From a7c3f8f51648b5ecff83d21981787b071b8a5f45 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Fri, 26 Jun 2026 14:28:26 +0200 Subject: [PATCH 1/7] Refactor: Pricing/Draft-Pfad als Single Source of Truth (Phase 1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Neuer services/pricing.py: PRICING-Dict + compute_savings() aus dem system-Router extrahiert; Router ist jetzt dünn (nur role_map + Aufruf). - /system/token-stats liefert zusätzlich das pricing-Dict → Frontend zeigt die Tarife daraus an statt sie im Text zu hartkodieren. - SPEC_DRAFT_MODEL_PATH in config.py (MC_SPEC_DRAFT_MODEL); llamaswap.py und migrate_config.py referenzieren die Konstante statt des doppelten Literals. - Ersparnis-Berechnung verhaltensneutral verifiziert (35,09 $ / 32,28 €). Co-Authored-By: Claude Opus 4.8 --- backend/config.py | 4 + backend/migrate_config.py | 8 +- backend/routers/system.py | 65 ++------- backend/services/llamaswap.py | 7 +- backend/services/pricing.py | 58 ++++++++ .../{index-CJm59bcL.js => index-BYvMJHPL.js} | 138 +++++++++--------- frontend/dist/index.html | 2 +- frontend/src/views/DashboardView.tsx | 6 +- 8 files changed, 155 insertions(+), 133 deletions(-) create mode 100644 backend/services/pricing.py rename frontend/dist/assets/{index-CJm59bcL.js => index-BYvMJHPL.js} (59%) diff --git a/backend/config.py b/backend/config.py index 6210a28..e5732ee 100644 --- a/backend/config.py +++ b/backend/config.py @@ -30,6 +30,10 @@ CMD_TEMPLATE = os.environ.get("MC_CMD_TEMPLATE", _DEFAULT_CMD_TEMPLATE) if "{model}" not in CMD_TEMPLATE: CMD_TEMPLATE = _DEFAULT_CMD_TEMPLATE DEFAULT_TTL = int(os.environ.get("MC_DEFAULT_TTL", "300")) +# Draft-Modell für Speculative Decoding (nur fast/coder, wenn vorhanden). Eine +# Quelle der Wahrheit für llamaswap.register_model + migrate_config. +SPEC_DRAFT_MODEL_PATH = os.environ.get( + "MC_SPEC_DRAFT_MODEL", f"{MODELS_DIR.as_posix()}/drafts/qwen2.5-1.5b-instruct-q4_k_m.gguf") # Env für HuggingFace-Downloads: XET deaktivieren (Hänger bei ~6 MB, siehe v1-Gotcha). HF_DOWNLOAD_ENV = {"HF_HUB_DISABLE_XET": "1"} diff --git a/backend/migrate_config.py b/backend/migrate_config.py index 4806d7c..74b6af3 100644 --- a/backend/migrate_config.py +++ b/backend/migrate_config.py @@ -5,7 +5,7 @@ from pathlib import Path sys.path.append(str(Path(__file__).resolve().parent)) from services.llamaswap import read_config, write_config -from config import CONFIG_PATH +from config import CONFIG_PATH, SPEC_DRAFT_MODEL_PATH def migrate(): print(f"Reading config from {CONFIG_PATH}...") @@ -15,9 +15,9 @@ def migrate(): cfg = read_config() models = cfg.get("models", {}) - - draft_path = "/srv/models/drafts/qwen2.5-1.5b-instruct-q4_k_m.gguf" - + + draft_path = SPEC_DRAFT_MODEL_PATH + for name, spec in models.items(): if not isinstance(spec, dict): continue diff --git a/backend/routers/system.py b/backend/routers/system.py index ccc56f6..8b50a5b 100644 --- a/backend/routers/system.py +++ b/backend/routers/system.py @@ -5,6 +5,7 @@ Lokal (Windows) schlagen die Shell-Befehle harmlos fehl und werden als Fehler zurückgegeben statt zu crashen. """ +import logging import os import subprocess @@ -15,8 +16,12 @@ from config import GATEWAY_URL, HERMES_API_URL, HERMES_WEBUI_URL, LLAMA_SWAP_URL from services import backup as backup_svc from services.agent import agent_status from services.gateway import gateway_reachable -from services.llamaswap import engine_reachable +from services.llamaswap import engine_reachable, list_models +from services.pricing import compute_savings from services.system import system_status +from services.token_stats import get_stats + +log = logging.getLogger(__name__) router = APIRouter(prefix="/api") @@ -90,64 +95,16 @@ def self_update() -> dict: return {"pull": pull, "reset": reset, "restart": restart_res} -from services.token_stats import get_stats -from services.llamaswap import list_models - @router.get("/system/token-stats") def token_stats() -> dict: - stats = get_stats() - p = stats.get("prompt_tokens", 0) - c = stats.get("completion_tokens", 0) - total = p + c - - # Map model IDs and aliases to their respective roles for pricing resolution - role_map = {} + """Token-Verbrauch + Cloud-Ersparnis. Logik im pricing-Service (SSoT).""" + # Rolle je Modell/Alias (lowercase) für die Tarif-Auflösung auflösen. + role_map: dict[str, str | None] = {} try: for m in list_models(): role_map[m["name"].lower()] = m.get("role") for alias in m.get("aliases", []): role_map[alias.lower()] = m.get("role") except Exception: - pass - - # Dynamic pricing tiers based on model class in June 2026 - PRICING = { - "heavy": (15.0, 75.0), - "coder": (3.0, 15.0), - "hermes": (1.0, 5.0), - "fast": (0.15, 0.60), - "scout": (0.15, 0.60), - "vision": (0.15, 0.60), - "reasoning": (0.15, 0.60), - } - - modeled_p = 0 - modeled_c = 0 - saved_usd = 0.0 - - models_data = stats.get("models") or {} - for m_name, m_tokens in models_data.items(): - mp = m_tokens.get("prompt", 0) - mc = m_tokens.get("completion", 0) - modeled_p += mp - modeled_c += mc - - role = role_map.get(m_name, m_name) - rate_in, rate_out = PRICING.get(role, (0.15, 0.60)) - saved_usd += (mp * rate_in + mc * rate_out) / 1_000_000.0 - - # Baseline/legacy tokens calculated at premium rates ($15.00 / $75.00) - # to preserve historical savings value prior to model-specific logging - baseline_p = max(0, p - modeled_p) - baseline_c = max(0, c - modeled_c) - saved_usd += (baseline_p * 15.0 + baseline_c * 75.0) / 1_000_000.0 - - saved_eur = saved_usd * 0.92 # 1 USD = 0.92 EUR - - return { - "prompt_tokens": p, - "completion_tokens": c, - "total_tokens": total, - "saved_usd": round(saved_usd, 2), - "saved_eur": round(saved_eur, 2) - } + log.warning("token_stats: list_models fehlgeschlagen, Tarife per Name", exc_info=True) + return compute_savings(get_stats(), role_map) diff --git a/backend/services/llamaswap.py b/backend/services/llamaswap.py index e9aa8c3..f1ae1cc 100644 --- a/backend/services/llamaswap.py +++ b/backend/services/llamaswap.py @@ -12,7 +12,7 @@ import re import httpx from ruamel.yaml.scalarstring import LiteralScalarString -from config import CMD_TEMPLATE, CONFIG_PATH, DEFAULT_TTL, LLAMA_SWAP_URL +from config import CMD_TEMPLATE, CONFIG_PATH, DEFAULT_TTL, LLAMA_SWAP_URL, SPEC_DRAFT_MODEL_PATH # Kanonische Rollen (vereinheitlicht ggü. v1: kein manager/reviewer mehr). ROLE_IDS = {"vision", "coder", "reasoning", "agent", "scout"} @@ -188,9 +188,8 @@ def register_model(model_path: str, role: str | None = None, ctx: int = 8192, if role_lower in ("fast", "coder"): if "--parallel" not in cmd: cmd += " --parallel 2" - draft_path = "/srv/models/drafts/qwen2.5-1.5b-instruct-q4_k_m.gguf" - if os.path.exists(draft_path) and "--spec-draft-model" not in cmd: - cmd += f" --spec-draft-model {draft_path}" + if os.path.exists(SPEC_DRAFT_MODEL_PATH) and "--spec-draft-model" not in cmd: + cmd += f" --spec-draft-model {SPEC_DRAFT_MODEL_PATH}" cfg.setdefault("models", {})[model_id] = { "cmd": LiteralScalarString(cmd + "\n"), diff --git a/backend/services/pricing.py b/backend/services/pricing.py new file mode 100644 index 0000000..bcad84c --- /dev/null +++ b/backend/services/pricing.py @@ -0,0 +1,58 @@ +"""Kosten-/Ersparnis-Berechnung für die Token-Statistik (eine Quelle der Wahrheit). + +Vergleicht die lokal verbrauchten Tokens gegen die Cloud-Listenpreise vergleichbarer +Modellklassen (Stand Juni 2026, USD pro 1M Tokens, in/out) und liefert die so +eingesparte Summe. Wird vom System-Router dünn aufgerufen. +""" + +import os + +# Cloud-Listenpreise je Rolle/Modellklasse: (input_usd_per_1M, output_usd_per_1M). +PRICING: dict[str, tuple[float, float]] = { + "heavy": (15.0, 75.0), + "coder": (3.0, 15.0), + "hermes": (1.0, 5.0), + "fast": (0.15, 0.60), + "scout": (0.15, 0.60), + "vision": (0.15, 0.60), + "reasoning": (0.15, 0.60), +} +# Tarif für nicht zuordenbare Tokens (Default-/Fallback-Klasse). +DEFAULT_RATE: tuple[float, float] = (0.15, 0.60) +# Baseline/Legacy-Tokens (vor modellspezifischem Logging) am Premium-Tarif bewerten, +# damit historische Ersparnis erhalten bleibt. +BASELINE_RATE: tuple[float, float] = PRICING["heavy"] +USD_TO_EUR = float(os.environ.get("MC_USD_TO_EUR", "0.92")) + + +def compute_savings(stats: dict, role_map: dict[str, str | None]) -> dict: + """Aggregiert Tokens und berechnet die Cloud-Ersparnis. + + role_map: Modell-/Alias-Name (lowercase) -> Rolle, zur Tarif-Auflösung. + """ + prompt = stats.get("prompt_tokens", 0) + completion = stats.get("completion_tokens", 0) + + modeled_p = modeled_c = 0 + saved_usd = 0.0 + for m_name, m_tokens in (stats.get("models") or {}).items(): + mp = m_tokens.get("prompt", 0) + mc = m_tokens.get("completion", 0) + modeled_p += mp + modeled_c += mc + role = role_map.get(m_name, m_name) + rate_in, rate_out = PRICING.get(role, DEFAULT_RATE) + saved_usd += (mp * rate_in + mc * rate_out) / 1_000_000.0 + + baseline_p = max(0, prompt - modeled_p) + baseline_c = max(0, completion - modeled_c) + saved_usd += (baseline_p * BASELINE_RATE[0] + baseline_c * BASELINE_RATE[1]) / 1_000_000.0 + + return { + "prompt_tokens": prompt, + "completion_tokens": completion, + "total_tokens": prompt + completion, + "saved_usd": round(saved_usd, 2), + "saved_eur": round(saved_usd * USD_TO_EUR, 2), + "pricing": {role: {"in": r[0], "out": r[1]} for role, r in PRICING.items()}, + } diff --git a/frontend/dist/assets/index-CJm59bcL.js b/frontend/dist/assets/index-BYvMJHPL.js similarity index 59% rename from frontend/dist/assets/index-CJm59bcL.js rename to frontend/dist/assets/index-BYvMJHPL.js index 422a9df..0be40f0 100644 --- a/frontend/dist/assets/index-CJm59bcL.js +++ b/frontend/dist/assets/index-BYvMJHPL.js @@ -1,4 +1,4 @@ -function Km(o,d){for(var a=0;ac[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const d=document.createElement("link").relList;if(d&&d.supports&&d.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function a(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(f){if(f.ep)return;f.ep=!0;const m=a(f);fetch(f.href,m)}})();function tf(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ya={exports:{}},ws={},Ja={exports:{}},je={};/** +function Km(o,d){for(var a=0;ac[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const d=document.createElement("link").relList;if(d&&d.supports&&d.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function a(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(f){if(f.ep)return;f.ep=!0;const m=a(f);fetch(f.href,m)}})();function tf(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ya={exports:{}},ws={},Ja={exports:{}},ke={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ function Km(o,d){for(var a=0;a>>1,v=W[j];if(0>>1;jf(K,G))oef(pe,K)?(W[j]=pe,W[oe]=G,j=oe):(W[j]=K,W[J]=G,j=J);else if(oef(pe,G))W[j]=pe,W[oe]=G,j=oe;else break e}}return ae}function f(W,ae){var G=W.sortIndex-ae.sortIndex;return G!==0?G:W.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;o.unstable_now=function(){return m.now()}}else{var h=Date,x=h.now();o.unstable_now=function(){return h.now()-x}}var E=[],b=[],k=1,M=null,A=3,I=!1,O=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Z(W){for(var ae=a(b);ae!==null;){if(ae.callback===null)c(b);else if(ae.startTime<=W)c(b),ae.sortIndex=ae.expirationTime,d(E,ae);else break;ae=a(b)}}function Y(W){if(S=!1,Z(W),!O)if(a(E)!==null)O=!0,Ne(H);else{var ae=a(b);ae!==null&&ke(Y,ae.startTime-W)}}function H(W,ae){O=!1,S&&(S=!1,_(ne),ne=-1),I=!0;var G=A;try{for(Z(ae),M=a(E);M!==null&&(!(M.expirationTime>ae)||W&&!ye());){var j=M.callback;if(typeof j=="function"){M.callback=null,A=M.priorityLevel;var v=j(M.expirationTime<=ae);ae=o.unstable_now(),typeof v=="function"?M.callback=v:M===a(E)&&c(E),Z(ae)}else c(E);M=a(E)}if(M!==null)var B=!0;else{var J=a(b);J!==null&&ke(Y,J.startTime-ae),B=!1}return B}finally{M=null,A=G,I=!1}}var T=!1,F=null,ne=-1,se=5,X=-1;function ye(){return!(o.unstable_now()-XW||125j?(W.sortIndex=G,d(b,W),a(E)===null&&W===a(b)&&(S?(_(ne),ne=-1):S=!0,ke(Y,G-j))):(W.sortIndex=v,d(E,W),O||I||(O=!0,Ne(H))),W},o.unstable_shouldYield=ye,o.unstable_wrapCallback=function(W){var ae=A;return function(){var G=A;A=ae;try{return W.apply(this,arguments)}finally{A=G}}}})(ti)),ti}var Nu;function Jm(){return Nu||(Nu=1,ei.exports=Ym()),ei.exports}/** + */var ku;function Ym(){return ku||(ku=1,(function(o){function d(H,ae){var K=H.length;H.push(ae);e:for(;0>>1,v=H[w];if(0>>1;wf(Q,K))oef(pe,Q)?(H[w]=pe,H[oe]=K,w=oe):(H[w]=Q,H[J]=K,w=J);else if(oef(pe,K))H[w]=pe,H[oe]=K,w=oe;else break e}}return ae}function f(H,ae){var K=H.sortIndex-ae.sortIndex;return K!==0?K:H.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;o.unstable_now=function(){return m.now()}}else{var h=Date,x=h.now();o.unstable_now=function(){return h.now()-x}}var C=[],b=[],j=1,P=null,L=3,F=!1,A=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Z(H){for(var ae=a(b);ae!==null;){if(ae.callback===null)c(b);else if(ae.startTime<=H)c(b),ae.sortIndex=ae.expirationTime,d(C,ae);else break;ae=a(b)}}function Y(H){if(N=!1,Z(H),!A)if(a(C)!==null)A=!0,Se(G);else{var ae=a(b);ae!==null&&Ne(Y,ae.startTime-H)}}function G(H,ae){A=!1,N&&(N=!1,E(ne),ne=-1),F=!0;var K=L;try{for(Z(ae),P=a(C);P!==null&&(!(P.expirationTime>ae)||H&&!be());){var w=P.callback;if(typeof w=="function"){P.callback=null,L=P.priorityLevel;var v=w(P.expirationTime<=ae);ae=o.unstable_now(),typeof v=="function"?P.callback=v:P===a(C)&&c(C),Z(ae)}else c(C);P=a(C)}if(P!==null)var V=!0;else{var J=a(b);J!==null&&Ne(Y,J.startTime-ae),V=!1}return V}finally{P=null,L=K,F=!1}}var I=!1,$=null,ne=-1,se=5,X=-1;function be(){return!(o.unstable_now()-XH||125w?(H.sortIndex=K,d(b,H),a(C)===null&&H===a(b)&&(N?(E(ne),ne=-1):N=!0,Ne(Y,K-w))):(H.sortIndex=v,d(C,H),A||F||(A=!0,Se(G))),H},o.unstable_shouldYield=be,o.unstable_wrapCallback=function(H){var ae=L;return function(){var K=L;L=ae;try{return H.apply(this,arguments)}finally{L=K}}}})(ti)),ti}var Nu;function Jm(){return Nu||(Nu=1,ei.exports=Ym()),ei.exports}/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ function Km(o,d){for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),E=Object.prototype.hasOwnProperty,b=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,k={},M={};function A(e){return E.call(M,e)?!0:E.call(k,e)?!1:b.test(e)?M[e]=!0:(k[e]=!0,!1)}function I(e,t,r,s){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function O(e,t,r,s){if(t===null||typeof t>"u"||I(e,t,r,s))return!0;if(s)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function S(e,t,r,s,l,i,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=u}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new S(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new S(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new S(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new S(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new S(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new S(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new S(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new S(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new S(e,5,!1,e.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function L(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(_,L);C[t]=new S(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_,L);C[t]=new S(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_,L);C[t]=new S(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new S(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new S(e,1,!1,e.toLowerCase(),null,!0,!0)});function Z(e,t,r,s){var l=C.hasOwnProperty(t)?C[t]:null;(l!==null?l.type!==0:s||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),C=Object.prototype.hasOwnProperty,b=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,j={},P={};function L(e){return C.call(P,e)?!0:C.call(j,e)?!1:b.test(e)?P[e]=!0:(j[e]=!0,!1)}function F(e,t,r,s){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function A(e,t,r,s){if(t===null||typeof t>"u"||F(e,t,r,s))return!0;if(s)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function N(e,t,r,s,l,i,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=u}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];S[t]=new N(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){S[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function D(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(E,D);S[t]=new N(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(E,D);S[t]=new N(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(E,D);S[t]=new N(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function Z(e,t,r,s){var l=S.hasOwnProperty(t)?S[t]:null;(l!==null?l.type!==0:s||!(2g||l[u]!==i[g]){var y=` -`+l[u].replace(" at new "," at ");return e.displayName&&y.includes("")&&(y=y.replace("",e.displayName)),y}while(1<=u&&0<=g);break}}}finally{B=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?v(e):""}function K(e){switch(e.tag){case 5:return v(e.type);case 16:return v("Lazy");case 13:return v("Suspense");case 19:return v("SuspenseList");case 0:case 2:case 15:return e=J(e.type,!1),e;case 11:return e=J(e.type.render,!1),e;case 1:return e=J(e.type,!0),e;default:return""}}function oe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case F:return"Fragment";case T:return"Portal";case se:return"Profiler";case ne:return"StrictMode";case Pe:return"Suspense";case _e:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ye:return(e.displayName||"Context")+".Consumer";case X:return(e._context.displayName||"Context")+".Provider";case ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Me:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case Ne:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function me(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function w(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Q(e){var t=w(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var l=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(u){s=""+u,i.call(this,u)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(u){s=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Le(e){e._valueTracker||(e._valueTracker=Q(e))}function $t(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),s="";return e&&(s=w(e)?e.checked?"true":"false":e.value),e=s,e!==r?(t.setValue(e),!0):!1}function lt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function nt(e,t){var r=t.checked;return G({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function On(e,t){var r=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;r=me(t.value!=null?t.value:r),e._wrapperState={initialChecked:s,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Tn(e,t){t=t.checked,t!=null&&Z(e,"checked",t,!1)}function qr(e,t){Tn(e,t);var r=me(t.value),s=t.type;if(r!=null)s==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Zr(e,t.type,r):t.hasOwnProperty("defaultValue")&&Zr(e,t.type,me(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function er(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Zr(e,t,r){(t!=="number"||lt(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var tr=Array.isArray;function Ut(e,t,r,s){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=ze.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bt(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Vt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},il=["Webkit","ms","Moz","O"];Object.keys(Vt).forEach(function(e){il.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Vt[t]=Vt[e]})});function Li(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Vt.hasOwnProperty(e)&&Vt[e]?(""+t).trim():t+"px"}function Ai(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var s=r.indexOf("--")===0,l=Li(r,t[r],s);r==="float"&&(r="cssFloat"),s?e.setProperty(r,l):e[r]=l}}var Jf=G({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dl(e,t){if(t){if(Jf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function cl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ul=null;function fl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pl=null,Jr=null,Xr=null;function Oi(e){if(e=ls(e)){if(typeof pl!="function")throw Error(a(280));var t=e.stateNode;t&&(t=eo(t),pl(e.stateNode,e.type,t))}}function Ti(e){Jr?Xr?Xr.push(e):Xr=[e]:Jr=e}function Ii(){if(Jr){var e=Jr,t=Xr;if(Xr=Jr=null,Oi(e),t)for(e=0;e>>=0,e===0?32:31-(dp(e)/cp|0)|0}var Os=64,Ts=4194304;function Bn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Is(e,t){var r=e.pendingLanes;if(r===0)return 0;var s=0,l=e.suspendedLanes,i=e.pingedLanes,u=r&268435455;if(u!==0){var g=u&~l;g!==0?s=Bn(g):(i&=u,i!==0&&(s=Bn(i)))}else u=r&~l,u!==0?s=Bn(u):i!==0&&(s=Bn(i));if(s===0)return 0;if(t!==0&&t!==s&&(t&l)===0&&(l=s&-s,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if((s&4)!==0&&(s|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0r;r++)t.push(e);return t}function Vn(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=r}function mp(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=Yn),fd=" ",pd=!1;function md(e,t){switch(e){case"keyup":return Bp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var rn=!1;function Wp(e,t){switch(e){case"compositionend":return hd(t);case"keypress":return t.which!==32?null:(pd=!0,fd);case"textInput":return e=t.data,e===fd&&pd?null:e;default:return null}}function Hp(e,t){if(rn)return e==="compositionend"||!Rl&&md(e,t)?(e=ld(),Vs=Sl=lr=null,rn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=jd(r)}}function Nd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sd(){for(var e=window,t=lt();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=lt(e.document)}return t}function Ll(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function em(e){var t=Sd(),r=e.focusedElem,s=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Nd(r.ownerDocument.documentElement,r)){if(s!==null&&Ll(r)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=r.textContent.length,i=Math.min(s.start,l);s=s.end===void 0?i:Math.min(s.end,l),!e.extend&&i>s&&(l=s,s=i,i=l),l=kd(r,i);var u=kd(r,s);l&&u&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,nn=null,Al=null,ts=null,Ol=!1;function Cd(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ol||nn==null||nn!==lt(s)||(s=nn,"selectionStart"in s&&Ll(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ts&&es(ts,s)||(ts=s,s=Ys(Al,"onSelect"),0dn||(e.current=Ql[dn],Ql[dn]=null,dn--)}function De(e,t){dn++,Ql[dn]=e.current,e.current=t}var cr={},Xe=dr(cr),at=dr(!1),Pr=cr;function cn(e,t){var r=e.type.contextTypes;if(!r)return cr;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in r)l[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function it(e){return e=e.childContextTypes,e!=null}function to(){Oe(at),Oe(Xe)}function Ud(e,t,r){if(Xe.current!==cr)throw Error(a(168));De(Xe,t),De(at,r)}function Bd(e,t,r){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(a(108,pe(e)||"Unknown",l));return G({},r,s)}function ro(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cr,Pr=Xe.current,De(Xe,e),De(at,at.current),!0}function Vd(e,t,r){var s=e.stateNode;if(!s)throw Error(a(169));r?(e=Bd(e,t,Pr),s.__reactInternalMemoizedMergedChildContext=e,Oe(at),Oe(Xe),De(Xe,e)):Oe(at),De(at,r)}var Ht=null,no=!1,ql=!1;function Wd(e){Ht===null?Ht=[e]:Ht.push(e)}function fm(e){no=!0,Wd(e)}function ur(){if(!ql&&Ht!==null){ql=!0;var e=0,t=Re;try{var r=Ht;for(Re=1;e>=u,l-=u,Gt=1<<32-St(t)+l|r<be?(qe=xe,xe=null):qe=xe.sibling;var Ee=$(P,xe,R[be],q);if(Ee===null){xe===null&&(xe=qe);break}e&&xe&&Ee.alternate===null&&t(P,xe),N=i(Ee,N,be),he===null?ue=Ee:he.sibling=Ee,he=Ee,xe=qe}if(be===R.length)return r(P,xe),Ie&&Rr(P,be),ue;if(xe===null){for(;bebe?(qe=xe,xe=null):qe=xe.sibling;var br=$(P,xe,Ee.value,q);if(br===null){xe===null&&(xe=qe);break}e&&xe&&br.alternate===null&&t(P,xe),N=i(br,N,be),he===null?ue=br:he.sibling=br,he=br,xe=qe}if(Ee.done)return r(P,xe),Ie&&Rr(P,be),ue;if(xe===null){for(;!Ee.done;be++,Ee=R.next())Ee=V(P,Ee.value,q),Ee!==null&&(N=i(Ee,N,be),he===null?ue=Ee:he.sibling=Ee,he=Ee);return Ie&&Rr(P,be),ue}for(xe=s(P,xe);!Ee.done;be++,Ee=R.next())Ee=te(xe,P,be,Ee.value,q),Ee!==null&&(e&&Ee.alternate!==null&&xe.delete(Ee.key===null?be:Ee.key),N=i(Ee,N,be),he===null?ue=Ee:he.sibling=Ee,he=Ee);return e&&xe.forEach(function(Gm){return t(P,Gm)}),Ie&&Rr(P,be),ue}function Ve(P,N,R,q){if(typeof R=="object"&&R!==null&&R.type===F&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case H:e:{for(var ue=R.key,he=N;he!==null;){if(he.key===ue){if(ue=R.type,ue===F){if(he.tag===7){r(P,he.sibling),N=l(he,R.props.children),N.return=P,P=N;break e}}else if(he.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===Ne&&Zd(ue)===he.type){r(P,he.sibling),N=l(he,R.props),N.ref=as(P,he,R),N.return=P,P=N;break e}r(P,he);break}else t(P,he);he=he.sibling}R.type===F?(N=Fr(R.props.children,P.mode,q,R.key),N.return=P,P=N):(q=zo(R.type,R.key,R.props,null,P.mode,q),q.ref=as(P,N,R),q.return=P,P=q)}return u(P);case T:e:{for(he=R.key;N!==null;){if(N.key===he)if(N.tag===4&&N.stateNode.containerInfo===R.containerInfo&&N.stateNode.implementation===R.implementation){r(P,N.sibling),N=l(N,R.children||[]),N.return=P,P=N;break e}else{r(P,N);break}else t(P,N);N=N.sibling}N=Ga(R,P.mode,q),N.return=P,P=N}return u(P);case Ne:return he=R._init,Ve(P,N,he(R._payload),q)}if(tr(R))return ie(P,N,R,q);if(ae(R))return de(P,N,R,q);ao(P,R)}return typeof R=="string"&&R!==""||typeof R=="number"?(R=""+R,N!==null&&N.tag===6?(r(P,N.sibling),N=l(N,R),N.return=P,P=N):(r(P,N),N=Ha(R,P.mode,q),N.return=P,P=N),u(P)):r(P,N)}return Ve}var mn=Yd(!0),Jd=Yd(!1),io=dr(null),co=null,hn=null,ta=null;function ra(){ta=hn=co=null}function na(e){var t=io.current;Oe(io),e._currentValue=t}function sa(e,t,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===r)break;e=e.return}}function xn(e,t){co=e,ta=hn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(dt=!0),e.firstContext=null)}function bt(e){var t=e._currentValue;if(ta!==e)if(e={context:e,memoizedValue:t,next:null},hn===null){if(co===null)throw Error(a(308));hn=e,co.dependencies={lanes:0,firstContext:e}}else hn=hn.next=e;return t}var zr=null;function oa(e){zr===null?zr=[e]:zr.push(e)}function Xd(e,t,r,s){var l=t.interleaved;return l===null?(r.next=r,oa(t)):(r.next=l.next,l.next=r),t.interleaved=r,Qt(e,s)}function Qt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var fr=!1;function la(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ec(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function qt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pr(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ce&2)!==0){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,Qt(e,r)}return l=s.interleaved,l===null?(t.next=t,oa(s)):(t.next=l.next,l.next=t),s.interleaved=t,Qt(e,r)}function uo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,bl(e,r)}}function tc(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var l=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var u={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?l=i=u:i=i.next=u,r=r.next}while(r!==null);i===null?l=i=t:i=i.next=t}else l=i=t;r={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function fo(e,t,r,s){var l=e.updateQueue;fr=!1;var i=l.firstBaseUpdate,u=l.lastBaseUpdate,g=l.shared.pending;if(g!==null){l.shared.pending=null;var y=g,D=y.next;y.next=null,u===null?i=D:u.next=D,u=y;var U=e.alternate;U!==null&&(U=U.updateQueue,g=U.lastBaseUpdate,g!==u&&(g===null?U.firstBaseUpdate=D:g.next=D,U.lastBaseUpdate=y))}if(i!==null){var V=l.baseState;u=0,U=D=y=null,g=i;do{var $=g.lane,te=g.eventTime;if((s&$)===$){U!==null&&(U=U.next={eventTime:te,lane:0,tag:g.tag,payload:g.payload,callback:g.callback,next:null});e:{var ie=e,de=g;switch($=t,te=r,de.tag){case 1:if(ie=de.payload,typeof ie=="function"){V=ie.call(te,V,$);break e}V=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=de.payload,$=typeof ie=="function"?ie.call(te,V,$):ie,$==null)break e;V=G({},V,$);break e;case 2:fr=!0}}g.callback!==null&&g.lane!==0&&(e.flags|=64,$=l.effects,$===null?l.effects=[g]:$.push(g))}else te={eventTime:te,lane:$,tag:g.tag,payload:g.payload,callback:g.callback,next:null},U===null?(D=U=te,y=V):U=U.next=te,u|=$;if(g=g.next,g===null){if(g=l.shared.pending,g===null)break;$=g,g=$.next,$.next=null,l.lastBaseUpdate=$,l.shared.pending=null}}while(!0);if(U===null&&(y=V),l.baseState=y,l.firstBaseUpdate=D,l.lastBaseUpdate=U,t=l.shared.interleaved,t!==null){l=t;do u|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Ar|=u,e.lanes=u,e.memoizedState=V}}function rc(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var s=ua.transition;ua.transition={};try{e(!1),t()}finally{Re=r,ua.transition=s}}function wc(){return wt().memoizedState}function xm(e,t,r){var s=gr(e);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},jc(e))kc(t,r);else if(r=Xd(e,t,r,s),r!==null){var l=ot();Rt(r,e,s,l),Nc(r,t,s)}}function gm(e,t,r){var s=gr(e),l={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(jc(e))kc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var u=t.lastRenderedState,g=i(u,r);if(l.hasEagerState=!0,l.eagerState=g,Ct(g,u)){var y=t.interleaved;y===null?(l.next=l,oa(t)):(l.next=y.next,y.next=l),t.interleaved=l;return}}catch{}finally{}r=Xd(e,t,l,s),r!==null&&(l=ot(),Rt(r,e,s,l),Nc(r,t,s))}}function jc(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function kc(e,t){us=ho=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Nc(e,t,r){if((r&4194240)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,bl(e,r)}}var vo={readContext:bt,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useInsertionEffect:et,useLayoutEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useMutableSource:et,useSyncExternalStore:et,useId:et,unstable_isNewReconciler:!1},vm={readContext:bt,useCallback:function(e,t){return Ot().memoizedState=[e,t===void 0?null:t],e},useContext:bt,useEffect:pc,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,xo(4194308,4,xc.bind(null,t,e),r)},useLayoutEffect:function(e,t){return xo(4194308,4,e,t)},useInsertionEffect:function(e,t){return xo(4,2,e,t)},useMemo:function(e,t){var r=Ot();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var s=Ot();return t=r!==void 0?r(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=xm.bind(null,$e,e),[s.memoizedState,e]},useRef:function(e){var t=Ot();return e={current:e},t.memoizedState=e},useState:uc,useDebugValue:va,useDeferredValue:function(e){return Ot().memoizedState=e},useTransition:function(){var e=uc(!1),t=e[0];return e=hm.bind(null,e[1]),Ot().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var s=$e,l=Ot();if(Ie){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Qe===null)throw Error(a(349));(Lr&30)!==0||lc(s,t,r)}l.memoizedState=r;var i={value:r,getSnapshot:t};return l.queue=i,pc(ic.bind(null,s,i,e),[e]),s.flags|=2048,ms(9,ac.bind(null,s,i,r,t),void 0,null),r},useId:function(){var e=Ot(),t=Qe.identifierPrefix;if(Ie){var r=Kt,s=Gt;r=(s&~(1<<32-St(s)-1)).toString(32)+r,t=":"+t+"R"+r,r=fs++,0")&&(y=y.replace("",e.displayName)),y}while(1<=u&&0<=g);break}}}finally{V=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?v(e):""}function Q(e){switch(e.tag){case 5:return v(e.type);case 16:return v("Lazy");case 13:return v("Suspense");case 19:return v("SuspenseList");case 0:case 2:case 15:return e=J(e.type,!1),e;case 11:return e=J(e.type.render,!1),e;case 1:return e=J(e.type,!0),e;default:return""}}function oe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $:return"Fragment";case I:return"Portal";case se:return"Profiler";case ne:return"StrictMode";case Me:return"Suspense";case Pe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case be:return(e.displayName||"Context")+".Consumer";case X:return(e._context.displayName||"Context")+".Provider";case ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function me(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function T(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function O(e){var t=T(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var l=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(u){s=""+u,i.call(this,u)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(u){s=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ge(e){e._valueTracker||(e._valueTracker=O(e))}function Xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),s="";return e&&(s=T(e)?e.checked?"true":"false":e.value),e=s,e!==r?(t.setValue(e),!0):!1}function ft(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function pt(e,t){var r=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function mt(e,t){var r=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;r=me(t.value!=null?t.value:r),e._wrapperState={initialChecked:s,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Tn(e,t){t=t.checked,t!=null&&Z(e,"checked",t,!1)}function Zr(e,t){Tn(e,t);var r=me(t.value),s=t.type;if(r!=null)s==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Yr(e,t.type,r):t.hasOwnProperty("defaultValue")&&Yr(e,t.type,me(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function tr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Yr(e,t,r){(t!=="number"||ft(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var rr=Array.isArray;function Bt(e,t,r,s){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vt(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Wt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},il=["Webkit","ms","Moz","O"];Object.keys(Wt).forEach(function(e){il.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Wt[t]=Wt[e]})});function Li(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Wt.hasOwnProperty(e)&&Wt[e]?(""+t).trim():t+"px"}function Ai(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var s=r.indexOf("--")===0,l=Li(r,t[r],s);r==="float"&&(r="cssFloat"),s?e.setProperty(r,l):e[r]=l}}var Jf=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dl(e,t){if(t){if(Jf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function cl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ul=null;function fl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pl=null,Xr=null,en=null;function Oi(e){if(e=ls(e)){if(typeof pl!="function")throw Error(a(280));var t=e.stateNode;t&&(t=eo(t),pl(e.stateNode,e.type,t))}}function Ti(e){Xr?en?en.push(e):en=[e]:Xr=e}function Ii(){if(Xr){var e=Xr,t=en;if(en=Xr=null,Oi(e),t)for(e=0;e>>=0,e===0?32:31-(dp(e)/cp|0)|0}var Os=64,Ts=4194304;function Bn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Is(e,t){var r=e.pendingLanes;if(r===0)return 0;var s=0,l=e.suspendedLanes,i=e.pingedLanes,u=r&268435455;if(u!==0){var g=u&~l;g!==0?s=Bn(g):(i&=u,i!==0&&(s=Bn(i)))}else u=r&~l,u!==0?s=Bn(u):i!==0&&(s=Bn(i));if(s===0)return 0;if(t!==0&&t!==s&&(t&l)===0&&(l=s&-s,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if((s&4)!==0&&(s|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0r;r++)t.push(e);return t}function Vn(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=r}function mp(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=Yn),fd=" ",pd=!1;function md(e,t){switch(e){case"keyup":return Bp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var nn=!1;function Wp(e,t){switch(e){case"compositionend":return hd(t);case"keypress":return t.which!==32?null:(pd=!0,fd);case"textInput":return e=t.data,e===fd&&pd?null:e;default:return null}}function Hp(e,t){if(nn)return e==="compositionend"||!Rl&&md(e,t)?(e=ld(),Vs=Sl=ar=null,nn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=jd(r)}}function Nd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sd(){for(var e=window,t=ft();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ft(e.document)}return t}function Ll(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function em(e){var t=Sd(),r=e.focusedElem,s=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Nd(r.ownerDocument.documentElement,r)){if(s!==null&&Ll(r)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=r.textContent.length,i=Math.min(s.start,l);s=s.end===void 0?i:Math.min(s.end,l),!e.extend&&i>s&&(l=s,s=i,i=l),l=kd(r,i);var u=kd(r,s);l&&u&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,sn=null,Al=null,ts=null,Ol=!1;function Cd(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ol||sn==null||sn!==ft(s)||(s=sn,"selectionStart"in s&&Ll(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ts&&es(ts,s)||(ts=s,s=Ys(Al,"onSelect"),0cn||(e.current=Ql[cn],Ql[cn]=null,cn--)}function Le(e,t){cn++,Ql[cn]=e.current,e.current=t}var ur={},et=cr(ur),lt=cr(!1),Mr=ur;function un(e,t){var r=e.type.contextTypes;if(!r)return ur;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in r)l[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function at(e){return e=e.childContextTypes,e!=null}function to(){Oe(lt),Oe(et)}function Ud(e,t,r){if(et.current!==ur)throw Error(a(168));Le(et,t),Le(lt,r)}function Bd(e,t,r){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(a(108,pe(e)||"Unknown",l));return K({},r,s)}function ro(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ur,Mr=et.current,Le(et,e),Le(lt,lt.current),!0}function Vd(e,t,r){var s=e.stateNode;if(!s)throw Error(a(169));r?(e=Bd(e,t,Mr),s.__reactInternalMemoizedMergedChildContext=e,Oe(lt),Oe(et),Le(et,e)):Oe(lt),Le(lt,r)}var Gt=null,no=!1,ql=!1;function Wd(e){Gt===null?Gt=[e]:Gt.push(e)}function fm(e){no=!0,Wd(e)}function fr(){if(!ql&&Gt!==null){ql=!0;var e=0,t=ze;try{var r=Gt;for(ze=1;e>=u,l-=u,Kt=1<<32-Et(t)+l|r<we?(qe=xe,xe=null):qe=xe.sibling;var _e=U(_,xe,M[we],q);if(_e===null){xe===null&&(xe=qe);break}e&&xe&&_e.alternate===null&&t(_,xe),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e,xe=qe}if(we===M.length)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;wewe?(qe=xe,xe=null):qe=xe.sibling;var wr=U(_,xe,_e.value,q);if(wr===null){xe===null&&(xe=qe);break}e&&xe&&wr.alternate===null&&t(_,xe),k=i(wr,k,we),he===null?ue=wr:he.sibling=wr,he=wr,xe=qe}if(_e.done)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;!_e.done;we++,_e=M.next())_e=W(_,_e.value,q),_e!==null&&(k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return Ie&&zr(_,we),ue}for(xe=s(_,xe);!_e.done;we++,_e=M.next())_e=te(xe,_,we,_e.value,q),_e!==null&&(e&&_e.alternate!==null&&xe.delete(_e.key===null?we:_e.key),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return e&&xe.forEach(function(Gm){return t(_,Gm)}),Ie&&zr(_,we),ue}function Ve(_,k,M,q){if(typeof M=="object"&&M!==null&&M.type===$&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case G:e:{for(var ue=M.key,he=k;he!==null;){if(he.key===ue){if(ue=M.type,ue===$){if(he.tag===7){r(_,he.sibling),k=l(he,M.props.children),k.return=_,_=k;break e}}else if(he.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===Se&&Zd(ue)===he.type){r(_,he.sibling),k=l(he,M.props),k.ref=as(_,he,M),k.return=_,_=k;break e}r(_,he);break}else t(_,he);he=he.sibling}M.type===$?(k=$r(M.props.children,_.mode,q,M.key),k.return=_,_=k):(q=zo(M.type,M.key,M.props,null,_.mode,q),q.ref=as(_,k,M),q.return=_,_=q)}return u(_);case I:e:{for(he=M.key;k!==null;){if(k.key===he)if(k.tag===4&&k.stateNode.containerInfo===M.containerInfo&&k.stateNode.implementation===M.implementation){r(_,k.sibling),k=l(k,M.children||[]),k.return=_,_=k;break e}else{r(_,k);break}else t(_,k);k=k.sibling}k=Ga(M,_.mode,q),k.return=_,_=k}return u(_);case Se:return he=M._init,Ve(_,k,he(M._payload),q)}if(rr(M))return ie(_,k,M,q);if(ae(M))return de(_,k,M,q);ao(_,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,k!==null&&k.tag===6?(r(_,k.sibling),k=l(k,M),k.return=_,_=k):(r(_,k),k=Ha(M,_.mode,q),k.return=_,_=k),u(_)):r(_,k)}return Ve}var hn=Yd(!0),Jd=Yd(!1),io=cr(null),co=null,xn=null,ta=null;function ra(){ta=xn=co=null}function na(e){var t=io.current;Oe(io),e._currentValue=t}function sa(e,t,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===r)break;e=e.return}}function gn(e,t){co=e,ta=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(it=!0),e.firstContext=null)}function jt(e){var t=e._currentValue;if(ta!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(co===null)throw Error(a(308));xn=e,co.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var Dr=null;function oa(e){Dr===null?Dr=[e]:Dr.push(e)}function Xd(e,t,r,s){var l=t.interleaved;return l===null?(r.next=r,oa(t)):(r.next=l.next,l.next=r),t.interleaved=r,qt(e,s)}function qt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var pr=!1;function la(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ec(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Zt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mr(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ee&2)!==0){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,qt(e,r)}return l=s.interleaved,l===null?(t.next=t,oa(s)):(t.next=l.next,l.next=t),s.interleaved=t,qt(e,r)}function uo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,bl(e,r)}}function tc(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var l=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var u={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?l=i=u:i=i.next=u,r=r.next}while(r!==null);i===null?l=i=t:i=i.next=t}else l=i=t;r={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function fo(e,t,r,s){var l=e.updateQueue;pr=!1;var i=l.firstBaseUpdate,u=l.lastBaseUpdate,g=l.shared.pending;if(g!==null){l.shared.pending=null;var y=g,z=y.next;y.next=null,u===null?i=z:u.next=z,u=y;var B=e.alternate;B!==null&&(B=B.updateQueue,g=B.lastBaseUpdate,g!==u&&(g===null?B.firstBaseUpdate=z:g.next=z,B.lastBaseUpdate=y))}if(i!==null){var W=l.baseState;u=0,B=z=y=null,g=i;do{var U=g.lane,te=g.eventTime;if((s&U)===U){B!==null&&(B=B.next={eventTime:te,lane:0,tag:g.tag,payload:g.payload,callback:g.callback,next:null});e:{var ie=e,de=g;switch(U=t,te=r,de.tag){case 1:if(ie=de.payload,typeof ie=="function"){W=ie.call(te,W,U);break e}W=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=de.payload,U=typeof ie=="function"?ie.call(te,W,U):ie,U==null)break e;W=K({},W,U);break e;case 2:pr=!0}}g.callback!==null&&g.lane!==0&&(e.flags|=64,U=l.effects,U===null?l.effects=[g]:U.push(g))}else te={eventTime:te,lane:U,tag:g.tag,payload:g.payload,callback:g.callback,next:null},B===null?(z=B=te,y=W):B=B.next=te,u|=U;if(g=g.next,g===null){if(g=l.shared.pending,g===null)break;U=g,g=U.next,U.next=null,l.lastBaseUpdate=U,l.shared.pending=null}}while(!0);if(B===null&&(y=W),l.baseState=y,l.firstBaseUpdate=z,l.lastBaseUpdate=B,t=l.shared.interleaved,t!==null){l=t;do u|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Or|=u,e.lanes=u,e.memoizedState=W}}function rc(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var s=ua.transition;ua.transition={};try{e(!1),t()}finally{ze=r,ua.transition=s}}function wc(){return kt().memoizedState}function xm(e,t,r){var s=vr(e);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},jc(e))kc(t,r);else if(r=Xd(e,t,r,s),r!==null){var l=ot();Dt(r,e,s,l),Nc(r,t,s)}}function gm(e,t,r){var s=vr(e),l={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(jc(e))kc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var u=t.lastRenderedState,g=i(u,r);if(l.hasEagerState=!0,l.eagerState=g,_t(g,u)){var y=t.interleaved;y===null?(l.next=l,oa(t)):(l.next=y.next,y.next=l),t.interleaved=l;return}}catch{}finally{}r=Xd(e,t,l,s),r!==null&&(l=ot(),Dt(r,e,s,l),Nc(r,t,s))}}function jc(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function kc(e,t){us=ho=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Nc(e,t,r){if((r&4194240)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,bl(e,r)}}var vo={readContext:jt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},vm={readContext:jt,useCallback:function(e,t){return It().memoizedState=[e,t===void 0?null:t],e},useContext:jt,useEffect:pc,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,xo(4194308,4,xc.bind(null,t,e),r)},useLayoutEffect:function(e,t){return xo(4194308,4,e,t)},useInsertionEffect:function(e,t){return xo(4,2,e,t)},useMemo:function(e,t){var r=It();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var s=It();return t=r!==void 0?r(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=xm.bind(null,$e,e),[s.memoizedState,e]},useRef:function(e){var t=It();return e={current:e},t.memoizedState=e},useState:uc,useDebugValue:va,useDeferredValue:function(e){return It().memoizedState=e},useTransition:function(){var e=uc(!1),t=e[0];return e=hm.bind(null,e[1]),It().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var s=$e,l=It();if(Ie){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Qe===null)throw Error(a(349));(Ar&30)!==0||lc(s,t,r)}l.memoizedState=r;var i={value:r,getSnapshot:t};return l.queue=i,pc(ic.bind(null,s,i,e),[e]),s.flags|=2048,ms(9,ac.bind(null,s,i,r,t),void 0,null),r},useId:function(){var e=It(),t=Qe.identifierPrefix;if(Ie){var r=Qt,s=Kt;r=(s&~(1<<32-Et(s)-1)).toString(32)+r,t=":"+t+"R"+r,r=fs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=u.createElement(r,{is:s.is}):(e=u.createElement(r),r==="select"&&(u=e,s.multiple?u.multiple=!0:s.size&&(u.size=s.size))):e=u.createElementNS(e,r),e[Lt]=t,e[os]=s,Wc(e,t,!1,!1),t.stateNode=e;e:{switch(u=cl(r,s),r){case"dialog":Ae("cancel",e),Ae("close",e),l=s;break;case"iframe":case"object":case"embed":Ae("load",e),l=s;break;case"video":case"audio":for(l=0;lwn&&(t.flags|=128,s=!0,hs(i,!1),t.lanes=4194304)}else{if(!s)if(e=po(u),e!==null){if(t.flags|=128,s=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),hs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!u.alternate&&!Ie)return tt(t),null}else 2*Be()-i.renderingStartTime>wn&&r!==1073741824&&(t.flags|=128,s=!0,hs(i,!1),t.lanes=4194304);i.isBackwards?(u.sibling=t.child,t.child=u):(r=i.last,r!==null?r.sibling=u:t.child=u,i.last=u)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Be(),t.sibling=null,r=Fe.current,De(Fe,s?r&1|2:r&1),t):(tt(t),null);case 22:case 23:return Ba(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&(t.mode&1)!==0?(xt&1073741824)!==0&&(tt(t),t.subtreeFlags&6&&(t.flags|=8192)):tt(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Cm(e,t){switch(Yl(t),t.tag){case 1:return it(t.type)&&to(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gn(),Oe(at),Oe(Xe),ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return ia(t),null;case 13:if(Oe(Fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));pn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oe(Fe),null;case 4:return gn(),null;case 10:return na(t.type._context),null;case 22:case 23:return Ba(),null;case 24:return null;default:return null}}var jo=!1,rt=!1,Em=typeof WeakSet=="function"?WeakSet:Set,le=null;function yn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){Ue(e,t,s)}else r.current=null}function Ma(e,t,r){try{r()}catch(s){Ue(e,t,s)}}var Kc=!1;function _m(e,t){if(Bl=Us,e=Sd(),Ll(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var l=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var u=0,g=-1,y=-1,D=0,U=0,V=e,$=null;t:for(;;){for(var te;V!==r||l!==0&&V.nodeType!==3||(g=u+l),V!==i||s!==0&&V.nodeType!==3||(y=u+s),V.nodeType===3&&(u+=V.nodeValue.length),(te=V.firstChild)!==null;)$=V,V=te;for(;;){if(V===e)break t;if($===r&&++D===l&&(g=u),$===i&&++U===s&&(y=u),(te=V.nextSibling)!==null)break;V=$,$=V.parentNode}V=te}r=g===-1||y===-1?null:{start:g,end:y}}else r=null}r=r||{start:0,end:0}}else r=null;for(Vl={focusedElem:e,selectionRange:r},Us=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var de=ie.memoizedProps,Ve=ie.memoizedState,P=t.stateNode,N=P.getSnapshotBeforeUpdate(t.elementType===t.type?de:_t(t.type,de),Ve);P.__reactInternalSnapshotBeforeUpdate=N}break;case 3:var R=t.stateNode.containerInfo;R.nodeType===1?R.textContent="":R.nodeType===9&&R.documentElement&&R.removeChild(R.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(q){Ue(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ie=Kc,Kc=!1,ie}function xs(e,t,r){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Ma(t,r,i)}l=l.next}while(l!==s)}}function ko(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var s=r.create;r.destroy=s()}r=r.next}while(r!==t)}}function Ra(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Qc(e){var t=e.alternate;t!==null&&(e.alternate=null,Qc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Lt],delete t[os],delete t[Kl],delete t[cm],delete t[um])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qc(e){return e.tag===5||e.tag===3||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function za(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Xs));else if(s!==4&&(e=e.child,e!==null))for(za(e,t,r),e=e.sibling;e!==null;)za(e,t,r),e=e.sibling}function Da(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Da(e,t,r),e=e.sibling;e!==null;)Da(e,t,r),e=e.sibling}var Ze=null,Pt=!1;function mr(e,t,r){for(r=r.child;r!==null;)Yc(e,t,r),r=r.sibling}function Yc(e,t,r){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(As,r)}catch{}switch(r.tag){case 5:rt||yn(r,t);case 6:var s=Ze,l=Pt;Ze=null,mr(e,t,r),Ze=s,Pt=l,Ze!==null&&(Pt?(e=Ze,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ze.removeChild(r.stateNode));break;case 18:Ze!==null&&(Pt?(e=Ze,r=r.stateNode,e.nodeType===8?Gl(e.parentNode,r):e.nodeType===1&&Gl(e,r),Qn(e)):Gl(Ze,r.stateNode));break;case 4:s=Ze,l=Pt,Ze=r.stateNode.containerInfo,Pt=!0,mr(e,t,r),Ze=s,Pt=l;break;case 0:case 11:case 14:case 15:if(!rt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var i=l,u=i.destroy;i=i.tag,u!==void 0&&((i&2)!==0||(i&4)!==0)&&Ma(r,t,u),l=l.next}while(l!==s)}mr(e,t,r);break;case 1:if(!rt&&(yn(r,t),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(g){Ue(r,t,g)}mr(e,t,r);break;case 21:mr(e,t,r);break;case 22:r.mode&1?(rt=(s=rt)||r.memoizedState!==null,mr(e,t,r),rt=s):mr(e,t,r);break;default:mr(e,t,r)}}function Jc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Em),t.forEach(function(s){var l=Tm.bind(null,e,s);r.has(s)||(r.add(s),s.then(l,l))})}}function Mt(e,t){var r=t.deletions;if(r!==null)for(var s=0;sl&&(l=u),s&=~i}if(s=l,s=Be()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Mm(s/1960))-s,10e?16:e,xr===null)var s=!1;else{if(e=xr,xr=null,_o=0,(Ce&6)!==0)throw Error(a(331));var l=Ce;for(Ce|=4,le=e.current;le!==null;){var i=le,u=i.child;if((le.flags&16)!==0){var g=i.deletions;if(g!==null){for(var y=0;yBe()-Oa?Tr(e,0):Aa|=r),ut(e,t)}function uu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Ts,Ts<<=1,(Ts&130023424)===0&&(Ts=4194304)));var r=ot();e=Qt(e,t),e!==null&&(Vn(e,t,r),ut(e,r))}function Om(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),uu(e,r)}function Tm(e,t){var r=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(r=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(a(314))}s!==null&&s.delete(t),uu(e,r)}var fu;fu=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||at.current)dt=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return dt=!1,Nm(e,t,r);dt=(e.flags&131072)!==0}else dt=!1,Ie&&(t.flags&1048576)!==0&&Hd(t,oo,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;wo(e,t),e=t.pendingProps;var l=cn(t,Xe.current);xn(t,r),l=pa(null,t,s,e,l,r);var i=ma();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(s)?(i=!0,ro(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,la(t),l.updater=yo,t.stateNode=l,l._reactInternals=t,ba(t,s,e,r),t=Na(null,t,s,!0,i,r)):(t.tag=0,Ie&&i&&Zl(t),st(null,t,l,r),t=t.child),t;case 16:s=t.elementType;e:{switch(wo(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=Fm(s),e=_t(s,e),l){case 0:t=ka(null,t,s,e,r);break e;case 1:t=Ic(null,t,s,e,r);break e;case 11:t=Dc(null,t,s,e,r);break e;case 14:t=Lc(null,t,s,_t(s.type,e),r);break e}throw Error(a(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:_t(s,l),ka(e,t,s,l,r);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:_t(s,l),Ic(e,t,s,l,r);case 3:e:{if(Fc(t),e===null)throw Error(a(387));s=t.pendingProps,i=t.memoizedState,l=i.element,ec(e,t),fo(t,s,null,r);var u=t.memoizedState;if(s=u.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=vn(Error(a(423)),t),t=$c(e,t,s,r,l);break e}else if(s!==l){l=vn(Error(a(424)),t),t=$c(e,t,s,r,l);break e}else for(ht=ir(t.stateNode.containerInfo.firstChild),mt=t,Ie=!0,Et=null,r=Jd(t,null,s,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(pn(),s===l){t=Zt(e,t,r);break e}st(e,t,s,r)}t=t.child}return t;case 5:return nc(t),e===null&&Xl(t),s=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,u=l.children,Wl(s,l)?u=null:i!==null&&Wl(s,i)&&(t.flags|=32),Tc(e,t),st(e,t,u,r),t.child;case 6:return e===null&&Xl(t),null;case 13:return Uc(e,t,r);case 4:return aa(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=mn(t,null,s,r):st(e,t,s,r),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:_t(s,l),Dc(e,t,s,l,r);case 7:return st(e,t,t.pendingProps,r),t.child;case 8:return st(e,t,t.pendingProps.children,r),t.child;case 12:return st(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,i=t.memoizedProps,u=l.value,De(io,s._currentValue),s._currentValue=u,i!==null)if(Ct(i.value,u)){if(i.children===l.children&&!at.current){t=Zt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var g=i.dependencies;if(g!==null){u=i.child;for(var y=g.firstContext;y!==null;){if(y.context===s){if(i.tag===1){y=qt(-1,r&-r),y.tag=2;var D=i.updateQueue;if(D!==null){D=D.shared;var U=D.pending;U===null?y.next=y:(y.next=U.next,U.next=y),D.pending=y}}i.lanes|=r,y=i.alternate,y!==null&&(y.lanes|=r),sa(i.return,r,t),g.lanes|=r;break}y=y.next}}else if(i.tag===10)u=i.type===t.type?null:i.child;else if(i.tag===18){if(u=i.return,u===null)throw Error(a(341));u.lanes|=r,g=u.alternate,g!==null&&(g.lanes|=r),sa(u,r,t),u=i.sibling}else u=i.child;if(u!==null)u.return=i;else for(u=i;u!==null;){if(u===t){u=null;break}if(i=u.sibling,i!==null){i.return=u.return,u=i;break}u=u.return}i=u}st(e,t,l.children,r),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,xn(t,r),l=bt(l),s=s(l),t.flags|=1,st(e,t,s,r),t.child;case 14:return s=t.type,l=_t(s,t.pendingProps),l=_t(s.type,l),Lc(e,t,s,l,r);case 15:return Ac(e,t,t.type,t.pendingProps,r);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:_t(s,l),wo(e,t),t.tag=1,it(s)?(e=!0,ro(t)):e=!1,xn(t,r),Cc(t,s,l),ba(t,s,l,r),Na(null,t,s,!0,e,r);case 19:return Vc(e,t,r);case 22:return Oc(e,t,r)}throw Error(a(156,t.tag))};function pu(e,t){return Gi(e,t)}function Im(e,t,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kt(e,t,r,s){return new Im(e,t,r,s)}function Wa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fm(e){if(typeof e=="function")return Wa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ce)return 11;if(e===Me)return 14}return 2}function yr(e,t){var r=e.alternate;return r===null?(r=kt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function zo(e,t,r,s,l,i){var u=2;if(s=e,typeof e=="function")Wa(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case F:return Fr(r.children,l,i,t);case ne:u=8,l|=8;break;case se:return e=kt(12,r,t,l|2),e.elementType=se,e.lanes=i,e;case Pe:return e=kt(13,r,t,l),e.elementType=Pe,e.lanes=i,e;case _e:return e=kt(19,r,t,l),e.elementType=_e,e.lanes=i,e;case ke:return Do(r,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case X:u=10;break e;case ye:u=9;break e;case ce:u=11;break e;case Me:u=14;break e;case Ne:u=16,s=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=kt(u,r,t,l),t.elementType=e,t.type=s,t.lanes=i,t}function Fr(e,t,r,s){return e=kt(7,e,s,t),e.lanes=r,e}function Do(e,t,r,s){return e=kt(22,e,s,t),e.elementType=ke,e.lanes=r,e.stateNode={isHidden:!1},e}function Ha(e,t,r){return e=kt(6,e,null,t),e.lanes=r,e}function Ga(e,t,r){return t=kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $m(e,t,r,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yl(0),this.expirationTimes=yl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yl(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ka(e,t,r,s,l,i,u,g,y){return e=new $m(e,t,r,g,y),t===1?(t=1,i===!0&&(t|=8)):t=0,i=kt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},la(i),e}function Um(e,t,r){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(d){console.error(d)}}return o(),Xa.exports=Xm(),Xa.exports}var Eu;function eh(){if(Eu)return $o;Eu=1;var o=nf();return $o.createRoot=o.createRoot,$o.hydrateRoot=o.hydrateRoot,$o}var th=eh();const rh=tf(th);/** +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function wa(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function ja(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var wm=typeof WeakMap=="function"?WeakMap:Map;function _c(e,t,r){r=Zt(-1,r),r.tag=3,r.payload={element:null};var s=t.value;return r.callback=function(){Co||(Co=!0,Ta=s),ja(e,t)},r}function Pc(e,t,r){r=Zt(-1,r),r.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var l=t.value;r.payload=function(){return s(l)},r.callback=function(){ja(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){ja(e,t),typeof s!="function"&&(xr===null?xr=new Set([this]):xr.add(this));var u=t.stack;this.componentDidCatch(t.value,{componentStack:u!==null?u:""})}),r}function Mc(e,t,r){var s=e.pingCache;if(s===null){s=e.pingCache=new wm;var l=new Set;s.set(t,l)}else l=s.get(t),l===void 0&&(l=new Set,s.set(t,l));l.has(r)||(l.add(r),e=Am.bind(null,e,t,r),t.then(e,e))}function Rc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function zc(e,t,r,s,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Zt(-1,1),t.tag=2,mr(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var jm=Y.ReactCurrentOwner,it=!1;function st(e,t,r,s){t.child=e===null?Jd(t,null,r,s):hn(t,e.child,r,s)}function Dc(e,t,r,s,l){r=r.render;var i=t.ref;return gn(t,l),s=pa(e,t,r,s,i,l),r=ma(),e!==null&&!it?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Yt(e,t,l)):(Ie&&r&&Zl(t),t.flags|=1,st(e,t,s,l),t.child)}function Lc(e,t,r,s,l){if(e===null){var i=r.type;return typeof i=="function"&&!Wa(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,Ac(e,t,i,s,l)):(e=zo(r.type,null,s,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,(e.lanes&l)===0){var u=i.memoizedProps;if(r=r.compare,r=r!==null?r:es,r(u,s)&&e.ref===t.ref)return Yt(e,t,l)}return t.flags|=1,e=br(i,s),e.ref=t.ref,e.return=t,t.child=e}function Ac(e,t,r,s,l){if(e!==null){var i=e.memoizedProps;if(es(i,s)&&e.ref===t.ref)if(it=!1,t.pendingProps=s=i,(e.lanes&l)!==0)(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Yt(e,t,l)}return ka(e,t,r,s,l)}function Oc(e,t,r){var s=t.pendingProps,l=s.children,i=e!==null?e.memoizedState:null;if(s.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Le(wn,vt),vt|=r;else{if((r&1073741824)===0)return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Le(wn,vt),vt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:r,Le(wn,vt),vt|=s}else i!==null?(s=i.baseLanes|r,t.memoizedState=null):s=r,Le(wn,vt),vt|=s;return st(e,t,l,r),t.child}function Tc(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function ka(e,t,r,s,l){var i=at(r)?Mr:et.current;return i=un(t,i),gn(t,l),r=pa(e,t,r,s,i,l),s=ma(),e!==null&&!it?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Yt(e,t,l)):(Ie&&s&&Zl(t),t.flags|=1,st(e,t,r,l),t.child)}function Ic(e,t,r,s,l){if(at(r)){var i=!0;ro(t)}else i=!1;if(gn(t,l),t.stateNode===null)wo(e,t),Cc(t,r,s),ba(t,r,s,l),s=!0;else if(e===null){var u=t.stateNode,g=t.memoizedProps;u.props=g;var y=u.context,z=r.contextType;typeof z=="object"&&z!==null?z=jt(z):(z=at(r)?Mr:et.current,z=un(t,z));var B=r.getDerivedStateFromProps,W=typeof B=="function"||typeof u.getSnapshotBeforeUpdate=="function";W||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==s||y!==z)&&Ec(t,u,s,z),pr=!1;var U=t.memoizedState;u.state=U,fo(t,s,u,l),y=t.memoizedState,g!==s||U!==y||lt.current||pr?(typeof B=="function"&&(ya(t,r,B,s),y=t.memoizedState),(g=pr||Sc(t,r,g,s,U,y,z))?(W||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=y),u.props=s,u.state=y,u.context=z,s=g):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,ec(e,t),g=t.memoizedProps,z=t.type===t.elementType?g:Mt(t.type,g),u.props=z,W=t.pendingProps,U=u.context,y=r.contextType,typeof y=="object"&&y!==null?y=jt(y):(y=at(r)?Mr:et.current,y=un(t,y));var te=r.getDerivedStateFromProps;(B=typeof te=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==W||U!==y)&&Ec(t,u,s,y),pr=!1,U=t.memoizedState,u.state=U,fo(t,s,u,l);var ie=t.memoizedState;g!==W||U!==ie||lt.current||pr?(typeof te=="function"&&(ya(t,r,te,s),ie=t.memoizedState),(z=pr||Sc(t,r,z,s,U,ie,y)||!1)?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,ie,y),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,ie,y)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=ie),u.props=s,u.state=ie,u.context=y,s=z):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),s=!1)}return Na(e,t,r,s,i,l)}function Na(e,t,r,s,l,i){Tc(e,t);var u=(t.flags&128)!==0;if(!s&&!u)return l&&Vd(t,r,!1),Yt(e,t,i);s=t.stateNode,jm.current=t;var g=u&&typeof r.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&u?(t.child=hn(t,e.child,null,i),t.child=hn(t,null,g,i)):st(e,t,g,i),t.memoizedState=s.state,l&&Vd(t,r,!0),t.child}function Fc(e){var t=e.stateNode;t.pendingContext?Ud(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ud(e,t.context,!1),aa(e,t.containerInfo)}function $c(e,t,r,s,l){return mn(),ea(l),t.flags|=256,st(e,t,r,s),t.child}var Sa={dehydrated:null,treeContext:null,retryLane:0};function Ca(e){return{baseLanes:e,cachePool:null,transitions:null}}function Uc(e,t,r){var s=t.pendingProps,l=Fe.current,i=!1,u=(t.flags&128)!==0,g;if((g=u)||(g=e!==null&&e.memoizedState===null?!1:(l&2)!==0),g?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Le(Fe,l&1),e===null)return Xl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(u=s.children,e=s.fallback,i?(s=t.mode,i=t.child,u={mode:"hidden",children:u},(s&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=u):i=Do(u,s,0,null),e=$r(e,s,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ca(r),t.memoizedState=Sa,e):Ea(t,u));if(l=e.memoizedState,l!==null&&(g=l.dehydrated,g!==null))return km(e,t,u,s,g,l,r);if(i){i=s.fallback,u=t.mode,l=e.child,g=l.sibling;var y={mode:"hidden",children:s.children};return(u&1)===0&&t.child!==l?(s=t.child,s.childLanes=0,s.pendingProps=y,t.deletions=null):(s=br(l,y),s.subtreeFlags=l.subtreeFlags&14680064),g!==null?i=br(g,i):(i=$r(i,u,r,null),i.flags|=2),i.return=t,s.return=t,s.sibling=i,t.child=s,s=i,i=t.child,u=e.child.memoizedState,u=u===null?Ca(r):{baseLanes:u.baseLanes|r,cachePool:null,transitions:u.transitions},i.memoizedState=u,i.childLanes=e.childLanes&~r,t.memoizedState=Sa,s}return i=e.child,e=i.sibling,s=br(i,{mode:"visible",children:s.children}),(t.mode&1)===0&&(s.lanes=r),s.return=t,s.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=s,t.memoizedState=null,s}function Ea(e,t){return t=Do({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function bo(e,t,r,s){return s!==null&&ea(s),hn(t,e.child,null,r),e=Ea(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function km(e,t,r,s,l,i,u){if(r)return t.flags&256?(t.flags&=-257,s=wa(Error(a(422))),bo(e,t,u,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,l=t.mode,s=Do({mode:"visible",children:s.children},l,0,null),i=$r(i,l,u,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,(t.mode&1)!==0&&hn(t,e.child,null,u),t.child.memoizedState=Ca(u),t.memoizedState=Sa,i);if((t.mode&1)===0)return bo(e,t,u,null);if(l.data==="$!"){if(s=l.nextSibling&&l.nextSibling.dataset,s)var g=s.dgst;return s=g,i=Error(a(419)),s=wa(i,s,void 0),bo(e,t,u,s)}if(g=(u&e.childLanes)!==0,it||g){if(s=Qe,s!==null){switch(u&-u){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=(l&(s.suspendedLanes|u))!==0?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,qt(e,l),Dt(s,e,l,-1))}return Va(),s=wa(Error(a(421))),bo(e,t,u,s)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Om.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,gt=dr(l.nextSibling),xt=t,Ie=!0,Pt=null,e!==null&&(bt[wt++]=Kt,bt[wt++]=Qt,bt[wt++]=Rr,Kt=e.id,Qt=e.overflow,Rr=t),t=Ea(t,s.children),t.flags|=4096,t)}function Bc(e,t,r){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),sa(e.return,t,r)}function _a(e,t,r,s,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=r,i.tailMode=l)}function Vc(e,t,r){var s=t.pendingProps,l=s.revealOrder,i=s.tail;if(st(e,t,s.children,r),s=Fe.current,(s&2)!==0)s=s&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Bc(e,r,t);else if(e.tag===19)Bc(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(Le(Fe,s),(t.mode&1)===0)t.memoizedState=null;else switch(l){case"forwards":for(r=t.child,l=null;r!==null;)e=r.alternate,e!==null&&po(e)===null&&(l=r),r=r.sibling;r=l,r===null?(l=t.child,t.child=null):(l=r.sibling,r.sibling=null),_a(t,!1,l,r,i);break;case"backwards":for(r=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&po(e)===null){t.child=l;break}e=l.sibling,l.sibling=r,r=l,l=e}_a(t,!0,r,null,i);break;case"together":_a(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function wo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Yt(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Or|=t.lanes,(r&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,r=br(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=br(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Nm(e,t,r){switch(t.tag){case 3:Fc(t),mn();break;case 5:nc(t);break;case 1:at(t.type)&&ro(t);break;case 4:aa(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,l=t.memoizedProps.value;Le(io,s._currentValue),s._currentValue=l;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(Le(Fe,Fe.current&1),t.flags|=128,null):(r&t.child.childLanes)!==0?Uc(e,t,r):(Le(Fe,Fe.current&1),e=Yt(e,t,r),e!==null?e.sibling:null);Le(Fe,Fe.current&1);break;case 19:if(s=(r&t.childLanes)!==0,(e.flags&128)!==0){if(s)return Vc(e,t,r);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Le(Fe,Fe.current),s)break;return null;case 22:case 23:return t.lanes=0,Oc(e,t,r)}return Yt(e,t,r)}var Wc,Pa,Hc,Gc;Wc=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},Pa=function(){},Hc=function(e,t,r,s){var l=e.memoizedProps;if(l!==s){e=t.stateNode,Lr(Tt.current);var i=null;switch(r){case"input":l=pt(e,l),s=pt(e,s),i=[];break;case"select":l=K({},l,{value:void 0}),s=K({},s,{value:void 0}),i=[];break;case"textarea":l=Jr(e,l),s=Jr(e,s),i=[];break;default:typeof l.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Xs)}dl(r,s);var u;r=null;for(z in l)if(!s.hasOwnProperty(z)&&l.hasOwnProperty(z)&&l[z]!=null)if(z==="style"){var g=l[z];for(u in g)g.hasOwnProperty(u)&&(r||(r={}),r[u]="")}else z!=="dangerouslySetInnerHTML"&&z!=="children"&&z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&z!=="autoFocus"&&(f.hasOwnProperty(z)?i||(i=[]):(i=i||[]).push(z,null));for(z in s){var y=s[z];if(g=l!=null?l[z]:void 0,s.hasOwnProperty(z)&&y!==g&&(y!=null||g!=null))if(z==="style")if(g){for(u in g)!g.hasOwnProperty(u)||y&&y.hasOwnProperty(u)||(r||(r={}),r[u]="");for(u in y)y.hasOwnProperty(u)&&g[u]!==y[u]&&(r||(r={}),r[u]=y[u])}else r||(i||(i=[]),i.push(z,r)),r=y;else z==="dangerouslySetInnerHTML"?(y=y?y.__html:void 0,g=g?g.__html:void 0,y!=null&&g!==y&&(i=i||[]).push(z,y)):z==="children"?typeof y!="string"&&typeof y!="number"||(i=i||[]).push(z,""+y):z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&(f.hasOwnProperty(z)?(y!=null&&z==="onScroll"&&Ae("scroll",e),i||g===y||(i=[])):(i=i||[]).push(z,y))}r&&(i=i||[]).push("style",r);var z=i;(t.updateQueue=z)&&(t.flags|=4)}},Gc=function(e,t,r,s){r!==s&&(t.flags|=4)};function hs(e,t){if(!Ie)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,s=0;if(t)for(var l=e.child;l!==null;)r|=l.lanes|l.childLanes,s|=l.subtreeFlags&14680064,s|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)r|=l.lanes|l.childLanes,s|=l.subtreeFlags,s|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=s,e.childLanes=r,t}function Sm(e,t,r){var s=t.pendingProps;switch(Yl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rt(t),null;case 1:return at(t.type)&&to(),rt(t),null;case 3:return s=t.stateNode,vn(),Oe(lt),Oe(et),ca(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(lo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Pt!==null&&($a(Pt),Pt=null))),Pa(e,t),rt(t),null;case 5:ia(t);var l=Lr(cs.current);if(r=t.type,e!==null&&t.stateNode!=null)Hc(e,t,r,s,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(a(166));return rt(t),null}if(e=Lr(Tt.current),lo(t)){s=t.stateNode,r=t.type;var i=t.memoizedProps;switch(s[Ot]=t,s[os]=i,e=(t.mode&1)!==0,r){case"dialog":Ae("cancel",s),Ae("close",s);break;case"iframe":case"object":case"embed":Ae("load",s);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=u.createElement(r,{is:s.is}):(e=u.createElement(r),r==="select"&&(u=e,s.multiple?u.multiple=!0:s.size&&(u.size=s.size))):e=u.createElementNS(e,r),e[Ot]=t,e[os]=s,Wc(e,t,!1,!1),t.stateNode=e;e:{switch(u=cl(r,s),r){case"dialog":Ae("cancel",e),Ae("close",e),l=s;break;case"iframe":case"object":case"embed":Ae("load",e),l=s;break;case"video":case"audio":for(l=0;ljn&&(t.flags|=128,s=!0,hs(i,!1),t.lanes=4194304)}else{if(!s)if(e=po(u),e!==null){if(t.flags|=128,s=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),hs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!u.alternate&&!Ie)return rt(t),null}else 2*Be()-i.renderingStartTime>jn&&r!==1073741824&&(t.flags|=128,s=!0,hs(i,!1),t.lanes=4194304);i.isBackwards?(u.sibling=t.child,t.child=u):(r=i.last,r!==null?r.sibling=u:t.child=u,i.last=u)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Be(),t.sibling=null,r=Fe.current,Le(Fe,s?r&1|2:r&1),t):(rt(t),null);case 22:case 23:return Ba(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&(t.mode&1)!==0?(vt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Cm(e,t){switch(Yl(t),t.tag){case 1:return at(t.type)&&to(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vn(),Oe(lt),Oe(et),ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return ia(t),null;case 13:if(Oe(Fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oe(Fe),null;case 4:return vn(),null;case 10:return na(t.type._context),null;case 22:case 23:return Ba(),null;case 24:return null;default:return null}}var jo=!1,nt=!1,Em=typeof WeakSet=="function"?WeakSet:Set,le=null;function bn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){Ue(e,t,s)}else r.current=null}function Ma(e,t,r){try{r()}catch(s){Ue(e,t,s)}}var Kc=!1;function _m(e,t){if(Bl=Us,e=Sd(),Ll(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var l=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var u=0,g=-1,y=-1,z=0,B=0,W=e,U=null;t:for(;;){for(var te;W!==r||l!==0&&W.nodeType!==3||(g=u+l),W!==i||s!==0&&W.nodeType!==3||(y=u+s),W.nodeType===3&&(u+=W.nodeValue.length),(te=W.firstChild)!==null;)U=W,W=te;for(;;){if(W===e)break t;if(U===r&&++z===l&&(g=u),U===i&&++B===s&&(y=u),(te=W.nextSibling)!==null)break;W=U,U=W.parentNode}W=te}r=g===-1||y===-1?null:{start:g,end:y}}else r=null}r=r||{start:0,end:0}}else r=null;for(Vl={focusedElem:e,selectionRange:r},Us=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var de=ie.memoizedProps,Ve=ie.memoizedState,_=t.stateNode,k=_.getSnapshotBeforeUpdate(t.elementType===t.type?de:Mt(t.type,de),Ve);_.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var M=t.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(q){Ue(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ie=Kc,Kc=!1,ie}function xs(e,t,r){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Ma(t,r,i)}l=l.next}while(l!==s)}}function ko(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var s=r.create;r.destroy=s()}r=r.next}while(r!==t)}}function Ra(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Qc(e){var t=e.alternate;t!==null&&(e.alternate=null,Qc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ot],delete t[os],delete t[Kl],delete t[cm],delete t[um])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qc(e){return e.tag===5||e.tag===3||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function za(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Xs));else if(s!==4&&(e=e.child,e!==null))for(za(e,t,r),e=e.sibling;e!==null;)za(e,t,r),e=e.sibling}function Da(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Da(e,t,r),e=e.sibling;e!==null;)Da(e,t,r),e=e.sibling}var Ze=null,Rt=!1;function hr(e,t,r){for(r=r.child;r!==null;)Yc(e,t,r),r=r.sibling}function Yc(e,t,r){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(As,r)}catch{}switch(r.tag){case 5:nt||bn(r,t);case 6:var s=Ze,l=Rt;Ze=null,hr(e,t,r),Ze=s,Rt=l,Ze!==null&&(Rt?(e=Ze,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ze.removeChild(r.stateNode));break;case 18:Ze!==null&&(Rt?(e=Ze,r=r.stateNode,e.nodeType===8?Gl(e.parentNode,r):e.nodeType===1&&Gl(e,r),Qn(e)):Gl(Ze,r.stateNode));break;case 4:s=Ze,l=Rt,Ze=r.stateNode.containerInfo,Rt=!0,hr(e,t,r),Ze=s,Rt=l;break;case 0:case 11:case 14:case 15:if(!nt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var i=l,u=i.destroy;i=i.tag,u!==void 0&&((i&2)!==0||(i&4)!==0)&&Ma(r,t,u),l=l.next}while(l!==s)}hr(e,t,r);break;case 1:if(!nt&&(bn(r,t),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(g){Ue(r,t,g)}hr(e,t,r);break;case 21:hr(e,t,r);break;case 22:r.mode&1?(nt=(s=nt)||r.memoizedState!==null,hr(e,t,r),nt=s):hr(e,t,r);break;default:hr(e,t,r)}}function Jc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Em),t.forEach(function(s){var l=Tm.bind(null,e,s);r.has(s)||(r.add(s),s.then(l,l))})}}function zt(e,t){var r=t.deletions;if(r!==null)for(var s=0;sl&&(l=u),s&=~i}if(s=l,s=Be()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Mm(s/1960))-s,10e?16:e,gr===null)var s=!1;else{if(e=gr,gr=null,_o=0,(Ee&6)!==0)throw Error(a(331));var l=Ee;for(Ee|=4,le=e.current;le!==null;){var i=le,u=i.child;if((le.flags&16)!==0){var g=i.deletions;if(g!==null){for(var y=0;yBe()-Oa?Ir(e,0):Aa|=r),ct(e,t)}function uu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Ts,Ts<<=1,(Ts&130023424)===0&&(Ts=4194304)));var r=ot();e=qt(e,t),e!==null&&(Vn(e,t,r),ct(e,r))}function Om(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),uu(e,r)}function Tm(e,t){var r=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(r=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(a(314))}s!==null&&s.delete(t),uu(e,r)}var fu;fu=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)it=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return it=!1,Nm(e,t,r);it=(e.flags&131072)!==0}else it=!1,Ie&&(t.flags&1048576)!==0&&Hd(t,oo,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;wo(e,t),e=t.pendingProps;var l=un(t,et.current);gn(t,r),l=pa(null,t,s,e,l,r);var i=ma();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,at(s)?(i=!0,ro(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,la(t),l.updater=yo,t.stateNode=l,l._reactInternals=t,ba(t,s,e,r),t=Na(null,t,s,!0,i,r)):(t.tag=0,Ie&&i&&Zl(t),st(null,t,l,r),t=t.child),t;case 16:s=t.elementType;e:{switch(wo(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=Fm(s),e=Mt(s,e),l){case 0:t=ka(null,t,s,e,r);break e;case 1:t=Ic(null,t,s,e,r);break e;case 11:t=Dc(null,t,s,e,r);break e;case 14:t=Lc(null,t,s,Mt(s.type,e),r);break e}throw Error(a(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),ka(e,t,s,l,r);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),Ic(e,t,s,l,r);case 3:e:{if(Fc(t),e===null)throw Error(a(387));s=t.pendingProps,i=t.memoizedState,l=i.element,ec(e,t),fo(t,s,null,r);var u=t.memoizedState;if(s=u.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=yn(Error(a(423)),t),t=$c(e,t,s,r,l);break e}else if(s!==l){l=yn(Error(a(424)),t),t=$c(e,t,s,r,l);break e}else for(gt=dr(t.stateNode.containerInfo.firstChild),xt=t,Ie=!0,Pt=null,r=Jd(t,null,s,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(mn(),s===l){t=Yt(e,t,r);break e}st(e,t,s,r)}t=t.child}return t;case 5:return nc(t),e===null&&Xl(t),s=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,u=l.children,Wl(s,l)?u=null:i!==null&&Wl(s,i)&&(t.flags|=32),Tc(e,t),st(e,t,u,r),t.child;case 6:return e===null&&Xl(t),null;case 13:return Uc(e,t,r);case 4:return aa(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=hn(t,null,s,r):st(e,t,s,r),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),Dc(e,t,s,l,r);case 7:return st(e,t,t.pendingProps,r),t.child;case 8:return st(e,t,t.pendingProps.children,r),t.child;case 12:return st(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,i=t.memoizedProps,u=l.value,Le(io,s._currentValue),s._currentValue=u,i!==null)if(_t(i.value,u)){if(i.children===l.children&&!lt.current){t=Yt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var g=i.dependencies;if(g!==null){u=i.child;for(var y=g.firstContext;y!==null;){if(y.context===s){if(i.tag===1){y=Zt(-1,r&-r),y.tag=2;var z=i.updateQueue;if(z!==null){z=z.shared;var B=z.pending;B===null?y.next=y:(y.next=B.next,B.next=y),z.pending=y}}i.lanes|=r,y=i.alternate,y!==null&&(y.lanes|=r),sa(i.return,r,t),g.lanes|=r;break}y=y.next}}else if(i.tag===10)u=i.type===t.type?null:i.child;else if(i.tag===18){if(u=i.return,u===null)throw Error(a(341));u.lanes|=r,g=u.alternate,g!==null&&(g.lanes|=r),sa(u,r,t),u=i.sibling}else u=i.child;if(u!==null)u.return=i;else for(u=i;u!==null;){if(u===t){u=null;break}if(i=u.sibling,i!==null){i.return=u.return,u=i;break}u=u.return}i=u}st(e,t,l.children,r),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,gn(t,r),l=jt(l),s=s(l),t.flags|=1,st(e,t,s,r),t.child;case 14:return s=t.type,l=Mt(s,t.pendingProps),l=Mt(s.type,l),Lc(e,t,s,l,r);case 15:return Ac(e,t,t.type,t.pendingProps,r);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),wo(e,t),t.tag=1,at(s)?(e=!0,ro(t)):e=!1,gn(t,r),Cc(t,s,l),ba(t,s,l,r),Na(null,t,s,!0,e,r);case 19:return Vc(e,t,r);case 22:return Oc(e,t,r)}throw Error(a(156,t.tag))};function pu(e,t){return Gi(e,t)}function Im(e,t,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function St(e,t,r,s){return new Im(e,t,r,s)}function Wa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fm(e){if(typeof e=="function")return Wa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ce)return 11;if(e===Re)return 14}return 2}function br(e,t){var r=e.alternate;return r===null?(r=St(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function zo(e,t,r,s,l,i){var u=2;if(s=e,typeof e=="function")Wa(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case $:return $r(r.children,l,i,t);case ne:u=8,l|=8;break;case se:return e=St(12,r,t,l|2),e.elementType=se,e.lanes=i,e;case Me:return e=St(13,r,t,l),e.elementType=Me,e.lanes=i,e;case Pe:return e=St(19,r,t,l),e.elementType=Pe,e.lanes=i,e;case Ne:return Do(r,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case X:u=10;break e;case be:u=9;break e;case ce:u=11;break e;case Re:u=14;break e;case Se:u=16,s=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=St(u,r,t,l),t.elementType=e,t.type=s,t.lanes=i,t}function $r(e,t,r,s){return e=St(7,e,s,t),e.lanes=r,e}function Do(e,t,r,s){return e=St(22,e,s,t),e.elementType=Ne,e.lanes=r,e.stateNode={isHidden:!1},e}function Ha(e,t,r){return e=St(6,e,null,t),e.lanes=r,e}function Ga(e,t,r){return t=St(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $m(e,t,r,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yl(0),this.expirationTimes=yl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yl(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ka(e,t,r,s,l,i,u,g,y){return e=new $m(e,t,r,g,y),t===1?(t=1,i===!0&&(t|=8)):t=0,i=St(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},la(i),e}function Um(e,t,r){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(d){console.error(d)}}return o(),Xa.exports=Xm(),Xa.exports}var Eu;function eh(){if(Eu)return $o;Eu=1;var o=nf();return $o.createRoot=o.createRoot,$o.hydrateRoot=o.hydrateRoot,$o}var th=eh();const rh=tf(th);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -52,272 +52,272 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oh=p.forwardRef(({color:o="currentColor",size:d=24,strokeWidth:a=2,absoluteStrokeWidth:c,className:f="",children:m,iconNode:h,...x},E)=>p.createElement("svg",{ref:E,...sh,width:d,height:d,stroke:o,strokeWidth:c?Number(a)*24/Number(d):a,className:sf("lucide",f),...x},[...h.map(([b,k])=>p.createElement(b,k)),...Array.isArray(m)?m:[m]]));/** + */const oh=p.forwardRef(({color:o="currentColor",size:d=24,strokeWidth:a=2,absoluteStrokeWidth:c,className:f="",children:m,iconNode:h,...x},C)=>p.createElement("svg",{ref:C,...sh,width:d,height:d,stroke:o,strokeWidth:c?Number(a)*24/Number(d):a,className:sf("lucide",f),...x},[...h.map(([b,j])=>p.createElement(b,j)),...Array.isArray(m)?m:[m]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ge=(o,d)=>{const a=p.forwardRef(({className:c,...f},m)=>p.createElement(oh,{ref:m,iconNode:d,className:sf(`lucide-${nh(o)}`,c),...f}));return a.displayName=`${o}`,a};/** + */const ve=(o,d)=>{const a=p.forwardRef(({className:c,...f},m)=>p.createElement(oh,{ref:m,iconNode:d,className:sf(`lucide-${nh(o)}`,c),...f}));return a.displayName=`${o}`,a};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xo=ge("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const Xo=ve("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _u=ge("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const _u=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const of=ge("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + */const of=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ss=ge("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 Ss=ve("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. * See the LICENSE file in the root directory of this source tree. - */const lh=ge("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const lh=ve("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cs=ge("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 Cs=ve("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. * See the LICENSE file in the root directory of this source tree. - */const zn=ge("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const Dn=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ah=ge("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const ah=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ih=ge("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const ih=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dh=ge("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const dh=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ch=ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + */const ch=ve("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uh=ge("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const uh=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fh=ge("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const fh=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mi=ge("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + */const mi=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ph=ge("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** + */const ph=ve("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mh=ge("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** + */const mh=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hi=ge("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const hi=ve("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hh=ge("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** + */const hh=ve("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lf=ge("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const lf=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gt=ge("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const yt=ve("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vr=ge("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const Wr=ve("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const el=ge("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 el=ve("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. * See the LICENSE file in the root directory of this source tree. - */const Pu=ge("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + */const Pu=ve("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xi=ge("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const xi=ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xh=ge("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + */const xh=ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gh=ge("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const gh=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gi=ge("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + */const gi=ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vh=ge("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const vh=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yh=ge("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + */const yh=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Es=ge("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 Es=ve("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. * See the LICENSE file in the root directory of this source tree. - */const bh=ge("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + */const bh=ve("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wh=ge("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + */const wh=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jh=ge("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + */const jh=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const af=ge("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const af=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const df=ge("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + */const df=ve("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Br=ge("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const Vr=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kh=ge("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + */const kh=ve("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Nh=ge("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + */const Nh=ve("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _i=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const _i=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Sh=ge("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + */const Sh=ve("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ch=ge("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + */const Ch=ve("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wr=ge("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + */const Hr=ve("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Eh=ge("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + */const Eh=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cf=ge("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + */const cf=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _h=ge("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + */const _h=ve("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tl=ge("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const tl=ve("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. * See the LICENSE file in the root directory of this source tree. - */const vi=ge("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const vi=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ph=ge("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const Ph=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Mh=ge("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + */const Mh=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rl=ge("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 rl=ve("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. * See the LICENSE file in the root directory of this source tree. - */const Hr=ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),yi=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:bh},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:lh},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:gt},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Cs},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:jh},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Ss},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:uh}];var Mu=1,Rh=.9,zh=.8,Dh=.17,ri=.1,ni=.999,Lh=.9999,Ah=.99,Oh=/[\\\/_+.#"@\[\(\{&]/,Th=/[\\\/_+.#"@\[\(\{&]/g,Ih=/[\s-]/,uf=/[\s-]/g;function bi(o,d,a,c,f,m,h){if(m===d.length)return f===o.length?Mu:Ah;var x=`${f},${m}`;if(h[x]!==void 0)return h[x];for(var E=c.charAt(m),b=a.indexOf(E,f),k=0,M,A,I,O;b>=0;)M=bi(o,d,a,c,b+1,m+1,h),M>k&&(b===f?M*=Mu:Oh.test(o.charAt(b-1))?(M*=zh,I=o.slice(f,b-1).match(Th),I&&f>0&&(M*=Math.pow(ni,I.length))):Ih.test(o.charAt(b-1))?(M*=Rh,O=o.slice(f,b-1).match(uf),O&&f>0&&(M*=Math.pow(ni,O.length))):(M*=Dh,f>0&&(M*=Math.pow(ni,b-f))),o.charAt(b)!==d.charAt(m)&&(M*=Lh)),(MM&&(M=A*ri)),M>k&&(k=M),b=a.indexOf(E,b+1);return h[x]=k,k}function Ru(o){return o.toLowerCase().replace(uf," ")}function Fh(o,d,a){return o=a&&a.length>0?`${o+" "+a.join(" ")}`:o,bi(o,d,Ru(o),Ru(d),0,0,{})}function Sr(o,d,{checkForDefaultPrevented:a=!0}={}){return function(f){if(o==null||o(f),a===!1||!f.defaultPrevented)return d==null?void 0:d(f)}}function zu(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Dn(...o){return d=>{let a=!1;const c=o.map(f=>{const m=zu(f,d);return!a&&typeof m=="function"&&(a=!0),m});if(a)return()=>{for(let f=0;f{var _;const{scope:A,children:I,...O}=M,S=((_=A==null?void 0:A[o])==null?void 0:_[E])||x,C=p.useMemo(()=>O,Object.values(O));return n.jsx(S.Provider,{value:C,children:I})};b.displayName=m+"Provider";function k(M,A){var S;const I=((S=A==null?void 0:A[o])==null?void 0:S[E])||x,O=p.useContext(I);if(O)return O;if(h!==void 0)return h;throw new Error(`\`${M}\` must be used within \`${m}\``)}return[b,k]}const f=()=>{const m=a.map(h=>p.createContext(h));return function(x){const E=(x==null?void 0:x[o])||m;return p.useMemo(()=>({[`__scope${o}`]:{...x,[o]:E}}),[x,E])}};return f.scopeName=o,[c,Uh(f,...d)]}function Uh(...o){const d=o[0];if(o.length===1)return d;const a=()=>{const c=o.map(f=>({useScope:f(),scopeName:f.scopeName}));return function(m){const h=c.reduce((x,{useScope:E,scopeName:b})=>{const M=E(m)[`__scope${b}`];return{...x,...M}},{});return p.useMemo(()=>({[`__scope${d.scopeName}`]:h}),[h])}};return a.scopeName=d.scopeName,a}var _s=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Bh=Ei[" useId ".trim().toString()]||(()=>{}),Vh=0;function Xt(o){const[d,a]=p.useState(Bh());return _s(()=>{a(c=>c??String(Vh++))},[o]),d?`radix-${d}`:""}var Wh=Ei[" useInsertionEffect ".trim().toString()]||_s;function Hh({prop:o,defaultProp:d,onChange:a=()=>{},caller:c}){const[f,m,h]=Gh({defaultProp:d,onChange:a}),x=o!==void 0,E=x?o:f;{const k=p.useRef(o!==void 0);p.useEffect(()=>{const M=k.current;M!==x&&console.warn(`${c} is changing from ${M?"controlled":"uncontrolled"} to ${x?"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.`),k.current=x},[x,c])}const b=p.useCallback(k=>{var M;if(x){const A=Kh(k)?k(o):k;A!==o&&((M=h.current)==null||M.call(h,A))}else m(k)},[x,o,m,h]);return[E,b]}function Gh({defaultProp:o,onChange:d}){const[a,c]=p.useState(o),f=p.useRef(a),m=p.useRef(d);return Wh(()=>{m.current=d},[d]),p.useEffect(()=>{var h;f.current!==a&&((h=m.current)==null||h.call(m,a),f.current=a)},[a,f]),[a,c,m]}function Kh(o){return typeof o=="function"}var ff=nf();function pf(o){const d=p.forwardRef((a,c)=>{let{children:f,...m}=a,h=null,x=!1;const E=[];Du(f)&&typeof Uo=="function"&&(f=Uo(f._payload)),p.Children.forEach(f,A=>{var I;if(Jh(A)){x=!0;const O=A;let S="child"in O.props?O.props.child:O.props.children;Du(S)&&typeof Uo=="function"&&(S=Uo(S._payload)),h=qh(O,S),E.push((I=h==null?void 0:h.props)==null?void 0:I.children)}else E.push(A)}),h?h=p.cloneElement(h,void 0,E):!x&&p.Children.count(f)===1&&p.isValidElement(f)&&(h=f);const b=h?Yh(h):void 0,k=Kr(c,b);if(!h){if(f||f===0)throw new Error(x?rx(o):tx(o));return f}const M=Zh(m,h.props??{});return h.type!==p.Fragment&&(M.ref=c?k:b),p.cloneElement(h,M)});return d.displayName=`${o}.Slot`,d}var Qh=Symbol.for("radix.slottable"),qh=(o,d)=>{if("child"in o.props){const a=o.props.child;return p.isValidElement(a)?p.cloneElement(a,void 0,o.props.children(a.props.children)):null}return p.isValidElement(d)?d:null};function Zh(o,d){const a={...d};for(const c in d){const f=o[c],m=d[c];/^on[A-Z]/.test(c)?f&&m?a[c]=(...x)=>{const E=m(...x);return f(...x),E}:f&&(a[c]=f):c==="style"?a[c]={...f,...m}:c==="className"&&(a[c]=[f,m].filter(Boolean).join(" "))}return{...o,...a}}function Yh(o){var c,f;let d=(c=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:c.get,a=d&&"isReactWarning"in d&&d.isReactWarning;return a?o.ref:(d=(f=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:f.get,a=d&&"isReactWarning"in d&&d.isReactWarning,a?o.props.ref:o.props.ref||o.ref)}function Jh(o){return p.isValidElement(o)&&typeof o.type=="function"&&"__radixId"in o.type&&o.type.__radixId===Qh}var Xh=Symbol.for("react.lazy");function Du(o){return o!=null&&typeof o=="object"&&"$$typeof"in o&&o.$$typeof===Xh&&"_payload"in o&&ex(o._payload)}function ex(o){return typeof o=="object"&&o!==null&&"then"in o}var tx=o=>`${o} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,rx=o=>`${o} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Uo=Ei[" use ".trim().toString()],nx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=nx.reduce((o,d)=>{const a=pf(`Primitive.${d}`),c=p.forwardRef((f,m)=>{const{asChild:h,...x}=f,E=h?a:d;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(E,{...x,ref:m})});return c.displayName=`Primitive.${d}`,{...o,[d]:c}},{});function sx(o,d){o&&ff.flushSync(()=>o.dispatchEvent(d))}function Ps(o){const d=p.useRef(o);return p.useEffect(()=>{d.current=o}),p.useMemo(()=>((...a)=>{var c;return(c=d.current)==null?void 0:c.call(d,...a)}),[])}function ox(o,d=globalThis==null?void 0:globalThis.document){const a=Ps(o);p.useEffect(()=>{const c=f=>{f.key==="Escape"&&a(f)};return d.addEventListener("keydown",c,{capture:!0}),()=>d.removeEventListener("keydown",c,{capture:!0})},[a,d])}var lx="DismissableLayer",wi="dismissableLayer.update",ax="dismissableLayer.pointerDownOutside",ix="dismissableLayer.focusOutside",Lu,Pi=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),mf=p.forwardRef((o,d)=>{const{disableOutsidePointerEvents:a=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:E,...b}=o,k=p.useContext(Pi),[M,A]=p.useState(null),I=(M==null?void 0:M.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,O]=p.useState({}),S=Kr(d,se=>A(se)),C=Array.from(k.layers),[_]=[...k.layersWithOutsidePointerEventsDisabled].slice(-1),L=C.indexOf(_),Z=M?C.indexOf(M):-1,Y=k.layersWithOutsidePointerEventsDisabled.size>0,H=Z>=L,T=p.useRef(!1),F=fx(se=>{const X=se.target;if(!(X instanceof Node))return;const ye=[...k.branches].some(ce=>ce.contains(X));!H||ye||(m==null||m(se),x==null||x(se),se.defaultPrevented||E==null||E())},{ownerDocument:I,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:k.dismissableSurfaces}),ne=px(se=>{if(c&&T.current)return;const X=se.target;[...k.branches].some(ce=>ce.contains(X))||(h==null||h(se),x==null||x(se),se.defaultPrevented||E==null||E())},I);return ox(se=>{Z===k.layers.size-1&&(f==null||f(se),!se.defaultPrevented&&E&&(se.preventDefault(),E()))},I),p.useEffect(()=>{if(M)return a&&(k.layersWithOutsidePointerEventsDisabled.size===0&&(Lu=I.body.style.pointerEvents,I.body.style.pointerEvents="none"),k.layersWithOutsidePointerEventsDisabled.add(M)),k.layers.add(M),Au(),()=>{a&&(k.layersWithOutsidePointerEventsDisabled.delete(M),k.layersWithOutsidePointerEventsDisabled.size===0&&(I.body.style.pointerEvents=Lu))}},[M,I,a,k]),p.useEffect(()=>()=>{M&&(k.layers.delete(M),k.layersWithOutsidePointerEventsDisabled.delete(M),Au())},[M,k]),p.useEffect(()=>{const se=()=>O({});return document.addEventListener(wi,se),()=>document.removeEventListener(wi,se)},[]),n.jsx(Je.div,{...b,ref:S,style:{pointerEvents:Y?H?"auto":"none":void 0,...o.style},onFocusCapture:Sr(o.onFocusCapture,ne.onFocusCapture),onBlurCapture:Sr(o.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:Sr(o.onPointerDownCapture,F.onPointerDownCapture)})});mf.displayName=lx;var dx="DismissableLayerBranch",cx=p.forwardRef((o,d)=>{const a=p.useContext(Pi),c=p.useRef(null),f=Kr(d,c);return p.useEffect(()=>{const m=c.current;if(m)return a.branches.add(m),()=>{a.branches.delete(m)}},[a.branches]),n.jsx(Je.div,{...o,ref:f})});cx.displayName=dx;function ux(){const o=p.useContext(Pi),[d,a]=p.useState(null);return p.useEffect(()=>{if(d)return o.dismissableSurfaces.add(d),()=>{o.dismissableSurfaces.delete(d)}},[d,o.dismissableSurfaces]),a}function fx(o,d){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:f,dismissableSurfaces:m}=d,h=Ps(o),x=p.useRef(!1),E=p.useRef(!1),b=p.useRef(new Map),k=p.useRef(()=>{});return p.useEffect(()=>{function M(){E.current=!1,f.current=!1,b.current.clear()}function A(){return Array.from(b.current.values()).some(Boolean)}function I(L){if(!E.current)return;const Z=L.target;Z instanceof Node&&[...m].some(H=>H.contains(Z))||b.current.set(L.type,!0),L.type==="click"&&window.setTimeout(()=>{E.current&&k.current()},0)}function O(L){E.current&&b.current.set(L.type,!1)}const S=L=>{if(L.target&&!x.current){let Z=function(){a.removeEventListener("click",k.current);const H=A();M(),H||hf(ax,h,Y,{discrete:!0})};const Y={originalEvent:L};E.current=!0,f.current=c&&L.button===0,b.current.clear(),!c||L.button!==0?Z():(a.removeEventListener("click",k.current),k.current=Z,a.addEventListener("click",k.current,{once:!0}))}else a.removeEventListener("click",k.current),M();x.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const L of C)a.addEventListener(L,I,!0),a.addEventListener(L,O);const _=window.setTimeout(()=>{a.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(_),a.removeEventListener("pointerdown",S),a.removeEventListener("click",k.current);for(const L of C)a.removeEventListener(L,I,!0),a.removeEventListener(L,O)}},[a,h,c,f,m]),{onPointerDownCapture:()=>x.current=!0}}function px(o,d=globalThis==null?void 0:globalThis.document){const a=Ps(o),c=p.useRef(!1);return p.useEffect(()=>{const f=m=>{m.target&&!c.current&&hf(ix,a,{originalEvent:m},{discrete:!1})};return d.addEventListener("focusin",f),()=>d.removeEventListener("focusin",f)},[d,a]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Au(){const o=new CustomEvent(wi);document.dispatchEvent(o)}function hf(o,d,a,{discrete:c}){const f=a.originalEvent.target,m=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:a});d&&f.addEventListener(o,d,{once:!0}),c?sx(f,m):f.dispatchEvent(m)}var si="focusScope.autoFocusOnMount",oi="focusScope.autoFocusOnUnmount",Ou={bubbles:!1,cancelable:!0},mx="FocusScope",xf=p.forwardRef((o,d)=>{const{loop:a=!1,trapped:c=!1,onMountAutoFocus:f,onUnmountAutoFocus:m,...h}=o,[x,E]=p.useState(null),b=Ps(f),k=Ps(m),M=p.useRef(null),A=Kr(d,S=>E(S)),I=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(c){let S=function(Z){if(I.paused||!x)return;const Y=Z.target;x.contains(Y)?M.current=Y:Nr(M.current,{select:!0})},C=function(Z){if(I.paused||!x)return;const Y=Z.relatedTarget;Y!==null&&(x.contains(Y)||Nr(M.current,{select:!0}))},_=function(Z){if(document.activeElement===document.body)for(const H of Z)H.removedNodes.length>0&&Nr(x)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const L=new MutationObserver(_);return x&&L.observe(x,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),L.disconnect()}}},[c,x,I.paused]),p.useEffect(()=>{if(x){Iu.add(I);const S=document.activeElement;if(!x.contains(S)){const _=new CustomEvent(si,Ou);x.addEventListener(si,b),x.dispatchEvent(_),_.defaultPrevented||(hx(bx(gf(x)),{select:!0}),document.activeElement===S&&Nr(x))}return()=>{x.removeEventListener(si,b),setTimeout(()=>{const _=new CustomEvent(oi,Ou);x.addEventListener(oi,k),x.dispatchEvent(_),_.defaultPrevented||Nr(S??document.body,{select:!0}),x.removeEventListener(oi,k),Iu.remove(I)},0)}}},[x,b,k,I]);const O=p.useCallback(S=>{if(!a&&!c||I.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,_=document.activeElement;if(C&&_){const L=S.currentTarget,[Z,Y]=xx(L);Z&&Y?!S.shiftKey&&_===Y?(S.preventDefault(),a&&Nr(Z,{select:!0})):S.shiftKey&&_===Z&&(S.preventDefault(),a&&Nr(Y,{select:!0})):_===L&&S.preventDefault()}},[a,c,I.paused]);return n.jsx(Je.div,{tabIndex:-1,...h,ref:A,onKeyDown:O})});xf.displayName=mx;function hx(o,{select:d=!1}={}){const a=document.activeElement;for(const c of o)if(Nr(c,{select:d}),document.activeElement!==a)return}function xx(o){const d=gf(o),a=Tu(d,o),c=Tu(d.reverse(),o);return[a,c]}function gf(o){const d=[],a=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const f=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||f?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)d.push(a.currentNode);return d}function Tu(o,d){for(const a of o)if(!gx(a,{upTo:d}))return a}function gx(o,{upTo:d}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(d!==void 0&&o===d)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function vx(o){return o instanceof HTMLInputElement&&"select"in o}function Nr(o,{select:d=!1}={}){if(o&&o.focus){const a=document.activeElement;o.focus({preventScroll:!0}),o!==a&&vx(o)&&d&&o.select()}}var Iu=yx();function yx(){let o=[];return{add(d){const a=o[0];d!==a&&(a==null||a.pause()),o=Fu(o,d),o.unshift(d)},remove(d){var a;o=Fu(o,d),(a=o[0])==null||a.resume()}}}function Fu(o,d){const a=[...o],c=a.indexOf(d);return c!==-1&&a.splice(c,1),a}function bx(o){return o.filter(d=>d.tagName!=="A")}var wx="Portal",vf=p.forwardRef((o,d)=>{var x;const{container:a,...c}=o,[f,m]=p.useState(!1);_s(()=>m(!0),[]);const h=a||f&&((x=globalThis==null?void 0:globalThis.document)==null?void 0:x.body);return h?ff.createPortal(n.jsx(Je.div,{...c,ref:d}),h):null});vf.displayName=wx;function jx(o,d){return p.useReducer((a,c)=>d[a][c]??a,o)}var sl=o=>{const{present:d,children:a}=o,c=kx(d),f=typeof a=="function"?a({present:c.isPresent}):p.Children.only(a),m=Nx(c.ref,Sx(f));return typeof a=="function"||c.isPresent?p.cloneElement(f,{ref:m}):null};sl.displayName="Presence";function kx(o){const[d,a]=p.useState(),c=p.useRef(null),f=p.useRef(o),m=p.useRef("none"),h=o?"mounted":"unmounted",[x,E]=jx(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const b=Bo(c.current);m.current=x==="mounted"?b:"none"},[x]),_s(()=>{const b=c.current,k=f.current;if(k!==o){const A=m.current,I=Bo(b);o?E("MOUNT"):I==="none"||(b==null?void 0:b.display)==="none"?E("UNMOUNT"):E(k&&A!==I?"ANIMATION_OUT":"UNMOUNT"),f.current=o}},[o,E]),_s(()=>{if(d){let b;const k=d.ownerDocument.defaultView??window,M=I=>{const S=Bo(c.current).includes(CSS.escape(I.animationName));if(I.target===d&&S&&(E("ANIMATION_END"),!f.current)){const C=d.style.animationFillMode;d.style.animationFillMode="forwards",b=k.setTimeout(()=>{d.style.animationFillMode==="forwards"&&(d.style.animationFillMode=C)})}},A=I=>{I.target===d&&(m.current=Bo(c.current))};return d.addEventListener("animationstart",A),d.addEventListener("animationcancel",M),d.addEventListener("animationend",M),()=>{k.clearTimeout(b),d.removeEventListener("animationstart",A),d.removeEventListener("animationcancel",M),d.removeEventListener("animationend",M)}}else E("ANIMATION_END")},[d,E]),{isPresent:["mounted","unmountSuspended"].includes(x),ref:p.useCallback(b=>{c.current=b?getComputedStyle(b):null,a(b)},[])}}function $u(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Nx(...o){const d=p.useRef(o);return d.current=o,p.useCallback(a=>{const c=d.current;let f=!1;const m=c.map(h=>{const x=$u(h,a);return!f&&typeof x=="function"&&(f=!0),x});if(f)return()=>{for(let h=0;h{It||(It={start:Uu(),end:Uu()});const{start:o,end:d}=It;return document.body.firstElementChild!==o&&document.body.insertAdjacentElement("afterbegin",o),document.body.lastElementChild!==d&&document.body.insertAdjacentElement("beforeend",d),Vo++,()=>{Vo===1&&(It==null||It.start.remove(),It==null||It.end.remove(),It=null),Vo=Math.max(0,Vo-1)}},[])}function Uu(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var Ft=function(){return Ft=Object.assign||function(d){for(var a,c=1,f=arguments.length;c"u")return Vx;var d=Wx(o),a=document.documentElement.clientWidth,c=window.innerWidth;return{left:d[0],top:d[1],right:d[2],gap:Math.max(0,c-a+d[2]-d[0])}},Gx=jf(),Mn="data-scroll-locked",Kx=function(o,d,a,c){var f=o.left,m=o.top,h=o.right,x=o.gap;return a===void 0&&(a="margin"),` + */const Gr=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),yi=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:bh},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:lh},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:yt},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Cs},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:jh},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Ss},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:uh}];var Mu=1,Rh=.9,zh=.8,Dh=.17,ri=.1,ni=.999,Lh=.9999,Ah=.99,Oh=/[\\\/_+.#"@\[\(\{&]/,Th=/[\\\/_+.#"@\[\(\{&]/g,Ih=/[\s-]/,uf=/[\s-]/g;function bi(o,d,a,c,f,m,h){if(m===d.length)return f===o.length?Mu:Ah;var x=`${f},${m}`;if(h[x]!==void 0)return h[x];for(var C=c.charAt(m),b=a.indexOf(C,f),j=0,P,L,F,A;b>=0;)P=bi(o,d,a,c,b+1,m+1,h),P>j&&(b===f?P*=Mu:Oh.test(o.charAt(b-1))?(P*=zh,F=o.slice(f,b-1).match(Th),F&&f>0&&(P*=Math.pow(ni,F.length))):Ih.test(o.charAt(b-1))?(P*=Rh,A=o.slice(f,b-1).match(uf),A&&f>0&&(P*=Math.pow(ni,A.length))):(P*=Dh,f>0&&(P*=Math.pow(ni,b-f))),o.charAt(b)!==d.charAt(m)&&(P*=Lh)),(PP&&(P=L*ri)),P>j&&(j=P),b=a.indexOf(C,b+1);return h[x]=j,j}function Ru(o){return o.toLowerCase().replace(uf," ")}function Fh(o,d,a){return o=a&&a.length>0?`${o+" "+a.join(" ")}`:o,bi(o,d,Ru(o),Ru(d),0,0,{})}function Cr(o,d,{checkForDefaultPrevented:a=!0}={}){return function(f){if(o==null||o(f),a===!1||!f.defaultPrevented)return d==null?void 0:d(f)}}function zu(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Ln(...o){return d=>{let a=!1;const c=o.map(f=>{const m=zu(f,d);return!a&&typeof m=="function"&&(a=!0),m});if(a)return()=>{for(let f=0;f{var E;const{scope:L,children:F,...A}=P,N=((E=L==null?void 0:L[o])==null?void 0:E[C])||x,S=p.useMemo(()=>A,Object.values(A));return n.jsx(N.Provider,{value:S,children:F})};b.displayName=m+"Provider";function j(P,L){var N;const F=((N=L==null?void 0:L[o])==null?void 0:N[C])||x,A=p.useContext(F);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${P}\` must be used within \`${m}\``)}return[b,j]}const f=()=>{const m=a.map(h=>p.createContext(h));return function(x){const C=(x==null?void 0:x[o])||m;return p.useMemo(()=>({[`__scope${o}`]:{...x,[o]:C}}),[x,C])}};return f.scopeName=o,[c,Uh(f,...d)]}function Uh(...o){const d=o[0];if(o.length===1)return d;const a=()=>{const c=o.map(f=>({useScope:f(),scopeName:f.scopeName}));return function(m){const h=c.reduce((x,{useScope:C,scopeName:b})=>{const P=C(m)[`__scope${b}`];return{...x,...P}},{});return p.useMemo(()=>({[`__scope${d.scopeName}`]:h}),[h])}};return a.scopeName=d.scopeName,a}var _s=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Bh=Ei[" useId ".trim().toString()]||(()=>{}),Vh=0;function er(o){const[d,a]=p.useState(Bh());return _s(()=>{a(c=>c??String(Vh++))},[o]),d?`radix-${d}`:""}var Wh=Ei[" useInsertionEffect ".trim().toString()]||_s;function Hh({prop:o,defaultProp:d,onChange:a=()=>{},caller:c}){const[f,m,h]=Gh({defaultProp:d,onChange:a}),x=o!==void 0,C=x?o:f;{const j=p.useRef(o!==void 0);p.useEffect(()=>{const P=j.current;P!==x&&console.warn(`${c} is changing from ${P?"controlled":"uncontrolled"} to ${x?"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.`),j.current=x},[x,c])}const b=p.useCallback(j=>{var P;if(x){const L=Kh(j)?j(o):j;L!==o&&((P=h.current)==null||P.call(h,L))}else m(j)},[x,o,m,h]);return[C,b]}function Gh({defaultProp:o,onChange:d}){const[a,c]=p.useState(o),f=p.useRef(a),m=p.useRef(d);return Wh(()=>{m.current=d},[d]),p.useEffect(()=>{var h;f.current!==a&&((h=m.current)==null||h.call(m,a),f.current=a)},[a,f]),[a,c,m]}function Kh(o){return typeof o=="function"}var ff=nf();function pf(o){const d=p.forwardRef((a,c)=>{let{children:f,...m}=a,h=null,x=!1;const C=[];Du(f)&&typeof Uo=="function"&&(f=Uo(f._payload)),p.Children.forEach(f,L=>{var F;if(Jh(L)){x=!0;const A=L;let N="child"in A.props?A.props.child:A.props.children;Du(N)&&typeof Uo=="function"&&(N=Uo(N._payload)),h=qh(A,N),C.push((F=h==null?void 0:h.props)==null?void 0:F.children)}else C.push(L)}),h?h=p.cloneElement(h,void 0,C):!x&&p.Children.count(f)===1&&p.isValidElement(f)&&(h=f);const b=h?Yh(h):void 0,j=Qr(c,b);if(!h){if(f||f===0)throw new Error(x?rx(o):tx(o));return f}const P=Zh(m,h.props??{});return h.type!==p.Fragment&&(P.ref=c?j:b),p.cloneElement(h,P)});return d.displayName=`${o}.Slot`,d}var Qh=Symbol.for("radix.slottable"),qh=(o,d)=>{if("child"in o.props){const a=o.props.child;return p.isValidElement(a)?p.cloneElement(a,void 0,o.props.children(a.props.children)):null}return p.isValidElement(d)?d:null};function Zh(o,d){const a={...d};for(const c in d){const f=o[c],m=d[c];/^on[A-Z]/.test(c)?f&&m?a[c]=(...x)=>{const C=m(...x);return f(...x),C}:f&&(a[c]=f):c==="style"?a[c]={...f,...m}:c==="className"&&(a[c]=[f,m].filter(Boolean).join(" "))}return{...o,...a}}function Yh(o){var c,f;let d=(c=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:c.get,a=d&&"isReactWarning"in d&&d.isReactWarning;return a?o.ref:(d=(f=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:f.get,a=d&&"isReactWarning"in d&&d.isReactWarning,a?o.props.ref:o.props.ref||o.ref)}function Jh(o){return p.isValidElement(o)&&typeof o.type=="function"&&"__radixId"in o.type&&o.type.__radixId===Qh}var Xh=Symbol.for("react.lazy");function Du(o){return o!=null&&typeof o=="object"&&"$$typeof"in o&&o.$$typeof===Xh&&"_payload"in o&&ex(o._payload)}function ex(o){return typeof o=="object"&&o!==null&&"then"in o}var tx=o=>`${o} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,rx=o=>`${o} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Uo=Ei[" use ".trim().toString()],nx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=nx.reduce((o,d)=>{const a=pf(`Primitive.${d}`),c=p.forwardRef((f,m)=>{const{asChild:h,...x}=f,C=h?a:d;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(C,{...x,ref:m})});return c.displayName=`Primitive.${d}`,{...o,[d]:c}},{});function sx(o,d){o&&ff.flushSync(()=>o.dispatchEvent(d))}function Ps(o){const d=p.useRef(o);return p.useEffect(()=>{d.current=o}),p.useMemo(()=>((...a)=>{var c;return(c=d.current)==null?void 0:c.call(d,...a)}),[])}function ox(o,d=globalThis==null?void 0:globalThis.document){const a=Ps(o);p.useEffect(()=>{const c=f=>{f.key==="Escape"&&a(f)};return d.addEventListener("keydown",c,{capture:!0}),()=>d.removeEventListener("keydown",c,{capture:!0})},[a,d])}var lx="DismissableLayer",wi="dismissableLayer.update",ax="dismissableLayer.pointerDownOutside",ix="dismissableLayer.focusOutside",Lu,Pi=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),mf=p.forwardRef((o,d)=>{const{disableOutsidePointerEvents:a=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:C,...b}=o,j=p.useContext(Pi),[P,L]=p.useState(null),F=(P==null?void 0:P.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,A]=p.useState({}),N=Qr(d,se=>L(se)),S=Array.from(j.layers),[E]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),D=S.indexOf(E),Z=P?S.indexOf(P):-1,Y=j.layersWithOutsidePointerEventsDisabled.size>0,G=Z>=D,I=p.useRef(!1),$=fx(se=>{const X=se.target;if(!(X instanceof Node))return;const be=[...j.branches].some(ce=>ce.contains(X));!G||be||(m==null||m(se),x==null||x(se),se.defaultPrevented||C==null||C())},{ownerDocument:F,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:j.dismissableSurfaces}),ne=px(se=>{if(c&&I.current)return;const X=se.target;[...j.branches].some(ce=>ce.contains(X))||(h==null||h(se),x==null||x(se),se.defaultPrevented||C==null||C())},F);return ox(se=>{Z===j.layers.size-1&&(f==null||f(se),!se.defaultPrevented&&C&&(se.preventDefault(),C()))},F),p.useEffect(()=>{if(P)return a&&(j.layersWithOutsidePointerEventsDisabled.size===0&&(Lu=F.body.style.pointerEvents,F.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(P)),j.layers.add(P),Au(),()=>{a&&(j.layersWithOutsidePointerEventsDisabled.delete(P),j.layersWithOutsidePointerEventsDisabled.size===0&&(F.body.style.pointerEvents=Lu))}},[P,F,a,j]),p.useEffect(()=>()=>{P&&(j.layers.delete(P),j.layersWithOutsidePointerEventsDisabled.delete(P),Au())},[P,j]),p.useEffect(()=>{const se=()=>A({});return document.addEventListener(wi,se),()=>document.removeEventListener(wi,se)},[]),n.jsx(Je.div,{...b,ref:N,style:{pointerEvents:Y?G?"auto":"none":void 0,...o.style},onFocusCapture:Cr(o.onFocusCapture,ne.onFocusCapture),onBlurCapture:Cr(o.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:Cr(o.onPointerDownCapture,$.onPointerDownCapture)})});mf.displayName=lx;var dx="DismissableLayerBranch",cx=p.forwardRef((o,d)=>{const a=p.useContext(Pi),c=p.useRef(null),f=Qr(d,c);return p.useEffect(()=>{const m=c.current;if(m)return a.branches.add(m),()=>{a.branches.delete(m)}},[a.branches]),n.jsx(Je.div,{...o,ref:f})});cx.displayName=dx;function ux(){const o=p.useContext(Pi),[d,a]=p.useState(null);return p.useEffect(()=>{if(d)return o.dismissableSurfaces.add(d),()=>{o.dismissableSurfaces.delete(d)}},[d,o.dismissableSurfaces]),a}function fx(o,d){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:f,dismissableSurfaces:m}=d,h=Ps(o),x=p.useRef(!1),C=p.useRef(!1),b=p.useRef(new Map),j=p.useRef(()=>{});return p.useEffect(()=>{function P(){C.current=!1,f.current=!1,b.current.clear()}function L(){return Array.from(b.current.values()).some(Boolean)}function F(D){if(!C.current)return;const Z=D.target;Z instanceof Node&&[...m].some(G=>G.contains(Z))||b.current.set(D.type,!0),D.type==="click"&&window.setTimeout(()=>{C.current&&j.current()},0)}function A(D){C.current&&b.current.set(D.type,!1)}const N=D=>{if(D.target&&!x.current){let Z=function(){a.removeEventListener("click",j.current);const G=L();P(),G||hf(ax,h,Y,{discrete:!0})};const Y={originalEvent:D};C.current=!0,f.current=c&&D.button===0,b.current.clear(),!c||D.button!==0?Z():(a.removeEventListener("click",j.current),j.current=Z,a.addEventListener("click",j.current,{once:!0}))}else a.removeEventListener("click",j.current),P();x.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const D of S)a.addEventListener(D,F,!0),a.addEventListener(D,A);const E=window.setTimeout(()=>{a.addEventListener("pointerdown",N)},0);return()=>{window.clearTimeout(E),a.removeEventListener("pointerdown",N),a.removeEventListener("click",j.current);for(const D of S)a.removeEventListener(D,F,!0),a.removeEventListener(D,A)}},[a,h,c,f,m]),{onPointerDownCapture:()=>x.current=!0}}function px(o,d=globalThis==null?void 0:globalThis.document){const a=Ps(o),c=p.useRef(!1);return p.useEffect(()=>{const f=m=>{m.target&&!c.current&&hf(ix,a,{originalEvent:m},{discrete:!1})};return d.addEventListener("focusin",f),()=>d.removeEventListener("focusin",f)},[d,a]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Au(){const o=new CustomEvent(wi);document.dispatchEvent(o)}function hf(o,d,a,{discrete:c}){const f=a.originalEvent.target,m=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:a});d&&f.addEventListener(o,d,{once:!0}),c?sx(f,m):f.dispatchEvent(m)}var si="focusScope.autoFocusOnMount",oi="focusScope.autoFocusOnUnmount",Ou={bubbles:!1,cancelable:!0},mx="FocusScope",xf=p.forwardRef((o,d)=>{const{loop:a=!1,trapped:c=!1,onMountAutoFocus:f,onUnmountAutoFocus:m,...h}=o,[x,C]=p.useState(null),b=Ps(f),j=Ps(m),P=p.useRef(null),L=Qr(d,N=>C(N)),F=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(c){let N=function(Z){if(F.paused||!x)return;const Y=Z.target;x.contains(Y)?P.current=Y:Sr(P.current,{select:!0})},S=function(Z){if(F.paused||!x)return;const Y=Z.relatedTarget;Y!==null&&(x.contains(Y)||Sr(P.current,{select:!0}))},E=function(Z){if(document.activeElement===document.body)for(const G of Z)G.removedNodes.length>0&&Sr(x)};document.addEventListener("focusin",N),document.addEventListener("focusout",S);const D=new MutationObserver(E);return x&&D.observe(x,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",S),D.disconnect()}}},[c,x,F.paused]),p.useEffect(()=>{if(x){Iu.add(F);const N=document.activeElement;if(!x.contains(N)){const E=new CustomEvent(si,Ou);x.addEventListener(si,b),x.dispatchEvent(E),E.defaultPrevented||(hx(bx(gf(x)),{select:!0}),document.activeElement===N&&Sr(x))}return()=>{x.removeEventListener(si,b),setTimeout(()=>{const E=new CustomEvent(oi,Ou);x.addEventListener(oi,j),x.dispatchEvent(E),E.defaultPrevented||Sr(N??document.body,{select:!0}),x.removeEventListener(oi,j),Iu.remove(F)},0)}}},[x,b,j,F]);const A=p.useCallback(N=>{if(!a&&!c||F.paused)return;const S=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,E=document.activeElement;if(S&&E){const D=N.currentTarget,[Z,Y]=xx(D);Z&&Y?!N.shiftKey&&E===Y?(N.preventDefault(),a&&Sr(Z,{select:!0})):N.shiftKey&&E===Z&&(N.preventDefault(),a&&Sr(Y,{select:!0})):E===D&&N.preventDefault()}},[a,c,F.paused]);return n.jsx(Je.div,{tabIndex:-1,...h,ref:L,onKeyDown:A})});xf.displayName=mx;function hx(o,{select:d=!1}={}){const a=document.activeElement;for(const c of o)if(Sr(c,{select:d}),document.activeElement!==a)return}function xx(o){const d=gf(o),a=Tu(d,o),c=Tu(d.reverse(),o);return[a,c]}function gf(o){const d=[],a=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const f=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||f?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)d.push(a.currentNode);return d}function Tu(o,d){for(const a of o)if(!gx(a,{upTo:d}))return a}function gx(o,{upTo:d}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(d!==void 0&&o===d)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function vx(o){return o instanceof HTMLInputElement&&"select"in o}function Sr(o,{select:d=!1}={}){if(o&&o.focus){const a=document.activeElement;o.focus({preventScroll:!0}),o!==a&&vx(o)&&d&&o.select()}}var Iu=yx();function yx(){let o=[];return{add(d){const a=o[0];d!==a&&(a==null||a.pause()),o=Fu(o,d),o.unshift(d)},remove(d){var a;o=Fu(o,d),(a=o[0])==null||a.resume()}}}function Fu(o,d){const a=[...o],c=a.indexOf(d);return c!==-1&&a.splice(c,1),a}function bx(o){return o.filter(d=>d.tagName!=="A")}var wx="Portal",vf=p.forwardRef((o,d)=>{var x;const{container:a,...c}=o,[f,m]=p.useState(!1);_s(()=>m(!0),[]);const h=a||f&&((x=globalThis==null?void 0:globalThis.document)==null?void 0:x.body);return h?ff.createPortal(n.jsx(Je.div,{...c,ref:d}),h):null});vf.displayName=wx;function jx(o,d){return p.useReducer((a,c)=>d[a][c]??a,o)}var sl=o=>{const{present:d,children:a}=o,c=kx(d),f=typeof a=="function"?a({present:c.isPresent}):p.Children.only(a),m=Nx(c.ref,Sx(f));return typeof a=="function"||c.isPresent?p.cloneElement(f,{ref:m}):null};sl.displayName="Presence";function kx(o){const[d,a]=p.useState(),c=p.useRef(null),f=p.useRef(o),m=p.useRef("none"),h=o?"mounted":"unmounted",[x,C]=jx(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const b=Bo(c.current);m.current=x==="mounted"?b:"none"},[x]),_s(()=>{const b=c.current,j=f.current;if(j!==o){const L=m.current,F=Bo(b);o?C("MOUNT"):F==="none"||(b==null?void 0:b.display)==="none"?C("UNMOUNT"):C(j&&L!==F?"ANIMATION_OUT":"UNMOUNT"),f.current=o}},[o,C]),_s(()=>{if(d){let b;const j=d.ownerDocument.defaultView??window,P=F=>{const N=Bo(c.current).includes(CSS.escape(F.animationName));if(F.target===d&&N&&(C("ANIMATION_END"),!f.current)){const S=d.style.animationFillMode;d.style.animationFillMode="forwards",b=j.setTimeout(()=>{d.style.animationFillMode==="forwards"&&(d.style.animationFillMode=S)})}},L=F=>{F.target===d&&(m.current=Bo(c.current))};return d.addEventListener("animationstart",L),d.addEventListener("animationcancel",P),d.addEventListener("animationend",P),()=>{j.clearTimeout(b),d.removeEventListener("animationstart",L),d.removeEventListener("animationcancel",P),d.removeEventListener("animationend",P)}}else C("ANIMATION_END")},[d,C]),{isPresent:["mounted","unmountSuspended"].includes(x),ref:p.useCallback(b=>{c.current=b?getComputedStyle(b):null,a(b)},[])}}function $u(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Nx(...o){const d=p.useRef(o);return d.current=o,p.useCallback(a=>{const c=d.current;let f=!1;const m=c.map(h=>{const x=$u(h,a);return!f&&typeof x=="function"&&(f=!0),x});if(f)return()=>{for(let h=0;h{$t||($t={start:Uu(),end:Uu()});const{start:o,end:d}=$t;return document.body.firstElementChild!==o&&document.body.insertAdjacentElement("afterbegin",o),document.body.lastElementChild!==d&&document.body.insertAdjacentElement("beforeend",d),Vo++,()=>{Vo===1&&($t==null||$t.start.remove(),$t==null||$t.end.remove(),$t=null),Vo=Math.max(0,Vo-1)}},[])}function Uu(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var Ut=function(){return Ut=Object.assign||function(d){for(var a,c=1,f=arguments.length;c"u")return Vx;var d=Wx(o),a=document.documentElement.clientWidth,c=window.innerWidth;return{left:d[0],top:d[1],right:d[2],gap:Math.max(0,c-a+d[2]-d[0])}},Gx=jf(),Rn="data-scroll-locked",Kx=function(o,d,a,c){var f=o.left,m=o.top,h=o.right,x=o.gap;return a===void 0&&(a="margin"),` .`.concat(_x,` { overflow: hidden `).concat(c,`; padding-right: `).concat(x,"px ").concat(c,`; } - body[`).concat(Mn,`] { + body[`).concat(Rn,`] { overflow: hidden `).concat(c,`; overscroll-behavior: contain; `).concat([d&&"position: relative ".concat(c,";"),a==="margin"&&` @@ -346,13 +346,13 @@ Error generating stack: `+i.message+` margin-right: 0 `).concat(c,`; } - body[`).concat(Mn,`] { + body[`).concat(Rn,`] { `).concat(Px,": ").concat(x,`px; } -`)},Vu=function(){var o=parseInt(document.body.getAttribute(Mn)||"0",10);return isFinite(o)?o:0},Qx=function(){p.useEffect(function(){return document.body.setAttribute(Mn,(Vu()+1).toString()),function(){var o=Vu()-1;o<=0?document.body.removeAttribute(Mn):document.body.setAttribute(Mn,o.toString())}},[])},qx=function(o){var d=o.noRelative,a=o.noImportant,c=o.gapMode,f=c===void 0?"margin":c;Qx();var m=p.useMemo(function(){return Hx(f)},[f]);return p.createElement(Gx,{styles:Kx(m,!d,f,a?"":"!important")})},ji=!1;if(typeof window<"u")try{var Wo=Object.defineProperty({},"passive",{get:function(){return ji=!0,!0}});window.addEventListener("test",Wo,Wo),window.removeEventListener("test",Wo,Wo)}catch{ji=!1}var kn=ji?{passive:!1}:!1,Zx=function(o){return o.tagName==="TEXTAREA"},kf=function(o,d){if(!(o instanceof Element))return!1;var a=window.getComputedStyle(o);return a[d]!=="hidden"&&!(a.overflowY===a.overflowX&&!Zx(o)&&a[d]==="visible")},Yx=function(o){return kf(o,"overflowY")},Jx=function(o){return kf(o,"overflowX")},Wu=function(o,d){var a=d.ownerDocument,c=d;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var f=Nf(o,c);if(f){var m=Sf(o,c),h=m[1],x=m[2];if(h>x)return!0}c=c.parentNode}while(c&&c!==a.body);return!1},Xx=function(o){var d=o.scrollTop,a=o.scrollHeight,c=o.clientHeight;return[d,a,c]},eg=function(o){var d=o.scrollLeft,a=o.scrollWidth,c=o.clientWidth;return[d,a,c]},Nf=function(o,d){return o==="v"?Yx(d):Jx(d)},Sf=function(o,d){return o==="v"?Xx(d):eg(d)},tg=function(o,d){return o==="h"&&d==="rtl"?-1:1},rg=function(o,d,a,c,f){var m=tg(o,window.getComputedStyle(d).direction),h=m*c,x=a.target,E=d.contains(x),b=!1,k=h>0,M=0,A=0;do{if(!x)break;var I=Sf(o,x),O=I[0],S=I[1],C=I[2],_=S-C-m*O;(O||_)&&Nf(o,x)&&(M+=_,A+=O);var L=x.parentNode;x=L&&L.nodeType===Node.DOCUMENT_FRAGMENT_NODE?L.host:L}while(!E&&x!==document.body||E&&(d.contains(x)||d===x));return(k&&Math.abs(M)<1||!k&&Math.abs(A)<1)&&(b=!0),b},Ho=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},Hu=function(o){return[o.deltaX,o.deltaY]},Gu=function(o){return o&&"current"in o?o.current:o},ng=function(o,d){return o[0]===d[0]&&o[1]===d[1]},sg=function(o){return` +`)},Vu=function(){var o=parseInt(document.body.getAttribute(Rn)||"0",10);return isFinite(o)?o:0},Qx=function(){p.useEffect(function(){return document.body.setAttribute(Rn,(Vu()+1).toString()),function(){var o=Vu()-1;o<=0?document.body.removeAttribute(Rn):document.body.setAttribute(Rn,o.toString())}},[])},qx=function(o){var d=o.noRelative,a=o.noImportant,c=o.gapMode,f=c===void 0?"margin":c;Qx();var m=p.useMemo(function(){return Hx(f)},[f]);return p.createElement(Gx,{styles:Kx(m,!d,f,a?"":"!important")})},ji=!1;if(typeof window<"u")try{var Wo=Object.defineProperty({},"passive",{get:function(){return ji=!0,!0}});window.addEventListener("test",Wo,Wo),window.removeEventListener("test",Wo,Wo)}catch{ji=!1}var Nn=ji?{passive:!1}:!1,Zx=function(o){return o.tagName==="TEXTAREA"},kf=function(o,d){if(!(o instanceof Element))return!1;var a=window.getComputedStyle(o);return a[d]!=="hidden"&&!(a.overflowY===a.overflowX&&!Zx(o)&&a[d]==="visible")},Yx=function(o){return kf(o,"overflowY")},Jx=function(o){return kf(o,"overflowX")},Wu=function(o,d){var a=d.ownerDocument,c=d;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var f=Nf(o,c);if(f){var m=Sf(o,c),h=m[1],x=m[2];if(h>x)return!0}c=c.parentNode}while(c&&c!==a.body);return!1},Xx=function(o){var d=o.scrollTop,a=o.scrollHeight,c=o.clientHeight;return[d,a,c]},eg=function(o){var d=o.scrollLeft,a=o.scrollWidth,c=o.clientWidth;return[d,a,c]},Nf=function(o,d){return o==="v"?Yx(d):Jx(d)},Sf=function(o,d){return o==="v"?Xx(d):eg(d)},tg=function(o,d){return o==="h"&&d==="rtl"?-1:1},rg=function(o,d,a,c,f){var m=tg(o,window.getComputedStyle(d).direction),h=m*c,x=a.target,C=d.contains(x),b=!1,j=h>0,P=0,L=0;do{if(!x)break;var F=Sf(o,x),A=F[0],N=F[1],S=F[2],E=N-S-m*A;(A||E)&&Nf(o,x)&&(P+=E,L+=A);var D=x.parentNode;x=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!C&&x!==document.body||C&&(d.contains(x)||d===x));return(j&&Math.abs(P)<1||!j&&Math.abs(L)<1)&&(b=!0),b},Ho=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},Hu=function(o){return[o.deltaX,o.deltaY]},Gu=function(o){return o&&"current"in o?o.current:o},ng=function(o,d){return o[0]===d[0]&&o[1]===d[1]},sg=function(o){return` .block-interactivity-`.concat(o,` {pointer-events: none;} .allow-interactivity-`).concat(o,` {pointer-events: all;} -`)},og=0,Nn=[];function lg(o){var d=p.useRef([]),a=p.useRef([0,0]),c=p.useRef(),f=p.useState(og++)[0],m=p.useState(jf)[0],h=p.useRef(o);p.useEffect(function(){h.current=o},[o]),p.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(f));var S=Ex([o.lockRef.current],(o.shards||[]).map(Gu),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(f))}),function(){document.body.classList.remove("block-interactivity-".concat(f)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(f))})}}},[o.inert,o.lockRef.current,o.shards]);var x=p.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!h.current.allowPinchZoom;var _=Ho(S),L=a.current,Z="deltaX"in S?S.deltaX:L[0]-_[0],Y="deltaY"in S?S.deltaY:L[1]-_[1],H,T=S.target,F=Math.abs(Z)>Math.abs(Y)?"h":"v";if("touches"in S&&F==="h"&&T.type==="range")return!1;var ne=window.getSelection(),se=ne&&ne.anchorNode,X=se?se===T||se.contains(T):!1;if(X)return!1;var ye=Wu(F,T);if(!ye)return!0;if(ye?H=F:(H=F==="v"?"h":"v",ye=Wu(F,T)),!ye)return!1;if(!c.current&&"changedTouches"in S&&(Z||Y)&&(c.current=H),!H)return!0;var ce=c.current||H;return rg(ce,C,S,ce==="h"?Z:Y)},[]),E=p.useCallback(function(S){var C=S;if(!(!Nn.length||Nn[Nn.length-1]!==m)){var _="deltaY"in C?Hu(C):Ho(C),L=d.current.filter(function(H){return H.name===C.type&&(H.target===C.target||C.target===H.shadowParent)&&ng(H.delta,_)})[0];if(L&&L.should){C.cancelable&&C.preventDefault();return}if(!L){var Z=(h.current.shards||[]).map(Gu).filter(Boolean).filter(function(H){return H.contains(C.target)}),Y=Z.length>0?x(C,Z[0]):!h.current.noIsolation;Y&&C.cancelable&&C.preventDefault()}}},[]),b=p.useCallback(function(S,C,_,L){var Z={name:S,delta:C,target:_,should:L,shadowParent:ag(_)};d.current.push(Z),setTimeout(function(){d.current=d.current.filter(function(Y){return Y!==Z})},1)},[]),k=p.useCallback(function(S){a.current=Ho(S),c.current=void 0},[]),M=p.useCallback(function(S){b(S.type,Hu(S),S.target,x(S,o.lockRef.current))},[]),A=p.useCallback(function(S){b(S.type,Ho(S),S.target,x(S,o.lockRef.current))},[]);p.useEffect(function(){return Nn.push(m),o.setCallbacks({onScrollCapture:M,onWheelCapture:M,onTouchMoveCapture:A}),document.addEventListener("wheel",E,kn),document.addEventListener("touchmove",E,kn),document.addEventListener("touchstart",k,kn),function(){Nn=Nn.filter(function(S){return S!==m}),document.removeEventListener("wheel",E,kn),document.removeEventListener("touchmove",E,kn),document.removeEventListener("touchstart",k,kn)}},[]);var I=o.removeScrollBar,O=o.inert;return p.createElement(p.Fragment,null,O?p.createElement(m,{styles:sg(f)}):null,I?p.createElement(qx,{noRelative:o.noRelative,gapMode:o.gapMode}):null)}function ag(o){for(var d=null;o!==null;)o instanceof ShadowRoot&&(d=o.host,o=o.host),o=o.parentNode;return d}const ig=Ox(wf,lg);var Cf=p.forwardRef(function(o,d){return p.createElement(ol,Ft({},o,{ref:d,sideCar:ig}))});Cf.classNames=ol.classNames;var dg=function(o){if(typeof document>"u")return null;var d=Array.isArray(o)?o[0]:o;return d.ownerDocument.body},Sn=new WeakMap,Go=new WeakMap,Ko={},di=0,Ef=function(o){return o&&(o.host||Ef(o.parentNode))},cg=function(o,d){return d.map(function(a){if(o.contains(a))return a;var c=Ef(a);return c&&o.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",o,". Doing nothing"),null)}).filter(function(a){return!!a})},ug=function(o,d,a,c){var f=cg(d,Array.isArray(o)?o:[o]);Ko[a]||(Ko[a]=new WeakMap);var m=Ko[a],h=[],x=new Set,E=new Set(f),b=function(M){!M||x.has(M)||(x.add(M),b(M.parentNode))};f.forEach(b);var k=function(M){!M||E.has(M)||Array.prototype.forEach.call(M.children,function(A){if(x.has(A))k(A);else try{var I=A.getAttribute(c),O=I!==null&&I!=="false",S=(Sn.get(A)||0)+1,C=(m.get(A)||0)+1;Sn.set(A,S),m.set(A,C),h.push(A),S===1&&O&&Go.set(A,!0),C===1&&A.setAttribute(a,"true"),O||A.setAttribute(c,"true")}catch(_){console.error("aria-hidden: cannot operate on ",A,_)}})};return k(d),x.clear(),di++,function(){h.forEach(function(M){var A=Sn.get(M)-1,I=m.get(M)-1;Sn.set(M,A),m.set(M,I),A||(Go.has(M)||M.removeAttribute(c),Go.delete(M)),I||M.removeAttribute(a)}),di--,di||(Sn=new WeakMap,Sn=new WeakMap,Go=new WeakMap,Ko={})}},fg=function(o,d,a){a===void 0&&(a="data-aria-hidden");var c=Array.from(Array.isArray(o)?o:[o]),f=dg(o);return f?(c.push.apply(c,Array.from(f.querySelectorAll("[aria-live], script"))),ug(c,f,a,"aria-hidden")):function(){return null}},ll="Dialog",[_f]=$h(ll),[pg,zt]=_f(ll),Pf=o=>{const{__scopeDialog:d,children:a,open:c,defaultOpen:f,onOpenChange:m,modal:h=!0}=o,x=p.useRef(null),E=p.useRef(null),[b,k]=Hh({prop:c,defaultProp:f??!1,onChange:m,caller:ll});return n.jsx(pg,{scope:d,triggerRef:x,contentRef:E,contentId:Xt(),titleId:Xt(),descriptionId:Xt(),open:b,onOpenChange:k,onOpenToggle:p.useCallback(()=>k(M=>!M),[k]),modal:h,children:a})};Pf.displayName=ll;var Mf="DialogTrigger",mg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=zt(Mf,a),m=Kr(d,f.triggerRef);return n.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":Ri(f.open),...c,ref:m,onClick:Sr(o.onClick,f.onOpenToggle)})});mg.displayName=Mf;var Mi="DialogPortal",[hg,Rf]=_f(Mi,{forceMount:void 0}),zf=o=>{const{__scopeDialog:d,forceMount:a,children:c,container:f}=o,m=zt(Mi,d);return n.jsx(hg,{scope:d,forceMount:a,children:p.Children.map(c,h=>n.jsx(sl,{present:a||m.open,children:n.jsx(vf,{asChild:!0,container:f,children:h})}))})};zf.displayName=Mi;var nl="DialogOverlay",Df=p.forwardRef((o,d)=>{const a=Rf(nl,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=zt(nl,o.__scopeDialog);return m.modal?n.jsx(sl,{present:c||m.open,children:n.jsx(gg,{...f,ref:d})}):null});Df.displayName=nl;var xg=pf("DialogOverlay.RemoveScroll"),gg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=zt(nl,a),m=ux(),h=Kr(d,m);return n.jsx(Cf,{as:xg,allowPinchZoom:!0,shards:[f.contentRef],children:n.jsx(Je.div,{"data-state":Ri(f.open),...c,ref:h,style:{pointerEvents:"auto",...c.style}})})}),Ln="DialogContent",Lf=p.forwardRef((o,d)=>{const a=Rf(Ln,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=zt(Ln,o.__scopeDialog);return n.jsx(sl,{present:c||m.open,children:m.modal?n.jsx(vg,{...f,ref:d}):n.jsx(yg,{...f,ref:d})})});Lf.displayName=Ln;var vg=p.forwardRef((o,d)=>{const a=zt(Ln,o.__scopeDialog),c=p.useRef(null),f=Kr(d,a.contentRef,c);return p.useEffect(()=>{const m=c.current;if(m)return fg(m)},[]),n.jsx(Af,{...o,ref:f,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:Sr(o.onCloseAutoFocus,m=>{var h;m.preventDefault(),(h=a.triggerRef.current)==null||h.focus()}),onPointerDownOutside:Sr(o.onPointerDownOutside,m=>{const h=m.detail.originalEvent,x=h.button===0&&h.ctrlKey===!0;(h.button===2||x)&&m.preventDefault()}),onFocusOutside:Sr(o.onFocusOutside,m=>m.preventDefault())})}),yg=p.forwardRef((o,d)=>{const a=zt(Ln,o.__scopeDialog),c=p.useRef(!1),f=p.useRef(!1);return n.jsx(Af,{...o,ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:m=>{var h,x;(h=o.onCloseAutoFocus)==null||h.call(o,m),m.defaultPrevented||(c.current||(x=a.triggerRef.current)==null||x.focus(),m.preventDefault()),c.current=!1,f.current=!1},onInteractOutside:m=>{var E,b;(E=o.onInteractOutside)==null||E.call(o,m),m.defaultPrevented||(c.current=!0,m.detail.originalEvent.type==="pointerdown"&&(f.current=!0));const h=m.target;((b=a.triggerRef.current)==null?void 0:b.contains(h))&&m.preventDefault(),m.detail.originalEvent.type==="focusin"&&f.current&&m.preventDefault()}})}),Af=p.forwardRef((o,d)=>{const{__scopeDialog:a,trapFocus:c,onOpenAutoFocus:f,onCloseAutoFocus:m,...h}=o,x=zt(Ln,a);return Cx(),n.jsx(n.Fragment,{children:n.jsx(xf,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:f,onUnmountAutoFocus:m,children:n.jsx(mf,{role:"dialog",id:x.contentId,"aria-describedby":x.descriptionId,"aria-labelledby":x.titleId,"data-state":Ri(x.open),...h,ref:d,deferPointerDownOutside:!0,onDismiss:()=>x.onOpenChange(!1)})})})}),Of="DialogTitle",bg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=zt(Of,a);return n.jsx(Je.h2,{id:f.titleId,...c,ref:d})});bg.displayName=Of;var Tf="DialogDescription",wg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=zt(Tf,a);return n.jsx(Je.p,{id:f.descriptionId,...c,ref:d})});wg.displayName=Tf;var If="DialogClose",jg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=zt(If,a);return n.jsx(Je.button,{type:"button",...c,ref:d,onClick:Sr(o.onClick,()=>f.onOpenChange(!1))})});jg.displayName=If;function Ri(o){return o?"open":"closed"}var js='[cmdk-group=""]',ci='[cmdk-group-items=""]',kg='[cmdk-group-heading=""]',Ff='[cmdk-item=""]',Ku=`${Ff}:not([aria-disabled="true"])`,ki="cmdk-item-select",_n="data-value",Ng=(o,d,a)=>Fh(o,d,a),$f=p.createContext(void 0),Rs=()=>p.useContext($f),Uf=p.createContext(void 0),zi=()=>p.useContext(Uf),Bf=p.createContext(void 0),Vf=p.forwardRef((o,d)=>{let a=Pn(()=>{var v,B;return{search:"",value:(B=(v=o.value)!=null?v:o.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=Pn(()=>new Set),f=Pn(()=>new Map),m=Pn(()=>new Map),h=Pn(()=>new Set),x=Wf(o),{label:E,children:b,value:k,onValueChange:M,filter:A,shouldFilter:I,loop:O,disablePointerSelection:S=!1,vimBindings:C=!0,..._}=o,L=Xt(),Z=Xt(),Y=Xt(),H=p.useRef(null),T=Ag();Gr(()=>{if(k!==void 0){let v=k.trim();a.current.value=v,F.emit()}},[k]),Gr(()=>{T(6,Pe)},[]);let F=p.useMemo(()=>({subscribe:v=>(h.current.add(v),()=>h.current.delete(v)),snapshot:()=>a.current,setState:(v,B,J)=>{var K,oe,pe,me;if(!Object.is(a.current[v],B)){if(a.current[v]=B,v==="search")ce(),X(),T(1,ye);else if(v==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let w=document.getElementById(Y);w?w.focus():(K=document.getElementById(L))==null||K.focus()}if(T(7,()=>{var w;a.current.selectedItemId=(w=_e())==null?void 0:w.id,F.emit()}),J||T(5,Pe),((oe=x.current)==null?void 0:oe.value)!==void 0){let w=B??"";(me=(pe=x.current).onValueChange)==null||me.call(pe,w);return}}F.emit()}},emit:()=>{h.current.forEach(v=>v())}}),[]),ne=p.useMemo(()=>({value:(v,B,J)=>{var K;B!==((K=m.current.get(v))==null?void 0:K.value)&&(m.current.set(v,{value:B,keywords:J}),a.current.filtered.items.set(v,se(B,J)),T(2,()=>{X(),F.emit()}))},item:(v,B)=>(c.current.add(v),B&&(f.current.has(B)?f.current.get(B).add(v):f.current.set(B,new Set([v]))),T(3,()=>{ce(),X(),a.current.value||ye(),F.emit()}),()=>{m.current.delete(v),c.current.delete(v),a.current.filtered.items.delete(v);let J=_e();T(4,()=>{ce(),(J==null?void 0:J.getAttribute("id"))===v&&ye(),F.emit()})}),group:v=>(f.current.has(v)||f.current.set(v,new Set),()=>{m.current.delete(v),f.current.delete(v)}),filter:()=>x.current.shouldFilter,label:E||o["aria-label"],getDisablePointerSelection:()=>x.current.disablePointerSelection,listId:L,inputId:Y,labelId:Z,listInnerRef:H}),[]);function se(v,B){var J,K;let oe=(K=(J=x.current)==null?void 0:J.filter)!=null?K:Ng;return v?oe(v,a.current.search,B):0}function X(){if(!a.current.search||x.current.shouldFilter===!1)return;let v=a.current.filtered.items,B=[];a.current.filtered.groups.forEach(K=>{let oe=f.current.get(K),pe=0;oe.forEach(me=>{let w=v.get(me);pe=Math.max(w,pe)}),B.push([K,pe])});let J=H.current;Me().sort((K,oe)=>{var pe,me;let w=K.getAttribute("id"),Q=oe.getAttribute("id");return((pe=v.get(Q))!=null?pe:0)-((me=v.get(w))!=null?me:0)}).forEach(K=>{let oe=K.closest(ci);oe?oe.appendChild(K.parentElement===oe?K:K.closest(`${ci} > *`)):J.appendChild(K.parentElement===J?K:K.closest(`${ci} > *`))}),B.sort((K,oe)=>oe[1]-K[1]).forEach(K=>{var oe;let pe=(oe=H.current)==null?void 0:oe.querySelector(`${js}[${_n}="${encodeURIComponent(K[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function ye(){let v=Me().find(J=>J.getAttribute("aria-disabled")!=="true"),B=v==null?void 0:v.getAttribute(_n);F.setState("value",B||void 0)}function ce(){var v,B,J,K;if(!a.current.search||x.current.shouldFilter===!1){a.current.filtered.count=c.current.size;return}a.current.filtered.groups=new Set;let oe=0;for(let pe of c.current){let me=(B=(v=m.current.get(pe))==null?void 0:v.value)!=null?B:"",w=(K=(J=m.current.get(pe))==null?void 0:J.keywords)!=null?K:[],Q=se(me,w);a.current.filtered.items.set(pe,Q),Q>0&&oe++}for(let[pe,me]of f.current)for(let w of me)if(a.current.filtered.items.get(w)>0){a.current.filtered.groups.add(pe);break}a.current.filtered.count=oe}function Pe(){var v,B,J;let K=_e();K&&(((v=K.parentElement)==null?void 0:v.firstChild)===K&&((J=(B=K.closest(js))==null?void 0:B.querySelector(kg))==null||J.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function _e(){var v;return(v=H.current)==null?void 0:v.querySelector(`${Ff}[aria-selected="true"]`)}function Me(){var v;return Array.from(((v=H.current)==null?void 0:v.querySelectorAll(Ku))||[])}function Ne(v){let B=Me()[v];B&&F.setState("value",B.getAttribute(_n))}function ke(v){var B;let J=_e(),K=Me(),oe=K.findIndex(me=>me===J),pe=K[oe+v];(B=x.current)!=null&&B.loop&&(pe=oe+v<0?K[K.length-1]:oe+v===K.length?K[0]:K[oe+v]),pe&&F.setState("value",pe.getAttribute(_n))}function W(v){let B=_e(),J=B==null?void 0:B.closest(js),K;for(;J&&!K;)J=v>0?Dg(J,js):Lg(J,js),K=J==null?void 0:J.querySelector(Ku);K?F.setState("value",K.getAttribute(_n)):ke(v)}let ae=()=>Ne(Me().length-1),G=v=>{v.preventDefault(),v.metaKey?ae():v.altKey?W(1):ke(1)},j=v=>{v.preventDefault(),v.metaKey?Ne(0):v.altKey?W(-1):ke(-1)};return p.createElement(Je.div,{ref:d,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:v=>{var B;(B=_.onKeyDown)==null||B.call(_,v);let J=v.nativeEvent.isComposing||v.keyCode===229;if(!(v.defaultPrevented||J))switch(v.key){case"n":case"j":{C&&v.ctrlKey&&G(v);break}case"ArrowDown":{G(v);break}case"p":case"k":{C&&v.ctrlKey&&j(v);break}case"ArrowUp":{j(v);break}case"Home":{v.preventDefault(),Ne(0);break}case"End":{v.preventDefault(),ae();break}case"Enter":{v.preventDefault();let K=_e();if(K){let oe=new Event(ki);K.dispatchEvent(oe)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Tg},E),al(o,v=>p.createElement(Uf.Provider,{value:F},p.createElement($f.Provider,{value:ne},v))))}),Sg=p.forwardRef((o,d)=>{var a,c;let f=Xt(),m=p.useRef(null),h=p.useContext(Bf),x=Rs(),E=Wf(o),b=(c=(a=E.current)==null?void 0:a.forceMount)!=null?c:h==null?void 0:h.forceMount;Gr(()=>{if(!b)return x.item(f,h==null?void 0:h.id)},[b]);let k=Hf(f,m,[o.value,o.children,m],o.keywords),M=zi(),A=Cr(T=>T.value&&T.value===k.current),I=Cr(T=>b||x.filter()===!1?!0:T.search?T.filtered.items.get(f)>0:!0);p.useEffect(()=>{let T=m.current;if(!(!T||o.disabled))return T.addEventListener(ki,O),()=>T.removeEventListener(ki,O)},[I,o.onSelect,o.disabled]);function O(){var T,F;S(),(F=(T=E.current).onSelect)==null||F.call(T,k.current)}function S(){M.setState("value",k.current,!0)}if(!I)return null;let{disabled:C,value:_,onSelect:L,forceMount:Z,keywords:Y,...H}=o;return p.createElement(Je.div,{ref:Dn(m,d),...H,id:f,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!A,"data-disabled":!!C,"data-selected":!!A,onPointerMove:C||x.getDisablePointerSelection()?void 0:S,onClick:C?void 0:O},o.children)}),Cg=p.forwardRef((o,d)=>{let{heading:a,children:c,forceMount:f,...m}=o,h=Xt(),x=p.useRef(null),E=p.useRef(null),b=Xt(),k=Rs(),M=Cr(I=>f||k.filter()===!1?!0:I.search?I.filtered.groups.has(h):!0);Gr(()=>k.group(h),[]),Hf(h,x,[o.value,o.heading,E]);let A=p.useMemo(()=>({id:h,forceMount:f}),[f]);return p.createElement(Je.div,{ref:Dn(x,d),...m,"cmdk-group":"",role:"presentation",hidden:M?void 0:!0},a&&p.createElement("div",{ref:E,"cmdk-group-heading":"","aria-hidden":!0,id:b},a),al(o,I=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?b:void 0},p.createElement(Bf.Provider,{value:A},I))))}),Eg=p.forwardRef((o,d)=>{let{alwaysRender:a,...c}=o,f=p.useRef(null),m=Cr(h=>!h.search);return!a&&!m?null:p.createElement(Je.div,{ref:Dn(f,d),...c,"cmdk-separator":"",role:"separator"})}),_g=p.forwardRef((o,d)=>{let{onValueChange:a,...c}=o,f=o.value!=null,m=zi(),h=Cr(b=>b.search),x=Cr(b=>b.selectedItemId),E=Rs();return p.useEffect(()=>{o.value!=null&&m.setState("search",o.value)},[o.value]),p.createElement(Je.input,{ref:d,...c,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":E.listId,"aria-labelledby":E.labelId,"aria-activedescendant":x,id:E.inputId,type:"text",value:f?o.value:h,onChange:b=>{f||m.setState("search",b.target.value),a==null||a(b.target.value)}})}),Pg=p.forwardRef((o,d)=>{let{children:a,label:c="Suggestions",...f}=o,m=p.useRef(null),h=p.useRef(null),x=Cr(b=>b.selectedItemId),E=Rs();return p.useEffect(()=>{if(h.current&&m.current){let b=h.current,k=m.current,M,A=new ResizeObserver(()=>{M=requestAnimationFrame(()=>{let I=b.offsetHeight;k.style.setProperty("--cmdk-list-height",I.toFixed(1)+"px")})});return A.observe(b),()=>{cancelAnimationFrame(M),A.unobserve(b)}}},[]),p.createElement(Je.div,{ref:Dn(m,d),...f,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":x,"aria-label":c,id:E.listId},al(o,b=>p.createElement("div",{ref:Dn(h,E.listInnerRef),"cmdk-list-sizer":""},b)))}),Mg=p.forwardRef((o,d)=>{let{open:a,onOpenChange:c,overlayClassName:f,contentClassName:m,container:h,...x}=o;return p.createElement(Pf,{open:a,onOpenChange:c},p.createElement(zf,{container:h},p.createElement(Df,{"cmdk-overlay":"",className:f}),p.createElement(Lf,{"aria-label":o.label,"cmdk-dialog":"",className:m},p.createElement(Vf,{ref:d,...x}))))}),Rg=p.forwardRef((o,d)=>Cr(a=>a.filtered.count===0)?p.createElement(Je.div,{ref:d,...o,"cmdk-empty":"",role:"presentation"}):null),zg=p.forwardRef((o,d)=>{let{progress:a,children:c,label:f="Loading...",...m}=o;return p.createElement(Je.div,{ref:d,...m,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":f},al(o,h=>p.createElement("div",{"aria-hidden":!0},h)))}),Cn=Object.assign(Vf,{List:Pg,Item:Sg,Input:_g,Group:Cg,Separator:Eg,Dialog:Mg,Empty:Rg,Loading:zg});function Dg(o,d){let a=o.nextElementSibling;for(;a;){if(a.matches(d))return a;a=a.nextElementSibling}}function Lg(o,d){let a=o.previousElementSibling;for(;a;){if(a.matches(d))return a;a=a.previousElementSibling}}function Wf(o){let d=p.useRef(o);return Gr(()=>{d.current=o}),d}var Gr=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Pn(o){let d=p.useRef();return d.current===void 0&&(d.current=o()),d}function Cr(o){let d=zi(),a=()=>o(d.snapshot());return p.useSyncExternalStore(d.subscribe,a,a)}function Hf(o,d,a,c=[]){let f=p.useRef(),m=Rs();return Gr(()=>{var h;let x=(()=>{var b;for(let k of a){if(typeof k=="string")return k.trim();if(typeof k=="object"&&"current"in k)return k.current?(b=k.current.textContent)==null?void 0:b.trim():f.current}})(),E=c.map(b=>b.trim());m.value(o,x,E),(h=d.current)==null||h.setAttribute(_n,x),f.current=x}),f}var Ag=()=>{let[o,d]=p.useState(),a=Pn(()=>new Map);return Gr(()=>{a.current.forEach(c=>c()),a.current=new Map},[o]),(c,f)=>{a.current.set(c,f),d({})}};function Og(o){let d=o.type;return typeof d=="function"?d(o.props):"render"in d?d.render(o.props):o}function al({asChild:o,children:d},a){return o&&p.isValidElement(d)?p.cloneElement(Og(d),{ref:d.ref},a(d.props.children)):a(d)}var Tg={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Ig({onNavigate:o}){const[d,a]=p.useState(!1);return p.useEffect(()=>{const c=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&(f.preventDefault(),a(m=>!m))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),n.jsx(Cn.Dialog,{open:d,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:n.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:[n.jsx(Cn.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"}),n.jsxs(Cn.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(Cn.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(Cn.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:yi.map(c=>n.jsxs(Cn.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{o(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:[n.jsx(c.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:c.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function fe(o,d){var E;const a={"Content-Type":"application/json",...d==null?void 0:d.headers},c=localStorage.getItem("mc_sudo_password"),f=localStorage.getItem("mc_hf_token");c&&(a["X-Sudo-Password"]=c);let m=d==null?void 0:d.body;if((((E=d==null?void 0:d.method)==null?void 0:E.toUpperCase())||"GET")==="POST"){if(typeof m=="string")try{const b=JSON.parse(m);let k=!1;c&&!("sudo_password"in b)&&(b.sudo_password=c,k=!0),f&&!("hf_token"in b)&&(b.hf_token=f,k=!0),k&&(m=JSON.stringify(b))}catch{}else if(!m){const b={};c&&(b.sudo_password=c),f&&(b.hf_token=f),Object.keys(b).length>0&&(m=JSON.stringify(b))}}const x=await fetch(o,{...d,headers:a,body:m});if(!x.ok)throw new Error(`${x.status} ${x.statusText}`);return x.json()}function Gf(o){var d,a,c="";if(typeof o=="string"||typeof o=="number")c+=o;else if(typeof o=="object")if(Array.isArray(o)){var f=o.length;for(d=0;d{const d=Bg(o),{conflictingClassGroups:a,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:h=>{const x=h.split(Di);return x[0]===""&&x.length!==1&&x.shift(),Kf(x,d)||Ug(h)},getConflictingClassGroupIds:(h,x)=>{const E=a[h]||[];return x&&c[h]?[...E,...c[h]]:E}}},Kf=(o,d)=>{var h;if(o.length===0)return d.classGroupId;const a=o[0],c=d.nextPart.get(a),f=c?Kf(o.slice(1),c):void 0;if(f)return f;if(d.validators.length===0)return;const m=o.join(Di);return(h=d.validators.find(({validator:x})=>x(m)))==null?void 0:h.classGroupId},Qu=/^\[(.+)\]$/,Ug=o=>{if(Qu.test(o)){const d=Qu.exec(o)[1],a=d==null?void 0:d.substring(0,d.indexOf(":"));if(a)return"arbitrary.."+a}},Bg=o=>{const{theme:d,prefix:a}=o,c={nextPart:new Map,validators:[]};return Wg(Object.entries(o.classGroups),a).forEach(([m,h])=>{Ni(h,c,m,d)}),c},Ni=(o,d,a,c)=>{o.forEach(f=>{if(typeof f=="string"){const m=f===""?d:qu(d,f);m.classGroupId=a;return}if(typeof f=="function"){if(Vg(f)){Ni(f(c),d,a,c);return}d.validators.push({validator:f,classGroupId:a});return}Object.entries(f).forEach(([m,h])=>{Ni(h,qu(d,m),a,c)})})},qu=(o,d)=>{let a=o;return d.split(Di).forEach(c=>{a.nextPart.has(c)||a.nextPart.set(c,{nextPart:new Map,validators:[]}),a=a.nextPart.get(c)}),a},Vg=o=>o.isThemeGetter,Wg=(o,d)=>d?o.map(([a,c])=>{const f=c.map(m=>typeof m=="string"?d+m:typeof m=="object"?Object.fromEntries(Object.entries(m).map(([h,x])=>[d+h,x])):m);return[a,f]}):o,Hg=o=>{if(o<1)return{get:()=>{},set:()=>{}};let d=0,a=new Map,c=new Map;const f=(m,h)=>{a.set(m,h),d++,d>o&&(d=0,c=a,a=new Map)};return{get(m){let h=a.get(m);if(h!==void 0)return h;if((h=c.get(m))!==void 0)return f(m,h),h},set(m,h){a.has(m)?a.set(m,h):f(m,h)}}},Qf="!",Gg=o=>{const{separator:d,experimentalParseClassName:a}=o,c=d.length===1,f=d[0],m=d.length,h=x=>{const E=[];let b=0,k=0,M;for(let C=0;Ck?M-k:void 0;return{modifiers:E,hasImportantModifier:I,baseClassName:O,maybePostfixModifierPosition:S}};return a?x=>a({className:x,parseClassName:h}):h},Kg=o=>{if(o.length<=1)return o;const d=[];let a=[];return o.forEach(c=>{c[0]==="["?(d.push(...a.sort(),c),a=[]):a.push(c)}),d.push(...a.sort()),d},Qg=o=>({cache:Hg(o.cacheSize),parseClassName:Gg(o),...$g(o)}),qg=/\s+/,Zg=(o,d)=>{const{parseClassName:a,getClassGroupId:c,getConflictingClassGroupIds:f}=d,m=[],h=o.trim().split(qg);let x="";for(let E=h.length-1;E>=0;E-=1){const b=h[E],{modifiers:k,hasImportantModifier:M,baseClassName:A,maybePostfixModifierPosition:I}=a(b);let O=!!I,S=c(O?A.substring(0,I):A);if(!S){if(!O){x=b+(x.length>0?" "+x:x);continue}if(S=c(A),!S){x=b+(x.length>0?" "+x:x);continue}O=!1}const C=Kg(k).join(":"),_=M?C+Qf:C,L=_+S;if(m.includes(L))continue;m.push(L);const Z=f(S,O);for(let Y=0;Y0?" "+x:x)}return x};function Yg(){let o=0,d,a,c="";for(;o{if(typeof o=="string")return o;let d,a="";for(let c=0;cM(k),o());return a=Qg(b),c=a.cache.get,f=a.cache.set,m=x,x(E)}function x(E){const b=c(E);if(b)return b;const k=Zg(E,a);return f(E,k),k}return function(){return m(Yg.apply(null,arguments))}}const Te=o=>{const d=a=>a[o]||[];return d.isThemeGetter=!0,d},Zf=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xg=/^\d+\/\d+$/,e0=new Set(["px","full","screen"]),t0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r0=/\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$/,n0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,s0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Jt=o=>Rn(o)||e0.has(o)||Xg.test(o),wr=o=>An(o,"length",p0),Rn=o=>!!o&&!Number.isNaN(Number(o)),ui=o=>An(o,"number",Rn),ks=o=>!!o&&Number.isInteger(Number(o)),l0=o=>o.endsWith("%")&&Rn(o.slice(0,-1)),we=o=>Zf.test(o),jr=o=>t0.test(o),a0=new Set(["length","size","percentage"]),i0=o=>An(o,a0,Yf),d0=o=>An(o,"position",Yf),c0=new Set(["image","url"]),u0=o=>An(o,c0,h0),f0=o=>An(o,"",m0),Ns=()=>!0,An=(o,d,a)=>{const c=Zf.exec(o);return c?c[1]?typeof d=="string"?c[1]===d:d.has(c[1]):a(c[2]):!1},p0=o=>r0.test(o)&&!n0.test(o),Yf=()=>!1,m0=o=>s0.test(o),h0=o=>o0.test(o),x0=()=>{const o=Te("colors"),d=Te("spacing"),a=Te("blur"),c=Te("brightness"),f=Te("borderColor"),m=Te("borderRadius"),h=Te("borderSpacing"),x=Te("borderWidth"),E=Te("contrast"),b=Te("grayscale"),k=Te("hueRotate"),M=Te("invert"),A=Te("gap"),I=Te("gradientColorStops"),O=Te("gradientColorStopPositions"),S=Te("inset"),C=Te("margin"),_=Te("opacity"),L=Te("padding"),Z=Te("saturate"),Y=Te("scale"),H=Te("sepia"),T=Te("skew"),F=Te("space"),ne=Te("translate"),se=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],ye=()=>["auto",we,d],ce=()=>[we,d],Pe=()=>["",Jt,wr],_e=()=>["auto",Rn,we],Me=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Ne=()=>["solid","dashed","dotted","double","none"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>["start","end","center","between","around","evenly","stretch"],ae=()=>["","0",we],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>[Rn,we];return{cacheSize:500,separator:":",theme:{colors:[Ns],spacing:[Jt,wr],blur:["none","",jr,we],brightness:j(),borderColor:[o],borderRadius:["none","","full",jr,we],borderSpacing:ce(),borderWidth:Pe(),contrast:j(),grayscale:ae(),hueRotate:j(),invert:ae(),gap:ce(),gradientColorStops:[o],gradientColorStopPositions:[l0,wr],inset:ye(),margin:ye(),opacity:j(),padding:ce(),saturate:j(),scale:j(),sepia:ae(),skew:j(),space:ce(),translate:ce()},classGroups:{aspect:[{aspect:["auto","square","video",we]}],container:["container"],columns:[{columns:[jr]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"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:[...Me(),we]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:se()}],"overscroll-x":[{"overscroll-x":se()}],"overscroll-y":[{"overscroll-y":se()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ks,we]}],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",we]}],grow:[{grow:ae()}],shrink:[{shrink:ae()}],order:[{order:["first","last","none",ks,we]}],"grid-cols":[{"grid-cols":[Ns]}],"col-start-end":[{col:["auto",{span:["full",ks,we]},we]}],"col-start":[{"col-start":_e()}],"col-end":[{"col-end":_e()}],"grid-rows":[{"grid-rows":[Ns]}],"row-start-end":[{row:["auto",{span:[ks,we]},we]}],"row-start":[{"row-start":_e()}],"row-end":[{"row-end":_e()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",we]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",we]}],gap:[{gap:[A]}],"gap-x":[{"gap-x":[A]}],"gap-y":[{"gap-y":[A]}],"justify-content":[{justify:["normal",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[L]}],px:[{px:[L]}],py:[{py:[L]}],ps:[{ps:[L]}],pe:[{pe:[L]}],pt:[{pt:[L]}],pr:[{pr:[L]}],pb:[{pb:[L]}],pl:[{pl:[L]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[F]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[F]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",we,d]}],"min-w":[{"min-w":[we,d,"min","max","fit"]}],"max-w":[{"max-w":[we,d,"none","full","min","max","fit","prose",{screen:[jr]},jr]}],h:[{h:[we,d,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[we,d,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[we,d,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[we,d,"auto","min","max","fit"]}],"font-size":[{text:["base",jr,wr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ui]}],"font-family":[{font:[Ns]}],"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",we]}],"line-clamp":[{"line-clamp":["none",Rn,ui]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Jt,we]}],"list-image":[{"list-image":["none",we]}],"list-style-type":[{list:["none","disc","decimal",we]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[o]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Jt,wr]}],"underline-offset":[{"underline-offset":["auto",Jt,we]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ce()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we]}],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",we]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Me(),d0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",i0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},u0]}],"bg-color":[{bg:[o]}],"gradient-from-pos":[{from:[O]}],"gradient-via-pos":[{via:[O]}],"gradient-to-pos":[{to:[O]}],"gradient-from":[{from:[I]}],"gradient-via":[{via:[I]}],"gradient-to":[{to:[I]}],rounded:[{rounded:[m]}],"rounded-s":[{"rounded-s":[m]}],"rounded-e":[{"rounded-e":[m]}],"rounded-t":[{"rounded-t":[m]}],"rounded-r":[{"rounded-r":[m]}],"rounded-b":[{"rounded-b":[m]}],"rounded-l":[{"rounded-l":[m]}],"rounded-ss":[{"rounded-ss":[m]}],"rounded-se":[{"rounded-se":[m]}],"rounded-ee":[{"rounded-ee":[m]}],"rounded-es":[{"rounded-es":[m]}],"rounded-tl":[{"rounded-tl":[m]}],"rounded-tr":[{"rounded-tr":[m]}],"rounded-br":[{"rounded-br":[m]}],"rounded-bl":[{"rounded-bl":[m]}],"border-w":[{border:[x]}],"border-w-x":[{"border-x":[x]}],"border-w-y":[{"border-y":[x]}],"border-w-s":[{"border-s":[x]}],"border-w-e":[{"border-e":[x]}],"border-w-t":[{"border-t":[x]}],"border-w-r":[{"border-r":[x]}],"border-w-b":[{"border-b":[x]}],"border-w-l":[{"border-l":[x]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...Ne(),"hidden"]}],"divide-x":[{"divide-x":[x]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[x]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:Ne()}],"border-color":[{border:[f]}],"border-color-x":[{"border-x":[f]}],"border-color-y":[{"border-y":[f]}],"border-color-s":[{"border-s":[f]}],"border-color-e":[{"border-e":[f]}],"border-color-t":[{"border-t":[f]}],"border-color-r":[{"border-r":[f]}],"border-color-b":[{"border-b":[f]}],"border-color-l":[{"border-l":[f]}],"divide-color":[{divide:[f]}],"outline-style":[{outline:["",...Ne()]}],"outline-offset":[{"outline-offset":[Jt,we]}],"outline-w":[{outline:[Jt,wr]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Jt,wr]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",jr,f0]}],"shadow-color":[{shadow:[Ns]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...ke(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ke()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[c]}],contrast:[{contrast:[E]}],"drop-shadow":[{"drop-shadow":["","none",jr,we]}],grayscale:[{grayscale:[b]}],"hue-rotate":[{"hue-rotate":[k]}],invert:[{invert:[M]}],saturate:[{saturate:[Z]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[E]}],"backdrop-grayscale":[{"backdrop-grayscale":[b]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[k]}],"backdrop-invert":[{"backdrop-invert":[M]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[Z]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[h]}],"border-spacing-x":[{"border-spacing-x":[h]}],"border-spacing-y":[{"border-spacing-y":[h]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",we]}],duration:[{duration:j()}],ease:[{ease:["linear","in","out","in-out",we]}],delay:[{delay:j()}],animate:[{animate:["none","spin","ping","pulse","bounce",we]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[Y]}],"scale-x":[{"scale-x":[Y]}],"scale-y":[{"scale-y":[Y]}],rotate:[{rotate:[ks,we]}],"translate-x":[{"translate-x":[ne]}],"translate-y":[{"translate-y":[ne]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",we]}],accent:[{accent:["auto",o]}],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",we]}],"caret-color":[{caret:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ce()}],"scroll-mx":[{"scroll-mx":ce()}],"scroll-my":[{"scroll-my":ce()}],"scroll-ms":[{"scroll-ms":ce()}],"scroll-me":[{"scroll-me":ce()}],"scroll-mt":[{"scroll-mt":ce()}],"scroll-mr":[{"scroll-mr":ce()}],"scroll-mb":[{"scroll-mb":ce()}],"scroll-ml":[{"scroll-ml":ce()}],"scroll-p":[{"scroll-p":ce()}],"scroll-px":[{"scroll-px":ce()}],"scroll-py":[{"scroll-py":ce()}],"scroll-ps":[{"scroll-ps":ce()}],"scroll-pe":[{"scroll-pe":ce()}],"scroll-pt":[{"scroll-pt":ce()}],"scroll-pr":[{"scroll-pr":ce()}],"scroll-pb":[{"scroll-pb":ce()}],"scroll-pl":[{"scroll-pl":ce()}],"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",we]}],fill:[{fill:[o,"none"]}],"stroke-w":[{stroke:[Jt,wr,ui]}],stroke:[{stroke:[o,"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"]}}},g0=Jg(x0);function ee(...o){return g0(Fg(o))}function Ms(o){return o?o.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function Qr({type:o,title:d,message:a,defaultValue:c,onConfirm:f,onCancel:m}){return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:d}),n.jsx("button",{onClick:m||(()=>f()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Hr,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a}),o==="prompt"&&n.jsx("input",{type:"text",id:"custom-dialog-input",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:h=>{var x;if(h.key==="Enter"){const E=(x=document.getElementById("custom-dialog-input"))==null?void 0:x.value;f(E)}}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(o==="confirm"||o==="prompt")&&n.jsx("button",{onClick:m,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"}),n.jsx("button",{onClick:()=>{var x;const h=o==="prompt"?(x=document.getElementById("custom-dialog-input"))==null?void 0:x.value:void 0;f(h)},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:o==="confirm"?"Ja, fortfahren":o==="prompt"?"Übernehmen":"OK"})]})]})})}function En(o){return(o/1024**3).toFixed(1)}function Qo({value:o,label:d,detail:a}){const f=2*Math.PI*24,m=f-Math.min(o,100)/100*f,h=o>90?"stroke-red-500":o>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:ee("fill-none transition-all duration-700 ease-out",h),strokeWidth:"4.5",strokeDasharray:f,strokeDashoffset:m,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:d}),a&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function v0(){const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState([]),[h,x]=p.useState([]),[E,b]=p.useState([]),[k,M]=p.useState(null),[A,I]=p.useState([]),[O,S]=p.useState(null),[C,_]=p.useState(""),[L,Z]=p.useState(!1),[Y,H]=p.useState(""),[T,F]=p.useState(!1),[ne,se]=p.useState({open:!1,actionPath:"",actionLabel:""}),[X,ye]=p.useState(null),[ce,Pe]=p.useState(!1);async function _e(w){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:w})}),ye({type:"alert",title:"Erfolgreich",message:`Hermes-Gehirn wurde auf '${w}' geändert. Der Gateway-Dienst wurde neu gestartet.`,onConfirm:()=>ye(null)}),v(),Pe(!1)}catch(Q){ye({type:"alert",title:"Fehler",message:`Fehler beim Wechseln des Gehirns: ${Q.message}`,onConfirm:()=>ye(null)})}}function Me(w,Q,Le){ye({type:"confirm",title:w,message:Q,onConfirm:()=>{ye(null),Le()},onCancel:()=>ye(null)})}const[Ne,ke]=p.useState(""),[W,ae]=p.useState("stable"),[G,j]=p.useState(!1);function v(){fe("/api/system/status").then(d).catch(()=>{}),fe("/api/agent/status").then(c).catch(()=>{}),fe("/api/models").then(w=>{m(w.models||[]),x(w.running||[])}).catch(()=>{}),fe("/api/memory?category=").then(w=>b(w.slice(0,3))).catch(()=>{}),fe("/api/maintenance/updates").then(M).catch(()=>{}),fe("/api/jobs").then(w=>I(w.jobs||[])).catch(()=>{}),fe("/api/system/token-stats").then(S).catch(()=>{})}p.useEffect(()=>{v();const w=setInterval(v,3e3);return()=>clearInterval(w)},[]);async function B(w,Q,Le,$t){_(`${Q} wird ausgeführt...`),Z(!0);try{const lt={...Le},nt=await fe(w,{method:"POST",body:JSON.stringify(lt)});if(nt.status==="password_required"||nt.status==="incorrect_password"){se({open:!0,actionPath:w,actionLabel:Q,payload:Le,error:nt.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),_("");return}nt.job_id?_(`${Q} gestartet (Job-ID: ${nt.job_id})`):nt.ok?_(`${Q} erfolgreich ausgeführt.`):_(`Fehler: ${nt.err||"Unbekannter Fehler"}`),v()}catch(lt){_(`Fehler bei ${Q}: ${lt.message}`)}finally{Z(!1)}}async function J(){F(!0);try{const w={...ne.payload,sudo_password:Y},Q=await fe(ne.actionPath,{method:"POST",body:JSON.stringify(w)});if(Q.status==="password_required"||Q.status==="incorrect_password"){se(Le=>({...Le,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}Q.job_id?_(`${ne.actionLabel} gestartet (Job-ID: ${Q.job_id})`):Q.ok?_(`${ne.actionLabel} erfolgreich ausgeführt.`):_(`Fehler: ${Q.err||"Unbekannter Fehler"}`),se({open:!1,actionPath:"",actionLabel:""}),H(""),v()}catch(w){_(`Fehler: ${w.message}`),se({open:!1,actionPath:"",actionLabel:""}),H("")}finally{F(!1)}}async function K(w,Q){_(`Upgrade für ${w} wird gestartet...`);try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:w,role:Q,quant:"Q4_K_M",jinja:!0})}),_("Upgrade-Download gestartet."),v()}catch(Le){_(`Upgrade fehlgeschlagen: ${Le.message}`)}}async function oe(){if(!(!Ne.trim()||G)){j(!0);try{await fe("/api/memory",{method:"POST",body:JSON.stringify({content:Ne,category:W,source:"dashboard"})}),ke(""),fe("/api/memory?category=").then(w=>b(w.slice(0,3))).catch(()=>{})}catch(w){console.error(w)}finally{j(!1)}}}const pe=A.find(w=>w.label.includes("OS-Update")&&(w.state==="running"||w.state==="queued")),me=A.find(w=>w.label.includes("Engine-Update")&&(w.state==="running"||w.state==="queued"));return n.jsxs("div",{className:"space-y-6",children:[ne.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),H("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Hr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:ne.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:Y,onChange:w=>H(w.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:w=>w.key==="Enter"&&J(),autoFocus:!0}),ne.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:ne.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),H("")},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"}),n.jsx("button",{onClick:J,disabled:!Y||T,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:T?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(gt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),o?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(Qo,{value:o.cpu.percent,label:"CPU",detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0}),n.jsx(Qo,{value:o.ram.percent,label:"RAM",detail:`${En(o.ram.used)} / ${En(o.ram.total)} GB`}),o.gpu&&o.gpu.busy_percent!=null&&o.gpu.gtt_used!=null&&o.gpu.gtt_total!=null&&n.jsx(Qo,{value:o.gpu.busy_percent,label:"GPU",detail:`${En(o.gpu.gtt_used)} / ${En(o.gpu.gtt_total)} GB`}),o.disk&&n.jsx(Qo,{value:o.disk.percent,label:"Disk",detail:`${En(o.disk.used)} / ${En(o.disk.total)} GB`})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(o==null?void 0:o.temp)&&(o.temp.cpu||o.temp.gpu)&&n.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[o.temp.cpu!=null&&n.jsxs("span",{children:["CPU Temp: ",o.temp.cpu," °C"]}),o.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",o.temp.gpu," °C"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ch,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(k==null?void 0:k.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(k.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),k?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",k.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:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:k.os>0?`${k.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",k.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:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:k.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",k.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:k.models>0?`${k.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>B("/api/maintenance/os-update","OS-Update"),disabled:L||!!pe,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:pe?n.jsxs(n.Fragment,{children:[n.jsx(Br,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",pe.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>B("/api/maintenance/engine-update","Engine-Update"),disabled:L||!!me,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:me?n.jsxs(n.Fragment,{children:[n.jsx(Br,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",me.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{Me("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>B("/api/maintenance/reboot","Reboot"))},disabled:L,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:[n.jsx(df,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),k.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:k.model_list.map(w=>n.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:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${w.role}: ${w.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:w.role}),": ",w.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>K(w.repo,w.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:[n.jsx(Vr,{className:"h-2.5 w-2.5"})," Laden"]})]},w.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),C&&n.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:C}),n.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:[n.jsx(Wr,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.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"})})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ss,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(a==null?void 0:a.webui_url)&&n.jsxs("a",{href:Ms(a.webui_url),target:"_blank",rel:"noopener",className:ee("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",a.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(el,{className:"h-3 w-3"})," Hermes öffnen"]})]}),a?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>Pe(!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 group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(gt,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(Es,{className:"h-3.5 w-3.5"}),a.brain_model?`model: ${a.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Es,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:["fast","heavy","coder","reasoning","vision","scout"].map(w=>{var $t;const Q=f.find(lt=>lt.role===w),Le=Q?h.includes(Q.name):!1;return n.jsxs("div",{className:ee("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",Le?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":Q?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ee("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",w==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":w==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":w==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":w==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":w==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:w}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:Q?($t=Q.name.split("/").pop())==null?void 0:$t.replace(/\.gguf$/i,""):"nicht zugewiesen"}),Q&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[Q.prompt_cache&&n.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"}),Q.spec_draft_model&&n.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: ${Q.spec_draft_model})`,children:"SPEC"}),Q.parallel_slots>1&&n.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:`${Q.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",Q.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:Q?Le?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},w)})})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Cs,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:Ne,onChange:w=>ke(w.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"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:W,onChange:w=>ae(w.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:oe,disabled:!Ne.trim()||G,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:[n.jsx(af,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:E.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):E.map(w=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:w.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:w.content,children:w.content})]},w.id))})]})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(ph,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),O?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[O.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",O.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:O.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[O.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[O.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsx("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:"Berechnet im Vergleich zu Cloud-APIs von Juni 2026 (Ø 15,00 $ / 75,00 $ pro 1M tkn)."})]})]}),a&&ce&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(gt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>Pe(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Hr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...f.map(w=>{var Q;return((Q=w.name.split("/").pop())==null?void 0:Q.replace(".gguf",""))||w.name})].map(w=>{const Q=["auto","fast","heavy"].includes(w);return n.jsxs("button",{onClick:()=>_e(w),className:ee("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.brain_model===w||!a.brain_model&&w==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:w}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Q?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(a.brain_model===w||!a.brain_model&&w==="auto")&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},w)})})]})}),X&&n.jsx(Qr,{type:X.type,title:X.title,message:X.message,onConfirm:()=>X.onConfirm(),onCancel:X.onCancel})]})}function $r({children:o,tone:d="muted"}){const a={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${a[d]}`,children:o})}function Zu({caps:o}){return o?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[o.coder&&n.jsx($r,{children:"💻 Code"}),o.vision&&n.jsx($r,{children:"👁 Bild"}),o.reasoning&&n.jsx($r,{children:"🧠 Reason"}),o.moe&&n.jsxs($r,{tone:"primary",children:["🧩 MoE",o.active_b?`·${o.active_b}b`:""]}),o.tools==="yes"&&n.jsx($r,{tone:"primary",children:"🛠 Tools"}),o.tools==="likely"&&n.jsx($r,{tone:"warn",children:"🛠 Tools?"}),o.embedding&&n.jsx($r,{children:"🔢 Embed"})]}):null}function Si(o){return o?o>1024**3?`${(o/1024**3).toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`:""}function y0(o){if(!o)return"";const d=Math.floor(o/60);return d>0?`${d} min`:`${o} s`}function b0({onError:o}){const[d,a]=p.useState([]),[c,f]=p.useState(null);function m(){fe("/api/jobs").then(b=>a(b.jobs||[])).catch(()=>{})}p.useEffect(()=>{m();const b=setInterval(m,2e3);return()=>clearInterval(b)},[]);async function h(b){try{await fe(`/api/jobs/${b}/cancel`,{method:"POST"}),m()}catch(k){o?o(k.message):f(k.message)}}const x=d.filter(b=>b.state==="running"||b.state==="queued"),E=d.filter(b=>b.state!=="running"&&b.state!=="queued").slice(-3);return x.length===0&&E.length===0?null:n.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:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),x.map(b=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:b.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[b.progress??0,"% • ",Si(b.done_bytes),"/",Si(b.total_bytes),b.eta_s?` • ETA ${y0(b.eta_s)}`:""]}),n.jsx("button",{onClick:()=>h(b.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"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${b.progress??0}%`}})})]},b.id)),E.map(b=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:b.label}),n.jsx("span",{className:ee("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",b.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:b.state})]},b.id)),c&&n.jsx(Qr,{type:"alert",title:"Fehler",message:c,onConfirm:()=>f(null)})]})}function Ur(o){if(!o)return"—";const d=o/1024**3;return d>=1?`${d.toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`}function Yu(o){return o?`${Math.round(o/1024)}k`:"—"}function w0({fit:o}){const d={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"}[o.level];return n.jsxs("span",{className:ee("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",d),children:[o.text," • ",o.req_gb," GB RAM"]})}const j0=["fast","heavy","coder","reasoning","agent","vision","scout"];function Ju(o){const d=o.toLowerCase();return d.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:d.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:d.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:d.includes("mistral")||d.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:d.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:d.includes("hermes")||d.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:d.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 k0(){var Zr,tr,Ut,Yr,In;const[o,d]=p.useState([]),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(null),[E,b]=p.useState(null),[k,M]=p.useState(!0),[A,I]=p.useState(""),[O,S]=p.useState(null),[C,_]=p.useState(null),[L,Z]=p.useState(!1),[Y,H]=p.useState(null),[T,F]=p.useState("grid"),[ne,se]=p.useState("all"),[X,ye]=p.useState(null);function ce(z,re,ve){ye({type:"alert",title:z,message:re,onConfirm:()=>{ye(null)}})}function Pe(z,re,ve,Se){ye({type:"confirm",title:z,message:re,onConfirm:()=>{ye(null),ve()},onCancel:()=>{ye(null)}})}function _e(z,re,ve,Se,ze){ye({type:"prompt",title:z,message:re,defaultValue:ve,onConfirm:Nt=>{ye(null),Se(Nt)},onCancel:()=>{ye(null)}})}const Me=o.filter(z=>ne==="in_use"?!!z.role||a.includes(z.name):!0),[Ne,ke]=p.useState({width:800,height:360}),W=p.useRef(null),ae=p.useCallback(z=>{if(W.current&&(W.current.disconnect(),W.current=null),z){const re=new ResizeObserver(ve=>{if(!ve||ve.length===0)return;const Se=ve[0].contentRect;ke({width:Se.width,height:Se.height})});re.observe(z),W.current=re}},[]),G=Ne.width,j=Ne.height,v=z=>{const re=G*.1,ve=j*z,Se=G*.5,ze=j*.5,Nt=G*.3,Bt=ve,Vt=G*.3;return`M ${re} ${ve} C ${Nt} ${Bt}, ${Vt} ${ze}, ${Se} ${ze}`},B=z=>{const re=G*.5,ve=j*.5,Se=G*.9,ze=j*z,Nt=G*.7,Bt=ve,Vt=G*.7;return`M ${re} ${ve} C ${Nt} ${Bt}, ${Vt} ${ze}, ${Se} ${ze}`};function J(){Promise.all([fe("/api/models"),fe("/api/routing"),fe("/api/connect"),fe("/api/maintenance/updates")]).then(([z,re,ve,Se])=>{d(z.models||[]),c(z.running||[]),m(re),x(ve),b(Se)}).catch(z=>I(String(z))).finally(()=>M(!1))}p.useEffect(()=>{J();const z=setInterval(J,4e3);return()=>clearInterval(z)},[]);async function K(z){try{await fe(`/api/models/${encodeURIComponent(z)}/load`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Laden des Modells: ${re.message}`)}}async function oe(z){try{await fe(`/api/models/${encodeURIComponent(z)}/unload`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Entladen des Modells: ${re.message}`)}}async function pe(){try{await fe("/api/models/unload",{method:"POST"}),J()}catch(z){ce("Fehler",`Fehler beim Entladen aller Modelle: ${z.message}`)}}async function me(z,re){try{await fe(`/api/models/${encodeURIComponent(re)}/role`,{method:"POST",body:JSON.stringify({role:z||null})}),J()}catch(ve){ce("Fehler",`Fehler beim Zuweisen der Rolle: ${ve.message||ve}`)}}async function w(z,re){_e("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(re||32768),async ve=>{if(ve)try{await fe(`/api/models/${encodeURIComponent(z)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ve,10)})}),J()}catch(Se){ce("Fehler",`Fehler beim Setzen des Kontexts: ${Se.message||Se}`)}})}async function Q(z){Pe("Modell löschen?",`Modell '${z}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await fe(`/api/models/${encodeURIComponent(z)}`,{method:"DELETE"}),J()}catch(re){ce("Fehler",`Fehler beim Löschen: ${re.message||re}`)}})}async function Le(z,re,ve,Se){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:z,role:re,quant:ve,jinja:Se})}),ce("Herunterladen gestartet",`Download für '${z}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(ze){ce("Fehler",`Fehler beim Starten des Upgrades: ${ze.message||ze}`)}}async function $t(z){z&&(await navigator.clipboard.writeText(z),Z(!0),setTimeout(()=>Z(!1),1500))}if(k)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(A)return n.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 (",A,")."]});const lt=o.filter(z=>a.includes(z.name)),nt=lt.reduce((z,re)=>z+(re.size_bytes||0),0),On=16*1024**3,Tn=nt>On?nt*1.2:On,qr=z=>o.find(re=>re.role===z),er=z=>{const re=qr(z);return re?a.includes(re.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` +`)},og=0,Sn=[];function lg(o){var d=p.useRef([]),a=p.useRef([0,0]),c=p.useRef(),f=p.useState(og++)[0],m=p.useState(jf)[0],h=p.useRef(o);p.useEffect(function(){h.current=o},[o]),p.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(f));var N=Ex([o.lockRef.current],(o.shards||[]).map(Gu),!0).filter(Boolean);return N.forEach(function(S){return S.classList.add("allow-interactivity-".concat(f))}),function(){document.body.classList.remove("block-interactivity-".concat(f)),N.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(f))})}}},[o.inert,o.lockRef.current,o.shards]);var x=p.useCallback(function(N,S){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!h.current.allowPinchZoom;var E=Ho(N),D=a.current,Z="deltaX"in N?N.deltaX:D[0]-E[0],Y="deltaY"in N?N.deltaY:D[1]-E[1],G,I=N.target,$=Math.abs(Z)>Math.abs(Y)?"h":"v";if("touches"in N&&$==="h"&&I.type==="range")return!1;var ne=window.getSelection(),se=ne&&ne.anchorNode,X=se?se===I||se.contains(I):!1;if(X)return!1;var be=Wu($,I);if(!be)return!0;if(be?G=$:(G=$==="v"?"h":"v",be=Wu($,I)),!be)return!1;if(!c.current&&"changedTouches"in N&&(Z||Y)&&(c.current=G),!G)return!0;var ce=c.current||G;return rg(ce,S,N,ce==="h"?Z:Y)},[]),C=p.useCallback(function(N){var S=N;if(!(!Sn.length||Sn[Sn.length-1]!==m)){var E="deltaY"in S?Hu(S):Ho(S),D=d.current.filter(function(G){return G.name===S.type&&(G.target===S.target||S.target===G.shadowParent)&&ng(G.delta,E)})[0];if(D&&D.should){S.cancelable&&S.preventDefault();return}if(!D){var Z=(h.current.shards||[]).map(Gu).filter(Boolean).filter(function(G){return G.contains(S.target)}),Y=Z.length>0?x(S,Z[0]):!h.current.noIsolation;Y&&S.cancelable&&S.preventDefault()}}},[]),b=p.useCallback(function(N,S,E,D){var Z={name:N,delta:S,target:E,should:D,shadowParent:ag(E)};d.current.push(Z),setTimeout(function(){d.current=d.current.filter(function(Y){return Y!==Z})},1)},[]),j=p.useCallback(function(N){a.current=Ho(N),c.current=void 0},[]),P=p.useCallback(function(N){b(N.type,Hu(N),N.target,x(N,o.lockRef.current))},[]),L=p.useCallback(function(N){b(N.type,Ho(N),N.target,x(N,o.lockRef.current))},[]);p.useEffect(function(){return Sn.push(m),o.setCallbacks({onScrollCapture:P,onWheelCapture:P,onTouchMoveCapture:L}),document.addEventListener("wheel",C,Nn),document.addEventListener("touchmove",C,Nn),document.addEventListener("touchstart",j,Nn),function(){Sn=Sn.filter(function(N){return N!==m}),document.removeEventListener("wheel",C,Nn),document.removeEventListener("touchmove",C,Nn),document.removeEventListener("touchstart",j,Nn)}},[]);var F=o.removeScrollBar,A=o.inert;return p.createElement(p.Fragment,null,A?p.createElement(m,{styles:sg(f)}):null,F?p.createElement(qx,{noRelative:o.noRelative,gapMode:o.gapMode}):null)}function ag(o){for(var d=null;o!==null;)o instanceof ShadowRoot&&(d=o.host,o=o.host),o=o.parentNode;return d}const ig=Ox(wf,lg);var Cf=p.forwardRef(function(o,d){return p.createElement(ol,Ut({},o,{ref:d,sideCar:ig}))});Cf.classNames=ol.classNames;var dg=function(o){if(typeof document>"u")return null;var d=Array.isArray(o)?o[0]:o;return d.ownerDocument.body},Cn=new WeakMap,Go=new WeakMap,Ko={},di=0,Ef=function(o){return o&&(o.host||Ef(o.parentNode))},cg=function(o,d){return d.map(function(a){if(o.contains(a))return a;var c=Ef(a);return c&&o.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",o,". Doing nothing"),null)}).filter(function(a){return!!a})},ug=function(o,d,a,c){var f=cg(d,Array.isArray(o)?o:[o]);Ko[a]||(Ko[a]=new WeakMap);var m=Ko[a],h=[],x=new Set,C=new Set(f),b=function(P){!P||x.has(P)||(x.add(P),b(P.parentNode))};f.forEach(b);var j=function(P){!P||C.has(P)||Array.prototype.forEach.call(P.children,function(L){if(x.has(L))j(L);else try{var F=L.getAttribute(c),A=F!==null&&F!=="false",N=(Cn.get(L)||0)+1,S=(m.get(L)||0)+1;Cn.set(L,N),m.set(L,S),h.push(L),N===1&&A&&Go.set(L,!0),S===1&&L.setAttribute(a,"true"),A||L.setAttribute(c,"true")}catch(E){console.error("aria-hidden: cannot operate on ",L,E)}})};return j(d),x.clear(),di++,function(){h.forEach(function(P){var L=Cn.get(P)-1,F=m.get(P)-1;Cn.set(P,L),m.set(P,F),L||(Go.has(P)||P.removeAttribute(c),Go.delete(P)),F||P.removeAttribute(a)}),di--,di||(Cn=new WeakMap,Cn=new WeakMap,Go=new WeakMap,Ko={})}},fg=function(o,d,a){a===void 0&&(a="data-aria-hidden");var c=Array.from(Array.isArray(o)?o:[o]),f=dg(o);return f?(c.push.apply(c,Array.from(f.querySelectorAll("[aria-live], script"))),ug(c,f,a,"aria-hidden")):function(){return null}},ll="Dialog",[_f]=$h(ll),[pg,Lt]=_f(ll),Pf=o=>{const{__scopeDialog:d,children:a,open:c,defaultOpen:f,onOpenChange:m,modal:h=!0}=o,x=p.useRef(null),C=p.useRef(null),[b,j]=Hh({prop:c,defaultProp:f??!1,onChange:m,caller:ll});return n.jsx(pg,{scope:d,triggerRef:x,contentRef:C,contentId:er(),titleId:er(),descriptionId:er(),open:b,onOpenChange:j,onOpenToggle:p.useCallback(()=>j(P=>!P),[j]),modal:h,children:a})};Pf.displayName=ll;var Mf="DialogTrigger",mg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(Mf,a),m=Qr(d,f.triggerRef);return n.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":Ri(f.open),...c,ref:m,onClick:Cr(o.onClick,f.onOpenToggle)})});mg.displayName=Mf;var Mi="DialogPortal",[hg,Rf]=_f(Mi,{forceMount:void 0}),zf=o=>{const{__scopeDialog:d,forceMount:a,children:c,container:f}=o,m=Lt(Mi,d);return n.jsx(hg,{scope:d,forceMount:a,children:p.Children.map(c,h=>n.jsx(sl,{present:a||m.open,children:n.jsx(vf,{asChild:!0,container:f,children:h})}))})};zf.displayName=Mi;var nl="DialogOverlay",Df=p.forwardRef((o,d)=>{const a=Rf(nl,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=Lt(nl,o.__scopeDialog);return m.modal?n.jsx(sl,{present:c||m.open,children:n.jsx(gg,{...f,ref:d})}):null});Df.displayName=nl;var xg=pf("DialogOverlay.RemoveScroll"),gg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(nl,a),m=ux(),h=Qr(d,m);return n.jsx(Cf,{as:xg,allowPinchZoom:!0,shards:[f.contentRef],children:n.jsx(Je.div,{"data-state":Ri(f.open),...c,ref:h,style:{pointerEvents:"auto",...c.style}})})}),An="DialogContent",Lf=p.forwardRef((o,d)=>{const a=Rf(An,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=Lt(An,o.__scopeDialog);return n.jsx(sl,{present:c||m.open,children:m.modal?n.jsx(vg,{...f,ref:d}):n.jsx(yg,{...f,ref:d})})});Lf.displayName=An;var vg=p.forwardRef((o,d)=>{const a=Lt(An,o.__scopeDialog),c=p.useRef(null),f=Qr(d,a.contentRef,c);return p.useEffect(()=>{const m=c.current;if(m)return fg(m)},[]),n.jsx(Af,{...o,ref:f,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:Cr(o.onCloseAutoFocus,m=>{var h;m.preventDefault(),(h=a.triggerRef.current)==null||h.focus()}),onPointerDownOutside:Cr(o.onPointerDownOutside,m=>{const h=m.detail.originalEvent,x=h.button===0&&h.ctrlKey===!0;(h.button===2||x)&&m.preventDefault()}),onFocusOutside:Cr(o.onFocusOutside,m=>m.preventDefault())})}),yg=p.forwardRef((o,d)=>{const a=Lt(An,o.__scopeDialog),c=p.useRef(!1),f=p.useRef(!1);return n.jsx(Af,{...o,ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:m=>{var h,x;(h=o.onCloseAutoFocus)==null||h.call(o,m),m.defaultPrevented||(c.current||(x=a.triggerRef.current)==null||x.focus(),m.preventDefault()),c.current=!1,f.current=!1},onInteractOutside:m=>{var C,b;(C=o.onInteractOutside)==null||C.call(o,m),m.defaultPrevented||(c.current=!0,m.detail.originalEvent.type==="pointerdown"&&(f.current=!0));const h=m.target;((b=a.triggerRef.current)==null?void 0:b.contains(h))&&m.preventDefault(),m.detail.originalEvent.type==="focusin"&&f.current&&m.preventDefault()}})}),Af=p.forwardRef((o,d)=>{const{__scopeDialog:a,trapFocus:c,onOpenAutoFocus:f,onCloseAutoFocus:m,...h}=o,x=Lt(An,a);return Cx(),n.jsx(n.Fragment,{children:n.jsx(xf,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:f,onUnmountAutoFocus:m,children:n.jsx(mf,{role:"dialog",id:x.contentId,"aria-describedby":x.descriptionId,"aria-labelledby":x.titleId,"data-state":Ri(x.open),...h,ref:d,deferPointerDownOutside:!0,onDismiss:()=>x.onOpenChange(!1)})})})}),Of="DialogTitle",bg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(Of,a);return n.jsx(Je.h2,{id:f.titleId,...c,ref:d})});bg.displayName=Of;var Tf="DialogDescription",wg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(Tf,a);return n.jsx(Je.p,{id:f.descriptionId,...c,ref:d})});wg.displayName=Tf;var If="DialogClose",jg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(If,a);return n.jsx(Je.button,{type:"button",...c,ref:d,onClick:Cr(o.onClick,()=>f.onOpenChange(!1))})});jg.displayName=If;function Ri(o){return o?"open":"closed"}var js='[cmdk-group=""]',ci='[cmdk-group-items=""]',kg='[cmdk-group-heading=""]',Ff='[cmdk-item=""]',Ku=`${Ff}:not([aria-disabled="true"])`,ki="cmdk-item-select",Pn="data-value",Ng=(o,d,a)=>Fh(o,d,a),$f=p.createContext(void 0),Rs=()=>p.useContext($f),Uf=p.createContext(void 0),zi=()=>p.useContext(Uf),Bf=p.createContext(void 0),Vf=p.forwardRef((o,d)=>{let a=Mn(()=>{var v,V;return{search:"",value:(V=(v=o.value)!=null?v:o.defaultValue)!=null?V:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=Mn(()=>new Set),f=Mn(()=>new Map),m=Mn(()=>new Map),h=Mn(()=>new Set),x=Wf(o),{label:C,children:b,value:j,onValueChange:P,filter:L,shouldFilter:F,loop:A,disablePointerSelection:N=!1,vimBindings:S=!0,...E}=o,D=er(),Z=er(),Y=er(),G=p.useRef(null),I=Ag();Kr(()=>{if(j!==void 0){let v=j.trim();a.current.value=v,$.emit()}},[j]),Kr(()=>{I(6,Me)},[]);let $=p.useMemo(()=>({subscribe:v=>(h.current.add(v),()=>h.current.delete(v)),snapshot:()=>a.current,setState:(v,V,J)=>{var Q,oe,pe,me;if(!Object.is(a.current[v],V)){if(a.current[v]=V,v==="search")ce(),X(),I(1,be);else if(v==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let T=document.getElementById(Y);T?T.focus():(Q=document.getElementById(D))==null||Q.focus()}if(I(7,()=>{var T;a.current.selectedItemId=(T=Pe())==null?void 0:T.id,$.emit()}),J||I(5,Me),((oe=x.current)==null?void 0:oe.value)!==void 0){let T=V??"";(me=(pe=x.current).onValueChange)==null||me.call(pe,T);return}}$.emit()}},emit:()=>{h.current.forEach(v=>v())}}),[]),ne=p.useMemo(()=>({value:(v,V,J)=>{var Q;V!==((Q=m.current.get(v))==null?void 0:Q.value)&&(m.current.set(v,{value:V,keywords:J}),a.current.filtered.items.set(v,se(V,J)),I(2,()=>{X(),$.emit()}))},item:(v,V)=>(c.current.add(v),V&&(f.current.has(V)?f.current.get(V).add(v):f.current.set(V,new Set([v]))),I(3,()=>{ce(),X(),a.current.value||be(),$.emit()}),()=>{m.current.delete(v),c.current.delete(v),a.current.filtered.items.delete(v);let J=Pe();I(4,()=>{ce(),(J==null?void 0:J.getAttribute("id"))===v&&be(),$.emit()})}),group:v=>(f.current.has(v)||f.current.set(v,new Set),()=>{m.current.delete(v),f.current.delete(v)}),filter:()=>x.current.shouldFilter,label:C||o["aria-label"],getDisablePointerSelection:()=>x.current.disablePointerSelection,listId:D,inputId:Y,labelId:Z,listInnerRef:G}),[]);function se(v,V){var J,Q;let oe=(Q=(J=x.current)==null?void 0:J.filter)!=null?Q:Ng;return v?oe(v,a.current.search,V):0}function X(){if(!a.current.search||x.current.shouldFilter===!1)return;let v=a.current.filtered.items,V=[];a.current.filtered.groups.forEach(Q=>{let oe=f.current.get(Q),pe=0;oe.forEach(me=>{let T=v.get(me);pe=Math.max(T,pe)}),V.push([Q,pe])});let J=G.current;Re().sort((Q,oe)=>{var pe,me;let T=Q.getAttribute("id"),O=oe.getAttribute("id");return((pe=v.get(O))!=null?pe:0)-((me=v.get(T))!=null?me:0)}).forEach(Q=>{let oe=Q.closest(ci);oe?oe.appendChild(Q.parentElement===oe?Q:Q.closest(`${ci} > *`)):J.appendChild(Q.parentElement===J?Q:Q.closest(`${ci} > *`))}),V.sort((Q,oe)=>oe[1]-Q[1]).forEach(Q=>{var oe;let pe=(oe=G.current)==null?void 0:oe.querySelector(`${js}[${Pn}="${encodeURIComponent(Q[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function be(){let v=Re().find(J=>J.getAttribute("aria-disabled")!=="true"),V=v==null?void 0:v.getAttribute(Pn);$.setState("value",V||void 0)}function ce(){var v,V,J,Q;if(!a.current.search||x.current.shouldFilter===!1){a.current.filtered.count=c.current.size;return}a.current.filtered.groups=new Set;let oe=0;for(let pe of c.current){let me=(V=(v=m.current.get(pe))==null?void 0:v.value)!=null?V:"",T=(Q=(J=m.current.get(pe))==null?void 0:J.keywords)!=null?Q:[],O=se(me,T);a.current.filtered.items.set(pe,O),O>0&&oe++}for(let[pe,me]of f.current)for(let T of me)if(a.current.filtered.items.get(T)>0){a.current.filtered.groups.add(pe);break}a.current.filtered.count=oe}function Me(){var v,V,J;let Q=Pe();Q&&(((v=Q.parentElement)==null?void 0:v.firstChild)===Q&&((J=(V=Q.closest(js))==null?void 0:V.querySelector(kg))==null||J.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function Pe(){var v;return(v=G.current)==null?void 0:v.querySelector(`${Ff}[aria-selected="true"]`)}function Re(){var v;return Array.from(((v=G.current)==null?void 0:v.querySelectorAll(Ku))||[])}function Se(v){let V=Re()[v];V&&$.setState("value",V.getAttribute(Pn))}function Ne(v){var V;let J=Pe(),Q=Re(),oe=Q.findIndex(me=>me===J),pe=Q[oe+v];(V=x.current)!=null&&V.loop&&(pe=oe+v<0?Q[Q.length-1]:oe+v===Q.length?Q[0]:Q[oe+v]),pe&&$.setState("value",pe.getAttribute(Pn))}function H(v){let V=Pe(),J=V==null?void 0:V.closest(js),Q;for(;J&&!Q;)J=v>0?Dg(J,js):Lg(J,js),Q=J==null?void 0:J.querySelector(Ku);Q?$.setState("value",Q.getAttribute(Pn)):Ne(v)}let ae=()=>Se(Re().length-1),K=v=>{v.preventDefault(),v.metaKey?ae():v.altKey?H(1):Ne(1)},w=v=>{v.preventDefault(),v.metaKey?Se(0):v.altKey?H(-1):Ne(-1)};return p.createElement(Je.div,{ref:d,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:v=>{var V;(V=E.onKeyDown)==null||V.call(E,v);let J=v.nativeEvent.isComposing||v.keyCode===229;if(!(v.defaultPrevented||J))switch(v.key){case"n":case"j":{S&&v.ctrlKey&&K(v);break}case"ArrowDown":{K(v);break}case"p":case"k":{S&&v.ctrlKey&&w(v);break}case"ArrowUp":{w(v);break}case"Home":{v.preventDefault(),Se(0);break}case"End":{v.preventDefault(),ae();break}case"Enter":{v.preventDefault();let Q=Pe();if(Q){let oe=new Event(ki);Q.dispatchEvent(oe)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Tg},C),al(o,v=>p.createElement(Uf.Provider,{value:$},p.createElement($f.Provider,{value:ne},v))))}),Sg=p.forwardRef((o,d)=>{var a,c;let f=er(),m=p.useRef(null),h=p.useContext(Bf),x=Rs(),C=Wf(o),b=(c=(a=C.current)==null?void 0:a.forceMount)!=null?c:h==null?void 0:h.forceMount;Kr(()=>{if(!b)return x.item(f,h==null?void 0:h.id)},[b]);let j=Hf(f,m,[o.value,o.children,m],o.keywords),P=zi(),L=Er(I=>I.value&&I.value===j.current),F=Er(I=>b||x.filter()===!1?!0:I.search?I.filtered.items.get(f)>0:!0);p.useEffect(()=>{let I=m.current;if(!(!I||o.disabled))return I.addEventListener(ki,A),()=>I.removeEventListener(ki,A)},[F,o.onSelect,o.disabled]);function A(){var I,$;N(),($=(I=C.current).onSelect)==null||$.call(I,j.current)}function N(){P.setState("value",j.current,!0)}if(!F)return null;let{disabled:S,value:E,onSelect:D,forceMount:Z,keywords:Y,...G}=o;return p.createElement(Je.div,{ref:Ln(m,d),...G,id:f,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!L,"data-disabled":!!S,"data-selected":!!L,onPointerMove:S||x.getDisablePointerSelection()?void 0:N,onClick:S?void 0:A},o.children)}),Cg=p.forwardRef((o,d)=>{let{heading:a,children:c,forceMount:f,...m}=o,h=er(),x=p.useRef(null),C=p.useRef(null),b=er(),j=Rs(),P=Er(F=>f||j.filter()===!1?!0:F.search?F.filtered.groups.has(h):!0);Kr(()=>j.group(h),[]),Hf(h,x,[o.value,o.heading,C]);let L=p.useMemo(()=>({id:h,forceMount:f}),[f]);return p.createElement(Je.div,{ref:Ln(x,d),...m,"cmdk-group":"",role:"presentation",hidden:P?void 0:!0},a&&p.createElement("div",{ref:C,"cmdk-group-heading":"","aria-hidden":!0,id:b},a),al(o,F=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?b:void 0},p.createElement(Bf.Provider,{value:L},F))))}),Eg=p.forwardRef((o,d)=>{let{alwaysRender:a,...c}=o,f=p.useRef(null),m=Er(h=>!h.search);return!a&&!m?null:p.createElement(Je.div,{ref:Ln(f,d),...c,"cmdk-separator":"",role:"separator"})}),_g=p.forwardRef((o,d)=>{let{onValueChange:a,...c}=o,f=o.value!=null,m=zi(),h=Er(b=>b.search),x=Er(b=>b.selectedItemId),C=Rs();return p.useEffect(()=>{o.value!=null&&m.setState("search",o.value)},[o.value]),p.createElement(Je.input,{ref:d,...c,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":C.listId,"aria-labelledby":C.labelId,"aria-activedescendant":x,id:C.inputId,type:"text",value:f?o.value:h,onChange:b=>{f||m.setState("search",b.target.value),a==null||a(b.target.value)}})}),Pg=p.forwardRef((o,d)=>{let{children:a,label:c="Suggestions",...f}=o,m=p.useRef(null),h=p.useRef(null),x=Er(b=>b.selectedItemId),C=Rs();return p.useEffect(()=>{if(h.current&&m.current){let b=h.current,j=m.current,P,L=new ResizeObserver(()=>{P=requestAnimationFrame(()=>{let F=b.offsetHeight;j.style.setProperty("--cmdk-list-height",F.toFixed(1)+"px")})});return L.observe(b),()=>{cancelAnimationFrame(P),L.unobserve(b)}}},[]),p.createElement(Je.div,{ref:Ln(m,d),...f,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":x,"aria-label":c,id:C.listId},al(o,b=>p.createElement("div",{ref:Ln(h,C.listInnerRef),"cmdk-list-sizer":""},b)))}),Mg=p.forwardRef((o,d)=>{let{open:a,onOpenChange:c,overlayClassName:f,contentClassName:m,container:h,...x}=o;return p.createElement(Pf,{open:a,onOpenChange:c},p.createElement(zf,{container:h},p.createElement(Df,{"cmdk-overlay":"",className:f}),p.createElement(Lf,{"aria-label":o.label,"cmdk-dialog":"",className:m},p.createElement(Vf,{ref:d,...x}))))}),Rg=p.forwardRef((o,d)=>Er(a=>a.filtered.count===0)?p.createElement(Je.div,{ref:d,...o,"cmdk-empty":"",role:"presentation"}):null),zg=p.forwardRef((o,d)=>{let{progress:a,children:c,label:f="Loading...",...m}=o;return p.createElement(Je.div,{ref:d,...m,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":f},al(o,h=>p.createElement("div",{"aria-hidden":!0},h)))}),En=Object.assign(Vf,{List:Pg,Item:Sg,Input:_g,Group:Cg,Separator:Eg,Dialog:Mg,Empty:Rg,Loading:zg});function Dg(o,d){let a=o.nextElementSibling;for(;a;){if(a.matches(d))return a;a=a.nextElementSibling}}function Lg(o,d){let a=o.previousElementSibling;for(;a;){if(a.matches(d))return a;a=a.previousElementSibling}}function Wf(o){let d=p.useRef(o);return Kr(()=>{d.current=o}),d}var Kr=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Mn(o){let d=p.useRef();return d.current===void 0&&(d.current=o()),d}function Er(o){let d=zi(),a=()=>o(d.snapshot());return p.useSyncExternalStore(d.subscribe,a,a)}function Hf(o,d,a,c=[]){let f=p.useRef(),m=Rs();return Kr(()=>{var h;let x=(()=>{var b;for(let j of a){if(typeof j=="string")return j.trim();if(typeof j=="object"&&"current"in j)return j.current?(b=j.current.textContent)==null?void 0:b.trim():f.current}})(),C=c.map(b=>b.trim());m.value(o,x,C),(h=d.current)==null||h.setAttribute(Pn,x),f.current=x}),f}var Ag=()=>{let[o,d]=p.useState(),a=Mn(()=>new Map);return Kr(()=>{a.current.forEach(c=>c()),a.current=new Map},[o]),(c,f)=>{a.current.set(c,f),d({})}};function Og(o){let d=o.type;return typeof d=="function"?d(o.props):"render"in d?d.render(o.props):o}function al({asChild:o,children:d},a){return o&&p.isValidElement(d)?p.cloneElement(Og(d),{ref:d.ref},a(d.props.children)):a(d)}var Tg={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Ig({onNavigate:o}){const[d,a]=p.useState(!1);return p.useEffect(()=>{const c=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&(f.preventDefault(),a(m=>!m))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),n.jsx(En.Dialog,{open:d,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:n.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:[n.jsx(En.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"}),n.jsxs(En.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(En.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(En.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:yi.map(c=>n.jsxs(En.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{o(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:[n.jsx(c.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:c.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function fe(o,d){var C;const a={"Content-Type":"application/json",...d==null?void 0:d.headers},c=localStorage.getItem("mc_sudo_password"),f=localStorage.getItem("mc_hf_token");c&&(a["X-Sudo-Password"]=c);let m=d==null?void 0:d.body;if((((C=d==null?void 0:d.method)==null?void 0:C.toUpperCase())||"GET")==="POST"){if(typeof m=="string")try{const b=JSON.parse(m);let j=!1;c&&!("sudo_password"in b)&&(b.sudo_password=c,j=!0),f&&!("hf_token"in b)&&(b.hf_token=f,j=!0),j&&(m=JSON.stringify(b))}catch{}else if(!m){const b={};c&&(b.sudo_password=c),f&&(b.hf_token=f),Object.keys(b).length>0&&(m=JSON.stringify(b))}}const x=await fetch(o,{...d,headers:a,body:m});if(!x.ok)throw new Error(`${x.status} ${x.statusText}`);return x.json()}function Gf(o){var d,a,c="";if(typeof o=="string"||typeof o=="number")c+=o;else if(typeof o=="object")if(Array.isArray(o)){var f=o.length;for(d=0;d{const d=Bg(o),{conflictingClassGroups:a,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:h=>{const x=h.split(Di);return x[0]===""&&x.length!==1&&x.shift(),Kf(x,d)||Ug(h)},getConflictingClassGroupIds:(h,x)=>{const C=a[h]||[];return x&&c[h]?[...C,...c[h]]:C}}},Kf=(o,d)=>{var h;if(o.length===0)return d.classGroupId;const a=o[0],c=d.nextPart.get(a),f=c?Kf(o.slice(1),c):void 0;if(f)return f;if(d.validators.length===0)return;const m=o.join(Di);return(h=d.validators.find(({validator:x})=>x(m)))==null?void 0:h.classGroupId},Qu=/^\[(.+)\]$/,Ug=o=>{if(Qu.test(o)){const d=Qu.exec(o)[1],a=d==null?void 0:d.substring(0,d.indexOf(":"));if(a)return"arbitrary.."+a}},Bg=o=>{const{theme:d,prefix:a}=o,c={nextPart:new Map,validators:[]};return Wg(Object.entries(o.classGroups),a).forEach(([m,h])=>{Ni(h,c,m,d)}),c},Ni=(o,d,a,c)=>{o.forEach(f=>{if(typeof f=="string"){const m=f===""?d:qu(d,f);m.classGroupId=a;return}if(typeof f=="function"){if(Vg(f)){Ni(f(c),d,a,c);return}d.validators.push({validator:f,classGroupId:a});return}Object.entries(f).forEach(([m,h])=>{Ni(h,qu(d,m),a,c)})})},qu=(o,d)=>{let a=o;return d.split(Di).forEach(c=>{a.nextPart.has(c)||a.nextPart.set(c,{nextPart:new Map,validators:[]}),a=a.nextPart.get(c)}),a},Vg=o=>o.isThemeGetter,Wg=(o,d)=>d?o.map(([a,c])=>{const f=c.map(m=>typeof m=="string"?d+m:typeof m=="object"?Object.fromEntries(Object.entries(m).map(([h,x])=>[d+h,x])):m);return[a,f]}):o,Hg=o=>{if(o<1)return{get:()=>{},set:()=>{}};let d=0,a=new Map,c=new Map;const f=(m,h)=>{a.set(m,h),d++,d>o&&(d=0,c=a,a=new Map)};return{get(m){let h=a.get(m);if(h!==void 0)return h;if((h=c.get(m))!==void 0)return f(m,h),h},set(m,h){a.has(m)?a.set(m,h):f(m,h)}}},Qf="!",Gg=o=>{const{separator:d,experimentalParseClassName:a}=o,c=d.length===1,f=d[0],m=d.length,h=x=>{const C=[];let b=0,j=0,P;for(let S=0;Sj?P-j:void 0;return{modifiers:C,hasImportantModifier:F,baseClassName:A,maybePostfixModifierPosition:N}};return a?x=>a({className:x,parseClassName:h}):h},Kg=o=>{if(o.length<=1)return o;const d=[];let a=[];return o.forEach(c=>{c[0]==="["?(d.push(...a.sort(),c),a=[]):a.push(c)}),d.push(...a.sort()),d},Qg=o=>({cache:Hg(o.cacheSize),parseClassName:Gg(o),...$g(o)}),qg=/\s+/,Zg=(o,d)=>{const{parseClassName:a,getClassGroupId:c,getConflictingClassGroupIds:f}=d,m=[],h=o.trim().split(qg);let x="";for(let C=h.length-1;C>=0;C-=1){const b=h[C],{modifiers:j,hasImportantModifier:P,baseClassName:L,maybePostfixModifierPosition:F}=a(b);let A=!!F,N=c(A?L.substring(0,F):L);if(!N){if(!A){x=b+(x.length>0?" "+x:x);continue}if(N=c(L),!N){x=b+(x.length>0?" "+x:x);continue}A=!1}const S=Kg(j).join(":"),E=P?S+Qf:S,D=E+N;if(m.includes(D))continue;m.push(D);const Z=f(N,A);for(let Y=0;Y0?" "+x:x)}return x};function Yg(){let o=0,d,a,c="";for(;o{if(typeof o=="string")return o;let d,a="";for(let c=0;cP(j),o());return a=Qg(b),c=a.cache.get,f=a.cache.set,m=x,x(C)}function x(C){const b=c(C);if(b)return b;const j=Zg(C,a);return f(C,j),j}return function(){return m(Yg.apply(null,arguments))}}const Te=o=>{const d=a=>a[o]||[];return d.isThemeGetter=!0,d},Zf=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xg=/^\d+\/\d+$/,e0=new Set(["px","full","screen"]),t0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r0=/\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$/,n0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,s0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xt=o=>zn(o)||e0.has(o)||Xg.test(o),jr=o=>On(o,"length",p0),zn=o=>!!o&&!Number.isNaN(Number(o)),ui=o=>On(o,"number",zn),ks=o=>!!o&&Number.isInteger(Number(o)),l0=o=>o.endsWith("%")&&zn(o.slice(0,-1)),je=o=>Zf.test(o),kr=o=>t0.test(o),a0=new Set(["length","size","percentage"]),i0=o=>On(o,a0,Yf),d0=o=>On(o,"position",Yf),c0=new Set(["image","url"]),u0=o=>On(o,c0,h0),f0=o=>On(o,"",m0),Ns=()=>!0,On=(o,d,a)=>{const c=Zf.exec(o);return c?c[1]?typeof d=="string"?c[1]===d:d.has(c[1]):a(c[2]):!1},p0=o=>r0.test(o)&&!n0.test(o),Yf=()=>!1,m0=o=>s0.test(o),h0=o=>o0.test(o),x0=()=>{const o=Te("colors"),d=Te("spacing"),a=Te("blur"),c=Te("brightness"),f=Te("borderColor"),m=Te("borderRadius"),h=Te("borderSpacing"),x=Te("borderWidth"),C=Te("contrast"),b=Te("grayscale"),j=Te("hueRotate"),P=Te("invert"),L=Te("gap"),F=Te("gradientColorStops"),A=Te("gradientColorStopPositions"),N=Te("inset"),S=Te("margin"),E=Te("opacity"),D=Te("padding"),Z=Te("saturate"),Y=Te("scale"),G=Te("sepia"),I=Te("skew"),$=Te("space"),ne=Te("translate"),se=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],be=()=>["auto",je,d],ce=()=>[je,d],Me=()=>["",Xt,jr],Pe=()=>["auto",zn,je],Re=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Se=()=>["solid","dashed","dotted","double","none"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],ae=()=>["","0",je],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>[zn,je];return{cacheSize:500,separator:":",theme:{colors:[Ns],spacing:[Xt,jr],blur:["none","",kr,je],brightness:w(),borderColor:[o],borderRadius:["none","","full",kr,je],borderSpacing:ce(),borderWidth:Me(),contrast:w(),grayscale:ae(),hueRotate:w(),invert:ae(),gap:ce(),gradientColorStops:[o],gradientColorStopPositions:[l0,jr],inset:be(),margin:be(),opacity:w(),padding:ce(),saturate:w(),scale:w(),sepia:ae(),skew:w(),space:ce(),translate:ce()},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[kr]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"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:[...Re(),je]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:se()}],"overscroll-x":[{"overscroll-x":se()}],"overscroll-y":[{"overscroll-y":se()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ks,je]}],basis:[{basis:be()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",je]}],grow:[{grow:ae()}],shrink:[{shrink:ae()}],order:[{order:["first","last","none",ks,je]}],"grid-cols":[{"grid-cols":[Ns]}],"col-start-end":[{col:["auto",{span:["full",ks,je]},je]}],"col-start":[{"col-start":Pe()}],"col-end":[{"col-end":Pe()}],"grid-rows":[{"grid-rows":[Ns]}],"row-start-end":[{row:["auto",{span:[ks,je]},je]}],"row-start":[{"row-start":Pe()}],"row-end":[{"row-end":Pe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[L]}],"gap-x":[{"gap-x":[L]}],"gap-y":[{"gap-y":[L]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",je,d]}],"min-w":[{"min-w":[je,d,"min","max","fit"]}],"max-w":[{"max-w":[je,d,"none","full","min","max","fit","prose",{screen:[kr]},kr]}],h:[{h:[je,d,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[je,d,"auto","min","max","fit"]}],"font-size":[{text:["base",kr,jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ui]}],"font-family":[{font:[Ns]}],"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",je]}],"line-clamp":[{"line-clamp":["none",zn,ui]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Xt,je]}],"list-image":[{"list-image":["none",je]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[o]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Xt,jr]}],"underline-offset":[{"underline-offset":["auto",Xt,je]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ce()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je]}],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",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Re(),d0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",i0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},u0]}],"bg-color":[{bg:[o]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[F]}],"gradient-via":[{via:[F]}],"gradient-to":[{to:[F]}],rounded:[{rounded:[m]}],"rounded-s":[{"rounded-s":[m]}],"rounded-e":[{"rounded-e":[m]}],"rounded-t":[{"rounded-t":[m]}],"rounded-r":[{"rounded-r":[m]}],"rounded-b":[{"rounded-b":[m]}],"rounded-l":[{"rounded-l":[m]}],"rounded-ss":[{"rounded-ss":[m]}],"rounded-se":[{"rounded-se":[m]}],"rounded-ee":[{"rounded-ee":[m]}],"rounded-es":[{"rounded-es":[m]}],"rounded-tl":[{"rounded-tl":[m]}],"rounded-tr":[{"rounded-tr":[m]}],"rounded-br":[{"rounded-br":[m]}],"rounded-bl":[{"rounded-bl":[m]}],"border-w":[{border:[x]}],"border-w-x":[{"border-x":[x]}],"border-w-y":[{"border-y":[x]}],"border-w-s":[{"border-s":[x]}],"border-w-e":[{"border-e":[x]}],"border-w-t":[{"border-t":[x]}],"border-w-r":[{"border-r":[x]}],"border-w-b":[{"border-b":[x]}],"border-w-l":[{"border-l":[x]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...Se(),"hidden"]}],"divide-x":[{"divide-x":[x]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[x]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:Se()}],"border-color":[{border:[f]}],"border-color-x":[{"border-x":[f]}],"border-color-y":[{"border-y":[f]}],"border-color-s":[{"border-s":[f]}],"border-color-e":[{"border-e":[f]}],"border-color-t":[{"border-t":[f]}],"border-color-r":[{"border-r":[f]}],"border-color-b":[{"border-b":[f]}],"border-color-l":[{"border-l":[f]}],"divide-color":[{divide:[f]}],"outline-style":[{outline:["",...Se()]}],"outline-offset":[{"outline-offset":[Xt,je]}],"outline-w":[{outline:[Xt,jr]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[Xt,jr]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",kr,f0]}],"shadow-color":[{shadow:[Ns]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ne()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[c]}],contrast:[{contrast:[C]}],"drop-shadow":[{"drop-shadow":["","none",kr,je]}],grayscale:[{grayscale:[b]}],"hue-rotate":[{"hue-rotate":[j]}],invert:[{invert:[P]}],saturate:[{saturate:[Z]}],sepia:[{sepia:[G]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[C]}],"backdrop-grayscale":[{"backdrop-grayscale":[b]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j]}],"backdrop-invert":[{"backdrop-invert":[P]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[Z]}],"backdrop-sepia":[{"backdrop-sepia":[G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[h]}],"border-spacing-x":[{"border-spacing-x":[h]}],"border-spacing-y":[{"border-spacing-y":[h]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",je]}],duration:[{duration:w()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:w()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[Y]}],"scale-x":[{"scale-x":[Y]}],"scale-y":[{"scale-y":[Y]}],rotate:[{rotate:[ks,je]}],"translate-x":[{"translate-x":[ne]}],"translate-y":[{"translate-y":[ne]}],"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",je]}],accent:[{accent:["auto",o]}],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",je]}],"caret-color":[{caret:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ce()}],"scroll-mx":[{"scroll-mx":ce()}],"scroll-my":[{"scroll-my":ce()}],"scroll-ms":[{"scroll-ms":ce()}],"scroll-me":[{"scroll-me":ce()}],"scroll-mt":[{"scroll-mt":ce()}],"scroll-mr":[{"scroll-mr":ce()}],"scroll-mb":[{"scroll-mb":ce()}],"scroll-ml":[{"scroll-ml":ce()}],"scroll-p":[{"scroll-p":ce()}],"scroll-px":[{"scroll-px":ce()}],"scroll-py":[{"scroll-py":ce()}],"scroll-ps":[{"scroll-ps":ce()}],"scroll-pe":[{"scroll-pe":ce()}],"scroll-pt":[{"scroll-pt":ce()}],"scroll-pr":[{"scroll-pr":ce()}],"scroll-pb":[{"scroll-pb":ce()}],"scroll-pl":[{"scroll-pl":ce()}],"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",je]}],fill:[{fill:[o,"none"]}],"stroke-w":[{stroke:[Xt,jr,ui]}],stroke:[{stroke:[o,"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"]}}},g0=Jg(x0);function ee(...o){return g0(Fg(o))}function Ms(o){return o?o.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function qr({type:o,title:d,message:a,defaultValue:c,onConfirm:f,onCancel:m}){return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:d}),n.jsx("button",{onClick:m||(()=>f()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a}),o==="prompt"&&n.jsx("input",{type:"text",id:"custom-dialog-input",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:h=>{var x;if(h.key==="Enter"){const C=(x=document.getElementById("custom-dialog-input"))==null?void 0:x.value;f(C)}}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(o==="confirm"||o==="prompt")&&n.jsx("button",{onClick:m,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"}),n.jsx("button",{onClick:()=>{var x;const h=o==="prompt"?(x=document.getElementById("custom-dialog-input"))==null?void 0:x.value:void 0;f(h)},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:o==="confirm"?"Ja, fortfahren":o==="prompt"?"Übernehmen":"OK"})]})]})})}function _n(o){return(o/1024**3).toFixed(1)}function Qo({value:o,label:d,detail:a}){const f=2*Math.PI*24,m=f-Math.min(o,100)/100*f,h=o>90?"stroke-red-500":o>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:ee("fill-none transition-all duration-700 ease-out",h),strokeWidth:"4.5",strokeDasharray:f,strokeDashoffset:m,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:d}),a&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function v0(){var T;const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState([]),[h,x]=p.useState([]),[C,b]=p.useState([]),[j,P]=p.useState(null),[L,F]=p.useState([]),[A,N]=p.useState(null),[S,E]=p.useState(""),[D,Z]=p.useState(!1),[Y,G]=p.useState(""),[I,$]=p.useState(!1),[ne,se]=p.useState({open:!1,actionPath:"",actionLabel:""}),[X,be]=p.useState(null),[ce,Me]=p.useState(!1);async function Pe(O){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:O})}),be({type:"alert",title:"Erfolgreich",message:`Hermes-Gehirn wurde auf '${O}' geändert. Der Gateway-Dienst wurde neu gestartet.`,onConfirm:()=>be(null)}),v(),Me(!1)}catch(ge){be({type:"alert",title:"Fehler",message:`Fehler beim Wechseln des Gehirns: ${ge.message}`,onConfirm:()=>be(null)})}}function Re(O,ge,Xe){be({type:"confirm",title:O,message:ge,onConfirm:()=>{be(null),Xe()},onCancel:()=>be(null)})}const[Se,Ne]=p.useState(""),[H,ae]=p.useState("stable"),[K,w]=p.useState(!1);function v(){fe("/api/system/status").then(d).catch(()=>{}),fe("/api/agent/status").then(c).catch(()=>{}),fe("/api/models").then(O=>{m(O.models||[]),x(O.running||[])}).catch(()=>{}),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{}),fe("/api/maintenance/updates").then(P).catch(()=>{}),fe("/api/jobs").then(O=>F(O.jobs||[])).catch(()=>{}),fe("/api/system/token-stats").then(N).catch(()=>{})}p.useEffect(()=>{v();const O=setInterval(v,3e3);return()=>clearInterval(O)},[]);async function V(O,ge,Xe,ft){E(`${ge} wird ausgeführt...`),Z(!0);try{const pt={...Xe},mt=await fe(O,{method:"POST",body:JSON.stringify(pt)});if(mt.status==="password_required"||mt.status==="incorrect_password"){se({open:!0,actionPath:O,actionLabel:ge,payload:Xe,error:mt.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),E("");return}mt.job_id?E(`${ge} gestartet (Job-ID: ${mt.job_id})`):mt.ok?E(`${ge} erfolgreich ausgeführt.`):E(`Fehler: ${mt.err||"Unbekannter Fehler"}`),v()}catch(pt){E(`Fehler bei ${ge}: ${pt.message}`)}finally{Z(!1)}}async function J(){$(!0);try{const O={...ne.payload,sudo_password:Y},ge=await fe(ne.actionPath,{method:"POST",body:JSON.stringify(O)});if(ge.status==="password_required"||ge.status==="incorrect_password"){se(Xe=>({...Xe,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}ge.job_id?E(`${ne.actionLabel} gestartet (Job-ID: ${ge.job_id})`):ge.ok?E(`${ne.actionLabel} erfolgreich ausgeführt.`):E(`Fehler: ${ge.err||"Unbekannter Fehler"}`),se({open:!1,actionPath:"",actionLabel:""}),G(""),v()}catch(O){E(`Fehler: ${O.message}`),se({open:!1,actionPath:"",actionLabel:""}),G("")}finally{$(!1)}}async function Q(O,ge){E(`Upgrade für ${O} wird gestartet...`);try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:O,role:ge,quant:"Q4_K_M",jinja:!0})}),E("Upgrade-Download gestartet."),v()}catch(Xe){E(`Upgrade fehlgeschlagen: ${Xe.message}`)}}async function oe(){if(!(!Se.trim()||K)){w(!0);try{await fe("/api/memory",{method:"POST",body:JSON.stringify({content:Se,category:H,source:"dashboard"})}),Ne(""),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{})}catch(O){console.error(O)}finally{w(!1)}}}const pe=L.find(O=>O.label.includes("OS-Update")&&(O.state==="running"||O.state==="queued")),me=L.find(O=>O.label.includes("Engine-Update")&&(O.state==="running"||O.state==="queued"));return n.jsxs("div",{className:"space-y-6",children:[ne.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:ne.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:Y,onChange:O=>G(O.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:O=>O.key==="Enter"&&J(),autoFocus:!0}),ne.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:ne.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},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"}),n.jsx("button",{onClick:J,disabled:!Y||I,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:I?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(yt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),o?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(Qo,{value:o.cpu.percent,label:"CPU",detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0}),n.jsx(Qo,{value:o.ram.percent,label:"RAM",detail:`${_n(o.ram.used)} / ${_n(o.ram.total)} GB`}),o.gpu&&o.gpu.busy_percent!=null&&o.gpu.gtt_used!=null&&o.gpu.gtt_total!=null&&n.jsx(Qo,{value:o.gpu.busy_percent,label:"GPU",detail:`${_n(o.gpu.gtt_used)} / ${_n(o.gpu.gtt_total)} GB`}),o.disk&&n.jsx(Qo,{value:o.disk.percent,label:"Disk",detail:`${_n(o.disk.used)} / ${_n(o.disk.total)} GB`})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(o==null?void 0:o.temp)&&(o.temp.cpu||o.temp.gpu)&&n.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[o.temp.cpu!=null&&n.jsxs("span",{children:["CPU Temp: ",o.temp.cpu," °C"]}),o.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",o.temp.gpu," °C"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ch,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(j==null?void 0:j.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(j.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),j?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.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:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:j.os>0?`${j.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.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:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:j.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:j.models>0?`${j.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>V("/api/maintenance/os-update","OS-Update"),disabled:D||!!pe,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:pe?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",pe.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>V("/api/maintenance/engine-update","Engine-Update"),disabled:D||!!me,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:me?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",me.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{Re("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>V("/api/maintenance/reboot","Reboot"))},disabled:D,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:[n.jsx(df,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),j.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:j.model_list.map(O=>n.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:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${O.role}: ${O.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:O.role}),": ",O.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>Q(O.repo,O.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:[n.jsx(Wr,{className:"h-2.5 w-2.5"})," Laden"]})]},O.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),S&&n.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:S}),n.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:[n.jsx(Hr,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.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"})})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ss,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(a==null?void 0:a.webui_url)&&n.jsxs("a",{href:Ms(a.webui_url),target:"_blank",rel:"noopener",className:ee("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",a.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(el,{className:"h-3 w-3"})," Hermes öffnen"]})]}),a?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>Me(!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 group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(yt,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(Es,{className:"h-3.5 w-3.5"}),a.brain_model?`model: ${a.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Es,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:["fast","heavy","coder","reasoning","vision","scout"].map(O=>{var ft;const ge=f.find(pt=>pt.role===O),Xe=ge?h.includes(ge.name):!1;return n.jsxs("div",{className:ee("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",Xe?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":ge?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ee("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",O==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":O==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":O==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":O==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":O==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:O}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:ge?(ft=ge.name.split("/").pop())==null?void 0:ft.replace(/\.gguf$/i,""):"nicht zugewiesen"}),ge&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[ge.prompt_cache&&n.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"}),ge.spec_draft_model&&n.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: ${ge.spec_draft_model})`,children:"SPEC"}),ge.parallel_slots>1&&n.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:`${ge.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ge.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:ge?Xe?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},O)})})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Cs,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:Se,onChange:O=>Ne(O.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"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:H,onChange:O=>ae(O.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:oe,disabled:!Se.trim()||K,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:[n.jsx(af,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:C.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):C.map(O=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:O.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:O.content,children:O.content})]},O.id))})]})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(ph,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),A?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[A.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",A.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:A.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(T=A==null?void 0:A.pricing)!=null&&T.heavy?` (Ø ${A.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${A.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})]}),a&&ce&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(yt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>Me(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...f.map(O=>{var ge;return((ge=O.name.split("/").pop())==null?void 0:ge.replace(".gguf",""))||O.name})].map(O=>{const ge=["auto","fast","heavy"].includes(O);return n.jsxs("button",{onClick:()=>Pe(O),className:ee("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.brain_model===O||!a.brain_model&&O==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:O}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ge?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(a.brain_model===O||!a.brain_model&&O==="auto")&&n.jsx(Dn,{className:"h-4 w-4 shrink-0 text-primary"})]},O)})})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,onConfirm:()=>X.onConfirm(),onCancel:X.onCancel})]})}function Ur({children:o,tone:d="muted"}){const a={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${a[d]}`,children:o})}function Zu({caps:o}){return o?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[o.coder&&n.jsx(Ur,{children:"💻 Code"}),o.vision&&n.jsx(Ur,{children:"👁 Bild"}),o.reasoning&&n.jsx(Ur,{children:"🧠 Reason"}),o.moe&&n.jsxs(Ur,{tone:"primary",children:["🧩 MoE",o.active_b?`·${o.active_b}b`:""]}),o.tools==="yes"&&n.jsx(Ur,{tone:"primary",children:"🛠 Tools"}),o.tools==="likely"&&n.jsx(Ur,{tone:"warn",children:"🛠 Tools?"}),o.embedding&&n.jsx(Ur,{children:"🔢 Embed"})]}):null}function Si(o){return o?o>1024**3?`${(o/1024**3).toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`:""}function y0(o){if(!o)return"";const d=Math.floor(o/60);return d>0?`${d} min`:`${o} s`}function b0({onError:o}){const[d,a]=p.useState([]),[c,f]=p.useState(null);function m(){fe("/api/jobs").then(b=>a(b.jobs||[])).catch(()=>{})}p.useEffect(()=>{m();const b=setInterval(m,2e3);return()=>clearInterval(b)},[]);async function h(b){try{await fe(`/api/jobs/${b}/cancel`,{method:"POST"}),m()}catch(j){o?o(j.message):f(j.message)}}const x=d.filter(b=>b.state==="running"||b.state==="queued"),C=d.filter(b=>b.state!=="running"&&b.state!=="queued").slice(-3);return x.length===0&&C.length===0?null:n.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:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),x.map(b=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:b.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[b.progress??0,"% • ",Si(b.done_bytes),"/",Si(b.total_bytes),b.eta_s?` • ETA ${y0(b.eta_s)}`:""]}),n.jsx("button",{onClick:()=>h(b.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"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${b.progress??0}%`}})})]},b.id)),C.map(b=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:b.label}),n.jsx("span",{className:ee("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",b.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:b.state})]},b.id)),c&&n.jsx(qr,{type:"alert",title:"Fehler",message:c,onConfirm:()=>f(null)})]})}function Br(o){if(!o)return"—";const d=o/1024**3;return d>=1?`${d.toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`}function Yu(o){return o?`${Math.round(o/1024)}k`:"—"}function w0({fit:o}){const d={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"}[o.level];return n.jsxs("span",{className:ee("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",d),children:[o.text," • ",o.req_gb," GB RAM"]})}const j0=["fast","heavy","coder","reasoning","agent","vision","scout"];function Ju(o){const d=o.toLowerCase();return d.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:d.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:d.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:d.includes("mistral")||d.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:d.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:d.includes("hermes")||d.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:d.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 k0(){var Yr,rr,Bt,Jr,In;const[o,d]=p.useState([]),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(null),[C,b]=p.useState(null),[j,P]=p.useState(!0),[L,F]=p.useState(""),[A,N]=p.useState(null),[S,E]=p.useState(null),[D,Z]=p.useState(!1),[Y,G]=p.useState(null),[I,$]=p.useState("grid"),[ne,se]=p.useState("all"),[X,be]=p.useState(null);function ce(R,re,ye){be({type:"alert",title:R,message:re,onConfirm:()=>{be(null)}})}function Me(R,re,ye,Ce){be({type:"confirm",title:R,message:re,onConfirm:()=>{be(null),ye()},onCancel:()=>{be(null)}})}function Pe(R,re,ye,Ce,De){be({type:"prompt",title:R,message:re,defaultValue:ye,onConfirm:Ct=>{be(null),Ce(Ct)},onCancel:()=>{be(null)}})}const Re=o.filter(R=>ne==="in_use"?!!R.role||a.includes(R.name):!0),[Se,Ne]=p.useState({width:800,height:360}),H=p.useRef(null),ae=p.useCallback(R=>{if(H.current&&(H.current.disconnect(),H.current=null),R){const re=new ResizeObserver(ye=>{if(!ye||ye.length===0)return;const Ce=ye[0].contentRect;Ne({width:Ce.width,height:Ce.height})});re.observe(R),H.current=re}},[]),K=Se.width,w=Se.height,v=R=>{const re=K*.1,ye=w*R,Ce=K*.5,De=w*.5,Ct=K*.3,Vt=ye,Wt=K*.3;return`M ${re} ${ye} C ${Ct} ${Vt}, ${Wt} ${De}, ${Ce} ${De}`},V=R=>{const re=K*.5,ye=w*.5,Ce=K*.9,De=w*R,Ct=K*.7,Vt=ye,Wt=K*.7;return`M ${re} ${ye} C ${Ct} ${Vt}, ${Wt} ${De}, ${Ce} ${De}`};function J(){Promise.all([fe("/api/models"),fe("/api/routing"),fe("/api/connect"),fe("/api/maintenance/updates")]).then(([R,re,ye,Ce])=>{d(R.models||[]),c(R.running||[]),m(re),x(ye),b(Ce)}).catch(R=>F(String(R))).finally(()=>P(!1))}p.useEffect(()=>{J();const R=setInterval(J,4e3);return()=>clearInterval(R)},[]);async function Q(R){try{await fe(`/api/models/${encodeURIComponent(R)}/load`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Laden des Modells: ${re.message}`)}}async function oe(R){try{await fe(`/api/models/${encodeURIComponent(R)}/unload`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Entladen des Modells: ${re.message}`)}}async function pe(){try{await fe("/api/models/unload",{method:"POST"}),J()}catch(R){ce("Fehler",`Fehler beim Entladen aller Modelle: ${R.message}`)}}async function me(R,re){try{await fe(`/api/models/${encodeURIComponent(re)}/role`,{method:"POST",body:JSON.stringify({role:R||null})}),J()}catch(ye){ce("Fehler",`Fehler beim Zuweisen der Rolle: ${ye.message||ye}`)}}async function T(R,re){Pe("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(re||32768),async ye=>{if(ye)try{await fe(`/api/models/${encodeURIComponent(R)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ye,10)})}),J()}catch(Ce){ce("Fehler",`Fehler beim Setzen des Kontexts: ${Ce.message||Ce}`)}})}async function O(R){Me("Modell löschen?",`Modell '${R}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await fe(`/api/models/${encodeURIComponent(R)}`,{method:"DELETE"}),J()}catch(re){ce("Fehler",`Fehler beim Löschen: ${re.message||re}`)}})}async function ge(R,re,ye,Ce){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:R,role:re,quant:ye,jinja:Ce})}),ce("Herunterladen gestartet",`Download für '${R}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(De){ce("Fehler",`Fehler beim Starten des Upgrades: ${De.message||De}`)}}async function Xe(R){R&&(await navigator.clipboard.writeText(R),Z(!0),setTimeout(()=>Z(!1),1500))}if(j)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(L)return n.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 (",L,")."]});const ft=o.filter(R=>a.includes(R.name)),pt=ft.reduce((R,re)=>R+(re.size_bytes||0),0),mt=16*1024**3,Tn=pt>mt?pt*1.2:mt,Zr=R=>o.find(re=>re.role===R),tr=R=>{const re=Zr(R);return re?a.includes(re.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -362,7 +362,7 @@ Error generating stack: `+i.message+` stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),n.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:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",Ur(nt)," / ",Ur(Tn)," geladen"]}),a.length>0&&n.jsx("button",{onClick:pe,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"})]})]}),n.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:lt.length===0?n.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"}):lt.map((z,re)=>{var ze;const ve=(z.size_bytes||0)/Tn*100,Se=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][re%4];return n.jsxs("div",{style:{width:`${ve}%`},className:ee("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",Se),title:`${z.name} (${Ur(z.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[z.role?`[${z.role}] `:"",(ze=z.name.split("/").pop())==null?void 0:ze.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Ur(z.size_bytes)})]},z.name)})})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.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."})]}),n.jsxs("div",{ref:ae,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:v(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="roocode"||O==="roocode")&&n.jsx("path",{d:v(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="cursor"||O==="cursor")&&n.jsx("path",{d:v(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="opencode"||O==="opencode")&&n.jsx("path",{d:v(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="zed"||O==="zed")&&n.jsx("path",{d:v(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="continue"||O==="continue")&&n.jsx("path",{d:v(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:B(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),er("fast")&&n.jsx("path",{d:B(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:B(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),er("heavy")&&n.jsx("path",{d:B(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:B(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),er("coder")&&n.jsx("path",{d:B(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:B(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),er("vision")&&n.jsx("path",{d:B(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:B(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),er("scout")&&n.jsx("path",{d:B(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>H("roocode"),onMouseLeave:()=>H(null),onClick:()=>S(z=>z==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.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:()=>H("cursor"),onMouseLeave:()=>H(null),onClick:()=>S(z=>z==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.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:()=>H("opencode"),onMouseLeave:()=>H(null),onClick:()=>S(z=>z==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.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:()=>H("zed"),onMouseLeave:()=>H(null),onClick:()=>S(z=>z==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.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:()=>H("continue"),onMouseLeave:()=>H(null),onClick:()=>S(z=>z==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.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:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",f!=null&&f.heavy_threshold_chars?f.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.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"})]}),j0.map(z=>{var Nt;const re=["12%","31%","50%","69%","88%"],ve=qr(z),Se=ve?a.includes(ve.name):!1;if(z==="reasoning"||z==="agent")return null;const ze={fast:0,heavy:1,coder:2,vision:3,scout:4}[z];return n.jsxs("div",{className:ee("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",Se?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ve?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:re[ze]},onClick:()=>_(z),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:z}),Se&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ve?(Nt=ve.name.split("/").pop())==null?void 0:Nt.replace(".gguf",""):"Keine Zuweisung"})]},z)}),O&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[O==="roocode"&&"Roo Code Setup",O==="cursor"&&"Cursor Setup",O==="opencode"&&"OpenCode Setup",O==="zed"&&"Zed Setup",O==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>S(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Hr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[O==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),O==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),O==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),O==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),O==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),h.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var z,re,ve,Se,ze;return $t(O==="roocode"?(z=h.tools.cline)==null?void 0:z.snippet:O==="cursor"?(re=h.tools.cursor)==null?void 0:re.snippet:O==="opencode"?(ve=h.tools.opencode)==null?void 0:ve.snippet:O==="zed"?(Se=h.tools.zed)==null?void 0:Se.snippet:(ze=h.tools.continue)==null?void 0:ze.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[L?n.jsx(zn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(lf,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:L?"Kopiert":"Kopieren"})]})]}),n.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:n.jsxs("code",{children:[O==="roocode"&&((Zr=h.tools.cline)==null?void 0:Zr.snippet),O==="cursor"&&((tr=h.tools.cursor)==null?void 0:tr.snippet),O==="opencode"&&((Ut=h.tools.opencode)==null?void 0:Ut.snippet),O==="zed"&&((Yr=h.tools.zed)==null?void 0:Yr.snippet),O==="continue"&&((In=h.tools.continue)==null?void 0:In.snippet)]})})]}),n.jsx("button",{onClick:()=>S(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"})]})})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(z=>{var Se;const re=o.find(ze=>ze.role===z),ve=re?a.includes(re.name):!1;return n.jsxs("div",{onClick:()=>_(z),className:ee("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]",ve?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":re?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:ee("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",z==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":z==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":z==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":z==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":z==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:z}),ve&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:re==null?void 0:re.name,children:re?(Se=re.name.split("/").pop())==null?void 0:Se.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},z)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Me.length," von ",o.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>se("all"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>se("in_use"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>F("grid"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",T==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>F("list"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",T==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),T==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Me.length===0?n.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:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Me.map(z=>{const re=a.includes(z.name),ve=E==null?void 0:E.model_list.find(ze=>ze.role===z.role),Se=Ju(z.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45 shadow-primary/5":z.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:ee("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Se.color),title:Se.name,children:Se.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:z.name,children:z.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.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:z.quant||"GGUF"}),re&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(Xo,{className:"h-3 w-3 animate-pulse"})," Warm"]}),z.role&&n.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:z.role}),z.prompt_cache&&n.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"}),z.spec_draft_model&&n.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: ${z.spec_draft_model})`,children:"SPEC"}),z.parallel_slots>1&&n.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:`${z.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",z.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(Zu,{caps:z.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(gi,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:Ur(z.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(wh,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:Yu(z.ctx)})]})]})]}),ve&&n.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:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",ve.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>Le(ve.repo,z.role,z.quant||"Q4_K_M",z.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:[n.jsx(Vr,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>re?oe(z.name):K(z.name),className:ee("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>w(z.name,z.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"}),n.jsx("button",{onClick:()=>Q(z.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]})]},z.name)})}):n.jsx("div",{className:"space-y-2",children:Me.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Me.map(z=>{const re=a.includes(z.name),ve=Ju(z.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45":z.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:ee("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ve.color),title:ve.name,children:ve.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:z.name,children:z.name.split("/").pop()}),z.role&&n.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:z.role}),z.prompt_cache&&n.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"}),z.spec_draft_model&&n.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: ${z.spec_draft_model})`,children:"SPEC"}),z.parallel_slots>1&&n.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:`${z.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",z.parallel_slots]}),re&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",Ur(z.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",Yu(z.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:z.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(Zu,{caps:z.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>re?oe(z.name):K(z.name),className:ee("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>w(z.name,z.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"}),n.jsx("button",{onClick:()=>Q(z.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]})]},z.name)})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",C,"' konfigurieren"]}),n.jsx("button",{onClick:()=>_(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Hr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:C}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{me(C,""),_(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:n.jsx("span",{children:"Zuweisung entfernen"})}),o.map(z=>{var re;return n.jsxs("button",{onClick:()=>{me(C,z.name),_(null)},className:ee("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",z.role===C?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(re=z.name.split("/").pop())==null?void 0:re.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[Ur(z.size_bytes)," · ",z.quant]})]}),z.role===C&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},z.name)})]})]})}),X&&n.jsx(Qr,{type:X.type,title:X.title,message:X.message,defaultValue:X.defaultValue,onConfirm:X.onConfirm,onCancel:X.onCancel})]})}function N0(){const[o,d]=p.useState(""),[a,c]=p.useState([]),[f,m]=p.useState("Q4_K_M"),[h,x]=p.useState(""),[E,b]=p.useState(""),[k,M]=p.useState([]);async function A(S){const C=S??o;if(C.trim()){x("Analysiere HuggingFace Repository...");try{const _=await fe(`/api/hf/quants?repo=${encodeURIComponent(C)}`);d(_.repo),c(_.quants),_.quants.length&&m(_.quants.includes("Q4_K_M")?"Q4_K_M":_.quants[0]),x(_.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(_){x(`Fehler: ${_}`)}}}async function I(){if(E.trim()){x("Durchsuche HuggingFace...");try{const S=await fe(`/api/hf/search?q=${encodeURIComponent(E)}`);M(S.results),x(S.results.length?"":"Keine Ergebnisse gefunden.")}catch(S){x(`Suche fehlgeschlagen: ${S}`)}}}async function O(){if(o.trim()){x("Download-Job wird initiiert...");try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:o,quant:f,jinja:!0})}),x(`Download gestartet: ${o} (${f}). Fortschritt wird oben angezeigt.`)}catch(S){x(`Download-Fehler: ${S}`)}}}return n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:o,onChange:S=>d(S.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"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>A(),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&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:f,onChange:S=>m(S.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(S=>n.jsx("option",{value:S,className:"bg-popover text-foreground",children:S},S))}),n.jsxs("button",{onClick:O,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:[n.jsx(Vr,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:E,onChange:S=>b(S.target.value),onKeyDown:S=>S.key==="Enter"&&I(),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"}),n.jsx(_i,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:I,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"})]}),k.length>0&&n.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:k.map(S=>n.jsxs("button",{onClick:()=>{d(S.repo),M([]),b(""),A(S.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:[n.jsx("span",{className:"font-semibold truncate",children:S.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(Vr,{className:"h-3 w-3"})," ",S.downloads.toLocaleString()]})]},S.repo))}),h&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:h})]})}const S0={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:xi},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:mi},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Cs},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Ss},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:hi}};function C0(){const[o,d]=p.useState(null),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(""),[E,b]=p.useState(!0),[k,M]=p.useState({}),[A,I]=p.useState({}),[O,S]=p.useState(!1);p.useEffect(()=>{Promise.all([fe("/api/discover"),fe("/api/models"),fe("/api/maintenance/updates").catch(()=>null)]).then(([_,L,Z])=>{d(_),c(L.models||[]),Z&&m(Z)}).catch(_=>x(String(_))).finally(()=>b(!1))},[]);async function C(_,L,Z,Y){M(H=>({...H,[_]:"Starte..."}));try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:_,role:L,quant:Z,jinja:Y})}),M(H=>({...H,[_]:"Download läuft"}))}catch{M(T=>({...T,[_]:"Fehler"}))}}return E?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):h||!o?n.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 (",h,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.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:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(cf,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:o.categories.map(_=>{const L=S0[_.role]||{title:_.title||_.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:Es},Z=L.icon,Y=a.find(X=>X.role===_.role),H=f==null?void 0:f.model_list.find(X=>X.role===_.role),T=_.models.find(X=>X.repo===_.recommended)||_.models[0];if(!T)return null;const F=k[T.repo],ne=_.models.filter(X=>X.repo!==_.recommended),se=!!A[_.role];return n.jsxs("div",{className:ee("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",Y?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.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:n.jsx(Z,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:L.title}),n.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: ",_.role]})]})]}),Y?n.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:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.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"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:L.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:Y?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:Y.name,children:Y.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",Si(Y.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",Y.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",T.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",T.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(w0,{fit:T.fit})})]})}),n.jsx("div",{className:"pt-1",children:Y?H?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",H.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>C(H.repo,_.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!k[H.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:[n.jsx(Vr,{className:"h-3.5 w-3.5"}),k[H.repo]||"Auf neue Version aktualisieren"]})]}):n.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:[n.jsx(zn,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>C(T.repo,_.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!F,className:ee("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",F?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(Vr,{className:"h-3.5 w-3.5"}),F||"Optimales Modell einsetzen"]})})]}),ne.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>I(X=>({...X,[_.role]:!se})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[se?n.jsx(ch,{className:"h-3 w-3"}):n.jsx(ah,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",ne.length,")"]})]}),se&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:ne.map(X=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:X.name,children:X.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",X.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:X.fit.text})]})]}),n.jsx("button",{onClick:()=>C(X.repo,_.role,X.quant||"Q4_K_M",X.caps.tools!=="no"),disabled:!!k[X.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:k[X.repo]||"Installieren"})]},X.repo))})]})]},_.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>S(!O),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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_i,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:O?"Ausblenden ▲":"Anzeigen ▼"})]}),O&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(N0,{})})]})]})}function E0(){const[o,d]=p.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.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=>n.jsx("button",{onClick:()=>d(a),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",o===a?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:a==="cockpit"?"Cockpit":"Modelle finden"},a))})]}),n.jsx(b0,{}),n.jsx("div",{className:"transition-all duration-300",children:o==="cockpit"?n.jsx(k0,{}):n.jsx(C0,{})})]})}function kr(o){return(o/1024**3).toFixed(1)}function qo({label:o,percent:d,detail:a,icon:c}){const f=d>90?"bg-red-500 shadow-md shadow-red-500/20":d>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:o})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(d),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:ee("h-full transition-all duration-700 ease-out",f),style:{width:`${Math.min(d,100)}%`}})}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function _0(){const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState(""),[h,x]=p.useState(""),[E,b]=p.useState({}),[k,M]=p.useState(null);function A(C,_,L){M({type:"alert",title:C,message:_,onConfirm:()=>{M(null)}})}function I(){fe("/api/system/status").then(d).catch(C=>m(String(C))),fe("/api/system/services").then(c).catch(()=>{})}p.useEffect(()=>{I();const C=setInterval(I,3e3);return()=>clearInterval(C)},[]);async function O(){x("Backup snapshotted...");try{const C=await fe("/api/system/backup",{method:"POST"});x(C.ok?`Snapshot erzeugt: ${C.snapshot} (${C.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(C){x(`Fehler: ${C.message}`)}}async function S(C){b(_=>({..._,[C]:!0}));try{const _=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:C})});_.ok?A("Erfolgreich",`Dienst ${C} wurde erfolgreich neu gestartet.`):A("Fehler beim Neustart",`Fehler beim Neustart: ${_.err||"Unbekannter Fehler"}`)}catch(_){A("Fehler",`Fehler: ${_.message}`)}finally{b(_=>({..._,[C]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.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,")."]}),o&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(qo,{label:"CPU",percent:o.cpu.percent,detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0,icon:gt}),n.jsx(qo,{label:"RAM",percent:o.ram.percent,detail:`${kr(o.ram.used)} / ${kr(o.ram.total)} GB`,icon:Xo}),o.gpu&&o.gpu.busy_percent!=null&&n.jsx(qo,{label:"GPU",percent:o.gpu.busy_percent,detail:o.gpu.gtt_used!=null&&o.gpu.gtt_total?`${kr(o.gpu.gtt_used)} / ${kr(o.gpu.gtt_total)} GB (GTT/unified)`:o.gpu.vram_used!=null&&o.gpu.vram_total?`${kr(o.gpu.vram_used)} / ${kr(o.gpu.vram_total)} GB VRAM`:void 0,icon:gt}),o.disk&&n.jsx(qo,{label:"Disk",percent:o.disk.percent,detail:`${kr(o.disk.used)} / ${kr(o.disk.total)} GB`,icon:gi})]}),o.temp&&(o.temp.cpu||o.temp.gpu)&&n.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:[o.temp.cpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.cpu," °C"]})]}),o.temp.cpu!=null&&o.temp.gpu!=null&&n.jsx("span",{children:"|"}),o.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.gpu," °C"]})]})]})]}),a&&n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.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"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.services.map(C=>n.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:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",C.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:C.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:C.url})]})]}),n.jsx("button",{onClick:()=>S(C.name),disabled:E[C.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:n.jsx(Br,{className:ee("h-3.5 w-3.5",E[C.name]&&"animate-spin")})})]},C.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Ms(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:[n.jsx(el,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Ms(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:[n.jsx(el,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.jsxs("button",{onClick:O,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:[n.jsx(kh,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),h&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:h}),k&&n.jsx(Qr,{type:k.type,title:k.title,message:k.message,onConfirm:k.onConfirm,onCancel:k.onCancel})]})}function P0(){const[o,d]=p.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[a,c]=p.useState(localStorage.getItem("mc_mcp_path")||""),[f,m]=p.useState(null),[h,x]=p.useState("cline"),[E,b]=p.useState(!1),[k,M]=p.useState("");p.useEffect(()=>{const C=new URLSearchParams;C.set("host",o),a&&C.set("mcp_path",a),fe(`/api/connect?${C}`).then(m).catch(_=>M(String(_)))},[o,a]);function A(C){d(C),C&&localStorage.setItem("mc_host",C)}function I(C){c(C),localStorage.setItem("mc_mcp_path",C)}const O=f==null?void 0:f.tools[h];async function S(){O&&(await navigator.clipboard.writeText(O.snippet),b(!0),setTimeout(()=>b(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.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:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(gh,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:o,onChange:C=>A(C.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"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(xh,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:a,onChange:C=>I(C.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"})]})]}),k&&n.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: ",k]}),f&&n.jsxs("div",{className:"space-y-4",children:[n.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(f.tools).map(([C,_])=>n.jsx("button",{onClick:()=>x(C),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",h===C?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:_.label},C))}),O&&n.jsxs("div",{className:"space-y-3",children:[O.note&&n.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:[n.jsx(vh,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:O.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.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:[n.jsx(tl,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:h==="cline"||h==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:S,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:[E?n.jsx(zn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(lf,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:E?"Kopiert":"Kopieren"})]})]}),n.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:n.jsx("code",{children:O.snippet})})]})]})]})]})}const Xu=["user","instruction","stable","versioned","ephemeral"],fi={user:{label:"User",icon:Mh,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:Nh,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Wr,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:_h,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:fh,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},ef={label:"Gedächtnis",icon:of,bg:"bg-muted/10",text:"text-muted-foreground"},M0={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 R0(){const[o,d]=p.useState([]),[a,c]=p.useState(""),[f,m]=p.useState(""),[h,x]=p.useState(""),[E,b]=p.useState("stable"),[k,M]=p.useState(""),[A,I]=p.useState(!1),[O,S]=p.useState(null);function C(T,F,ne){S({type:"alert",title:T,message:F,onConfirm:()=>{S(null)}})}function _(T,F,ne){S({type:"confirm",title:T,message:F,onConfirm:()=>{S(null),ne()},onCancel:()=>S(null)})}function L(){const T=new URLSearchParams;f&&T.set("q",f),a&&T.set("category",a),fe(`/api/memory?${T}`).then(d).catch(F=>M(String(F)))}p.useEffect(L,[f,a]);async function Z(){h.trim()&&(await fe("/api/memory",{method:"POST",body:JSON.stringify({content:h,category:E,source:"ui"})}),x(""),L())}async function Y(T){await fe(`/api/memory/${T}`,{method:"DELETE"}),L()}async function H(){I(!0);try{const T=await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(T.duplicate_count===0){C("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}_("Deduplizierung bestätigen",`${T.duplicate_count} Dublette(n) in ${T.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),L()}catch(F){C("Fehler",`Fehler beim Löschen: ${F.message}`)}})}catch(T){C("Fehler",`Fehler bei der Deduplizierung: ${T.message}`)}finally{I(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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)"}),n.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."})]}),n.jsxs("button",{onClick:H,disabled:A,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:[n.jsx(Eh,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:h,onChange:T=>x(T.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"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:E,onChange:T=>b(T.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:Xu.map(T=>{var F;return n.jsx("option",{value:T,className:"bg-popover text-foreground",children:((F=fi[T])==null?void 0:F.label)||T},T)})})]}),n.jsxs("button",{onClick:Z,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:[n.jsx(af,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:f,onChange:T=>m(T.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"}),n.jsx(_i,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.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:[n.jsx("button",{onClick:()=>c(""),className:ee("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",a?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Xu.map(T=>{const F=fi[T]||ef,ne=F.icon;return n.jsxs("button",{onClick:()=>c(T),className:ee("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",a===T?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{children:F.label})]},T)})]})]}),k&&n.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: ",k]}),n.jsx("div",{className:"space-y-3",children:o.length===0?n.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."}):o.map(T=>{const F=fi[T.category]||ef,ne=F.icon;return n.jsxs("div",{className:ee("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",M0[T.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:ee("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",F.bg,F.text),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:F.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:T.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.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:T.source}),n.jsx("button",{onClick:()=>Y(T.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]},T.id)})}),O&&n.jsx(Qr,{type:O.type,title:O.title,message:O.message,onConfirm:O.onConfirm,onCancel:O.onCancel})]})}function Zo({label:o,ok:d,detail:a,icon:c,onClick:f}){return n.jsxs("div",{onClick:f,className:ee("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",d?"border-border/60":"border-amber-500/30",f&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:o}),n.jsx(c,{className:ee("h-4.5 w-4.5",d?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full ring-2 ring-black/40",d?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:d?"Bereit / Online":"Offline / Inaktiv"})]}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:a,children:a})]}),f&&n.jsxs("button",{onClick:m=>{m.stopPropagation(),f()},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:[n.jsx(gt,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function z0(){const[o,d]=p.useState(null),[a,c]=p.useState(""),[f,m]=p.useState(null),[h,x]=p.useState(!1),[E,b]=p.useState([]),[k,M]=p.useState(null);function A(F,ne,se){M({type:"alert",title:F,message:ne,onConfirm:se})}const[I,O]=p.useState({width:800,height:360}),S=p.useRef(null),C=p.useCallback(F=>{if(S.current&&(S.current.disconnect(),S.current=null),F){const ne=new ResizeObserver(se=>{if(!se||se.length===0)return;const X=se[0].contentRect;O({width:X.width,height:X.height})});ne.observe(F),S.current=ne}},[]),_=I.width,L=I.height,Z=(F,ne,se,X)=>{const ye=(F+se)/2;return`M ${F} ${ne} C ${ye} ${ne}, ${ye} ${X}, ${se} ${X}`};function Y(){fe("/api/agent/status").then(d).catch(F=>c(String(F)))}function H(){fe("/api/models").then(F=>{const ne=F.models.map(se=>{var X;return((X=se.name.split("/").pop())==null?void 0:X.replace(".gguf",""))||se.name});b(["auto","fast","heavy",...ne])}).catch(F=>console.error("Error loading models",F))}async function T(F){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:F})}),A("Erfolgreich",`Hermes-Gehirn wurde auf '${F}' geändert. Der Gateway-Dienst wurde neu gestartet.`),Y(),x(!1)}catch(ne){A("Fehler",`Fehler beim Wechseln des Gehirns: ${ne.message}`)}}return p.useEffect(()=>{Y(),H();const F=setInterval(Y,5e3);return()=>clearInterval(F)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` + `}),n.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:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",Br(pt)," / ",Br(Tn)," geladen"]}),a.length>0&&n.jsx("button",{onClick:pe,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"})]})]}),n.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:ft.length===0?n.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"}):ft.map((R,re)=>{var De;const ye=(R.size_bytes||0)/Tn*100,Ce=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][re%4];return n.jsxs("div",{style:{width:`${ye}%`},className:ee("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",Ce),title:`${R.name} (${Br(R.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[R.role?`[${R.role}] `:"",(De=R.name.split("/").pop())==null?void 0:De.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Br(R.size_bytes)})]},R.name)})})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.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."})]}),n.jsxs("div",{ref:ae,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:v(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="roocode"||A==="roocode")&&n.jsx("path",{d:v(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="cursor"||A==="cursor")&&n.jsx("path",{d:v(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="opencode"||A==="opencode")&&n.jsx("path",{d:v(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="zed"||A==="zed")&&n.jsx("path",{d:v(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="continue"||A==="continue")&&n.jsx("path",{d:v(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("fast")&&n.jsx("path",{d:V(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("heavy")&&n.jsx("path",{d:V(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("coder")&&n.jsx("path",{d:V(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("vision")&&n.jsx("path",{d:V(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("scout")&&n.jsx("path",{d:V(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>G("roocode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.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:()=>G("cursor"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.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:()=>G("opencode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.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:()=>G("zed"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.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:()=>G("continue"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.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:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",f!=null&&f.heavy_threshold_chars?f.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.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"})]}),j0.map(R=>{var Ct;const re=["12%","31%","50%","69%","88%"],ye=Zr(R),Ce=ye?a.includes(ye.name):!1;if(R==="reasoning"||R==="agent")return null;const De={fast:0,heavy:1,coder:2,vision:3,scout:4}[R];return n.jsxs("div",{className:ee("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",Ce?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ye?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:re[De]},onClick:()=>E(R),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:R}),Ce&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ye?(Ct=ye.name.split("/").pop())==null?void 0:Ct.replace(".gguf",""):"Keine Zuweisung"})]},R)}),A&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[A==="roocode"&&"Roo Code Setup",A==="cursor"&&"Cursor Setup",A==="opencode"&&"OpenCode Setup",A==="zed"&&"Zed Setup",A==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[A==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),A==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),A==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),A==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),A==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),h.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var R,re,ye,Ce,De;return Xe(A==="roocode"?(R=h.tools.cline)==null?void 0:R.snippet:A==="cursor"?(re=h.tools.cursor)==null?void 0:re.snippet:A==="opencode"?(ye=h.tools.opencode)==null?void 0:ye.snippet:A==="zed"?(Ce=h.tools.zed)==null?void 0:Ce.snippet:(De=h.tools.continue)==null?void 0:De.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[D?n.jsx(Dn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(lf,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:D?"Kopiert":"Kopieren"})]})]}),n.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:n.jsxs("code",{children:[A==="roocode"&&((Yr=h.tools.cline)==null?void 0:Yr.snippet),A==="cursor"&&((rr=h.tools.cursor)==null?void 0:rr.snippet),A==="opencode"&&((Bt=h.tools.opencode)==null?void 0:Bt.snippet),A==="zed"&&((Jr=h.tools.zed)==null?void 0:Jr.snippet),A==="continue"&&((In=h.tools.continue)==null?void 0:In.snippet)]})})]}),n.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"})]})})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(R=>{var Ce;const re=o.find(De=>De.role===R),ye=re?a.includes(re.name):!1;return n.jsxs("div",{onClick:()=>E(R),className:ee("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]",ye?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":re?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:ee("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",R==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":R==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":R==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":R==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":R==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:R}),ye&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:re==null?void 0:re.name,children:re?(Ce=re.name.split("/").pop())==null?void 0:Ce.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},R)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Re.length," von ",o.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>se("all"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>se("in_use"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>$("grid"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>$("list"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),I==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Re.length===0?n.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:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=C==null?void 0:C.model_list.find(De=>De.role===R.role),Ce=Ju(R.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45 shadow-primary/5":R.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:ee("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ce.color),title:Ce.name,children:Ce.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:R.name,children:R.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.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:R.quant||"GGUF"}),re&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(Xo,{className:"h-3 w-3 animate-pulse"})," Warm"]}),R.role&&n.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:R.role}),R.prompt_cache&&n.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"}),R.spec_draft_model&&n.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: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.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:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(gi,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:Br(R.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(wh,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:Yu(R.ctx)})]})]})]}),ye&&n.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:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",ye.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>ge(ye.repo,R.role,R.quant||"Q4_K_M",R.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:[n.jsx(Wr,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.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"}),n.jsx("button",{onClick:()=>O(R.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})}):n.jsx("div",{className:"space-y-2",children:Re.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=Ju(R.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45":R.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:ee("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ye.color),title:ye.name,children:ye.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:R.name,children:R.name.split("/").pop()}),R.role&&n.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:R.role}),R.prompt_cache&&n.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"}),R.spec_draft_model&&n.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: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.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:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]}),re&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",Br(R.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",Yu(R.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:R.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.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"}),n.jsx("button",{onClick:()=>O(R.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})})]}),S&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",S,"' konfigurieren"]}),n.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:S}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{me(S,""),E(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:n.jsx("span",{children:"Zuweisung entfernen"})}),o.map(R=>{var re;return n.jsxs("button",{onClick:()=>{me(S,R.name),E(null)},className:ee("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",R.role===S?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(re=R.name.split("/").pop())==null?void 0:re.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[Br(R.size_bytes)," · ",R.quant]})]}),R.role===S&&n.jsx(Dn,{className:"h-4 w-4 shrink-0 text-primary"})]},R.name)})]})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,defaultValue:X.defaultValue,onConfirm:X.onConfirm,onCancel:X.onCancel})]})}function N0(){const[o,d]=p.useState(""),[a,c]=p.useState([]),[f,m]=p.useState("Q4_K_M"),[h,x]=p.useState(""),[C,b]=p.useState(""),[j,P]=p.useState([]);async function L(N){const S=N??o;if(S.trim()){x("Analysiere HuggingFace Repository...");try{const E=await fe(`/api/hf/quants?repo=${encodeURIComponent(S)}`);d(E.repo),c(E.quants),E.quants.length&&m(E.quants.includes("Q4_K_M")?"Q4_K_M":E.quants[0]),x(E.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(E){x(`Fehler: ${E}`)}}}async function F(){if(C.trim()){x("Durchsuche HuggingFace...");try{const N=await fe(`/api/hf/search?q=${encodeURIComponent(C)}`);P(N.results),x(N.results.length?"":"Keine Ergebnisse gefunden.")}catch(N){x(`Suche fehlgeschlagen: ${N}`)}}}async function A(){if(o.trim()){x("Download-Job wird initiiert...");try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:o,quant:f,jinja:!0})}),x(`Download gestartet: ${o} (${f}). Fortschritt wird oben angezeigt.`)}catch(N){x(`Download-Fehler: ${N}`)}}}return n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:o,onChange:N=>d(N.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"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>L(),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&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:f,onChange:N=>m(N.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(N=>n.jsx("option",{value:N,className:"bg-popover text-foreground",children:N},N))}),n.jsxs("button",{onClick:A,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:[n.jsx(Wr,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:C,onChange:N=>b(N.target.value),onKeyDown:N=>N.key==="Enter"&&F(),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"}),n.jsx(_i,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:F,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"})]}),j.length>0&&n.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:j.map(N=>n.jsxs("button",{onClick:()=>{d(N.repo),P([]),b(""),L(N.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:[n.jsx("span",{className:"font-semibold truncate",children:N.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(Wr,{className:"h-3 w-3"})," ",N.downloads.toLocaleString()]})]},N.repo))}),h&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:h})]})}const S0={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:xi},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:mi},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Cs},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Ss},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:hi}};function C0(){const[o,d]=p.useState(null),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(""),[C,b]=p.useState(!0),[j,P]=p.useState({}),[L,F]=p.useState({}),[A,N]=p.useState(!1);p.useEffect(()=>{Promise.all([fe("/api/discover"),fe("/api/models"),fe("/api/maintenance/updates").catch(()=>null)]).then(([E,D,Z])=>{d(E),c(D.models||[]),Z&&m(Z)}).catch(E=>x(String(E))).finally(()=>b(!1))},[]);async function S(E,D,Z,Y){P(G=>({...G,[E]:"Starte..."}));try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:E,role:D,quant:Z,jinja:Y})}),P(G=>({...G,[E]:"Download läuft"}))}catch{P(I=>({...I,[E]:"Fehler"}))}}return C?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):h||!o?n.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 (",h,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.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:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(cf,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:o.categories.map(E=>{const D=S0[E.role]||{title:E.title||E.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:Es},Z=D.icon,Y=a.find(X=>X.role===E.role),G=f==null?void 0:f.model_list.find(X=>X.role===E.role),I=E.models.find(X=>X.repo===E.recommended)||E.models[0];if(!I)return null;const $=j[I.repo],ne=E.models.filter(X=>X.repo!==E.recommended),se=!!L[E.role];return n.jsxs("div",{className:ee("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",Y?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.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:n.jsx(Z,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:D.title}),n.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: ",E.role]})]})]}),Y?n.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:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.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"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:D.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:Y?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:Y.name,children:Y.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",Si(Y.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",Y.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:I.name,children:I.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",I.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",I.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(w0,{fit:I.fit})})]})}),n.jsx("div",{className:"pt-1",children:Y?G?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",G.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>S(G.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!j[G.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:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),j[G.repo]||"Auf neue Version aktualisieren"]})]}):n.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:[n.jsx(Dn,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>S(I.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!$,className:ee("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",$?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),$||"Optimales Modell einsetzen"]})})]}),ne.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>F(X=>({...X,[E.role]:!se})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[se?n.jsx(ch,{className:"h-3 w-3"}):n.jsx(ah,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",ne.length,")"]})]}),se&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:ne.map(X=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:X.name,children:X.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",X.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:X.fit.text})]})]}),n.jsx("button",{onClick:()=>S(X.repo,E.role,X.quant||"Q4_K_M",X.caps.tools!=="no"),disabled:!!j[X.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:j[X.repo]||"Installieren"})]},X.repo))})]})]},E.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>N(!A),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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_i,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:A?"Ausblenden ▲":"Anzeigen ▼"})]}),A&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(N0,{})})]})]})}function E0(){const[o,d]=p.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.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=>n.jsx("button",{onClick:()=>d(a),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",o===a?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:a==="cockpit"?"Cockpit":"Modelle finden"},a))})]}),n.jsx(b0,{}),n.jsx("div",{className:"transition-all duration-300",children:o==="cockpit"?n.jsx(k0,{}):n.jsx(C0,{})})]})}function Nr(o){return(o/1024**3).toFixed(1)}function qo({label:o,percent:d,detail:a,icon:c}){const f=d>90?"bg-red-500 shadow-md shadow-red-500/20":d>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:o})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(d),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:ee("h-full transition-all duration-700 ease-out",f),style:{width:`${Math.min(d,100)}%`}})}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function _0(){const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState(""),[h,x]=p.useState(""),[C,b]=p.useState({}),[j,P]=p.useState(null);function L(S,E,D){P({type:"alert",title:S,message:E,onConfirm:()=>{P(null)}})}function F(){fe("/api/system/status").then(d).catch(S=>m(String(S))),fe("/api/system/services").then(c).catch(()=>{})}p.useEffect(()=>{F();const S=setInterval(F,3e3);return()=>clearInterval(S)},[]);async function A(){x("Backup snapshotted...");try{const S=await fe("/api/system/backup",{method:"POST"});x(S.ok?`Snapshot erzeugt: ${S.snapshot} (${S.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(S){x(`Fehler: ${S.message}`)}}async function N(S){b(E=>({...E,[S]:!0}));try{const E=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:S})});E.ok?L("Erfolgreich",`Dienst ${S} wurde erfolgreich neu gestartet.`):L("Fehler beim Neustart",`Fehler beim Neustart: ${E.err||"Unbekannter Fehler"}`)}catch(E){L("Fehler",`Fehler: ${E.message}`)}finally{b(E=>({...E,[S]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.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,")."]}),o&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(qo,{label:"CPU",percent:o.cpu.percent,detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0,icon:yt}),n.jsx(qo,{label:"RAM",percent:o.ram.percent,detail:`${Nr(o.ram.used)} / ${Nr(o.ram.total)} GB`,icon:Xo}),o.gpu&&o.gpu.busy_percent!=null&&n.jsx(qo,{label:"GPU",percent:o.gpu.busy_percent,detail:o.gpu.gtt_used!=null&&o.gpu.gtt_total?`${Nr(o.gpu.gtt_used)} / ${Nr(o.gpu.gtt_total)} GB (GTT/unified)`:o.gpu.vram_used!=null&&o.gpu.vram_total?`${Nr(o.gpu.vram_used)} / ${Nr(o.gpu.vram_total)} GB VRAM`:void 0,icon:yt}),o.disk&&n.jsx(qo,{label:"Disk",percent:o.disk.percent,detail:`${Nr(o.disk.used)} / ${Nr(o.disk.total)} GB`,icon:gi})]}),o.temp&&(o.temp.cpu||o.temp.gpu)&&n.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:[o.temp.cpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.cpu," °C"]})]}),o.temp.cpu!=null&&o.temp.gpu!=null&&n.jsx("span",{children:"|"}),o.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.gpu," °C"]})]})]})]}),a&&n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.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"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.services.map(S=>n.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:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",S.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:S.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:S.url})]})]}),n.jsx("button",{onClick:()=>N(S.name),disabled:C[S.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:n.jsx(Vr,{className:ee("h-3.5 w-3.5",C[S.name]&&"animate-spin")})})]},S.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Ms(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:[n.jsx(el,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Ms(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:[n.jsx(el,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.jsxs("button",{onClick:A,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:[n.jsx(kh,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),h&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:h}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:j.onConfirm,onCancel:j.onCancel})]})}function P0(){const[o,d]=p.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[a,c]=p.useState(localStorage.getItem("mc_mcp_path")||""),[f,m]=p.useState(null),[h,x]=p.useState("cline"),[C,b]=p.useState(!1),[j,P]=p.useState("");p.useEffect(()=>{const S=new URLSearchParams;S.set("host",o),a&&S.set("mcp_path",a),fe(`/api/connect?${S}`).then(m).catch(E=>P(String(E)))},[o,a]);function L(S){d(S),S&&localStorage.setItem("mc_host",S)}function F(S){c(S),localStorage.setItem("mc_mcp_path",S)}const A=f==null?void 0:f.tools[h];async function N(){A&&(await navigator.clipboard.writeText(A.snippet),b(!0),setTimeout(()=>b(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.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:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(gh,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:o,onChange:S=>L(S.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"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(xh,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:a,onChange:S=>F(S.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"})]})]}),j&&n.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: ",j]}),f&&n.jsxs("div",{className:"space-y-4",children:[n.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(f.tools).map(([S,E])=>n.jsx("button",{onClick:()=>x(S),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",h===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:E.label},S))}),A&&n.jsxs("div",{className:"space-y-3",children:[A.note&&n.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:[n.jsx(vh,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:A.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.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:[n.jsx(tl,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:h==="cline"||h==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:N,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:[C?n.jsx(Dn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(lf,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:C?"Kopiert":"Kopieren"})]})]}),n.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:n.jsx("code",{children:A.snippet})})]})]})]})]})}const Xu=["user","instruction","stable","versioned","ephemeral"],fi={user:{label:"User",icon:Mh,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:Nh,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Hr,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:_h,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:fh,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},ef={label:"Gedächtnis",icon:of,bg:"bg-muted/10",text:"text-muted-foreground"},M0={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 R0(){const[o,d]=p.useState([]),[a,c]=p.useState(""),[f,m]=p.useState(""),[h,x]=p.useState(""),[C,b]=p.useState("stable"),[j,P]=p.useState(""),[L,F]=p.useState(!1),[A,N]=p.useState(null);function S(I,$,ne){N({type:"alert",title:I,message:$,onConfirm:()=>{N(null)}})}function E(I,$,ne){N({type:"confirm",title:I,message:$,onConfirm:()=>{N(null),ne()},onCancel:()=>N(null)})}function D(){const I=new URLSearchParams;f&&I.set("q",f),a&&I.set("category",a),fe(`/api/memory?${I}`).then(d).catch($=>P(String($)))}p.useEffect(D,[f,a]);async function Z(){h.trim()&&(await fe("/api/memory",{method:"POST",body:JSON.stringify({content:h,category:C,source:"ui"})}),x(""),D())}async function Y(I){await fe(`/api/memory/${I}`,{method:"DELETE"}),D()}async function G(){F(!0);try{const I=await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(I.duplicate_count===0){S("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${I.duplicate_count} Dublette(n) in ${I.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),D()}catch($){S("Fehler",`Fehler beim Löschen: ${$.message}`)}})}catch(I){S("Fehler",`Fehler bei der Deduplizierung: ${I.message}`)}finally{F(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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)"}),n.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."})]}),n.jsxs("button",{onClick:G,disabled:L,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:[n.jsx(Eh,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:h,onChange:I=>x(I.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"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:C,onChange:I=>b(I.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:Xu.map(I=>{var $;return n.jsx("option",{value:I,className:"bg-popover text-foreground",children:(($=fi[I])==null?void 0:$.label)||I},I)})})]}),n.jsxs("button",{onClick:Z,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:[n.jsx(af,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:f,onChange:I=>m(I.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"}),n.jsx(_i,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.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:[n.jsx("button",{onClick:()=>c(""),className:ee("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",a?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Xu.map(I=>{const $=fi[I]||ef,ne=$.icon;return n.jsxs("button",{onClick:()=>c(I),className:ee("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",a===I?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{children:$.label})]},I)})]})]}),j&&n.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: ",j]}),n.jsx("div",{className:"space-y-3",children:o.length===0?n.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."}):o.map(I=>{const $=fi[I.category]||ef,ne=$.icon;return n.jsxs("div",{className:ee("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",M0[I.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:ee("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",$.bg,$.text),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:$.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:I.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.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:I.source}),n.jsx("button",{onClick:()=>Y(I.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]},I.id)})}),A&&n.jsx(qr,{type:A.type,title:A.title,message:A.message,onConfirm:A.onConfirm,onCancel:A.onCancel})]})}function Zo({label:o,ok:d,detail:a,icon:c,onClick:f}){return n.jsxs("div",{onClick:f,className:ee("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",d?"border-border/60":"border-amber-500/30",f&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:o}),n.jsx(c,{className:ee("h-4.5 w-4.5",d?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full ring-2 ring-black/40",d?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:d?"Bereit / Online":"Offline / Inaktiv"})]}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:a,children:a})]}),f&&n.jsxs("button",{onClick:m=>{m.stopPropagation(),f()},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:[n.jsx(yt,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function z0(){const[o,d]=p.useState(null),[a,c]=p.useState(""),[f,m]=p.useState(null),[h,x]=p.useState(!1),[C,b]=p.useState([]),[j,P]=p.useState(null);function L($,ne,se){P({type:"alert",title:$,message:ne,onConfirm:se})}const[F,A]=p.useState({width:800,height:360}),N=p.useRef(null),S=p.useCallback($=>{if(N.current&&(N.current.disconnect(),N.current=null),$){const ne=new ResizeObserver(se=>{if(!se||se.length===0)return;const X=se[0].contentRect;A({width:X.width,height:X.height})});ne.observe($),N.current=ne}},[]),E=F.width,D=F.height,Z=($,ne,se,X)=>{const be=($+se)/2;return`M ${$} ${ne} C ${be} ${ne}, ${be} ${X}, ${se} ${X}`};function Y(){fe("/api/agent/status").then(d).catch($=>c(String($)))}function G(){fe("/api/models").then($=>{const ne=$.models.map(se=>{var X;return((X=se.name.split("/").pop())==null?void 0:X.replace(".gguf",""))||se.name});b(["auto","fast","heavy",...ne])}).catch($=>console.error("Error loading models",$))}async function I($){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:$})}),L("Erfolgreich",`Hermes-Gehirn wurde auf '${$}' geändert. Der Gateway-Dienst wurde neu gestartet.`),Y(),x(!1)}catch(ne){L("Fehler",`Fehler beim Wechseln des Gehirns: ${ne.message}`)}}return p.useEffect(()=>{Y(),G();const $=setInterval(Y,5e3);return()=>clearInterval($)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -372,9 +372,9 @@ Error generating stack: `+i.message+` stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(o==null?void 0:o.webui_url)&&n.jsxs("a",{href:Ms(o.webui_url),target:"_blank",rel:"noopener",className:ee("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",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[n.jsx(el,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),a&&n.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 (",a,")."]}),o&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(Zo,{label:"Agent Gateway",ok:o.gateway_reachable,detail:"Port :8642 (REST API)",icon:Ss}),n.jsx(Zo,{label:"Agent WebUI",ok:o.webui_reachable,detail:"Port :8787 (Chat UI)",icon:Xo}),n.jsx(Zo,{label:"Aktives Gehirn",ok:o.gateway_reachable,detail:o.brain_model?`Model: ${o.brain_model}`:"Model: auto",icon:gt,onClick:()=>x(!0)}),n.jsx(Zo,{label:"Verdrahtung",ok:o.has_config,detail:`Config: ${o.has_config?"✓":"—"} · Skills: ${o.has_skills?"✓":"—"} · Memory: ${o.has_memories?"✓":"—"}`,icon:rl})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:C,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:Z(_*.15,L*.5,_*.5,L*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="webui"||o.webui_reachable)&&n.jsx("path",{d:Z(_*.15,L*.5,_*.5,L*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(_*.5,L*.5,_*.85,L*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="brain"||o.gateway_reachable)&&n.jsx("path",{d:Z(_*.5,L*.5,_*.85,L*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(_*.5,L*.5,_*.85,L*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="wiring"||o.gateway_reachable)&&n.jsx("path",{d:Z(_*.5,L*.5,_*.85,L*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>m("webui"),onMouseLeave:()=>m(null),onClick:()=>o.webui_reachable&&window.open(Ms(o.webui_url),"_blank"),title:o.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(Xo,{className:ee("h-3.5 w-3.5",o.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:ee("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",o.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.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:()=>m("gateway"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Ss,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:ee("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",o.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:o.gateway_reachable?"Online":"Offline"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("brain"),onMouseLeave:()=>m(null),onClick:()=>x(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(gt,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),o.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:o.brain_model,children:o.brain_model||"auto"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("wiring"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(rl,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),o.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",o.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",o.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",o.has_memories?"✓":"—"]})]})]})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Wr,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!o.gateway_reachable&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Wr,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.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"}),"."]})]})]})]}),o&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(gt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>x(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Hr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:E.map(F=>{const ne=["auto","fast","heavy"].includes(F);return n.jsxs("button",{onClick:()=>T(F),className:ee("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===F||!o.brain_model&&F==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:F}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ne?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===F||!o.brain_model&&F==="auto")&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},F)})})]})}),k&&n.jsx(Qr,{type:k.type,title:k.title,message:k.message,onConfirm:()=>k.onConfirm&&k.onConfirm(),onCancel:k.onCancel})]})}function D0(){const[o,d]=p.useState("connect"),[a,c]=p.useState("roocode"),[f,m]=p.useState(null),h="192.168.178.151",[x,E]=p.useState(!1),[b,k]=p.useState(null);function M(){E(!0),fe("/api/health").then(A=>{m(A),k(A.engine_reachable?"success":"partial")}).catch(()=>{m(null),k("fail")}).finally(()=>E(!1))}return p.useEffect(()=>{M()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>d("connect"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),n.jsx("button",{onClick:()=>d("concepts"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),o==="connect"?n.jsxs(n.Fragment,{children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:ee("h-3 w-3 rounded-full ring-2 ring-black/40",b==="success"&&"bg-emerald-500 animate-pulse",b==="partial"&&"bg-amber-500",b==="fail"&&"bg-red-500",!b&&"bg-muted")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[b==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(f==null?void 0:f.version)||""}).`,b==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",b==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!b&&"Verbindung wird geprüft..."]})]})]}),n.jsxs("button",{onClick:M,disabled:x,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:[n.jsx(Br,{className:ee("h-3.5 w-3.5",x&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(of,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(gt,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.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."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Es,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Cs,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.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."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(mi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>c("roocode"),className:ee("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:[n.jsx(cf,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>c("cursor"),className:ee("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"}),n.jsx("button",{onClick:()=>c("opencode"),className:ee("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"})]}),n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),a==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.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.'})]})]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(tl,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.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:[n.jsx(hi,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.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."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Es,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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 ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(hi,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Cs,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.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:`--- + `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(o==null?void 0:o.webui_url)&&n.jsxs("a",{href:Ms(o.webui_url),target:"_blank",rel:"noopener",className:ee("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",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[n.jsx(el,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),a&&n.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 (",a,")."]}),o&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(Zo,{label:"Agent Gateway",ok:o.gateway_reachable,detail:"Port :8642 (REST API)",icon:Ss}),n.jsx(Zo,{label:"Agent WebUI",ok:o.webui_reachable,detail:"Port :8787 (Chat UI)",icon:Xo}),n.jsx(Zo,{label:"Aktives Gehirn",ok:o.gateway_reachable,detail:o.brain_model?`Model: ${o.brain_model}`:"Model: auto",icon:yt,onClick:()=>x(!0)}),n.jsx(Zo,{label:"Verdrahtung",ok:o.has_config,detail:`Config: ${o.has_config?"✓":"—"} · Skills: ${o.has_skills?"✓":"—"} · Memory: ${o.has_memories?"✓":"—"}`,icon:rl})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="webui"||o.webui_reachable)&&n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="brain"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="wiring"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>m("webui"),onMouseLeave:()=>m(null),onClick:()=>o.webui_reachable&&window.open(Ms(o.webui_url),"_blank"),title:o.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(Xo,{className:ee("h-3.5 w-3.5",o.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:ee("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",o.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.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:()=>m("gateway"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Ss,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:ee("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",o.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:o.gateway_reachable?"Online":"Offline"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("brain"),onMouseLeave:()=>m(null),onClick:()=>x(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(yt,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),o.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:o.brain_model,children:o.brain_model||"auto"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("wiring"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(rl,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),o.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",o.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",o.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",o.has_memories?"✓":"—"]})]})]})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!o.gateway_reachable&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.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"}),"."]})]})]})]}),o&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(yt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>x(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:C.map($=>{const ne=["auto","fast","heavy"].includes($);return n.jsxs("button",{onClick:()=>I($),className:ee("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===$||!o.brain_model&&$==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:$}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ne?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===$||!o.brain_model&&$==="auto")&&n.jsx(Dn,{className:"h-4 w-4 shrink-0 text-primary"})]},$)})})]})}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:()=>j.onConfirm&&j.onConfirm(),onCancel:j.onCancel})]})}function D0(){const[o,d]=p.useState("connect"),[a,c]=p.useState("roocode"),[f,m]=p.useState(null),h="192.168.178.151",[x,C]=p.useState(!1),[b,j]=p.useState(null);function P(){C(!0),fe("/api/health").then(L=>{m(L),j(L.engine_reachable?"success":"partial")}).catch(()=>{m(null),j("fail")}).finally(()=>C(!1))}return p.useEffect(()=>{P()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>d("connect"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),n.jsx("button",{onClick:()=>d("concepts"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),o==="connect"?n.jsxs(n.Fragment,{children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:ee("h-3 w-3 rounded-full ring-2 ring-black/40",b==="success"&&"bg-emerald-500 animate-pulse",b==="partial"&&"bg-amber-500",b==="fail"&&"bg-red-500",!b&&"bg-muted")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[b==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(f==null?void 0:f.version)||""}).`,b==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",b==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!b&&"Verbindung wird geprüft..."]})]})]}),n.jsxs("button",{onClick:P,disabled:x,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:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",x&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(of,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(yt,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.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."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Es,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Cs,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.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."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(mi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>c("roocode"),className:ee("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:[n.jsx(cf,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>c("cursor"),className:ee("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"}),n.jsx("button",{onClick:()=>c("opencode"),className:ee("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"})]}),n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),a==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.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.'})]})]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(tl,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.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:[n.jsx(hi,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.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."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Es,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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 ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(hi,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Cs,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.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 -...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.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:",n.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:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.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 ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(gt,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(rl,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(tl,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(mi,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(rl,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.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."})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Wr,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(_u,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(_u,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.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 L0({title:o,hint:d}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:o}),n.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}),n.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:[n.jsx(hh,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const A0=[{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 pi(o){return o==null?"":o>1024**3?`${(o/1024**3).toFixed(2)} GB`:`${(o/1024**2).toFixed(1)} MB`}function O0({open:o,onClose:d,defaultTab:a="maintenance"}){const[c,f]=p.useState(null),[m,h]=p.useState([]),[x,E]=p.useState("llama-swap"),[b,k]=p.useState(""),[M,A]=p.useState(!1),[I,O]=p.useState(null),[S,C]=p.useState({}),[_,L]=p.useState("maintenance"),[Z,Y]=p.useState(!1),[H,T]=p.useState(null);function F(w,Q,Le){T({type:"alert",title:w,message:Q,onConfirm:()=>{T(null),Le&&Le()}})}function ne(w,Q,Le){T({type:"confirm",title:w,message:Q,onConfirm:()=>{T(null),Le()},onCancel:()=>T(null)})}function se(w){return w?new Date(w*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[X,ye]=p.useState(""),[ce,Pe]=p.useState(""),[_e,Me]=p.useState(!1),[Ne,ke]=p.useState(!1);p.useEffect(()=>{o&&(ye(localStorage.getItem("mc_sudo_password")||""),Pe(localStorage.getItem("mc_hf_token")||""))},[o]),p.useEffect(()=>{o&&a&&L(a)},[o,a]);const W=p.useRef(null);function ae(){fe("/api/maintenance/updates").then(f).catch(w=>console.error("Error loading updates",w))}function G(){fe("/api/jobs").then(w=>h(w.jobs||[])).catch(w=>console.error("Error loading jobs",w))}function j(w){A(!0),O(null),fe(`/api/maintenance/logs?service=${w}&lines=150`).then(Q=>{Q.ok?k(Q.text):(k(`Fehler beim Laden der Logs: ${Q.err||"Unbekannter Fehler"}`),(Q.status==="incorrect_password"||Q.status==="password_required")&&O(Q.status))}).catch(Q=>k(`Fehler: ${Q.message}`)).finally(()=>{A(!1),setTimeout(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight)},50)})}p.useEffect(()=>{if(!o)return;ae(),G();const w=setInterval(()=>{G(),ae()},3e3);return()=>clearInterval(w)},[o]),p.useEffect(()=>{!o||_!=="logs"||j(x)},[o,_,x]);async function v(){try{await fe("/api/maintenance/os-update",{method:"POST"}),G(),L("maintenance")}catch(w){F("Fehler",`Fehler beim Starten des OS-Updates: ${w.message}`)}}async function B(){try{await fe("/api/maintenance/engine-update",{method:"POST"}),G(),L("maintenance")}catch(w){F("Fehler",`Fehler beim Engine-Update: ${w.message}`)}}async function J(){Y(!0);try{await fe("/api/maintenance/check-updates",{method:"POST"}),G(),L("maintenance")}catch(w){F("Fehler",`Fehler bei der Update-Suche: ${w.message}`)}finally{Y(!1)}}async function K(w,Q){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:w,role:Q})}),F("Gestartet",`Modell-Upgrade für '${Q}' (${w}) gestartet.`),G(),L("maintenance")}catch(Le){F("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Le.message}`)}}async function oe(){ne("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await fe("/api/maintenance/reboot",{method:"POST"}),F("Reboot","Reboot ausgelöst. System startet neu...",()=>{d()})}catch(w){F("Fehler",`Fehler beim Reboot: ${w.message}`)}})}async function pe(w){C(Q=>({...Q,[w]:!0}));try{const Q=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:w})});Q.ok?F("Dienst neu gestartet",`Dienst ${w} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&x===w&&j(w)}):F("Fehler",`Fehler beim Neustart: ${Q.err||"Unbekannter Fehler"}`)}catch(Q){F("Fehler",`Fehler beim Neustart: ${Q.message}`)}finally{C(Q=>({...Q,[w]:!1}))}}async function me(w){try{await fe(`/api/jobs/${w}/cancel`,{method:"POST"}),G()}catch(Q){F("Fehler",`Fehler beim Abbrechen: ${Q.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:ee("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",o?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:d}),n.jsxs("div",{className:ee("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",o?"translate-x-0":"translate-x-full"),children:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.jsx("button",{onClick:d,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:n.jsx(Hr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>L("maintenance"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>L("logs"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>L("settings"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",se(c.last_check)]}),n.jsxs("button",{onClick:J,disabled:Z,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Br,{className:ee("h-3 w-3",Z&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:v,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:[n.jsx(Wr,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:B,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:[n.jsx(Sh,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:oe,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:[n.jsx(df,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.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&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.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)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",se(c.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:c.model_list.map(w=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:w.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:w.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",w.role]})]}),n.jsxs("button",{onClick:()=>K(w.repo,w.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:[n.jsx(Vr,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},w.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[m.filter(w=>w.state==="running"||w.state==="queued").length," Aktiv"]})]}),n.jsx("div",{className:"space-y-3",children:m.length===0?n.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."}):m.map(w=>{const Q=w.state==="running"||w.state==="queued";return n.jsxs("div",{className:ee("p-3 rounded-xl border transition-all duration-300",Q?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Q&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),w.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",w.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:ee(w.state==="done"&&"text-emerald-400",w.state==="failed"&&"text-red-400",w.state==="running"&&"text-primary",w.state==="queued"&&"text-amber-400",w.state==="canceled"&&"text-muted-foreground"),children:w.state})]})]}),Q&&n.jsx("button",{onClick:()=>me(w.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"})]}),w.state==="running"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${w.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[w.progress??0,"%"]}),w.done_bytes!=null&&w.total_bytes!=null&&n.jsxs("span",{children:[pi(w.done_bytes)," / ",pi(w.total_bytes),w.rate_bps!=null&&` (${pi(w.rate_bps)}/s)`]}),w.eta_s!=null&&n.jsxs("span",{children:["ETA: ",w.eta_s,"s"]})]})]})]},w.id)})})]})]}),_==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:x,onChange:w=>E(w.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:A0.map(w=>n.jsxs("option",{value:w.id,children:[w.label," (",w.type==="system"?"systemd-root":"user",")"]},w.id))}),n.jsxs("button",{onClick:()=>pe(x),disabled:S[x],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:[n.jsx(Br,{className:ee("h-3.5 w-3.5",S[x]&&"animate-spin")}),"Restart"]})]}),n.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:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(tl,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",x]})]}),n.jsx("button",{onClick:()=>j(x),disabled:M,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Br,{className:ee("h-3 w-3",M&&"animate-spin")})})]}),n.jsx("pre",{ref:W,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:I==="password_required"||I==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(Ph,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:I==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",x," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>L("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"})]}):M&&!b?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):b||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(Wr,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:_e?"text":"password",value:X,onChange:w=>ye(w.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"}),n.jsx("button",{type:"button",onClick:()=>Me(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:_e?n.jsx(Pu,{className:"h-4 w-4"}):n.jsx(xi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(yh,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Ne?"text":"password",value:ce,onChange:w=>Pe(w.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"}),n.jsx("button",{type:"button",onClick:()=>ke(!Ne),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ne?n.jsx(Pu,{className:"h-4 w-4"}):n.jsx(xi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",X),localStorage.setItem("mc_hf_token",ce),F("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"}),n.jsx("button",{onClick:()=>{ye(""),Pe(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),F("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"})]})]})]})]}),H&&n.jsx(Qr,{type:H.type,title:H.title,message:H.message,onConfirm:H.onConfirm,onCancel:H.onCancel})]})}function T0(){var I,O,S,C,_;const[o,d]=p.useState("dashboard"),[a,c]=p.useState(null),[f,m]=p.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[h,x]=p.useState(null),[E,b]=p.useState(!1),[k,M]=p.useState("maintenance");p.useEffect(()=>{const L=()=>fe("/api/health").then(c).catch(()=>c(null));L();const Z=setInterval(L,1e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{const L=()=>fe("/api/system/status").then(x).catch(()=>{});L();const Z=setInterval(L,2e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{document.documentElement.classList.add("dark")},[]),p.useEffect(()=>{const L=Z=>{var H;M(((H=Z.detail)==null?void 0:H.tab)||"maintenance"),b(!0)};return window.addEventListener("open-system-drawer",L),()=>window.removeEventListener("open-system-drawer",L)},[]);const A=yi.find(L=>L.id===o);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.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]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Ig,{onNavigate:d}),n.jsx(O0,{open:E,onClose:()=>b(!1),defaultTab:k}),n.jsxs("aside",{className:ee("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",f?"w-16":"w-60"),children:[n.jsxs("div",{className:ee("flex items-center py-4 border-b border-border/40 shrink-0",f?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!f&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{m(L=>{const Z=!L;return localStorage.setItem("mc_sidebar_collapsed",Z.toString()),Z})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:f?"Maximieren":"Minimieren",children:f?n.jsx(dh,{className:"h-4 w-4"}):n.jsx(ih,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:yi.map(L=>n.jsxs("button",{onClick:()=>d(L.id),className:ee("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",f?"justify-center p-2.5":"gap-3 px-3 py-2",o===L.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:f?L.label:void 0,children:[n.jsx(L.icon,{className:"h-4.5 w-4.5 shrink-0"}),!f&&n.jsx("span",{className:"truncate",children:L.label})]},L.id))}),n.jsx("div",{className:ee("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",f?"px-2 text-center":"px-5"),children:f?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",a?a.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:a?`Engine ${a.engine_reachable?"online":"offline"}`:"Backend offline"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[a?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full animate-pulse",a.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",a.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(h==null?void 0:h.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.jsxs("div",{className:"truncate",title:h.versions.mc2?`${h.versions.mc2.branch}-${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""} (${h.versions.mc2.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"MC2:"})," ",h.versions.mc2?`${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((I=h.versions.engine)==null?void 0:I.type)==="git"?`${h.versions.engine.branch}-${h.versions.engine.hash}${h.versions.engine.dirty?"*":""} (${h.versions.engine.date})`:((O=h.versions.engine)==null?void 0:O.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((S=h.versions.engine)==null?void 0:S.type)==="git"?`${h.versions.engine.hash}${h.versions.engine.dirty?"*":""}`:((_=(C=h.versions.engine)==null?void 0:C.version_text)==null?void 0:_.split(" ").pop())||"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_ui?`${h.versions.hermes_ui.branch}-${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""} (${h.versions.hermes_ui.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes UI:"})," ",h.versions.hermes_ui?`${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_agent?`${h.versions.hermes_agent.branch}-${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""} (${h.versions.hermes_agent.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes Agent:"})," ",h.versions.hermes_agent?`${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.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:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:A.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.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"}),n.jsxs("button",{onClick:()=>{const L=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(L)},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:[n.jsx(mh,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[o==="dashboard"&&n.jsx(v0,{}),o==="models"&&n.jsx(E0,{}),o==="system"&&n.jsx(_0,{}),o==="connect"&&n.jsx(P0,{}),o==="memory"&&n.jsx(R0,{}),o==="agent"&&n.jsx(z0,{}),o==="guide"&&n.jsx(D0,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(o)&&n.jsx(L0,{title:A.label,hint:A.hint})]})]})]})}rh.createRoot(document.getElementById("root")).render(n.jsx(rf.StrictMode,{children:n.jsx(T0,{})})); +...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.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:",n.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:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.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 ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(yt,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(rl,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(tl,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(mi,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(rl,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.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."})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Hr,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(_u,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(_u,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.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 L0({title:o,hint:d}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:o}),n.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}),n.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:[n.jsx(hh,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const A0=[{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 pi(o){return o==null?"":o>1024**3?`${(o/1024**3).toFixed(2)} GB`:`${(o/1024**2).toFixed(1)} MB`}function O0({open:o,onClose:d,defaultTab:a="maintenance"}){const[c,f]=p.useState(null),[m,h]=p.useState([]),[x,C]=p.useState("llama-swap"),[b,j]=p.useState(""),[P,L]=p.useState(!1),[F,A]=p.useState(null),[N,S]=p.useState({}),[E,D]=p.useState("maintenance"),[Z,Y]=p.useState(!1),[G,I]=p.useState(null);function $(T,O,ge){I({type:"alert",title:T,message:O,onConfirm:()=>{I(null),ge&&ge()}})}function ne(T,O,ge){I({type:"confirm",title:T,message:O,onConfirm:()=>{I(null),ge()},onCancel:()=>I(null)})}function se(T){return T?new Date(T*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[X,be]=p.useState(""),[ce,Me]=p.useState(""),[Pe,Re]=p.useState(!1),[Se,Ne]=p.useState(!1);p.useEffect(()=>{o&&(be(localStorage.getItem("mc_sudo_password")||""),Me(localStorage.getItem("mc_hf_token")||""))},[o]),p.useEffect(()=>{o&&a&&D(a)},[o,a]);const H=p.useRef(null);function ae(){fe("/api/maintenance/updates").then(f).catch(T=>console.error("Error loading updates",T))}function K(){fe("/api/jobs").then(T=>h(T.jobs||[])).catch(T=>console.error("Error loading jobs",T))}function w(T){L(!0),A(null),fe(`/api/maintenance/logs?service=${T}&lines=150`).then(O=>{O.ok?j(O.text):(j(`Fehler beim Laden der Logs: ${O.err||"Unbekannter Fehler"}`),(O.status==="incorrect_password"||O.status==="password_required")&&A(O.status))}).catch(O=>j(`Fehler: ${O.message}`)).finally(()=>{L(!1),setTimeout(()=>{H.current&&(H.current.scrollTop=H.current.scrollHeight)},50)})}p.useEffect(()=>{if(!o)return;ae(),K();const T=setInterval(()=>{K(),ae()},3e3);return()=>clearInterval(T)},[o]),p.useEffect(()=>{!o||E!=="logs"||w(x)},[o,E,x]);async function v(){try{await fe("/api/maintenance/os-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Starten des OS-Updates: ${T.message}`)}}async function V(){try{await fe("/api/maintenance/engine-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Engine-Update: ${T.message}`)}}async function J(){Y(!0);try{await fe("/api/maintenance/check-updates",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler bei der Update-Suche: ${T.message}`)}finally{Y(!1)}}async function Q(T,O){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:T,role:O})}),$("Gestartet",`Modell-Upgrade für '${O}' (${T}) gestartet.`),K(),D("maintenance")}catch(ge){$("Fehler",`Fehler beim Starten des Modell-Upgrades: ${ge.message}`)}}async function oe(){ne("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await fe("/api/maintenance/reboot",{method:"POST"}),$("Reboot","Reboot ausgelöst. System startet neu...",()=>{d()})}catch(T){$("Fehler",`Fehler beim Reboot: ${T.message}`)}})}async function pe(T){S(O=>({...O,[T]:!0}));try{const O=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:T})});O.ok?$("Dienst neu gestartet",`Dienst ${T} wurde erfolgreich neu gestartet.`,()=>{E==="logs"&&x===T&&w(T)}):$("Fehler",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){$("Fehler",`Fehler beim Neustart: ${O.message}`)}finally{S(O=>({...O,[T]:!1}))}}async function me(T){try{await fe(`/api/jobs/${T}/cancel`,{method:"POST"}),K()}catch(O){$("Fehler",`Fehler beim Abbrechen: ${O.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:ee("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",o?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:d}),n.jsxs("div",{className:ee("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",o?"translate-x-0":"translate-x-full"),children:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(yt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.jsx("button",{onClick:d,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:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>D("maintenance"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>D("logs"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>D("settings"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[E==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",se(c.last_check)]}),n.jsxs("button",{onClick:J,disabled:Z,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Vr,{className:ee("h-3 w-3",Z&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:v,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:[n.jsx(Hr,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:V,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:[n.jsx(Sh,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:oe,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:[n.jsx(df,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.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&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.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)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",se(c.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:c.model_list.map(T=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:T.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:T.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",T.role]})]}),n.jsxs("button",{onClick:()=>Q(T.repo,T.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:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},T.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[m.filter(T=>T.state==="running"||T.state==="queued").length," Aktiv"]})]}),n.jsx("div",{className:"space-y-3",children:m.length===0?n.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."}):m.map(T=>{const O=T.state==="running"||T.state==="queued";return n.jsxs("div",{className:ee("p-3 rounded-xl border transition-all duration-300",O?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[O&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),T.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",T.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:ee(T.state==="done"&&"text-emerald-400",T.state==="failed"&&"text-red-400",T.state==="running"&&"text-primary",T.state==="queued"&&"text-amber-400",T.state==="canceled"&&"text-muted-foreground"),children:T.state})]})]}),O&&n.jsx("button",{onClick:()=>me(T.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),T.state==="running"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${T.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[T.progress??0,"%"]}),T.done_bytes!=null&&T.total_bytes!=null&&n.jsxs("span",{children:[pi(T.done_bytes)," / ",pi(T.total_bytes),T.rate_bps!=null&&` (${pi(T.rate_bps)}/s)`]}),T.eta_s!=null&&n.jsxs("span",{children:["ETA: ",T.eta_s,"s"]})]})]})]},T.id)})})]})]}),E==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:x,onChange:T=>C(T.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:A0.map(T=>n.jsxs("option",{value:T.id,children:[T.label," (",T.type==="system"?"systemd-root":"user",")"]},T.id))}),n.jsxs("button",{onClick:()=>pe(x),disabled:N[x],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:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",N[x]&&"animate-spin")}),"Restart"]})]}),n.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:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(tl,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",x]})]}),n.jsx("button",{onClick:()=>w(x),disabled:P,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Vr,{className:ee("h-3 w-3",P&&"animate-spin")})})]}),n.jsx("pre",{ref:H,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:F==="password_required"||F==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(Ph,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:F==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",x," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>D("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"})]}):P&&!b?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):b||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),E==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(Hr,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Pe?"text":"password",value:X,onChange:T=>be(T.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"}),n.jsx("button",{type:"button",onClick:()=>Re(!Pe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Pe?n.jsx(Pu,{className:"h-4 w-4"}):n.jsx(xi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(yh,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Se?"text":"password",value:ce,onChange:T=>Me(T.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"}),n.jsx("button",{type:"button",onClick:()=>Ne(!Se),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Se?n.jsx(Pu,{className:"h-4 w-4"}):n.jsx(xi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",X),localStorage.setItem("mc_hf_token",ce),$("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"}),n.jsx("button",{onClick:()=>{be(""),Me(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),$("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"})]})]})]})]}),G&&n.jsx(qr,{type:G.type,title:G.title,message:G.message,onConfirm:G.onConfirm,onCancel:G.onCancel})]})}function T0(){var F,A,N,S,E;const[o,d]=p.useState("dashboard"),[a,c]=p.useState(null),[f,m]=p.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[h,x]=p.useState(null),[C,b]=p.useState(!1),[j,P]=p.useState("maintenance");p.useEffect(()=>{const D=()=>fe("/api/health").then(c).catch(()=>c(null));D();const Z=setInterval(D,1e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{const D=()=>fe("/api/system/status").then(x).catch(()=>{});D();const Z=setInterval(D,2e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{document.documentElement.classList.add("dark")},[]),p.useEffect(()=>{const D=Z=>{var G;P(((G=Z.detail)==null?void 0:G.tab)||"maintenance"),b(!0)};return window.addEventListener("open-system-drawer",D),()=>window.removeEventListener("open-system-drawer",D)},[]);const L=yi.find(D=>D.id===o);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.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]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Ig,{onNavigate:d}),n.jsx(O0,{open:C,onClose:()=>b(!1),defaultTab:j}),n.jsxs("aside",{className:ee("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",f?"w-16":"w-60"),children:[n.jsxs("div",{className:ee("flex items-center py-4 border-b border-border/40 shrink-0",f?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!f&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{m(D=>{const Z=!D;return localStorage.setItem("mc_sidebar_collapsed",Z.toString()),Z})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:f?"Maximieren":"Minimieren",children:f?n.jsx(dh,{className:"h-4 w-4"}):n.jsx(ih,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:yi.map(D=>n.jsxs("button",{onClick:()=>d(D.id),className:ee("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",f?"justify-center p-2.5":"gap-3 px-3 py-2",o===D.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:f?D.label:void 0,children:[n.jsx(D.icon,{className:"h-4.5 w-4.5 shrink-0"}),!f&&n.jsx("span",{className:"truncate",children:D.label})]},D.id))}),n.jsx("div",{className:ee("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",f?"px-2 text-center":"px-5"),children:f?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",a?a.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:a?`Engine ${a.engine_reachable?"online":"offline"}`:"Backend offline"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[a?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full animate-pulse",a.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",a.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(h==null?void 0:h.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.jsxs("div",{className:"truncate",title:h.versions.mc2?`${h.versions.mc2.branch}-${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""} (${h.versions.mc2.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"MC2:"})," ",h.versions.mc2?`${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((F=h.versions.engine)==null?void 0:F.type)==="git"?`${h.versions.engine.branch}-${h.versions.engine.hash}${h.versions.engine.dirty?"*":""} (${h.versions.engine.date})`:((A=h.versions.engine)==null?void 0:A.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((N=h.versions.engine)==null?void 0:N.type)==="git"?`${h.versions.engine.hash}${h.versions.engine.dirty?"*":""}`:((E=(S=h.versions.engine)==null?void 0:S.version_text)==null?void 0:E.split(" ").pop())||"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_ui?`${h.versions.hermes_ui.branch}-${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""} (${h.versions.hermes_ui.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes UI:"})," ",h.versions.hermes_ui?`${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_agent?`${h.versions.hermes_agent.branch}-${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""} (${h.versions.hermes_agent.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes Agent:"})," ",h.versions.hermes_agent?`${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.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:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:L.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.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"}),n.jsxs("button",{onClick:()=>{const D=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(D)},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:[n.jsx(mh,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[o==="dashboard"&&n.jsx(v0,{}),o==="models"&&n.jsx(E0,{}),o==="system"&&n.jsx(_0,{}),o==="connect"&&n.jsx(P0,{}),o==="memory"&&n.jsx(R0,{}),o==="agent"&&n.jsx(z0,{}),o==="guide"&&n.jsx(D0,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(o)&&n.jsx(L0,{title:L.label,hint:L.hint})]})]})]})}rh.createRoot(document.getElementById("root")).render(n.jsx(rf.StrictMode,{children:n.jsx(T0,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 1829dbd..472075c 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/views/DashboardView.tsx b/frontend/src/views/DashboardView.tsx index 740dea0..d139da9 100644 --- a/frontend/src/views/DashboardView.tsx +++ b/frontend/src/views/DashboardView.tsx @@ -49,6 +49,7 @@ export function DashboardView() { total_tokens: number saved_usd: number saved_eur: number + pricing?: Record } | null>(null) // Sudo & Action states @@ -777,7 +778,10 @@ export function DashboardView() { )}
- Berechnet im Vergleich zu Cloud-APIs von Juni 2026 (Ø 15,00 $ / 75,00 $ pro 1M tkn). + Berechnet im Vergleich zu Cloud-APIs von Juni 2026 + {tokenStats?.pricing?.heavy + ? ` (Ø ${tokenStats.pricing.heavy.in.toFixed(2).replace(".", ",")} $ / ${tokenStats.pricing.heavy.out.toFixed(2).replace(".", ",")} $ pro 1M tkn).` + : "."}
From 341ea870bbe0fd3c5da123c78c22f032e61325bf Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Fri, 26 Jun 2026 14:32:15 +0200 Subject: [PATCH 2/7] Refactor: Zentrales Logging + robuste Token-Erfassung (Phase 2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - app.py: logging.basicConfig (MC_LOG_LEVEL, INFO default) als eine Konfiguration für alle Module. - Neuer services/gateway_stream.py: SSE-/Non-Stream-usage-Parsing aus dem gateway_proxy-Router extrahiert; robuster Zeilenparser mit Debug-Logging statt verschluckter Exceptions. Router ist jetzt dünn. - token_stats.py: In-Memory-Cache + gedrosseltes Flushen (5s) + atexit-Flush statt Write-pro-Request; atomarer Write (.tmp -> replace); thread-safe. - agent.py/discover.py: stille `except Exception: pass` durch gezieltes log.debug/warning ersetzt; ungenutzten yaml-Import entfernt. Verifiziert: Stream-Parsing (Summen + per-Modell), malformed-Chunk übersteht, flush schreibt; app importiert sauber. Co-Authored-By: Claude Opus 4.8 --- backend/app.py | 10 +++ backend/routers/gateway_proxy.py | 34 +------ backend/services/agent.py | 16 ++-- backend/services/discover.py | 10 ++- backend/services/gateway_stream.py | 41 +++++++++ backend/services/token_stats.py | 137 +++++++++++++++++++---------- 6 files changed, 163 insertions(+), 85 deletions(-) create mode 100644 backend/services/gateway_stream.py diff --git a/backend/app.py b/backend/app.py index 4be5df9..f1bb3de 100644 --- a/backend/app.py +++ b/backend/app.py @@ -6,6 +6,9 @@ setzt eine no-cache-Middleware. Im Dev läuft das Frontend über den Vite-Dev- Server (proxyt /api hierher), daher CORS für localhost offen. """ +import logging +import os + from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import FileResponse @@ -15,6 +18,13 @@ from starlette.requests import Request from config import FRONTEND_DIST, VERSION from routers import agent, connect, gateway_proxy, health, maintenance, memory, models, routing, system +# Zentrales Logging — Level via MC_LOG_LEVEL (INFO default). Eine Konfiguration +# für alle Module (logging.getLogger(__name__)). +logging.basicConfig( + level=os.environ.get("MC_LOG_LEVEL", "INFO").upper(), + format="%(asctime)s %(levelname)-7s %(name)s: %(message)s", +) + app = FastAPI(title="Mission Control 2.0", version=VERSION) # Dev: Vite-Dev-Server (5173) ruft das Backend per /api auf. diff --git a/backend/routers/gateway_proxy.py b/backend/routers/gateway_proxy.py index b7a6efe..e9f0f5a 100644 --- a/backend/routers/gateway_proxy.py +++ b/backend/routers/gateway_proxy.py @@ -1,11 +1,10 @@ -import json import httpx from fastapi import APIRouter, Request from fastapi.responses import JSONResponse, StreamingResponse from config import LLAMA_SWAP_URL +from services.gateway_stream import record_stream_chunk, record_usage from services.router_logic import FAST, FAST_NO_THINK, choose_model -from services.token_stats import increment_tokens router = APIRouter(prefix="/v1") @@ -37,41 +36,14 @@ async def _proxy(path: str, request: Request): async with httpx.AsyncClient(timeout=None) as c: async with c.stream("POST", url, json=body) as r: async for chunk in r.aiter_raw(): - try: - chunk_str = chunk.decode("utf-8", errors="ignore") - if '"usage":' in chunk_str: - for line in chunk_str.splitlines(): - if line.startswith("data:"): - data_str = line[5:].strip() - if data_str == "[DONE]": - continue - try: - data_json = json.loads(data_str) - usage = data_json.get("usage") - if usage: - prompt = usage.get("prompt_tokens", 0) - completion = usage.get("completion_tokens", 0) - if prompt or completion: - increment_tokens(prompt, completion, model=alias) - except Exception: - pass - except Exception: - pass + record_stream_chunk(chunk, alias) yield chunk return StreamingResponse(gen(), media_type="text/event-stream", headers=routed) async with httpx.AsyncClient(timeout=600) as c: r = await c.post(url, json=body) resp_json = r.json() - try: - usage = resp_json.get("usage") - if usage: - prompt = usage.get("prompt_tokens", 0) - completion = usage.get("completion_tokens", 0) - if prompt or completion: - increment_tokens(prompt, completion, model=alias) - except Exception: - pass + record_usage(resp_json.get("usage") if isinstance(resp_json, dict) else None, alias) return JSONResponse(resp_json, status_code=r.status_code, headers=routed) diff --git a/backend/services/agent.py b/backend/services/agent.py index a85e3c6..dde7ac3 100644 --- a/backend/services/agent.py +++ b/backend/services/agent.py @@ -4,16 +4,20 @@ Status + verlinkt das standalone hermes-webui. Voller Zugriff + Tools/MCP werden Hermes' eigener Config verdrahtet (siehe docs/HERMES_SETUP.md). """ +import logging + import httpx -from config import HERMES_API_URL, HERMES_HOME, HERMES_WEBUI_URL, yaml +from config import HERMES_API_URL, HERMES_HOME, HERMES_WEBUI_URL + +log = logging.getLogger(__name__) def _reach(url: str, path: str = "") -> bool: try: with httpx.Client(timeout=3.0) as c: return c.get(f"{url}{path}").status_code < 500 - except Exception: + except httpx.HTTPError: return False @@ -31,7 +35,7 @@ def agent_status() -> dict: if isinstance(cfg, dict): brain_model = cfg.get("model", {}).get("model", "auto") except Exception: - pass + log.debug("agent_status: Hermes-config.yaml nicht lesbar", exc_info=True) return { @@ -64,6 +68,7 @@ def update_brain_model(new_model: str) -> bool: with config_path.open("r", encoding="utf-8") as f: cfg = r_yaml.load(f) or {} except Exception: + log.debug("update_brain_model: bestehende config.yaml nicht lesbar", exc_info=True) cfg = {} if not isinstance(cfg, dict): @@ -85,8 +90,9 @@ def update_brain_model(new_model: str) -> bool: import services.maintenance as maintenance maintenance.restart_service("hermes-gateway") except Exception: - pass - + log.warning("update_brain_model: hermes-gateway-Restart fehlgeschlagen", exc_info=True) + return True except Exception: + log.warning("update_brain_model: Schreiben der config.yaml fehlgeschlagen", exc_info=True) return False diff --git a/backend/services/discover.py b/backend/services/discover.py index 4d10921..9b3666f 100644 --- a/backend/services/discover.py +++ b/backend/services/discover.py @@ -14,11 +14,15 @@ import time import httpx +import logging + from config import DISCOVER_CACHE_PATH, DISCOVER_TTL from services.caps import capabilities from services.fit import evaluate_fit, extract_params_b, max_ctx_for from services.sources import CATEGORIES, SKIP_TOKENS, TRUSTED_AUTHORS +log = logging.getLogger(__name__) + _FIT_ORDER = {"perfect": 0, "marginal": 1, "too_tight": 2} @@ -38,6 +42,7 @@ def _fetch_author_models(author: str) -> list: data = c.get(url).json() return data if isinstance(data, list) else [] except Exception: + log.debug("discover: Abfrage für Autor %s fehlgeschlagen", author, exc_info=True) return [] @@ -109,7 +114,7 @@ def refresh_discover(ram_gb: float) -> dict: tmp.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8") os.replace(tmp, DISCOVER_CACHE_PATH) except Exception: - pass # Cache ist nur Beschleunigung + log.debug("discover: Cache-Schreiben fehlgeschlagen (nur Beschleunigung)", exc_info=True) return data @@ -118,7 +123,7 @@ def load_discover() -> dict | None: if DISCOVER_CACHE_PATH.exists(): return json.loads(DISCOVER_CACHE_PATH.read_text(encoding="utf-8")) except Exception: - pass + log.debug("discover: Cache-Lesen fehlgeschlagen", exc_info=True) return None @@ -130,4 +135,5 @@ def safe_discover(ram_gb: float) -> dict | None: try: return refresh_discover(ram_gb) except Exception: + log.warning("discover: Live-Refresh fehlgeschlagen, nutze Cache", exc_info=True) return cached diff --git a/backend/services/gateway_stream.py b/backend/services/gateway_stream.py new file mode 100644 index 0000000..6c05268 --- /dev/null +++ b/backend/services/gateway_stream.py @@ -0,0 +1,41 @@ +"""Token-Erfassung für den Builtin-Gateway. + +Parst die `usage`-Felder aus llama-swap-Antworten (Stream + Non-Stream) und meldet +sie an token_stats. Hält den gateway_proxy-Router dünn und ersetzt die zuvor inline +verstreute, still scheiternde String-Suche durch einen testbaren SSE-Zeilenparser. +""" + +import json +import logging + +from services.token_stats import increment_tokens + +log = logging.getLogger(__name__) + + +def record_usage(usage: dict | None, model: str) -> None: + """Ein usage-Objekt verbuchen (no-op bei None/leer).""" + if not usage: + return + prompt = usage.get("prompt_tokens", 0) + completion = usage.get("completion_tokens", 0) + if prompt or completion: + increment_tokens(prompt, completion, model=model) + + +def record_stream_chunk(chunk: bytes, model: str) -> None: + """Rohen SSE-Chunk auf `usage` prüfen und Tokens verbuchen. Fehler werden + geloggt (debug) statt verschluckt — ein defekter Chunk bricht den Stream nicht.""" + if b'"usage"' not in chunk: + return + text = chunk.decode("utf-8", errors="ignore") + for line in text.splitlines(): + if not line.startswith("data:"): + continue + data_str = line[5:].strip() + if not data_str or data_str == "[DONE]": + continue + try: + record_usage(json.loads(data_str).get("usage"), model) + except json.JSONDecodeError: + log.debug("gateway stream: usage-Parsing fehlgeschlagen: %s", data_str[:120]) diff --git a/backend/services/token_stats.py b/backend/services/token_stats.py index 8907c1b..66fc5e5 100644 --- a/backend/services/token_stats.py +++ b/backend/services/token_stats.py @@ -1,56 +1,99 @@ +"""Token-Statistik (Verbrauch je Modell) mit gedrosseltem Persistieren. + +Früher wurde bei JEDEM Request die komplette JSON-Datei gelesen und geschrieben +(Disk-Thrash). Jetzt: einmaliges Laden in einen In-Memory-Cache, Inkremente laufen +gegen den Cache, Persistieren passiert höchstens alle FLUSH_INTERVAL Sekunden sowie +beim Prozess-Ende (atexit). Lesen liefert immer den aktuellen (auch ungeflushten) Stand. +""" + +import atexit import json +import logging +import threading +import time from pathlib import Path + from config import HERMES_HOME STATS_FILE = HERMES_HOME / "token_stats.json" +FLUSH_INTERVAL = 5.0 # Sekunden zwischen Disk-Writes +# Baseline (repräsentiert Verbrauch vor dem modellspezifischen Logging). +_BASELINE = {"prompt_tokens": 718400, "completion_tokens": 324200, "models": {}} + +log = logging.getLogger(__name__) + +_lock = threading.Lock() +_stats: dict | None = None +_dirty = False +_last_flush = 0.0 + + +def _load_from_disk() -> dict: + if not STATS_FILE.exists(): + return dict(_BASELINE) + try: + with open(STATS_FILE, "r", encoding="utf-8") as f: + data = json.load(f) + data.setdefault("prompt_tokens", 0) + data.setdefault("completion_tokens", 0) + data.setdefault("models", {}) + return data + except (OSError, json.JSONDecodeError): + log.warning("token_stats: Laden fehlgeschlagen, nutze Baseline", exc_info=True) + return dict(_BASELINE) + + +def _ensure_loaded() -> dict: + global _stats + if _stats is None: + _stats = _load_from_disk() + return _stats + + +def _write(stats: dict) -> None: + try: + STATS_FILE.parent.mkdir(parents=True, exist_ok=True) + tmp = STATS_FILE.with_suffix(".tmp") + with open(tmp, "w", encoding="utf-8") as f: + json.dump(stats, f) + tmp.replace(STATS_FILE) + except OSError: + log.warning("token_stats: Schreiben fehlgeschlagen", exc_info=True) + def get_stats() -> dict: - if not STATS_FILE.exists(): - # Initialize stats with a nice baseline (e.g., representing previous usage) - STATS_FILE.parent.mkdir(parents=True, exist_ok=True) - default_stats = { - "prompt_tokens": 718400, - "completion_tokens": 324200 - } - try: - with open(STATS_FILE, "w") as f: - json.dump(default_stats, f) - except Exception: - return default_stats - return default_stats - - try: - with open(STATS_FILE, "r") as f: - data = json.load(f) - # Ensure keys exist - if "prompt_tokens" not in data: - data["prompt_tokens"] = 0 - if "completion_tokens" not in data: - data["completion_tokens"] = 0 - if "models" not in data: - data["models"] = {} - return data - except Exception: - return {"prompt_tokens": 0, "completion_tokens": 0, "models": {}} + """Aktueller Stand (inkl. noch nicht geflushter Inkremente) als Kopie.""" + with _lock: + return json.loads(json.dumps(_ensure_loaded())) -def save_stats(stats: dict): - try: - STATS_FILE.parent.mkdir(parents=True, exist_ok=True) - with open(STATS_FILE, "w") as f: - json.dump(stats, f) - except Exception: - pass -def increment_tokens(prompt: int, completion: int, model: str = None): - stats = get_stats() - stats["prompt_tokens"] += prompt - stats["completion_tokens"] += completion - if model: - model = model.lower() - if "models" not in stats: - stats["models"] = {} - if model not in stats["models"]: - stats["models"][model] = {"prompt": 0, "completion": 0} - stats["models"][model]["prompt"] += prompt - stats["models"][model]["completion"] += completion - save_stats(stats) +def increment_tokens(prompt: int, completion: int, model: str | None = None) -> None: + """Tokens im Cache verbuchen; gedrosselt auf Disk persistieren.""" + global _dirty, _last_flush + with _lock: + stats = _ensure_loaded() + stats["prompt_tokens"] += prompt + stats["completion_tokens"] += completion + if model: + m = stats.setdefault("models", {}).setdefault( + model.lower(), {"prompt": 0, "completion": 0}) + m["prompt"] += prompt + m["completion"] += completion + _dirty = True + now = time.monotonic() + if now - _last_flush >= FLUSH_INTERVAL: + _write(stats) + _dirty = False + _last_flush = now + + +def flush() -> None: + """Ungeschriebene Inkremente sofort persistieren (z.B. beim Shutdown).""" + global _dirty + with _lock: + if _dirty and _stats is not None: + _write(_stats) + _dirty = False + + +atexit.register(flush) From 74f64731ab02a14b724a5e6b43a184a9bba95a55 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Fri, 26 Jun 2026 14:36:28 +0200 Subject: [PATCH 3/7] =?UTF-8?q?Refactor:=20Frontend-Fundament=20=E2=80=94?= =?UTF-8?q?=20Format-Utils,=20Dialog-Ref,=20Typen=20(Phase=203a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Neuer lib/format.ts: gb/fmtBytes/fmtSize/fmtEta/fmtCtx zentral; aus DashboardView/SystemView/ModelsView entdoppelt und importiert. - CustomDialog: document.getElementById -> useRef (kein DOM-Query, robuster). - api.ts: GitInfo/ComponentVersion/Versions typisiert, SystemStatus.versions ergänzt; App.tsx nutzt SystemStatus statt any. tsc grün, Build grün, Dashboard verifiziert (keine Konsolenfehler, Formatierer rendern identisch). Co-Authored-By: Claude Opus 4.8 --- .../{index-BYvMJHPL.js => index-L9oobut2.js} | 146 +++++++++--------- frontend/dist/index.html | 2 +- frontend/src/App.tsx | 6 +- frontend/src/components/CustomDialog.tsx | 11 +- frontend/src/lib/api.ts | 29 ++++ frontend/src/lib/format.ts | 32 ++++ frontend/src/views/DashboardView.tsx | 5 +- frontend/src/views/ModelsView.tsx | 23 +-- frontend/src/views/SystemView.tsx | 5 +- 9 files changed, 146 insertions(+), 113 deletions(-) rename frontend/dist/assets/{index-BYvMJHPL.js => index-L9oobut2.js} (57%) create mode 100644 frontend/src/lib/format.ts diff --git a/frontend/dist/assets/index-BYvMJHPL.js b/frontend/dist/assets/index-L9oobut2.js similarity index 57% rename from frontend/dist/assets/index-BYvMJHPL.js rename to frontend/dist/assets/index-L9oobut2.js index 0be40f0..2101b76 100644 --- a/frontend/dist/assets/index-BYvMJHPL.js +++ b/frontend/dist/assets/index-L9oobut2.js @@ -1,4 +1,4 @@ -function Km(o,d){for(var a=0;ac[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const d=document.createElement("link").relList;if(d&&d.supports&&d.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function a(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(f){if(f.ep)return;f.ep=!0;const m=a(f);fetch(f.href,m)}})();function tf(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ya={exports:{}},ws={},Ja={exports:{}},ke={};/** +function Gm(o,d){for(var a=0;ac[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const d=document.createElement("link").relList;if(d&&d.supports&&d.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function a(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(f){if(f.ep)return;f.ep=!0;const m=a(f);fetch(f.href,m)}})();function ef(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Za={exports:{}},bs={},Ya={exports:{}},ke={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ function Km(o,d){for(var a=0;a>>1,v=H[w];if(0>>1;wf(Q,K))oef(pe,Q)?(H[w]=pe,H[oe]=K,w=oe):(H[w]=Q,H[J]=K,w=J);else if(oef(pe,K))H[w]=pe,H[oe]=K,w=oe;else break e}}return ae}function f(H,ae){var K=H.sortIndex-ae.sortIndex;return K!==0?K:H.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;o.unstable_now=function(){return m.now()}}else{var h=Date,x=h.now();o.unstable_now=function(){return h.now()-x}}var C=[],b=[],j=1,P=null,L=3,F=!1,A=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Z(H){for(var ae=a(b);ae!==null;){if(ae.callback===null)c(b);else if(ae.startTime<=H)c(b),ae.sortIndex=ae.expirationTime,d(C,ae);else break;ae=a(b)}}function Y(H){if(N=!1,Z(H),!A)if(a(C)!==null)A=!0,Se(G);else{var ae=a(b);ae!==null&&Ne(Y,ae.startTime-H)}}function G(H,ae){A=!1,N&&(N=!1,E(ne),ne=-1),F=!0;var K=L;try{for(Z(ae),P=a(C);P!==null&&(!(P.expirationTime>ae)||H&&!be());){var w=P.callback;if(typeof w=="function"){P.callback=null,L=P.priorityLevel;var v=w(P.expirationTime<=ae);ae=o.unstable_now(),typeof v=="function"?P.callback=v:P===a(C)&&c(C),Z(ae)}else c(C);P=a(C)}if(P!==null)var V=!0;else{var J=a(b);J!==null&&Ne(Y,J.startTime-ae),V=!1}return V}finally{P=null,L=K,F=!1}}var I=!1,$=null,ne=-1,se=5,X=-1;function be(){return!(o.unstable_now()-XH||125w?(H.sortIndex=K,d(b,H),a(C)===null&&H===a(b)&&(N?(E(ne),ne=-1):N=!0,Ne(Y,K-w))):(H.sortIndex=v,d(C,H),A||F||(A=!0,Se(G))),H},o.unstable_shouldYield=be,o.unstable_wrapCallback=function(H){var ae=L;return function(){var K=L;L=ae;try{return H.apply(this,arguments)}finally{L=K}}}})(ti)),ti}var Nu;function Jm(){return Nu||(Nu=1,ei.exports=Ym()),ei.exports}/** + */var ju;function Zm(){return ju||(ju=1,(function(o){function d(H,ae){var K=H.length;H.push(ae);e:for(;0>>1,v=H[w];if(0>>1;wf(Q,K))oef(pe,Q)?(H[w]=pe,H[oe]=K,w=oe):(H[w]=Q,H[J]=K,w=J);else if(oef(pe,K))H[w]=pe,H[oe]=K,w=oe;else break e}}return ae}function f(H,ae){var K=H.sortIndex-ae.sortIndex;return K!==0?K:H.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;o.unstable_now=function(){return m.now()}}else{var h=Date,x=h.now();o.unstable_now=function(){return h.now()-x}}var S=[],b=[],j=1,P=null,L=3,F=!1,A=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Z(H){for(var ae=a(b);ae!==null;){if(ae.callback===null)c(b);else if(ae.startTime<=H)c(b),ae.sortIndex=ae.expirationTime,d(S,ae);else break;ae=a(b)}}function Y(H){if(N=!1,Z(H),!A)if(a(S)!==null)A=!0,Se(G);else{var ae=a(b);ae!==null&&Ne(Y,ae.startTime-H)}}function G(H,ae){A=!1,N&&(N=!1,E(ne),ne=-1),F=!0;var K=L;try{for(Z(ae),P=a(S);P!==null&&(!(P.expirationTime>ae)||H&&!be());){var w=P.callback;if(typeof w=="function"){P.callback=null,L=P.priorityLevel;var v=w(P.expirationTime<=ae);ae=o.unstable_now(),typeof v=="function"?P.callback=v:P===a(S)&&c(S),Z(ae)}else c(S);P=a(S)}if(P!==null)var V=!0;else{var J=a(b);J!==null&&Ne(Y,J.startTime-ae),V=!1}return V}finally{P=null,L=K,F=!1}}var I=!1,$=null,ne=-1,se=5,X=-1;function be(){return!(o.unstable_now()-XH||125w?(H.sortIndex=K,d(b,H),a(S)===null&&H===a(b)&&(N?(E(ne),ne=-1):N=!0,Ne(Y,K-w))):(H.sortIndex=v,d(S,H),A||F||(A=!0,Se(G))),H},o.unstable_shouldYield=be,o.unstable_wrapCallback=function(H){var ae=L;return function(){var K=L;L=ae;try{return H.apply(this,arguments)}finally{L=K}}}})(ei)),ei}var ku;function Ym(){return ku||(ku=1,Xa.exports=Zm()),Xa.exports}/** * @license React * react-dom.production.min.js * @@ -30,134 +30,134 @@ function Km(o,d){for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),C=Object.prototype.hasOwnProperty,b=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,j={},P={};function L(e){return C.call(P,e)?!0:C.call(j,e)?!1:b.test(e)?P[e]=!0:(j[e]=!0,!1)}function F(e,t,r,s){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function A(e,t,r,s){if(t===null||typeof t>"u"||F(e,t,r,s))return!0;if(s)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function N(e,t,r,s,l,i,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=u}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];S[t]=new N(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){S[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function D(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(E,D);S[t]=new N(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(E,D);S[t]=new N(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(E,D);S[t]=new N(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function Z(e,t,r,s){var l=S.hasOwnProperty(t)?S[t]:null;(l!==null?l.type!==0:s||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),S=Object.prototype.hasOwnProperty,b=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,j={},P={};function L(e){return S.call(P,e)?!0:S.call(j,e)?!1:b.test(e)?P[e]=!0:(j[e]=!0,!1)}function F(e,t,r,s){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function A(e,t,r,s){if(t===null||typeof t>"u"||F(e,t,r,s))return!0;if(s)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function N(e,t,r,s,l,i,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=u}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new N(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function D(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(E,D);C[t]=new N(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(E,D);C[t]=new N(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(E,D);C[t]=new N(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function Z(e,t,r,s){var l=C.hasOwnProperty(t)?C[t]:null;(l!==null?l.type!==0:s||!(2g||l[u]!==i[g]){var y=` -`+l[u].replace(" at new "," at ");return e.displayName&&y.includes("")&&(y=y.replace("",e.displayName)),y}while(1<=u&&0<=g);break}}}finally{V=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?v(e):""}function Q(e){switch(e.tag){case 5:return v(e.type);case 16:return v("Lazy");case 13:return v("Suspense");case 19:return v("SuspenseList");case 0:case 2:case 15:return e=J(e.type,!1),e;case 11:return e=J(e.type.render,!1),e;case 1:return e=J(e.type,!0),e;default:return""}}function oe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $:return"Fragment";case I:return"Portal";case se:return"Profiler";case ne:return"StrictMode";case Me:return"Suspense";case Pe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case be:return(e.displayName||"Context")+".Consumer";case X:return(e._context.displayName||"Context")+".Provider";case ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function me(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function T(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function O(e){var t=T(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var l=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(u){s=""+u,i.call(this,u)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(u){s=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ge(e){e._valueTracker||(e._valueTracker=O(e))}function Xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),s="";return e&&(s=T(e)?e.checked?"true":"false":e.value),e=s,e!==r?(t.setValue(e),!0):!1}function ft(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function pt(e,t){var r=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function mt(e,t){var r=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;r=me(t.value!=null?t.value:r),e._wrapperState={initialChecked:s,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Tn(e,t){t=t.checked,t!=null&&Z(e,"checked",t,!1)}function Zr(e,t){Tn(e,t);var r=me(t.value),s=t.type;if(r!=null)s==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Yr(e,t.type,r):t.hasOwnProperty("defaultValue")&&Yr(e,t.type,me(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function tr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Yr(e,t,r){(t!=="number"||ft(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var rr=Array.isArray;function Bt(e,t,r,s){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vt(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Wt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},il=["Webkit","ms","Moz","O"];Object.keys(Wt).forEach(function(e){il.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Wt[t]=Wt[e]})});function Li(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Wt.hasOwnProperty(e)&&Wt[e]?(""+t).trim():t+"px"}function Ai(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var s=r.indexOf("--")===0,l=Li(r,t[r],s);r==="float"&&(r="cssFloat"),s?e.setProperty(r,l):e[r]=l}}var Jf=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dl(e,t){if(t){if(Jf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function cl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ul=null;function fl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pl=null,Xr=null,en=null;function Oi(e){if(e=ls(e)){if(typeof pl!="function")throw Error(a(280));var t=e.stateNode;t&&(t=eo(t),pl(e.stateNode,e.type,t))}}function Ti(e){Xr?en?en.push(e):en=[e]:Xr=e}function Ii(){if(Xr){var e=Xr,t=en;if(en=Xr=null,Oi(e),t)for(e=0;e>>=0,e===0?32:31-(dp(e)/cp|0)|0}var Os=64,Ts=4194304;function Bn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Is(e,t){var r=e.pendingLanes;if(r===0)return 0;var s=0,l=e.suspendedLanes,i=e.pingedLanes,u=r&268435455;if(u!==0){var g=u&~l;g!==0?s=Bn(g):(i&=u,i!==0&&(s=Bn(i)))}else u=r&~l,u!==0?s=Bn(u):i!==0&&(s=Bn(i));if(s===0)return 0;if(t!==0&&t!==s&&(t&l)===0&&(l=s&-s,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if((s&4)!==0&&(s|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0r;r++)t.push(e);return t}function Vn(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=r}function mp(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=Yn),fd=" ",pd=!1;function md(e,t){switch(e){case"keyup":return Bp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var nn=!1;function Wp(e,t){switch(e){case"compositionend":return hd(t);case"keypress":return t.which!==32?null:(pd=!0,fd);case"textInput":return e=t.data,e===fd&&pd?null:e;default:return null}}function Hp(e,t){if(nn)return e==="compositionend"||!Rl&&md(e,t)?(e=ld(),Vs=Sl=ar=null,nn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=jd(r)}}function Nd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sd(){for(var e=window,t=ft();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ft(e.document)}return t}function Ll(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function em(e){var t=Sd(),r=e.focusedElem,s=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Nd(r.ownerDocument.documentElement,r)){if(s!==null&&Ll(r)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=r.textContent.length,i=Math.min(s.start,l);s=s.end===void 0?i:Math.min(s.end,l),!e.extend&&i>s&&(l=s,s=i,i=l),l=kd(r,i);var u=kd(r,s);l&&u&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,sn=null,Al=null,ts=null,Ol=!1;function Cd(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ol||sn==null||sn!==ft(s)||(s=sn,"selectionStart"in s&&Ll(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ts&&es(ts,s)||(ts=s,s=Ys(Al,"onSelect"),0cn||(e.current=Ql[cn],Ql[cn]=null,cn--)}function Le(e,t){cn++,Ql[cn]=e.current,e.current=t}var ur={},et=cr(ur),lt=cr(!1),Mr=ur;function un(e,t){var r=e.type.contextTypes;if(!r)return ur;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in r)l[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function at(e){return e=e.childContextTypes,e!=null}function to(){Oe(lt),Oe(et)}function Ud(e,t,r){if(et.current!==ur)throw Error(a(168));Le(et,t),Le(lt,r)}function Bd(e,t,r){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(a(108,pe(e)||"Unknown",l));return K({},r,s)}function ro(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ur,Mr=et.current,Le(et,e),Le(lt,lt.current),!0}function Vd(e,t,r){var s=e.stateNode;if(!s)throw Error(a(169));r?(e=Bd(e,t,Mr),s.__reactInternalMemoizedMergedChildContext=e,Oe(lt),Oe(et),Le(et,e)):Oe(lt),Le(lt,r)}var Gt=null,no=!1,ql=!1;function Wd(e){Gt===null?Gt=[e]:Gt.push(e)}function fm(e){no=!0,Wd(e)}function fr(){if(!ql&&Gt!==null){ql=!0;var e=0,t=ze;try{var r=Gt;for(ze=1;e>=u,l-=u,Kt=1<<32-Et(t)+l|r<we?(qe=xe,xe=null):qe=xe.sibling;var _e=U(_,xe,M[we],q);if(_e===null){xe===null&&(xe=qe);break}e&&xe&&_e.alternate===null&&t(_,xe),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e,xe=qe}if(we===M.length)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;wewe?(qe=xe,xe=null):qe=xe.sibling;var wr=U(_,xe,_e.value,q);if(wr===null){xe===null&&(xe=qe);break}e&&xe&&wr.alternate===null&&t(_,xe),k=i(wr,k,we),he===null?ue=wr:he.sibling=wr,he=wr,xe=qe}if(_e.done)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;!_e.done;we++,_e=M.next())_e=W(_,_e.value,q),_e!==null&&(k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return Ie&&zr(_,we),ue}for(xe=s(_,xe);!_e.done;we++,_e=M.next())_e=te(xe,_,we,_e.value,q),_e!==null&&(e&&_e.alternate!==null&&xe.delete(_e.key===null?we:_e.key),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return e&&xe.forEach(function(Gm){return t(_,Gm)}),Ie&&zr(_,we),ue}function Ve(_,k,M,q){if(typeof M=="object"&&M!==null&&M.type===$&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case G:e:{for(var ue=M.key,he=k;he!==null;){if(he.key===ue){if(ue=M.type,ue===$){if(he.tag===7){r(_,he.sibling),k=l(he,M.props.children),k.return=_,_=k;break e}}else if(he.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===Se&&Zd(ue)===he.type){r(_,he.sibling),k=l(he,M.props),k.ref=as(_,he,M),k.return=_,_=k;break e}r(_,he);break}else t(_,he);he=he.sibling}M.type===$?(k=$r(M.props.children,_.mode,q,M.key),k.return=_,_=k):(q=zo(M.type,M.key,M.props,null,_.mode,q),q.ref=as(_,k,M),q.return=_,_=q)}return u(_);case I:e:{for(he=M.key;k!==null;){if(k.key===he)if(k.tag===4&&k.stateNode.containerInfo===M.containerInfo&&k.stateNode.implementation===M.implementation){r(_,k.sibling),k=l(k,M.children||[]),k.return=_,_=k;break e}else{r(_,k);break}else t(_,k);k=k.sibling}k=Ga(M,_.mode,q),k.return=_,_=k}return u(_);case Se:return he=M._init,Ve(_,k,he(M._payload),q)}if(rr(M))return ie(_,k,M,q);if(ae(M))return de(_,k,M,q);ao(_,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,k!==null&&k.tag===6?(r(_,k.sibling),k=l(k,M),k.return=_,_=k):(r(_,k),k=Ha(M,_.mode,q),k.return=_,_=k),u(_)):r(_,k)}return Ve}var hn=Yd(!0),Jd=Yd(!1),io=cr(null),co=null,xn=null,ta=null;function ra(){ta=xn=co=null}function na(e){var t=io.current;Oe(io),e._currentValue=t}function sa(e,t,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===r)break;e=e.return}}function gn(e,t){co=e,ta=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(it=!0),e.firstContext=null)}function jt(e){var t=e._currentValue;if(ta!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(co===null)throw Error(a(308));xn=e,co.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var Dr=null;function oa(e){Dr===null?Dr=[e]:Dr.push(e)}function Xd(e,t,r,s){var l=t.interleaved;return l===null?(r.next=r,oa(t)):(r.next=l.next,l.next=r),t.interleaved=r,qt(e,s)}function qt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var pr=!1;function la(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ec(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Zt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mr(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ee&2)!==0){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,qt(e,r)}return l=s.interleaved,l===null?(t.next=t,oa(s)):(t.next=l.next,l.next=t),s.interleaved=t,qt(e,r)}function uo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,bl(e,r)}}function tc(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var l=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var u={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?l=i=u:i=i.next=u,r=r.next}while(r!==null);i===null?l=i=t:i=i.next=t}else l=i=t;r={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function fo(e,t,r,s){var l=e.updateQueue;pr=!1;var i=l.firstBaseUpdate,u=l.lastBaseUpdate,g=l.shared.pending;if(g!==null){l.shared.pending=null;var y=g,z=y.next;y.next=null,u===null?i=z:u.next=z,u=y;var B=e.alternate;B!==null&&(B=B.updateQueue,g=B.lastBaseUpdate,g!==u&&(g===null?B.firstBaseUpdate=z:g.next=z,B.lastBaseUpdate=y))}if(i!==null){var W=l.baseState;u=0,B=z=y=null,g=i;do{var U=g.lane,te=g.eventTime;if((s&U)===U){B!==null&&(B=B.next={eventTime:te,lane:0,tag:g.tag,payload:g.payload,callback:g.callback,next:null});e:{var ie=e,de=g;switch(U=t,te=r,de.tag){case 1:if(ie=de.payload,typeof ie=="function"){W=ie.call(te,W,U);break e}W=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=de.payload,U=typeof ie=="function"?ie.call(te,W,U):ie,U==null)break e;W=K({},W,U);break e;case 2:pr=!0}}g.callback!==null&&g.lane!==0&&(e.flags|=64,U=l.effects,U===null?l.effects=[g]:U.push(g))}else te={eventTime:te,lane:U,tag:g.tag,payload:g.payload,callback:g.callback,next:null},B===null?(z=B=te,y=W):B=B.next=te,u|=U;if(g=g.next,g===null){if(g=l.shared.pending,g===null)break;U=g,g=U.next,U.next=null,l.lastBaseUpdate=U,l.shared.pending=null}}while(!0);if(B===null&&(y=W),l.baseState=y,l.firstBaseUpdate=z,l.lastBaseUpdate=B,t=l.shared.interleaved,t!==null){l=t;do u|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Or|=u,e.lanes=u,e.memoizedState=W}}function rc(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var s=ua.transition;ua.transition={};try{e(!1),t()}finally{ze=r,ua.transition=s}}function wc(){return kt().memoizedState}function xm(e,t,r){var s=vr(e);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},jc(e))kc(t,r);else if(r=Xd(e,t,r,s),r!==null){var l=ot();Dt(r,e,s,l),Nc(r,t,s)}}function gm(e,t,r){var s=vr(e),l={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(jc(e))kc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var u=t.lastRenderedState,g=i(u,r);if(l.hasEagerState=!0,l.eagerState=g,_t(g,u)){var y=t.interleaved;y===null?(l.next=l,oa(t)):(l.next=y.next,y.next=l),t.interleaved=l;return}}catch{}finally{}r=Xd(e,t,l,s),r!==null&&(l=ot(),Dt(r,e,s,l),Nc(r,t,s))}}function jc(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function kc(e,t){us=ho=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Nc(e,t,r){if((r&4194240)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,bl(e,r)}}var vo={readContext:jt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},vm={readContext:jt,useCallback:function(e,t){return It().memoizedState=[e,t===void 0?null:t],e},useContext:jt,useEffect:pc,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,xo(4194308,4,xc.bind(null,t,e),r)},useLayoutEffect:function(e,t){return xo(4194308,4,e,t)},useInsertionEffect:function(e,t){return xo(4,2,e,t)},useMemo:function(e,t){var r=It();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var s=It();return t=r!==void 0?r(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=xm.bind(null,$e,e),[s.memoizedState,e]},useRef:function(e){var t=It();return e={current:e},t.memoizedState=e},useState:uc,useDebugValue:va,useDeferredValue:function(e){return It().memoizedState=e},useTransition:function(){var e=uc(!1),t=e[0];return e=hm.bind(null,e[1]),It().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var s=$e,l=It();if(Ie){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Qe===null)throw Error(a(349));(Ar&30)!==0||lc(s,t,r)}l.memoizedState=r;var i={value:r,getSnapshot:t};return l.queue=i,pc(ic.bind(null,s,i,e),[e]),s.flags|=2048,ms(9,ac.bind(null,s,i,r,t),void 0,null),r},useId:function(){var e=It(),t=Qe.identifierPrefix;if(Ie){var r=Qt,s=Kt;r=(s&~(1<<32-Et(s)-1)).toString(32)+r,t=":"+t+"R"+r,r=fs++,0")&&(y=y.replace("",e.displayName)),y}while(1<=u&&0<=g);break}}}finally{V=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?v(e):""}function Q(e){switch(e.tag){case 5:return v(e.type);case 16:return v("Lazy");case 13:return v("Suspense");case 19:return v("SuspenseList");case 0:case 2:case 15:return e=J(e.type,!1),e;case 11:return e=J(e.type.render,!1),e;case 1:return e=J(e.type,!0),e;default:return""}}function oe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $:return"Fragment";case I:return"Portal";case se:return"Profiler";case ne:return"StrictMode";case Me:return"Suspense";case Pe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case be:return(e.displayName||"Context")+".Consumer";case X:return(e._context.displayName||"Context")+".Provider";case ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function me(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function T(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function O(e){var t=T(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var l=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(u){s=""+u,i.call(this,u)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(u){s=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ge(e){e._valueTracker||(e._valueTracker=O(e))}function Xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),s="";return e&&(s=T(e)?e.checked?"true":"false":e.value),e=s,e!==r?(t.setValue(e),!0):!1}function pt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function mt(e,t){var r=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ht(e,t){var r=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;r=me(t.value!=null?t.value:r),e._wrapperState={initialChecked:s,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function On(e,t){t=t.checked,t!=null&&Z(e,"checked",t,!1)}function Zr(e,t){On(e,t);var r=me(t.value),s=t.type;if(r!=null)s==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Yr(e,t.type,r):t.hasOwnProperty("defaultValue")&&Yr(e,t.type,me(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function rr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Yr(e,t,r){(t!=="number"||pt(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var nr=Array.isArray;function Vt(e,t,r,s){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wt(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Ht={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},al=["Webkit","ms","Moz","O"];Object.keys(Ht).forEach(function(e){al.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ht[t]=Ht[e]})});function Di(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Ht.hasOwnProperty(e)&&Ht[e]?(""+t).trim():t+"px"}function Li(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var s=r.indexOf("--")===0,l=Di(r,t[r],s);r==="float"&&(r="cssFloat"),s?e.setProperty(r,l):e[r]=l}}var Yf=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function il(e,t){if(t){if(Yf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function dl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var cl=null;function ul(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fl=null,Xr=null,en=null;function Ai(e){if(e=os(e)){if(typeof fl!="function")throw Error(a(280));var t=e.stateNode;t&&(t=Xs(t),fl(e.stateNode,e.type,t))}}function Oi(e){Xr?en?en.push(e):en=[e]:Xr=e}function Ti(){if(Xr){var e=Xr,t=en;if(en=Xr=null,Ai(e),t)for(e=0;e>>=0,e===0?32:31-(ip(e)/dp|0)|0}var As=64,Os=4194304;function Un(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ts(e,t){var r=e.pendingLanes;if(r===0)return 0;var s=0,l=e.suspendedLanes,i=e.pingedLanes,u=r&268435455;if(u!==0){var g=u&~l;g!==0?s=Un(g):(i&=u,i!==0&&(s=Un(i)))}else u=r&~l,u!==0?s=Un(u):i!==0&&(s=Un(i));if(s===0)return 0;if(t!==0&&t!==s&&(t&l)===0&&(l=s&-s,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if((s&4)!==0&&(s|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0r;r++)t.push(e);return t}function Bn(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-_t(t),e[t]=r}function pp(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=Zn),ud=" ",fd=!1;function pd(e,t){switch(e){case"keyup":return Up.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function md(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var nn=!1;function Vp(e,t){switch(e){case"compositionend":return md(t);case"keypress":return t.which!==32?null:(fd=!0,ud);case"textInput":return e=t.data,e===ud&&fd?null:e;default:return null}}function Wp(e,t){if(nn)return e==="compositionend"||!Ml&&pd(e,t)?(e=od(),Bs=Nl=ir=null,nn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=wd(r)}}function kd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nd(){for(var e=window,t=pt();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=pt(e.document)}return t}function Dl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Xp(e){var t=Nd(),r=e.focusedElem,s=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&kd(r.ownerDocument.documentElement,r)){if(s!==null&&Dl(r)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=r.textContent.length,i=Math.min(s.start,l);s=s.end===void 0?i:Math.min(s.end,l),!e.extend&&i>s&&(l=s,s=i,i=l),l=jd(r,i);var u=jd(r,s);l&&u&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,sn=null,Ll=null,es=null,Al=!1;function Sd(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Al||sn==null||sn!==pt(s)||(s=sn,"selectionStart"in s&&Dl(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),es&&Xn(es,s)||(es=s,s=Zs(Ll,"onSelect"),0cn||(e.current=Kl[cn],Kl[cn]=null,cn--)}function Le(e,t){cn++,Kl[cn]=e.current,e.current=t}var fr={},et=ur(fr),lt=ur(!1),Mr=fr;function un(e,t){var r=e.type.contextTypes;if(!r)return fr;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in r)l[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function at(e){return e=e.childContextTypes,e!=null}function eo(){Oe(lt),Oe(et)}function $d(e,t,r){if(et.current!==fr)throw Error(a(168));Le(et,t),Le(lt,r)}function Ud(e,t,r){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(a(108,pe(e)||"Unknown",l));return K({},r,s)}function to(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fr,Mr=et.current,Le(et,e),Le(lt,lt.current),!0}function Bd(e,t,r){var s=e.stateNode;if(!s)throw Error(a(169));r?(e=Ud(e,t,Mr),s.__reactInternalMemoizedMergedChildContext=e,Oe(lt),Oe(et),Le(et,e)):Oe(lt),Le(lt,r)}var Kt=null,ro=!1,Ql=!1;function Vd(e){Kt===null?Kt=[e]:Kt.push(e)}function um(e){ro=!0,Vd(e)}function pr(){if(!Ql&&Kt!==null){Ql=!0;var e=0,t=ze;try{var r=Kt;for(ze=1;e>=u,l-=u,Qt=1<<32-_t(t)+l|r<we?(qe=xe,xe=null):qe=xe.sibling;var _e=U(_,xe,M[we],q);if(_e===null){xe===null&&(xe=qe);break}e&&xe&&_e.alternate===null&&t(_,xe),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e,xe=qe}if(we===M.length)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;wewe?(qe=xe,xe=null):qe=xe.sibling;var jr=U(_,xe,_e.value,q);if(jr===null){xe===null&&(xe=qe);break}e&&xe&&jr.alternate===null&&t(_,xe),k=i(jr,k,we),he===null?ue=jr:he.sibling=jr,he=jr,xe=qe}if(_e.done)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;!_e.done;we++,_e=M.next())_e=W(_,_e.value,q),_e!==null&&(k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return Ie&&zr(_,we),ue}for(xe=s(_,xe);!_e.done;we++,_e=M.next())_e=te(xe,_,we,_e.value,q),_e!==null&&(e&&_e.alternate!==null&&xe.delete(_e.key===null?we:_e.key),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return e&&xe.forEach(function(Hm){return t(_,Hm)}),Ie&&zr(_,we),ue}function Ve(_,k,M,q){if(typeof M=="object"&&M!==null&&M.type===$&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case G:e:{for(var ue=M.key,he=k;he!==null;){if(he.key===ue){if(ue=M.type,ue===$){if(he.tag===7){r(_,he.sibling),k=l(he,M.props.children),k.return=_,_=k;break e}}else if(he.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===Se&&qd(ue)===he.type){r(_,he.sibling),k=l(he,M.props),k.ref=ls(_,he,M),k.return=_,_=k;break e}r(_,he);break}else t(_,he);he=he.sibling}M.type===$?(k=$r(M.props.children,_.mode,q,M.key),k.return=_,_=k):(q=Ro(M.type,M.key,M.props,null,_.mode,q),q.ref=ls(_,k,M),q.return=_,_=q)}return u(_);case I:e:{for(he=M.key;k!==null;){if(k.key===he)if(k.tag===4&&k.stateNode.containerInfo===M.containerInfo&&k.stateNode.implementation===M.implementation){r(_,k.sibling),k=l(k,M.children||[]),k.return=_,_=k;break e}else{r(_,k);break}else t(_,k);k=k.sibling}k=Ha(M,_.mode,q),k.return=_,_=k}return u(_);case Se:return he=M._init,Ve(_,k,he(M._payload),q)}if(nr(M))return ie(_,k,M,q);if(ae(M))return de(_,k,M,q);lo(_,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,k!==null&&k.tag===6?(r(_,k.sibling),k=l(k,M),k.return=_,_=k):(r(_,k),k=Wa(M,_.mode,q),k.return=_,_=k),u(_)):r(_,k)}return Ve}var hn=Zd(!0),Yd=Zd(!1),ao=ur(null),io=null,xn=null,ea=null;function ta(){ea=xn=io=null}function ra(e){var t=ao.current;Oe(ao),e._currentValue=t}function na(e,t,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===r)break;e=e.return}}function gn(e,t){io=e,ea=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(it=!0),e.firstContext=null)}function kt(e){var t=e._currentValue;if(ea!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(io===null)throw Error(a(308));xn=e,io.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var Dr=null;function sa(e){Dr===null?Dr=[e]:Dr.push(e)}function Jd(e,t,r,s){var l=t.interleaved;return l===null?(r.next=r,sa(t)):(r.next=l.next,l.next=r),t.interleaved=r,Zt(e,s)}function Zt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var mr=!1;function oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Yt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hr(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ee&2)!==0){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,Zt(e,r)}return l=s.interleaved,l===null?(t.next=t,sa(s)):(t.next=l.next,l.next=t),s.interleaved=t,Zt(e,r)}function co(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,yl(e,r)}}function ec(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var l=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var u={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?l=i=u:i=i.next=u,r=r.next}while(r!==null);i===null?l=i=t:i=i.next=t}else l=i=t;r={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function uo(e,t,r,s){var l=e.updateQueue;mr=!1;var i=l.firstBaseUpdate,u=l.lastBaseUpdate,g=l.shared.pending;if(g!==null){l.shared.pending=null;var y=g,z=y.next;y.next=null,u===null?i=z:u.next=z,u=y;var B=e.alternate;B!==null&&(B=B.updateQueue,g=B.lastBaseUpdate,g!==u&&(g===null?B.firstBaseUpdate=z:g.next=z,B.lastBaseUpdate=y))}if(i!==null){var W=l.baseState;u=0,B=z=y=null,g=i;do{var U=g.lane,te=g.eventTime;if((s&U)===U){B!==null&&(B=B.next={eventTime:te,lane:0,tag:g.tag,payload:g.payload,callback:g.callback,next:null});e:{var ie=e,de=g;switch(U=t,te=r,de.tag){case 1:if(ie=de.payload,typeof ie=="function"){W=ie.call(te,W,U);break e}W=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=de.payload,U=typeof ie=="function"?ie.call(te,W,U):ie,U==null)break e;W=K({},W,U);break e;case 2:mr=!0}}g.callback!==null&&g.lane!==0&&(e.flags|=64,U=l.effects,U===null?l.effects=[g]:U.push(g))}else te={eventTime:te,lane:U,tag:g.tag,payload:g.payload,callback:g.callback,next:null},B===null?(z=B=te,y=W):B=B.next=te,u|=U;if(g=g.next,g===null){if(g=l.shared.pending,g===null)break;U=g,g=U.next,U.next=null,l.lastBaseUpdate=U,l.shared.pending=null}}while(!0);if(B===null&&(y=W),l.baseState=y,l.firstBaseUpdate=z,l.lastBaseUpdate=B,t=l.shared.interleaved,t!==null){l=t;do u|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Or|=u,e.lanes=u,e.memoizedState=W}}function tc(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var s=ca.transition;ca.transition={};try{e(!1),t()}finally{ze=r,ca.transition=s}}function bc(){return Nt().memoizedState}function hm(e,t,r){var s=yr(e);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},wc(e))jc(t,r);else if(r=Jd(e,t,r,s),r!==null){var l=ot();Lt(r,e,s,l),kc(r,t,s)}}function xm(e,t,r){var s=yr(e),l={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(wc(e))jc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var u=t.lastRenderedState,g=i(u,r);if(l.hasEagerState=!0,l.eagerState=g,Pt(g,u)){var y=t.interleaved;y===null?(l.next=l,sa(t)):(l.next=y.next,y.next=l),t.interleaved=l;return}}catch{}finally{}r=Jd(e,t,l,s),r!==null&&(l=ot(),Lt(r,e,s,l),kc(r,t,s))}}function wc(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function jc(e,t){cs=mo=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function kc(e,t,r){if((r&4194240)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,yl(e,r)}}var go={readContext:kt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},gm={readContext:kt,useCallback:function(e,t){return Ft().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:fc,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,ho(4194308,4,hc.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ho(4194308,4,e,t)},useInsertionEffect:function(e,t){return ho(4,2,e,t)},useMemo:function(e,t){var r=Ft();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var s=Ft();return t=r!==void 0?r(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=hm.bind(null,$e,e),[s.memoizedState,e]},useRef:function(e){var t=Ft();return e={current:e},t.memoizedState=e},useState:cc,useDebugValue:ga,useDeferredValue:function(e){return Ft().memoizedState=e},useTransition:function(){var e=cc(!1),t=e[0];return e=mm.bind(null,e[1]),Ft().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var s=$e,l=Ft();if(Ie){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Qe===null)throw Error(a(349));(Ar&30)!==0||oc(s,t,r)}l.memoizedState=r;var i={value:r,getSnapshot:t};return l.queue=i,fc(ac.bind(null,s,i,e),[e]),s.flags|=2048,ps(9,lc.bind(null,s,i,r,t),void 0,null),r},useId:function(){var e=Ft(),t=Qe.identifierPrefix;if(Ie){var r=qt,s=Qt;r=(s&~(1<<32-_t(s)-1)).toString(32)+r,t=":"+t+"R"+r,r=us++,0<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=u.createElement(r,{is:s.is}):(e=u.createElement(r),r==="select"&&(u=e,s.multiple?u.multiple=!0:s.size&&(u.size=s.size))):e=u.createElementNS(e,r),e[Ot]=t,e[os]=s,Wc(e,t,!1,!1),t.stateNode=e;e:{switch(u=cl(r,s),r){case"dialog":Ae("cancel",e),Ae("close",e),l=s;break;case"iframe":case"object":case"embed":Ae("load",e),l=s;break;case"video":case"audio":for(l=0;ljn&&(t.flags|=128,s=!0,hs(i,!1),t.lanes=4194304)}else{if(!s)if(e=po(u),e!==null){if(t.flags|=128,s=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),hs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!u.alternate&&!Ie)return rt(t),null}else 2*Be()-i.renderingStartTime>jn&&r!==1073741824&&(t.flags|=128,s=!0,hs(i,!1),t.lanes=4194304);i.isBackwards?(u.sibling=t.child,t.child=u):(r=i.last,r!==null?r.sibling=u:t.child=u,i.last=u)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Be(),t.sibling=null,r=Fe.current,Le(Fe,s?r&1|2:r&1),t):(rt(t),null);case 22:case 23:return Ba(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&(t.mode&1)!==0?(vt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Cm(e,t){switch(Yl(t),t.tag){case 1:return at(t.type)&&to(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vn(),Oe(lt),Oe(et),ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return ia(t),null;case 13:if(Oe(Fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oe(Fe),null;case 4:return vn(),null;case 10:return na(t.type._context),null;case 22:case 23:return Ba(),null;case 24:return null;default:return null}}var jo=!1,nt=!1,Em=typeof WeakSet=="function"?WeakSet:Set,le=null;function bn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){Ue(e,t,s)}else r.current=null}function Ma(e,t,r){try{r()}catch(s){Ue(e,t,s)}}var Kc=!1;function _m(e,t){if(Bl=Us,e=Sd(),Ll(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var l=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var u=0,g=-1,y=-1,z=0,B=0,W=e,U=null;t:for(;;){for(var te;W!==r||l!==0&&W.nodeType!==3||(g=u+l),W!==i||s!==0&&W.nodeType!==3||(y=u+s),W.nodeType===3&&(u+=W.nodeValue.length),(te=W.firstChild)!==null;)U=W,W=te;for(;;){if(W===e)break t;if(U===r&&++z===l&&(g=u),U===i&&++B===s&&(y=u),(te=W.nextSibling)!==null)break;W=U,U=W.parentNode}W=te}r=g===-1||y===-1?null:{start:g,end:y}}else r=null}r=r||{start:0,end:0}}else r=null;for(Vl={focusedElem:e,selectionRange:r},Us=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var de=ie.memoizedProps,Ve=ie.memoizedState,_=t.stateNode,k=_.getSnapshotBeforeUpdate(t.elementType===t.type?de:Mt(t.type,de),Ve);_.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var M=t.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(q){Ue(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ie=Kc,Kc=!1,ie}function xs(e,t,r){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Ma(t,r,i)}l=l.next}while(l!==s)}}function ko(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var s=r.create;r.destroy=s()}r=r.next}while(r!==t)}}function Ra(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Qc(e){var t=e.alternate;t!==null&&(e.alternate=null,Qc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ot],delete t[os],delete t[Kl],delete t[cm],delete t[um])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qc(e){return e.tag===5||e.tag===3||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function za(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Xs));else if(s!==4&&(e=e.child,e!==null))for(za(e,t,r),e=e.sibling;e!==null;)za(e,t,r),e=e.sibling}function Da(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Da(e,t,r),e=e.sibling;e!==null;)Da(e,t,r),e=e.sibling}var Ze=null,Rt=!1;function hr(e,t,r){for(r=r.child;r!==null;)Yc(e,t,r),r=r.sibling}function Yc(e,t,r){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(As,r)}catch{}switch(r.tag){case 5:nt||bn(r,t);case 6:var s=Ze,l=Rt;Ze=null,hr(e,t,r),Ze=s,Rt=l,Ze!==null&&(Rt?(e=Ze,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ze.removeChild(r.stateNode));break;case 18:Ze!==null&&(Rt?(e=Ze,r=r.stateNode,e.nodeType===8?Gl(e.parentNode,r):e.nodeType===1&&Gl(e,r),Qn(e)):Gl(Ze,r.stateNode));break;case 4:s=Ze,l=Rt,Ze=r.stateNode.containerInfo,Rt=!0,hr(e,t,r),Ze=s,Rt=l;break;case 0:case 11:case 14:case 15:if(!nt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var i=l,u=i.destroy;i=i.tag,u!==void 0&&((i&2)!==0||(i&4)!==0)&&Ma(r,t,u),l=l.next}while(l!==s)}hr(e,t,r);break;case 1:if(!nt&&(bn(r,t),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(g){Ue(r,t,g)}hr(e,t,r);break;case 21:hr(e,t,r);break;case 22:r.mode&1?(nt=(s=nt)||r.memoizedState!==null,hr(e,t,r),nt=s):hr(e,t,r);break;default:hr(e,t,r)}}function Jc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Em),t.forEach(function(s){var l=Tm.bind(null,e,s);r.has(s)||(r.add(s),s.then(l,l))})}}function zt(e,t){var r=t.deletions;if(r!==null)for(var s=0;sl&&(l=u),s&=~i}if(s=l,s=Be()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Mm(s/1960))-s,10e?16:e,gr===null)var s=!1;else{if(e=gr,gr=null,_o=0,(Ee&6)!==0)throw Error(a(331));var l=Ee;for(Ee|=4,le=e.current;le!==null;){var i=le,u=i.child;if((le.flags&16)!==0){var g=i.deletions;if(g!==null){for(var y=0;yBe()-Oa?Ir(e,0):Aa|=r),ct(e,t)}function uu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Ts,Ts<<=1,(Ts&130023424)===0&&(Ts=4194304)));var r=ot();e=qt(e,t),e!==null&&(Vn(e,t,r),ct(e,r))}function Om(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),uu(e,r)}function Tm(e,t){var r=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(r=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(a(314))}s!==null&&s.delete(t),uu(e,r)}var fu;fu=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)it=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return it=!1,Nm(e,t,r);it=(e.flags&131072)!==0}else it=!1,Ie&&(t.flags&1048576)!==0&&Hd(t,oo,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;wo(e,t),e=t.pendingProps;var l=un(t,et.current);gn(t,r),l=pa(null,t,s,e,l,r);var i=ma();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,at(s)?(i=!0,ro(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,la(t),l.updater=yo,t.stateNode=l,l._reactInternals=t,ba(t,s,e,r),t=Na(null,t,s,!0,i,r)):(t.tag=0,Ie&&i&&Zl(t),st(null,t,l,r),t=t.child),t;case 16:s=t.elementType;e:{switch(wo(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=Fm(s),e=Mt(s,e),l){case 0:t=ka(null,t,s,e,r);break e;case 1:t=Ic(null,t,s,e,r);break e;case 11:t=Dc(null,t,s,e,r);break e;case 14:t=Lc(null,t,s,Mt(s.type,e),r);break e}throw Error(a(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),ka(e,t,s,l,r);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),Ic(e,t,s,l,r);case 3:e:{if(Fc(t),e===null)throw Error(a(387));s=t.pendingProps,i=t.memoizedState,l=i.element,ec(e,t),fo(t,s,null,r);var u=t.memoizedState;if(s=u.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=yn(Error(a(423)),t),t=$c(e,t,s,r,l);break e}else if(s!==l){l=yn(Error(a(424)),t),t=$c(e,t,s,r,l);break e}else for(gt=dr(t.stateNode.containerInfo.firstChild),xt=t,Ie=!0,Pt=null,r=Jd(t,null,s,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(mn(),s===l){t=Yt(e,t,r);break e}st(e,t,s,r)}t=t.child}return t;case 5:return nc(t),e===null&&Xl(t),s=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,u=l.children,Wl(s,l)?u=null:i!==null&&Wl(s,i)&&(t.flags|=32),Tc(e,t),st(e,t,u,r),t.child;case 6:return e===null&&Xl(t),null;case 13:return Uc(e,t,r);case 4:return aa(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=hn(t,null,s,r):st(e,t,s,r),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),Dc(e,t,s,l,r);case 7:return st(e,t,t.pendingProps,r),t.child;case 8:return st(e,t,t.pendingProps.children,r),t.child;case 12:return st(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,i=t.memoizedProps,u=l.value,Le(io,s._currentValue),s._currentValue=u,i!==null)if(_t(i.value,u)){if(i.children===l.children&&!lt.current){t=Yt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var g=i.dependencies;if(g!==null){u=i.child;for(var y=g.firstContext;y!==null;){if(y.context===s){if(i.tag===1){y=Zt(-1,r&-r),y.tag=2;var z=i.updateQueue;if(z!==null){z=z.shared;var B=z.pending;B===null?y.next=y:(y.next=B.next,B.next=y),z.pending=y}}i.lanes|=r,y=i.alternate,y!==null&&(y.lanes|=r),sa(i.return,r,t),g.lanes|=r;break}y=y.next}}else if(i.tag===10)u=i.type===t.type?null:i.child;else if(i.tag===18){if(u=i.return,u===null)throw Error(a(341));u.lanes|=r,g=u.alternate,g!==null&&(g.lanes|=r),sa(u,r,t),u=i.sibling}else u=i.child;if(u!==null)u.return=i;else for(u=i;u!==null;){if(u===t){u=null;break}if(i=u.sibling,i!==null){i.return=u.return,u=i;break}u=u.return}i=u}st(e,t,l.children,r),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,gn(t,r),l=jt(l),s=s(l),t.flags|=1,st(e,t,s,r),t.child;case 14:return s=t.type,l=Mt(s,t.pendingProps),l=Mt(s.type,l),Lc(e,t,s,l,r);case 15:return Ac(e,t,t.type,t.pendingProps,r);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Mt(s,l),wo(e,t),t.tag=1,at(s)?(e=!0,ro(t)):e=!1,gn(t,r),Cc(t,s,l),ba(t,s,l,r),Na(null,t,s,!0,e,r);case 19:return Vc(e,t,r);case 22:return Oc(e,t,r)}throw Error(a(156,t.tag))};function pu(e,t){return Gi(e,t)}function Im(e,t,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function St(e,t,r,s){return new Im(e,t,r,s)}function Wa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fm(e){if(typeof e=="function")return Wa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ce)return 11;if(e===Re)return 14}return 2}function br(e,t){var r=e.alternate;return r===null?(r=St(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function zo(e,t,r,s,l,i){var u=2;if(s=e,typeof e=="function")Wa(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case $:return $r(r.children,l,i,t);case ne:u=8,l|=8;break;case se:return e=St(12,r,t,l|2),e.elementType=se,e.lanes=i,e;case Me:return e=St(13,r,t,l),e.elementType=Me,e.lanes=i,e;case Pe:return e=St(19,r,t,l),e.elementType=Pe,e.lanes=i,e;case Ne:return Do(r,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case X:u=10;break e;case be:u=9;break e;case ce:u=11;break e;case Re:u=14;break e;case Se:u=16,s=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=St(u,r,t,l),t.elementType=e,t.type=s,t.lanes=i,t}function $r(e,t,r,s){return e=St(7,e,s,t),e.lanes=r,e}function Do(e,t,r,s){return e=St(22,e,s,t),e.elementType=Ne,e.lanes=r,e.stateNode={isHidden:!1},e}function Ha(e,t,r){return e=St(6,e,null,t),e.lanes=r,e}function Ga(e,t,r){return t=St(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $m(e,t,r,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yl(0),this.expirationTimes=yl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yl(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ka(e,t,r,s,l,i,u,g,y){return e=new $m(e,t,r,g,y),t===1?(t=1,i===!0&&(t|=8)):t=0,i=St(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},la(i),e}function Um(e,t,r){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(d){console.error(d)}}return o(),Xa.exports=Xm(),Xa.exports}var Eu;function eh(){if(Eu)return $o;Eu=1;var o=nf();return $o.createRoot=o.createRoot,$o.hydrateRoot=o.hydrateRoot,$o}var th=eh();const rh=tf(th);/** +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function ba(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function wa(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var bm=typeof WeakMap=="function"?WeakMap:Map;function Ec(e,t,r){r=Yt(-1,r),r.tag=3,r.payload={element:null};var s=t.value;return r.callback=function(){So||(So=!0,Oa=s),wa(e,t)},r}function _c(e,t,r){r=Yt(-1,r),r.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var l=t.value;r.payload=function(){return s(l)},r.callback=function(){wa(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){wa(e,t),typeof s!="function"&&(gr===null?gr=new Set([this]):gr.add(this));var u=t.stack;this.componentDidCatch(t.value,{componentStack:u!==null?u:""})}),r}function Pc(e,t,r){var s=e.pingCache;if(s===null){s=e.pingCache=new bm;var l=new Set;s.set(t,l)}else l=s.get(t),l===void 0&&(l=new Set,s.set(t,l));l.has(r)||(l.add(r),e=Lm.bind(null,e,t,r),t.then(e,e))}function Mc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Rc(e,t,r,s,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Yt(-1,1),t.tag=2,hr(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var wm=Y.ReactCurrentOwner,it=!1;function st(e,t,r,s){t.child=e===null?Yd(t,null,r,s):hn(t,e.child,r,s)}function zc(e,t,r,s,l){r=r.render;var i=t.ref;return gn(t,l),s=fa(e,t,r,s,i,l),r=pa(),e!==null&&!it?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Jt(e,t,l)):(Ie&&r&&ql(t),t.flags|=1,st(e,t,s,l),t.child)}function Dc(e,t,r,s,l){if(e===null){var i=r.type;return typeof i=="function"&&!Va(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,Lc(e,t,i,s,l)):(e=Ro(r.type,null,s,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,(e.lanes&l)===0){var u=i.memoizedProps;if(r=r.compare,r=r!==null?r:Xn,r(u,s)&&e.ref===t.ref)return Jt(e,t,l)}return t.flags|=1,e=wr(i,s),e.ref=t.ref,e.return=t,t.child=e}function Lc(e,t,r,s,l){if(e!==null){var i=e.memoizedProps;if(Xn(i,s)&&e.ref===t.ref)if(it=!1,t.pendingProps=s=i,(e.lanes&l)!==0)(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Jt(e,t,l)}return ja(e,t,r,s,l)}function Ac(e,t,r){var s=t.pendingProps,l=s.children,i=e!==null?e.memoizedState:null;if(s.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Le(wn,yt),yt|=r;else{if((r&1073741824)===0)return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Le(wn,yt),yt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:r,Le(wn,yt),yt|=s}else i!==null?(s=i.baseLanes|r,t.memoizedState=null):s=r,Le(wn,yt),yt|=s;return st(e,t,l,r),t.child}function Oc(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function ja(e,t,r,s,l){var i=at(r)?Mr:et.current;return i=un(t,i),gn(t,l),r=fa(e,t,r,s,i,l),s=pa(),e!==null&&!it?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Jt(e,t,l)):(Ie&&s&&ql(t),t.flags|=1,st(e,t,r,l),t.child)}function Tc(e,t,r,s,l){if(at(r)){var i=!0;to(t)}else i=!1;if(gn(t,l),t.stateNode===null)bo(e,t),Sc(t,r,s),ya(t,r,s,l),s=!0;else if(e===null){var u=t.stateNode,g=t.memoizedProps;u.props=g;var y=u.context,z=r.contextType;typeof z=="object"&&z!==null?z=kt(z):(z=at(r)?Mr:et.current,z=un(t,z));var B=r.getDerivedStateFromProps,W=typeof B=="function"||typeof u.getSnapshotBeforeUpdate=="function";W||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==s||y!==z)&&Cc(t,u,s,z),mr=!1;var U=t.memoizedState;u.state=U,uo(t,s,u,l),y=t.memoizedState,g!==s||U!==y||lt.current||mr?(typeof B=="function"&&(va(t,r,B,s),y=t.memoizedState),(g=mr||Nc(t,r,g,s,U,y,z))?(W||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=y),u.props=s,u.state=y,u.context=z,s=g):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Xd(e,t),g=t.memoizedProps,z=t.type===t.elementType?g:Rt(t.type,g),u.props=z,W=t.pendingProps,U=u.context,y=r.contextType,typeof y=="object"&&y!==null?y=kt(y):(y=at(r)?Mr:et.current,y=un(t,y));var te=r.getDerivedStateFromProps;(B=typeof te=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==W||U!==y)&&Cc(t,u,s,y),mr=!1,U=t.memoizedState,u.state=U,uo(t,s,u,l);var ie=t.memoizedState;g!==W||U!==ie||lt.current||mr?(typeof te=="function"&&(va(t,r,te,s),ie=t.memoizedState),(z=mr||Nc(t,r,z,s,U,ie,y)||!1)?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,ie,y),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,ie,y)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=ie),u.props=s,u.state=ie,u.context=y,s=z):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),s=!1)}return ka(e,t,r,s,i,l)}function ka(e,t,r,s,l,i){Oc(e,t);var u=(t.flags&128)!==0;if(!s&&!u)return l&&Bd(t,r,!1),Jt(e,t,i);s=t.stateNode,wm.current=t;var g=u&&typeof r.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&u?(t.child=hn(t,e.child,null,i),t.child=hn(t,null,g,i)):st(e,t,g,i),t.memoizedState=s.state,l&&Bd(t,r,!0),t.child}function Ic(e){var t=e.stateNode;t.pendingContext?$d(e,t.pendingContext,t.pendingContext!==t.context):t.context&&$d(e,t.context,!1),la(e,t.containerInfo)}function Fc(e,t,r,s,l){return mn(),Xl(l),t.flags|=256,st(e,t,r,s),t.child}var Na={dehydrated:null,treeContext:null,retryLane:0};function Sa(e){return{baseLanes:e,cachePool:null,transitions:null}}function $c(e,t,r){var s=t.pendingProps,l=Fe.current,i=!1,u=(t.flags&128)!==0,g;if((g=u)||(g=e!==null&&e.memoizedState===null?!1:(l&2)!==0),g?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Le(Fe,l&1),e===null)return Jl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(u=s.children,e=s.fallback,i?(s=t.mode,i=t.child,u={mode:"hidden",children:u},(s&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=u):i=zo(u,s,0,null),e=$r(e,s,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Sa(r),t.memoizedState=Na,e):Ca(t,u));if(l=e.memoizedState,l!==null&&(g=l.dehydrated,g!==null))return jm(e,t,u,s,g,l,r);if(i){i=s.fallback,u=t.mode,l=e.child,g=l.sibling;var y={mode:"hidden",children:s.children};return(u&1)===0&&t.child!==l?(s=t.child,s.childLanes=0,s.pendingProps=y,t.deletions=null):(s=wr(l,y),s.subtreeFlags=l.subtreeFlags&14680064),g!==null?i=wr(g,i):(i=$r(i,u,r,null),i.flags|=2),i.return=t,s.return=t,s.sibling=i,t.child=s,s=i,i=t.child,u=e.child.memoizedState,u=u===null?Sa(r):{baseLanes:u.baseLanes|r,cachePool:null,transitions:u.transitions},i.memoizedState=u,i.childLanes=e.childLanes&~r,t.memoizedState=Na,s}return i=e.child,e=i.sibling,s=wr(i,{mode:"visible",children:s.children}),(t.mode&1)===0&&(s.lanes=r),s.return=t,s.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=s,t.memoizedState=null,s}function Ca(e,t){return t=zo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function yo(e,t,r,s){return s!==null&&Xl(s),hn(t,e.child,null,r),e=Ca(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jm(e,t,r,s,l,i,u){if(r)return t.flags&256?(t.flags&=-257,s=ba(Error(a(422))),yo(e,t,u,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,l=t.mode,s=zo({mode:"visible",children:s.children},l,0,null),i=$r(i,l,u,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,(t.mode&1)!==0&&hn(t,e.child,null,u),t.child.memoizedState=Sa(u),t.memoizedState=Na,i);if((t.mode&1)===0)return yo(e,t,u,null);if(l.data==="$!"){if(s=l.nextSibling&&l.nextSibling.dataset,s)var g=s.dgst;return s=g,i=Error(a(419)),s=ba(i,s,void 0),yo(e,t,u,s)}if(g=(u&e.childLanes)!==0,it||g){if(s=Qe,s!==null){switch(u&-u){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=(l&(s.suspendedLanes|u))!==0?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,Zt(e,l),Lt(s,e,l,-1))}return Ba(),s=ba(Error(a(421))),yo(e,t,u,s)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Am.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,vt=cr(l.nextSibling),gt=t,Ie=!0,Mt=null,e!==null&&(wt[jt++]=Qt,wt[jt++]=qt,wt[jt++]=Rr,Qt=e.id,qt=e.overflow,Rr=t),t=Ca(t,s.children),t.flags|=4096,t)}function Uc(e,t,r){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),na(e.return,t,r)}function Ea(e,t,r,s,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=r,i.tailMode=l)}function Bc(e,t,r){var s=t.pendingProps,l=s.revealOrder,i=s.tail;if(st(e,t,s.children,r),s=Fe.current,(s&2)!==0)s=s&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Uc(e,r,t);else if(e.tag===19)Uc(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(Le(Fe,s),(t.mode&1)===0)t.memoizedState=null;else switch(l){case"forwards":for(r=t.child,l=null;r!==null;)e=r.alternate,e!==null&&fo(e)===null&&(l=r),r=r.sibling;r=l,r===null?(l=t.child,t.child=null):(l=r.sibling,r.sibling=null),Ea(t,!1,l,r,i);break;case"backwards":for(r=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&fo(e)===null){t.child=l;break}e=l.sibling,l.sibling=r,r=l,l=e}Ea(t,!0,r,null,i);break;case"together":Ea(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function bo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Jt(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Or|=t.lanes,(r&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,r=wr(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=wr(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function km(e,t,r){switch(t.tag){case 3:Ic(t),mn();break;case 5:rc(t);break;case 1:at(t.type)&&to(t);break;case 4:la(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,l=t.memoizedProps.value;Le(ao,s._currentValue),s._currentValue=l;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(Le(Fe,Fe.current&1),t.flags|=128,null):(r&t.child.childLanes)!==0?$c(e,t,r):(Le(Fe,Fe.current&1),e=Jt(e,t,r),e!==null?e.sibling:null);Le(Fe,Fe.current&1);break;case 19:if(s=(r&t.childLanes)!==0,(e.flags&128)!==0){if(s)return Bc(e,t,r);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Le(Fe,Fe.current),s)break;return null;case 22:case 23:return t.lanes=0,Ac(e,t,r)}return Jt(e,t,r)}var Vc,_a,Wc,Hc;Vc=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},_a=function(){},Wc=function(e,t,r,s){var l=e.memoizedProps;if(l!==s){e=t.stateNode,Lr(It.current);var i=null;switch(r){case"input":l=mt(e,l),s=mt(e,s),i=[];break;case"select":l=K({},l,{value:void 0}),s=K({},s,{value:void 0}),i=[];break;case"textarea":l=Jr(e,l),s=Jr(e,s),i=[];break;default:typeof l.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Js)}il(r,s);var u;r=null;for(z in l)if(!s.hasOwnProperty(z)&&l.hasOwnProperty(z)&&l[z]!=null)if(z==="style"){var g=l[z];for(u in g)g.hasOwnProperty(u)&&(r||(r={}),r[u]="")}else z!=="dangerouslySetInnerHTML"&&z!=="children"&&z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&z!=="autoFocus"&&(f.hasOwnProperty(z)?i||(i=[]):(i=i||[]).push(z,null));for(z in s){var y=s[z];if(g=l!=null?l[z]:void 0,s.hasOwnProperty(z)&&y!==g&&(y!=null||g!=null))if(z==="style")if(g){for(u in g)!g.hasOwnProperty(u)||y&&y.hasOwnProperty(u)||(r||(r={}),r[u]="");for(u in y)y.hasOwnProperty(u)&&g[u]!==y[u]&&(r||(r={}),r[u]=y[u])}else r||(i||(i=[]),i.push(z,r)),r=y;else z==="dangerouslySetInnerHTML"?(y=y?y.__html:void 0,g=g?g.__html:void 0,y!=null&&g!==y&&(i=i||[]).push(z,y)):z==="children"?typeof y!="string"&&typeof y!="number"||(i=i||[]).push(z,""+y):z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&(f.hasOwnProperty(z)?(y!=null&&z==="onScroll"&&Ae("scroll",e),i||g===y||(i=[])):(i=i||[]).push(z,y))}r&&(i=i||[]).push("style",r);var z=i;(t.updateQueue=z)&&(t.flags|=4)}},Hc=function(e,t,r,s){r!==s&&(t.flags|=4)};function ms(e,t){if(!Ie)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,s=0;if(t)for(var l=e.child;l!==null;)r|=l.lanes|l.childLanes,s|=l.subtreeFlags&14680064,s|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)r|=l.lanes|l.childLanes,s|=l.subtreeFlags,s|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=s,e.childLanes=r,t}function Nm(e,t,r){var s=t.pendingProps;switch(Zl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rt(t),null;case 1:return at(t.type)&&eo(),rt(t),null;case 3:return s=t.stateNode,vn(),Oe(lt),Oe(et),da(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(oo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Mt!==null&&(Fa(Mt),Mt=null))),_a(e,t),rt(t),null;case 5:aa(t);var l=Lr(ds.current);if(r=t.type,e!==null&&t.stateNode!=null)Wc(e,t,r,s,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(a(166));return rt(t),null}if(e=Lr(It.current),oo(t)){s=t.stateNode,r=t.type;var i=t.memoizedProps;switch(s[Tt]=t,s[ss]=i,e=(t.mode&1)!==0,r){case"dialog":Ae("cancel",s),Ae("close",s);break;case"iframe":case"object":case"embed":Ae("load",s);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=u.createElement(r,{is:s.is}):(e=u.createElement(r),r==="select"&&(u=e,s.multiple?u.multiple=!0:s.size&&(u.size=s.size))):e=u.createElementNS(e,r),e[Tt]=t,e[ss]=s,Vc(e,t,!1,!1),t.stateNode=e;e:{switch(u=dl(r,s),r){case"dialog":Ae("cancel",e),Ae("close",e),l=s;break;case"iframe":case"object":case"embed":Ae("load",e),l=s;break;case"video":case"audio":for(l=0;ljn&&(t.flags|=128,s=!0,ms(i,!1),t.lanes=4194304)}else{if(!s)if(e=fo(u),e!==null){if(t.flags|=128,s=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),ms(i,!0),i.tail===null&&i.tailMode==="hidden"&&!u.alternate&&!Ie)return rt(t),null}else 2*Be()-i.renderingStartTime>jn&&r!==1073741824&&(t.flags|=128,s=!0,ms(i,!1),t.lanes=4194304);i.isBackwards?(u.sibling=t.child,t.child=u):(r=i.last,r!==null?r.sibling=u:t.child=u,i.last=u)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Be(),t.sibling=null,r=Fe.current,Le(Fe,s?r&1|2:r&1),t):(rt(t),null);case 22:case 23:return Ua(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&(t.mode&1)!==0?(yt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Sm(e,t){switch(Zl(t),t.tag){case 1:return at(t.type)&&eo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vn(),Oe(lt),Oe(et),da(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return aa(t),null;case 13:if(Oe(Fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oe(Fe),null;case 4:return vn(),null;case 10:return ra(t.type._context),null;case 22:case 23:return Ua(),null;case 24:return null;default:return null}}var wo=!1,nt=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,le=null;function bn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){Ue(e,t,s)}else r.current=null}function Pa(e,t,r){try{r()}catch(s){Ue(e,t,s)}}var Gc=!1;function Em(e,t){if(Ul=$s,e=Nd(),Dl(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var l=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var u=0,g=-1,y=-1,z=0,B=0,W=e,U=null;t:for(;;){for(var te;W!==r||l!==0&&W.nodeType!==3||(g=u+l),W!==i||s!==0&&W.nodeType!==3||(y=u+s),W.nodeType===3&&(u+=W.nodeValue.length),(te=W.firstChild)!==null;)U=W,W=te;for(;;){if(W===e)break t;if(U===r&&++z===l&&(g=u),U===i&&++B===s&&(y=u),(te=W.nextSibling)!==null)break;W=U,U=W.parentNode}W=te}r=g===-1||y===-1?null:{start:g,end:y}}else r=null}r=r||{start:0,end:0}}else r=null;for(Bl={focusedElem:e,selectionRange:r},$s=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var de=ie.memoizedProps,Ve=ie.memoizedState,_=t.stateNode,k=_.getSnapshotBeforeUpdate(t.elementType===t.type?de:Rt(t.type,de),Ve);_.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var M=t.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(q){Ue(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ie=Gc,Gc=!1,ie}function hs(e,t,r){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Pa(t,r,i)}l=l.next}while(l!==s)}}function jo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var s=r.create;r.destroy=s()}r=r.next}while(r!==t)}}function Ma(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Kc(e){var t=e.alternate;t!==null&&(e.alternate=null,Kc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tt],delete t[ss],delete t[Gl],delete t[dm],delete t[cm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Qc(e){return e.tag===5||e.tag===3||e.tag===4}function qc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ra(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Js));else if(s!==4&&(e=e.child,e!==null))for(Ra(e,t,r),e=e.sibling;e!==null;)Ra(e,t,r),e=e.sibling}function za(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(za(e,t,r),e=e.sibling;e!==null;)za(e,t,r),e=e.sibling}var Ze=null,zt=!1;function xr(e,t,r){for(r=r.child;r!==null;)Zc(e,t,r),r=r.sibling}function Zc(e,t,r){if(Ot&&typeof Ot.onCommitFiberUnmount=="function")try{Ot.onCommitFiberUnmount(Ls,r)}catch{}switch(r.tag){case 5:nt||bn(r,t);case 6:var s=Ze,l=zt;Ze=null,xr(e,t,r),Ze=s,zt=l,Ze!==null&&(zt?(e=Ze,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ze.removeChild(r.stateNode));break;case 18:Ze!==null&&(zt?(e=Ze,r=r.stateNode,e.nodeType===8?Hl(e.parentNode,r):e.nodeType===1&&Hl(e,r),Kn(e)):Hl(Ze,r.stateNode));break;case 4:s=Ze,l=zt,Ze=r.stateNode.containerInfo,zt=!0,xr(e,t,r),Ze=s,zt=l;break;case 0:case 11:case 14:case 15:if(!nt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var i=l,u=i.destroy;i=i.tag,u!==void 0&&((i&2)!==0||(i&4)!==0)&&Pa(r,t,u),l=l.next}while(l!==s)}xr(e,t,r);break;case 1:if(!nt&&(bn(r,t),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(g){Ue(r,t,g)}xr(e,t,r);break;case 21:xr(e,t,r);break;case 22:r.mode&1?(nt=(s=nt)||r.memoizedState!==null,xr(e,t,r),nt=s):xr(e,t,r);break;default:xr(e,t,r)}}function Yc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Cm),t.forEach(function(s){var l=Om.bind(null,e,s);r.has(s)||(r.add(s),s.then(l,l))})}}function Dt(e,t){var r=t.deletions;if(r!==null)for(var s=0;sl&&(l=u),s&=~i}if(s=l,s=Be()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Pm(s/1960))-s,10e?16:e,vr===null)var s=!1;else{if(e=vr,vr=null,Eo=0,(Ee&6)!==0)throw Error(a(331));var l=Ee;for(Ee|=4,le=e.current;le!==null;){var i=le,u=i.child;if((le.flags&16)!==0){var g=i.deletions;if(g!==null){for(var y=0;yBe()-Aa?Ir(e,0):La|=r),ct(e,t)}function cu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Os,Os<<=1,(Os&130023424)===0&&(Os=4194304)));var r=ot();e=Zt(e,t),e!==null&&(Bn(e,t,r),ct(e,r))}function Am(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),cu(e,r)}function Om(e,t){var r=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(r=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(a(314))}s!==null&&s.delete(t),cu(e,r)}var uu;uu=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)it=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return it=!1,km(e,t,r);it=(e.flags&131072)!==0}else it=!1,Ie&&(t.flags&1048576)!==0&&Wd(t,so,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;bo(e,t),e=t.pendingProps;var l=un(t,et.current);gn(t,r),l=fa(null,t,s,e,l,r);var i=pa();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,at(s)?(i=!0,to(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,oa(t),l.updater=vo,t.stateNode=l,l._reactInternals=t,ya(t,s,e,r),t=ka(null,t,s,!0,i,r)):(t.tag=0,Ie&&i&&ql(t),st(null,t,l,r),t=t.child),t;case 16:s=t.elementType;e:{switch(bo(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=Im(s),e=Rt(s,e),l){case 0:t=ja(null,t,s,e,r);break e;case 1:t=Tc(null,t,s,e,r);break e;case 11:t=zc(null,t,s,e,r);break e;case 14:t=Dc(null,t,s,Rt(s.type,e),r);break e}throw Error(a(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),ja(e,t,s,l,r);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),Tc(e,t,s,l,r);case 3:e:{if(Ic(t),e===null)throw Error(a(387));s=t.pendingProps,i=t.memoizedState,l=i.element,Xd(e,t),uo(t,s,null,r);var u=t.memoizedState;if(s=u.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=yn(Error(a(423)),t),t=Fc(e,t,s,r,l);break e}else if(s!==l){l=yn(Error(a(424)),t),t=Fc(e,t,s,r,l);break e}else for(vt=cr(t.stateNode.containerInfo.firstChild),gt=t,Ie=!0,Mt=null,r=Yd(t,null,s,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(mn(),s===l){t=Jt(e,t,r);break e}st(e,t,s,r)}t=t.child}return t;case 5:return rc(t),e===null&&Jl(t),s=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,u=l.children,Vl(s,l)?u=null:i!==null&&Vl(s,i)&&(t.flags|=32),Oc(e,t),st(e,t,u,r),t.child;case 6:return e===null&&Jl(t),null;case 13:return $c(e,t,r);case 4:return la(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=hn(t,null,s,r):st(e,t,s,r),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),zc(e,t,s,l,r);case 7:return st(e,t,t.pendingProps,r),t.child;case 8:return st(e,t,t.pendingProps.children,r),t.child;case 12:return st(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,i=t.memoizedProps,u=l.value,Le(ao,s._currentValue),s._currentValue=u,i!==null)if(Pt(i.value,u)){if(i.children===l.children&&!lt.current){t=Jt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var g=i.dependencies;if(g!==null){u=i.child;for(var y=g.firstContext;y!==null;){if(y.context===s){if(i.tag===1){y=Yt(-1,r&-r),y.tag=2;var z=i.updateQueue;if(z!==null){z=z.shared;var B=z.pending;B===null?y.next=y:(y.next=B.next,B.next=y),z.pending=y}}i.lanes|=r,y=i.alternate,y!==null&&(y.lanes|=r),na(i.return,r,t),g.lanes|=r;break}y=y.next}}else if(i.tag===10)u=i.type===t.type?null:i.child;else if(i.tag===18){if(u=i.return,u===null)throw Error(a(341));u.lanes|=r,g=u.alternate,g!==null&&(g.lanes|=r),na(u,r,t),u=i.sibling}else u=i.child;if(u!==null)u.return=i;else for(u=i;u!==null;){if(u===t){u=null;break}if(i=u.sibling,i!==null){i.return=u.return,u=i;break}u=u.return}i=u}st(e,t,l.children,r),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,gn(t,r),l=kt(l),s=s(l),t.flags|=1,st(e,t,s,r),t.child;case 14:return s=t.type,l=Rt(s,t.pendingProps),l=Rt(s.type,l),Dc(e,t,s,l,r);case 15:return Lc(e,t,t.type,t.pendingProps,r);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),bo(e,t),t.tag=1,at(s)?(e=!0,to(t)):e=!1,gn(t,r),Sc(t,s,l),ya(t,s,l,r),ka(null,t,s,!0,e,r);case 19:return Bc(e,t,r);case 22:return Ac(e,t,r)}throw Error(a(156,t.tag))};function fu(e,t){return Hi(e,t)}function Tm(e,t,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ct(e,t,r,s){return new Tm(e,t,r,s)}function Va(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Im(e){if(typeof e=="function")return Va(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ce)return 11;if(e===Re)return 14}return 2}function wr(e,t){var r=e.alternate;return r===null?(r=Ct(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ro(e,t,r,s,l,i){var u=2;if(s=e,typeof e=="function")Va(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case $:return $r(r.children,l,i,t);case ne:u=8,l|=8;break;case se:return e=Ct(12,r,t,l|2),e.elementType=se,e.lanes=i,e;case Me:return e=Ct(13,r,t,l),e.elementType=Me,e.lanes=i,e;case Pe:return e=Ct(19,r,t,l),e.elementType=Pe,e.lanes=i,e;case Ne:return zo(r,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case X:u=10;break e;case be:u=9;break e;case ce:u=11;break e;case Re:u=14;break e;case Se:u=16,s=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=Ct(u,r,t,l),t.elementType=e,t.type=s,t.lanes=i,t}function $r(e,t,r,s){return e=Ct(7,e,s,t),e.lanes=r,e}function zo(e,t,r,s){return e=Ct(22,e,s,t),e.elementType=Ne,e.lanes=r,e.stateNode={isHidden:!1},e}function Wa(e,t,r){return e=Ct(6,e,null,t),e.lanes=r,e}function Ha(e,t,r){return t=Ct(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Fm(e,t,r,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vl(0),this.expirationTimes=vl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vl(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ga(e,t,r,s,l,i,u,g,y){return e=new Fm(e,t,r,g,y),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ct(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},oa(i),e}function $m(e,t,r){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(d){console.error(d)}}return o(),Ja.exports=Jm(),Ja.exports}var Cu;function Xm(){if(Cu)return Fo;Cu=1;var o=rf();return Fo.createRoot=o.createRoot,Fo.hydrateRoot=o.hydrateRoot,Fo}var eh=Xm();const th=ef(eh);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nh=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sf=(...o)=>o.filter((d,a,c)=>!!d&&d.trim()!==""&&c.indexOf(d)===a).join(" ").trim();/** + */const rh=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nf=(...o)=>o.filter((d,a,c)=>!!d&&d.trim()!==""&&c.indexOf(d)===a).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var sh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var nh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oh=p.forwardRef(({color:o="currentColor",size:d=24,strokeWidth:a=2,absoluteStrokeWidth:c,className:f="",children:m,iconNode:h,...x},C)=>p.createElement("svg",{ref:C,...sh,width:d,height:d,stroke:o,strokeWidth:c?Number(a)*24/Number(d):a,className:sf("lucide",f),...x},[...h.map(([b,j])=>p.createElement(b,j)),...Array.isArray(m)?m:[m]]));/** + */const sh=p.forwardRef(({color:o="currentColor",size:d=24,strokeWidth:a=2,absoluteStrokeWidth:c,className:f="",children:m,iconNode:h,...x},S)=>p.createElement("svg",{ref:S,...nh,width:d,height:d,stroke:o,strokeWidth:c?Number(a)*24/Number(d):a,className:nf("lucide",f),...x},[...h.map(([b,j])=>p.createElement(b,j)),...Array.isArray(m)?m:[m]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ve=(o,d)=>{const a=p.forwardRef(({className:c,...f},m)=>p.createElement(oh,{ref:m,iconNode:d,className:sf(`lucide-${nh(o)}`,c),...f}));return a.displayName=`${o}`,a};/** + */const ve=(o,d)=>{const a=p.forwardRef(({className:c,...f},m)=>p.createElement(sh,{ref:m,iconNode:d,className:nf(`lucide-${rh(o)}`,c),...f}));return a.displayName=`${o}`,a};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xo=ve("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const Jo=ve("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _u=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const Eu=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const of=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + */const sf=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ss=ve("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 Ns=ve("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. * See the LICENSE file in the root directory of this source tree. - */const lh=ve("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const oh=ve("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cs=ve("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 Ss=ve("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. * See the LICENSE file in the root directory of this source tree. - */const Dn=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const zn=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ah=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const lh=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ih=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const ah=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dh=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const ih=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ch=ve("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + */const dh=ve("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uh=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const ch=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fh=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const uh=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mi=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + */const pi=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ph=ve("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** + */const fh=ve("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mh=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** + */const ph=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hi=ve("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const mi=ve("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hh=ve("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** + */const mh=ve("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lf=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const of=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yt=ve("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const bt=ve("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -167,72 +167,72 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const el=ve("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 Xo=ve("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. * See the LICENSE file in the root directory of this source tree. - */const Pu=ve("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + */const _u=ve("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xi=ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const hi=ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xh=ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + */const hh=ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gh=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const xh=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gi=ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + */const xi=ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vh=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const gh=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yh=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + */const vh=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Es=ve("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 Cs=ve("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. * See the LICENSE file in the root directory of this source tree. - */const bh=ve("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + */const yh=ve("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wh=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + */const bh=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jh=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + */const wh=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const af=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const lf=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const df=ve("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + */const af=ve("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -242,27 +242,27 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kh=ve("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + */const jh=ve("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Nh=ve("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + */const kh=ve("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _i=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const Ei=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Sh=ve("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + */const Nh=ve("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ch=ve("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + */const Sh=ve("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -272,52 +272,52 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Eh=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + */const Ch=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cf=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + */const df=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _h=ve("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + */const Eh=ve("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tl=ve("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const el=ve("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. * See the LICENSE file in the root directory of this source tree. - */const vi=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const gi=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ph=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const _h=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Mh=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + */const Ph=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rl=ve("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 tl=ve("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. * See the LICENSE file in the root directory of this source tree. - */const Gr=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),yi=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:bh},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:lh},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:yt},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Cs},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:jh},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Ss},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:uh}];var Mu=1,Rh=.9,zh=.8,Dh=.17,ri=.1,ni=.999,Lh=.9999,Ah=.99,Oh=/[\\\/_+.#"@\[\(\{&]/,Th=/[\\\/_+.#"@\[\(\{&]/g,Ih=/[\s-]/,uf=/[\s-]/g;function bi(o,d,a,c,f,m,h){if(m===d.length)return f===o.length?Mu:Ah;var x=`${f},${m}`;if(h[x]!==void 0)return h[x];for(var C=c.charAt(m),b=a.indexOf(C,f),j=0,P,L,F,A;b>=0;)P=bi(o,d,a,c,b+1,m+1,h),P>j&&(b===f?P*=Mu:Oh.test(o.charAt(b-1))?(P*=zh,F=o.slice(f,b-1).match(Th),F&&f>0&&(P*=Math.pow(ni,F.length))):Ih.test(o.charAt(b-1))?(P*=Rh,A=o.slice(f,b-1).match(uf),A&&f>0&&(P*=Math.pow(ni,A.length))):(P*=Dh,f>0&&(P*=Math.pow(ni,b-f))),o.charAt(b)!==d.charAt(m)&&(P*=Lh)),(PP&&(P=L*ri)),P>j&&(j=P),b=a.indexOf(C,b+1);return h[x]=j,j}function Ru(o){return o.toLowerCase().replace(uf," ")}function Fh(o,d,a){return o=a&&a.length>0?`${o+" "+a.join(" ")}`:o,bi(o,d,Ru(o),Ru(d),0,0,{})}function Cr(o,d,{checkForDefaultPrevented:a=!0}={}){return function(f){if(o==null||o(f),a===!1||!f.defaultPrevented)return d==null?void 0:d(f)}}function zu(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Ln(...o){return d=>{let a=!1;const c=o.map(f=>{const m=zu(f,d);return!a&&typeof m=="function"&&(a=!0),m});if(a)return()=>{for(let f=0;f{var E;const{scope:L,children:F,...A}=P,N=((E=L==null?void 0:L[o])==null?void 0:E[C])||x,S=p.useMemo(()=>A,Object.values(A));return n.jsx(N.Provider,{value:S,children:F})};b.displayName=m+"Provider";function j(P,L){var N;const F=((N=L==null?void 0:L[o])==null?void 0:N[C])||x,A=p.useContext(F);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${P}\` must be used within \`${m}\``)}return[b,j]}const f=()=>{const m=a.map(h=>p.createContext(h));return function(x){const C=(x==null?void 0:x[o])||m;return p.useMemo(()=>({[`__scope${o}`]:{...x,[o]:C}}),[x,C])}};return f.scopeName=o,[c,Uh(f,...d)]}function Uh(...o){const d=o[0];if(o.length===1)return d;const a=()=>{const c=o.map(f=>({useScope:f(),scopeName:f.scopeName}));return function(m){const h=c.reduce((x,{useScope:C,scopeName:b})=>{const P=C(m)[`__scope${b}`];return{...x,...P}},{});return p.useMemo(()=>({[`__scope${d.scopeName}`]:h}),[h])}};return a.scopeName=d.scopeName,a}var _s=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Bh=Ei[" useId ".trim().toString()]||(()=>{}),Vh=0;function er(o){const[d,a]=p.useState(Bh());return _s(()=>{a(c=>c??String(Vh++))},[o]),d?`radix-${d}`:""}var Wh=Ei[" useInsertionEffect ".trim().toString()]||_s;function Hh({prop:o,defaultProp:d,onChange:a=()=>{},caller:c}){const[f,m,h]=Gh({defaultProp:d,onChange:a}),x=o!==void 0,C=x?o:f;{const j=p.useRef(o!==void 0);p.useEffect(()=>{const P=j.current;P!==x&&console.warn(`${c} is changing from ${P?"controlled":"uncontrolled"} to ${x?"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.`),j.current=x},[x,c])}const b=p.useCallback(j=>{var P;if(x){const L=Kh(j)?j(o):j;L!==o&&((P=h.current)==null||P.call(h,L))}else m(j)},[x,o,m,h]);return[C,b]}function Gh({defaultProp:o,onChange:d}){const[a,c]=p.useState(o),f=p.useRef(a),m=p.useRef(d);return Wh(()=>{m.current=d},[d]),p.useEffect(()=>{var h;f.current!==a&&((h=m.current)==null||h.call(m,a),f.current=a)},[a,f]),[a,c,m]}function Kh(o){return typeof o=="function"}var ff=nf();function pf(o){const d=p.forwardRef((a,c)=>{let{children:f,...m}=a,h=null,x=!1;const C=[];Du(f)&&typeof Uo=="function"&&(f=Uo(f._payload)),p.Children.forEach(f,L=>{var F;if(Jh(L)){x=!0;const A=L;let N="child"in A.props?A.props.child:A.props.children;Du(N)&&typeof Uo=="function"&&(N=Uo(N._payload)),h=qh(A,N),C.push((F=h==null?void 0:h.props)==null?void 0:F.children)}else C.push(L)}),h?h=p.cloneElement(h,void 0,C):!x&&p.Children.count(f)===1&&p.isValidElement(f)&&(h=f);const b=h?Yh(h):void 0,j=Qr(c,b);if(!h){if(f||f===0)throw new Error(x?rx(o):tx(o));return f}const P=Zh(m,h.props??{});return h.type!==p.Fragment&&(P.ref=c?j:b),p.cloneElement(h,P)});return d.displayName=`${o}.Slot`,d}var Qh=Symbol.for("radix.slottable"),qh=(o,d)=>{if("child"in o.props){const a=o.props.child;return p.isValidElement(a)?p.cloneElement(a,void 0,o.props.children(a.props.children)):null}return p.isValidElement(d)?d:null};function Zh(o,d){const a={...d};for(const c in d){const f=o[c],m=d[c];/^on[A-Z]/.test(c)?f&&m?a[c]=(...x)=>{const C=m(...x);return f(...x),C}:f&&(a[c]=f):c==="style"?a[c]={...f,...m}:c==="className"&&(a[c]=[f,m].filter(Boolean).join(" "))}return{...o,...a}}function Yh(o){var c,f;let d=(c=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:c.get,a=d&&"isReactWarning"in d&&d.isReactWarning;return a?o.ref:(d=(f=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:f.get,a=d&&"isReactWarning"in d&&d.isReactWarning,a?o.props.ref:o.props.ref||o.ref)}function Jh(o){return p.isValidElement(o)&&typeof o.type=="function"&&"__radixId"in o.type&&o.type.__radixId===Qh}var Xh=Symbol.for("react.lazy");function Du(o){return o!=null&&typeof o=="object"&&"$$typeof"in o&&o.$$typeof===Xh&&"_payload"in o&&ex(o._payload)}function ex(o){return typeof o=="object"&&o!==null&&"then"in o}var tx=o=>`${o} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,rx=o=>`${o} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Uo=Ei[" use ".trim().toString()],nx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=nx.reduce((o,d)=>{const a=pf(`Primitive.${d}`),c=p.forwardRef((f,m)=>{const{asChild:h,...x}=f,C=h?a:d;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(C,{...x,ref:m})});return c.displayName=`Primitive.${d}`,{...o,[d]:c}},{});function sx(o,d){o&&ff.flushSync(()=>o.dispatchEvent(d))}function Ps(o){const d=p.useRef(o);return p.useEffect(()=>{d.current=o}),p.useMemo(()=>((...a)=>{var c;return(c=d.current)==null?void 0:c.call(d,...a)}),[])}function ox(o,d=globalThis==null?void 0:globalThis.document){const a=Ps(o);p.useEffect(()=>{const c=f=>{f.key==="Escape"&&a(f)};return d.addEventListener("keydown",c,{capture:!0}),()=>d.removeEventListener("keydown",c,{capture:!0})},[a,d])}var lx="DismissableLayer",wi="dismissableLayer.update",ax="dismissableLayer.pointerDownOutside",ix="dismissableLayer.focusOutside",Lu,Pi=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),mf=p.forwardRef((o,d)=>{const{disableOutsidePointerEvents:a=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:C,...b}=o,j=p.useContext(Pi),[P,L]=p.useState(null),F=(P==null?void 0:P.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,A]=p.useState({}),N=Qr(d,se=>L(se)),S=Array.from(j.layers),[E]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),D=S.indexOf(E),Z=P?S.indexOf(P):-1,Y=j.layersWithOutsidePointerEventsDisabled.size>0,G=Z>=D,I=p.useRef(!1),$=fx(se=>{const X=se.target;if(!(X instanceof Node))return;const be=[...j.branches].some(ce=>ce.contains(X));!G||be||(m==null||m(se),x==null||x(se),se.defaultPrevented||C==null||C())},{ownerDocument:F,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:j.dismissableSurfaces}),ne=px(se=>{if(c&&I.current)return;const X=se.target;[...j.branches].some(ce=>ce.contains(X))||(h==null||h(se),x==null||x(se),se.defaultPrevented||C==null||C())},F);return ox(se=>{Z===j.layers.size-1&&(f==null||f(se),!se.defaultPrevented&&C&&(se.preventDefault(),C()))},F),p.useEffect(()=>{if(P)return a&&(j.layersWithOutsidePointerEventsDisabled.size===0&&(Lu=F.body.style.pointerEvents,F.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(P)),j.layers.add(P),Au(),()=>{a&&(j.layersWithOutsidePointerEventsDisabled.delete(P),j.layersWithOutsidePointerEventsDisabled.size===0&&(F.body.style.pointerEvents=Lu))}},[P,F,a,j]),p.useEffect(()=>()=>{P&&(j.layers.delete(P),j.layersWithOutsidePointerEventsDisabled.delete(P),Au())},[P,j]),p.useEffect(()=>{const se=()=>A({});return document.addEventListener(wi,se),()=>document.removeEventListener(wi,se)},[]),n.jsx(Je.div,{...b,ref:N,style:{pointerEvents:Y?G?"auto":"none":void 0,...o.style},onFocusCapture:Cr(o.onFocusCapture,ne.onFocusCapture),onBlurCapture:Cr(o.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:Cr(o.onPointerDownCapture,$.onPointerDownCapture)})});mf.displayName=lx;var dx="DismissableLayerBranch",cx=p.forwardRef((o,d)=>{const a=p.useContext(Pi),c=p.useRef(null),f=Qr(d,c);return p.useEffect(()=>{const m=c.current;if(m)return a.branches.add(m),()=>{a.branches.delete(m)}},[a.branches]),n.jsx(Je.div,{...o,ref:f})});cx.displayName=dx;function ux(){const o=p.useContext(Pi),[d,a]=p.useState(null);return p.useEffect(()=>{if(d)return o.dismissableSurfaces.add(d),()=>{o.dismissableSurfaces.delete(d)}},[d,o.dismissableSurfaces]),a}function fx(o,d){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:f,dismissableSurfaces:m}=d,h=Ps(o),x=p.useRef(!1),C=p.useRef(!1),b=p.useRef(new Map),j=p.useRef(()=>{});return p.useEffect(()=>{function P(){C.current=!1,f.current=!1,b.current.clear()}function L(){return Array.from(b.current.values()).some(Boolean)}function F(D){if(!C.current)return;const Z=D.target;Z instanceof Node&&[...m].some(G=>G.contains(Z))||b.current.set(D.type,!0),D.type==="click"&&window.setTimeout(()=>{C.current&&j.current()},0)}function A(D){C.current&&b.current.set(D.type,!1)}const N=D=>{if(D.target&&!x.current){let Z=function(){a.removeEventListener("click",j.current);const G=L();P(),G||hf(ax,h,Y,{discrete:!0})};const Y={originalEvent:D};C.current=!0,f.current=c&&D.button===0,b.current.clear(),!c||D.button!==0?Z():(a.removeEventListener("click",j.current),j.current=Z,a.addEventListener("click",j.current,{once:!0}))}else a.removeEventListener("click",j.current),P();x.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const D of S)a.addEventListener(D,F,!0),a.addEventListener(D,A);const E=window.setTimeout(()=>{a.addEventListener("pointerdown",N)},0);return()=>{window.clearTimeout(E),a.removeEventListener("pointerdown",N),a.removeEventListener("click",j.current);for(const D of S)a.removeEventListener(D,F,!0),a.removeEventListener(D,A)}},[a,h,c,f,m]),{onPointerDownCapture:()=>x.current=!0}}function px(o,d=globalThis==null?void 0:globalThis.document){const a=Ps(o),c=p.useRef(!1);return p.useEffect(()=>{const f=m=>{m.target&&!c.current&&hf(ix,a,{originalEvent:m},{discrete:!1})};return d.addEventListener("focusin",f),()=>d.removeEventListener("focusin",f)},[d,a]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Au(){const o=new CustomEvent(wi);document.dispatchEvent(o)}function hf(o,d,a,{discrete:c}){const f=a.originalEvent.target,m=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:a});d&&f.addEventListener(o,d,{once:!0}),c?sx(f,m):f.dispatchEvent(m)}var si="focusScope.autoFocusOnMount",oi="focusScope.autoFocusOnUnmount",Ou={bubbles:!1,cancelable:!0},mx="FocusScope",xf=p.forwardRef((o,d)=>{const{loop:a=!1,trapped:c=!1,onMountAutoFocus:f,onUnmountAutoFocus:m,...h}=o,[x,C]=p.useState(null),b=Ps(f),j=Ps(m),P=p.useRef(null),L=Qr(d,N=>C(N)),F=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(c){let N=function(Z){if(F.paused||!x)return;const Y=Z.target;x.contains(Y)?P.current=Y:Sr(P.current,{select:!0})},S=function(Z){if(F.paused||!x)return;const Y=Z.relatedTarget;Y!==null&&(x.contains(Y)||Sr(P.current,{select:!0}))},E=function(Z){if(document.activeElement===document.body)for(const G of Z)G.removedNodes.length>0&&Sr(x)};document.addEventListener("focusin",N),document.addEventListener("focusout",S);const D=new MutationObserver(E);return x&&D.observe(x,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",S),D.disconnect()}}},[c,x,F.paused]),p.useEffect(()=>{if(x){Iu.add(F);const N=document.activeElement;if(!x.contains(N)){const E=new CustomEvent(si,Ou);x.addEventListener(si,b),x.dispatchEvent(E),E.defaultPrevented||(hx(bx(gf(x)),{select:!0}),document.activeElement===N&&Sr(x))}return()=>{x.removeEventListener(si,b),setTimeout(()=>{const E=new CustomEvent(oi,Ou);x.addEventListener(oi,j),x.dispatchEvent(E),E.defaultPrevented||Sr(N??document.body,{select:!0}),x.removeEventListener(oi,j),Iu.remove(F)},0)}}},[x,b,j,F]);const A=p.useCallback(N=>{if(!a&&!c||F.paused)return;const S=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,E=document.activeElement;if(S&&E){const D=N.currentTarget,[Z,Y]=xx(D);Z&&Y?!N.shiftKey&&E===Y?(N.preventDefault(),a&&Sr(Z,{select:!0})):N.shiftKey&&E===Z&&(N.preventDefault(),a&&Sr(Y,{select:!0})):E===D&&N.preventDefault()}},[a,c,F.paused]);return n.jsx(Je.div,{tabIndex:-1,...h,ref:L,onKeyDown:A})});xf.displayName=mx;function hx(o,{select:d=!1}={}){const a=document.activeElement;for(const c of o)if(Sr(c,{select:d}),document.activeElement!==a)return}function xx(o){const d=gf(o),a=Tu(d,o),c=Tu(d.reverse(),o);return[a,c]}function gf(o){const d=[],a=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const f=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||f?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)d.push(a.currentNode);return d}function Tu(o,d){for(const a of o)if(!gx(a,{upTo:d}))return a}function gx(o,{upTo:d}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(d!==void 0&&o===d)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function vx(o){return o instanceof HTMLInputElement&&"select"in o}function Sr(o,{select:d=!1}={}){if(o&&o.focus){const a=document.activeElement;o.focus({preventScroll:!0}),o!==a&&vx(o)&&d&&o.select()}}var Iu=yx();function yx(){let o=[];return{add(d){const a=o[0];d!==a&&(a==null||a.pause()),o=Fu(o,d),o.unshift(d)},remove(d){var a;o=Fu(o,d),(a=o[0])==null||a.resume()}}}function Fu(o,d){const a=[...o],c=a.indexOf(d);return c!==-1&&a.splice(c,1),a}function bx(o){return o.filter(d=>d.tagName!=="A")}var wx="Portal",vf=p.forwardRef((o,d)=>{var x;const{container:a,...c}=o,[f,m]=p.useState(!1);_s(()=>m(!0),[]);const h=a||f&&((x=globalThis==null?void 0:globalThis.document)==null?void 0:x.body);return h?ff.createPortal(n.jsx(Je.div,{...c,ref:d}),h):null});vf.displayName=wx;function jx(o,d){return p.useReducer((a,c)=>d[a][c]??a,o)}var sl=o=>{const{present:d,children:a}=o,c=kx(d),f=typeof a=="function"?a({present:c.isPresent}):p.Children.only(a),m=Nx(c.ref,Sx(f));return typeof a=="function"||c.isPresent?p.cloneElement(f,{ref:m}):null};sl.displayName="Presence";function kx(o){const[d,a]=p.useState(),c=p.useRef(null),f=p.useRef(o),m=p.useRef("none"),h=o?"mounted":"unmounted",[x,C]=jx(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const b=Bo(c.current);m.current=x==="mounted"?b:"none"},[x]),_s(()=>{const b=c.current,j=f.current;if(j!==o){const L=m.current,F=Bo(b);o?C("MOUNT"):F==="none"||(b==null?void 0:b.display)==="none"?C("UNMOUNT"):C(j&&L!==F?"ANIMATION_OUT":"UNMOUNT"),f.current=o}},[o,C]),_s(()=>{if(d){let b;const j=d.ownerDocument.defaultView??window,P=F=>{const N=Bo(c.current).includes(CSS.escape(F.animationName));if(F.target===d&&N&&(C("ANIMATION_END"),!f.current)){const S=d.style.animationFillMode;d.style.animationFillMode="forwards",b=j.setTimeout(()=>{d.style.animationFillMode==="forwards"&&(d.style.animationFillMode=S)})}},L=F=>{F.target===d&&(m.current=Bo(c.current))};return d.addEventListener("animationstart",L),d.addEventListener("animationcancel",P),d.addEventListener("animationend",P),()=>{j.clearTimeout(b),d.removeEventListener("animationstart",L),d.removeEventListener("animationcancel",P),d.removeEventListener("animationend",P)}}else C("ANIMATION_END")},[d,C]),{isPresent:["mounted","unmountSuspended"].includes(x),ref:p.useCallback(b=>{c.current=b?getComputedStyle(b):null,a(b)},[])}}function $u(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Nx(...o){const d=p.useRef(o);return d.current=o,p.useCallback(a=>{const c=d.current;let f=!1;const m=c.map(h=>{const x=$u(h,a);return!f&&typeof x=="function"&&(f=!0),x});if(f)return()=>{for(let h=0;h{$t||($t={start:Uu(),end:Uu()});const{start:o,end:d}=$t;return document.body.firstElementChild!==o&&document.body.insertAdjacentElement("afterbegin",o),document.body.lastElementChild!==d&&document.body.insertAdjacentElement("beforeend",d),Vo++,()=>{Vo===1&&($t==null||$t.start.remove(),$t==null||$t.end.remove(),$t=null),Vo=Math.max(0,Vo-1)}},[])}function Uu(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var Ut=function(){return Ut=Object.assign||function(d){for(var a,c=1,f=arguments.length;c"u")return Vx;var d=Wx(o),a=document.documentElement.clientWidth,c=window.innerWidth;return{left:d[0],top:d[1],right:d[2],gap:Math.max(0,c-a+d[2]-d[0])}},Gx=jf(),Rn="data-scroll-locked",Kx=function(o,d,a,c){var f=o.left,m=o.top,h=o.right,x=o.gap;return a===void 0&&(a="margin"),` - .`.concat(_x,` { + */const Gr=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vi=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:yh},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:oh},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:bt},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Ss},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:wh},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Ns},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:ch}];var Pu=1,Mh=.9,Rh=.8,zh=.17,ti=.1,ri=.999,Dh=.9999,Lh=.99,Ah=/[\\\/_+.#"@\[\(\{&]/,Oh=/[\\\/_+.#"@\[\(\{&]/g,Th=/[\s-]/,cf=/[\s-]/g;function yi(o,d,a,c,f,m,h){if(m===d.length)return f===o.length?Pu:Lh;var x=`${f},${m}`;if(h[x]!==void 0)return h[x];for(var S=c.charAt(m),b=a.indexOf(S,f),j=0,P,L,F,A;b>=0;)P=yi(o,d,a,c,b+1,m+1,h),P>j&&(b===f?P*=Pu:Ah.test(o.charAt(b-1))?(P*=Rh,F=o.slice(f,b-1).match(Oh),F&&f>0&&(P*=Math.pow(ri,F.length))):Th.test(o.charAt(b-1))?(P*=Mh,A=o.slice(f,b-1).match(cf),A&&f>0&&(P*=Math.pow(ri,A.length))):(P*=zh,f>0&&(P*=Math.pow(ri,b-f))),o.charAt(b)!==d.charAt(m)&&(P*=Dh)),(PP&&(P=L*ti)),P>j&&(j=P),b=a.indexOf(S,b+1);return h[x]=j,j}function Mu(o){return o.toLowerCase().replace(cf," ")}function Ih(o,d,a){return o=a&&a.length>0?`${o+" "+a.join(" ")}`:o,yi(o,d,Mu(o),Mu(d),0,0,{})}function Cr(o,d,{checkForDefaultPrevented:a=!0}={}){return function(f){if(o==null||o(f),a===!1||!f.defaultPrevented)return d==null?void 0:d(f)}}function Ru(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Dn(...o){return d=>{let a=!1;const c=o.map(f=>{const m=Ru(f,d);return!a&&typeof m=="function"&&(a=!0),m});if(a)return()=>{for(let f=0;f{var E;const{scope:L,children:F,...A}=P,N=((E=L==null?void 0:L[o])==null?void 0:E[S])||x,C=p.useMemo(()=>A,Object.values(A));return n.jsx(N.Provider,{value:C,children:F})};b.displayName=m+"Provider";function j(P,L){var N;const F=((N=L==null?void 0:L[o])==null?void 0:N[S])||x,A=p.useContext(F);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${P}\` must be used within \`${m}\``)}return[b,j]}const f=()=>{const m=a.map(h=>p.createContext(h));return function(x){const S=(x==null?void 0:x[o])||m;return p.useMemo(()=>({[`__scope${o}`]:{...x,[o]:S}}),[x,S])}};return f.scopeName=o,[c,$h(f,...d)]}function $h(...o){const d=o[0];if(o.length===1)return d;const a=()=>{const c=o.map(f=>({useScope:f(),scopeName:f.scopeName}));return function(m){const h=c.reduce((x,{useScope:S,scopeName:b})=>{const P=S(m)[`__scope${b}`];return{...x,...P}},{});return p.useMemo(()=>({[`__scope${d.scopeName}`]:h}),[h])}};return a.scopeName=d.scopeName,a}var Es=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Uh=Ci[" useId ".trim().toString()]||(()=>{}),Bh=0;function tr(o){const[d,a]=p.useState(Uh());return Es(()=>{a(c=>c??String(Bh++))},[o]),d?`radix-${d}`:""}var Vh=Ci[" useInsertionEffect ".trim().toString()]||Es;function Wh({prop:o,defaultProp:d,onChange:a=()=>{},caller:c}){const[f,m,h]=Hh({defaultProp:d,onChange:a}),x=o!==void 0,S=x?o:f;{const j=p.useRef(o!==void 0);p.useEffect(()=>{const P=j.current;P!==x&&console.warn(`${c} is changing from ${P?"controlled":"uncontrolled"} to ${x?"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.`),j.current=x},[x,c])}const b=p.useCallback(j=>{var P;if(x){const L=Gh(j)?j(o):j;L!==o&&((P=h.current)==null||P.call(h,L))}else m(j)},[x,o,m,h]);return[S,b]}function Hh({defaultProp:o,onChange:d}){const[a,c]=p.useState(o),f=p.useRef(a),m=p.useRef(d);return Vh(()=>{m.current=d},[d]),p.useEffect(()=>{var h;f.current!==a&&((h=m.current)==null||h.call(m,a),f.current=a)},[a,f]),[a,c,m]}function Gh(o){return typeof o=="function"}var uf=rf();function ff(o){const d=p.forwardRef((a,c)=>{let{children:f,...m}=a,h=null,x=!1;const S=[];zu(f)&&typeof $o=="function"&&(f=$o(f._payload)),p.Children.forEach(f,L=>{var F;if(Yh(L)){x=!0;const A=L;let N="child"in A.props?A.props.child:A.props.children;zu(N)&&typeof $o=="function"&&(N=$o(N._payload)),h=Qh(A,N),S.push((F=h==null?void 0:h.props)==null?void 0:F.children)}else S.push(L)}),h?h=p.cloneElement(h,void 0,S):!x&&p.Children.count(f)===1&&p.isValidElement(f)&&(h=f);const b=h?Zh(h):void 0,j=Qr(c,b);if(!h){if(f||f===0)throw new Error(x?tx(o):ex(o));return f}const P=qh(m,h.props??{});return h.type!==p.Fragment&&(P.ref=c?j:b),p.cloneElement(h,P)});return d.displayName=`${o}.Slot`,d}var Kh=Symbol.for("radix.slottable"),Qh=(o,d)=>{if("child"in o.props){const a=o.props.child;return p.isValidElement(a)?p.cloneElement(a,void 0,o.props.children(a.props.children)):null}return p.isValidElement(d)?d:null};function qh(o,d){const a={...d};for(const c in d){const f=o[c],m=d[c];/^on[A-Z]/.test(c)?f&&m?a[c]=(...x)=>{const S=m(...x);return f(...x),S}:f&&(a[c]=f):c==="style"?a[c]={...f,...m}:c==="className"&&(a[c]=[f,m].filter(Boolean).join(" "))}return{...o,...a}}function Zh(o){var c,f;let d=(c=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:c.get,a=d&&"isReactWarning"in d&&d.isReactWarning;return a?o.ref:(d=(f=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:f.get,a=d&&"isReactWarning"in d&&d.isReactWarning,a?o.props.ref:o.props.ref||o.ref)}function Yh(o){return p.isValidElement(o)&&typeof o.type=="function"&&"__radixId"in o.type&&o.type.__radixId===Kh}var Jh=Symbol.for("react.lazy");function zu(o){return o!=null&&typeof o=="object"&&"$$typeof"in o&&o.$$typeof===Jh&&"_payload"in o&&Xh(o._payload)}function Xh(o){return typeof o=="object"&&o!==null&&"then"in o}var ex=o=>`${o} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,tx=o=>`${o} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,$o=Ci[" use ".trim().toString()],rx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=rx.reduce((o,d)=>{const a=ff(`Primitive.${d}`),c=p.forwardRef((f,m)=>{const{asChild:h,...x}=f,S=h?a:d;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(S,{...x,ref:m})});return c.displayName=`Primitive.${d}`,{...o,[d]:c}},{});function nx(o,d){o&&uf.flushSync(()=>o.dispatchEvent(d))}function _s(o){const d=p.useRef(o);return p.useEffect(()=>{d.current=o}),p.useMemo(()=>((...a)=>{var c;return(c=d.current)==null?void 0:c.call(d,...a)}),[])}function sx(o,d=globalThis==null?void 0:globalThis.document){const a=_s(o);p.useEffect(()=>{const c=f=>{f.key==="Escape"&&a(f)};return d.addEventListener("keydown",c,{capture:!0}),()=>d.removeEventListener("keydown",c,{capture:!0})},[a,d])}var ox="DismissableLayer",bi="dismissableLayer.update",lx="dismissableLayer.pointerDownOutside",ax="dismissableLayer.focusOutside",Du,_i=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),pf=p.forwardRef((o,d)=>{const{disableOutsidePointerEvents:a=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:S,...b}=o,j=p.useContext(_i),[P,L]=p.useState(null),F=(P==null?void 0:P.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,A]=p.useState({}),N=Qr(d,se=>L(se)),C=Array.from(j.layers),[E]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),D=C.indexOf(E),Z=P?C.indexOf(P):-1,Y=j.layersWithOutsidePointerEventsDisabled.size>0,G=Z>=D,I=p.useRef(!1),$=ux(se=>{const X=se.target;if(!(X instanceof Node))return;const be=[...j.branches].some(ce=>ce.contains(X));!G||be||(m==null||m(se),x==null||x(se),se.defaultPrevented||S==null||S())},{ownerDocument:F,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:j.dismissableSurfaces}),ne=fx(se=>{if(c&&I.current)return;const X=se.target;[...j.branches].some(ce=>ce.contains(X))||(h==null||h(se),x==null||x(se),se.defaultPrevented||S==null||S())},F);return sx(se=>{Z===j.layers.size-1&&(f==null||f(se),!se.defaultPrevented&&S&&(se.preventDefault(),S()))},F),p.useEffect(()=>{if(P)return a&&(j.layersWithOutsidePointerEventsDisabled.size===0&&(Du=F.body.style.pointerEvents,F.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(P)),j.layers.add(P),Lu(),()=>{a&&(j.layersWithOutsidePointerEventsDisabled.delete(P),j.layersWithOutsidePointerEventsDisabled.size===0&&(F.body.style.pointerEvents=Du))}},[P,F,a,j]),p.useEffect(()=>()=>{P&&(j.layers.delete(P),j.layersWithOutsidePointerEventsDisabled.delete(P),Lu())},[P,j]),p.useEffect(()=>{const se=()=>A({});return document.addEventListener(bi,se),()=>document.removeEventListener(bi,se)},[]),n.jsx(Je.div,{...b,ref:N,style:{pointerEvents:Y?G?"auto":"none":void 0,...o.style},onFocusCapture:Cr(o.onFocusCapture,ne.onFocusCapture),onBlurCapture:Cr(o.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:Cr(o.onPointerDownCapture,$.onPointerDownCapture)})});pf.displayName=ox;var ix="DismissableLayerBranch",dx=p.forwardRef((o,d)=>{const a=p.useContext(_i),c=p.useRef(null),f=Qr(d,c);return p.useEffect(()=>{const m=c.current;if(m)return a.branches.add(m),()=>{a.branches.delete(m)}},[a.branches]),n.jsx(Je.div,{...o,ref:f})});dx.displayName=ix;function cx(){const o=p.useContext(_i),[d,a]=p.useState(null);return p.useEffect(()=>{if(d)return o.dismissableSurfaces.add(d),()=>{o.dismissableSurfaces.delete(d)}},[d,o.dismissableSurfaces]),a}function ux(o,d){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:f,dismissableSurfaces:m}=d,h=_s(o),x=p.useRef(!1),S=p.useRef(!1),b=p.useRef(new Map),j=p.useRef(()=>{});return p.useEffect(()=>{function P(){S.current=!1,f.current=!1,b.current.clear()}function L(){return Array.from(b.current.values()).some(Boolean)}function F(D){if(!S.current)return;const Z=D.target;Z instanceof Node&&[...m].some(G=>G.contains(Z))||b.current.set(D.type,!0),D.type==="click"&&window.setTimeout(()=>{S.current&&j.current()},0)}function A(D){S.current&&b.current.set(D.type,!1)}const N=D=>{if(D.target&&!x.current){let Z=function(){a.removeEventListener("click",j.current);const G=L();P(),G||mf(lx,h,Y,{discrete:!0})};const Y={originalEvent:D};S.current=!0,f.current=c&&D.button===0,b.current.clear(),!c||D.button!==0?Z():(a.removeEventListener("click",j.current),j.current=Z,a.addEventListener("click",j.current,{once:!0}))}else a.removeEventListener("click",j.current),P();x.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const D of C)a.addEventListener(D,F,!0),a.addEventListener(D,A);const E=window.setTimeout(()=>{a.addEventListener("pointerdown",N)},0);return()=>{window.clearTimeout(E),a.removeEventListener("pointerdown",N),a.removeEventListener("click",j.current);for(const D of C)a.removeEventListener(D,F,!0),a.removeEventListener(D,A)}},[a,h,c,f,m]),{onPointerDownCapture:()=>x.current=!0}}function fx(o,d=globalThis==null?void 0:globalThis.document){const a=_s(o),c=p.useRef(!1);return p.useEffect(()=>{const f=m=>{m.target&&!c.current&&mf(ax,a,{originalEvent:m},{discrete:!1})};return d.addEventListener("focusin",f),()=>d.removeEventListener("focusin",f)},[d,a]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Lu(){const o=new CustomEvent(bi);document.dispatchEvent(o)}function mf(o,d,a,{discrete:c}){const f=a.originalEvent.target,m=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:a});d&&f.addEventListener(o,d,{once:!0}),c?nx(f,m):f.dispatchEvent(m)}var ni="focusScope.autoFocusOnMount",si="focusScope.autoFocusOnUnmount",Au={bubbles:!1,cancelable:!0},px="FocusScope",hf=p.forwardRef((o,d)=>{const{loop:a=!1,trapped:c=!1,onMountAutoFocus:f,onUnmountAutoFocus:m,...h}=o,[x,S]=p.useState(null),b=_s(f),j=_s(m),P=p.useRef(null),L=Qr(d,N=>S(N)),F=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(c){let N=function(Z){if(F.paused||!x)return;const Y=Z.target;x.contains(Y)?P.current=Y:Sr(P.current,{select:!0})},C=function(Z){if(F.paused||!x)return;const Y=Z.relatedTarget;Y!==null&&(x.contains(Y)||Sr(P.current,{select:!0}))},E=function(Z){if(document.activeElement===document.body)for(const G of Z)G.removedNodes.length>0&&Sr(x)};document.addEventListener("focusin",N),document.addEventListener("focusout",C);const D=new MutationObserver(E);return x&&D.observe(x,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",C),D.disconnect()}}},[c,x,F.paused]),p.useEffect(()=>{if(x){Tu.add(F);const N=document.activeElement;if(!x.contains(N)){const E=new CustomEvent(ni,Au);x.addEventListener(ni,b),x.dispatchEvent(E),E.defaultPrevented||(mx(yx(xf(x)),{select:!0}),document.activeElement===N&&Sr(x))}return()=>{x.removeEventListener(ni,b),setTimeout(()=>{const E=new CustomEvent(si,Au);x.addEventListener(si,j),x.dispatchEvent(E),E.defaultPrevented||Sr(N??document.body,{select:!0}),x.removeEventListener(si,j),Tu.remove(F)},0)}}},[x,b,j,F]);const A=p.useCallback(N=>{if(!a&&!c||F.paused)return;const C=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,E=document.activeElement;if(C&&E){const D=N.currentTarget,[Z,Y]=hx(D);Z&&Y?!N.shiftKey&&E===Y?(N.preventDefault(),a&&Sr(Z,{select:!0})):N.shiftKey&&E===Z&&(N.preventDefault(),a&&Sr(Y,{select:!0})):E===D&&N.preventDefault()}},[a,c,F.paused]);return n.jsx(Je.div,{tabIndex:-1,...h,ref:L,onKeyDown:A})});hf.displayName=px;function mx(o,{select:d=!1}={}){const a=document.activeElement;for(const c of o)if(Sr(c,{select:d}),document.activeElement!==a)return}function hx(o){const d=xf(o),a=Ou(d,o),c=Ou(d.reverse(),o);return[a,c]}function xf(o){const d=[],a=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const f=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||f?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)d.push(a.currentNode);return d}function Ou(o,d){for(const a of o)if(!xx(a,{upTo:d}))return a}function xx(o,{upTo:d}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(d!==void 0&&o===d)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function gx(o){return o instanceof HTMLInputElement&&"select"in o}function Sr(o,{select:d=!1}={}){if(o&&o.focus){const a=document.activeElement;o.focus({preventScroll:!0}),o!==a&&gx(o)&&d&&o.select()}}var Tu=vx();function vx(){let o=[];return{add(d){const a=o[0];d!==a&&(a==null||a.pause()),o=Iu(o,d),o.unshift(d)},remove(d){var a;o=Iu(o,d),(a=o[0])==null||a.resume()}}}function Iu(o,d){const a=[...o],c=a.indexOf(d);return c!==-1&&a.splice(c,1),a}function yx(o){return o.filter(d=>d.tagName!=="A")}var bx="Portal",gf=p.forwardRef((o,d)=>{var x;const{container:a,...c}=o,[f,m]=p.useState(!1);Es(()=>m(!0),[]);const h=a||f&&((x=globalThis==null?void 0:globalThis.document)==null?void 0:x.body);return h?uf.createPortal(n.jsx(Je.div,{...c,ref:d}),h):null});gf.displayName=bx;function wx(o,d){return p.useReducer((a,c)=>d[a][c]??a,o)}var nl=o=>{const{present:d,children:a}=o,c=jx(d),f=typeof a=="function"?a({present:c.isPresent}):p.Children.only(a),m=kx(c.ref,Nx(f));return typeof a=="function"||c.isPresent?p.cloneElement(f,{ref:m}):null};nl.displayName="Presence";function jx(o){const[d,a]=p.useState(),c=p.useRef(null),f=p.useRef(o),m=p.useRef("none"),h=o?"mounted":"unmounted",[x,S]=wx(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const b=Uo(c.current);m.current=x==="mounted"?b:"none"},[x]),Es(()=>{const b=c.current,j=f.current;if(j!==o){const L=m.current,F=Uo(b);o?S("MOUNT"):F==="none"||(b==null?void 0:b.display)==="none"?S("UNMOUNT"):S(j&&L!==F?"ANIMATION_OUT":"UNMOUNT"),f.current=o}},[o,S]),Es(()=>{if(d){let b;const j=d.ownerDocument.defaultView??window,P=F=>{const N=Uo(c.current).includes(CSS.escape(F.animationName));if(F.target===d&&N&&(S("ANIMATION_END"),!f.current)){const C=d.style.animationFillMode;d.style.animationFillMode="forwards",b=j.setTimeout(()=>{d.style.animationFillMode==="forwards"&&(d.style.animationFillMode=C)})}},L=F=>{F.target===d&&(m.current=Uo(c.current))};return d.addEventListener("animationstart",L),d.addEventListener("animationcancel",P),d.addEventListener("animationend",P),()=>{j.clearTimeout(b),d.removeEventListener("animationstart",L),d.removeEventListener("animationcancel",P),d.removeEventListener("animationend",P)}}else S("ANIMATION_END")},[d,S]),{isPresent:["mounted","unmountSuspended"].includes(x),ref:p.useCallback(b=>{c.current=b?getComputedStyle(b):null,a(b)},[])}}function Fu(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function kx(...o){const d=p.useRef(o);return d.current=o,p.useCallback(a=>{const c=d.current;let f=!1;const m=c.map(h=>{const x=Fu(h,a);return!f&&typeof x=="function"&&(f=!0),x});if(f)return()=>{for(let h=0;h{Ut||(Ut={start:$u(),end:$u()});const{start:o,end:d}=Ut;return document.body.firstElementChild!==o&&document.body.insertAdjacentElement("afterbegin",o),document.body.lastElementChild!==d&&document.body.insertAdjacentElement("beforeend",d),Bo++,()=>{Bo===1&&(Ut==null||Ut.start.remove(),Ut==null||Ut.end.remove(),Ut=null),Bo=Math.max(0,Bo-1)}},[])}function $u(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var Bt=function(){return Bt=Object.assign||function(d){for(var a,c=1,f=arguments.length;c"u")return Bx;var d=Vx(o),a=document.documentElement.clientWidth,c=window.innerWidth;return{left:d[0],top:d[1],right:d[2],gap:Math.max(0,c-a+d[2]-d[0])}},Hx=wf(),Mn="data-scroll-locked",Gx=function(o,d,a,c){var f=o.left,m=o.top,h=o.right,x=o.gap;return a===void 0&&(a="margin"),` + .`.concat(Ex,` { overflow: hidden `).concat(c,`; padding-right: `).concat(x,"px ").concat(c,`; } - body[`).concat(Rn,`] { + body[`).concat(Mn,`] { overflow: hidden `).concat(c,`; overscroll-behavior: contain; `).concat([d&&"position: relative ".concat(c,";"),a==="margin"&&` @@ -330,29 +330,29 @@ Error generating stack: `+i.message+` `),a==="padding"&&"padding-right: ".concat(x,"px ").concat(c,";")].filter(Boolean).join(""),` } - .`).concat(Yo,` { + .`).concat(Zo,` { right: `).concat(x,"px ").concat(c,`; } - .`).concat(Jo,` { + .`).concat(Yo,` { margin-right: `).concat(x,"px ").concat(c,`; } - .`).concat(Yo," .").concat(Yo,` { + .`).concat(Zo," .").concat(Zo,` { right: 0 `).concat(c,`; } - .`).concat(Jo," .").concat(Jo,` { + .`).concat(Yo," .").concat(Yo,` { margin-right: 0 `).concat(c,`; } - body[`).concat(Rn,`] { - `).concat(Px,": ").concat(x,`px; + body[`).concat(Mn,`] { + `).concat(_x,": ").concat(x,`px; } -`)},Vu=function(){var o=parseInt(document.body.getAttribute(Rn)||"0",10);return isFinite(o)?o:0},Qx=function(){p.useEffect(function(){return document.body.setAttribute(Rn,(Vu()+1).toString()),function(){var o=Vu()-1;o<=0?document.body.removeAttribute(Rn):document.body.setAttribute(Rn,o.toString())}},[])},qx=function(o){var d=o.noRelative,a=o.noImportant,c=o.gapMode,f=c===void 0?"margin":c;Qx();var m=p.useMemo(function(){return Hx(f)},[f]);return p.createElement(Gx,{styles:Kx(m,!d,f,a?"":"!important")})},ji=!1;if(typeof window<"u")try{var Wo=Object.defineProperty({},"passive",{get:function(){return ji=!0,!0}});window.addEventListener("test",Wo,Wo),window.removeEventListener("test",Wo,Wo)}catch{ji=!1}var Nn=ji?{passive:!1}:!1,Zx=function(o){return o.tagName==="TEXTAREA"},kf=function(o,d){if(!(o instanceof Element))return!1;var a=window.getComputedStyle(o);return a[d]!=="hidden"&&!(a.overflowY===a.overflowX&&!Zx(o)&&a[d]==="visible")},Yx=function(o){return kf(o,"overflowY")},Jx=function(o){return kf(o,"overflowX")},Wu=function(o,d){var a=d.ownerDocument,c=d;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var f=Nf(o,c);if(f){var m=Sf(o,c),h=m[1],x=m[2];if(h>x)return!0}c=c.parentNode}while(c&&c!==a.body);return!1},Xx=function(o){var d=o.scrollTop,a=o.scrollHeight,c=o.clientHeight;return[d,a,c]},eg=function(o){var d=o.scrollLeft,a=o.scrollWidth,c=o.clientWidth;return[d,a,c]},Nf=function(o,d){return o==="v"?Yx(d):Jx(d)},Sf=function(o,d){return o==="v"?Xx(d):eg(d)},tg=function(o,d){return o==="h"&&d==="rtl"?-1:1},rg=function(o,d,a,c,f){var m=tg(o,window.getComputedStyle(d).direction),h=m*c,x=a.target,C=d.contains(x),b=!1,j=h>0,P=0,L=0;do{if(!x)break;var F=Sf(o,x),A=F[0],N=F[1],S=F[2],E=N-S-m*A;(A||E)&&Nf(o,x)&&(P+=E,L+=A);var D=x.parentNode;x=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!C&&x!==document.body||C&&(d.contains(x)||d===x));return(j&&Math.abs(P)<1||!j&&Math.abs(L)<1)&&(b=!0),b},Ho=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},Hu=function(o){return[o.deltaX,o.deltaY]},Gu=function(o){return o&&"current"in o?o.current:o},ng=function(o,d){return o[0]===d[0]&&o[1]===d[1]},sg=function(o){return` +`)},Bu=function(){var o=parseInt(document.body.getAttribute(Mn)||"0",10);return isFinite(o)?o:0},Kx=function(){p.useEffect(function(){return document.body.setAttribute(Mn,(Bu()+1).toString()),function(){var o=Bu()-1;o<=0?document.body.removeAttribute(Mn):document.body.setAttribute(Mn,o.toString())}},[])},Qx=function(o){var d=o.noRelative,a=o.noImportant,c=o.gapMode,f=c===void 0?"margin":c;Kx();var m=p.useMemo(function(){return Wx(f)},[f]);return p.createElement(Hx,{styles:Gx(m,!d,f,a?"":"!important")})},wi=!1;if(typeof window<"u")try{var Vo=Object.defineProperty({},"passive",{get:function(){return wi=!0,!0}});window.addEventListener("test",Vo,Vo),window.removeEventListener("test",Vo,Vo)}catch{wi=!1}var Nn=wi?{passive:!1}:!1,qx=function(o){return o.tagName==="TEXTAREA"},jf=function(o,d){if(!(o instanceof Element))return!1;var a=window.getComputedStyle(o);return a[d]!=="hidden"&&!(a.overflowY===a.overflowX&&!qx(o)&&a[d]==="visible")},Zx=function(o){return jf(o,"overflowY")},Yx=function(o){return jf(o,"overflowX")},Vu=function(o,d){var a=d.ownerDocument,c=d;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var f=kf(o,c);if(f){var m=Nf(o,c),h=m[1],x=m[2];if(h>x)return!0}c=c.parentNode}while(c&&c!==a.body);return!1},Jx=function(o){var d=o.scrollTop,a=o.scrollHeight,c=o.clientHeight;return[d,a,c]},Xx=function(o){var d=o.scrollLeft,a=o.scrollWidth,c=o.clientWidth;return[d,a,c]},kf=function(o,d){return o==="v"?Zx(d):Yx(d)},Nf=function(o,d){return o==="v"?Jx(d):Xx(d)},eg=function(o,d){return o==="h"&&d==="rtl"?-1:1},tg=function(o,d,a,c,f){var m=eg(o,window.getComputedStyle(d).direction),h=m*c,x=a.target,S=d.contains(x),b=!1,j=h>0,P=0,L=0;do{if(!x)break;var F=Nf(o,x),A=F[0],N=F[1],C=F[2],E=N-C-m*A;(A||E)&&kf(o,x)&&(P+=E,L+=A);var D=x.parentNode;x=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!S&&x!==document.body||S&&(d.contains(x)||d===x));return(j&&Math.abs(P)<1||!j&&Math.abs(L)<1)&&(b=!0),b},Wo=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},Wu=function(o){return[o.deltaX,o.deltaY]},Hu=function(o){return o&&"current"in o?o.current:o},rg=function(o,d){return o[0]===d[0]&&o[1]===d[1]},ng=function(o){return` .block-interactivity-`.concat(o,` {pointer-events: none;} .allow-interactivity-`).concat(o,` {pointer-events: all;} -`)},og=0,Sn=[];function lg(o){var d=p.useRef([]),a=p.useRef([0,0]),c=p.useRef(),f=p.useState(og++)[0],m=p.useState(jf)[0],h=p.useRef(o);p.useEffect(function(){h.current=o},[o]),p.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(f));var N=Ex([o.lockRef.current],(o.shards||[]).map(Gu),!0).filter(Boolean);return N.forEach(function(S){return S.classList.add("allow-interactivity-".concat(f))}),function(){document.body.classList.remove("block-interactivity-".concat(f)),N.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(f))})}}},[o.inert,o.lockRef.current,o.shards]);var x=p.useCallback(function(N,S){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!h.current.allowPinchZoom;var E=Ho(N),D=a.current,Z="deltaX"in N?N.deltaX:D[0]-E[0],Y="deltaY"in N?N.deltaY:D[1]-E[1],G,I=N.target,$=Math.abs(Z)>Math.abs(Y)?"h":"v";if("touches"in N&&$==="h"&&I.type==="range")return!1;var ne=window.getSelection(),se=ne&&ne.anchorNode,X=se?se===I||se.contains(I):!1;if(X)return!1;var be=Wu($,I);if(!be)return!0;if(be?G=$:(G=$==="v"?"h":"v",be=Wu($,I)),!be)return!1;if(!c.current&&"changedTouches"in N&&(Z||Y)&&(c.current=G),!G)return!0;var ce=c.current||G;return rg(ce,S,N,ce==="h"?Z:Y)},[]),C=p.useCallback(function(N){var S=N;if(!(!Sn.length||Sn[Sn.length-1]!==m)){var E="deltaY"in S?Hu(S):Ho(S),D=d.current.filter(function(G){return G.name===S.type&&(G.target===S.target||S.target===G.shadowParent)&&ng(G.delta,E)})[0];if(D&&D.should){S.cancelable&&S.preventDefault();return}if(!D){var Z=(h.current.shards||[]).map(Gu).filter(Boolean).filter(function(G){return G.contains(S.target)}),Y=Z.length>0?x(S,Z[0]):!h.current.noIsolation;Y&&S.cancelable&&S.preventDefault()}}},[]),b=p.useCallback(function(N,S,E,D){var Z={name:N,delta:S,target:E,should:D,shadowParent:ag(E)};d.current.push(Z),setTimeout(function(){d.current=d.current.filter(function(Y){return Y!==Z})},1)},[]),j=p.useCallback(function(N){a.current=Ho(N),c.current=void 0},[]),P=p.useCallback(function(N){b(N.type,Hu(N),N.target,x(N,o.lockRef.current))},[]),L=p.useCallback(function(N){b(N.type,Ho(N),N.target,x(N,o.lockRef.current))},[]);p.useEffect(function(){return Sn.push(m),o.setCallbacks({onScrollCapture:P,onWheelCapture:P,onTouchMoveCapture:L}),document.addEventListener("wheel",C,Nn),document.addEventListener("touchmove",C,Nn),document.addEventListener("touchstart",j,Nn),function(){Sn=Sn.filter(function(N){return N!==m}),document.removeEventListener("wheel",C,Nn),document.removeEventListener("touchmove",C,Nn),document.removeEventListener("touchstart",j,Nn)}},[]);var F=o.removeScrollBar,A=o.inert;return p.createElement(p.Fragment,null,A?p.createElement(m,{styles:sg(f)}):null,F?p.createElement(qx,{noRelative:o.noRelative,gapMode:o.gapMode}):null)}function ag(o){for(var d=null;o!==null;)o instanceof ShadowRoot&&(d=o.host,o=o.host),o=o.parentNode;return d}const ig=Ox(wf,lg);var Cf=p.forwardRef(function(o,d){return p.createElement(ol,Ut({},o,{ref:d,sideCar:ig}))});Cf.classNames=ol.classNames;var dg=function(o){if(typeof document>"u")return null;var d=Array.isArray(o)?o[0]:o;return d.ownerDocument.body},Cn=new WeakMap,Go=new WeakMap,Ko={},di=0,Ef=function(o){return o&&(o.host||Ef(o.parentNode))},cg=function(o,d){return d.map(function(a){if(o.contains(a))return a;var c=Ef(a);return c&&o.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",o,". Doing nothing"),null)}).filter(function(a){return!!a})},ug=function(o,d,a,c){var f=cg(d,Array.isArray(o)?o:[o]);Ko[a]||(Ko[a]=new WeakMap);var m=Ko[a],h=[],x=new Set,C=new Set(f),b=function(P){!P||x.has(P)||(x.add(P),b(P.parentNode))};f.forEach(b);var j=function(P){!P||C.has(P)||Array.prototype.forEach.call(P.children,function(L){if(x.has(L))j(L);else try{var F=L.getAttribute(c),A=F!==null&&F!=="false",N=(Cn.get(L)||0)+1,S=(m.get(L)||0)+1;Cn.set(L,N),m.set(L,S),h.push(L),N===1&&A&&Go.set(L,!0),S===1&&L.setAttribute(a,"true"),A||L.setAttribute(c,"true")}catch(E){console.error("aria-hidden: cannot operate on ",L,E)}})};return j(d),x.clear(),di++,function(){h.forEach(function(P){var L=Cn.get(P)-1,F=m.get(P)-1;Cn.set(P,L),m.set(P,F),L||(Go.has(P)||P.removeAttribute(c),Go.delete(P)),F||P.removeAttribute(a)}),di--,di||(Cn=new WeakMap,Cn=new WeakMap,Go=new WeakMap,Ko={})}},fg=function(o,d,a){a===void 0&&(a="data-aria-hidden");var c=Array.from(Array.isArray(o)?o:[o]),f=dg(o);return f?(c.push.apply(c,Array.from(f.querySelectorAll("[aria-live], script"))),ug(c,f,a,"aria-hidden")):function(){return null}},ll="Dialog",[_f]=$h(ll),[pg,Lt]=_f(ll),Pf=o=>{const{__scopeDialog:d,children:a,open:c,defaultOpen:f,onOpenChange:m,modal:h=!0}=o,x=p.useRef(null),C=p.useRef(null),[b,j]=Hh({prop:c,defaultProp:f??!1,onChange:m,caller:ll});return n.jsx(pg,{scope:d,triggerRef:x,contentRef:C,contentId:er(),titleId:er(),descriptionId:er(),open:b,onOpenChange:j,onOpenToggle:p.useCallback(()=>j(P=>!P),[j]),modal:h,children:a})};Pf.displayName=ll;var Mf="DialogTrigger",mg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(Mf,a),m=Qr(d,f.triggerRef);return n.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":Ri(f.open),...c,ref:m,onClick:Cr(o.onClick,f.onOpenToggle)})});mg.displayName=Mf;var Mi="DialogPortal",[hg,Rf]=_f(Mi,{forceMount:void 0}),zf=o=>{const{__scopeDialog:d,forceMount:a,children:c,container:f}=o,m=Lt(Mi,d);return n.jsx(hg,{scope:d,forceMount:a,children:p.Children.map(c,h=>n.jsx(sl,{present:a||m.open,children:n.jsx(vf,{asChild:!0,container:f,children:h})}))})};zf.displayName=Mi;var nl="DialogOverlay",Df=p.forwardRef((o,d)=>{const a=Rf(nl,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=Lt(nl,o.__scopeDialog);return m.modal?n.jsx(sl,{present:c||m.open,children:n.jsx(gg,{...f,ref:d})}):null});Df.displayName=nl;var xg=pf("DialogOverlay.RemoveScroll"),gg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(nl,a),m=ux(),h=Qr(d,m);return n.jsx(Cf,{as:xg,allowPinchZoom:!0,shards:[f.contentRef],children:n.jsx(Je.div,{"data-state":Ri(f.open),...c,ref:h,style:{pointerEvents:"auto",...c.style}})})}),An="DialogContent",Lf=p.forwardRef((o,d)=>{const a=Rf(An,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=Lt(An,o.__scopeDialog);return n.jsx(sl,{present:c||m.open,children:m.modal?n.jsx(vg,{...f,ref:d}):n.jsx(yg,{...f,ref:d})})});Lf.displayName=An;var vg=p.forwardRef((o,d)=>{const a=Lt(An,o.__scopeDialog),c=p.useRef(null),f=Qr(d,a.contentRef,c);return p.useEffect(()=>{const m=c.current;if(m)return fg(m)},[]),n.jsx(Af,{...o,ref:f,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:Cr(o.onCloseAutoFocus,m=>{var h;m.preventDefault(),(h=a.triggerRef.current)==null||h.focus()}),onPointerDownOutside:Cr(o.onPointerDownOutside,m=>{const h=m.detail.originalEvent,x=h.button===0&&h.ctrlKey===!0;(h.button===2||x)&&m.preventDefault()}),onFocusOutside:Cr(o.onFocusOutside,m=>m.preventDefault())})}),yg=p.forwardRef((o,d)=>{const a=Lt(An,o.__scopeDialog),c=p.useRef(!1),f=p.useRef(!1);return n.jsx(Af,{...o,ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:m=>{var h,x;(h=o.onCloseAutoFocus)==null||h.call(o,m),m.defaultPrevented||(c.current||(x=a.triggerRef.current)==null||x.focus(),m.preventDefault()),c.current=!1,f.current=!1},onInteractOutside:m=>{var C,b;(C=o.onInteractOutside)==null||C.call(o,m),m.defaultPrevented||(c.current=!0,m.detail.originalEvent.type==="pointerdown"&&(f.current=!0));const h=m.target;((b=a.triggerRef.current)==null?void 0:b.contains(h))&&m.preventDefault(),m.detail.originalEvent.type==="focusin"&&f.current&&m.preventDefault()}})}),Af=p.forwardRef((o,d)=>{const{__scopeDialog:a,trapFocus:c,onOpenAutoFocus:f,onCloseAutoFocus:m,...h}=o,x=Lt(An,a);return Cx(),n.jsx(n.Fragment,{children:n.jsx(xf,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:f,onUnmountAutoFocus:m,children:n.jsx(mf,{role:"dialog",id:x.contentId,"aria-describedby":x.descriptionId,"aria-labelledby":x.titleId,"data-state":Ri(x.open),...h,ref:d,deferPointerDownOutside:!0,onDismiss:()=>x.onOpenChange(!1)})})})}),Of="DialogTitle",bg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(Of,a);return n.jsx(Je.h2,{id:f.titleId,...c,ref:d})});bg.displayName=Of;var Tf="DialogDescription",wg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(Tf,a);return n.jsx(Je.p,{id:f.descriptionId,...c,ref:d})});wg.displayName=Tf;var If="DialogClose",jg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=Lt(If,a);return n.jsx(Je.button,{type:"button",...c,ref:d,onClick:Cr(o.onClick,()=>f.onOpenChange(!1))})});jg.displayName=If;function Ri(o){return o?"open":"closed"}var js='[cmdk-group=""]',ci='[cmdk-group-items=""]',kg='[cmdk-group-heading=""]',Ff='[cmdk-item=""]',Ku=`${Ff}:not([aria-disabled="true"])`,ki="cmdk-item-select",Pn="data-value",Ng=(o,d,a)=>Fh(o,d,a),$f=p.createContext(void 0),Rs=()=>p.useContext($f),Uf=p.createContext(void 0),zi=()=>p.useContext(Uf),Bf=p.createContext(void 0),Vf=p.forwardRef((o,d)=>{let a=Mn(()=>{var v,V;return{search:"",value:(V=(v=o.value)!=null?v:o.defaultValue)!=null?V:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=Mn(()=>new Set),f=Mn(()=>new Map),m=Mn(()=>new Map),h=Mn(()=>new Set),x=Wf(o),{label:C,children:b,value:j,onValueChange:P,filter:L,shouldFilter:F,loop:A,disablePointerSelection:N=!1,vimBindings:S=!0,...E}=o,D=er(),Z=er(),Y=er(),G=p.useRef(null),I=Ag();Kr(()=>{if(j!==void 0){let v=j.trim();a.current.value=v,$.emit()}},[j]),Kr(()=>{I(6,Me)},[]);let $=p.useMemo(()=>({subscribe:v=>(h.current.add(v),()=>h.current.delete(v)),snapshot:()=>a.current,setState:(v,V,J)=>{var Q,oe,pe,me;if(!Object.is(a.current[v],V)){if(a.current[v]=V,v==="search")ce(),X(),I(1,be);else if(v==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let T=document.getElementById(Y);T?T.focus():(Q=document.getElementById(D))==null||Q.focus()}if(I(7,()=>{var T;a.current.selectedItemId=(T=Pe())==null?void 0:T.id,$.emit()}),J||I(5,Me),((oe=x.current)==null?void 0:oe.value)!==void 0){let T=V??"";(me=(pe=x.current).onValueChange)==null||me.call(pe,T);return}}$.emit()}},emit:()=>{h.current.forEach(v=>v())}}),[]),ne=p.useMemo(()=>({value:(v,V,J)=>{var Q;V!==((Q=m.current.get(v))==null?void 0:Q.value)&&(m.current.set(v,{value:V,keywords:J}),a.current.filtered.items.set(v,se(V,J)),I(2,()=>{X(),$.emit()}))},item:(v,V)=>(c.current.add(v),V&&(f.current.has(V)?f.current.get(V).add(v):f.current.set(V,new Set([v]))),I(3,()=>{ce(),X(),a.current.value||be(),$.emit()}),()=>{m.current.delete(v),c.current.delete(v),a.current.filtered.items.delete(v);let J=Pe();I(4,()=>{ce(),(J==null?void 0:J.getAttribute("id"))===v&&be(),$.emit()})}),group:v=>(f.current.has(v)||f.current.set(v,new Set),()=>{m.current.delete(v),f.current.delete(v)}),filter:()=>x.current.shouldFilter,label:C||o["aria-label"],getDisablePointerSelection:()=>x.current.disablePointerSelection,listId:D,inputId:Y,labelId:Z,listInnerRef:G}),[]);function se(v,V){var J,Q;let oe=(Q=(J=x.current)==null?void 0:J.filter)!=null?Q:Ng;return v?oe(v,a.current.search,V):0}function X(){if(!a.current.search||x.current.shouldFilter===!1)return;let v=a.current.filtered.items,V=[];a.current.filtered.groups.forEach(Q=>{let oe=f.current.get(Q),pe=0;oe.forEach(me=>{let T=v.get(me);pe=Math.max(T,pe)}),V.push([Q,pe])});let J=G.current;Re().sort((Q,oe)=>{var pe,me;let T=Q.getAttribute("id"),O=oe.getAttribute("id");return((pe=v.get(O))!=null?pe:0)-((me=v.get(T))!=null?me:0)}).forEach(Q=>{let oe=Q.closest(ci);oe?oe.appendChild(Q.parentElement===oe?Q:Q.closest(`${ci} > *`)):J.appendChild(Q.parentElement===J?Q:Q.closest(`${ci} > *`))}),V.sort((Q,oe)=>oe[1]-Q[1]).forEach(Q=>{var oe;let pe=(oe=G.current)==null?void 0:oe.querySelector(`${js}[${Pn}="${encodeURIComponent(Q[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function be(){let v=Re().find(J=>J.getAttribute("aria-disabled")!=="true"),V=v==null?void 0:v.getAttribute(Pn);$.setState("value",V||void 0)}function ce(){var v,V,J,Q;if(!a.current.search||x.current.shouldFilter===!1){a.current.filtered.count=c.current.size;return}a.current.filtered.groups=new Set;let oe=0;for(let pe of c.current){let me=(V=(v=m.current.get(pe))==null?void 0:v.value)!=null?V:"",T=(Q=(J=m.current.get(pe))==null?void 0:J.keywords)!=null?Q:[],O=se(me,T);a.current.filtered.items.set(pe,O),O>0&&oe++}for(let[pe,me]of f.current)for(let T of me)if(a.current.filtered.items.get(T)>0){a.current.filtered.groups.add(pe);break}a.current.filtered.count=oe}function Me(){var v,V,J;let Q=Pe();Q&&(((v=Q.parentElement)==null?void 0:v.firstChild)===Q&&((J=(V=Q.closest(js))==null?void 0:V.querySelector(kg))==null||J.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function Pe(){var v;return(v=G.current)==null?void 0:v.querySelector(`${Ff}[aria-selected="true"]`)}function Re(){var v;return Array.from(((v=G.current)==null?void 0:v.querySelectorAll(Ku))||[])}function Se(v){let V=Re()[v];V&&$.setState("value",V.getAttribute(Pn))}function Ne(v){var V;let J=Pe(),Q=Re(),oe=Q.findIndex(me=>me===J),pe=Q[oe+v];(V=x.current)!=null&&V.loop&&(pe=oe+v<0?Q[Q.length-1]:oe+v===Q.length?Q[0]:Q[oe+v]),pe&&$.setState("value",pe.getAttribute(Pn))}function H(v){let V=Pe(),J=V==null?void 0:V.closest(js),Q;for(;J&&!Q;)J=v>0?Dg(J,js):Lg(J,js),Q=J==null?void 0:J.querySelector(Ku);Q?$.setState("value",Q.getAttribute(Pn)):Ne(v)}let ae=()=>Se(Re().length-1),K=v=>{v.preventDefault(),v.metaKey?ae():v.altKey?H(1):Ne(1)},w=v=>{v.preventDefault(),v.metaKey?Se(0):v.altKey?H(-1):Ne(-1)};return p.createElement(Je.div,{ref:d,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:v=>{var V;(V=E.onKeyDown)==null||V.call(E,v);let J=v.nativeEvent.isComposing||v.keyCode===229;if(!(v.defaultPrevented||J))switch(v.key){case"n":case"j":{S&&v.ctrlKey&&K(v);break}case"ArrowDown":{K(v);break}case"p":case"k":{S&&v.ctrlKey&&w(v);break}case"ArrowUp":{w(v);break}case"Home":{v.preventDefault(),Se(0);break}case"End":{v.preventDefault(),ae();break}case"Enter":{v.preventDefault();let Q=Pe();if(Q){let oe=new Event(ki);Q.dispatchEvent(oe)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Tg},C),al(o,v=>p.createElement(Uf.Provider,{value:$},p.createElement($f.Provider,{value:ne},v))))}),Sg=p.forwardRef((o,d)=>{var a,c;let f=er(),m=p.useRef(null),h=p.useContext(Bf),x=Rs(),C=Wf(o),b=(c=(a=C.current)==null?void 0:a.forceMount)!=null?c:h==null?void 0:h.forceMount;Kr(()=>{if(!b)return x.item(f,h==null?void 0:h.id)},[b]);let j=Hf(f,m,[o.value,o.children,m],o.keywords),P=zi(),L=Er(I=>I.value&&I.value===j.current),F=Er(I=>b||x.filter()===!1?!0:I.search?I.filtered.items.get(f)>0:!0);p.useEffect(()=>{let I=m.current;if(!(!I||o.disabled))return I.addEventListener(ki,A),()=>I.removeEventListener(ki,A)},[F,o.onSelect,o.disabled]);function A(){var I,$;N(),($=(I=C.current).onSelect)==null||$.call(I,j.current)}function N(){P.setState("value",j.current,!0)}if(!F)return null;let{disabled:S,value:E,onSelect:D,forceMount:Z,keywords:Y,...G}=o;return p.createElement(Je.div,{ref:Ln(m,d),...G,id:f,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!L,"data-disabled":!!S,"data-selected":!!L,onPointerMove:S||x.getDisablePointerSelection()?void 0:N,onClick:S?void 0:A},o.children)}),Cg=p.forwardRef((o,d)=>{let{heading:a,children:c,forceMount:f,...m}=o,h=er(),x=p.useRef(null),C=p.useRef(null),b=er(),j=Rs(),P=Er(F=>f||j.filter()===!1?!0:F.search?F.filtered.groups.has(h):!0);Kr(()=>j.group(h),[]),Hf(h,x,[o.value,o.heading,C]);let L=p.useMemo(()=>({id:h,forceMount:f}),[f]);return p.createElement(Je.div,{ref:Ln(x,d),...m,"cmdk-group":"",role:"presentation",hidden:P?void 0:!0},a&&p.createElement("div",{ref:C,"cmdk-group-heading":"","aria-hidden":!0,id:b},a),al(o,F=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?b:void 0},p.createElement(Bf.Provider,{value:L},F))))}),Eg=p.forwardRef((o,d)=>{let{alwaysRender:a,...c}=o,f=p.useRef(null),m=Er(h=>!h.search);return!a&&!m?null:p.createElement(Je.div,{ref:Ln(f,d),...c,"cmdk-separator":"",role:"separator"})}),_g=p.forwardRef((o,d)=>{let{onValueChange:a,...c}=o,f=o.value!=null,m=zi(),h=Er(b=>b.search),x=Er(b=>b.selectedItemId),C=Rs();return p.useEffect(()=>{o.value!=null&&m.setState("search",o.value)},[o.value]),p.createElement(Je.input,{ref:d,...c,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":C.listId,"aria-labelledby":C.labelId,"aria-activedescendant":x,id:C.inputId,type:"text",value:f?o.value:h,onChange:b=>{f||m.setState("search",b.target.value),a==null||a(b.target.value)}})}),Pg=p.forwardRef((o,d)=>{let{children:a,label:c="Suggestions",...f}=o,m=p.useRef(null),h=p.useRef(null),x=Er(b=>b.selectedItemId),C=Rs();return p.useEffect(()=>{if(h.current&&m.current){let b=h.current,j=m.current,P,L=new ResizeObserver(()=>{P=requestAnimationFrame(()=>{let F=b.offsetHeight;j.style.setProperty("--cmdk-list-height",F.toFixed(1)+"px")})});return L.observe(b),()=>{cancelAnimationFrame(P),L.unobserve(b)}}},[]),p.createElement(Je.div,{ref:Ln(m,d),...f,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":x,"aria-label":c,id:C.listId},al(o,b=>p.createElement("div",{ref:Ln(h,C.listInnerRef),"cmdk-list-sizer":""},b)))}),Mg=p.forwardRef((o,d)=>{let{open:a,onOpenChange:c,overlayClassName:f,contentClassName:m,container:h,...x}=o;return p.createElement(Pf,{open:a,onOpenChange:c},p.createElement(zf,{container:h},p.createElement(Df,{"cmdk-overlay":"",className:f}),p.createElement(Lf,{"aria-label":o.label,"cmdk-dialog":"",className:m},p.createElement(Vf,{ref:d,...x}))))}),Rg=p.forwardRef((o,d)=>Er(a=>a.filtered.count===0)?p.createElement(Je.div,{ref:d,...o,"cmdk-empty":"",role:"presentation"}):null),zg=p.forwardRef((o,d)=>{let{progress:a,children:c,label:f="Loading...",...m}=o;return p.createElement(Je.div,{ref:d,...m,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":f},al(o,h=>p.createElement("div",{"aria-hidden":!0},h)))}),En=Object.assign(Vf,{List:Pg,Item:Sg,Input:_g,Group:Cg,Separator:Eg,Dialog:Mg,Empty:Rg,Loading:zg});function Dg(o,d){let a=o.nextElementSibling;for(;a;){if(a.matches(d))return a;a=a.nextElementSibling}}function Lg(o,d){let a=o.previousElementSibling;for(;a;){if(a.matches(d))return a;a=a.previousElementSibling}}function Wf(o){let d=p.useRef(o);return Kr(()=>{d.current=o}),d}var Kr=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Mn(o){let d=p.useRef();return d.current===void 0&&(d.current=o()),d}function Er(o){let d=zi(),a=()=>o(d.snapshot());return p.useSyncExternalStore(d.subscribe,a,a)}function Hf(o,d,a,c=[]){let f=p.useRef(),m=Rs();return Kr(()=>{var h;let x=(()=>{var b;for(let j of a){if(typeof j=="string")return j.trim();if(typeof j=="object"&&"current"in j)return j.current?(b=j.current.textContent)==null?void 0:b.trim():f.current}})(),C=c.map(b=>b.trim());m.value(o,x,C),(h=d.current)==null||h.setAttribute(Pn,x),f.current=x}),f}var Ag=()=>{let[o,d]=p.useState(),a=Mn(()=>new Map);return Kr(()=>{a.current.forEach(c=>c()),a.current=new Map},[o]),(c,f)=>{a.current.set(c,f),d({})}};function Og(o){let d=o.type;return typeof d=="function"?d(o.props):"render"in d?d.render(o.props):o}function al({asChild:o,children:d},a){return o&&p.isValidElement(d)?p.cloneElement(Og(d),{ref:d.ref},a(d.props.children)):a(d)}var Tg={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Ig({onNavigate:o}){const[d,a]=p.useState(!1);return p.useEffect(()=>{const c=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&(f.preventDefault(),a(m=>!m))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),n.jsx(En.Dialog,{open:d,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:n.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:[n.jsx(En.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"}),n.jsxs(En.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(En.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(En.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:yi.map(c=>n.jsxs(En.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{o(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:[n.jsx(c.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:c.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function fe(o,d){var C;const a={"Content-Type":"application/json",...d==null?void 0:d.headers},c=localStorage.getItem("mc_sudo_password"),f=localStorage.getItem("mc_hf_token");c&&(a["X-Sudo-Password"]=c);let m=d==null?void 0:d.body;if((((C=d==null?void 0:d.method)==null?void 0:C.toUpperCase())||"GET")==="POST"){if(typeof m=="string")try{const b=JSON.parse(m);let j=!1;c&&!("sudo_password"in b)&&(b.sudo_password=c,j=!0),f&&!("hf_token"in b)&&(b.hf_token=f,j=!0),j&&(m=JSON.stringify(b))}catch{}else if(!m){const b={};c&&(b.sudo_password=c),f&&(b.hf_token=f),Object.keys(b).length>0&&(m=JSON.stringify(b))}}const x=await fetch(o,{...d,headers:a,body:m});if(!x.ok)throw new Error(`${x.status} ${x.statusText}`);return x.json()}function Gf(o){var d,a,c="";if(typeof o=="string"||typeof o=="number")c+=o;else if(typeof o=="object")if(Array.isArray(o)){var f=o.length;for(d=0;d{const d=Bg(o),{conflictingClassGroups:a,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:h=>{const x=h.split(Di);return x[0]===""&&x.length!==1&&x.shift(),Kf(x,d)||Ug(h)},getConflictingClassGroupIds:(h,x)=>{const C=a[h]||[];return x&&c[h]?[...C,...c[h]]:C}}},Kf=(o,d)=>{var h;if(o.length===0)return d.classGroupId;const a=o[0],c=d.nextPart.get(a),f=c?Kf(o.slice(1),c):void 0;if(f)return f;if(d.validators.length===0)return;const m=o.join(Di);return(h=d.validators.find(({validator:x})=>x(m)))==null?void 0:h.classGroupId},Qu=/^\[(.+)\]$/,Ug=o=>{if(Qu.test(o)){const d=Qu.exec(o)[1],a=d==null?void 0:d.substring(0,d.indexOf(":"));if(a)return"arbitrary.."+a}},Bg=o=>{const{theme:d,prefix:a}=o,c={nextPart:new Map,validators:[]};return Wg(Object.entries(o.classGroups),a).forEach(([m,h])=>{Ni(h,c,m,d)}),c},Ni=(o,d,a,c)=>{o.forEach(f=>{if(typeof f=="string"){const m=f===""?d:qu(d,f);m.classGroupId=a;return}if(typeof f=="function"){if(Vg(f)){Ni(f(c),d,a,c);return}d.validators.push({validator:f,classGroupId:a});return}Object.entries(f).forEach(([m,h])=>{Ni(h,qu(d,m),a,c)})})},qu=(o,d)=>{let a=o;return d.split(Di).forEach(c=>{a.nextPart.has(c)||a.nextPart.set(c,{nextPart:new Map,validators:[]}),a=a.nextPart.get(c)}),a},Vg=o=>o.isThemeGetter,Wg=(o,d)=>d?o.map(([a,c])=>{const f=c.map(m=>typeof m=="string"?d+m:typeof m=="object"?Object.fromEntries(Object.entries(m).map(([h,x])=>[d+h,x])):m);return[a,f]}):o,Hg=o=>{if(o<1)return{get:()=>{},set:()=>{}};let d=0,a=new Map,c=new Map;const f=(m,h)=>{a.set(m,h),d++,d>o&&(d=0,c=a,a=new Map)};return{get(m){let h=a.get(m);if(h!==void 0)return h;if((h=c.get(m))!==void 0)return f(m,h),h},set(m,h){a.has(m)?a.set(m,h):f(m,h)}}},Qf="!",Gg=o=>{const{separator:d,experimentalParseClassName:a}=o,c=d.length===1,f=d[0],m=d.length,h=x=>{const C=[];let b=0,j=0,P;for(let S=0;Sj?P-j:void 0;return{modifiers:C,hasImportantModifier:F,baseClassName:A,maybePostfixModifierPosition:N}};return a?x=>a({className:x,parseClassName:h}):h},Kg=o=>{if(o.length<=1)return o;const d=[];let a=[];return o.forEach(c=>{c[0]==="["?(d.push(...a.sort(),c),a=[]):a.push(c)}),d.push(...a.sort()),d},Qg=o=>({cache:Hg(o.cacheSize),parseClassName:Gg(o),...$g(o)}),qg=/\s+/,Zg=(o,d)=>{const{parseClassName:a,getClassGroupId:c,getConflictingClassGroupIds:f}=d,m=[],h=o.trim().split(qg);let x="";for(let C=h.length-1;C>=0;C-=1){const b=h[C],{modifiers:j,hasImportantModifier:P,baseClassName:L,maybePostfixModifierPosition:F}=a(b);let A=!!F,N=c(A?L.substring(0,F):L);if(!N){if(!A){x=b+(x.length>0?" "+x:x);continue}if(N=c(L),!N){x=b+(x.length>0?" "+x:x);continue}A=!1}const S=Kg(j).join(":"),E=P?S+Qf:S,D=E+N;if(m.includes(D))continue;m.push(D);const Z=f(N,A);for(let Y=0;Y0?" "+x:x)}return x};function Yg(){let o=0,d,a,c="";for(;o{if(typeof o=="string")return o;let d,a="";for(let c=0;cP(j),o());return a=Qg(b),c=a.cache.get,f=a.cache.set,m=x,x(C)}function x(C){const b=c(C);if(b)return b;const j=Zg(C,a);return f(C,j),j}return function(){return m(Yg.apply(null,arguments))}}const Te=o=>{const d=a=>a[o]||[];return d.isThemeGetter=!0,d},Zf=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xg=/^\d+\/\d+$/,e0=new Set(["px","full","screen"]),t0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r0=/\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$/,n0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,s0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xt=o=>zn(o)||e0.has(o)||Xg.test(o),jr=o=>On(o,"length",p0),zn=o=>!!o&&!Number.isNaN(Number(o)),ui=o=>On(o,"number",zn),ks=o=>!!o&&Number.isInteger(Number(o)),l0=o=>o.endsWith("%")&&zn(o.slice(0,-1)),je=o=>Zf.test(o),kr=o=>t0.test(o),a0=new Set(["length","size","percentage"]),i0=o=>On(o,a0,Yf),d0=o=>On(o,"position",Yf),c0=new Set(["image","url"]),u0=o=>On(o,c0,h0),f0=o=>On(o,"",m0),Ns=()=>!0,On=(o,d,a)=>{const c=Zf.exec(o);return c?c[1]?typeof d=="string"?c[1]===d:d.has(c[1]):a(c[2]):!1},p0=o=>r0.test(o)&&!n0.test(o),Yf=()=>!1,m0=o=>s0.test(o),h0=o=>o0.test(o),x0=()=>{const o=Te("colors"),d=Te("spacing"),a=Te("blur"),c=Te("brightness"),f=Te("borderColor"),m=Te("borderRadius"),h=Te("borderSpacing"),x=Te("borderWidth"),C=Te("contrast"),b=Te("grayscale"),j=Te("hueRotate"),P=Te("invert"),L=Te("gap"),F=Te("gradientColorStops"),A=Te("gradientColorStopPositions"),N=Te("inset"),S=Te("margin"),E=Te("opacity"),D=Te("padding"),Z=Te("saturate"),Y=Te("scale"),G=Te("sepia"),I=Te("skew"),$=Te("space"),ne=Te("translate"),se=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],be=()=>["auto",je,d],ce=()=>[je,d],Me=()=>["",Xt,jr],Pe=()=>["auto",zn,je],Re=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Se=()=>["solid","dashed","dotted","double","none"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],ae=()=>["","0",je],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>[zn,je];return{cacheSize:500,separator:":",theme:{colors:[Ns],spacing:[Xt,jr],blur:["none","",kr,je],brightness:w(),borderColor:[o],borderRadius:["none","","full",kr,je],borderSpacing:ce(),borderWidth:Me(),contrast:w(),grayscale:ae(),hueRotate:w(),invert:ae(),gap:ce(),gradientColorStops:[o],gradientColorStopPositions:[l0,jr],inset:be(),margin:be(),opacity:w(),padding:ce(),saturate:w(),scale:w(),sepia:ae(),skew:w(),space:ce(),translate:ce()},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[kr]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"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:[...Re(),je]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:se()}],"overscroll-x":[{"overscroll-x":se()}],"overscroll-y":[{"overscroll-y":se()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ks,je]}],basis:[{basis:be()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",je]}],grow:[{grow:ae()}],shrink:[{shrink:ae()}],order:[{order:["first","last","none",ks,je]}],"grid-cols":[{"grid-cols":[Ns]}],"col-start-end":[{col:["auto",{span:["full",ks,je]},je]}],"col-start":[{"col-start":Pe()}],"col-end":[{"col-end":Pe()}],"grid-rows":[{"grid-rows":[Ns]}],"row-start-end":[{row:["auto",{span:[ks,je]},je]}],"row-start":[{"row-start":Pe()}],"row-end":[{"row-end":Pe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[L]}],"gap-x":[{"gap-x":[L]}],"gap-y":[{"gap-y":[L]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",je,d]}],"min-w":[{"min-w":[je,d,"min","max","fit"]}],"max-w":[{"max-w":[je,d,"none","full","min","max","fit","prose",{screen:[kr]},kr]}],h:[{h:[je,d,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[je,d,"auto","min","max","fit"]}],"font-size":[{text:["base",kr,jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ui]}],"font-family":[{font:[Ns]}],"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",je]}],"line-clamp":[{"line-clamp":["none",zn,ui]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Xt,je]}],"list-image":[{"list-image":["none",je]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[o]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Xt,jr]}],"underline-offset":[{"underline-offset":["auto",Xt,je]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ce()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je]}],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",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Re(),d0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",i0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},u0]}],"bg-color":[{bg:[o]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[F]}],"gradient-via":[{via:[F]}],"gradient-to":[{to:[F]}],rounded:[{rounded:[m]}],"rounded-s":[{"rounded-s":[m]}],"rounded-e":[{"rounded-e":[m]}],"rounded-t":[{"rounded-t":[m]}],"rounded-r":[{"rounded-r":[m]}],"rounded-b":[{"rounded-b":[m]}],"rounded-l":[{"rounded-l":[m]}],"rounded-ss":[{"rounded-ss":[m]}],"rounded-se":[{"rounded-se":[m]}],"rounded-ee":[{"rounded-ee":[m]}],"rounded-es":[{"rounded-es":[m]}],"rounded-tl":[{"rounded-tl":[m]}],"rounded-tr":[{"rounded-tr":[m]}],"rounded-br":[{"rounded-br":[m]}],"rounded-bl":[{"rounded-bl":[m]}],"border-w":[{border:[x]}],"border-w-x":[{"border-x":[x]}],"border-w-y":[{"border-y":[x]}],"border-w-s":[{"border-s":[x]}],"border-w-e":[{"border-e":[x]}],"border-w-t":[{"border-t":[x]}],"border-w-r":[{"border-r":[x]}],"border-w-b":[{"border-b":[x]}],"border-w-l":[{"border-l":[x]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...Se(),"hidden"]}],"divide-x":[{"divide-x":[x]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[x]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:Se()}],"border-color":[{border:[f]}],"border-color-x":[{"border-x":[f]}],"border-color-y":[{"border-y":[f]}],"border-color-s":[{"border-s":[f]}],"border-color-e":[{"border-e":[f]}],"border-color-t":[{"border-t":[f]}],"border-color-r":[{"border-r":[f]}],"border-color-b":[{"border-b":[f]}],"border-color-l":[{"border-l":[f]}],"divide-color":[{divide:[f]}],"outline-style":[{outline:["",...Se()]}],"outline-offset":[{"outline-offset":[Xt,je]}],"outline-w":[{outline:[Xt,jr]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[Xt,jr]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",kr,f0]}],"shadow-color":[{shadow:[Ns]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ne()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[c]}],contrast:[{contrast:[C]}],"drop-shadow":[{"drop-shadow":["","none",kr,je]}],grayscale:[{grayscale:[b]}],"hue-rotate":[{"hue-rotate":[j]}],invert:[{invert:[P]}],saturate:[{saturate:[Z]}],sepia:[{sepia:[G]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[C]}],"backdrop-grayscale":[{"backdrop-grayscale":[b]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j]}],"backdrop-invert":[{"backdrop-invert":[P]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[Z]}],"backdrop-sepia":[{"backdrop-sepia":[G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[h]}],"border-spacing-x":[{"border-spacing-x":[h]}],"border-spacing-y":[{"border-spacing-y":[h]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",je]}],duration:[{duration:w()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:w()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[Y]}],"scale-x":[{"scale-x":[Y]}],"scale-y":[{"scale-y":[Y]}],rotate:[{rotate:[ks,je]}],"translate-x":[{"translate-x":[ne]}],"translate-y":[{"translate-y":[ne]}],"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",je]}],accent:[{accent:["auto",o]}],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",je]}],"caret-color":[{caret:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ce()}],"scroll-mx":[{"scroll-mx":ce()}],"scroll-my":[{"scroll-my":ce()}],"scroll-ms":[{"scroll-ms":ce()}],"scroll-me":[{"scroll-me":ce()}],"scroll-mt":[{"scroll-mt":ce()}],"scroll-mr":[{"scroll-mr":ce()}],"scroll-mb":[{"scroll-mb":ce()}],"scroll-ml":[{"scroll-ml":ce()}],"scroll-p":[{"scroll-p":ce()}],"scroll-px":[{"scroll-px":ce()}],"scroll-py":[{"scroll-py":ce()}],"scroll-ps":[{"scroll-ps":ce()}],"scroll-pe":[{"scroll-pe":ce()}],"scroll-pt":[{"scroll-pt":ce()}],"scroll-pr":[{"scroll-pr":ce()}],"scroll-pb":[{"scroll-pb":ce()}],"scroll-pl":[{"scroll-pl":ce()}],"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",je]}],fill:[{fill:[o,"none"]}],"stroke-w":[{stroke:[Xt,jr,ui]}],stroke:[{stroke:[o,"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"]}}},g0=Jg(x0);function ee(...o){return g0(Fg(o))}function Ms(o){return o?o.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function qr({type:o,title:d,message:a,defaultValue:c,onConfirm:f,onCancel:m}){return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:d}),n.jsx("button",{onClick:m||(()=>f()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a}),o==="prompt"&&n.jsx("input",{type:"text",id:"custom-dialog-input",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:h=>{var x;if(h.key==="Enter"){const C=(x=document.getElementById("custom-dialog-input"))==null?void 0:x.value;f(C)}}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(o==="confirm"||o==="prompt")&&n.jsx("button",{onClick:m,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"}),n.jsx("button",{onClick:()=>{var x;const h=o==="prompt"?(x=document.getElementById("custom-dialog-input"))==null?void 0:x.value:void 0;f(h)},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:o==="confirm"?"Ja, fortfahren":o==="prompt"?"Übernehmen":"OK"})]})]})})}function _n(o){return(o/1024**3).toFixed(1)}function Qo({value:o,label:d,detail:a}){const f=2*Math.PI*24,m=f-Math.min(o,100)/100*f,h=o>90?"stroke-red-500":o>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:ee("fill-none transition-all duration-700 ease-out",h),strokeWidth:"4.5",strokeDasharray:f,strokeDashoffset:m,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:d}),a&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function v0(){var T;const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState([]),[h,x]=p.useState([]),[C,b]=p.useState([]),[j,P]=p.useState(null),[L,F]=p.useState([]),[A,N]=p.useState(null),[S,E]=p.useState(""),[D,Z]=p.useState(!1),[Y,G]=p.useState(""),[I,$]=p.useState(!1),[ne,se]=p.useState({open:!1,actionPath:"",actionLabel:""}),[X,be]=p.useState(null),[ce,Me]=p.useState(!1);async function Pe(O){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:O})}),be({type:"alert",title:"Erfolgreich",message:`Hermes-Gehirn wurde auf '${O}' geändert. Der Gateway-Dienst wurde neu gestartet.`,onConfirm:()=>be(null)}),v(),Me(!1)}catch(ge){be({type:"alert",title:"Fehler",message:`Fehler beim Wechseln des Gehirns: ${ge.message}`,onConfirm:()=>be(null)})}}function Re(O,ge,Xe){be({type:"confirm",title:O,message:ge,onConfirm:()=>{be(null),Xe()},onCancel:()=>be(null)})}const[Se,Ne]=p.useState(""),[H,ae]=p.useState("stable"),[K,w]=p.useState(!1);function v(){fe("/api/system/status").then(d).catch(()=>{}),fe("/api/agent/status").then(c).catch(()=>{}),fe("/api/models").then(O=>{m(O.models||[]),x(O.running||[])}).catch(()=>{}),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{}),fe("/api/maintenance/updates").then(P).catch(()=>{}),fe("/api/jobs").then(O=>F(O.jobs||[])).catch(()=>{}),fe("/api/system/token-stats").then(N).catch(()=>{})}p.useEffect(()=>{v();const O=setInterval(v,3e3);return()=>clearInterval(O)},[]);async function V(O,ge,Xe,ft){E(`${ge} wird ausgeführt...`),Z(!0);try{const pt={...Xe},mt=await fe(O,{method:"POST",body:JSON.stringify(pt)});if(mt.status==="password_required"||mt.status==="incorrect_password"){se({open:!0,actionPath:O,actionLabel:ge,payload:Xe,error:mt.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),E("");return}mt.job_id?E(`${ge} gestartet (Job-ID: ${mt.job_id})`):mt.ok?E(`${ge} erfolgreich ausgeführt.`):E(`Fehler: ${mt.err||"Unbekannter Fehler"}`),v()}catch(pt){E(`Fehler bei ${ge}: ${pt.message}`)}finally{Z(!1)}}async function J(){$(!0);try{const O={...ne.payload,sudo_password:Y},ge=await fe(ne.actionPath,{method:"POST",body:JSON.stringify(O)});if(ge.status==="password_required"||ge.status==="incorrect_password"){se(Xe=>({...Xe,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}ge.job_id?E(`${ne.actionLabel} gestartet (Job-ID: ${ge.job_id})`):ge.ok?E(`${ne.actionLabel} erfolgreich ausgeführt.`):E(`Fehler: ${ge.err||"Unbekannter Fehler"}`),se({open:!1,actionPath:"",actionLabel:""}),G(""),v()}catch(O){E(`Fehler: ${O.message}`),se({open:!1,actionPath:"",actionLabel:""}),G("")}finally{$(!1)}}async function Q(O,ge){E(`Upgrade für ${O} wird gestartet...`);try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:O,role:ge,quant:"Q4_K_M",jinja:!0})}),E("Upgrade-Download gestartet."),v()}catch(Xe){E(`Upgrade fehlgeschlagen: ${Xe.message}`)}}async function oe(){if(!(!Se.trim()||K)){w(!0);try{await fe("/api/memory",{method:"POST",body:JSON.stringify({content:Se,category:H,source:"dashboard"})}),Ne(""),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{})}catch(O){console.error(O)}finally{w(!1)}}}const pe=L.find(O=>O.label.includes("OS-Update")&&(O.state==="running"||O.state==="queued")),me=L.find(O=>O.label.includes("Engine-Update")&&(O.state==="running"||O.state==="queued"));return n.jsxs("div",{className:"space-y-6",children:[ne.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:ne.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:Y,onChange:O=>G(O.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:O=>O.key==="Enter"&&J(),autoFocus:!0}),ne.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:ne.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},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"}),n.jsx("button",{onClick:J,disabled:!Y||I,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:I?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(yt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),o?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(Qo,{value:o.cpu.percent,label:"CPU",detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0}),n.jsx(Qo,{value:o.ram.percent,label:"RAM",detail:`${_n(o.ram.used)} / ${_n(o.ram.total)} GB`}),o.gpu&&o.gpu.busy_percent!=null&&o.gpu.gtt_used!=null&&o.gpu.gtt_total!=null&&n.jsx(Qo,{value:o.gpu.busy_percent,label:"GPU",detail:`${_n(o.gpu.gtt_used)} / ${_n(o.gpu.gtt_total)} GB`}),o.disk&&n.jsx(Qo,{value:o.disk.percent,label:"Disk",detail:`${_n(o.disk.used)} / ${_n(o.disk.total)} GB`})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(o==null?void 0:o.temp)&&(o.temp.cpu||o.temp.gpu)&&n.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[o.temp.cpu!=null&&n.jsxs("span",{children:["CPU Temp: ",o.temp.cpu," °C"]}),o.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",o.temp.gpu," °C"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ch,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(j==null?void 0:j.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(j.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),j?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.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:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:j.os>0?`${j.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.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:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:j.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:j.models>0?`${j.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>V("/api/maintenance/os-update","OS-Update"),disabled:D||!!pe,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:pe?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",pe.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>V("/api/maintenance/engine-update","Engine-Update"),disabled:D||!!me,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:me?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",me.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{Re("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>V("/api/maintenance/reboot","Reboot"))},disabled:D,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:[n.jsx(df,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),j.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:j.model_list.map(O=>n.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:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${O.role}: ${O.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:O.role}),": ",O.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>Q(O.repo,O.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:[n.jsx(Wr,{className:"h-2.5 w-2.5"})," Laden"]})]},O.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),S&&n.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:S}),n.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:[n.jsx(Hr,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.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"})})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ss,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(a==null?void 0:a.webui_url)&&n.jsxs("a",{href:Ms(a.webui_url),target:"_blank",rel:"noopener",className:ee("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",a.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(el,{className:"h-3 w-3"})," Hermes öffnen"]})]}),a?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>Me(!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 group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(yt,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(Es,{className:"h-3.5 w-3.5"}),a.brain_model?`model: ${a.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Es,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:["fast","heavy","coder","reasoning","vision","scout"].map(O=>{var ft;const ge=f.find(pt=>pt.role===O),Xe=ge?h.includes(ge.name):!1;return n.jsxs("div",{className:ee("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",Xe?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":ge?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ee("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",O==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":O==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":O==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":O==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":O==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:O}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:ge?(ft=ge.name.split("/").pop())==null?void 0:ft.replace(/\.gguf$/i,""):"nicht zugewiesen"}),ge&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[ge.prompt_cache&&n.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"}),ge.spec_draft_model&&n.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: ${ge.spec_draft_model})`,children:"SPEC"}),ge.parallel_slots>1&&n.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:`${ge.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ge.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:ge?Xe?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},O)})})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Cs,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:Se,onChange:O=>Ne(O.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"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:H,onChange:O=>ae(O.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:oe,disabled:!Se.trim()||K,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:[n.jsx(af,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:C.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):C.map(O=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:O.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:O.content,children:O.content})]},O.id))})]})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(ph,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),A?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[A.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",A.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:A.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(T=A==null?void 0:A.pricing)!=null&&T.heavy?` (Ø ${A.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${A.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})]}),a&&ce&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(yt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>Me(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...f.map(O=>{var ge;return((ge=O.name.split("/").pop())==null?void 0:ge.replace(".gguf",""))||O.name})].map(O=>{const ge=["auto","fast","heavy"].includes(O);return n.jsxs("button",{onClick:()=>Pe(O),className:ee("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.brain_model===O||!a.brain_model&&O==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:O}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ge?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(a.brain_model===O||!a.brain_model&&O==="auto")&&n.jsx(Dn,{className:"h-4 w-4 shrink-0 text-primary"})]},O)})})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,onConfirm:()=>X.onConfirm(),onCancel:X.onCancel})]})}function Ur({children:o,tone:d="muted"}){const a={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${a[d]}`,children:o})}function Zu({caps:o}){return o?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[o.coder&&n.jsx(Ur,{children:"💻 Code"}),o.vision&&n.jsx(Ur,{children:"👁 Bild"}),o.reasoning&&n.jsx(Ur,{children:"🧠 Reason"}),o.moe&&n.jsxs(Ur,{tone:"primary",children:["🧩 MoE",o.active_b?`·${o.active_b}b`:""]}),o.tools==="yes"&&n.jsx(Ur,{tone:"primary",children:"🛠 Tools"}),o.tools==="likely"&&n.jsx(Ur,{tone:"warn",children:"🛠 Tools?"}),o.embedding&&n.jsx(Ur,{children:"🔢 Embed"})]}):null}function Si(o){return o?o>1024**3?`${(o/1024**3).toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`:""}function y0(o){if(!o)return"";const d=Math.floor(o/60);return d>0?`${d} min`:`${o} s`}function b0({onError:o}){const[d,a]=p.useState([]),[c,f]=p.useState(null);function m(){fe("/api/jobs").then(b=>a(b.jobs||[])).catch(()=>{})}p.useEffect(()=>{m();const b=setInterval(m,2e3);return()=>clearInterval(b)},[]);async function h(b){try{await fe(`/api/jobs/${b}/cancel`,{method:"POST"}),m()}catch(j){o?o(j.message):f(j.message)}}const x=d.filter(b=>b.state==="running"||b.state==="queued"),C=d.filter(b=>b.state!=="running"&&b.state!=="queued").slice(-3);return x.length===0&&C.length===0?null:n.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:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),x.map(b=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:b.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[b.progress??0,"% • ",Si(b.done_bytes),"/",Si(b.total_bytes),b.eta_s?` • ETA ${y0(b.eta_s)}`:""]}),n.jsx("button",{onClick:()=>h(b.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"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${b.progress??0}%`}})})]},b.id)),C.map(b=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:b.label}),n.jsx("span",{className:ee("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",b.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:b.state})]},b.id)),c&&n.jsx(qr,{type:"alert",title:"Fehler",message:c,onConfirm:()=>f(null)})]})}function Br(o){if(!o)return"—";const d=o/1024**3;return d>=1?`${d.toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`}function Yu(o){return o?`${Math.round(o/1024)}k`:"—"}function w0({fit:o}){const d={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"}[o.level];return n.jsxs("span",{className:ee("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",d),children:[o.text," • ",o.req_gb," GB RAM"]})}const j0=["fast","heavy","coder","reasoning","agent","vision","scout"];function Ju(o){const d=o.toLowerCase();return d.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:d.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:d.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:d.includes("mistral")||d.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:d.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:d.includes("hermes")||d.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:d.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 k0(){var Yr,rr,Bt,Jr,In;const[o,d]=p.useState([]),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(null),[C,b]=p.useState(null),[j,P]=p.useState(!0),[L,F]=p.useState(""),[A,N]=p.useState(null),[S,E]=p.useState(null),[D,Z]=p.useState(!1),[Y,G]=p.useState(null),[I,$]=p.useState("grid"),[ne,se]=p.useState("all"),[X,be]=p.useState(null);function ce(R,re,ye){be({type:"alert",title:R,message:re,onConfirm:()=>{be(null)}})}function Me(R,re,ye,Ce){be({type:"confirm",title:R,message:re,onConfirm:()=>{be(null),ye()},onCancel:()=>{be(null)}})}function Pe(R,re,ye,Ce,De){be({type:"prompt",title:R,message:re,defaultValue:ye,onConfirm:Ct=>{be(null),Ce(Ct)},onCancel:()=>{be(null)}})}const Re=o.filter(R=>ne==="in_use"?!!R.role||a.includes(R.name):!0),[Se,Ne]=p.useState({width:800,height:360}),H=p.useRef(null),ae=p.useCallback(R=>{if(H.current&&(H.current.disconnect(),H.current=null),R){const re=new ResizeObserver(ye=>{if(!ye||ye.length===0)return;const Ce=ye[0].contentRect;Ne({width:Ce.width,height:Ce.height})});re.observe(R),H.current=re}},[]),K=Se.width,w=Se.height,v=R=>{const re=K*.1,ye=w*R,Ce=K*.5,De=w*.5,Ct=K*.3,Vt=ye,Wt=K*.3;return`M ${re} ${ye} C ${Ct} ${Vt}, ${Wt} ${De}, ${Ce} ${De}`},V=R=>{const re=K*.5,ye=w*.5,Ce=K*.9,De=w*R,Ct=K*.7,Vt=ye,Wt=K*.7;return`M ${re} ${ye} C ${Ct} ${Vt}, ${Wt} ${De}, ${Ce} ${De}`};function J(){Promise.all([fe("/api/models"),fe("/api/routing"),fe("/api/connect"),fe("/api/maintenance/updates")]).then(([R,re,ye,Ce])=>{d(R.models||[]),c(R.running||[]),m(re),x(ye),b(Ce)}).catch(R=>F(String(R))).finally(()=>P(!1))}p.useEffect(()=>{J();const R=setInterval(J,4e3);return()=>clearInterval(R)},[]);async function Q(R){try{await fe(`/api/models/${encodeURIComponent(R)}/load`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Laden des Modells: ${re.message}`)}}async function oe(R){try{await fe(`/api/models/${encodeURIComponent(R)}/unload`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Entladen des Modells: ${re.message}`)}}async function pe(){try{await fe("/api/models/unload",{method:"POST"}),J()}catch(R){ce("Fehler",`Fehler beim Entladen aller Modelle: ${R.message}`)}}async function me(R,re){try{await fe(`/api/models/${encodeURIComponent(re)}/role`,{method:"POST",body:JSON.stringify({role:R||null})}),J()}catch(ye){ce("Fehler",`Fehler beim Zuweisen der Rolle: ${ye.message||ye}`)}}async function T(R,re){Pe("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(re||32768),async ye=>{if(ye)try{await fe(`/api/models/${encodeURIComponent(R)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ye,10)})}),J()}catch(Ce){ce("Fehler",`Fehler beim Setzen des Kontexts: ${Ce.message||Ce}`)}})}async function O(R){Me("Modell löschen?",`Modell '${R}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await fe(`/api/models/${encodeURIComponent(R)}`,{method:"DELETE"}),J()}catch(re){ce("Fehler",`Fehler beim Löschen: ${re.message||re}`)}})}async function ge(R,re,ye,Ce){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:R,role:re,quant:ye,jinja:Ce})}),ce("Herunterladen gestartet",`Download für '${R}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(De){ce("Fehler",`Fehler beim Starten des Upgrades: ${De.message||De}`)}}async function Xe(R){R&&(await navigator.clipboard.writeText(R),Z(!0),setTimeout(()=>Z(!1),1500))}if(j)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(L)return n.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 (",L,")."]});const ft=o.filter(R=>a.includes(R.name)),pt=ft.reduce((R,re)=>R+(re.size_bytes||0),0),mt=16*1024**3,Tn=pt>mt?pt*1.2:mt,Zr=R=>o.find(re=>re.role===R),tr=R=>{const re=Zr(R);return re?a.includes(re.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` +`)},sg=0,Sn=[];function og(o){var d=p.useRef([]),a=p.useRef([0,0]),c=p.useRef(),f=p.useState(sg++)[0],m=p.useState(wf)[0],h=p.useRef(o);p.useEffect(function(){h.current=o},[o]),p.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(f));var N=Cx([o.lockRef.current],(o.shards||[]).map(Hu),!0).filter(Boolean);return N.forEach(function(C){return C.classList.add("allow-interactivity-".concat(f))}),function(){document.body.classList.remove("block-interactivity-".concat(f)),N.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(f))})}}},[o.inert,o.lockRef.current,o.shards]);var x=p.useCallback(function(N,C){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!h.current.allowPinchZoom;var E=Wo(N),D=a.current,Z="deltaX"in N?N.deltaX:D[0]-E[0],Y="deltaY"in N?N.deltaY:D[1]-E[1],G,I=N.target,$=Math.abs(Z)>Math.abs(Y)?"h":"v";if("touches"in N&&$==="h"&&I.type==="range")return!1;var ne=window.getSelection(),se=ne&&ne.anchorNode,X=se?se===I||se.contains(I):!1;if(X)return!1;var be=Vu($,I);if(!be)return!0;if(be?G=$:(G=$==="v"?"h":"v",be=Vu($,I)),!be)return!1;if(!c.current&&"changedTouches"in N&&(Z||Y)&&(c.current=G),!G)return!0;var ce=c.current||G;return tg(ce,C,N,ce==="h"?Z:Y)},[]),S=p.useCallback(function(N){var C=N;if(!(!Sn.length||Sn[Sn.length-1]!==m)){var E="deltaY"in C?Wu(C):Wo(C),D=d.current.filter(function(G){return G.name===C.type&&(G.target===C.target||C.target===G.shadowParent)&&rg(G.delta,E)})[0];if(D&&D.should){C.cancelable&&C.preventDefault();return}if(!D){var Z=(h.current.shards||[]).map(Hu).filter(Boolean).filter(function(G){return G.contains(C.target)}),Y=Z.length>0?x(C,Z[0]):!h.current.noIsolation;Y&&C.cancelable&&C.preventDefault()}}},[]),b=p.useCallback(function(N,C,E,D){var Z={name:N,delta:C,target:E,should:D,shadowParent:lg(E)};d.current.push(Z),setTimeout(function(){d.current=d.current.filter(function(Y){return Y!==Z})},1)},[]),j=p.useCallback(function(N){a.current=Wo(N),c.current=void 0},[]),P=p.useCallback(function(N){b(N.type,Wu(N),N.target,x(N,o.lockRef.current))},[]),L=p.useCallback(function(N){b(N.type,Wo(N),N.target,x(N,o.lockRef.current))},[]);p.useEffect(function(){return Sn.push(m),o.setCallbacks({onScrollCapture:P,onWheelCapture:P,onTouchMoveCapture:L}),document.addEventListener("wheel",S,Nn),document.addEventListener("touchmove",S,Nn),document.addEventListener("touchstart",j,Nn),function(){Sn=Sn.filter(function(N){return N!==m}),document.removeEventListener("wheel",S,Nn),document.removeEventListener("touchmove",S,Nn),document.removeEventListener("touchstart",j,Nn)}},[]);var F=o.removeScrollBar,A=o.inert;return p.createElement(p.Fragment,null,A?p.createElement(m,{styles:ng(f)}):null,F?p.createElement(Qx,{noRelative:o.noRelative,gapMode:o.gapMode}):null)}function lg(o){for(var d=null;o!==null;)o instanceof ShadowRoot&&(d=o.host,o=o.host),o=o.parentNode;return d}const ag=Ax(bf,og);var Sf=p.forwardRef(function(o,d){return p.createElement(sl,Bt({},o,{ref:d,sideCar:ag}))});Sf.classNames=sl.classNames;var ig=function(o){if(typeof document>"u")return null;var d=Array.isArray(o)?o[0]:o;return d.ownerDocument.body},Cn=new WeakMap,Ho=new WeakMap,Go={},ii=0,Cf=function(o){return o&&(o.host||Cf(o.parentNode))},dg=function(o,d){return d.map(function(a){if(o.contains(a))return a;var c=Cf(a);return c&&o.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",o,". Doing nothing"),null)}).filter(function(a){return!!a})},cg=function(o,d,a,c){var f=dg(d,Array.isArray(o)?o:[o]);Go[a]||(Go[a]=new WeakMap);var m=Go[a],h=[],x=new Set,S=new Set(f),b=function(P){!P||x.has(P)||(x.add(P),b(P.parentNode))};f.forEach(b);var j=function(P){!P||S.has(P)||Array.prototype.forEach.call(P.children,function(L){if(x.has(L))j(L);else try{var F=L.getAttribute(c),A=F!==null&&F!=="false",N=(Cn.get(L)||0)+1,C=(m.get(L)||0)+1;Cn.set(L,N),m.set(L,C),h.push(L),N===1&&A&&Ho.set(L,!0),C===1&&L.setAttribute(a,"true"),A||L.setAttribute(c,"true")}catch(E){console.error("aria-hidden: cannot operate on ",L,E)}})};return j(d),x.clear(),ii++,function(){h.forEach(function(P){var L=Cn.get(P)-1,F=m.get(P)-1;Cn.set(P,L),m.set(P,F),L||(Ho.has(P)||P.removeAttribute(c),Ho.delete(P)),F||P.removeAttribute(a)}),ii--,ii||(Cn=new WeakMap,Cn=new WeakMap,Ho=new WeakMap,Go={})}},ug=function(o,d,a){a===void 0&&(a="data-aria-hidden");var c=Array.from(Array.isArray(o)?o:[o]),f=ig(o);return f?(c.push.apply(c,Array.from(f.querySelectorAll("[aria-live], script"))),cg(c,f,a,"aria-hidden")):function(){return null}},ol="Dialog",[Ef]=Fh(ol),[fg,At]=Ef(ol),_f=o=>{const{__scopeDialog:d,children:a,open:c,defaultOpen:f,onOpenChange:m,modal:h=!0}=o,x=p.useRef(null),S=p.useRef(null),[b,j]=Wh({prop:c,defaultProp:f??!1,onChange:m,caller:ol});return n.jsx(fg,{scope:d,triggerRef:x,contentRef:S,contentId:tr(),titleId:tr(),descriptionId:tr(),open:b,onOpenChange:j,onOpenToggle:p.useCallback(()=>j(P=>!P),[j]),modal:h,children:a})};_f.displayName=ol;var Pf="DialogTrigger",pg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Pf,a),m=Qr(d,f.triggerRef);return n.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":Mi(f.open),...c,ref:m,onClick:Cr(o.onClick,f.onOpenToggle)})});pg.displayName=Pf;var Pi="DialogPortal",[mg,Mf]=Ef(Pi,{forceMount:void 0}),Rf=o=>{const{__scopeDialog:d,forceMount:a,children:c,container:f}=o,m=At(Pi,d);return n.jsx(mg,{scope:d,forceMount:a,children:p.Children.map(c,h=>n.jsx(nl,{present:a||m.open,children:n.jsx(gf,{asChild:!0,container:f,children:h})}))})};Rf.displayName=Pi;var rl="DialogOverlay",zf=p.forwardRef((o,d)=>{const a=Mf(rl,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=At(rl,o.__scopeDialog);return m.modal?n.jsx(nl,{present:c||m.open,children:n.jsx(xg,{...f,ref:d})}):null});zf.displayName=rl;var hg=ff("DialogOverlay.RemoveScroll"),xg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(rl,a),m=cx(),h=Qr(d,m);return n.jsx(Sf,{as:hg,allowPinchZoom:!0,shards:[f.contentRef],children:n.jsx(Je.div,{"data-state":Mi(f.open),...c,ref:h,style:{pointerEvents:"auto",...c.style}})})}),Ln="DialogContent",Df=p.forwardRef((o,d)=>{const a=Mf(Ln,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=At(Ln,o.__scopeDialog);return n.jsx(nl,{present:c||m.open,children:m.modal?n.jsx(gg,{...f,ref:d}):n.jsx(vg,{...f,ref:d})})});Df.displayName=Ln;var gg=p.forwardRef((o,d)=>{const a=At(Ln,o.__scopeDialog),c=p.useRef(null),f=Qr(d,a.contentRef,c);return p.useEffect(()=>{const m=c.current;if(m)return ug(m)},[]),n.jsx(Lf,{...o,ref:f,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:Cr(o.onCloseAutoFocus,m=>{var h;m.preventDefault(),(h=a.triggerRef.current)==null||h.focus()}),onPointerDownOutside:Cr(o.onPointerDownOutside,m=>{const h=m.detail.originalEvent,x=h.button===0&&h.ctrlKey===!0;(h.button===2||x)&&m.preventDefault()}),onFocusOutside:Cr(o.onFocusOutside,m=>m.preventDefault())})}),vg=p.forwardRef((o,d)=>{const a=At(Ln,o.__scopeDialog),c=p.useRef(!1),f=p.useRef(!1);return n.jsx(Lf,{...o,ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:m=>{var h,x;(h=o.onCloseAutoFocus)==null||h.call(o,m),m.defaultPrevented||(c.current||(x=a.triggerRef.current)==null||x.focus(),m.preventDefault()),c.current=!1,f.current=!1},onInteractOutside:m=>{var S,b;(S=o.onInteractOutside)==null||S.call(o,m),m.defaultPrevented||(c.current=!0,m.detail.originalEvent.type==="pointerdown"&&(f.current=!0));const h=m.target;((b=a.triggerRef.current)==null?void 0:b.contains(h))&&m.preventDefault(),m.detail.originalEvent.type==="focusin"&&f.current&&m.preventDefault()}})}),Lf=p.forwardRef((o,d)=>{const{__scopeDialog:a,trapFocus:c,onOpenAutoFocus:f,onCloseAutoFocus:m,...h}=o,x=At(Ln,a);return Sx(),n.jsx(n.Fragment,{children:n.jsx(hf,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:f,onUnmountAutoFocus:m,children:n.jsx(pf,{role:"dialog",id:x.contentId,"aria-describedby":x.descriptionId,"aria-labelledby":x.titleId,"data-state":Mi(x.open),...h,ref:d,deferPointerDownOutside:!0,onDismiss:()=>x.onOpenChange(!1)})})})}),Af="DialogTitle",yg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Af,a);return n.jsx(Je.h2,{id:f.titleId,...c,ref:d})});yg.displayName=Af;var Of="DialogDescription",bg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Of,a);return n.jsx(Je.p,{id:f.descriptionId,...c,ref:d})});bg.displayName=Of;var Tf="DialogClose",wg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Tf,a);return n.jsx(Je.button,{type:"button",...c,ref:d,onClick:Cr(o.onClick,()=>f.onOpenChange(!1))})});wg.displayName=Tf;function Mi(o){return o?"open":"closed"}var ws='[cmdk-group=""]',di='[cmdk-group-items=""]',jg='[cmdk-group-heading=""]',If='[cmdk-item=""]',Gu=`${If}:not([aria-disabled="true"])`,ji="cmdk-item-select",_n="data-value",kg=(o,d,a)=>Ih(o,d,a),Ff=p.createContext(void 0),Ms=()=>p.useContext(Ff),$f=p.createContext(void 0),Ri=()=>p.useContext($f),Uf=p.createContext(void 0),Bf=p.forwardRef((o,d)=>{let a=Pn(()=>{var v,V;return{search:"",value:(V=(v=o.value)!=null?v:o.defaultValue)!=null?V:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=Pn(()=>new Set),f=Pn(()=>new Map),m=Pn(()=>new Map),h=Pn(()=>new Set),x=Vf(o),{label:S,children:b,value:j,onValueChange:P,filter:L,shouldFilter:F,loop:A,disablePointerSelection:N=!1,vimBindings:C=!0,...E}=o,D=tr(),Z=tr(),Y=tr(),G=p.useRef(null),I=Lg();Kr(()=>{if(j!==void 0){let v=j.trim();a.current.value=v,$.emit()}},[j]),Kr(()=>{I(6,Me)},[]);let $=p.useMemo(()=>({subscribe:v=>(h.current.add(v),()=>h.current.delete(v)),snapshot:()=>a.current,setState:(v,V,J)=>{var Q,oe,pe,me;if(!Object.is(a.current[v],V)){if(a.current[v]=V,v==="search")ce(),X(),I(1,be);else if(v==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let T=document.getElementById(Y);T?T.focus():(Q=document.getElementById(D))==null||Q.focus()}if(I(7,()=>{var T;a.current.selectedItemId=(T=Pe())==null?void 0:T.id,$.emit()}),J||I(5,Me),((oe=x.current)==null?void 0:oe.value)!==void 0){let T=V??"";(me=(pe=x.current).onValueChange)==null||me.call(pe,T);return}}$.emit()}},emit:()=>{h.current.forEach(v=>v())}}),[]),ne=p.useMemo(()=>({value:(v,V,J)=>{var Q;V!==((Q=m.current.get(v))==null?void 0:Q.value)&&(m.current.set(v,{value:V,keywords:J}),a.current.filtered.items.set(v,se(V,J)),I(2,()=>{X(),$.emit()}))},item:(v,V)=>(c.current.add(v),V&&(f.current.has(V)?f.current.get(V).add(v):f.current.set(V,new Set([v]))),I(3,()=>{ce(),X(),a.current.value||be(),$.emit()}),()=>{m.current.delete(v),c.current.delete(v),a.current.filtered.items.delete(v);let J=Pe();I(4,()=>{ce(),(J==null?void 0:J.getAttribute("id"))===v&&be(),$.emit()})}),group:v=>(f.current.has(v)||f.current.set(v,new Set),()=>{m.current.delete(v),f.current.delete(v)}),filter:()=>x.current.shouldFilter,label:S||o["aria-label"],getDisablePointerSelection:()=>x.current.disablePointerSelection,listId:D,inputId:Y,labelId:Z,listInnerRef:G}),[]);function se(v,V){var J,Q;let oe=(Q=(J=x.current)==null?void 0:J.filter)!=null?Q:kg;return v?oe(v,a.current.search,V):0}function X(){if(!a.current.search||x.current.shouldFilter===!1)return;let v=a.current.filtered.items,V=[];a.current.filtered.groups.forEach(Q=>{let oe=f.current.get(Q),pe=0;oe.forEach(me=>{let T=v.get(me);pe=Math.max(T,pe)}),V.push([Q,pe])});let J=G.current;Re().sort((Q,oe)=>{var pe,me;let T=Q.getAttribute("id"),O=oe.getAttribute("id");return((pe=v.get(O))!=null?pe:0)-((me=v.get(T))!=null?me:0)}).forEach(Q=>{let oe=Q.closest(di);oe?oe.appendChild(Q.parentElement===oe?Q:Q.closest(`${di} > *`)):J.appendChild(Q.parentElement===J?Q:Q.closest(`${di} > *`))}),V.sort((Q,oe)=>oe[1]-Q[1]).forEach(Q=>{var oe;let pe=(oe=G.current)==null?void 0:oe.querySelector(`${ws}[${_n}="${encodeURIComponent(Q[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function be(){let v=Re().find(J=>J.getAttribute("aria-disabled")!=="true"),V=v==null?void 0:v.getAttribute(_n);$.setState("value",V||void 0)}function ce(){var v,V,J,Q;if(!a.current.search||x.current.shouldFilter===!1){a.current.filtered.count=c.current.size;return}a.current.filtered.groups=new Set;let oe=0;for(let pe of c.current){let me=(V=(v=m.current.get(pe))==null?void 0:v.value)!=null?V:"",T=(Q=(J=m.current.get(pe))==null?void 0:J.keywords)!=null?Q:[],O=se(me,T);a.current.filtered.items.set(pe,O),O>0&&oe++}for(let[pe,me]of f.current)for(let T of me)if(a.current.filtered.items.get(T)>0){a.current.filtered.groups.add(pe);break}a.current.filtered.count=oe}function Me(){var v,V,J;let Q=Pe();Q&&(((v=Q.parentElement)==null?void 0:v.firstChild)===Q&&((J=(V=Q.closest(ws))==null?void 0:V.querySelector(jg))==null||J.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function Pe(){var v;return(v=G.current)==null?void 0:v.querySelector(`${If}[aria-selected="true"]`)}function Re(){var v;return Array.from(((v=G.current)==null?void 0:v.querySelectorAll(Gu))||[])}function Se(v){let V=Re()[v];V&&$.setState("value",V.getAttribute(_n))}function Ne(v){var V;let J=Pe(),Q=Re(),oe=Q.findIndex(me=>me===J),pe=Q[oe+v];(V=x.current)!=null&&V.loop&&(pe=oe+v<0?Q[Q.length-1]:oe+v===Q.length?Q[0]:Q[oe+v]),pe&&$.setState("value",pe.getAttribute(_n))}function H(v){let V=Pe(),J=V==null?void 0:V.closest(ws),Q;for(;J&&!Q;)J=v>0?zg(J,ws):Dg(J,ws),Q=J==null?void 0:J.querySelector(Gu);Q?$.setState("value",Q.getAttribute(_n)):Ne(v)}let ae=()=>Se(Re().length-1),K=v=>{v.preventDefault(),v.metaKey?ae():v.altKey?H(1):Ne(1)},w=v=>{v.preventDefault(),v.metaKey?Se(0):v.altKey?H(-1):Ne(-1)};return p.createElement(Je.div,{ref:d,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:v=>{var V;(V=E.onKeyDown)==null||V.call(E,v);let J=v.nativeEvent.isComposing||v.keyCode===229;if(!(v.defaultPrevented||J))switch(v.key){case"n":case"j":{C&&v.ctrlKey&&K(v);break}case"ArrowDown":{K(v);break}case"p":case"k":{C&&v.ctrlKey&&w(v);break}case"ArrowUp":{w(v);break}case"Home":{v.preventDefault(),Se(0);break}case"End":{v.preventDefault(),ae();break}case"Enter":{v.preventDefault();let Q=Pe();if(Q){let oe=new Event(ji);Q.dispatchEvent(oe)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Og},S),ll(o,v=>p.createElement($f.Provider,{value:$},p.createElement(Ff.Provider,{value:ne},v))))}),Ng=p.forwardRef((o,d)=>{var a,c;let f=tr(),m=p.useRef(null),h=p.useContext(Uf),x=Ms(),S=Vf(o),b=(c=(a=S.current)==null?void 0:a.forceMount)!=null?c:h==null?void 0:h.forceMount;Kr(()=>{if(!b)return x.item(f,h==null?void 0:h.id)},[b]);let j=Wf(f,m,[o.value,o.children,m],o.keywords),P=Ri(),L=Er(I=>I.value&&I.value===j.current),F=Er(I=>b||x.filter()===!1?!0:I.search?I.filtered.items.get(f)>0:!0);p.useEffect(()=>{let I=m.current;if(!(!I||o.disabled))return I.addEventListener(ji,A),()=>I.removeEventListener(ji,A)},[F,o.onSelect,o.disabled]);function A(){var I,$;N(),($=(I=S.current).onSelect)==null||$.call(I,j.current)}function N(){P.setState("value",j.current,!0)}if(!F)return null;let{disabled:C,value:E,onSelect:D,forceMount:Z,keywords:Y,...G}=o;return p.createElement(Je.div,{ref:Dn(m,d),...G,id:f,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!L,"data-disabled":!!C,"data-selected":!!L,onPointerMove:C||x.getDisablePointerSelection()?void 0:N,onClick:C?void 0:A},o.children)}),Sg=p.forwardRef((o,d)=>{let{heading:a,children:c,forceMount:f,...m}=o,h=tr(),x=p.useRef(null),S=p.useRef(null),b=tr(),j=Ms(),P=Er(F=>f||j.filter()===!1?!0:F.search?F.filtered.groups.has(h):!0);Kr(()=>j.group(h),[]),Wf(h,x,[o.value,o.heading,S]);let L=p.useMemo(()=>({id:h,forceMount:f}),[f]);return p.createElement(Je.div,{ref:Dn(x,d),...m,"cmdk-group":"",role:"presentation",hidden:P?void 0:!0},a&&p.createElement("div",{ref:S,"cmdk-group-heading":"","aria-hidden":!0,id:b},a),ll(o,F=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?b:void 0},p.createElement(Uf.Provider,{value:L},F))))}),Cg=p.forwardRef((o,d)=>{let{alwaysRender:a,...c}=o,f=p.useRef(null),m=Er(h=>!h.search);return!a&&!m?null:p.createElement(Je.div,{ref:Dn(f,d),...c,"cmdk-separator":"",role:"separator"})}),Eg=p.forwardRef((o,d)=>{let{onValueChange:a,...c}=o,f=o.value!=null,m=Ri(),h=Er(b=>b.search),x=Er(b=>b.selectedItemId),S=Ms();return p.useEffect(()=>{o.value!=null&&m.setState("search",o.value)},[o.value]),p.createElement(Je.input,{ref:d,...c,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":S.listId,"aria-labelledby":S.labelId,"aria-activedescendant":x,id:S.inputId,type:"text",value:f?o.value:h,onChange:b=>{f||m.setState("search",b.target.value),a==null||a(b.target.value)}})}),_g=p.forwardRef((o,d)=>{let{children:a,label:c="Suggestions",...f}=o,m=p.useRef(null),h=p.useRef(null),x=Er(b=>b.selectedItemId),S=Ms();return p.useEffect(()=>{if(h.current&&m.current){let b=h.current,j=m.current,P,L=new ResizeObserver(()=>{P=requestAnimationFrame(()=>{let F=b.offsetHeight;j.style.setProperty("--cmdk-list-height",F.toFixed(1)+"px")})});return L.observe(b),()=>{cancelAnimationFrame(P),L.unobserve(b)}}},[]),p.createElement(Je.div,{ref:Dn(m,d),...f,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":x,"aria-label":c,id:S.listId},ll(o,b=>p.createElement("div",{ref:Dn(h,S.listInnerRef),"cmdk-list-sizer":""},b)))}),Pg=p.forwardRef((o,d)=>{let{open:a,onOpenChange:c,overlayClassName:f,contentClassName:m,container:h,...x}=o;return p.createElement(_f,{open:a,onOpenChange:c},p.createElement(Rf,{container:h},p.createElement(zf,{"cmdk-overlay":"",className:f}),p.createElement(Df,{"aria-label":o.label,"cmdk-dialog":"",className:m},p.createElement(Bf,{ref:d,...x}))))}),Mg=p.forwardRef((o,d)=>Er(a=>a.filtered.count===0)?p.createElement(Je.div,{ref:d,...o,"cmdk-empty":"",role:"presentation"}):null),Rg=p.forwardRef((o,d)=>{let{progress:a,children:c,label:f="Loading...",...m}=o;return p.createElement(Je.div,{ref:d,...m,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":f},ll(o,h=>p.createElement("div",{"aria-hidden":!0},h)))}),En=Object.assign(Bf,{List:_g,Item:Ng,Input:Eg,Group:Sg,Separator:Cg,Dialog:Pg,Empty:Mg,Loading:Rg});function zg(o,d){let a=o.nextElementSibling;for(;a;){if(a.matches(d))return a;a=a.nextElementSibling}}function Dg(o,d){let a=o.previousElementSibling;for(;a;){if(a.matches(d))return a;a=a.previousElementSibling}}function Vf(o){let d=p.useRef(o);return Kr(()=>{d.current=o}),d}var Kr=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Pn(o){let d=p.useRef();return d.current===void 0&&(d.current=o()),d}function Er(o){let d=Ri(),a=()=>o(d.snapshot());return p.useSyncExternalStore(d.subscribe,a,a)}function Wf(o,d,a,c=[]){let f=p.useRef(),m=Ms();return Kr(()=>{var h;let x=(()=>{var b;for(let j of a){if(typeof j=="string")return j.trim();if(typeof j=="object"&&"current"in j)return j.current?(b=j.current.textContent)==null?void 0:b.trim():f.current}})(),S=c.map(b=>b.trim());m.value(o,x,S),(h=d.current)==null||h.setAttribute(_n,x),f.current=x}),f}var Lg=()=>{let[o,d]=p.useState(),a=Pn(()=>new Map);return Kr(()=>{a.current.forEach(c=>c()),a.current=new Map},[o]),(c,f)=>{a.current.set(c,f),d({})}};function Ag(o){let d=o.type;return typeof d=="function"?d(o.props):"render"in d?d.render(o.props):o}function ll({asChild:o,children:d},a){return o&&p.isValidElement(d)?p.cloneElement(Ag(d),{ref:d.ref},a(d.props.children)):a(d)}var Og={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Tg({onNavigate:o}){const[d,a]=p.useState(!1);return p.useEffect(()=>{const c=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&(f.preventDefault(),a(m=>!m))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),n.jsx(En.Dialog,{open:d,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:n.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:[n.jsx(En.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"}),n.jsxs(En.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(En.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(En.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:vi.map(c=>n.jsxs(En.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{o(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:[n.jsx(c.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:c.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function fe(o,d){var S;const a={"Content-Type":"application/json",...d==null?void 0:d.headers},c=localStorage.getItem("mc_sudo_password"),f=localStorage.getItem("mc_hf_token");c&&(a["X-Sudo-Password"]=c);let m=d==null?void 0:d.body;if((((S=d==null?void 0:d.method)==null?void 0:S.toUpperCase())||"GET")==="POST"){if(typeof m=="string")try{const b=JSON.parse(m);let j=!1;c&&!("sudo_password"in b)&&(b.sudo_password=c,j=!0),f&&!("hf_token"in b)&&(b.hf_token=f,j=!0),j&&(m=JSON.stringify(b))}catch{}else if(!m){const b={};c&&(b.sudo_password=c),f&&(b.hf_token=f),Object.keys(b).length>0&&(m=JSON.stringify(b))}}const x=await fetch(o,{...d,headers:a,body:m});if(!x.ok)throw new Error(`${x.status} ${x.statusText}`);return x.json()}function Hf(o){var d,a,c="";if(typeof o=="string"||typeof o=="number")c+=o;else if(typeof o=="object")if(Array.isArray(o)){var f=o.length;for(d=0;d{const d=Ug(o),{conflictingClassGroups:a,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:h=>{const x=h.split(zi);return x[0]===""&&x.length!==1&&x.shift(),Gf(x,d)||$g(h)},getConflictingClassGroupIds:(h,x)=>{const S=a[h]||[];return x&&c[h]?[...S,...c[h]]:S}}},Gf=(o,d)=>{var h;if(o.length===0)return d.classGroupId;const a=o[0],c=d.nextPart.get(a),f=c?Gf(o.slice(1),c):void 0;if(f)return f;if(d.validators.length===0)return;const m=o.join(zi);return(h=d.validators.find(({validator:x})=>x(m)))==null?void 0:h.classGroupId},Ku=/^\[(.+)\]$/,$g=o=>{if(Ku.test(o)){const d=Ku.exec(o)[1],a=d==null?void 0:d.substring(0,d.indexOf(":"));if(a)return"arbitrary.."+a}},Ug=o=>{const{theme:d,prefix:a}=o,c={nextPart:new Map,validators:[]};return Vg(Object.entries(o.classGroups),a).forEach(([m,h])=>{ki(h,c,m,d)}),c},ki=(o,d,a,c)=>{o.forEach(f=>{if(typeof f=="string"){const m=f===""?d:Qu(d,f);m.classGroupId=a;return}if(typeof f=="function"){if(Bg(f)){ki(f(c),d,a,c);return}d.validators.push({validator:f,classGroupId:a});return}Object.entries(f).forEach(([m,h])=>{ki(h,Qu(d,m),a,c)})})},Qu=(o,d)=>{let a=o;return d.split(zi).forEach(c=>{a.nextPart.has(c)||a.nextPart.set(c,{nextPart:new Map,validators:[]}),a=a.nextPart.get(c)}),a},Bg=o=>o.isThemeGetter,Vg=(o,d)=>d?o.map(([a,c])=>{const f=c.map(m=>typeof m=="string"?d+m:typeof m=="object"?Object.fromEntries(Object.entries(m).map(([h,x])=>[d+h,x])):m);return[a,f]}):o,Wg=o=>{if(o<1)return{get:()=>{},set:()=>{}};let d=0,a=new Map,c=new Map;const f=(m,h)=>{a.set(m,h),d++,d>o&&(d=0,c=a,a=new Map)};return{get(m){let h=a.get(m);if(h!==void 0)return h;if((h=c.get(m))!==void 0)return f(m,h),h},set(m,h){a.has(m)?a.set(m,h):f(m,h)}}},Kf="!",Hg=o=>{const{separator:d,experimentalParseClassName:a}=o,c=d.length===1,f=d[0],m=d.length,h=x=>{const S=[];let b=0,j=0,P;for(let C=0;Cj?P-j:void 0;return{modifiers:S,hasImportantModifier:F,baseClassName:A,maybePostfixModifierPosition:N}};return a?x=>a({className:x,parseClassName:h}):h},Gg=o=>{if(o.length<=1)return o;const d=[];let a=[];return o.forEach(c=>{c[0]==="["?(d.push(...a.sort(),c),a=[]):a.push(c)}),d.push(...a.sort()),d},Kg=o=>({cache:Wg(o.cacheSize),parseClassName:Hg(o),...Fg(o)}),Qg=/\s+/,qg=(o,d)=>{const{parseClassName:a,getClassGroupId:c,getConflictingClassGroupIds:f}=d,m=[],h=o.trim().split(Qg);let x="";for(let S=h.length-1;S>=0;S-=1){const b=h[S],{modifiers:j,hasImportantModifier:P,baseClassName:L,maybePostfixModifierPosition:F}=a(b);let A=!!F,N=c(A?L.substring(0,F):L);if(!N){if(!A){x=b+(x.length>0?" "+x:x);continue}if(N=c(L),!N){x=b+(x.length>0?" "+x:x);continue}A=!1}const C=Gg(j).join(":"),E=P?C+Kf:C,D=E+N;if(m.includes(D))continue;m.push(D);const Z=f(N,A);for(let Y=0;Y0?" "+x:x)}return x};function Zg(){let o=0,d,a,c="";for(;o{if(typeof o=="string")return o;let d,a="";for(let c=0;cP(j),o());return a=Kg(b),c=a.cache.get,f=a.cache.set,m=x,x(S)}function x(S){const b=c(S);if(b)return b;const j=qg(S,a);return f(S,j),j}return function(){return m(Zg.apply(null,arguments))}}const Te=o=>{const d=a=>a[o]||[];return d.isThemeGetter=!0,d},qf=/^\[(?:([a-z-]+):)?(.+)\]$/i,Jg=/^\d+\/\d+$/,Xg=new Set(["px","full","screen"]),e0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t0=/\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$/,r0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,s0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,er=o=>Rn(o)||Xg.has(o)||Jg.test(o),kr=o=>An(o,"length",f0),Rn=o=>!!o&&!Number.isNaN(Number(o)),ci=o=>An(o,"number",Rn),js=o=>!!o&&Number.isInteger(Number(o)),o0=o=>o.endsWith("%")&&Rn(o.slice(0,-1)),je=o=>qf.test(o),Nr=o=>e0.test(o),l0=new Set(["length","size","percentage"]),a0=o=>An(o,l0,Zf),i0=o=>An(o,"position",Zf),d0=new Set(["image","url"]),c0=o=>An(o,d0,m0),u0=o=>An(o,"",p0),ks=()=>!0,An=(o,d,a)=>{const c=qf.exec(o);return c?c[1]?typeof d=="string"?c[1]===d:d.has(c[1]):a(c[2]):!1},f0=o=>t0.test(o)&&!r0.test(o),Zf=()=>!1,p0=o=>n0.test(o),m0=o=>s0.test(o),h0=()=>{const o=Te("colors"),d=Te("spacing"),a=Te("blur"),c=Te("brightness"),f=Te("borderColor"),m=Te("borderRadius"),h=Te("borderSpacing"),x=Te("borderWidth"),S=Te("contrast"),b=Te("grayscale"),j=Te("hueRotate"),P=Te("invert"),L=Te("gap"),F=Te("gradientColorStops"),A=Te("gradientColorStopPositions"),N=Te("inset"),C=Te("margin"),E=Te("opacity"),D=Te("padding"),Z=Te("saturate"),Y=Te("scale"),G=Te("sepia"),I=Te("skew"),$=Te("space"),ne=Te("translate"),se=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],be=()=>["auto",je,d],ce=()=>[je,d],Me=()=>["",er,kr],Pe=()=>["auto",Rn,je],Re=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Se=()=>["solid","dashed","dotted","double","none"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],ae=()=>["","0",je],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>[Rn,je];return{cacheSize:500,separator:":",theme:{colors:[ks],spacing:[er,kr],blur:["none","",Nr,je],brightness:w(),borderColor:[o],borderRadius:["none","","full",Nr,je],borderSpacing:ce(),borderWidth:Me(),contrast:w(),grayscale:ae(),hueRotate:w(),invert:ae(),gap:ce(),gradientColorStops:[o],gradientColorStopPositions:[o0,kr],inset:be(),margin:be(),opacity:w(),padding:ce(),saturate:w(),scale:w(),sepia:ae(),skew:w(),space:ce(),translate:ce()},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[Nr]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"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:[...Re(),je]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:se()}],"overscroll-x":[{"overscroll-x":se()}],"overscroll-y":[{"overscroll-y":se()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",js,je]}],basis:[{basis:be()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",je]}],grow:[{grow:ae()}],shrink:[{shrink:ae()}],order:[{order:["first","last","none",js,je]}],"grid-cols":[{"grid-cols":[ks]}],"col-start-end":[{col:["auto",{span:["full",js,je]},je]}],"col-start":[{"col-start":Pe()}],"col-end":[{"col-end":Pe()}],"grid-rows":[{"grid-rows":[ks]}],"row-start-end":[{row:["auto",{span:[js,je]},je]}],"row-start":[{"row-start":Pe()}],"row-end":[{"row-end":Pe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[L]}],"gap-x":[{"gap-x":[L]}],"gap-y":[{"gap-y":[L]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",je,d]}],"min-w":[{"min-w":[je,d,"min","max","fit"]}],"max-w":[{"max-w":[je,d,"none","full","min","max","fit","prose",{screen:[Nr]},Nr]}],h:[{h:[je,d,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[je,d,"auto","min","max","fit"]}],"font-size":[{text:["base",Nr,kr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ci]}],"font-family":[{font:[ks]}],"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",je]}],"line-clamp":[{"line-clamp":["none",Rn,ci]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",er,je]}],"list-image":[{"list-image":["none",je]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[o]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",er,kr]}],"underline-offset":[{"underline-offset":["auto",er,je]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ce()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je]}],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",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Re(),i0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",a0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},c0]}],"bg-color":[{bg:[o]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[F]}],"gradient-via":[{via:[F]}],"gradient-to":[{to:[F]}],rounded:[{rounded:[m]}],"rounded-s":[{"rounded-s":[m]}],"rounded-e":[{"rounded-e":[m]}],"rounded-t":[{"rounded-t":[m]}],"rounded-r":[{"rounded-r":[m]}],"rounded-b":[{"rounded-b":[m]}],"rounded-l":[{"rounded-l":[m]}],"rounded-ss":[{"rounded-ss":[m]}],"rounded-se":[{"rounded-se":[m]}],"rounded-ee":[{"rounded-ee":[m]}],"rounded-es":[{"rounded-es":[m]}],"rounded-tl":[{"rounded-tl":[m]}],"rounded-tr":[{"rounded-tr":[m]}],"rounded-br":[{"rounded-br":[m]}],"rounded-bl":[{"rounded-bl":[m]}],"border-w":[{border:[x]}],"border-w-x":[{"border-x":[x]}],"border-w-y":[{"border-y":[x]}],"border-w-s":[{"border-s":[x]}],"border-w-e":[{"border-e":[x]}],"border-w-t":[{"border-t":[x]}],"border-w-r":[{"border-r":[x]}],"border-w-b":[{"border-b":[x]}],"border-w-l":[{"border-l":[x]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...Se(),"hidden"]}],"divide-x":[{"divide-x":[x]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[x]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:Se()}],"border-color":[{border:[f]}],"border-color-x":[{"border-x":[f]}],"border-color-y":[{"border-y":[f]}],"border-color-s":[{"border-s":[f]}],"border-color-e":[{"border-e":[f]}],"border-color-t":[{"border-t":[f]}],"border-color-r":[{"border-r":[f]}],"border-color-b":[{"border-b":[f]}],"border-color-l":[{"border-l":[f]}],"divide-color":[{divide:[f]}],"outline-style":[{outline:["",...Se()]}],"outline-offset":[{"outline-offset":[er,je]}],"outline-w":[{outline:[er,kr]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[er,kr]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",Nr,u0]}],"shadow-color":[{shadow:[ks]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ne()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[c]}],contrast:[{contrast:[S]}],"drop-shadow":[{"drop-shadow":["","none",Nr,je]}],grayscale:[{grayscale:[b]}],"hue-rotate":[{"hue-rotate":[j]}],invert:[{invert:[P]}],saturate:[{saturate:[Z]}],sepia:[{sepia:[G]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[S]}],"backdrop-grayscale":[{"backdrop-grayscale":[b]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j]}],"backdrop-invert":[{"backdrop-invert":[P]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[Z]}],"backdrop-sepia":[{"backdrop-sepia":[G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[h]}],"border-spacing-x":[{"border-spacing-x":[h]}],"border-spacing-y":[{"border-spacing-y":[h]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",je]}],duration:[{duration:w()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:w()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[Y]}],"scale-x":[{"scale-x":[Y]}],"scale-y":[{"scale-y":[Y]}],rotate:[{rotate:[js,je]}],"translate-x":[{"translate-x":[ne]}],"translate-y":[{"translate-y":[ne]}],"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",je]}],accent:[{accent:["auto",o]}],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",je]}],"caret-color":[{caret:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ce()}],"scroll-mx":[{"scroll-mx":ce()}],"scroll-my":[{"scroll-my":ce()}],"scroll-ms":[{"scroll-ms":ce()}],"scroll-me":[{"scroll-me":ce()}],"scroll-mt":[{"scroll-mt":ce()}],"scroll-mr":[{"scroll-mr":ce()}],"scroll-mb":[{"scroll-mb":ce()}],"scroll-ml":[{"scroll-ml":ce()}],"scroll-p":[{"scroll-p":ce()}],"scroll-px":[{"scroll-px":ce()}],"scroll-py":[{"scroll-py":ce()}],"scroll-ps":[{"scroll-ps":ce()}],"scroll-pe":[{"scroll-pe":ce()}],"scroll-pt":[{"scroll-pt":ce()}],"scroll-pr":[{"scroll-pr":ce()}],"scroll-pb":[{"scroll-pb":ce()}],"scroll-pl":[{"scroll-pl":ce()}],"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",je]}],fill:[{fill:[o,"none"]}],"stroke-w":[{stroke:[er,kr,ci]}],stroke:[{stroke:[o,"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"]}}},x0=Yg(h0);function ee(...o){return x0(Ig(o))}function Ps(o){return o?o.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function ft(o){return(o/1024**3).toFixed(1)}function Ni(o){return o?o>1024**3?`${(o/1024**3).toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`:""}function Ur(o){if(!o)return"—";const d=o/1024**3;return d>=1?`${d.toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`}function g0(o){if(!o)return"";const d=Math.floor(o/60);return d>0?`${d} min`:`${o} s`}function qu(o){return o?`${Math.round(o/1024)}k`:"—"}function qr({type:o,title:d,message:a,defaultValue:c,onConfirm:f,onCancel:m}){const h=p.useRef(null);return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:d}),n.jsx("button",{onClick:m||(()=>f()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a}),o==="prompt"&&n.jsx("input",{ref:h,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:x=>{var S;x.key==="Enter"&&f((S=h.current)==null?void 0:S.value)}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(o==="confirm"||o==="prompt")&&n.jsx("button",{onClick:m,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"}),n.jsx("button",{onClick:()=>{var S;const x=o==="prompt"?(S=h.current)==null?void 0:S.value:void 0;f(x)},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:o==="confirm"?"Ja, fortfahren":o==="prompt"?"Übernehmen":"OK"})]})]})})}function Ko({value:o,label:d,detail:a}){const f=2*Math.PI*24,m=f-Math.min(o,100)/100*f,h=o>90?"stroke-red-500":o>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:ee("fill-none transition-all duration-700 ease-out",h),strokeWidth:"4.5",strokeDasharray:f,strokeDashoffset:m,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:d}),a&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function v0(){var T;const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState([]),[h,x]=p.useState([]),[S,b]=p.useState([]),[j,P]=p.useState(null),[L,F]=p.useState([]),[A,N]=p.useState(null),[C,E]=p.useState(""),[D,Z]=p.useState(!1),[Y,G]=p.useState(""),[I,$]=p.useState(!1),[ne,se]=p.useState({open:!1,actionPath:"",actionLabel:""}),[X,be]=p.useState(null),[ce,Me]=p.useState(!1);async function Pe(O){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:O})}),be({type:"alert",title:"Erfolgreich",message:`Hermes-Gehirn wurde auf '${O}' geändert. Der Gateway-Dienst wurde neu gestartet.`,onConfirm:()=>be(null)}),v(),Me(!1)}catch(ge){be({type:"alert",title:"Fehler",message:`Fehler beim Wechseln des Gehirns: ${ge.message}`,onConfirm:()=>be(null)})}}function Re(O,ge,Xe){be({type:"confirm",title:O,message:ge,onConfirm:()=>{be(null),Xe()},onCancel:()=>be(null)})}const[Se,Ne]=p.useState(""),[H,ae]=p.useState("stable"),[K,w]=p.useState(!1);function v(){fe("/api/system/status").then(d).catch(()=>{}),fe("/api/agent/status").then(c).catch(()=>{}),fe("/api/models").then(O=>{m(O.models||[]),x(O.running||[])}).catch(()=>{}),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{}),fe("/api/maintenance/updates").then(P).catch(()=>{}),fe("/api/jobs").then(O=>F(O.jobs||[])).catch(()=>{}),fe("/api/system/token-stats").then(N).catch(()=>{})}p.useEffect(()=>{v();const O=setInterval(v,3e3);return()=>clearInterval(O)},[]);async function V(O,ge,Xe,pt){E(`${ge} wird ausgeführt...`),Z(!0);try{const mt={...Xe},ht=await fe(O,{method:"POST",body:JSON.stringify(mt)});if(ht.status==="password_required"||ht.status==="incorrect_password"){se({open:!0,actionPath:O,actionLabel:ge,payload:Xe,error:ht.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),E("");return}ht.job_id?E(`${ge} gestartet (Job-ID: ${ht.job_id})`):ht.ok?E(`${ge} erfolgreich ausgeführt.`):E(`Fehler: ${ht.err||"Unbekannter Fehler"}`),v()}catch(mt){E(`Fehler bei ${ge}: ${mt.message}`)}finally{Z(!1)}}async function J(){$(!0);try{const O={...ne.payload,sudo_password:Y},ge=await fe(ne.actionPath,{method:"POST",body:JSON.stringify(O)});if(ge.status==="password_required"||ge.status==="incorrect_password"){se(Xe=>({...Xe,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}ge.job_id?E(`${ne.actionLabel} gestartet (Job-ID: ${ge.job_id})`):ge.ok?E(`${ne.actionLabel} erfolgreich ausgeführt.`):E(`Fehler: ${ge.err||"Unbekannter Fehler"}`),se({open:!1,actionPath:"",actionLabel:""}),G(""),v()}catch(O){E(`Fehler: ${O.message}`),se({open:!1,actionPath:"",actionLabel:""}),G("")}finally{$(!1)}}async function Q(O,ge){E(`Upgrade für ${O} wird gestartet...`);try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:O,role:ge,quant:"Q4_K_M",jinja:!0})}),E("Upgrade-Download gestartet."),v()}catch(Xe){E(`Upgrade fehlgeschlagen: ${Xe.message}`)}}async function oe(){if(!(!Se.trim()||K)){w(!0);try{await fe("/api/memory",{method:"POST",body:JSON.stringify({content:Se,category:H,source:"dashboard"})}),Ne(""),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{})}catch(O){console.error(O)}finally{w(!1)}}}const pe=L.find(O=>O.label.includes("OS-Update")&&(O.state==="running"||O.state==="queued")),me=L.find(O=>O.label.includes("Engine-Update")&&(O.state==="running"||O.state==="queued"));return n.jsxs("div",{className:"space-y-6",children:[ne.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:ne.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:Y,onChange:O=>G(O.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:O=>O.key==="Enter"&&J(),autoFocus:!0}),ne.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:ne.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},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"}),n.jsx("button",{onClick:J,disabled:!Y||I,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:I?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(bt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),o?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(Ko,{value:o.cpu.percent,label:"CPU",detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0}),n.jsx(Ko,{value:o.ram.percent,label:"RAM",detail:`${ft(o.ram.used)} / ${ft(o.ram.total)} GB`}),o.gpu&&o.gpu.busy_percent!=null&&o.gpu.gtt_used!=null&&o.gpu.gtt_total!=null&&n.jsx(Ko,{value:o.gpu.busy_percent,label:"GPU",detail:`${ft(o.gpu.gtt_used)} / ${ft(o.gpu.gtt_total)} GB`}),o.disk&&n.jsx(Ko,{value:o.disk.percent,label:"Disk",detail:`${ft(o.disk.used)} / ${ft(o.disk.total)} GB`})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(o==null?void 0:o.temp)&&(o.temp.cpu||o.temp.gpu)&&n.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[o.temp.cpu!=null&&n.jsxs("span",{children:["CPU Temp: ",o.temp.cpu," °C"]}),o.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",o.temp.gpu," °C"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Sh,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(j==null?void 0:j.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(j.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),j?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.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:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:j.os>0?`${j.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.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:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:j.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:j.models>0?`${j.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>V("/api/maintenance/os-update","OS-Update"),disabled:D||!!pe,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:pe?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",pe.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>V("/api/maintenance/engine-update","Engine-Update"),disabled:D||!!me,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:me?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",me.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{Re("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>V("/api/maintenance/reboot","Reboot"))},disabled:D,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:[n.jsx(af,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),j.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:j.model_list.map(O=>n.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:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${O.role}: ${O.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:O.role}),": ",O.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>Q(O.repo,O.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:[n.jsx(Wr,{className:"h-2.5 w-2.5"})," Laden"]})]},O.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),C&&n.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:C}),n.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:[n.jsx(Hr,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.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"})})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ns,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(a==null?void 0:a.webui_url)&&n.jsxs("a",{href:Ps(a.webui_url),target:"_blank",rel:"noopener",className:ee("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",a.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(Xo,{className:"h-3 w-3"})," Hermes öffnen"]})]}),a?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>Me(!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 group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(bt,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(Cs,{className:"h-3.5 w-3.5"}),a.brain_model?`model: ${a.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Cs,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:["fast","heavy","coder","reasoning","vision","scout"].map(O=>{var pt;const ge=f.find(mt=>mt.role===O),Xe=ge?h.includes(ge.name):!1;return n.jsxs("div",{className:ee("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",Xe?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":ge?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ee("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",O==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":O==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":O==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":O==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":O==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:O}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:ge?(pt=ge.name.split("/").pop())==null?void 0:pt.replace(/\.gguf$/i,""):"nicht zugewiesen"}),ge&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[ge.prompt_cache&&n.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"}),ge.spec_draft_model&&n.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: ${ge.spec_draft_model})`,children:"SPEC"}),ge.parallel_slots>1&&n.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:`${ge.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ge.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:ge?Xe?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},O)})})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Ss,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:Se,onChange:O=>Ne(O.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"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:H,onChange:O=>ae(O.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:oe,disabled:!Se.trim()||K,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:[n.jsx(lf,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:S.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):S.map(O=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:O.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:O.content,children:O.content})]},O.id))})]})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(fh,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),A?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[A.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",A.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:A.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(T=A==null?void 0:A.pricing)!=null&&T.heavy?` (Ø ${A.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${A.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})]}),a&&ce&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(bt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>Me(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...f.map(O=>{var ge;return((ge=O.name.split("/").pop())==null?void 0:ge.replace(".gguf",""))||O.name})].map(O=>{const ge=["auto","fast","heavy"].includes(O);return n.jsxs("button",{onClick:()=>Pe(O),className:ee("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.brain_model===O||!a.brain_model&&O==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:O}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ge?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(a.brain_model===O||!a.brain_model&&O==="auto")&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},O)})})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,onConfirm:()=>X.onConfirm(),onCancel:X.onCancel})]})}function Br({children:o,tone:d="muted"}){const a={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${a[d]}`,children:o})}function Zu({caps:o}){return o?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[o.coder&&n.jsx(Br,{children:"💻 Code"}),o.vision&&n.jsx(Br,{children:"👁 Bild"}),o.reasoning&&n.jsx(Br,{children:"🧠 Reason"}),o.moe&&n.jsxs(Br,{tone:"primary",children:["🧩 MoE",o.active_b?`·${o.active_b}b`:""]}),o.tools==="yes"&&n.jsx(Br,{tone:"primary",children:"🛠 Tools"}),o.tools==="likely"&&n.jsx(Br,{tone:"warn",children:"🛠 Tools?"}),o.embedding&&n.jsx(Br,{children:"🔢 Embed"})]}):null}function y0({onError:o}){const[d,a]=p.useState([]),[c,f]=p.useState(null);function m(){fe("/api/jobs").then(b=>a(b.jobs||[])).catch(()=>{})}p.useEffect(()=>{m();const b=setInterval(m,2e3);return()=>clearInterval(b)},[]);async function h(b){try{await fe(`/api/jobs/${b}/cancel`,{method:"POST"}),m()}catch(j){o?o(j.message):f(j.message)}}const x=d.filter(b=>b.state==="running"||b.state==="queued"),S=d.filter(b=>b.state!=="running"&&b.state!=="queued").slice(-3);return x.length===0&&S.length===0?null:n.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:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),x.map(b=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:b.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[b.progress??0,"% • ",Ni(b.done_bytes),"/",Ni(b.total_bytes),b.eta_s?` • ETA ${g0(b.eta_s)}`:""]}),n.jsx("button",{onClick:()=>h(b.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"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${b.progress??0}%`}})})]},b.id)),S.map(b=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:b.label}),n.jsx("span",{className:ee("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",b.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:b.state})]},b.id)),c&&n.jsx(qr,{type:"alert",title:"Fehler",message:c,onConfirm:()=>f(null)})]})}function b0({fit:o}){const d={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"}[o.level];return n.jsxs("span",{className:ee("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",d),children:[o.text," • ",o.req_gb," GB RAM"]})}const w0=["fast","heavy","coder","reasoning","agent","vision","scout"];function Yu(o){const d=o.toLowerCase();return d.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:d.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:d.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:d.includes("mistral")||d.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:d.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:d.includes("hermes")||d.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:d.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 j0(){var Yr,nr,Vt,Jr,Tn;const[o,d]=p.useState([]),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(null),[S,b]=p.useState(null),[j,P]=p.useState(!0),[L,F]=p.useState(""),[A,N]=p.useState(null),[C,E]=p.useState(null),[D,Z]=p.useState(!1),[Y,G]=p.useState(null),[I,$]=p.useState("grid"),[ne,se]=p.useState("all"),[X,be]=p.useState(null);function ce(R,re,ye){be({type:"alert",title:R,message:re,onConfirm:()=>{be(null)}})}function Me(R,re,ye,Ce){be({type:"confirm",title:R,message:re,onConfirm:()=>{be(null),ye()},onCancel:()=>{be(null)}})}function Pe(R,re,ye,Ce,De){be({type:"prompt",title:R,message:re,defaultValue:ye,onConfirm:Et=>{be(null),Ce(Et)},onCancel:()=>{be(null)}})}const Re=o.filter(R=>ne==="in_use"?!!R.role||a.includes(R.name):!0),[Se,Ne]=p.useState({width:800,height:360}),H=p.useRef(null),ae=p.useCallback(R=>{if(H.current&&(H.current.disconnect(),H.current=null),R){const re=new ResizeObserver(ye=>{if(!ye||ye.length===0)return;const Ce=ye[0].contentRect;Ne({width:Ce.width,height:Ce.height})});re.observe(R),H.current=re}},[]),K=Se.width,w=Se.height,v=R=>{const re=K*.1,ye=w*R,Ce=K*.5,De=w*.5,Et=K*.3,Wt=ye,Ht=K*.3;return`M ${re} ${ye} C ${Et} ${Wt}, ${Ht} ${De}, ${Ce} ${De}`},V=R=>{const re=K*.5,ye=w*.5,Ce=K*.9,De=w*R,Et=K*.7,Wt=ye,Ht=K*.7;return`M ${re} ${ye} C ${Et} ${Wt}, ${Ht} ${De}, ${Ce} ${De}`};function J(){Promise.all([fe("/api/models"),fe("/api/routing"),fe("/api/connect"),fe("/api/maintenance/updates")]).then(([R,re,ye,Ce])=>{d(R.models||[]),c(R.running||[]),m(re),x(ye),b(Ce)}).catch(R=>F(String(R))).finally(()=>P(!1))}p.useEffect(()=>{J();const R=setInterval(J,4e3);return()=>clearInterval(R)},[]);async function Q(R){try{await fe(`/api/models/${encodeURIComponent(R)}/load`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Laden des Modells: ${re.message}`)}}async function oe(R){try{await fe(`/api/models/${encodeURIComponent(R)}/unload`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Entladen des Modells: ${re.message}`)}}async function pe(){try{await fe("/api/models/unload",{method:"POST"}),J()}catch(R){ce("Fehler",`Fehler beim Entladen aller Modelle: ${R.message}`)}}async function me(R,re){try{await fe(`/api/models/${encodeURIComponent(re)}/role`,{method:"POST",body:JSON.stringify({role:R||null})}),J()}catch(ye){ce("Fehler",`Fehler beim Zuweisen der Rolle: ${ye.message||ye}`)}}async function T(R,re){Pe("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(re||32768),async ye=>{if(ye)try{await fe(`/api/models/${encodeURIComponent(R)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ye,10)})}),J()}catch(Ce){ce("Fehler",`Fehler beim Setzen des Kontexts: ${Ce.message||Ce}`)}})}async function O(R){Me("Modell löschen?",`Modell '${R}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await fe(`/api/models/${encodeURIComponent(R)}`,{method:"DELETE"}),J()}catch(re){ce("Fehler",`Fehler beim Löschen: ${re.message||re}`)}})}async function ge(R,re,ye,Ce){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:R,role:re,quant:ye,jinja:Ce})}),ce("Herunterladen gestartet",`Download für '${R}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(De){ce("Fehler",`Fehler beim Starten des Upgrades: ${De.message||De}`)}}async function Xe(R){R&&(await navigator.clipboard.writeText(R),Z(!0),setTimeout(()=>Z(!1),1500))}if(j)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(L)return n.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 (",L,")."]});const pt=o.filter(R=>a.includes(R.name)),mt=pt.reduce((R,re)=>R+(re.size_bytes||0),0),ht=16*1024**3,On=mt>ht?mt*1.2:ht,Zr=R=>o.find(re=>re.role===R),rr=R=>{const re=Zr(R);return re?a.includes(re.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -362,7 +362,7 @@ Error generating stack: `+i.message+` stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),n.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:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",Br(pt)," / ",Br(Tn)," geladen"]}),a.length>0&&n.jsx("button",{onClick:pe,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"})]})]}),n.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:ft.length===0?n.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"}):ft.map((R,re)=>{var De;const ye=(R.size_bytes||0)/Tn*100,Ce=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][re%4];return n.jsxs("div",{style:{width:`${ye}%`},className:ee("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",Ce),title:`${R.name} (${Br(R.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[R.role?`[${R.role}] `:"",(De=R.name.split("/").pop())==null?void 0:De.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Br(R.size_bytes)})]},R.name)})})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.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."})]}),n.jsxs("div",{ref:ae,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:v(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="roocode"||A==="roocode")&&n.jsx("path",{d:v(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="cursor"||A==="cursor")&&n.jsx("path",{d:v(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="opencode"||A==="opencode")&&n.jsx("path",{d:v(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="zed"||A==="zed")&&n.jsx("path",{d:v(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="continue"||A==="continue")&&n.jsx("path",{d:v(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("fast")&&n.jsx("path",{d:V(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("heavy")&&n.jsx("path",{d:V(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("coder")&&n.jsx("path",{d:V(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("vision")&&n.jsx("path",{d:V(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),tr("scout")&&n.jsx("path",{d:V(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>G("roocode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.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:()=>G("cursor"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.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:()=>G("opencode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.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:()=>G("zed"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.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:()=>G("continue"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.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:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",f!=null&&f.heavy_threshold_chars?f.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.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"})]}),j0.map(R=>{var Ct;const re=["12%","31%","50%","69%","88%"],ye=Zr(R),Ce=ye?a.includes(ye.name):!1;if(R==="reasoning"||R==="agent")return null;const De={fast:0,heavy:1,coder:2,vision:3,scout:4}[R];return n.jsxs("div",{className:ee("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",Ce?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ye?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:re[De]},onClick:()=>E(R),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:R}),Ce&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ye?(Ct=ye.name.split("/").pop())==null?void 0:Ct.replace(".gguf",""):"Keine Zuweisung"})]},R)}),A&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[A==="roocode"&&"Roo Code Setup",A==="cursor"&&"Cursor Setup",A==="opencode"&&"OpenCode Setup",A==="zed"&&"Zed Setup",A==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[A==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),A==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),A==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),A==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),A==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),h.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var R,re,ye,Ce,De;return Xe(A==="roocode"?(R=h.tools.cline)==null?void 0:R.snippet:A==="cursor"?(re=h.tools.cursor)==null?void 0:re.snippet:A==="opencode"?(ye=h.tools.opencode)==null?void 0:ye.snippet:A==="zed"?(Ce=h.tools.zed)==null?void 0:Ce.snippet:(De=h.tools.continue)==null?void 0:De.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[D?n.jsx(Dn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(lf,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:D?"Kopiert":"Kopieren"})]})]}),n.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:n.jsxs("code",{children:[A==="roocode"&&((Yr=h.tools.cline)==null?void 0:Yr.snippet),A==="cursor"&&((rr=h.tools.cursor)==null?void 0:rr.snippet),A==="opencode"&&((Bt=h.tools.opencode)==null?void 0:Bt.snippet),A==="zed"&&((Jr=h.tools.zed)==null?void 0:Jr.snippet),A==="continue"&&((In=h.tools.continue)==null?void 0:In.snippet)]})})]}),n.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"})]})})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(R=>{var Ce;const re=o.find(De=>De.role===R),ye=re?a.includes(re.name):!1;return n.jsxs("div",{onClick:()=>E(R),className:ee("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]",ye?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":re?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:ee("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",R==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":R==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":R==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":R==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":R==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:R}),ye&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:re==null?void 0:re.name,children:re?(Ce=re.name.split("/").pop())==null?void 0:Ce.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},R)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Re.length," von ",o.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>se("all"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>se("in_use"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>$("grid"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>$("list"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),I==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Re.length===0?n.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:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=C==null?void 0:C.model_list.find(De=>De.role===R.role),Ce=Ju(R.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45 shadow-primary/5":R.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:ee("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ce.color),title:Ce.name,children:Ce.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:R.name,children:R.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.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:R.quant||"GGUF"}),re&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(Xo,{className:"h-3 w-3 animate-pulse"})," Warm"]}),R.role&&n.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:R.role}),R.prompt_cache&&n.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"}),R.spec_draft_model&&n.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: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.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:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(gi,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:Br(R.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(wh,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:Yu(R.ctx)})]})]})]}),ye&&n.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:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",ye.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>ge(ye.repo,R.role,R.quant||"Q4_K_M",R.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:[n.jsx(Wr,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.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"}),n.jsx("button",{onClick:()=>O(R.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})}):n.jsx("div",{className:"space-y-2",children:Re.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=Ju(R.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45":R.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:ee("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ye.color),title:ye.name,children:ye.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:R.name,children:R.name.split("/").pop()}),R.role&&n.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:R.role}),R.prompt_cache&&n.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"}),R.spec_draft_model&&n.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: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.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:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]}),re&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",Br(R.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",Yu(R.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:R.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.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"}),n.jsx("button",{onClick:()=>O(R.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})})]}),S&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",S,"' konfigurieren"]}),n.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:S}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{me(S,""),E(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:n.jsx("span",{children:"Zuweisung entfernen"})}),o.map(R=>{var re;return n.jsxs("button",{onClick:()=>{me(S,R.name),E(null)},className:ee("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",R.role===S?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(re=R.name.split("/").pop())==null?void 0:re.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[Br(R.size_bytes)," · ",R.quant]})]}),R.role===S&&n.jsx(Dn,{className:"h-4 w-4 shrink-0 text-primary"})]},R.name)})]})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,defaultValue:X.defaultValue,onConfirm:X.onConfirm,onCancel:X.onCancel})]})}function N0(){const[o,d]=p.useState(""),[a,c]=p.useState([]),[f,m]=p.useState("Q4_K_M"),[h,x]=p.useState(""),[C,b]=p.useState(""),[j,P]=p.useState([]);async function L(N){const S=N??o;if(S.trim()){x("Analysiere HuggingFace Repository...");try{const E=await fe(`/api/hf/quants?repo=${encodeURIComponent(S)}`);d(E.repo),c(E.quants),E.quants.length&&m(E.quants.includes("Q4_K_M")?"Q4_K_M":E.quants[0]),x(E.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(E){x(`Fehler: ${E}`)}}}async function F(){if(C.trim()){x("Durchsuche HuggingFace...");try{const N=await fe(`/api/hf/search?q=${encodeURIComponent(C)}`);P(N.results),x(N.results.length?"":"Keine Ergebnisse gefunden.")}catch(N){x(`Suche fehlgeschlagen: ${N}`)}}}async function A(){if(o.trim()){x("Download-Job wird initiiert...");try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:o,quant:f,jinja:!0})}),x(`Download gestartet: ${o} (${f}). Fortschritt wird oben angezeigt.`)}catch(N){x(`Download-Fehler: ${N}`)}}}return n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:o,onChange:N=>d(N.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"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>L(),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&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:f,onChange:N=>m(N.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(N=>n.jsx("option",{value:N,className:"bg-popover text-foreground",children:N},N))}),n.jsxs("button",{onClick:A,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:[n.jsx(Wr,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:C,onChange:N=>b(N.target.value),onKeyDown:N=>N.key==="Enter"&&F(),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"}),n.jsx(_i,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:F,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"})]}),j.length>0&&n.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:j.map(N=>n.jsxs("button",{onClick:()=>{d(N.repo),P([]),b(""),L(N.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:[n.jsx("span",{className:"font-semibold truncate",children:N.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(Wr,{className:"h-3 w-3"})," ",N.downloads.toLocaleString()]})]},N.repo))}),h&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:h})]})}const S0={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:xi},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:mi},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Cs},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Ss},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:hi}};function C0(){const[o,d]=p.useState(null),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(""),[C,b]=p.useState(!0),[j,P]=p.useState({}),[L,F]=p.useState({}),[A,N]=p.useState(!1);p.useEffect(()=>{Promise.all([fe("/api/discover"),fe("/api/models"),fe("/api/maintenance/updates").catch(()=>null)]).then(([E,D,Z])=>{d(E),c(D.models||[]),Z&&m(Z)}).catch(E=>x(String(E))).finally(()=>b(!1))},[]);async function S(E,D,Z,Y){P(G=>({...G,[E]:"Starte..."}));try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:E,role:D,quant:Z,jinja:Y})}),P(G=>({...G,[E]:"Download läuft"}))}catch{P(I=>({...I,[E]:"Fehler"}))}}return C?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):h||!o?n.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 (",h,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.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:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(cf,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:o.categories.map(E=>{const D=S0[E.role]||{title:E.title||E.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:Es},Z=D.icon,Y=a.find(X=>X.role===E.role),G=f==null?void 0:f.model_list.find(X=>X.role===E.role),I=E.models.find(X=>X.repo===E.recommended)||E.models[0];if(!I)return null;const $=j[I.repo],ne=E.models.filter(X=>X.repo!==E.recommended),se=!!L[E.role];return n.jsxs("div",{className:ee("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",Y?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.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:n.jsx(Z,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:D.title}),n.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: ",E.role]})]})]}),Y?n.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:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.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"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:D.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:Y?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:Y.name,children:Y.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",Si(Y.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",Y.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:I.name,children:I.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",I.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",I.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(w0,{fit:I.fit})})]})}),n.jsx("div",{className:"pt-1",children:Y?G?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",G.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>S(G.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!j[G.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:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),j[G.repo]||"Auf neue Version aktualisieren"]})]}):n.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:[n.jsx(Dn,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>S(I.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!$,className:ee("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",$?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),$||"Optimales Modell einsetzen"]})})]}),ne.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>F(X=>({...X,[E.role]:!se})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[se?n.jsx(ch,{className:"h-3 w-3"}):n.jsx(ah,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",ne.length,")"]})]}),se&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:ne.map(X=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:X.name,children:X.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",X.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:X.fit.text})]})]}),n.jsx("button",{onClick:()=>S(X.repo,E.role,X.quant||"Q4_K_M",X.caps.tools!=="no"),disabled:!!j[X.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:j[X.repo]||"Installieren"})]},X.repo))})]})]},E.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>N(!A),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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_i,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:A?"Ausblenden ▲":"Anzeigen ▼"})]}),A&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(N0,{})})]})]})}function E0(){const[o,d]=p.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.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=>n.jsx("button",{onClick:()=>d(a),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",o===a?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:a==="cockpit"?"Cockpit":"Modelle finden"},a))})]}),n.jsx(b0,{}),n.jsx("div",{className:"transition-all duration-300",children:o==="cockpit"?n.jsx(k0,{}):n.jsx(C0,{})})]})}function Nr(o){return(o/1024**3).toFixed(1)}function qo({label:o,percent:d,detail:a,icon:c}){const f=d>90?"bg-red-500 shadow-md shadow-red-500/20":d>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:o})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(d),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:ee("h-full transition-all duration-700 ease-out",f),style:{width:`${Math.min(d,100)}%`}})}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function _0(){const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState(""),[h,x]=p.useState(""),[C,b]=p.useState({}),[j,P]=p.useState(null);function L(S,E,D){P({type:"alert",title:S,message:E,onConfirm:()=>{P(null)}})}function F(){fe("/api/system/status").then(d).catch(S=>m(String(S))),fe("/api/system/services").then(c).catch(()=>{})}p.useEffect(()=>{F();const S=setInterval(F,3e3);return()=>clearInterval(S)},[]);async function A(){x("Backup snapshotted...");try{const S=await fe("/api/system/backup",{method:"POST"});x(S.ok?`Snapshot erzeugt: ${S.snapshot} (${S.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(S){x(`Fehler: ${S.message}`)}}async function N(S){b(E=>({...E,[S]:!0}));try{const E=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:S})});E.ok?L("Erfolgreich",`Dienst ${S} wurde erfolgreich neu gestartet.`):L("Fehler beim Neustart",`Fehler beim Neustart: ${E.err||"Unbekannter Fehler"}`)}catch(E){L("Fehler",`Fehler: ${E.message}`)}finally{b(E=>({...E,[S]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.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,")."]}),o&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(qo,{label:"CPU",percent:o.cpu.percent,detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0,icon:yt}),n.jsx(qo,{label:"RAM",percent:o.ram.percent,detail:`${Nr(o.ram.used)} / ${Nr(o.ram.total)} GB`,icon:Xo}),o.gpu&&o.gpu.busy_percent!=null&&n.jsx(qo,{label:"GPU",percent:o.gpu.busy_percent,detail:o.gpu.gtt_used!=null&&o.gpu.gtt_total?`${Nr(o.gpu.gtt_used)} / ${Nr(o.gpu.gtt_total)} GB (GTT/unified)`:o.gpu.vram_used!=null&&o.gpu.vram_total?`${Nr(o.gpu.vram_used)} / ${Nr(o.gpu.vram_total)} GB VRAM`:void 0,icon:yt}),o.disk&&n.jsx(qo,{label:"Disk",percent:o.disk.percent,detail:`${Nr(o.disk.used)} / ${Nr(o.disk.total)} GB`,icon:gi})]}),o.temp&&(o.temp.cpu||o.temp.gpu)&&n.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:[o.temp.cpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.cpu," °C"]})]}),o.temp.cpu!=null&&o.temp.gpu!=null&&n.jsx("span",{children:"|"}),o.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.gpu," °C"]})]})]})]}),a&&n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.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"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.services.map(S=>n.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:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",S.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:S.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:S.url})]})]}),n.jsx("button",{onClick:()=>N(S.name),disabled:C[S.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:n.jsx(Vr,{className:ee("h-3.5 w-3.5",C[S.name]&&"animate-spin")})})]},S.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Ms(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:[n.jsx(el,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Ms(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:[n.jsx(el,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.jsxs("button",{onClick:A,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:[n.jsx(kh,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),h&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:h}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:j.onConfirm,onCancel:j.onCancel})]})}function P0(){const[o,d]=p.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[a,c]=p.useState(localStorage.getItem("mc_mcp_path")||""),[f,m]=p.useState(null),[h,x]=p.useState("cline"),[C,b]=p.useState(!1),[j,P]=p.useState("");p.useEffect(()=>{const S=new URLSearchParams;S.set("host",o),a&&S.set("mcp_path",a),fe(`/api/connect?${S}`).then(m).catch(E=>P(String(E)))},[o,a]);function L(S){d(S),S&&localStorage.setItem("mc_host",S)}function F(S){c(S),localStorage.setItem("mc_mcp_path",S)}const A=f==null?void 0:f.tools[h];async function N(){A&&(await navigator.clipboard.writeText(A.snippet),b(!0),setTimeout(()=>b(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.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:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(gh,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:o,onChange:S=>L(S.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"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(xh,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:a,onChange:S=>F(S.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"})]})]}),j&&n.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: ",j]}),f&&n.jsxs("div",{className:"space-y-4",children:[n.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(f.tools).map(([S,E])=>n.jsx("button",{onClick:()=>x(S),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",h===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:E.label},S))}),A&&n.jsxs("div",{className:"space-y-3",children:[A.note&&n.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:[n.jsx(vh,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:A.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.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:[n.jsx(tl,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:h==="cline"||h==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:N,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:[C?n.jsx(Dn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(lf,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:C?"Kopiert":"Kopieren"})]})]}),n.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:n.jsx("code",{children:A.snippet})})]})]})]})]})}const Xu=["user","instruction","stable","versioned","ephemeral"],fi={user:{label:"User",icon:Mh,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:Nh,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Hr,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:_h,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:fh,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},ef={label:"Gedächtnis",icon:of,bg:"bg-muted/10",text:"text-muted-foreground"},M0={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 R0(){const[o,d]=p.useState([]),[a,c]=p.useState(""),[f,m]=p.useState(""),[h,x]=p.useState(""),[C,b]=p.useState("stable"),[j,P]=p.useState(""),[L,F]=p.useState(!1),[A,N]=p.useState(null);function S(I,$,ne){N({type:"alert",title:I,message:$,onConfirm:()=>{N(null)}})}function E(I,$,ne){N({type:"confirm",title:I,message:$,onConfirm:()=>{N(null),ne()},onCancel:()=>N(null)})}function D(){const I=new URLSearchParams;f&&I.set("q",f),a&&I.set("category",a),fe(`/api/memory?${I}`).then(d).catch($=>P(String($)))}p.useEffect(D,[f,a]);async function Z(){h.trim()&&(await fe("/api/memory",{method:"POST",body:JSON.stringify({content:h,category:C,source:"ui"})}),x(""),D())}async function Y(I){await fe(`/api/memory/${I}`,{method:"DELETE"}),D()}async function G(){F(!0);try{const I=await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(I.duplicate_count===0){S("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${I.duplicate_count} Dublette(n) in ${I.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),D()}catch($){S("Fehler",`Fehler beim Löschen: ${$.message}`)}})}catch(I){S("Fehler",`Fehler bei der Deduplizierung: ${I.message}`)}finally{F(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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)"}),n.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."})]}),n.jsxs("button",{onClick:G,disabled:L,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:[n.jsx(Eh,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:h,onChange:I=>x(I.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"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:C,onChange:I=>b(I.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:Xu.map(I=>{var $;return n.jsx("option",{value:I,className:"bg-popover text-foreground",children:(($=fi[I])==null?void 0:$.label)||I},I)})})]}),n.jsxs("button",{onClick:Z,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:[n.jsx(af,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:f,onChange:I=>m(I.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"}),n.jsx(_i,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.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:[n.jsx("button",{onClick:()=>c(""),className:ee("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",a?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Xu.map(I=>{const $=fi[I]||ef,ne=$.icon;return n.jsxs("button",{onClick:()=>c(I),className:ee("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",a===I?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{children:$.label})]},I)})]})]}),j&&n.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: ",j]}),n.jsx("div",{className:"space-y-3",children:o.length===0?n.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."}):o.map(I=>{const $=fi[I.category]||ef,ne=$.icon;return n.jsxs("div",{className:ee("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",M0[I.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:ee("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",$.bg,$.text),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:$.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:I.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.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:I.source}),n.jsx("button",{onClick:()=>Y(I.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:n.jsx(vi,{className:"h-3.5 w-3.5"})})]})]},I.id)})}),A&&n.jsx(qr,{type:A.type,title:A.title,message:A.message,onConfirm:A.onConfirm,onCancel:A.onCancel})]})}function Zo({label:o,ok:d,detail:a,icon:c,onClick:f}){return n.jsxs("div",{onClick:f,className:ee("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",d?"border-border/60":"border-amber-500/30",f&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:o}),n.jsx(c,{className:ee("h-4.5 w-4.5",d?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full ring-2 ring-black/40",d?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:d?"Bereit / Online":"Offline / Inaktiv"})]}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:a,children:a})]}),f&&n.jsxs("button",{onClick:m=>{m.stopPropagation(),f()},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:[n.jsx(yt,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function z0(){const[o,d]=p.useState(null),[a,c]=p.useState(""),[f,m]=p.useState(null),[h,x]=p.useState(!1),[C,b]=p.useState([]),[j,P]=p.useState(null);function L($,ne,se){P({type:"alert",title:$,message:ne,onConfirm:se})}const[F,A]=p.useState({width:800,height:360}),N=p.useRef(null),S=p.useCallback($=>{if(N.current&&(N.current.disconnect(),N.current=null),$){const ne=new ResizeObserver(se=>{if(!se||se.length===0)return;const X=se[0].contentRect;A({width:X.width,height:X.height})});ne.observe($),N.current=ne}},[]),E=F.width,D=F.height,Z=($,ne,se,X)=>{const be=($+se)/2;return`M ${$} ${ne} C ${be} ${ne}, ${be} ${X}, ${se} ${X}`};function Y(){fe("/api/agent/status").then(d).catch($=>c(String($)))}function G(){fe("/api/models").then($=>{const ne=$.models.map(se=>{var X;return((X=se.name.split("/").pop())==null?void 0:X.replace(".gguf",""))||se.name});b(["auto","fast","heavy",...ne])}).catch($=>console.error("Error loading models",$))}async function I($){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:$})}),L("Erfolgreich",`Hermes-Gehirn wurde auf '${$}' geändert. Der Gateway-Dienst wurde neu gestartet.`),Y(),x(!1)}catch(ne){L("Fehler",`Fehler beim Wechseln des Gehirns: ${ne.message}`)}}return p.useEffect(()=>{Y(),G();const $=setInterval(Y,5e3);return()=>clearInterval($)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` + `}),n.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:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",Ur(mt)," / ",Ur(On)," geladen"]}),a.length>0&&n.jsx("button",{onClick:pe,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"})]})]}),n.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:pt.length===0?n.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"}):pt.map((R,re)=>{var De;const ye=(R.size_bytes||0)/On*100,Ce=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][re%4];return n.jsxs("div",{style:{width:`${ye}%`},className:ee("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",Ce),title:`${R.name} (${Ur(R.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[R.role?`[${R.role}] `:"",(De=R.name.split("/").pop())==null?void 0:De.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Ur(R.size_bytes)})]},R.name)})})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.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."})]}),n.jsxs("div",{ref:ae,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:v(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="roocode"||A==="roocode")&&n.jsx("path",{d:v(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="cursor"||A==="cursor")&&n.jsx("path",{d:v(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="opencode"||A==="opencode")&&n.jsx("path",{d:v(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="zed"||A==="zed")&&n.jsx("path",{d:v(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="continue"||A==="continue")&&n.jsx("path",{d:v(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("fast")&&n.jsx("path",{d:V(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("heavy")&&n.jsx("path",{d:V(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("coder")&&n.jsx("path",{d:V(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("vision")&&n.jsx("path",{d:V(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("scout")&&n.jsx("path",{d:V(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>G("roocode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.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:()=>G("cursor"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.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:()=>G("opencode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.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:()=>G("zed"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.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:()=>G("continue"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.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:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",f!=null&&f.heavy_threshold_chars?f.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.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"})]}),w0.map(R=>{var Et;const re=["12%","31%","50%","69%","88%"],ye=Zr(R),Ce=ye?a.includes(ye.name):!1;if(R==="reasoning"||R==="agent")return null;const De={fast:0,heavy:1,coder:2,vision:3,scout:4}[R];return n.jsxs("div",{className:ee("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",Ce?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ye?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:re[De]},onClick:()=>E(R),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:R}),Ce&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ye?(Et=ye.name.split("/").pop())==null?void 0:Et.replace(".gguf",""):"Keine Zuweisung"})]},R)}),A&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[A==="roocode"&&"Roo Code Setup",A==="cursor"&&"Cursor Setup",A==="opencode"&&"OpenCode Setup",A==="zed"&&"Zed Setup",A==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[A==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),A==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),A==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),A==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),A==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),h.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var R,re,ye,Ce,De;return Xe(A==="roocode"?(R=h.tools.cline)==null?void 0:R.snippet:A==="cursor"?(re=h.tools.cursor)==null?void 0:re.snippet:A==="opencode"?(ye=h.tools.opencode)==null?void 0:ye.snippet:A==="zed"?(Ce=h.tools.zed)==null?void 0:Ce.snippet:(De=h.tools.continue)==null?void 0:De.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[D?n.jsx(zn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(of,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:D?"Kopiert":"Kopieren"})]})]}),n.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:n.jsxs("code",{children:[A==="roocode"&&((Yr=h.tools.cline)==null?void 0:Yr.snippet),A==="cursor"&&((nr=h.tools.cursor)==null?void 0:nr.snippet),A==="opencode"&&((Vt=h.tools.opencode)==null?void 0:Vt.snippet),A==="zed"&&((Jr=h.tools.zed)==null?void 0:Jr.snippet),A==="continue"&&((Tn=h.tools.continue)==null?void 0:Tn.snippet)]})})]}),n.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"})]})})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(R=>{var Ce;const re=o.find(De=>De.role===R),ye=re?a.includes(re.name):!1;return n.jsxs("div",{onClick:()=>E(R),className:ee("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]",ye?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":re?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:ee("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",R==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":R==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":R==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":R==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":R==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:R}),ye&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:re==null?void 0:re.name,children:re?(Ce=re.name.split("/").pop())==null?void 0:Ce.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},R)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Re.length," von ",o.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>se("all"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>se("in_use"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>$("grid"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>$("list"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),I==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Re.length===0?n.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:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=S==null?void 0:S.model_list.find(De=>De.role===R.role),Ce=Yu(R.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45 shadow-primary/5":R.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:ee("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ce.color),title:Ce.name,children:Ce.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:R.name,children:R.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.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:R.quant||"GGUF"}),re&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(Jo,{className:"h-3 w-3 animate-pulse"})," Warm"]}),R.role&&n.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:R.role}),R.prompt_cache&&n.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"}),R.spec_draft_model&&n.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: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.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:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(xi,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:Ur(R.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(bh,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:qu(R.ctx)})]})]})]}),ye&&n.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:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",ye.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>ge(ye.repo,R.role,R.quant||"Q4_K_M",R.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:[n.jsx(Wr,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.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"}),n.jsx("button",{onClick:()=>O(R.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:n.jsx(gi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})}):n.jsx("div",{className:"space-y-2",children:Re.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=Yu(R.name);return n.jsxs("div",{className:ee("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",re?"border-primary/45":R.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:ee("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ye.color),title:ye.name,children:ye.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:R.name,children:R.name.split("/").pop()}),R.role&&n.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:R.role}),R.prompt_cache&&n.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"}),R.spec_draft_model&&n.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: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.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:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]}),re&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",Ur(R.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",qu(R.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:R.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.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"}),n.jsx("button",{onClick:()=>O(R.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:n.jsx(gi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",C,"' konfigurieren"]}),n.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:C}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{me(C,""),E(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:n.jsx("span",{children:"Zuweisung entfernen"})}),o.map(R=>{var re;return n.jsxs("button",{onClick:()=>{me(C,R.name),E(null)},className:ee("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",R.role===C?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(re=R.name.split("/").pop())==null?void 0:re.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[Ur(R.size_bytes)," · ",R.quant]})]}),R.role===C&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},R.name)})]})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,defaultValue:X.defaultValue,onConfirm:X.onConfirm,onCancel:X.onCancel})]})}function k0(){const[o,d]=p.useState(""),[a,c]=p.useState([]),[f,m]=p.useState("Q4_K_M"),[h,x]=p.useState(""),[S,b]=p.useState(""),[j,P]=p.useState([]);async function L(N){const C=N??o;if(C.trim()){x("Analysiere HuggingFace Repository...");try{const E=await fe(`/api/hf/quants?repo=${encodeURIComponent(C)}`);d(E.repo),c(E.quants),E.quants.length&&m(E.quants.includes("Q4_K_M")?"Q4_K_M":E.quants[0]),x(E.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(E){x(`Fehler: ${E}`)}}}async function F(){if(S.trim()){x("Durchsuche HuggingFace...");try{const N=await fe(`/api/hf/search?q=${encodeURIComponent(S)}`);P(N.results),x(N.results.length?"":"Keine Ergebnisse gefunden.")}catch(N){x(`Suche fehlgeschlagen: ${N}`)}}}async function A(){if(o.trim()){x("Download-Job wird initiiert...");try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:o,quant:f,jinja:!0})}),x(`Download gestartet: ${o} (${f}). Fortschritt wird oben angezeigt.`)}catch(N){x(`Download-Fehler: ${N}`)}}}return n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:o,onChange:N=>d(N.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"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>L(),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&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:f,onChange:N=>m(N.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(N=>n.jsx("option",{value:N,className:"bg-popover text-foreground",children:N},N))}),n.jsxs("button",{onClick:A,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:[n.jsx(Wr,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:S,onChange:N=>b(N.target.value),onKeyDown:N=>N.key==="Enter"&&F(),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"}),n.jsx(Ei,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:F,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"})]}),j.length>0&&n.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:j.map(N=>n.jsxs("button",{onClick:()=>{d(N.repo),P([]),b(""),L(N.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:[n.jsx("span",{className:"font-semibold truncate",children:N.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(Wr,{className:"h-3 w-3"})," ",N.downloads.toLocaleString()]})]},N.repo))}),h&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:h})]})}const N0={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:hi},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:pi},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Ss},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Ns},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:mi}};function S0(){const[o,d]=p.useState(null),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(""),[S,b]=p.useState(!0),[j,P]=p.useState({}),[L,F]=p.useState({}),[A,N]=p.useState(!1);p.useEffect(()=>{Promise.all([fe("/api/discover"),fe("/api/models"),fe("/api/maintenance/updates").catch(()=>null)]).then(([E,D,Z])=>{d(E),c(D.models||[]),Z&&m(Z)}).catch(E=>x(String(E))).finally(()=>b(!1))},[]);async function C(E,D,Z,Y){P(G=>({...G,[E]:"Starte..."}));try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:E,role:D,quant:Z,jinja:Y})}),P(G=>({...G,[E]:"Download läuft"}))}catch{P(I=>({...I,[E]:"Fehler"}))}}return S?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):h||!o?n.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 (",h,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.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:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(df,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:o.categories.map(E=>{const D=N0[E.role]||{title:E.title||E.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:Cs},Z=D.icon,Y=a.find(X=>X.role===E.role),G=f==null?void 0:f.model_list.find(X=>X.role===E.role),I=E.models.find(X=>X.repo===E.recommended)||E.models[0];if(!I)return null;const $=j[I.repo],ne=E.models.filter(X=>X.repo!==E.recommended),se=!!L[E.role];return n.jsxs("div",{className:ee("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",Y?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.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:n.jsx(Z,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:D.title}),n.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: ",E.role]})]})]}),Y?n.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:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.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"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:D.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:Y?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:Y.name,children:Y.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",Ni(Y.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",Y.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:I.name,children:I.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",I.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",I.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(b0,{fit:I.fit})})]})}),n.jsx("div",{className:"pt-1",children:Y?G?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",G.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>C(G.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!j[G.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:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),j[G.repo]||"Auf neue Version aktualisieren"]})]}):n.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:[n.jsx(zn,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>C(I.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!$,className:ee("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",$?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),$||"Optimales Modell einsetzen"]})})]}),ne.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>F(X=>({...X,[E.role]:!se})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[se?n.jsx(dh,{className:"h-3 w-3"}):n.jsx(lh,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",ne.length,")"]})]}),se&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:ne.map(X=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:X.name,children:X.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",X.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:X.fit.text})]})]}),n.jsx("button",{onClick:()=>C(X.repo,E.role,X.quant||"Q4_K_M",X.caps.tools!=="no"),disabled:!!j[X.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:j[X.repo]||"Installieren"})]},X.repo))})]})]},E.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>N(!A),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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ei,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:A?"Ausblenden ▲":"Anzeigen ▼"})]}),A&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(k0,{})})]})]})}function C0(){const[o,d]=p.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.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=>n.jsx("button",{onClick:()=>d(a),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",o===a?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:a==="cockpit"?"Cockpit":"Modelle finden"},a))})]}),n.jsx(y0,{}),n.jsx("div",{className:"transition-all duration-300",children:o==="cockpit"?n.jsx(j0,{}):n.jsx(S0,{})})]})}function Qo({label:o,percent:d,detail:a,icon:c}){const f=d>90?"bg-red-500 shadow-md shadow-red-500/20":d>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:o})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(d),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:ee("h-full transition-all duration-700 ease-out",f),style:{width:`${Math.min(d,100)}%`}})}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function E0(){const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState(""),[h,x]=p.useState(""),[S,b]=p.useState({}),[j,P]=p.useState(null);function L(C,E,D){P({type:"alert",title:C,message:E,onConfirm:()=>{P(null)}})}function F(){fe("/api/system/status").then(d).catch(C=>m(String(C))),fe("/api/system/services").then(c).catch(()=>{})}p.useEffect(()=>{F();const C=setInterval(F,3e3);return()=>clearInterval(C)},[]);async function A(){x("Backup snapshotted...");try{const C=await fe("/api/system/backup",{method:"POST"});x(C.ok?`Snapshot erzeugt: ${C.snapshot} (${C.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(C){x(`Fehler: ${C.message}`)}}async function N(C){b(E=>({...E,[C]:!0}));try{const E=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:C})});E.ok?L("Erfolgreich",`Dienst ${C} wurde erfolgreich neu gestartet.`):L("Fehler beim Neustart",`Fehler beim Neustart: ${E.err||"Unbekannter Fehler"}`)}catch(E){L("Fehler",`Fehler: ${E.message}`)}finally{b(E=>({...E,[C]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.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,")."]}),o&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(Qo,{label:"CPU",percent:o.cpu.percent,detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0,icon:bt}),n.jsx(Qo,{label:"RAM",percent:o.ram.percent,detail:`${ft(o.ram.used)} / ${ft(o.ram.total)} GB`,icon:Jo}),o.gpu&&o.gpu.busy_percent!=null&&n.jsx(Qo,{label:"GPU",percent:o.gpu.busy_percent,detail:o.gpu.gtt_used!=null&&o.gpu.gtt_total?`${ft(o.gpu.gtt_used)} / ${ft(o.gpu.gtt_total)} GB (GTT/unified)`:o.gpu.vram_used!=null&&o.gpu.vram_total?`${ft(o.gpu.vram_used)} / ${ft(o.gpu.vram_total)} GB VRAM`:void 0,icon:bt}),o.disk&&n.jsx(Qo,{label:"Disk",percent:o.disk.percent,detail:`${ft(o.disk.used)} / ${ft(o.disk.total)} GB`,icon:xi})]}),o.temp&&(o.temp.cpu||o.temp.gpu)&&n.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:[o.temp.cpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.cpu," °C"]})]}),o.temp.cpu!=null&&o.temp.gpu!=null&&n.jsx("span",{children:"|"}),o.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.gpu," °C"]})]})]})]}),a&&n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.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"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.services.map(C=>n.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:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",C.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:C.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:C.url})]})]}),n.jsx("button",{onClick:()=>N(C.name),disabled:S[C.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:n.jsx(Vr,{className:ee("h-3.5 w-3.5",S[C.name]&&"animate-spin")})})]},C.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Ps(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:[n.jsx(Xo,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Ps(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:[n.jsx(Xo,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.jsxs("button",{onClick:A,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:[n.jsx(jh,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),h&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:h}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:j.onConfirm,onCancel:j.onCancel})]})}function _0(){const[o,d]=p.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[a,c]=p.useState(localStorage.getItem("mc_mcp_path")||""),[f,m]=p.useState(null),[h,x]=p.useState("cline"),[S,b]=p.useState(!1),[j,P]=p.useState("");p.useEffect(()=>{const C=new URLSearchParams;C.set("host",o),a&&C.set("mcp_path",a),fe(`/api/connect?${C}`).then(m).catch(E=>P(String(E)))},[o,a]);function L(C){d(C),C&&localStorage.setItem("mc_host",C)}function F(C){c(C),localStorage.setItem("mc_mcp_path",C)}const A=f==null?void 0:f.tools[h];async function N(){A&&(await navigator.clipboard.writeText(A.snippet),b(!0),setTimeout(()=>b(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.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:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(xh,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:o,onChange:C=>L(C.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"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(hh,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:a,onChange:C=>F(C.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"})]})]}),j&&n.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: ",j]}),f&&n.jsxs("div",{className:"space-y-4",children:[n.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(f.tools).map(([C,E])=>n.jsx("button",{onClick:()=>x(C),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",h===C?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:E.label},C))}),A&&n.jsxs("div",{className:"space-y-3",children:[A.note&&n.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:[n.jsx(gh,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:A.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.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:[n.jsx(el,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:h==="cline"||h==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:N,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:[S?n.jsx(zn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(of,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:S?"Kopiert":"Kopieren"})]})]}),n.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:n.jsx("code",{children:A.snippet})})]})]})]})]})}const Ju=["user","instruction","stable","versioned","ephemeral"],ui={user:{label:"User",icon:Ph,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:kh,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Hr,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:Eh,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:uh,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Xu={label:"Gedächtnis",icon:sf,bg:"bg-muted/10",text:"text-muted-foreground"},P0={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 M0(){const[o,d]=p.useState([]),[a,c]=p.useState(""),[f,m]=p.useState(""),[h,x]=p.useState(""),[S,b]=p.useState("stable"),[j,P]=p.useState(""),[L,F]=p.useState(!1),[A,N]=p.useState(null);function C(I,$,ne){N({type:"alert",title:I,message:$,onConfirm:()=>{N(null)}})}function E(I,$,ne){N({type:"confirm",title:I,message:$,onConfirm:()=>{N(null),ne()},onCancel:()=>N(null)})}function D(){const I=new URLSearchParams;f&&I.set("q",f),a&&I.set("category",a),fe(`/api/memory?${I}`).then(d).catch($=>P(String($)))}p.useEffect(D,[f,a]);async function Z(){h.trim()&&(await fe("/api/memory",{method:"POST",body:JSON.stringify({content:h,category:S,source:"ui"})}),x(""),D())}async function Y(I){await fe(`/api/memory/${I}`,{method:"DELETE"}),D()}async function G(){F(!0);try{const I=await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(I.duplicate_count===0){C("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${I.duplicate_count} Dublette(n) in ${I.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),D()}catch($){C("Fehler",`Fehler beim Löschen: ${$.message}`)}})}catch(I){C("Fehler",`Fehler bei der Deduplizierung: ${I.message}`)}finally{F(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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)"}),n.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."})]}),n.jsxs("button",{onClick:G,disabled:L,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:[n.jsx(Ch,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:h,onChange:I=>x(I.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"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:S,onChange:I=>b(I.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:Ju.map(I=>{var $;return n.jsx("option",{value:I,className:"bg-popover text-foreground",children:(($=ui[I])==null?void 0:$.label)||I},I)})})]}),n.jsxs("button",{onClick:Z,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:[n.jsx(lf,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:f,onChange:I=>m(I.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"}),n.jsx(Ei,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.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:[n.jsx("button",{onClick:()=>c(""),className:ee("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",a?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Ju.map(I=>{const $=ui[I]||Xu,ne=$.icon;return n.jsxs("button",{onClick:()=>c(I),className:ee("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",a===I?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{children:$.label})]},I)})]})]}),j&&n.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: ",j]}),n.jsx("div",{className:"space-y-3",children:o.length===0?n.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."}):o.map(I=>{const $=ui[I.category]||Xu,ne=$.icon;return n.jsxs("div",{className:ee("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",P0[I.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:ee("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",$.bg,$.text),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:$.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:I.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.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:I.source}),n.jsx("button",{onClick:()=>Y(I.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:n.jsx(gi,{className:"h-3.5 w-3.5"})})]})]},I.id)})}),A&&n.jsx(qr,{type:A.type,title:A.title,message:A.message,onConfirm:A.onConfirm,onCancel:A.onCancel})]})}function qo({label:o,ok:d,detail:a,icon:c,onClick:f}){return n.jsxs("div",{onClick:f,className:ee("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",d?"border-border/60":"border-amber-500/30",f&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:o}),n.jsx(c,{className:ee("h-4.5 w-4.5",d?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full ring-2 ring-black/40",d?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:d?"Bereit / Online":"Offline / Inaktiv"})]}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:a,children:a})]}),f&&n.jsxs("button",{onClick:m=>{m.stopPropagation(),f()},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:[n.jsx(bt,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function R0(){const[o,d]=p.useState(null),[a,c]=p.useState(""),[f,m]=p.useState(null),[h,x]=p.useState(!1),[S,b]=p.useState([]),[j,P]=p.useState(null);function L($,ne,se){P({type:"alert",title:$,message:ne,onConfirm:se})}const[F,A]=p.useState({width:800,height:360}),N=p.useRef(null),C=p.useCallback($=>{if(N.current&&(N.current.disconnect(),N.current=null),$){const ne=new ResizeObserver(se=>{if(!se||se.length===0)return;const X=se[0].contentRect;A({width:X.width,height:X.height})});ne.observe($),N.current=ne}},[]),E=F.width,D=F.height,Z=($,ne,se,X)=>{const be=($+se)/2;return`M ${$} ${ne} C ${be} ${ne}, ${be} ${X}, ${se} ${X}`};function Y(){fe("/api/agent/status").then(d).catch($=>c(String($)))}function G(){fe("/api/models").then($=>{const ne=$.models.map(se=>{var X;return((X=se.name.split("/").pop())==null?void 0:X.replace(".gguf",""))||se.name});b(["auto","fast","heavy",...ne])}).catch($=>console.error("Error loading models",$))}async function I($){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:$})}),L("Erfolgreich",`Hermes-Gehirn wurde auf '${$}' geändert. Der Gateway-Dienst wurde neu gestartet.`),Y(),x(!1)}catch(ne){L("Fehler",`Fehler beim Wechseln des Gehirns: ${ne.message}`)}}return p.useEffect(()=>{Y(),G();const $=setInterval(Y,5e3);return()=>clearInterval($)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -372,9 +372,9 @@ Error generating stack: `+i.message+` stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(o==null?void 0:o.webui_url)&&n.jsxs("a",{href:Ms(o.webui_url),target:"_blank",rel:"noopener",className:ee("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",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[n.jsx(el,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),a&&n.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 (",a,")."]}),o&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(Zo,{label:"Agent Gateway",ok:o.gateway_reachable,detail:"Port :8642 (REST API)",icon:Ss}),n.jsx(Zo,{label:"Agent WebUI",ok:o.webui_reachable,detail:"Port :8787 (Chat UI)",icon:Xo}),n.jsx(Zo,{label:"Aktives Gehirn",ok:o.gateway_reachable,detail:o.brain_model?`Model: ${o.brain_model}`:"Model: auto",icon:yt,onClick:()=>x(!0)}),n.jsx(Zo,{label:"Verdrahtung",ok:o.has_config,detail:`Config: ${o.has_config?"✓":"—"} · Skills: ${o.has_skills?"✓":"—"} · Memory: ${o.has_memories?"✓":"—"}`,icon:rl})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="webui"||o.webui_reachable)&&n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="brain"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="wiring"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>m("webui"),onMouseLeave:()=>m(null),onClick:()=>o.webui_reachable&&window.open(Ms(o.webui_url),"_blank"),title:o.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(Xo,{className:ee("h-3.5 w-3.5",o.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:ee("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",o.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.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:()=>m("gateway"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Ss,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:ee("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",o.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:o.gateway_reachable?"Online":"Offline"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("brain"),onMouseLeave:()=>m(null),onClick:()=>x(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(yt,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),o.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:o.brain_model,children:o.brain_model||"auto"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("wiring"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(rl,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),o.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",o.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",o.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",o.has_memories?"✓":"—"]})]})]})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!o.gateway_reachable&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.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"}),"."]})]})]})]}),o&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(yt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>x(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:C.map($=>{const ne=["auto","fast","heavy"].includes($);return n.jsxs("button",{onClick:()=>I($),className:ee("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===$||!o.brain_model&&$==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:$}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ne?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===$||!o.brain_model&&$==="auto")&&n.jsx(Dn,{className:"h-4 w-4 shrink-0 text-primary"})]},$)})})]})}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:()=>j.onConfirm&&j.onConfirm(),onCancel:j.onCancel})]})}function D0(){const[o,d]=p.useState("connect"),[a,c]=p.useState("roocode"),[f,m]=p.useState(null),h="192.168.178.151",[x,C]=p.useState(!1),[b,j]=p.useState(null);function P(){C(!0),fe("/api/health").then(L=>{m(L),j(L.engine_reachable?"success":"partial")}).catch(()=>{m(null),j("fail")}).finally(()=>C(!1))}return p.useEffect(()=>{P()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>d("connect"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),n.jsx("button",{onClick:()=>d("concepts"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),o==="connect"?n.jsxs(n.Fragment,{children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:ee("h-3 w-3 rounded-full ring-2 ring-black/40",b==="success"&&"bg-emerald-500 animate-pulse",b==="partial"&&"bg-amber-500",b==="fail"&&"bg-red-500",!b&&"bg-muted")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[b==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(f==null?void 0:f.version)||""}).`,b==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",b==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!b&&"Verbindung wird geprüft..."]})]})]}),n.jsxs("button",{onClick:P,disabled:x,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:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",x&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(of,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(yt,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.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."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Es,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Cs,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.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."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(mi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>c("roocode"),className:ee("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:[n.jsx(cf,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>c("cursor"),className:ee("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"}),n.jsx("button",{onClick:()=>c("opencode"),className:ee("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"})]}),n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),a==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.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.'})]})]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(tl,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.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:[n.jsx(hi,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.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."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Es,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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 ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(hi,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Cs,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.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:`--- + `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(o==null?void 0:o.webui_url)&&n.jsxs("a",{href:Ps(o.webui_url),target:"_blank",rel:"noopener",className:ee("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",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[n.jsx(Xo,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),a&&n.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 (",a,")."]}),o&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(qo,{label:"Agent Gateway",ok:o.gateway_reachable,detail:"Port :8642 (REST API)",icon:Ns}),n.jsx(qo,{label:"Agent WebUI",ok:o.webui_reachable,detail:"Port :8787 (Chat UI)",icon:Jo}),n.jsx(qo,{label:"Aktives Gehirn",ok:o.gateway_reachable,detail:o.brain_model?`Model: ${o.brain_model}`:"Model: auto",icon:bt,onClick:()=>x(!0)}),n.jsx(qo,{label:"Verdrahtung",ok:o.has_config,detail:`Config: ${o.has_config?"✓":"—"} · Skills: ${o.has_skills?"✓":"—"} · Memory: ${o.has_memories?"✓":"—"}`,icon:tl})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:C,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="webui"||o.webui_reachable)&&n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="brain"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="wiring"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>m("webui"),onMouseLeave:()=>m(null),onClick:()=>o.webui_reachable&&window.open(Ps(o.webui_url),"_blank"),title:o.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(Jo,{className:ee("h-3.5 w-3.5",o.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:ee("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",o.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.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:()=>m("gateway"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Ns,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:ee("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",o.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:o.gateway_reachable?"Online":"Offline"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("brain"),onMouseLeave:()=>m(null),onClick:()=>x(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(bt,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),o.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:o.brain_model,children:o.brain_model||"auto"})]}),n.jsxs("div",{className:ee("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",o.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:()=>m("wiring"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(tl,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),o.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",o.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",o.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",o.has_memories?"✓":"—"]})]})]})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!o.gateway_reachable&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.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"}),"."]})]})]})]}),o&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(bt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>x(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:S.map($=>{const ne=["auto","fast","heavy"].includes($);return n.jsxs("button",{onClick:()=>I($),className:ee("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===$||!o.brain_model&&$==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:$}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ne?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===$||!o.brain_model&&$==="auto")&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},$)})})]})}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:()=>j.onConfirm&&j.onConfirm(),onCancel:j.onCancel})]})}function z0(){const[o,d]=p.useState("connect"),[a,c]=p.useState("roocode"),[f,m]=p.useState(null),h="192.168.178.151",[x,S]=p.useState(!1),[b,j]=p.useState(null);function P(){S(!0),fe("/api/health").then(L=>{m(L),j(L.engine_reachable?"success":"partial")}).catch(()=>{m(null),j("fail")}).finally(()=>S(!1))}return p.useEffect(()=>{P()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>d("connect"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),n.jsx("button",{onClick:()=>d("concepts"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),o==="connect"?n.jsxs(n.Fragment,{children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:ee("h-3 w-3 rounded-full ring-2 ring-black/40",b==="success"&&"bg-emerald-500 animate-pulse",b==="partial"&&"bg-amber-500",b==="fail"&&"bg-red-500",!b&&"bg-muted")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[b==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(f==null?void 0:f.version)||""}).`,b==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",b==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!b&&"Verbindung wird geprüft..."]})]})]}),n.jsxs("button",{onClick:P,disabled:x,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:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",x&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(sf,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(bt,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.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."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Cs,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Ss,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.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."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(pi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>c("roocode"),className:ee("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:[n.jsx(df,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>c("cursor"),className:ee("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"}),n.jsx("button",{onClick:()=>c("opencode"),className:ee("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"})]}),n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),a==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.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"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.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.'})]})]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(el,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.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:[n.jsx(mi,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.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."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Cs,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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 ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(mi,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Ss,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.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 -...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.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:",n.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:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.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 ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(yt,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(rl,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(tl,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(mi,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(rl,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.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."})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Hr,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(_u,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(_u,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.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 L0({title:o,hint:d}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:o}),n.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}),n.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:[n.jsx(hh,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const A0=[{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 pi(o){return o==null?"":o>1024**3?`${(o/1024**3).toFixed(2)} GB`:`${(o/1024**2).toFixed(1)} MB`}function O0({open:o,onClose:d,defaultTab:a="maintenance"}){const[c,f]=p.useState(null),[m,h]=p.useState([]),[x,C]=p.useState("llama-swap"),[b,j]=p.useState(""),[P,L]=p.useState(!1),[F,A]=p.useState(null),[N,S]=p.useState({}),[E,D]=p.useState("maintenance"),[Z,Y]=p.useState(!1),[G,I]=p.useState(null);function $(T,O,ge){I({type:"alert",title:T,message:O,onConfirm:()=>{I(null),ge&&ge()}})}function ne(T,O,ge){I({type:"confirm",title:T,message:O,onConfirm:()=>{I(null),ge()},onCancel:()=>I(null)})}function se(T){return T?new Date(T*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[X,be]=p.useState(""),[ce,Me]=p.useState(""),[Pe,Re]=p.useState(!1),[Se,Ne]=p.useState(!1);p.useEffect(()=>{o&&(be(localStorage.getItem("mc_sudo_password")||""),Me(localStorage.getItem("mc_hf_token")||""))},[o]),p.useEffect(()=>{o&&a&&D(a)},[o,a]);const H=p.useRef(null);function ae(){fe("/api/maintenance/updates").then(f).catch(T=>console.error("Error loading updates",T))}function K(){fe("/api/jobs").then(T=>h(T.jobs||[])).catch(T=>console.error("Error loading jobs",T))}function w(T){L(!0),A(null),fe(`/api/maintenance/logs?service=${T}&lines=150`).then(O=>{O.ok?j(O.text):(j(`Fehler beim Laden der Logs: ${O.err||"Unbekannter Fehler"}`),(O.status==="incorrect_password"||O.status==="password_required")&&A(O.status))}).catch(O=>j(`Fehler: ${O.message}`)).finally(()=>{L(!1),setTimeout(()=>{H.current&&(H.current.scrollTop=H.current.scrollHeight)},50)})}p.useEffect(()=>{if(!o)return;ae(),K();const T=setInterval(()=>{K(),ae()},3e3);return()=>clearInterval(T)},[o]),p.useEffect(()=>{!o||E!=="logs"||w(x)},[o,E,x]);async function v(){try{await fe("/api/maintenance/os-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Starten des OS-Updates: ${T.message}`)}}async function V(){try{await fe("/api/maintenance/engine-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Engine-Update: ${T.message}`)}}async function J(){Y(!0);try{await fe("/api/maintenance/check-updates",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler bei der Update-Suche: ${T.message}`)}finally{Y(!1)}}async function Q(T,O){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:T,role:O})}),$("Gestartet",`Modell-Upgrade für '${O}' (${T}) gestartet.`),K(),D("maintenance")}catch(ge){$("Fehler",`Fehler beim Starten des Modell-Upgrades: ${ge.message}`)}}async function oe(){ne("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await fe("/api/maintenance/reboot",{method:"POST"}),$("Reboot","Reboot ausgelöst. System startet neu...",()=>{d()})}catch(T){$("Fehler",`Fehler beim Reboot: ${T.message}`)}})}async function pe(T){S(O=>({...O,[T]:!0}));try{const O=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:T})});O.ok?$("Dienst neu gestartet",`Dienst ${T} wurde erfolgreich neu gestartet.`,()=>{E==="logs"&&x===T&&w(T)}):$("Fehler",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){$("Fehler",`Fehler beim Neustart: ${O.message}`)}finally{S(O=>({...O,[T]:!1}))}}async function me(T){try{await fe(`/api/jobs/${T}/cancel`,{method:"POST"}),K()}catch(O){$("Fehler",`Fehler beim Abbrechen: ${O.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:ee("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",o?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:d}),n.jsxs("div",{className:ee("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",o?"translate-x-0":"translate-x-full"),children:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(yt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.jsx("button",{onClick:d,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:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>D("maintenance"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>D("logs"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>D("settings"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[E==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",se(c.last_check)]}),n.jsxs("button",{onClick:J,disabled:Z,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Vr,{className:ee("h-3 w-3",Z&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:v,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:[n.jsx(Hr,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:V,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:[n.jsx(Sh,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:oe,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:[n.jsx(df,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.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&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.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)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",se(c.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:c.model_list.map(T=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:T.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:T.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",T.role]})]}),n.jsxs("button",{onClick:()=>Q(T.repo,T.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:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},T.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[m.filter(T=>T.state==="running"||T.state==="queued").length," Aktiv"]})]}),n.jsx("div",{className:"space-y-3",children:m.length===0?n.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."}):m.map(T=>{const O=T.state==="running"||T.state==="queued";return n.jsxs("div",{className:ee("p-3 rounded-xl border transition-all duration-300",O?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[O&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),T.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",T.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:ee(T.state==="done"&&"text-emerald-400",T.state==="failed"&&"text-red-400",T.state==="running"&&"text-primary",T.state==="queued"&&"text-amber-400",T.state==="canceled"&&"text-muted-foreground"),children:T.state})]})]}),O&&n.jsx("button",{onClick:()=>me(T.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),T.state==="running"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${T.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[T.progress??0,"%"]}),T.done_bytes!=null&&T.total_bytes!=null&&n.jsxs("span",{children:[pi(T.done_bytes)," / ",pi(T.total_bytes),T.rate_bps!=null&&` (${pi(T.rate_bps)}/s)`]}),T.eta_s!=null&&n.jsxs("span",{children:["ETA: ",T.eta_s,"s"]})]})]})]},T.id)})})]})]}),E==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:x,onChange:T=>C(T.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:A0.map(T=>n.jsxs("option",{value:T.id,children:[T.label," (",T.type==="system"?"systemd-root":"user",")"]},T.id))}),n.jsxs("button",{onClick:()=>pe(x),disabled:N[x],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:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",N[x]&&"animate-spin")}),"Restart"]})]}),n.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:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(tl,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",x]})]}),n.jsx("button",{onClick:()=>w(x),disabled:P,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Vr,{className:ee("h-3 w-3",P&&"animate-spin")})})]}),n.jsx("pre",{ref:H,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:F==="password_required"||F==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(Ph,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:F==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",x," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>D("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"})]}):P&&!b?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):b||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),E==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(Hr,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Pe?"text":"password",value:X,onChange:T=>be(T.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"}),n.jsx("button",{type:"button",onClick:()=>Re(!Pe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Pe?n.jsx(Pu,{className:"h-4 w-4"}):n.jsx(xi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(yh,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Se?"text":"password",value:ce,onChange:T=>Me(T.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"}),n.jsx("button",{type:"button",onClick:()=>Ne(!Se),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Se?n.jsx(Pu,{className:"h-4 w-4"}):n.jsx(xi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",X),localStorage.setItem("mc_hf_token",ce),$("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"}),n.jsx("button",{onClick:()=>{be(""),Me(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),$("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"})]})]})]})]}),G&&n.jsx(qr,{type:G.type,title:G.title,message:G.message,onConfirm:G.onConfirm,onCancel:G.onCancel})]})}function T0(){var F,A,N,S,E;const[o,d]=p.useState("dashboard"),[a,c]=p.useState(null),[f,m]=p.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[h,x]=p.useState(null),[C,b]=p.useState(!1),[j,P]=p.useState("maintenance");p.useEffect(()=>{const D=()=>fe("/api/health").then(c).catch(()=>c(null));D();const Z=setInterval(D,1e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{const D=()=>fe("/api/system/status").then(x).catch(()=>{});D();const Z=setInterval(D,2e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{document.documentElement.classList.add("dark")},[]),p.useEffect(()=>{const D=Z=>{var G;P(((G=Z.detail)==null?void 0:G.tab)||"maintenance"),b(!0)};return window.addEventListener("open-system-drawer",D),()=>window.removeEventListener("open-system-drawer",D)},[]);const L=yi.find(D=>D.id===o);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.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]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Ig,{onNavigate:d}),n.jsx(O0,{open:C,onClose:()=>b(!1),defaultTab:j}),n.jsxs("aside",{className:ee("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",f?"w-16":"w-60"),children:[n.jsxs("div",{className:ee("flex items-center py-4 border-b border-border/40 shrink-0",f?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!f&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{m(D=>{const Z=!D;return localStorage.setItem("mc_sidebar_collapsed",Z.toString()),Z})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:f?"Maximieren":"Minimieren",children:f?n.jsx(dh,{className:"h-4 w-4"}):n.jsx(ih,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:yi.map(D=>n.jsxs("button",{onClick:()=>d(D.id),className:ee("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",f?"justify-center p-2.5":"gap-3 px-3 py-2",o===D.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:f?D.label:void 0,children:[n.jsx(D.icon,{className:"h-4.5 w-4.5 shrink-0"}),!f&&n.jsx("span",{className:"truncate",children:D.label})]},D.id))}),n.jsx("div",{className:ee("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",f?"px-2 text-center":"px-5"),children:f?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",a?a.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:a?`Engine ${a.engine_reachable?"online":"offline"}`:"Backend offline"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[a?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full animate-pulse",a.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",a.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(h==null?void 0:h.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.jsxs("div",{className:"truncate",title:h.versions.mc2?`${h.versions.mc2.branch}-${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""} (${h.versions.mc2.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"MC2:"})," ",h.versions.mc2?`${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((F=h.versions.engine)==null?void 0:F.type)==="git"?`${h.versions.engine.branch}-${h.versions.engine.hash}${h.versions.engine.dirty?"*":""} (${h.versions.engine.date})`:((A=h.versions.engine)==null?void 0:A.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((N=h.versions.engine)==null?void 0:N.type)==="git"?`${h.versions.engine.hash}${h.versions.engine.dirty?"*":""}`:((E=(S=h.versions.engine)==null?void 0:S.version_text)==null?void 0:E.split(" ").pop())||"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_ui?`${h.versions.hermes_ui.branch}-${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""} (${h.versions.hermes_ui.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes UI:"})," ",h.versions.hermes_ui?`${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_agent?`${h.versions.hermes_agent.branch}-${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""} (${h.versions.hermes_agent.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes Agent:"})," ",h.versions.hermes_agent?`${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.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:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:L.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.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"}),n.jsxs("button",{onClick:()=>{const D=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(D)},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:[n.jsx(mh,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[o==="dashboard"&&n.jsx(v0,{}),o==="models"&&n.jsx(E0,{}),o==="system"&&n.jsx(_0,{}),o==="connect"&&n.jsx(P0,{}),o==="memory"&&n.jsx(R0,{}),o==="agent"&&n.jsx(z0,{}),o==="guide"&&n.jsx(D0,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(o)&&n.jsx(L0,{title:L.label,hint:L.hint})]})]})]})}rh.createRoot(document.getElementById("root")).render(n.jsx(rf.StrictMode,{children:n.jsx(T0,{})})); +...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.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:",n.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:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.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 ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(bt,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(tl,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(el,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(pi,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(tl,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.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."})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Hr,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Eu,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Eu,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.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 D0({title:o,hint:d}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:o}),n.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}),n.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:[n.jsx(mh,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const L0=[{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 fi(o){return o==null?"":o>1024**3?`${(o/1024**3).toFixed(2)} GB`:`${(o/1024**2).toFixed(1)} MB`}function A0({open:o,onClose:d,defaultTab:a="maintenance"}){const[c,f]=p.useState(null),[m,h]=p.useState([]),[x,S]=p.useState("llama-swap"),[b,j]=p.useState(""),[P,L]=p.useState(!1),[F,A]=p.useState(null),[N,C]=p.useState({}),[E,D]=p.useState("maintenance"),[Z,Y]=p.useState(!1),[G,I]=p.useState(null);function $(T,O,ge){I({type:"alert",title:T,message:O,onConfirm:()=>{I(null),ge&&ge()}})}function ne(T,O,ge){I({type:"confirm",title:T,message:O,onConfirm:()=>{I(null),ge()},onCancel:()=>I(null)})}function se(T){return T?new Date(T*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[X,be]=p.useState(""),[ce,Me]=p.useState(""),[Pe,Re]=p.useState(!1),[Se,Ne]=p.useState(!1);p.useEffect(()=>{o&&(be(localStorage.getItem("mc_sudo_password")||""),Me(localStorage.getItem("mc_hf_token")||""))},[o]),p.useEffect(()=>{o&&a&&D(a)},[o,a]);const H=p.useRef(null);function ae(){fe("/api/maintenance/updates").then(f).catch(T=>console.error("Error loading updates",T))}function K(){fe("/api/jobs").then(T=>h(T.jobs||[])).catch(T=>console.error("Error loading jobs",T))}function w(T){L(!0),A(null),fe(`/api/maintenance/logs?service=${T}&lines=150`).then(O=>{O.ok?j(O.text):(j(`Fehler beim Laden der Logs: ${O.err||"Unbekannter Fehler"}`),(O.status==="incorrect_password"||O.status==="password_required")&&A(O.status))}).catch(O=>j(`Fehler: ${O.message}`)).finally(()=>{L(!1),setTimeout(()=>{H.current&&(H.current.scrollTop=H.current.scrollHeight)},50)})}p.useEffect(()=>{if(!o)return;ae(),K();const T=setInterval(()=>{K(),ae()},3e3);return()=>clearInterval(T)},[o]),p.useEffect(()=>{!o||E!=="logs"||w(x)},[o,E,x]);async function v(){try{await fe("/api/maintenance/os-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Starten des OS-Updates: ${T.message}`)}}async function V(){try{await fe("/api/maintenance/engine-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Engine-Update: ${T.message}`)}}async function J(){Y(!0);try{await fe("/api/maintenance/check-updates",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler bei der Update-Suche: ${T.message}`)}finally{Y(!1)}}async function Q(T,O){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:T,role:O})}),$("Gestartet",`Modell-Upgrade für '${O}' (${T}) gestartet.`),K(),D("maintenance")}catch(ge){$("Fehler",`Fehler beim Starten des Modell-Upgrades: ${ge.message}`)}}async function oe(){ne("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await fe("/api/maintenance/reboot",{method:"POST"}),$("Reboot","Reboot ausgelöst. System startet neu...",()=>{d()})}catch(T){$("Fehler",`Fehler beim Reboot: ${T.message}`)}})}async function pe(T){C(O=>({...O,[T]:!0}));try{const O=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:T})});O.ok?$("Dienst neu gestartet",`Dienst ${T} wurde erfolgreich neu gestartet.`,()=>{E==="logs"&&x===T&&w(T)}):$("Fehler",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){$("Fehler",`Fehler beim Neustart: ${O.message}`)}finally{C(O=>({...O,[T]:!1}))}}async function me(T){try{await fe(`/api/jobs/${T}/cancel`,{method:"POST"}),K()}catch(O){$("Fehler",`Fehler beim Abbrechen: ${O.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:ee("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",o?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:d}),n.jsxs("div",{className:ee("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",o?"translate-x-0":"translate-x-full"),children:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(bt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.jsx("button",{onClick:d,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:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>D("maintenance"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>D("logs"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>D("settings"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[E==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",se(c.last_check)]}),n.jsxs("button",{onClick:J,disabled:Z,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Vr,{className:ee("h-3 w-3",Z&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:v,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:[n.jsx(Hr,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:V,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:[n.jsx(Nh,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:oe,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:[n.jsx(af,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.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&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.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)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",se(c.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:c.model_list.map(T=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:T.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:T.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",T.role]})]}),n.jsxs("button",{onClick:()=>Q(T.repo,T.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:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},T.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[m.filter(T=>T.state==="running"||T.state==="queued").length," Aktiv"]})]}),n.jsx("div",{className:"space-y-3",children:m.length===0?n.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."}):m.map(T=>{const O=T.state==="running"||T.state==="queued";return n.jsxs("div",{className:ee("p-3 rounded-xl border transition-all duration-300",O?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[O&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),T.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",T.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:ee(T.state==="done"&&"text-emerald-400",T.state==="failed"&&"text-red-400",T.state==="running"&&"text-primary",T.state==="queued"&&"text-amber-400",T.state==="canceled"&&"text-muted-foreground"),children:T.state})]})]}),O&&n.jsx("button",{onClick:()=>me(T.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),T.state==="running"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${T.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[T.progress??0,"%"]}),T.done_bytes!=null&&T.total_bytes!=null&&n.jsxs("span",{children:[fi(T.done_bytes)," / ",fi(T.total_bytes),T.rate_bps!=null&&` (${fi(T.rate_bps)}/s)`]}),T.eta_s!=null&&n.jsxs("span",{children:["ETA: ",T.eta_s,"s"]})]})]})]},T.id)})})]})]}),E==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:x,onChange:T=>S(T.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:L0.map(T=>n.jsxs("option",{value:T.id,children:[T.label," (",T.type==="system"?"systemd-root":"user",")"]},T.id))}),n.jsxs("button",{onClick:()=>pe(x),disabled:N[x],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:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",N[x]&&"animate-spin")}),"Restart"]})]}),n.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:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(el,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",x]})]}),n.jsx("button",{onClick:()=>w(x),disabled:P,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Vr,{className:ee("h-3 w-3",P&&"animate-spin")})})]}),n.jsx("pre",{ref:H,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:F==="password_required"||F==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(_h,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:F==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",x," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>D("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"})]}):P&&!b?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):b||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),E==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(Hr,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Pe?"text":"password",value:X,onChange:T=>be(T.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"}),n.jsx("button",{type:"button",onClick:()=>Re(!Pe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Pe?n.jsx(_u,{className:"h-4 w-4"}):n.jsx(hi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(vh,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Se?"text":"password",value:ce,onChange:T=>Me(T.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"}),n.jsx("button",{type:"button",onClick:()=>Ne(!Se),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Se?n.jsx(_u,{className:"h-4 w-4"}):n.jsx(hi,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",X),localStorage.setItem("mc_hf_token",ce),$("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"}),n.jsx("button",{onClick:()=>{be(""),Me(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),$("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"})]})]})]})]}),G&&n.jsx(qr,{type:G.type,title:G.title,message:G.message,onConfirm:G.onConfirm,onCancel:G.onCancel})]})}function O0(){var F,A,N,C,E;const[o,d]=p.useState("dashboard"),[a,c]=p.useState(null),[f,m]=p.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[h,x]=p.useState(null),[S,b]=p.useState(!1),[j,P]=p.useState("maintenance");p.useEffect(()=>{const D=()=>fe("/api/health").then(c).catch(()=>c(null));D();const Z=setInterval(D,1e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{const D=()=>fe("/api/system/status").then(x).catch(()=>{});D();const Z=setInterval(D,2e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{document.documentElement.classList.add("dark")},[]),p.useEffect(()=>{const D=Z=>{var G;P(((G=Z.detail)==null?void 0:G.tab)||"maintenance"),b(!0)};return window.addEventListener("open-system-drawer",D),()=>window.removeEventListener("open-system-drawer",D)},[]);const L=vi.find(D=>D.id===o);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.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]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Tg,{onNavigate:d}),n.jsx(A0,{open:S,onClose:()=>b(!1),defaultTab:j}),n.jsxs("aside",{className:ee("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",f?"w-16":"w-60"),children:[n.jsxs("div",{className:ee("flex items-center py-4 border-b border-border/40 shrink-0",f?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!f&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{m(D=>{const Z=!D;return localStorage.setItem("mc_sidebar_collapsed",Z.toString()),Z})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:f?"Maximieren":"Minimieren",children:f?n.jsx(ih,{className:"h-4 w-4"}):n.jsx(ah,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:vi.map(D=>n.jsxs("button",{onClick:()=>d(D.id),className:ee("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",f?"justify-center p-2.5":"gap-3 px-3 py-2",o===D.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:f?D.label:void 0,children:[n.jsx(D.icon,{className:"h-4.5 w-4.5 shrink-0"}),!f&&n.jsx("span",{className:"truncate",children:D.label})]},D.id))}),n.jsx("div",{className:ee("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",f?"px-2 text-center":"px-5"),children:f?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",a?a.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:a?`Engine ${a.engine_reachable?"online":"offline"}`:"Backend offline"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[a?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full animate-pulse",a.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",a.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(h==null?void 0:h.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.jsxs("div",{className:"truncate",title:h.versions.mc2?`${h.versions.mc2.branch}-${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""} (${h.versions.mc2.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"MC2:"})," ",h.versions.mc2?`${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((F=h.versions.engine)==null?void 0:F.type)==="git"?`${h.versions.engine.branch}-${h.versions.engine.hash}${h.versions.engine.dirty?"*":""} (${h.versions.engine.date})`:((A=h.versions.engine)==null?void 0:A.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((N=h.versions.engine)==null?void 0:N.type)==="git"?`${h.versions.engine.hash}${h.versions.engine.dirty?"*":""}`:((E=(C=h.versions.engine)==null?void 0:C.version_text)==null?void 0:E.split(" ").pop())||"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_ui?`${h.versions.hermes_ui.branch}-${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""} (${h.versions.hermes_ui.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes UI:"})," ",h.versions.hermes_ui?`${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_agent?`${h.versions.hermes_agent.branch}-${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""} (${h.versions.hermes_agent.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes Agent:"})," ",h.versions.hermes_agent?`${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.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:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:L.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.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"}),n.jsxs("button",{onClick:()=>{const D=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(D)},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:[n.jsx(ph,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[o==="dashboard"&&n.jsx(v0,{}),o==="models"&&n.jsx(C0,{}),o==="system"&&n.jsx(E0,{}),o==="connect"&&n.jsx(_0,{}),o==="memory"&&n.jsx(M0,{}),o==="agent"&&n.jsx(R0,{}),o==="guide"&&n.jsx(z0,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(o)&&n.jsx(D0,{title:L.label,hint:L.hint})]})]})]})}th.createRoot(document.getElementById("root")).render(n.jsx(tf.StrictMode,{children:n.jsx(O0,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 472075c..1d7d3c3 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 04be139..05eed36 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -11,14 +11,14 @@ import { AgentView } from "@/views/AgentView" import { GuideView } from "@/views/GuideView" import { Placeholder } from "@/views/Placeholder" import { SystemDrawer } from "@/components/SystemDrawer" -import { api, type Health } from "@/lib/api" +import { api, type Health, type SystemStatus } from "@/lib/api" import { cn } from "@/lib/utils" export default function App() { const [view, setView] = useState("dashboard") const [health, setHealth] = useState(null) const [sidebarCollapsed, setSidebarCollapsed] = useState(() => localStorage.getItem("mc_sidebar_collapsed") === "true") - const [sysStatus, setSysStatus] = useState(null) + const [sysStatus, setSysStatus] = useState(null) const [drawerOpen, setDrawerOpen] = useState(false) const [drawerTab, setDrawerTab] = useState<"maintenance" | "logs">("maintenance") @@ -30,7 +30,7 @@ export default function App() { }, []) useEffect(() => { - const loadSys = () => api("/api/system/status").then(setSysStatus).catch(() => {}) + const loadSys = () => api("/api/system/status").then(setSysStatus).catch(() => {}) loadSys() const t = setInterval(loadSys, 20000) return () => clearInterval(t) diff --git a/frontend/src/components/CustomDialog.tsx b/frontend/src/components/CustomDialog.tsx index 70fb1a5..4bfc319 100644 --- a/frontend/src/components/CustomDialog.tsx +++ b/frontend/src/components/CustomDialog.tsx @@ -1,3 +1,4 @@ +import { useRef } from "react" import { X } from "lucide-react" export interface CustomDialogProps { @@ -10,6 +11,7 @@ export interface CustomDialogProps { } export function CustomDialog({ type, title, message, defaultValue, onConfirm, onCancel }: CustomDialogProps) { + const inputRef = useRef(null) return (
@@ -26,15 +28,14 @@ export function CustomDialog({ type, title, message, defaultValue, onConfirm, on {type === "prompt" && ( { if (e.key === "Enter") { - const val = (document.getElementById("custom-dialog-input") as HTMLInputElement)?.value - onConfirm(val) + onConfirm(inputRef.current?.value) } }} /> @@ -51,9 +52,7 @@ export function CustomDialog({ type, title, message, defaultValue, onConfirm, on )}
) } diff --git a/frontend/src/views/ConnectView.tsx b/frontend/src/views/ConnectView.tsx index fb9f256..0645920 100644 --- a/frontend/src/views/ConnectView.tsx +++ b/frontend/src/views/ConnectView.tsx @@ -1,24 +1,18 @@ -import { useEffect, useState } from "react" +import { useState } from "react" import { Check, Copy, Terminal, Info, Globe, FolderOpen } from "lucide-react" -import { api, type ConnectResp } from "@/lib/api" +import { useConnect } from "@/lib/queries" import { cn } from "@/lib/utils" export function ConnectView() { const [host, setHost] = useState(localStorage.getItem("mc_host") || "192.168.178.151") const [mcpPath, setMcpPath] = useState(localStorage.getItem("mc_mcp_path") || "") - const [data, setData] = useState(null) const [active, setActive] = useState("cline") const [copied, setCopied] = useState(false) - const [error, setError] = useState("") - useEffect(() => { - const params = new URLSearchParams() - params.set("host", host) - if (mcpPath) params.set("mcp_path", mcpPath) - api(`/api/connect?${params}`) - .then(setData) - .catch((e) => setError(String(e))) - }, [host, mcpPath]) + const params = new URLSearchParams({ host }) + if (mcpPath) params.set("mcp_path", mcpPath) + const { data, error: dataErr } = useConnect(params.toString()) + const error = dataErr ? String(dataErr) : "" function saveHost(v: string) { setHost(v) diff --git a/frontend/src/views/MemoryView.tsx b/frontend/src/views/MemoryView.tsx index e01bf5b..4eb24d3 100644 --- a/frontend/src/views/MemoryView.tsx +++ b/frontend/src/views/MemoryView.tsx @@ -1,8 +1,9 @@ -import { useEffect, useState } from "react" +import { useState } from "react" import { Trash2, Sparkles, User, Scroll, Shield, Tag, Clock, Search, Plus, BookOpen } from "lucide-react" -import { api, type DedupeResult, type Memory } from "@/lib/api" +import { api, type DedupeResult } from "@/lib/api" +import { useMemory, useQueryClient } from "@/lib/queries" +import { useDialog } from "@/lib/useDialog" import { cn } from "@/lib/utils" -import { CustomDialog } from "@/components/CustomDialog" const CATEGORIES = ["user", "instruction", "stable", "versioned", "ephemeral"] @@ -26,73 +27,32 @@ const BORDER_CLASSES: Record = { } export function MemoryView() { - const [items, setItems] = useState([]) const [filter, setFilter] = useState("") const [q, setQ] = useState("") const [content, setContent] = useState("") const [category, setCategory] = useState("stable") - const [error, setError] = useState("") const [deduping, setDeduping] = useState(false) - // Custom Dialog State - const [dialog, setDialog] = useState<{ - type: "alert" | "confirm" - title: string - message: string - onConfirm: () => void - onCancel?: () => void - } | null>(null) + const qc = useQueryClient() + const { showAlert, showConfirm, dialogElement } = useDialog() + const { data: items = [], error: itemsErr } = useMemory({ q, category: filter }) + const error = itemsErr ? String(itemsErr) : "" - function showAlert(title: string, message: string, onConfirm?: () => void) { - setDialog({ - type: "alert", - title, - message, - onConfirm: () => { - setDialog(null) - if (onConfirm) onConfirm() - } - }) - } - - function showConfirm(title: string, message: string, onConfirm: () => void) { - setDialog({ - type: "confirm", - title, - message, - onConfirm: () => { - setDialog(null) - onConfirm() - }, - onCancel: () => setDialog(null) - }) - } - - - function load() { - const params = new URLSearchParams() - if (q) params.set("q", q) - if (filter) params.set("category", filter) - api(`/api/memory?${params}`) - .then(setItems) - .catch((e) => setError(String(e))) - } - - useEffect(load, [q, filter]) + const reloadMemory = () => qc.invalidateQueries({ queryKey: ["memory"] }) async function add() { if (!content.trim()) return - await api("/api/memory", { - method: "POST", - body: JSON.stringify({ content, category, source: "ui" }) + await api("/api/memory", { + method: "POST", + body: JSON.stringify({ content, category, source: "ui" }) }) setContent("") - load() + reloadMemory() } async function del(id: string) { await api(`/api/memory/${id}`, { method: "DELETE" }) - load() + reloadMemory() } async function cleanup() { @@ -111,11 +71,11 @@ export function MemoryView() { `${dry.duplicate_count} Dublette(n) in ${dry.groups.length} Gruppe(n) gefunden. Entfernen?`, async () => { try { - await api("/api/memory/dedupe", { - method: "POST", - body: JSON.stringify({ apply: true }) + await api("/api/memory/dedupe", { + method: "POST", + body: JSON.stringify({ apply: true }) }) - load() + reloadMemory() } catch (e: any) { showAlert("Fehler", `Fehler beim Löschen: ${e.message}`) } @@ -285,15 +245,7 @@ export function MemoryView() { )}
- {dialog && ( - - )} + {dialogElement} ) } diff --git a/frontend/src/views/SystemView.tsx b/frontend/src/views/SystemView.tsx index 0e752e7..31b0be1 100644 --- a/frontend/src/views/SystemView.tsx +++ b/frontend/src/views/SystemView.tsx @@ -1,9 +1,10 @@ -import { useEffect, useState } from "react" +import { useState } from "react" import { ExternalLink, RefreshCw, Save, Cpu, HardDrive, Cpu as GpuIcon, Activity } from "lucide-react" -import { api, type ServicesResp, type SystemStatus } from "@/lib/api" +import { api } from "@/lib/api" +import { useSystemStatus, useServices } from "@/lib/queries" +import { useDialog } from "@/lib/useDialog" import { cn, resolveExternalUrl } from "@/lib/utils" import { gb } from "@/lib/format" -import { CustomDialog } from "@/components/CustomDialog" function DiagnosticBar({ label, percent, detail, icon: Icon }: { label: string; percent: number; detail?: string; icon: any }) { @@ -36,44 +37,13 @@ function DiagnosticBar({ label, percent, detail, icon: Icon }: { label: string; } export function SystemView() { - const [s, setS] = useState(null) - const [svc, setSvc] = useState(null) - const [error, setError] = useState("") + const { data: s, error: sErr } = useSystemStatus(3_000) + const { data: svc } = useServices(3_000) + const { showAlert, dialogElement } = useDialog() + const error = sErr ? String(sErr) : "" const [backupMsg, setBackupMsg] = useState("") const [restartingServices, setRestartingServices] = useState>({}) - // Custom Dialog State - const [dialog, setDialog] = useState<{ - type: "alert" | "confirm" - title: string - message: string - onConfirm: () => void - onCancel?: () => void - } | null>(null) - - function showAlert(title: string, message: string, onConfirm?: () => void) { - setDialog({ - type: "alert", - title, - message, - onConfirm: () => { - setDialog(null) - if (onConfirm) onConfirm() - } - }) - } - - function load() { - api("/api/system/status").then(setS).catch((e) => setError(String(e))) - api("/api/system/services").then(setSvc).catch(() => {}) - } - - useEffect(() => { - load() - const t = setInterval(load, 3000) - return () => clearInterval(t) - }, []) - async function doBackup() { setBackupMsg("Backup snapshotted...") try { @@ -254,15 +224,7 @@ export function SystemView() { )} - {dialog && ( - - )} + {dialogElement} ) } From 7a11fd28461286a2c2e788a15b91169aa34fa7f9 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Fri, 26 Jun 2026 14:50:54 +0200 Subject: [PATCH 5/7] Refactor: DashboardView in Karten zerlegen (Phase 4a) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DashboardView 849 -> ~40 Zeilen Orchestrator. Sechs eigenständige Karten unter components/dashboard/, jede mit eigenem Daten-Hook (react-query, geteilte Keys): - RadialGauge, SystemStatusCard (useSystemStatus) - UpdatesCard (useUpdates+useJobs; OS/Engine-Update, Reboot, Modell-Upgrade, Sudo-Modal, invalidiert nach Aktionen) - AgentStatusCard (useAgentStatus+useModels; Gehirn-Wechsel-Modal) - RolesCard (useModels), MemoryInputCard (useMemory), TokenStatsCard (useTokenStats) Kein manuelles useEffect+setInterval mehr; useDialog statt lokalem Dialog-State. Verifiziert: tsc grün, Build grün, alle 6 Karten rendern, Live-Daten + Pricing- Footer korrekt, keine Konsolenfehler. Co-Authored-By: Claude Opus 4.8 --- frontend/dist/assets/index-CSv49ImW.js | 380 -------- frontend/dist/assets/index-CpG8j7ha.js | 380 ++++++++ frontend/dist/index.html | 2 +- .../components/dashboard/AgentStatusCard.tsx | 149 ++++ .../components/dashboard/MemoryInputCard.tsx | 92 ++ .../src/components/dashboard/RadialGauge.tsx | 27 + .../src/components/dashboard/RolesCard.tsx | 104 +++ .../components/dashboard/SystemStatusCard.tsx | 43 + .../components/dashboard/TokenStatsCard.tsx | 61 ++ .../src/components/dashboard/UpdatesCard.tsx | 304 +++++++ frontend/src/views/DashboardView.tsx | 843 +----------------- 11 files changed, 1175 insertions(+), 1210 deletions(-) delete mode 100644 frontend/dist/assets/index-CSv49ImW.js create mode 100644 frontend/dist/assets/index-CpG8j7ha.js create mode 100644 frontend/src/components/dashboard/AgentStatusCard.tsx create mode 100644 frontend/src/components/dashboard/MemoryInputCard.tsx create mode 100644 frontend/src/components/dashboard/RadialGauge.tsx create mode 100644 frontend/src/components/dashboard/RolesCard.tsx create mode 100644 frontend/src/components/dashboard/SystemStatusCard.tsx create mode 100644 frontend/src/components/dashboard/TokenStatsCard.tsx create mode 100644 frontend/src/components/dashboard/UpdatesCard.tsx diff --git a/frontend/dist/assets/index-CSv49ImW.js b/frontend/dist/assets/index-CSv49ImW.js deleted file mode 100644 index c415209..0000000 --- a/frontend/dist/assets/index-CSv49ImW.js +++ /dev/null @@ -1,380 +0,0 @@ -var sp=s=>{throw TypeError(s)};var pu=(s,o,i)=>o.has(s)||sp("Cannot "+i);var S=(s,o,i)=>(pu(s,o,"read from private field"),i?i.call(s):o.get(s)),be=(s,o,i)=>o.has(s)?sp("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(s):o.set(s,i),oe=(s,o,i,u)=>(pu(s,o,"write to private field"),u?u.call(s,i):o.set(s,i),i),_e=(s,o,i)=>(pu(s,o,"access private method"),i);var Xl=(s,o,i,u)=>({set _(d){oe(s,o,d,i)},get _(){return S(s,o,u)}});function dx(s,o){for(var i=0;iu[d]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&u(g)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();function ih(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var hu={exports:{}},No={},mu={exports:{}},Ce={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var op;function fx(){if(op)return Ce;op=1;var s=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),g=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),j=Symbol.iterator;function M(E){return E===null||typeof E!="object"?null:(E=j&&E[j]||E["@@iterator"],typeof E=="function"?E:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,w={};function C(E,k,G){this.props=E,this.context=k,this.refs=w,this.updater=G||O}C.prototype.isReactComponent={},C.prototype.setState=function(E,k){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,k,"setState")},C.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function _(){}_.prototype=C.prototype;function $(E,k,G){this.props=E,this.context=k,this.refs=w,this.updater=G||O}var V=$.prototype=new _;V.constructor=$,A(V,C.prototype),V.isPureReactComponent=!0;var z=Array.isArray,L=Object.prototype.hasOwnProperty,B={current:null},J={key:!0,ref:!0,__self:!0,__source:!0};function te(E,k,G){var X,Z={},ie=null,he=null;if(k!=null)for(X in k.ref!==void 0&&(he=k.ref),k.key!==void 0&&(ie=""+k.key),k)L.call(k,X)&&!J.hasOwnProperty(X)&&(Z[X]=k[X]);var xe=arguments.length-2;if(xe===1)Z.children=G;else if(1>>1,k=Q[E];if(0>>1;Ed(Z,q))ied(he,Z)?(Q[E]=he,Q[ie]=q,E=ie):(Q[E]=Z,Q[X]=q,E=X);else if(ied(he,q))Q[E]=he,Q[ie]=q,E=ie;else break e}}return ce}function d(Q,ce){var q=Q.sortIndex-ce.sortIndex;return q!==0?q:Q.id-ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;s.unstable_now=function(){return f.now()}}else{var g=Date,h=g.now();s.unstable_now=function(){return g.now()-h}}var v=[],x=[],b=1,j=null,M=3,O=!1,A=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function V(Q){for(var ce=i(x);ce!==null;){if(ce.callback===null)u(x);else if(ce.startTime<=Q)u(x),ce.sortIndex=ce.expirationTime,o(v,ce);else break;ce=i(x)}}function z(Q){if(w=!1,V(Q),!A)if(i(v)!==null)A=!0,Me(L);else{var ce=i(x);ce!==null&&Pe(z,ce.startTime-Q)}}function L(Q,ce){A=!1,w&&(w=!1,_(te),te=-1),O=!0;var q=M;try{for(V(ce),j=i(v);j!==null&&(!(j.expirationTime>ce)||Q&&!ge());){var E=j.callback;if(typeof E=="function"){j.callback=null,M=j.priorityLevel;var k=E(j.expirationTime<=ce);ce=s.unstable_now(),typeof k=="function"?j.callback=k:j===i(v)&&u(v),V(ce)}else u(v);j=i(v)}if(j!==null)var G=!0;else{var X=i(x);X!==null&&Pe(z,X.startTime-ce),G=!1}return G}finally{j=null,M=q,O=!1}}var B=!1,J=null,te=-1,re=5,ee=-1;function ge(){return!(s.unstable_now()-eeQ||125E?(Q.sortIndex=q,o(x,Q),i(v)===null&&Q===i(x)&&(w?(_(te),te=-1):w=!0,Pe(z,q-E))):(Q.sortIndex=k,o(v,Q),A||O||(A=!0,Me(L))),Q},s.unstable_shouldYield=ge,s.unstable_wrapCallback=function(Q){var ce=M;return function(){var q=M;M=ce;try{return Q.apply(this,arguments)}finally{M=q}}}})(yu)),yu}var cp;function gx(){return cp||(cp=1,xu.exports=mx()),xu.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var dp;function xx(){if(dp)return jt;dp=1;var s=sc(),o=gx();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,x=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,b={},j={};function M(e){return v.call(j,e)?!0:v.call(b,e)?!1:x.test(e)?j[e]=!0:(b[e]=!0,!1)}function O(e,t,r,l){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function A(e,t,r,l){if(t===null||typeof t>"u"||O(e,t,r,l))return!0;if(l)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function w(e,t,r,l,a,c,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=p}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new w(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new w(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new w(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new w(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new w(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new w(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new w(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new w(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new w(e,5,!1,e.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function $(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!0,!0)});function V(e,t,r,l){var a=C.hasOwnProperty(t)?C[t]:null;(a!==null?a.type!==0:l||!(2y||a[p]!==c[y]){var N=` -`+a[p].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=p&&0<=y);break}}}finally{G=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?k(e):""}function Z(e){switch(e.tag){case 5:return k(e.type);case 16:return k("Lazy");case 13:return k("Suspense");case 19:return k("SuspenseList");case 0:case 2:case 15:return e=X(e.type,!1),e;case 11:return e=X(e.type.render,!1),e;case 1:return e=X(e.type,!0),e;default:return""}}function ie(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case J:return"Fragment";case B:return"Portal";case re:return"Profiler";case te:return"StrictMode";case Ae:return"Suspense";case Ee:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ge:return(e.displayName||"Context")+".Consumer";case ee:return(e._context.displayName||"Context")+".Provider";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case De:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Me:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function he(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(t);case 8:return t===te?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function xe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function U(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function F(e){var t=U(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,c=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(p){l=""+p,c.call(this,p)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return l},setValue:function(p){l=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function we(e){e._valueTracker||(e._valueTracker=F(e))}function at(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),l="";return e&&(l=U(e)?e.checked?"true":"false":e.value),e=l,e!==r?(t.setValue(e),!0):!1}function Ct(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Et(e,t){var r=t.checked;return q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Pt(e,t){var r=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;r=xe(t.value!=null?t.value:r),e._wrapperState={initialChecked:l,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Fs(e,t){t=t.checked,t!=null&&V(e,"checked",t,!1)}function $n(e,t){Fs(e,t);var r=xe(t.value),l=t.type;if(r!=null)l==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Bn(e,t.type,r):t.hasOwnProperty("defaultValue")&&Bn(e,t.type,xe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Sr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Bn(e,t,r){(t!=="number"||Ct(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Cr=Array.isArray;function ur(e,t,r,l){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Fe.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function cr(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var dr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ni=["Webkit","ms","Moz","O"];Object.keys(dr).forEach(function(e){Ni.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),dr[t]=dr[e]})});function yc(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||dr.hasOwnProperty(e)&&dr[e]?(""+t).trim():t+"px"}function vc(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var l=r.indexOf("--")===0,a=yc(r,t[r],l);r==="float"&&(r="cssFloat"),l?e.setProperty(r,a):e[r]=a}}var gm=q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Si(e,t){if(t){if(gm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function Ci(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ei=null;function Pi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _i=null,Wn=null,Vn=null;function bc(e){if(e=ao(e)){if(typeof _i!="function")throw Error(i(280));var t=e.stateNode;t&&(t=hl(t),_i(e.stateNode,e.type,t))}}function wc(e){Wn?Vn?Vn.push(e):Vn=[e]:Wn=e}function jc(){if(Wn){var e=Wn,t=Vn;if(Vn=Wn=null,bc(e),t)for(e=0;e>>=0,e===0?32:31-(Em(e)/Pm|0)|0}var Zo=64,Yo=4194304;function Ws(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jo(e,t){var r=e.pendingLanes;if(r===0)return 0;var l=0,a=e.suspendedLanes,c=e.pingedLanes,p=r&268435455;if(p!==0){var y=p&~a;y!==0?l=Ws(y):(c&=p,c!==0&&(l=Ws(c)))}else p=r&~a,p!==0?l=Ws(p):c!==0&&(l=Ws(c));if(l===0)return 0;if(t!==0&&t!==l&&(t&a)===0&&(a=l&-l,c=t&-t,a>=c||a===16&&(c&4194240)!==0))return t;if((l&4)!==0&&(l|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0r;r++)t.push(e);return t}function Vs(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Wt(t),e[t]=r}function Om(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0=Xs),Zc=" ",Yc=!1;function Jc(e,t){switch(e){case"keyup":return lg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qn=!1;function ag(e,t){switch(e){case"compositionend":return Xc(t);case"keypress":return t.which!==32?null:(Yc=!0,Zc);case"textInput":return e=t.data,e===Zc&&Yc?null:e;default:return null}}function ug(e,t){if(Qn)return e==="compositionend"||!Ki&&Jc(e,t)?(e=Wc(),nl=$i=Rr=null,Qn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ld(r)}}function ad(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ad(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ud(){for(var e=window,t=Ct();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Ct(e.document)}return t}function Zi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function yg(e){var t=ud(),r=e.focusedElem,l=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&ad(r.ownerDocument.documentElement,r)){if(l!==null&&Zi(r)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,c=Math.min(l.start,a);l=l.end===void 0?c:Math.min(l.end,a),!e.extend&&c>l&&(a=l,l=c,c=a),a=id(r,c);var p=id(r,l);a&&p&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),c>l?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,qn=null,Yi=null,no=null,Ji=!1;function cd(e,t,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ji||qn==null||qn!==Ct(l)||(l=qn,"selectionStart"in l&&Zi(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),no&&ro(no,l)||(no=l,l=dl(Yi,"onSelect"),0es||(e.current=ca[es],ca[es]=null,es--)}function Ue(e,t){es++,ca[es]=e.current,e.current=t}var Ar={},ut=Tr(Ar),xt=Tr(!1),dn=Ar;function ts(e,t){var r=e.type.contextTypes;if(!r)return Ar;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var a={},c;for(c in r)a[c]=t[c];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function yt(e){return e=e.childContextTypes,e!=null}function ml(){Be(xt),Be(ut)}function Sd(e,t,r){if(ut.current!==Ar)throw Error(i(168));Ue(ut,t),Ue(xt,r)}function Cd(e,t,r){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return r;l=l.getChildContext();for(var a in l)if(!(a in t))throw Error(i(108,he(e)||"Unknown",a));return q({},r,l)}function gl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ar,dn=ut.current,Ue(ut,e),Ue(xt,xt.current),!0}function Ed(e,t,r){var l=e.stateNode;if(!l)throw Error(i(169));r?(e=Cd(e,t,dn),l.__reactInternalMemoizedMergedChildContext=e,Be(xt),Be(ut),Ue(ut,e)):Be(xt),Ue(xt,r)}var pr=null,xl=!1,da=!1;function Pd(e){pr===null?pr=[e]:pr.push(e)}function Mg(e){xl=!0,Pd(e)}function zr(){if(!da&&pr!==null){da=!0;var e=0,t=Ie;try{var r=pr;for(Ie=1;e>=p,a-=p,hr=1<<32-Wt(t)+a|r<Ne?(rt=ve,ve=null):rt=ve.sibling;var ze=H(R,ve,D[Ne],Y);if(ze===null){ve===null&&(ve=rt);break}e&&ve&&ze.alternate===null&&t(R,ve),P=c(ze,P,Ne),ye===null?pe=ze:ye.sibling=ze,ye=ze,ve=rt}if(Ne===D.length)return r(R,ve),We&&pn(R,Ne),pe;if(ve===null){for(;NeNe?(rt=ve,ve=null):rt=ve.sibling;var Vr=H(R,ve,ze.value,Y);if(Vr===null){ve===null&&(ve=rt);break}e&&ve&&Vr.alternate===null&&t(R,ve),P=c(Vr,P,Ne),ye===null?pe=Vr:ye.sibling=Vr,ye=Vr,ve=rt}if(ze.done)return r(R,ve),We&&pn(R,Ne),pe;if(ve===null){for(;!ze.done;Ne++,ze=D.next())ze=K(R,ze.value,Y),ze!==null&&(P=c(ze,P,Ne),ye===null?pe=ze:ye.sibling=ze,ye=ze);return We&&pn(R,Ne),pe}for(ve=l(R,ve);!ze.done;Ne++,ze=D.next())ze=se(ve,R,Ne,ze.value,Y),ze!==null&&(e&&ze.alternate!==null&&ve.delete(ze.key===null?Ne:ze.key),P=c(ze,P,Ne),ye===null?pe=ze:ye.sibling=ze,ye=ze);return e&&ve.forEach(function(cx){return t(R,cx)}),We&&pn(R,Ne),pe}function Ze(R,P,D,Y){if(typeof D=="object"&&D!==null&&D.type===J&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case L:e:{for(var pe=D.key,ye=P;ye!==null;){if(ye.key===pe){if(pe=D.type,pe===J){if(ye.tag===7){r(R,ye.sibling),P=a(ye,D.props.children),P.return=R,R=P;break e}}else if(ye.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Me&&Td(pe)===ye.type){r(R,ye.sibling),P=a(ye,D.props),P.ref=uo(R,ye,D),P.return=R,R=P;break e}r(R,ye);break}else t(R,ye);ye=ye.sibling}D.type===J?(P=wn(D.props.children,R.mode,Y,D.key),P.return=R,R=P):(Y=Vl(D.type,D.key,D.props,null,R.mode,Y),Y.ref=uo(R,P,D),Y.return=R,R=Y)}return p(R);case B:e:{for(ye=D.key;P!==null;){if(P.key===ye)if(P.tag===4&&P.stateNode.containerInfo===D.containerInfo&&P.stateNode.implementation===D.implementation){r(R,P.sibling),P=a(P,D.children||[]),P.return=R,R=P;break e}else{r(R,P);break}else t(R,P);P=P.sibling}P=au(D,R.mode,Y),P.return=R,R=P}return p(R);case Me:return ye=D._init,Ze(R,P,ye(D._payload),Y)}if(Cr(D))return de(R,P,D,Y);if(ce(D))return fe(R,P,D,Y);wl(R,D)}return typeof D=="string"&&D!==""||typeof D=="number"?(D=""+D,P!==null&&P.tag===6?(r(R,P.sibling),P=a(P,D),P.return=R,R=P):(r(R,P),P=iu(D,R.mode,Y),P.return=R,R=P),p(R)):r(R,P)}return Ze}var os=Ad(!0),zd=Ad(!1),jl=Tr(null),kl=null,ls=null,xa=null;function ya(){xa=ls=kl=null}function va(e){var t=jl.current;Be(jl),e._currentValue=t}function ba(e,t,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===r)break;e=e.return}}function is(e,t){kl=e,xa=ls=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(vt=!0),e.firstContext=null)}function It(e){var t=e._currentValue;if(xa!==e)if(e={context:e,memoizedValue:t,next:null},ls===null){if(kl===null)throw Error(i(308));ls=e,kl.dependencies={lanes:0,firstContext:e}}else ls=ls.next=e;return t}var hn=null;function wa(e){hn===null?hn=[e]:hn.push(e)}function Ld(e,t,r,l){var a=t.interleaved;return a===null?(r.next=r,wa(t)):(r.next=a.next,a.next=r),t.interleaved=r,gr(e,l)}function gr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Lr=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Id(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function xr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ir(e,t,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Te&2)!==0){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,gr(e,r)}return a=l.interleaved,a===null?(t.next=t,wa(l)):(t.next=a.next,a.next=t),l.interleaved=t,gr(e,r)}function Nl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,zi(e,r)}}function Fd(e,t){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var a=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var p={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};c===null?a=c=p:c=c.next=p,r=r.next}while(r!==null);c===null?a=c=t:c=c.next=t}else a=c=t;r={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:c,shared:l.shared,effects:l.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Sl(e,t,r,l){var a=e.updateQueue;Lr=!1;var c=a.firstBaseUpdate,p=a.lastBaseUpdate,y=a.shared.pending;if(y!==null){a.shared.pending=null;var N=y,I=N.next;N.next=null,p===null?c=I:p.next=I,p=N;var W=e.alternate;W!==null&&(W=W.updateQueue,y=W.lastBaseUpdate,y!==p&&(y===null?W.firstBaseUpdate=I:y.next=I,W.lastBaseUpdate=N))}if(c!==null){var K=a.baseState;p=0,W=I=N=null,y=c;do{var H=y.lane,se=y.eventTime;if((l&H)===H){W!==null&&(W=W.next={eventTime:se,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var de=e,fe=y;switch(H=t,se=r,fe.tag){case 1:if(de=fe.payload,typeof de=="function"){K=de.call(se,K,H);break e}K=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=fe.payload,H=typeof de=="function"?de.call(se,K,H):de,H==null)break e;K=q({},K,H);break e;case 2:Lr=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,H=a.effects,H===null?a.effects=[y]:H.push(y))}else se={eventTime:se,lane:H,tag:y.tag,payload:y.payload,callback:y.callback,next:null},W===null?(I=W=se,N=K):W=W.next=se,p|=H;if(y=y.next,y===null){if(y=a.shared.pending,y===null)break;H=y,y=H.next,H.next=null,a.lastBaseUpdate=H,a.shared.pending=null}}while(!0);if(W===null&&(N=K),a.baseState=N,a.firstBaseUpdate=I,a.lastBaseUpdate=W,t=a.shared.interleaved,t!==null){a=t;do p|=a.lane,a=a.next;while(a!==t)}else c===null&&(a.shared.lanes=0);xn|=p,e.lanes=p,e.memoizedState=K}}function Ud(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var l=Ea.transition;Ea.transition={};try{e(!1),t()}finally{Ie=r,Ea.transition=l}}function of(){return Ft().memoizedState}function Tg(e,t,r){var l=Br(e);if(r={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null},lf(e))af(t,r);else if(r=Ld(e,t,r,l),r!==null){var a=mt();Zt(r,e,l,a),uf(r,t,l)}}function Ag(e,t,r){var l=Br(e),a={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null};if(lf(e))af(t,a);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var p=t.lastRenderedState,y=c(p,r);if(a.hasEagerState=!0,a.eagerState=y,Vt(y,p)){var N=t.interleaved;N===null?(a.next=a,wa(t)):(a.next=N.next,N.next=a),t.interleaved=a;return}}catch{}finally{}r=Ld(e,t,a,l),r!==null&&(a=mt(),Zt(r,e,l,a),uf(r,t,l))}}function lf(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function af(e,t){ho=Pl=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function uf(e,t,r){if((r&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,zi(e,r)}}var Rl={readContext:It,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},zg={readContext:It,useCallback:function(e,t){return rr().memoizedState=[e,t===void 0?null:t],e},useContext:It,useEffect:Yd,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,_l(4194308,4,ef.bind(null,t,e),r)},useLayoutEffect:function(e,t){return _l(4194308,4,e,t)},useInsertionEffect:function(e,t){return _l(4,2,e,t)},useMemo:function(e,t){var r=rr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var l=rr();return t=r!==void 0?r(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=Tg.bind(null,Ge,e),[l.memoizedState,e]},useRef:function(e){var t=rr();return e={current:e},t.memoizedState=e},useState:qd,useDebugValue:Ta,useDeferredValue:function(e){return rr().memoizedState=e},useTransition:function(){var e=qd(!1),t=e[0];return e=Dg.bind(null,e[1]),rr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var l=Ge,a=rr();if(We){if(r===void 0)throw Error(i(407));r=r()}else{if(r=t(),tt===null)throw Error(i(349));(gn&30)!==0||Wd(l,t,r)}a.memoizedState=r;var c={value:r,getSnapshot:t};return a.queue=c,Yd(Gd.bind(null,l,c,e),[e]),l.flags|=2048,xo(9,Vd.bind(null,l,c,r,t),void 0,null),r},useId:function(){var e=rr(),t=tt.identifierPrefix;if(We){var r=mr,l=hr;r=(l&~(1<<32-Wt(l)-1)).toString(32)+r,t=":"+t+"R"+r,r=mo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=p.createElement(r,{is:l.is}):(e=p.createElement(r),r==="select"&&(p=e,l.multiple?p.multiple=!0:l.size&&(p.size=l.size))):e=p.createElementNS(e,r),e[er]=t,e[io]=l,_f(e,t,!1,!1),t.stateNode=e;e:{switch(p=Ci(r,l),r){case"dialog":$e("cancel",e),$e("close",e),a=l;break;case"iframe":case"object":case"embed":$e("load",e),a=l;break;case"video":case"audio":for(a=0;afs&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304)}else{if(!l)if(e=Cl(p),e!==null){if(t.flags|=128,l=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),yo(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!We)return dt(t),null}else 2*qe()-c.renderingStartTime>fs&&r!==1073741824&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304);c.isBackwards?(p.sibling=t.child,t.child=p):(r=c.last,r!==null?r.sibling=p:t.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=qe(),t.sibling=null,r=Ve.current,Ue(Ve,l?r&1|2:r&1),t):(dt(t),null);case 22:case 23:return su(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(Ot&1073741824)!==0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Wg(e,t){switch(pa(t),t.tag){case 1:return yt(t.type)&&ml(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return as(),Be(xt),Be(ut),Ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Na(t),null;case 13:if(Be(Ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ss()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Be(Ve),null;case 4:return as(),null;case 10:return va(t.type._context),null;case 22:case 23:return su(),null;case 24:return null;default:return null}}var Al=!1,ft=!1,Vg=typeof WeakSet=="function"?WeakSet:Set,ae=null;function cs(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(l){Ke(e,t,l)}else r.current=null}function Ga(e,t,r){try{r()}catch(l){Ke(e,t,l)}}var Of=!1;function Gg(e,t){if(sa=tl,e=ud(),Zi(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var a=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{r.nodeType,c.nodeType}catch{r=null;break e}var p=0,y=-1,N=-1,I=0,W=0,K=e,H=null;t:for(;;){for(var se;K!==r||a!==0&&K.nodeType!==3||(y=p+a),K!==c||l!==0&&K.nodeType!==3||(N=p+l),K.nodeType===3&&(p+=K.nodeValue.length),(se=K.firstChild)!==null;)H=K,K=se;for(;;){if(K===e)break t;if(H===r&&++I===a&&(y=p),H===c&&++W===l&&(N=p),(se=K.nextSibling)!==null)break;K=H,H=K.parentNode}K=se}r=y===-1||N===-1?null:{start:y,end:N}}else r=null}r=r||{start:0,end:0}}else r=null;for(oa={focusedElem:e,selectionRange:r},tl=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var de=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(de!==null){var fe=de.memoizedProps,Ze=de.memoizedState,R=t.stateNode,P=R.getSnapshotBeforeUpdate(t.elementType===t.type?fe:Kt(t.type,fe),Ze);R.__reactInternalSnapshotBeforeUpdate=P}break;case 3:var D=t.stateNode.containerInfo;D.nodeType===1?D.textContent="":D.nodeType===9&&D.documentElement&&D.removeChild(D.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(Y){Ke(t,t.return,Y)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return de=Of,Of=!1,de}function vo(e,t,r){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var a=l=l.next;do{if((a.tag&e)===e){var c=a.destroy;a.destroy=void 0,c!==void 0&&Ga(t,r,c)}a=a.next}while(a!==l)}}function zl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var l=r.create;r.destroy=l()}r=r.next}while(r!==t)}}function Ka(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Df(e){var t=e.alternate;t!==null&&(e.alternate=null,Df(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[er],delete t[io],delete t[ua],delete t[Pg],delete t[_g])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tf(e){return e.tag===5||e.tag===3||e.tag===4}function Af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qa(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=pl));else if(l!==4&&(e=e.child,e!==null))for(Qa(e,t,r),e=e.sibling;e!==null;)Qa(e,t,r),e=e.sibling}function qa(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(qa(e,t,r),e=e.sibling;e!==null;)qa(e,t,r),e=e.sibling}var st=null,Qt=!1;function Fr(e,t,r){for(r=r.child;r!==null;)zf(e,t,r),r=r.sibling}function zf(e,t,r){if(Xt&&typeof Xt.onCommitFiberUnmount=="function")try{Xt.onCommitFiberUnmount(qo,r)}catch{}switch(r.tag){case 5:ft||cs(r,t);case 6:var l=st,a=Qt;st=null,Fr(e,t,r),st=l,Qt=a,st!==null&&(Qt?(e=st,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):st.removeChild(r.stateNode));break;case 18:st!==null&&(Qt?(e=st,r=r.stateNode,e.nodeType===8?aa(e.parentNode,r):e.nodeType===1&&aa(e,r),Zs(e)):aa(st,r.stateNode));break;case 4:l=st,a=Qt,st=r.stateNode.containerInfo,Qt=!0,Fr(e,t,r),st=l,Qt=a;break;case 0:case 11:case 14:case 15:if(!ft&&(l=r.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){a=l=l.next;do{var c=a,p=c.destroy;c=c.tag,p!==void 0&&((c&2)!==0||(c&4)!==0)&&Ga(r,t,p),a=a.next}while(a!==l)}Fr(e,t,r);break;case 1:if(!ft&&(cs(r,t),l=r.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=r.memoizedProps,l.state=r.memoizedState,l.componentWillUnmount()}catch(y){Ke(r,t,y)}Fr(e,t,r);break;case 21:Fr(e,t,r);break;case 22:r.mode&1?(ft=(l=ft)||r.memoizedState!==null,Fr(e,t,r),ft=l):Fr(e,t,r);break;default:Fr(e,t,r)}}function Lf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Vg),t.forEach(function(l){var a=tx.bind(null,e,l);r.has(l)||(r.add(l),l.then(a,a))})}}function qt(e,t){var r=t.deletions;if(r!==null)for(var l=0;la&&(a=p),l&=~c}if(l=a,l=qe()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Qg(l/1960))-l,10e?16:e,$r===null)var l=!1;else{if(e=$r,$r=null,$l=0,(Te&6)!==0)throw Error(i(331));var a=Te;for(Te|=4,ae=e.current;ae!==null;){var c=ae,p=c.child;if((ae.flags&16)!==0){var y=c.deletions;if(y!==null){for(var N=0;Nqe()-Ja?vn(e,0):Ya|=r),wt(e,t)}function Zf(e,t){t===0&&((e.mode&1)===0?t=1:(t=Yo,Yo<<=1,(Yo&130023424)===0&&(Yo=4194304)));var r=mt();e=gr(e,t),e!==null&&(Vs(e,t,r),wt(e,r))}function ex(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Zf(e,r)}function tx(e,t){var r=0;switch(e.tag){case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(i(314))}l!==null&&l.delete(t),Zf(e,r)}var Yf;Yf=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||xt.current)vt=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return vt=!1,Bg(e,t,r);vt=(e.flags&131072)!==0}else vt=!1,We&&(t.flags&1048576)!==0&&_d(t,vl,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Tl(e,t),e=t.pendingProps;var a=ts(t,ut.current);is(t,r),a=_a(null,t,l,e,a,r);var c=Ma();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,yt(l)?(c=!0,gl(t)):c=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ja(t),a.updater=Ol,t.stateNode=a,a._reactInternals=t,za(t,l,e,r),t=Ua(null,t,l,!0,c,r)):(t.tag=0,We&&c&&fa(t),ht(null,t,a,r),t=t.child),t;case 16:l=t.elementType;e:{switch(Tl(e,t),e=t.pendingProps,a=l._init,l=a(l._payload),t.type=l,a=t.tag=nx(l),e=Kt(l,e),a){case 0:t=Fa(null,t,l,e,r);break e;case 1:t=kf(null,t,l,e,r);break e;case 11:t=yf(null,t,l,e,r);break e;case 14:t=vf(null,t,l,Kt(l.type,e),r);break e}throw Error(i(306,l,""))}return t;case 0:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),Fa(e,t,l,a,r);case 1:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),kf(e,t,l,a,r);case 3:e:{if(Nf(t),e===null)throw Error(i(387));l=t.pendingProps,c=t.memoizedState,a=c.element,Id(e,t),Sl(t,l,null,r);var p=t.memoizedState;if(l=p.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){a=us(Error(i(423)),t),t=Sf(e,t,l,r,a);break e}else if(l!==a){a=us(Error(i(424)),t),t=Sf(e,t,l,r,a);break e}else for(Rt=Dr(t.stateNode.containerInfo.firstChild),Mt=t,We=!0,Gt=null,r=zd(t,null,l,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ss(),l===a){t=yr(e,t,r);break e}ht(e,t,l,r)}t=t.child}return t;case 5:return $d(t),e===null&&ma(t),l=t.type,a=t.pendingProps,c=e!==null?e.memoizedProps:null,p=a.children,la(l,a)?p=null:c!==null&&la(l,c)&&(t.flags|=32),jf(e,t),ht(e,t,p,r),t.child;case 6:return e===null&&ma(t),null;case 13:return Cf(e,t,r);case 4:return ka(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=os(t,null,l,r):ht(e,t,l,r),t.child;case 11:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),yf(e,t,l,a,r);case 7:return ht(e,t,t.pendingProps,r),t.child;case 8:return ht(e,t,t.pendingProps.children,r),t.child;case 12:return ht(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(l=t.type._context,a=t.pendingProps,c=t.memoizedProps,p=a.value,Ue(jl,l._currentValue),l._currentValue=p,c!==null)if(Vt(c.value,p)){if(c.children===a.children&&!xt.current){t=yr(e,t,r);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var y=c.dependencies;if(y!==null){p=c.child;for(var N=y.firstContext;N!==null;){if(N.context===l){if(c.tag===1){N=xr(-1,r&-r),N.tag=2;var I=c.updateQueue;if(I!==null){I=I.shared;var W=I.pending;W===null?N.next=N:(N.next=W.next,W.next=N),I.pending=N}}c.lanes|=r,N=c.alternate,N!==null&&(N.lanes|=r),ba(c.return,r,t),y.lanes|=r;break}N=N.next}}else if(c.tag===10)p=c.type===t.type?null:c.child;else if(c.tag===18){if(p=c.return,p===null)throw Error(i(341));p.lanes|=r,y=p.alternate,y!==null&&(y.lanes|=r),ba(p,r,t),p=c.sibling}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===t){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}ht(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,l=t.pendingProps.children,is(t,r),a=It(a),l=l(a),t.flags|=1,ht(e,t,l,r),t.child;case 14:return l=t.type,a=Kt(l,t.pendingProps),a=Kt(l.type,a),vf(e,t,l,a,r);case 15:return bf(e,t,t.type,t.pendingProps,r);case 17:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),Tl(e,t),t.tag=1,yt(l)?(e=!0,gl(t)):e=!1,is(t,r),df(t,l,a),za(t,l,a,r),Ua(null,t,l,!0,e,r);case 19:return Pf(e,t,r);case 22:return wf(e,t,r)}throw Error(i(156,t.tag))};function Jf(e,t){return Mc(e,t)}function rx(e,t,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(e,t,r,l){return new rx(e,t,r,l)}function lu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nx(e){if(typeof e=="function")return lu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===De)return 14}return 2}function Wr(e,t){var r=e.alternate;return r===null?(r=$t(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Vl(e,t,r,l,a,c){var p=2;if(l=e,typeof e=="function")lu(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case J:return wn(r.children,a,c,t);case te:p=8,a|=8;break;case re:return e=$t(12,r,t,a|2),e.elementType=re,e.lanes=c,e;case Ae:return e=$t(13,r,t,a),e.elementType=Ae,e.lanes=c,e;case Ee:return e=$t(19,r,t,a),e.elementType=Ee,e.lanes=c,e;case Pe:return Gl(r,a,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ee:p=10;break e;case ge:p=9;break e;case ue:p=11;break e;case De:p=14;break e;case Me:p=16,l=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=$t(p,r,t,a),t.elementType=e,t.type=l,t.lanes=c,t}function wn(e,t,r,l){return e=$t(7,e,l,t),e.lanes=r,e}function Gl(e,t,r,l){return e=$t(22,e,l,t),e.elementType=Pe,e.lanes=r,e.stateNode={isHidden:!1},e}function iu(e,t,r){return e=$t(6,e,null,t),e.lanes=r,e}function au(e,t,r){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sx(e,t,r,l,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ai(0),this.expirationTimes=Ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ai(0),this.identifierPrefix=l,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function uu(e,t,r,l,a,c,p,y,N){return e=new sx(e,t,r,y,N),t===1?(t=1,c===!0&&(t|=8)):t=0,c=$t(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:l,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},ja(c),e}function ox(e,t,r){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),gu.exports=xx(),gu.exports}var pp;function yx(){if(pp)return ei;pp=1;var s=uh();return ei.createRoot=s.createRoot,ei.hydrateRoot=s.hydrateRoot,ei}var vx=yx();const bx=ih(vx);var Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Sn,Zr,js,Yp,wx=(Yp=class extends Ho{constructor(){super();be(this,Sn);be(this,Zr);be(this,js);oe(this,js,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){S(this,Zr)||this.setEventListener(S(this,js))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,Zr))==null||o.call(this),oe(this,Zr,void 0))}setEventListener(o){var i;oe(this,js,o),(i=S(this,Zr))==null||i.call(this),oe(this,Zr,o(u=>{typeof u=="boolean"?this.setFocused(u):this.onFocus()}))}setFocused(o){S(this,Sn)!==o&&(oe(this,Sn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(i=>{i(o)})}isFocused(){var o;return typeof S(this,Sn)=="boolean"?S(this,Sn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},Sn=new WeakMap,Zr=new WeakMap,js=new WeakMap,Yp),lc=new wx,jx={setTimeout:(s,o)=>setTimeout(s,o),clearTimeout:s=>clearTimeout(s),setInterval:(s,o)=>setInterval(s,o),clearInterval:s=>clearInterval(s)},Yr,nc,Jp,kx=(Jp=class{constructor(){be(this,Yr,jx);be(this,nc,!1)}setTimeoutProvider(s){oe(this,Yr,s)}setTimeout(s,o){return S(this,Yr).setTimeout(s,o)}clearTimeout(s){S(this,Yr).clearTimeout(s)}setInterval(s,o){return S(this,Yr).setInterval(s,o)}clearInterval(s){S(this,Yr).clearInterval(s)}},Yr=new WeakMap,nc=new WeakMap,Jp),Nn=new kx;function Nx(s){setTimeout(s,0)}var Sx=typeof window>"u"||"Deno"in globalThis;function Nt(){}function Cx(s,o){return typeof s=="function"?s(o):s}function Ru(s){return typeof s=="number"&&s>=0&&s!==1/0}function ch(s,o){return Math.max(s+(o||0)-Date.now(),0)}function sn(s,o){return typeof s=="function"?s(o):s}function Tt(s,o){return typeof s=="function"?s(o):s}function hp(s,o){const{type:i="all",exact:u,fetchStatus:d,predicate:f,queryKey:g,stale:h}=s;if(g){if(u){if(o.queryHash!==ic(g,o.options))return!1}else if(!Mo(o.queryKey,g))return!1}if(i!=="all"){const v=o.isActive();if(i==="active"&&!v||i==="inactive"&&v)return!1}return!(typeof h=="boolean"&&o.isStale()!==h||d&&d!==o.state.fetchStatus||f&&!f(o))}function mp(s,o){const{exact:i,status:u,predicate:d,mutationKey:f}=s;if(f){if(!o.options.mutationKey)return!1;if(i){if(_o(o.options.mutationKey)!==_o(f))return!1}else if(!Mo(o.options.mutationKey,f))return!1}return!(u&&o.state.status!==u||d&&!d(o))}function ic(s,o){return((o==null?void 0:o.queryKeyHashFn)||_o)(s)}function _o(s){return JSON.stringify(s,(o,i)=>Du(i)?Object.keys(i).sort().reduce((u,d)=>(u[d]=i[d],u),{}):i)}function Mo(s,o){return s===o?!0:typeof s!=typeof o?!1:s&&o&&typeof s=="object"&&typeof o=="object"?Object.keys(o).every(i=>Mo(s[i],o[i])):!1}var Ex=Object.prototype.hasOwnProperty;function dh(s,o,i=0){if(s===o)return s;if(i>500)return o;const u=gp(s)&&gp(o);if(!u&&!(Du(s)&&Du(o)))return o;const f=(u?s:Object.keys(s)).length,g=u?o:Object.keys(o),h=g.length,v=u?new Array(h):{};let x=0;for(let b=0;b{Nn.setTimeout(o,s)})}function Tu(s,o,i){return typeof i.structuralSharing=="function"?i.structuralSharing(s,o):i.structuralSharing!==!1?dh(s,o):o}function _x(s,o,i=0){const u=[...s,o];return i&&u.length>i?u.slice(1):u}function Mx(s,o,i=0){const u=[o,...s];return i&&u.length>i?u.slice(0,-1):u}var ac=Symbol();function fh(s,o){return!s.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!s.queryFn||s.queryFn===ac?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function ph(s,o){return typeof s=="function"?s(...o):!!s}function Rx(s,o,i){let u=!1,d;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(d??(d=o()),u||(u=!0,d.aborted?i():d.addEventListener("abort",i,{once:!0})),d)}),s}var Ro=(()=>{let s=()=>Sx;return{isServer(){return s()},setIsServer(o){s=o}}})();function Au(){let s,o;const i=new Promise((d,f)=>{s=d,o=f});i.status="pending",i.catch(()=>{});function u(d){Object.assign(i,d),delete i.resolve,delete i.reject}return i.resolve=d=>{u({status:"fulfilled",value:d}),s(d)},i.reject=d=>{u({status:"rejected",reason:d}),o(d)},i}var Ox=Nx;function Dx(){let s=[],o=0,i=h=>{h()},u=h=>{h()},d=Ox;const f=h=>{o?s.push(h):d(()=>{i(h)})},g=()=>{const h=s;s=[],h.length&&d(()=>{u(()=>{h.forEach(v=>{i(v)})})})};return{batch:h=>{let v;o++;try{v=h()}finally{o--,o||g()}return v},batchCalls:h=>(...v)=>{f(()=>{h(...v)})},schedule:f,setNotifyFunction:h=>{i=h},setBatchNotifyFunction:h=>{u=h},setScheduler:h=>{d=h}}}var lt=Dx(),ks,Jr,Ns,Xp,Tx=(Xp=class extends Ho{constructor(){super();be(this,ks,!0);be(this,Jr);be(this,Ns);oe(this,Ns,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o(!0),u=()=>o(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",u,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",u)}}})}onSubscribe(){S(this,Jr)||this.setEventListener(S(this,Ns))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,Jr))==null||o.call(this),oe(this,Jr,void 0))}setEventListener(o){var i;oe(this,Ns,o),(i=S(this,Jr))==null||i.call(this),oe(this,Jr,o(this.setOnline.bind(this)))}setOnline(o){S(this,ks)!==o&&(oe(this,ks,o),this.listeners.forEach(u=>{u(o)}))}isOnline(){return S(this,ks)}},ks=new WeakMap,Jr=new WeakMap,Ns=new WeakMap,Xp),hi=new Tx;function Ax(s){return Math.min(1e3*2**s,3e4)}function hh(s){return(s??"online")==="online"?hi.isOnline():!0}var zu=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function mh(s){let o=!1,i=0,u;const d=Au(),f=()=>d.status!=="pending",g=w=>{var C;if(!f()){const _=new zu(w);M(_),(C=s.onCancel)==null||C.call(s,_)}},h=()=>{o=!0},v=()=>{o=!1},x=()=>lc.isFocused()&&(s.networkMode==="always"||hi.isOnline())&&s.canRun(),b=()=>hh(s.networkMode)&&s.canRun(),j=w=>{f()||(u==null||u(),d.resolve(w))},M=w=>{f()||(u==null||u(),d.reject(w))},O=()=>new Promise(w=>{var C;u=_=>{(f()||x())&&w(_)},(C=s.onPause)==null||C.call(s)}).then(()=>{var w;u=void 0,f()||(w=s.onContinue)==null||w.call(s)}),A=()=>{if(f())return;let w;const C=i===0?s.initialPromise:void 0;try{w=C??s.fn()}catch(_){w=Promise.reject(_)}Promise.resolve(w).then(j).catch(_=>{var B;if(f())return;const $=s.retry??(Ro.isServer()?0:3),V=s.retryDelay??Ax,z=typeof V=="function"?V(i,_):V,L=$===!0||typeof $=="number"&&i<$||typeof $=="function"&&$(i,_);if(o||!L){M(_);return}i++,(B=s.onFail)==null||B.call(s,i,_),Px(z).then(()=>x()?void 0:O()).then(()=>{o?M(_):A()})})};return{promise:d,status:()=>d.status,cancel:g,continue:()=>(u==null||u(),d),cancelRetry:h,continueRetry:v,canStart:b,start:()=>(b()?A():O().then(A),d)}}var Cn,eh,gh=(eh=class{constructor(){be(this,Cn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ru(this.gcTime)&&oe(this,Cn,Nn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Ro.isServer()?1/0:300*1e3))}clearGcTimeout(){S(this,Cn)!==void 0&&(Nn.clearTimeout(S(this,Cn)),oe(this,Cn,void 0))}},Cn=new WeakMap,eh);function zx(s){return{onFetch:(o,i)=>{var b,j,M,O,A;const u=o.options,d=(M=(j=(b=o.fetchOptions)==null?void 0:b.meta)==null?void 0:j.fetchMore)==null?void 0:M.direction,f=((O=o.state.data)==null?void 0:O.pages)||[],g=((A=o.state.data)==null?void 0:A.pageParams)||[];let h={pages:[],pageParams:[]},v=0;const x=async()=>{let w=!1;const C=V=>{Rx(V,()=>o.signal,()=>w=!0)},_=fh(o.options,o.fetchOptions),$=async(V,z,L)=>{if(w)return Promise.reject(o.signal.reason);if(z==null&&V.pages.length)return Promise.resolve(V);const J=(()=>{const ge={client:o.client,queryKey:o.queryKey,pageParam:z,direction:L?"backward":"forward",meta:o.options.meta};return C(ge),ge})(),te=await _(J),{maxPages:re}=o.options,ee=L?Mx:_x;return{pages:ee(V.pages,te,re),pageParams:ee(V.pageParams,z,re)}};if(d&&f.length){const V=d==="backward",z=V?Lx:yp,L={pages:f,pageParams:g},B=z(u,L);h=await $(L,B,V)}else{const V=s??f.length;do{const z=v===0?g[0]??u.initialPageParam:yp(u,h);if(v>0&&z==null)break;h=await $(h,z),v++}while(v{var w,C;return(C=(w=o.options).persister)==null?void 0:C.call(w,x,{client:o.client,queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},i)}:o.fetchFn=x}}}function yp(s,{pages:o,pageParams:i}){const u=o.length-1;return o.length>0?s.getNextPageParam(o[u],o,i[u],i):void 0}function Lx(s,{pages:o,pageParams:i}){var u;return o.length>0?(u=s.getPreviousPageParam)==null?void 0:u.call(s,o[0],o,i[0],i):void 0}var Ss,En,Cs,Bt,Pn,nt,Io,_n,Dt,xh,wr,th,Ix=(th=class extends gh{constructor(o){super();be(this,Dt);be(this,Ss);be(this,En);be(this,Cs);be(this,Bt);be(this,Pn);be(this,nt);be(this,Io);be(this,_n);oe(this,_n,!1),oe(this,Io,o.defaultOptions),this.setOptions(o.options),this.observers=[],oe(this,Pn,o.client),oe(this,Bt,S(this,Pn).getQueryCache()),this.queryKey=o.queryKey,this.queryHash=o.queryHash,oe(this,En,bp(this.options)),this.state=o.state??S(this,En),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return S(this,Ss)}get promise(){var o;return(o=S(this,nt))==null?void 0:o.promise}setOptions(o){if(this.options={...S(this,Io),...o},o!=null&&o._type&&oe(this,Ss,o._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=bp(this.options);i.data!==void 0&&(this.setState(vp(i.data,i.dataUpdatedAt)),oe(this,En,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,Bt).remove(this)}setData(o,i){const u=Tu(this.state.data,o,this.options);return _e(this,Dt,wr).call(this,{data:u,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),u}setState(o){_e(this,Dt,wr).call(this,{type:"setState",state:o})}cancel(o){var u,d;const i=(u=S(this,nt))==null?void 0:u.promise;return(d=S(this,nt))==null||d.cancel(o),i?i.then(Nt).catch(Nt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return S(this,En)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(o=>Tt(o.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ac||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(o=>sn(o.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(o=>o.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(o=0){return this.state.data===void 0?!0:o==="static"?!1:this.state.isInvalidated?!0:!ch(this.state.dataUpdatedAt,o)}onFocus(){var i;const o=this.observers.find(u=>u.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,nt))==null||i.continue()}onOnline(){var i;const o=this.observers.find(u=>u.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,nt))==null||i.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),S(this,Bt).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(i=>i!==o),this.observers.length||(S(this,nt)&&(S(this,_n)||_e(this,Dt,xh).call(this)?S(this,nt).cancel({revert:!0}):S(this,nt).cancelRetry()),this.scheduleGc()),S(this,Bt).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Dt,wr).call(this,{type:"invalidate"})}async fetch(o,i){var x,b,j,M,O,A,w,C,_,$,V;if(this.state.fetchStatus!=="idle"&&((x=S(this,nt))==null?void 0:x.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(S(this,nt))return S(this,nt).continueRetry(),S(this,nt).promise}if(o&&this.setOptions(o),!this.options.queryFn){const z=this.observers.find(L=>L.options.queryFn);z&&this.setOptions(z.options)}const u=new AbortController,d=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(oe(this,_n,!0),u.signal)})},f=()=>{const z=fh(this.options,i),B=(()=>{const J={client:S(this,Pn),queryKey:this.queryKey,meta:this.meta};return d(J),J})();return oe(this,_n,!1),this.options.persister?this.options.persister(z,B,this):z(B)},h=(()=>{const z={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:S(this,Pn),state:this.state,fetchFn:f};return d(z),z})(),v=S(this,Ss)==="infinite"?zx(this.options.pages):this.options.behavior;v==null||v.onFetch(h,this),oe(this,Cs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=h.fetchOptions)==null?void 0:b.meta))&&_e(this,Dt,wr).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta}),oe(this,nt,mh({initialPromise:i==null?void 0:i.initialPromise,fn:h.fetchFn,onCancel:z=>{z instanceof zu&&z.revert&&this.setState({...S(this,Cs),fetchStatus:"idle"}),u.abort()},onFail:(z,L)=>{_e(this,Dt,wr).call(this,{type:"failed",failureCount:z,error:L})},onPause:()=>{_e(this,Dt,wr).call(this,{type:"pause"})},onContinue:()=>{_e(this,Dt,wr).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const z=await S(this,nt).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(O=(M=S(this,Bt).config).onSuccess)==null||O.call(M,z,this),(w=(A=S(this,Bt).config).onSettled)==null||w.call(A,z,this.state.error,this),z}catch(z){if(z instanceof zu){if(z.silent)return S(this,nt).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw _e(this,Dt,wr).call(this,{type:"error",error:z}),(_=(C=S(this,Bt).config).onError)==null||_.call(C,z,this),(V=($=S(this,Bt).config).onSettled)==null||V.call($,this.state.data,z,this),z}finally{this.scheduleGc()}}},Ss=new WeakMap,En=new WeakMap,Cs=new WeakMap,Bt=new WeakMap,Pn=new WeakMap,nt=new WeakMap,Io=new WeakMap,_n=new WeakMap,Dt=new WeakSet,xh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},wr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...u,fetchStatus:"paused"};case"continue":return{...u,fetchStatus:"fetching"};case"fetch":return{...u,...yh(u.data,this.options),fetchMeta:o.meta??null};case"success":const d={...u,...vp(o.data,o.dataUpdatedAt),dataUpdateCount:u.dataUpdateCount+1,...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return oe(this,Cs,o.manual?d:void 0),d;case"error":const f=o.error;return{...u,error:f,errorUpdateCount:u.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:u.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...u,isInvalidated:!0};case"setState":return{...u,...o.state}}};this.state=i(this.state),lt.batch(()=>{this.observers.forEach(u=>{u.onQueryUpdate()}),S(this,Bt).notify({query:this,type:"updated",action:o})})},th);function yh(s,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hh(o.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function vp(s,o){return{data:s,dataUpdatedAt:o??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bp(s){const o=typeof s.initialData=="function"?s.initialData():s.initialData,i=o!==void 0,u=i?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:i?u??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var kt,Oe,Fo,gt,Mn,Es,jr,Xr,Uo,Ps,_s,Rn,On,en,Ms,Le,Po,Lu,Iu,Fu,Uu,$u,Bu,Hu,vh,rh,Fx=(rh=class extends Ho{constructor(o,i){super();be(this,Le);be(this,kt);be(this,Oe);be(this,Fo);be(this,gt);be(this,Mn);be(this,Es);be(this,jr);be(this,Xr);be(this,Uo);be(this,Ps);be(this,_s);be(this,Rn);be(this,On);be(this,en);be(this,Ms,new Set);this.options=i,oe(this,kt,o),oe(this,Xr,null),oe(this,jr,Au()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(S(this,Oe).addObserver(this),wp(S(this,Oe),this.options)?_e(this,Le,Po).call(this):this.updateResult(),_e(this,Le,Uu).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wu(S(this,Oe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wu(S(this,Oe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Le,$u).call(this),_e(this,Le,Bu).call(this),S(this,Oe).removeObserver(this)}setOptions(o){const i=this.options,u=S(this,Oe);if(this.options=S(this,kt).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tt(this.options.enabled,S(this,Oe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Le,Hu).call(this),S(this,Oe).setOptions(this.options),i._defaulted&&!Ou(this.options,i)&&S(this,kt).getQueryCache().notify({type:"observerOptionsUpdated",query:S(this,Oe),observer:this});const d=this.hasListeners();d&&jp(S(this,Oe),u,this.options,i)&&_e(this,Le,Po).call(this),this.updateResult(),d&&(S(this,Oe)!==u||Tt(this.options.enabled,S(this,Oe))!==Tt(i.enabled,S(this,Oe))||sn(this.options.staleTime,S(this,Oe))!==sn(i.staleTime,S(this,Oe)))&&_e(this,Le,Lu).call(this);const f=_e(this,Le,Iu).call(this);d&&(S(this,Oe)!==u||Tt(this.options.enabled,S(this,Oe))!==Tt(i.enabled,S(this,Oe))||f!==S(this,en))&&_e(this,Le,Fu).call(this,f)}getOptimisticResult(o){const i=S(this,kt).getQueryCache().build(S(this,kt),o),u=this.createResult(i,o);return $x(this,u)&&(oe(this,gt,u),oe(this,Es,this.options),oe(this,Mn,S(this,Oe).state)),u}getCurrentResult(){return S(this,gt)}trackResult(o,i){return new Proxy(o,{get:(u,d)=>(this.trackProp(d),i==null||i(d),d==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&S(this,jr).status==="pending"&&S(this,jr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(u,d))})}trackProp(o){S(this,Ms).add(o)}getCurrentQuery(){return S(this,Oe)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const i=S(this,kt).defaultQueryOptions(o),u=S(this,kt).getQueryCache().build(S(this,kt),i);return u.fetch().then(()=>this.createResult(u,i))}fetch(o){return _e(this,Le,Po).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),S(this,gt)))}createResult(o,i){var re;const u=S(this,Oe),d=this.options,f=S(this,gt),g=S(this,Mn),h=S(this,Es),x=o!==u?o.state:S(this,Fo),{state:b}=o;let j={...b},M=!1,O;if(i._optimisticResults){const ee=this.hasListeners(),ge=!ee&&wp(o,i),ue=ee&&jp(o,u,i,d);(ge||ue)&&(j={...j,...yh(b.data,o.options)}),i._optimisticResults==="isRestoring"&&(j.fetchStatus="idle")}let{error:A,errorUpdatedAt:w,status:C}=j;O=j.data;let _=!1;if(i.placeholderData!==void 0&&O===void 0&&C==="pending"){let ee;f!=null&&f.isPlaceholderData&&i.placeholderData===(h==null?void 0:h.placeholderData)?(ee=f.data,_=!0):ee=typeof i.placeholderData=="function"?i.placeholderData((re=S(this,_s))==null?void 0:re.state.data,S(this,_s)):i.placeholderData,ee!==void 0&&(C="success",O=Tu(f==null?void 0:f.data,ee,i),M=!0)}if(i.select&&O!==void 0&&!_)if(f&&O===(g==null?void 0:g.data)&&i.select===S(this,Uo))O=S(this,Ps);else try{oe(this,Uo,i.select),O=i.select(O),O=Tu(f==null?void 0:f.data,O,i),oe(this,Ps,O),oe(this,Xr,null)}catch(ee){oe(this,Xr,ee)}S(this,Xr)&&(A=S(this,Xr),O=S(this,Ps),w=Date.now(),C="error");const $=j.fetchStatus==="fetching",V=C==="pending",z=C==="error",L=V&&$,B=O!==void 0,te={status:C,fetchStatus:j.fetchStatus,isPending:V,isSuccess:C==="success",isError:z,isInitialLoading:L,isLoading:L,data:O,dataUpdatedAt:j.dataUpdatedAt,error:A,errorUpdatedAt:w,failureCount:j.fetchFailureCount,failureReason:j.fetchFailureReason,errorUpdateCount:j.errorUpdateCount,isFetched:o.isFetched(),isFetchedAfterMount:j.dataUpdateCount>x.dataUpdateCount||j.errorUpdateCount>x.errorUpdateCount,isFetching:$,isRefetching:$&&!V,isLoadingError:z&&!B,isPaused:j.fetchStatus==="paused",isPlaceholderData:M,isRefetchError:z&&B,isStale:uc(o,i),refetch:this.refetch,promise:S(this,jr),isEnabled:Tt(i.enabled,o)!==!1};if(this.options.experimental_prefetchInRender){const ee=te.data!==void 0,ge=te.status==="error"&&!ee,ue=De=>{ge?De.reject(te.error):ee&&De.resolve(te.data)},Ae=()=>{const De=oe(this,jr,te.promise=Au());ue(De)},Ee=S(this,jr);switch(Ee.status){case"pending":o.queryHash===u.queryHash&&ue(Ee);break;case"fulfilled":(ge||te.data!==Ee.value)&&Ae();break;case"rejected":(!ge||te.error!==Ee.reason)&&Ae();break}}return te}updateResult(){const o=S(this,gt),i=this.createResult(S(this,Oe),this.options);if(oe(this,Mn,S(this,Oe).state),oe(this,Es,this.options),S(this,Mn).data!==void 0&&oe(this,_s,S(this,Oe)),Ou(i,o))return;oe(this,gt,i);const u=()=>{if(!o)return!0;const{notifyOnChangeProps:d}=this.options,f=typeof d=="function"?d():d;if(f==="all"||!f&&!S(this,Ms).size)return!0;const g=new Set(f??S(this,Ms));return this.options.throwOnError&&g.add("error"),Object.keys(S(this,gt)).some(h=>{const v=h;return S(this,gt)[v]!==o[v]&&g.has(v)})};_e(this,Le,vh).call(this,{listeners:u()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Le,Uu).call(this)}},kt=new WeakMap,Oe=new WeakMap,Fo=new WeakMap,gt=new WeakMap,Mn=new WeakMap,Es=new WeakMap,jr=new WeakMap,Xr=new WeakMap,Uo=new WeakMap,Ps=new WeakMap,_s=new WeakMap,Rn=new WeakMap,On=new WeakMap,en=new WeakMap,Ms=new WeakMap,Le=new WeakSet,Po=function(o){_e(this,Le,Hu).call(this);let i=S(this,Oe).fetch(this.options,o);return o!=null&&o.throwOnError||(i=i.catch(Nt)),i},Lu=function(){_e(this,Le,$u).call(this);const o=sn(this.options.staleTime,S(this,Oe));if(Ro.isServer()||S(this,gt).isStale||!Ru(o))return;const u=ch(S(this,gt).dataUpdatedAt,o)+1;oe(this,Rn,Nn.setTimeout(()=>{S(this,gt).isStale||this.updateResult()},u))},Iu=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(S(this,Oe)):this.options.refetchInterval)??!1},Fu=function(o){_e(this,Le,Bu).call(this),oe(this,en,o),!(Ro.isServer()||Tt(this.options.enabled,S(this,Oe))===!1||!Ru(S(this,en))||S(this,en)===0)&&oe(this,On,Nn.setInterval(()=>{(this.options.refetchIntervalInBackground||lc.isFocused())&&_e(this,Le,Po).call(this)},S(this,en)))},Uu=function(){_e(this,Le,Lu).call(this),_e(this,Le,Fu).call(this,_e(this,Le,Iu).call(this))},$u=function(){S(this,Rn)!==void 0&&(Nn.clearTimeout(S(this,Rn)),oe(this,Rn,void 0))},Bu=function(){S(this,On)!==void 0&&(Nn.clearInterval(S(this,On)),oe(this,On,void 0))},Hu=function(){const o=S(this,kt).getQueryCache().build(S(this,kt),this.options);if(o===S(this,Oe))return;const i=S(this,Oe);oe(this,Oe,o),oe(this,Fo,o.state),this.hasListeners()&&(i==null||i.removeObserver(this),o.addObserver(this))},vh=function(o){lt.batch(()=>{o.listeners&&this.listeners.forEach(i=>{i(S(this,gt))}),S(this,kt).getQueryCache().notify({query:S(this,Oe),type:"observerResultsUpdated"})})},rh);function Ux(s,o){return Tt(o.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&Tt(o.retryOnMount,s)===!1)}function wp(s,o){return Ux(s,o)||s.state.data!==void 0&&Wu(s,o,o.refetchOnMount)}function Wu(s,o,i){if(Tt(o.enabled,s)!==!1&&sn(o.staleTime,s)!=="static"){const u=typeof i=="function"?i(s):i;return u==="always"||u!==!1&&uc(s,o)}return!1}function jp(s,o,i,u){return(s!==o||Tt(u.enabled,s)===!1)&&(!i.suspense||s.state.status!=="error")&&uc(s,i)}function uc(s,o){return Tt(o.enabled,s)!==!1&&s.isStaleByTime(sn(o.staleTime,s))}function $x(s,o){return!Ou(s.getCurrentResult(),o)}var $o,or,pt,Dn,lr,Qr,nh,Bx=(nh=class extends gh{constructor(o){super();be(this,lr);be(this,$o);be(this,or);be(this,pt);be(this,Dn);oe(this,$o,o.client),this.mutationId=o.mutationId,oe(this,pt,o.mutationCache),oe(this,or,[]),this.state=o.state||Hx(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){S(this,or).includes(o)||(S(this,or).push(o),this.clearGcTimeout(),S(this,pt).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){oe(this,or,S(this,or).filter(i=>i!==o)),this.scheduleGc(),S(this,pt).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){S(this,or).length||(this.state.status==="pending"?this.scheduleGc():S(this,pt).remove(this))}continue(){var o;return((o=S(this,Dn))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var g,h,v,x,b,j,M,O,A,w,C,_,$,V,z,L,B,J;const i=()=>{_e(this,lr,Qr).call(this,{type:"continue"})},u={client:S(this,$o),meta:this.options.meta,mutationKey:this.options.mutationKey};oe(this,Dn,mh({fn:()=>this.options.mutationFn?this.options.mutationFn(o,u):Promise.reject(new Error("No mutationFn found")),onFail:(te,re)=>{_e(this,lr,Qr).call(this,{type:"failed",failureCount:te,error:re})},onPause:()=>{_e(this,lr,Qr).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,pt).canRun(this)}));const d=this.state.status==="pending",f=!S(this,Dn).canStart();try{if(d)i();else{_e(this,lr,Qr).call(this,{type:"pending",variables:o,isPaused:f}),S(this,pt).config.onMutate&&await S(this,pt).config.onMutate(o,this,u);const re=await((h=(g=this.options).onMutate)==null?void 0:h.call(g,o,u));re!==this.state.context&&_e(this,lr,Qr).call(this,{type:"pending",context:re,variables:o,isPaused:f})}const te=await S(this,Dn).start();return await((x=(v=S(this,pt).config).onSuccess)==null?void 0:x.call(v,te,o,this.state.context,this,u)),await((j=(b=this.options).onSuccess)==null?void 0:j.call(b,te,o,this.state.context,u)),await((O=(M=S(this,pt).config).onSettled)==null?void 0:O.call(M,te,null,this.state.variables,this.state.context,this,u)),await((w=(A=this.options).onSettled)==null?void 0:w.call(A,te,null,o,this.state.context,u)),_e(this,lr,Qr).call(this,{type:"success",data:te}),te}catch(te){try{await((_=(C=S(this,pt).config).onError)==null?void 0:_.call(C,te,o,this.state.context,this,u))}catch(re){Promise.reject(re)}try{await((V=($=this.options).onError)==null?void 0:V.call($,te,o,this.state.context,u))}catch(re){Promise.reject(re)}try{await((L=(z=S(this,pt).config).onSettled)==null?void 0:L.call(z,void 0,te,this.state.variables,this.state.context,this,u))}catch(re){Promise.reject(re)}try{await((J=(B=this.options).onSettled)==null?void 0:J.call(B,void 0,te,o,this.state.context,u))}catch(re){Promise.reject(re)}throw _e(this,lr,Qr).call(this,{type:"error",error:te}),te}finally{S(this,pt).runNext(this)}}},$o=new WeakMap,or=new WeakMap,pt=new WeakMap,Dn=new WeakMap,lr=new WeakSet,Qr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...u,isPaused:!0};case"continue":return{...u,isPaused:!1};case"pending":return{...u,context:o.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:o.isPaused,status:"pending",variables:o.variables,submittedAt:Date.now()};case"success":return{...u,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...u,data:void 0,error:o.error,failureCount:u.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=i(this.state),lt.batch(()=>{S(this,or).forEach(u=>{u.onMutationUpdate(o)}),S(this,pt).notify({mutation:this,type:"updated",action:o})})},nh);function Hx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var kr,Yt,Bo,sh,Wx=(sh=class extends Ho{constructor(o={}){super();be(this,kr);be(this,Yt);be(this,Bo);this.config=o,oe(this,kr,new Set),oe(this,Yt,new Map),oe(this,Bo,0)}build(o,i,u){const d=new Bx({client:o,mutationCache:this,mutationId:++Xl(this,Bo)._,options:o.defaultMutationOptions(i),state:u});return this.add(d),d}add(o){S(this,kr).add(o);const i=ti(o);if(typeof i=="string"){const u=S(this,Yt).get(i);u?u.push(o):S(this,Yt).set(i,[o])}this.notify({type:"added",mutation:o})}remove(o){if(S(this,kr).delete(o)){const i=ti(o);if(typeof i=="string"){const u=S(this,Yt).get(i);if(u)if(u.length>1){const d=u.indexOf(o);d!==-1&&u.splice(d,1)}else u[0]===o&&S(this,Yt).delete(i)}}this.notify({type:"removed",mutation:o})}canRun(o){const i=ti(o);if(typeof i=="string"){const u=S(this,Yt).get(i),d=u==null?void 0:u.find(f=>f.state.status==="pending");return!d||d===o}else return!0}runNext(o){var u;const i=ti(o);if(typeof i=="string"){const d=(u=S(this,Yt).get(i))==null?void 0:u.find(f=>f!==o&&f.state.isPaused);return(d==null?void 0:d.continue())??Promise.resolve()}else return Promise.resolve()}clear(){lt.batch(()=>{S(this,kr).forEach(o=>{this.notify({type:"removed",mutation:o})}),S(this,kr).clear(),S(this,Yt).clear()})}getAll(){return Array.from(S(this,kr))}find(o){const i={exact:!0,...o};return this.getAll().find(u=>mp(i,u))}findAll(o={}){return this.getAll().filter(i=>mp(o,i))}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}resumePausedMutations(){const o=this.getAll().filter(i=>i.state.isPaused);return lt.batch(()=>Promise.all(o.map(i=>i.continue().catch(Nt))))}},kr=new WeakMap,Yt=new WeakMap,Bo=new WeakMap,sh);function ti(s){var o;return(o=s.options.scope)==null?void 0:o.id}var ir,oh,Vx=(oh=class extends Ho{constructor(o={}){super();be(this,ir);this.config=o,oe(this,ir,new Map)}build(o,i,u){const d=i.queryKey,f=i.queryHash??ic(d,i);let g=this.get(f);return g||(g=new Ix({client:o,queryKey:d,queryHash:f,options:o.defaultQueryOptions(i),state:u,defaultOptions:o.getQueryDefaults(d)}),this.add(g)),g}add(o){S(this,ir).has(o.queryHash)||(S(this,ir).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const i=S(this,ir).get(o.queryHash);i&&(o.destroy(),i===o&&S(this,ir).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){lt.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return S(this,ir).get(o)}getAll(){return[...S(this,ir).values()]}find(o){const i={exact:!0,...o};return this.getAll().find(u=>hp(i,u))}findAll(o={}){const i=this.getAll();return Object.keys(o).length>0?i.filter(u=>hp(o,u)):i}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}onFocus(){lt.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){lt.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},ir=new WeakMap,oh),Qe,tn,rn,Rs,Os,nn,Ds,Ts,lh,Gx=(lh=class{constructor(s={}){be(this,Qe);be(this,tn);be(this,rn);be(this,Rs);be(this,Os);be(this,nn);be(this,Ds);be(this,Ts);oe(this,Qe,s.queryCache||new Vx),oe(this,tn,s.mutationCache||new Wx),oe(this,rn,s.defaultOptions||{}),oe(this,Rs,new Map),oe(this,Os,new Map),oe(this,nn,0)}mount(){Xl(this,nn)._++,S(this,nn)===1&&(oe(this,Ds,lc.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Qe).onFocus())})),oe(this,Ts,hi.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Qe).onOnline())})))}unmount(){var s,o;Xl(this,nn)._--,S(this,nn)===0&&((s=S(this,Ds))==null||s.call(this),oe(this,Ds,void 0),(o=S(this,Ts))==null||o.call(this),oe(this,Ts,void 0))}isFetching(s){return S(this,Qe).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return S(this,tn).findAll({...s,status:"pending"}).length}getQueryData(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Qe).get(o.queryHash))==null?void 0:i.state.data}ensureQueryData(s){const o=this.defaultQueryOptions(s),i=S(this,Qe).build(this,o),u=i.state.data;return u===void 0?this.fetchQuery(s):(s.revalidateIfStale&&i.isStaleByTime(sn(o.staleTime,i))&&this.prefetchQuery(o),Promise.resolve(u))}getQueriesData(s){return S(this,Qe).findAll(s).map(({queryKey:o,state:i})=>{const u=i.data;return[o,u]})}setQueryData(s,o,i){const u=this.defaultQueryOptions({queryKey:s}),d=S(this,Qe).get(u.queryHash),f=d==null?void 0:d.state.data,g=Cx(o,f);if(g!==void 0)return S(this,Qe).build(this,u).setData(g,{...i,manual:!0})}setQueriesData(s,o,i){return lt.batch(()=>S(this,Qe).findAll(s).map(({queryKey:u})=>[u,this.setQueryData(u,o,i)]))}getQueryState(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Qe).get(o.queryHash))==null?void 0:i.state}removeQueries(s){const o=S(this,Qe);lt.batch(()=>{o.findAll(s).forEach(i=>{o.remove(i)})})}resetQueries(s,o){const i=S(this,Qe);return lt.batch(()=>(i.findAll(s).forEach(u=>{u.reset()}),this.refetchQueries({type:"active",...s},o)))}cancelQueries(s,o={}){const i={revert:!0,...o},u=lt.batch(()=>S(this,Qe).findAll(s).map(d=>d.cancel(i)));return Promise.all(u).then(Nt).catch(Nt)}invalidateQueries(s,o={}){return lt.batch(()=>(S(this,Qe).findAll(s).forEach(i=>{i.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},o)))}refetchQueries(s,o={}){const i={...o,cancelRefetch:o.cancelRefetch??!0},u=lt.batch(()=>S(this,Qe).findAll(s).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let f=d.fetch(void 0,i);return i.throwOnError||(f=f.catch(Nt)),d.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(u).then(Nt)}fetchQuery(s){const o=this.defaultQueryOptions(s);o.retry===void 0&&(o.retry=!1);const i=S(this,Qe).build(this,o);return i.isStaleByTime(sn(o.staleTime,i))?i.fetch(o):Promise.resolve(i.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(Nt).catch(Nt)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(Nt).catch(Nt)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return hi.isOnline()?S(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,Qe)}getMutationCache(){return S(this,tn)}getDefaultOptions(){return S(this,rn)}setDefaultOptions(s){oe(this,rn,s)}setQueryDefaults(s,o){S(this,Rs).set(_o(s),{queryKey:s,defaultOptions:o})}getQueryDefaults(s){const o=[...S(this,Rs).values()],i={};return o.forEach(u=>{Mo(s,u.queryKey)&&Object.assign(i,u.defaultOptions)}),i}setMutationDefaults(s,o){S(this,Os).set(_o(s),{mutationKey:s,defaultOptions:o})}getMutationDefaults(s){const o=[...S(this,Os).values()],i={};return o.forEach(u=>{Mo(s,u.mutationKey)&&Object.assign(i,u.defaultOptions)}),i}defaultQueryOptions(s){if(s._defaulted)return s;const o={...S(this,rn).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return o.queryHash||(o.queryHash=ic(o.queryKey,o)),o.refetchOnReconnect===void 0&&(o.refetchOnReconnect=o.networkMode!=="always"),o.throwOnError===void 0&&(o.throwOnError=!!o.suspense),!o.networkMode&&o.persister&&(o.networkMode="offlineFirst"),o.queryFn===ac&&(o.enabled=!1),o}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...S(this,rn).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){S(this,Qe).clear(),S(this,tn).clear()}},Qe=new WeakMap,tn=new WeakMap,rn=new WeakMap,Rs=new WeakMap,Os=new WeakMap,nn=new WeakMap,Ds=new WeakMap,Ts=new WeakMap,lh),bh=m.createContext(void 0),cc=s=>{const o=m.useContext(bh);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},Kx=({client:s,children:o})=>(m.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),n.jsx(bh.Provider,{value:s,children:o})),wh=m.createContext(!1),Qx=()=>m.useContext(wh);wh.Provider;function qx(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Zx=m.createContext(qx()),Yx=()=>m.useContext(Zx),Jx=(s,o,i)=>{const u=i!=null&&i.state.error&&typeof s.throwOnError=="function"?ph(s.throwOnError,[i.state.error,i]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||u)&&(o.isReset()||(s.retryOnMount=!1))},Xx=s=>{m.useEffect(()=>{s.clearReset()},[s])},e0=({result:s,errorResetBoundary:o,throwOnError:i,query:u,suspense:d})=>s.isError&&!o.isReset()&&!s.isFetching&&u&&(d&&s.data===void 0||ph(i,[s.error,u])),t0=s=>{if(s.suspense){const i=d=>d==="static"?d:Math.max(d??1e3,1e3),u=s.staleTime;s.staleTime=typeof u=="function"?(...d)=>i(u(...d)):i(u),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},r0=(s,o)=>s.isLoading&&s.isFetching&&!o,n0=(s,o)=>(s==null?void 0:s.suspense)&&o.isPending,kp=(s,o,i)=>o.fetchOptimistic(s).catch(()=>{i.clearReset()});function s0(s,o,i){var O,A,w,C;const u=Qx(),d=Yx(),f=cc(),g=f.defaultQueryOptions(s);(A=(O=f.getDefaultOptions().queries)==null?void 0:O._experimental_beforeQuery)==null||A.call(O,g);const h=f.getQueryCache().get(g.queryHash),v=s.subscribed!==!1;g._optimisticResults=u?"isRestoring":v?"optimistic":void 0,t0(g),Jx(g,d,h),Xx(d);const x=!f.getQueryCache().get(g.queryHash),[b]=m.useState(()=>new o(f,g)),j=b.getOptimisticResult(g),M=!u&&v;if(m.useSyncExternalStore(m.useCallback(_=>{const $=M?b.subscribe(lt.batchCalls(_)):Nt;return b.updateResult(),$},[b,M]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),m.useEffect(()=>{b.setOptions(g)},[g,b]),n0(g,j))throw kp(g,b,d);if(e0({result:j,errorResetBoundary:d,throwOnError:g.throwOnError,query:h,suspense:g.suspense}))throw j.error;if((C=(w=f.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||C.call(w,g,j),g.experimental_prefetchInRender&&!Ro.isServer()&&r0(j,u)){const _=x?kp(g,b,d):h==null?void 0:h.promise;_==null||_.catch(Nt).finally(()=>{b.updateResult()})}return g.notifyOnChangeProps?j:b.trackResult(j)}function Fn(s,o){return s0(s,Fx)}/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o0=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jh=(...s)=>s.filter((o,i,u)=>!!o&&o.trim()!==""&&u.indexOf(o)===i).join(" ").trim();/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var l0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i0=m.forwardRef(({color:s="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:g,...h},v)=>m.createElement("svg",{ref:v,...l0,width:o,height:o,stroke:s,strokeWidth:u?Number(i)*24/Number(o):i,className:jh("lucide",d),...h},[...g.map(([x,b])=>m.createElement(x,b)),...Array.isArray(f)?f:[f]]));/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const je=(s,o)=>{const i=m.forwardRef(({className:u,...d},f)=>m.createElement(i0,{ref:f,iconNode:o,className:jh(`lucide-${o0(s)}`,u),...d}));return i.displayName=`${s}`,i};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mi=je("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Np=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kh=je("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Oo=je("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. - * See the LICENSE file in the root directory of this source tree. - */const a0=je("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Do=je("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. - * See the LICENSE file in the root directory of this source tree. - */const As=je("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u0=je("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c0=je("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d0=je("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f0=je("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p0=je("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h0=je("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vu=je("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m0=je("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g0=je("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gu=je("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const x0=je("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nh=je("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const At=je("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const An=je("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gi=je("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. - * See the LICENSE file in the root directory of this source tree. - */const Sp=je("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ku=je("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y0=je("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v0=je("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qu=je("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const b0=je("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w0=je("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const To=je("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. - * See the LICENSE file in the root directory of this source tree. - */const j0=je("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const k0=je("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const N0=je("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sh=je("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ch=je("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tn=je("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S0=je("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const C0=je("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dc=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const E0=je("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const P0=je("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zn=je("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _0=je("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Eh=je("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const M0=je("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xi=je("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. - * See the LICENSE file in the root directory of this source tree. - */const qu=je("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const R0=je("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O0=je("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yi=je("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. - * See the LICENSE file in the root directory of this source tree. - */const Ln=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Zu=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:j0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:a0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:At},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Do},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:N0},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Oo},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:p0}];var Cp=1,D0=.9,T0=.8,A0=.17,vu=.1,bu=.999,z0=.9999,L0=.99,I0=/[\\\/_+.#"@\[\(\{&]/,F0=/[\\\/_+.#"@\[\(\{&]/g,U0=/[\s-]/,Ph=/[\s-]/g;function Yu(s,o,i,u,d,f,g){if(f===o.length)return d===s.length?Cp:L0;var h=`${d},${f}`;if(g[h]!==void 0)return g[h];for(var v=u.charAt(f),x=i.indexOf(v,d),b=0,j,M,O,A;x>=0;)j=Yu(s,o,i,u,x+1,f+1,g),j>b&&(x===d?j*=Cp:I0.test(s.charAt(x-1))?(j*=T0,O=s.slice(d,x-1).match(F0),O&&d>0&&(j*=Math.pow(bu,O.length))):U0.test(s.charAt(x-1))?(j*=D0,A=s.slice(d,x-1).match(Ph),A&&d>0&&(j*=Math.pow(bu,A.length))):(j*=A0,d>0&&(j*=Math.pow(bu,x-d))),s.charAt(x)!==o.charAt(f)&&(j*=z0)),(jj&&(j=M*vu)),j>b&&(b=j),x=i.indexOf(v,x+1);return g[h]=b,b}function Ep(s){return s.toLowerCase().replace(Ph," ")}function $0(s,o,i){return s=i&&i.length>0?`${s+" "+i.join(" ")}`:s,Yu(s,o,Ep(s),Ep(o),0,0,{})}function on(s,o,{checkForDefaultPrevented:i=!0}={}){return function(d){if(s==null||s(d),i===!1||!d.defaultPrevented)return o==null?void 0:o(d)}}function Pp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function zs(...s){return o=>{let i=!1;const u=s.map(d=>{const f=Pp(d,o);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let d=0;d{var _;const{scope:M,children:O,...A}=j,w=((_=M==null?void 0:M[s])==null?void 0:_[v])||h,C=m.useMemo(()=>A,Object.values(A));return n.jsx(w.Provider,{value:C,children:O})};x.displayName=f+"Provider";function b(j,M){var w;const O=((w=M==null?void 0:M[s])==null?void 0:w[v])||h,A=m.useContext(O);if(A)return A;if(g!==void 0)return g;throw new Error(`\`${j}\` must be used within \`${f}\``)}return[x,b]}const d=()=>{const f=i.map(g=>m.createContext(g));return function(h){const v=(h==null?void 0:h[s])||f;return m.useMemo(()=>({[`__scope${s}`]:{...h,[s]:v}}),[h,v])}};return d.scopeName=s,[u,H0(d,...o)]}function H0(...s){const o=s[0];if(s.length===1)return o;const i=()=>{const u=s.map(d=>({useScope:d(),scopeName:d.scopeName}));return function(f){const g=u.reduce((h,{useScope:v,scopeName:x})=>{const j=v(f)[`__scope${x}`];return{...h,...j}},{});return m.useMemo(()=>({[`__scope${o.scopeName}`]:g}),[g])}};return i.scopeName=o.scopeName,i}var Ao=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},W0=oc[" useId ".trim().toString()]||(()=>{}),V0=0;function Nr(s){const[o,i]=m.useState(W0());return Ao(()=>{i(u=>u??String(V0++))},[s]),o?`radix-${o}`:""}var G0=oc[" useInsertionEffect ".trim().toString()]||Ao;function K0({prop:s,defaultProp:o,onChange:i=()=>{},caller:u}){const[d,f,g]=Q0({defaultProp:o,onChange:i}),h=s!==void 0,v=h?s:d;{const b=m.useRef(s!==void 0);m.useEffect(()=>{const j=b.current;j!==h&&console.warn(`${u} is changing from ${j?"controlled":"uncontrolled"} to ${h?"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=h},[h,u])}const x=m.useCallback(b=>{var j;if(h){const M=q0(b)?b(s):b;M!==s&&((j=g.current)==null||j.call(g,M))}else f(b)},[h,s,f,g]);return[v,x]}function Q0({defaultProp:s,onChange:o}){const[i,u]=m.useState(s),d=m.useRef(i),f=m.useRef(o);return G0(()=>{f.current=o},[o]),m.useEffect(()=>{var g;d.current!==i&&((g=f.current)==null||g.call(f,i),d.current=i)},[i,d]),[i,u,f]}function q0(s){return typeof s=="function"}var _h=uh();function Mh(s){const o=m.forwardRef((i,u)=>{let{children:d,...f}=i,g=null,h=!1;const v=[];_p(d)&&typeof ri=="function"&&(d=ri(d._payload)),m.Children.forEach(d,M=>{var O;if(ey(M)){h=!0;const A=M;let w="child"in A.props?A.props.child:A.props.children;_p(w)&&typeof ri=="function"&&(w=ri(w._payload)),g=Y0(A,w),v.push((O=g==null?void 0:g.props)==null?void 0:O.children)}else v.push(M)}),g?g=m.cloneElement(g,void 0,v):!h&&m.Children.count(d)===1&&m.isValidElement(d)&&(g=d);const x=g?X0(g):void 0,b=Un(u,x);if(!g){if(d||d===0)throw new Error(h?sy(s):ny(s));return d}const j=J0(f,g.props??{});return g.type!==m.Fragment&&(j.ref=u?b:x),m.cloneElement(g,j)});return o.displayName=`${s}.Slot`,o}var Z0=Symbol.for("radix.slottable"),Y0=(s,o)=>{if("child"in s.props){const i=s.props.child;return m.isValidElement(i)?m.cloneElement(i,void 0,s.props.children(i.props.children)):null}return m.isValidElement(o)?o:null};function J0(s,o){const i={...o};for(const u in o){const d=s[u],f=o[u];/^on[A-Z]/.test(u)?d&&f?i[u]=(...h)=>{const v=f(...h);return d(...h),v}:d&&(i[u]=d):u==="style"?i[u]={...d,...f}:u==="className"&&(i[u]=[d,f].filter(Boolean).join(" "))}return{...s,...i}}function X0(s){var u,d;let o=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,i=o&&"isReactWarning"in o&&o.isReactWarning;return i?s.ref:(o=(d=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:d.get,i=o&&"isReactWarning"in o&&o.isReactWarning,i?s.props.ref:s.props.ref||s.ref)}function ey(s){return m.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===Z0}var ty=Symbol.for("react.lazy");function _p(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===ty&&"_payload"in s&&ry(s._payload)}function ry(s){return typeof s=="object"&&s!==null&&"then"in s}var ny=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,sy=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ri=oc[" use ".trim().toString()],oy=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],it=oy.reduce((s,o)=>{const i=Mh(`Primitive.${o}`),u=m.forwardRef((d,f)=>{const{asChild:g,...h}=d,v=g?i:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(v,{...h,ref:f})});return u.displayName=`Primitive.${o}`,{...s,[o]:u}},{});function ly(s,o){s&&_h.flushSync(()=>s.dispatchEvent(o))}function zo(s){const o=m.useRef(s);return m.useEffect(()=>{o.current=s}),m.useMemo(()=>((...i)=>{var u;return(u=o.current)==null?void 0:u.call(o,...i)}),[])}function iy(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s);m.useEffect(()=>{const u=d=>{d.key==="Escape"&&i(d)};return o.addEventListener("keydown",u,{capture:!0}),()=>o.removeEventListener("keydown",u,{capture:!0})},[i,o])}var ay="DismissableLayer",Ju="dismissableLayer.update",uy="dismissableLayer.pointerDownOutside",cy="dismissableLayer.focusOutside",Mp,fc=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Rh=m.forwardRef((s,o)=>{const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:u=!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:h,onDismiss:v,...x}=s,b=m.useContext(fc),[j,M]=m.useState(null),O=(j==null?void 0:j.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,A]=m.useState({}),w=Un(o,re=>M(re)),C=Array.from(b.layers),[_]=[...b.layersWithOutsidePointerEventsDisabled].slice(-1),$=C.indexOf(_),V=j?C.indexOf(j):-1,z=b.layersWithOutsidePointerEventsDisabled.size>0,L=V>=$,B=m.useRef(!1),J=hy(re=>{const ee=re.target;if(!(ee instanceof Node))return;const ge=[...b.branches].some(ue=>ue.contains(ee));!L||ge||(f==null||f(re),h==null||h(re),re.defaultPrevented||v==null||v())},{ownerDocument:O,deferPointerDownOutside:u,isDeferredPointerDownOutsideRef:B,dismissableSurfaces:b.dismissableSurfaces}),te=my(re=>{if(u&&B.current)return;const ee=re.target;[...b.branches].some(ue=>ue.contains(ee))||(g==null||g(re),h==null||h(re),re.defaultPrevented||v==null||v())},O);return iy(re=>{V===b.layers.size-1&&(d==null||d(re),!re.defaultPrevented&&v&&(re.preventDefault(),v()))},O),m.useEffect(()=>{if(j)return i&&(b.layersWithOutsidePointerEventsDisabled.size===0&&(Mp=O.body.style.pointerEvents,O.body.style.pointerEvents="none"),b.layersWithOutsidePointerEventsDisabled.add(j)),b.layers.add(j),Rp(),()=>{i&&(b.layersWithOutsidePointerEventsDisabled.delete(j),b.layersWithOutsidePointerEventsDisabled.size===0&&(O.body.style.pointerEvents=Mp))}},[j,O,i,b]),m.useEffect(()=>()=>{j&&(b.layers.delete(j),b.layersWithOutsidePointerEventsDisabled.delete(j),Rp())},[j,b]),m.useEffect(()=>{const re=()=>A({});return document.addEventListener(Ju,re),()=>document.removeEventListener(Ju,re)},[]),n.jsx(it.div,{...x,ref:w,style:{pointerEvents:z?L?"auto":"none":void 0,...s.style},onFocusCapture:on(s.onFocusCapture,te.onFocusCapture),onBlurCapture:on(s.onBlurCapture,te.onBlurCapture),onPointerDownCapture:on(s.onPointerDownCapture,J.onPointerDownCapture)})});Rh.displayName=ay;var dy="DismissableLayerBranch",fy=m.forwardRef((s,o)=>{const i=m.useContext(fc),u=m.useRef(null),d=Un(o,u);return m.useEffect(()=>{const f=u.current;if(f)return i.branches.add(f),()=>{i.branches.delete(f)}},[i.branches]),n.jsx(it.div,{...s,ref:d})});fy.displayName=dy;function py(){const s=m.useContext(fc),[o,i]=m.useState(null);return m.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),i}function hy(s,o){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:u=!1,isDeferredPointerDownOutsideRef:d,dismissableSurfaces:f}=o,g=zo(s),h=m.useRef(!1),v=m.useRef(!1),x=m.useRef(new Map),b=m.useRef(()=>{});return m.useEffect(()=>{function j(){v.current=!1,d.current=!1,x.current.clear()}function M(){return Array.from(x.current.values()).some(Boolean)}function O($){if(!v.current)return;const V=$.target;V instanceof Node&&[...f].some(L=>L.contains(V))||x.current.set($.type,!0),$.type==="click"&&window.setTimeout(()=>{v.current&&b.current()},0)}function A($){v.current&&x.current.set($.type,!1)}const w=$=>{if($.target&&!h.current){let V=function(){i.removeEventListener("click",b.current);const L=M();j(),L||Oh(uy,g,z,{discrete:!0})};const z={originalEvent:$};v.current=!0,d.current=u&&$.button===0,x.current.clear(),!u||$.button!==0?V():(i.removeEventListener("click",b.current),b.current=V,i.addEventListener("click",b.current,{once:!0}))}else i.removeEventListener("click",b.current),j();h.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const $ of C)i.addEventListener($,O,!0),i.addEventListener($,A);const _=window.setTimeout(()=>{i.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(_),i.removeEventListener("pointerdown",w),i.removeEventListener("click",b.current);for(const $ of C)i.removeEventListener($,O,!0),i.removeEventListener($,A)}},[i,g,u,d,f]),{onPointerDownCapture:()=>h.current=!0}}function my(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s),u=m.useRef(!1);return m.useEffect(()=>{const d=f=>{f.target&&!u.current&&Oh(cy,i,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",d),()=>o.removeEventListener("focusin",d)},[o,i]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function Rp(){const s=new CustomEvent(Ju);document.dispatchEvent(s)}function Oh(s,o,i,{discrete:u}){const d=i.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:i});o&&d.addEventListener(s,o,{once:!0}),u?ly(d,f):d.dispatchEvent(f)}var wu="focusScope.autoFocusOnMount",ju="focusScope.autoFocusOnUnmount",Op={bubbles:!1,cancelable:!0},gy="FocusScope",Dh=m.forwardRef((s,o)=>{const{loop:i=!1,trapped:u=!1,onMountAutoFocus:d,onUnmountAutoFocus:f,...g}=s,[h,v]=m.useState(null),x=zo(d),b=zo(f),j=m.useRef(null),M=Un(o,w=>v(w)),O=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(u){let w=function(V){if(O.paused||!h)return;const z=V.target;h.contains(z)?j.current=z:qr(j.current,{select:!0})},C=function(V){if(O.paused||!h)return;const z=V.relatedTarget;z!==null&&(h.contains(z)||qr(j.current,{select:!0}))},_=function(V){if(document.activeElement===document.body)for(const L of V)L.removedNodes.length>0&&qr(h)};document.addEventListener("focusin",w),document.addEventListener("focusout",C);const $=new MutationObserver(_);return h&&$.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",C),$.disconnect()}}},[u,h,O.paused]),m.useEffect(()=>{if(h){Tp.add(O);const w=document.activeElement;if(!h.contains(w)){const _=new CustomEvent(wu,Op);h.addEventListener(wu,x),h.dispatchEvent(_),_.defaultPrevented||(xy(jy(Th(h)),{select:!0}),document.activeElement===w&&qr(h))}return()=>{h.removeEventListener(wu,x),setTimeout(()=>{const _=new CustomEvent(ju,Op);h.addEventListener(ju,b),h.dispatchEvent(_),_.defaultPrevented||qr(w??document.body,{select:!0}),h.removeEventListener(ju,b),Tp.remove(O)},0)}}},[h,x,b,O]);const A=m.useCallback(w=>{if(!i&&!u||O.paused)return;const C=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,_=document.activeElement;if(C&&_){const $=w.currentTarget,[V,z]=yy($);V&&z?!w.shiftKey&&_===z?(w.preventDefault(),i&&qr(V,{select:!0})):w.shiftKey&&_===V&&(w.preventDefault(),i&&qr(z,{select:!0})):_===$&&w.preventDefault()}},[i,u,O.paused]);return n.jsx(it.div,{tabIndex:-1,...g,ref:M,onKeyDown:A})});Dh.displayName=gy;function xy(s,{select:o=!1}={}){const i=document.activeElement;for(const u of s)if(qr(u,{select:o}),document.activeElement!==i)return}function yy(s){const o=Th(s),i=Dp(o,s),u=Dp(o.reverse(),s);return[i,u]}function Th(s){const o=[],i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:u=>{const d=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||d?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)o.push(i.currentNode);return o}function Dp(s,o){for(const i of s)if(!vy(i,{upTo:o}))return i}function vy(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 by(s){return s instanceof HTMLInputElement&&"select"in s}function qr(s,{select:o=!1}={}){if(s&&s.focus){const i=document.activeElement;s.focus({preventScroll:!0}),s!==i&&by(s)&&o&&s.select()}}var Tp=wy();function wy(){let s=[];return{add(o){const i=s[0];o!==i&&(i==null||i.pause()),s=Ap(s,o),s.unshift(o)},remove(o){var i;s=Ap(s,o),(i=s[0])==null||i.resume()}}}function Ap(s,o){const i=[...s],u=i.indexOf(o);return u!==-1&&i.splice(u,1),i}function jy(s){return s.filter(o=>o.tagName!=="A")}var ky="Portal",Ah=m.forwardRef((s,o)=>{var h;const{container:i,...u}=s,[d,f]=m.useState(!1);Ao(()=>f(!0),[]);const g=i||d&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return g?_h.createPortal(n.jsx(it.div,{...u,ref:o}),g):null});Ah.displayName=ky;function Ny(s,o){return m.useReducer((i,u)=>o[i][u]??i,s)}var bi=s=>{const{present:o,children:i}=s,u=Sy(o),d=typeof i=="function"?i({present:u.isPresent}):m.Children.only(i),f=Cy(u.ref,Ey(d));return typeof i=="function"||u.isPresent?m.cloneElement(d,{ref:f}):null};bi.displayName="Presence";function Sy(s){const[o,i]=m.useState(),u=m.useRef(null),d=m.useRef(s),f=m.useRef("none"),g=s?"mounted":"unmounted",[h,v]=Ny(g,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const x=ni(u.current);f.current=h==="mounted"?x:"none"},[h]),Ao(()=>{const x=u.current,b=d.current;if(b!==s){const M=f.current,O=ni(x);s?v("MOUNT"):O==="none"||(x==null?void 0:x.display)==="none"?v("UNMOUNT"):v(b&&M!==O?"ANIMATION_OUT":"UNMOUNT"),d.current=s}},[s,v]),Ao(()=>{if(o){let x;const b=o.ownerDocument.defaultView??window,j=O=>{const w=ni(u.current).includes(CSS.escape(O.animationName));if(O.target===o&&w&&(v("ANIMATION_END"),!d.current)){const C=o.style.animationFillMode;o.style.animationFillMode="forwards",x=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=C)})}},M=O=>{O.target===o&&(f.current=ni(u.current))};return o.addEventListener("animationstart",M),o.addEventListener("animationcancel",j),o.addEventListener("animationend",j),()=>{b.clearTimeout(x),o.removeEventListener("animationstart",M),o.removeEventListener("animationcancel",j),o.removeEventListener("animationend",j)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:m.useCallback(x=>{u.current=x?getComputedStyle(x):null,i(x)},[])}}function zp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Cy(...s){const o=m.useRef(s);return o.current=s,m.useCallback(i=>{const u=o.current;let d=!1;const f=u.map(g=>{const h=zp(g,i);return!d&&typeof h=="function"&&(d=!0),h});if(d)return()=>{for(let g=0;g{sr||(sr={start:Lp(),end:Lp()});const{start:s,end:o}=sr;return document.body.firstElementChild!==s&&document.body.insertAdjacentElement("afterbegin",s),document.body.lastElementChild!==o&&document.body.insertAdjacentElement("beforeend",o),si++,()=>{si===1&&(sr==null||sr.start.remove(),sr==null||sr.end.remove(),sr=null),si=Math.max(0,si-1)}},[])}function Lp(){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 ar=function(){return ar=Object.assign||function(o){for(var i,u=1,d=arguments.length;u"u")return Vy;var o=Gy(s),i=document.documentElement.clientWidth,u=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,u-i+o[2]-o[0])}},Qy=Fh(),bs="data-scroll-locked",qy=function(s,o,i,u){var d=s.left,f=s.top,g=s.right,h=s.gap;return i===void 0&&(i="margin"),` - .`.concat(My,` { - overflow: hidden `).concat(u,`; - padding-right: `).concat(h,"px ").concat(u,`; - } - body[`).concat(bs,`] { - overflow: hidden `).concat(u,`; - overscroll-behavior: contain; - `).concat([o&&"position: relative ".concat(u,";"),i==="margin"&&` - padding-left: `.concat(d,`px; - padding-top: `).concat(f,`px; - padding-right: `).concat(g,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(h,"px ").concat(u,`; - `),i==="padding"&&"padding-right: ".concat(h,"px ").concat(u,";")].filter(Boolean).join(""),` - } - - .`).concat(fi,` { - right: `).concat(h,"px ").concat(u,`; - } - - .`).concat(pi,` { - margin-right: `).concat(h,"px ").concat(u,`; - } - - .`).concat(fi," .").concat(fi,` { - right: 0 `).concat(u,`; - } - - .`).concat(pi," .").concat(pi,` { - margin-right: 0 `).concat(u,`; - } - - body[`).concat(bs,`] { - `).concat(Ry,": ").concat(h,`px; - } -`)},Fp=function(){var s=parseInt(document.body.getAttribute(bs)||"0",10);return isFinite(s)?s:0},Zy=function(){m.useEffect(function(){return document.body.setAttribute(bs,(Fp()+1).toString()),function(){var s=Fp()-1;s<=0?document.body.removeAttribute(bs):document.body.setAttribute(bs,s.toString())}},[])},Yy=function(s){var o=s.noRelative,i=s.noImportant,u=s.gapMode,d=u===void 0?"margin":u;Zy();var f=m.useMemo(function(){return Ky(d)},[d]);return m.createElement(Qy,{styles:qy(f,!o,d,i?"":"!important")})},Xu=!1;if(typeof window<"u")try{var oi=Object.defineProperty({},"passive",{get:function(){return Xu=!0,!0}});window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{Xu=!1}var hs=Xu?{passive:!1}:!1,Jy=function(s){return s.tagName==="TEXTAREA"},Uh=function(s,o){if(!(s instanceof Element))return!1;var i=window.getComputedStyle(s);return i[o]!=="hidden"&&!(i.overflowY===i.overflowX&&!Jy(s)&&i[o]==="visible")},Xy=function(s){return Uh(s,"overflowY")},ev=function(s){return Uh(s,"overflowX")},Up=function(s,o){var i=o.ownerDocument,u=o;do{typeof ShadowRoot<"u"&&u instanceof ShadowRoot&&(u=u.host);var d=$h(s,u);if(d){var f=Bh(s,u),g=f[1],h=f[2];if(g>h)return!0}u=u.parentNode}while(u&&u!==i.body);return!1},tv=function(s){var o=s.scrollTop,i=s.scrollHeight,u=s.clientHeight;return[o,i,u]},rv=function(s){var o=s.scrollLeft,i=s.scrollWidth,u=s.clientWidth;return[o,i,u]},$h=function(s,o){return s==="v"?Xy(o):ev(o)},Bh=function(s,o){return s==="v"?tv(o):rv(o)},nv=function(s,o){return s==="h"&&o==="rtl"?-1:1},sv=function(s,o,i,u,d){var f=nv(s,window.getComputedStyle(o).direction),g=f*u,h=i.target,v=o.contains(h),x=!1,b=g>0,j=0,M=0;do{if(!h)break;var O=Bh(s,h),A=O[0],w=O[1],C=O[2],_=w-C-f*A;(A||_)&&$h(s,h)&&(j+=_,M+=A);var $=h.parentNode;h=$&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE?$.host:$}while(!v&&h!==document.body||v&&(o.contains(h)||o===h));return(b&&Math.abs(j)<1||!b&&Math.abs(M)<1)&&(x=!0),x},li=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},$p=function(s){return[s.deltaX,s.deltaY]},Bp=function(s){return s&&"current"in s?s.current:s},ov=function(s,o){return s[0]===o[0]&&s[1]===o[1]},lv=function(s){return` - .block-interactivity-`.concat(s,` {pointer-events: none;} - .allow-interactivity-`).concat(s,` {pointer-events: all;} -`)},iv=0,ms=[];function av(s){var o=m.useRef([]),i=m.useRef([0,0]),u=m.useRef(),d=m.useState(iv++)[0],f=m.useState(Fh)[0],g=m.useRef(s);m.useEffect(function(){g.current=s},[s]),m.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(d));var w=_y([s.lockRef.current],(s.shards||[]).map(Bp),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(d))}),function(){document.body.classList.remove("block-interactivity-".concat(d)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(d))})}}},[s.inert,s.lockRef.current,s.shards]);var h=m.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!g.current.allowPinchZoom;var _=li(w),$=i.current,V="deltaX"in w?w.deltaX:$[0]-_[0],z="deltaY"in w?w.deltaY:$[1]-_[1],L,B=w.target,J=Math.abs(V)>Math.abs(z)?"h":"v";if("touches"in w&&J==="h"&&B.type==="range")return!1;var te=window.getSelection(),re=te&&te.anchorNode,ee=re?re===B||re.contains(B):!1;if(ee)return!1;var ge=Up(J,B);if(!ge)return!0;if(ge?L=J:(L=J==="v"?"h":"v",ge=Up(J,B)),!ge)return!1;if(!u.current&&"changedTouches"in w&&(V||z)&&(u.current=L),!L)return!0;var ue=u.current||L;return sv(ue,C,w,ue==="h"?V:z)},[]),v=m.useCallback(function(w){var C=w;if(!(!ms.length||ms[ms.length-1]!==f)){var _="deltaY"in C?$p(C):li(C),$=o.current.filter(function(L){return L.name===C.type&&(L.target===C.target||C.target===L.shadowParent)&&ov(L.delta,_)})[0];if($&&$.should){C.cancelable&&C.preventDefault();return}if(!$){var V=(g.current.shards||[]).map(Bp).filter(Boolean).filter(function(L){return L.contains(C.target)}),z=V.length>0?h(C,V[0]):!g.current.noIsolation;z&&C.cancelable&&C.preventDefault()}}},[]),x=m.useCallback(function(w,C,_,$){var V={name:w,delta:C,target:_,should:$,shadowParent:uv(_)};o.current.push(V),setTimeout(function(){o.current=o.current.filter(function(z){return z!==V})},1)},[]),b=m.useCallback(function(w){i.current=li(w),u.current=void 0},[]),j=m.useCallback(function(w){x(w.type,$p(w),w.target,h(w,s.lockRef.current))},[]),M=m.useCallback(function(w){x(w.type,li(w),w.target,h(w,s.lockRef.current))},[]);m.useEffect(function(){return ms.push(f),s.setCallbacks({onScrollCapture:j,onWheelCapture:j,onTouchMoveCapture:M}),document.addEventListener("wheel",v,hs),document.addEventListener("touchmove",v,hs),document.addEventListener("touchstart",b,hs),function(){ms=ms.filter(function(w){return w!==f}),document.removeEventListener("wheel",v,hs),document.removeEventListener("touchmove",v,hs),document.removeEventListener("touchstart",b,hs)}},[]);var O=s.removeScrollBar,A=s.inert;return m.createElement(m.Fragment,null,A?m.createElement(f,{styles:lv(d)}):null,O?m.createElement(Yy,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function uv(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const cv=Iy(Ih,av);var Hh=m.forwardRef(function(s,o){return m.createElement(wi,ar({},s,{ref:o,sideCar:cv}))});Hh.classNames=wi.classNames;var dv=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},gs=new WeakMap,ii=new WeakMap,ai={},Cu=0,Wh=function(s){return s&&(s.host||Wh(s.parentNode))},fv=function(s,o){return o.map(function(i){if(s.contains(i))return i;var u=Wh(i);return u&&s.contains(u)?u:(console.error("aria-hidden",i,"in not contained inside",s,". Doing nothing"),null)}).filter(function(i){return!!i})},pv=function(s,o,i,u){var d=fv(o,Array.isArray(s)?s:[s]);ai[i]||(ai[i]=new WeakMap);var f=ai[i],g=[],h=new Set,v=new Set(d),x=function(j){!j||h.has(j)||(h.add(j),x(j.parentNode))};d.forEach(x);var b=function(j){!j||v.has(j)||Array.prototype.forEach.call(j.children,function(M){if(h.has(M))b(M);else try{var O=M.getAttribute(u),A=O!==null&&O!=="false",w=(gs.get(M)||0)+1,C=(f.get(M)||0)+1;gs.set(M,w),f.set(M,C),g.push(M),w===1&&A&&ii.set(M,!0),C===1&&M.setAttribute(i,"true"),A||M.setAttribute(u,"true")}catch(_){console.error("aria-hidden: cannot operate on ",M,_)}})};return b(o),h.clear(),Cu++,function(){g.forEach(function(j){var M=gs.get(j)-1,O=f.get(j)-1;gs.set(j,M),f.set(j,O),M||(ii.has(j)||j.removeAttribute(u),ii.delete(j)),O||j.removeAttribute(i)}),Cu--,Cu||(gs=new WeakMap,gs=new WeakMap,ii=new WeakMap,ai={})}},hv=function(s,o,i){i===void 0&&(i="data-aria-hidden");var u=Array.from(Array.isArray(s)?s:[s]),d=dv(s);return d?(u.push.apply(u,Array.from(d.querySelectorAll("[aria-live], script"))),pv(u,d,i,"aria-hidden")):function(){return null}},ji="Dialog",[Vh]=B0(ji),[mv,Jt]=Vh(ji),Gh=s=>{const{__scopeDialog:o,children:i,open:u,defaultOpen:d,onOpenChange:f,modal:g=!0}=s,h=m.useRef(null),v=m.useRef(null),[x,b]=K0({prop:u,defaultProp:d??!1,onChange:f,caller:ji});return n.jsx(mv,{scope:o,triggerRef:h,contentRef:v,contentId:Nr(),titleId:Nr(),descriptionId:Nr(),open:x,onOpenChange:b,onOpenToggle:m.useCallback(()=>b(j=>!j),[b]),modal:g,children:i})};Gh.displayName=ji;var Kh="DialogTrigger",gv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(Kh,i),f=Un(o,d.triggerRef);return n.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":hc(d.open),...u,ref:f,onClick:on(s.onClick,d.onOpenToggle)})});gv.displayName=Kh;var pc="DialogPortal",[xv,Qh]=Vh(pc,{forceMount:void 0}),qh=s=>{const{__scopeDialog:o,forceMount:i,children:u,container:d}=s,f=Jt(pc,o);return n.jsx(xv,{scope:o,forceMount:i,children:m.Children.map(u,g=>n.jsx(bi,{present:i||f.open,children:n.jsx(Ah,{asChild:!0,container:d,children:g})}))})};qh.displayName=pc;var vi="DialogOverlay",Zh=m.forwardRef((s,o)=>{const i=Qh(vi,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=Jt(vi,s.__scopeDialog);return f.modal?n.jsx(bi,{present:u||f.open,children:n.jsx(vv,{...d,ref:o})}):null});Zh.displayName=vi;var yv=Mh("DialogOverlay.RemoveScroll"),vv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(vi,i),f=py(),g=Un(o,f);return n.jsx(Hh,{as:yv,allowPinchZoom:!0,shards:[d.contentRef],children:n.jsx(it.div,{"data-state":hc(d.open),...u,ref:g,style:{pointerEvents:"auto",...u.style}})})}),Ls="DialogContent",Yh=m.forwardRef((s,o)=>{const i=Qh(Ls,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=Jt(Ls,s.__scopeDialog);return n.jsx(bi,{present:u||f.open,children:f.modal?n.jsx(bv,{...d,ref:o}):n.jsx(wv,{...d,ref:o})})});Yh.displayName=Ls;var bv=m.forwardRef((s,o)=>{const i=Jt(Ls,s.__scopeDialog),u=m.useRef(null),d=Un(o,i.contentRef,u);return m.useEffect(()=>{const f=u.current;if(f)return hv(f)},[]),n.jsx(Jh,{...s,ref:d,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:on(s.onCloseAutoFocus,f=>{var g;f.preventDefault(),(g=i.triggerRef.current)==null||g.focus()}),onPointerDownOutside:on(s.onPointerDownOutside,f=>{const g=f.detail.originalEvent,h=g.button===0&&g.ctrlKey===!0;(g.button===2||h)&&f.preventDefault()}),onFocusOutside:on(s.onFocusOutside,f=>f.preventDefault())})}),wv=m.forwardRef((s,o)=>{const i=Jt(Ls,s.__scopeDialog),u=m.useRef(!1),d=m.useRef(!1);return n.jsx(Jh,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var g,h;(g=s.onCloseAutoFocus)==null||g.call(s,f),f.defaultPrevented||(u.current||(h=i.triggerRef.current)==null||h.focus(),f.preventDefault()),u.current=!1,d.current=!1},onInteractOutside:f=>{var v,x;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(u.current=!0,f.detail.originalEvent.type==="pointerdown"&&(d.current=!0));const g=f.target;((x=i.triggerRef.current)==null?void 0:x.contains(g))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&d.current&&f.preventDefault()}})}),Jh=m.forwardRef((s,o)=>{const{__scopeDialog:i,trapFocus:u,onOpenAutoFocus:d,onCloseAutoFocus:f,...g}=s,h=Jt(Ls,i);return Py(),n.jsx(n.Fragment,{children:n.jsx(Dh,{asChild:!0,loop:!0,trapped:u,onMountAutoFocus:d,onUnmountAutoFocus:f,children:n.jsx(Rh,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":hc(h.open),...g,ref:o,deferPointerDownOutside:!0,onDismiss:()=>h.onOpenChange(!1)})})})}),Xh="DialogTitle",jv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(Xh,i);return n.jsx(it.h2,{id:d.titleId,...u,ref:o})});jv.displayName=Xh;var em="DialogDescription",kv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(em,i);return n.jsx(it.p,{id:d.descriptionId,...u,ref:o})});kv.displayName=em;var tm="DialogClose",Nv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(tm,i);return n.jsx(it.button,{type:"button",...u,ref:o,onClick:on(s.onClick,()=>d.onOpenChange(!1))})});Nv.displayName=tm;function hc(s){return s?"open":"closed"}var So='[cmdk-group=""]',Eu='[cmdk-group-items=""]',Sv='[cmdk-group-heading=""]',rm='[cmdk-item=""]',Hp=`${rm}:not([aria-disabled="true"])`,ec="cmdk-item-select",ys="data-value",Cv=(s,o,i)=>$0(s,o,i),nm=m.createContext(void 0),Wo=()=>m.useContext(nm),sm=m.createContext(void 0),mc=()=>m.useContext(sm),om=m.createContext(void 0),lm=m.forwardRef((s,o)=>{let i=vs(()=>{var k,G;return{search:"",value:(G=(k=s.value)!=null?k:s.defaultValue)!=null?G:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=vs(()=>new Set),d=vs(()=>new Map),f=vs(()=>new Map),g=vs(()=>new Set),h=im(s),{label:v,children:x,value:b,onValueChange:j,filter:M,shouldFilter:O,loop:A,disablePointerSelection:w=!1,vimBindings:C=!0,..._}=s,$=Nr(),V=Nr(),z=Nr(),L=m.useRef(null),B=Lv();In(()=>{if(b!==void 0){let k=b.trim();i.current.value=k,J.emit()}},[b]),In(()=>{B(6,Ae)},[]);let J=m.useMemo(()=>({subscribe:k=>(g.current.add(k),()=>g.current.delete(k)),snapshot:()=>i.current,setState:(k,G,X)=>{var Z,ie,he,xe;if(!Object.is(i.current[k],G)){if(i.current[k]=G,k==="search")ue(),ee(),B(1,ge);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(z);U?U.focus():(Z=document.getElementById($))==null||Z.focus()}if(B(7,()=>{var U;i.current.selectedItemId=(U=Ee())==null?void 0:U.id,J.emit()}),X||B(5,Ae),((ie=h.current)==null?void 0:ie.value)!==void 0){let U=G??"";(xe=(he=h.current).onValueChange)==null||xe.call(he,U);return}}J.emit()}},emit:()=>{g.current.forEach(k=>k())}}),[]),te=m.useMemo(()=>({value:(k,G,X)=>{var Z;G!==((Z=f.current.get(k))==null?void 0:Z.value)&&(f.current.set(k,{value:G,keywords:X}),i.current.filtered.items.set(k,re(G,X)),B(2,()=>{ee(),J.emit()}))},item:(k,G)=>(u.current.add(k),G&&(d.current.has(G)?d.current.get(G).add(k):d.current.set(G,new Set([k]))),B(3,()=>{ue(),ee(),i.current.value||ge(),J.emit()}),()=>{f.current.delete(k),u.current.delete(k),i.current.filtered.items.delete(k);let X=Ee();B(4,()=>{ue(),(X==null?void 0:X.getAttribute("id"))===k&&ge(),J.emit()})}),group:k=>(d.current.has(k)||d.current.set(k,new Set),()=>{f.current.delete(k),d.current.delete(k)}),filter:()=>h.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:$,inputId:z,labelId:V,listInnerRef:L}),[]);function re(k,G){var X,Z;let ie=(Z=(X=h.current)==null?void 0:X.filter)!=null?Z:Cv;return k?ie(k,i.current.search,G):0}function ee(){if(!i.current.search||h.current.shouldFilter===!1)return;let k=i.current.filtered.items,G=[];i.current.filtered.groups.forEach(Z=>{let ie=d.current.get(Z),he=0;ie.forEach(xe=>{let U=k.get(xe);he=Math.max(U,he)}),G.push([Z,he])});let X=L.current;De().sort((Z,ie)=>{var he,xe;let U=Z.getAttribute("id"),F=ie.getAttribute("id");return((he=k.get(F))!=null?he:0)-((xe=k.get(U))!=null?xe:0)}).forEach(Z=>{let ie=Z.closest(Eu);ie?ie.appendChild(Z.parentElement===ie?Z:Z.closest(`${Eu} > *`)):X.appendChild(Z.parentElement===X?Z:Z.closest(`${Eu} > *`))}),G.sort((Z,ie)=>ie[1]-Z[1]).forEach(Z=>{var ie;let he=(ie=L.current)==null?void 0:ie.querySelector(`${So}[${ys}="${encodeURIComponent(Z[0])}"]`);he==null||he.parentElement.appendChild(he)})}function ge(){let k=De().find(X=>X.getAttribute("aria-disabled")!=="true"),G=k==null?void 0:k.getAttribute(ys);J.setState("value",G||void 0)}function ue(){var k,G,X,Z;if(!i.current.search||h.current.shouldFilter===!1){i.current.filtered.count=u.current.size;return}i.current.filtered.groups=new Set;let ie=0;for(let he of u.current){let xe=(G=(k=f.current.get(he))==null?void 0:k.value)!=null?G:"",U=(Z=(X=f.current.get(he))==null?void 0:X.keywords)!=null?Z:[],F=re(xe,U);i.current.filtered.items.set(he,F),F>0&&ie++}for(let[he,xe]of d.current)for(let U of xe)if(i.current.filtered.items.get(U)>0){i.current.filtered.groups.add(he);break}i.current.filtered.count=ie}function Ae(){var k,G,X;let Z=Ee();Z&&(((k=Z.parentElement)==null?void 0:k.firstChild)===Z&&((X=(G=Z.closest(So))==null?void 0:G.querySelector(Sv))==null||X.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function Ee(){var k;return(k=L.current)==null?void 0:k.querySelector(`${rm}[aria-selected="true"]`)}function De(){var k;return Array.from(((k=L.current)==null?void 0:k.querySelectorAll(Hp))||[])}function Me(k){let G=De()[k];G&&J.setState("value",G.getAttribute(ys))}function Pe(k){var G;let X=Ee(),Z=De(),ie=Z.findIndex(xe=>xe===X),he=Z[ie+k];(G=h.current)!=null&&G.loop&&(he=ie+k<0?Z[Z.length-1]:ie+k===Z.length?Z[0]:Z[ie+k]),he&&J.setState("value",he.getAttribute(ys))}function Q(k){let G=Ee(),X=G==null?void 0:G.closest(So),Z;for(;X&&!Z;)X=k>0?Av(X,So):zv(X,So),Z=X==null?void 0:X.querySelector(Hp);Z?J.setState("value",Z.getAttribute(ys)):Pe(k)}let ce=()=>Me(De().length-1),q=k=>{k.preventDefault(),k.metaKey?ce():k.altKey?Q(1):Pe(1)},E=k=>{k.preventDefault(),k.metaKey?Me(0):k.altKey?Q(-1):Pe(-1)};return m.createElement(it.div,{ref:o,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:k=>{var G;(G=_.onKeyDown)==null||G.call(_,k);let X=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||X))switch(k.key){case"n":case"j":{C&&k.ctrlKey&&q(k);break}case"ArrowDown":{q(k);break}case"p":case"k":{C&&k.ctrlKey&&E(k);break}case"ArrowUp":{E(k);break}case"Home":{k.preventDefault(),Me(0);break}case"End":{k.preventDefault(),ce();break}case"Enter":{k.preventDefault();let Z=Ee();if(Z){let ie=new Event(ec);Z.dispatchEvent(ie)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:te.inputId,id:te.labelId,style:Fv},v),ki(s,k=>m.createElement(sm.Provider,{value:J},m.createElement(nm.Provider,{value:te},k))))}),Ev=m.forwardRef((s,o)=>{var i,u;let d=Nr(),f=m.useRef(null),g=m.useContext(om),h=Wo(),v=im(s),x=(u=(i=v.current)==null?void 0:i.forceMount)!=null?u:g==null?void 0:g.forceMount;In(()=>{if(!x)return h.item(d,g==null?void 0:g.id)},[x]);let b=am(d,f,[s.value,s.children,f],s.keywords),j=mc(),M=ln(B=>B.value&&B.value===b.current),O=ln(B=>x||h.filter()===!1?!0:B.search?B.filtered.items.get(d)>0:!0);m.useEffect(()=>{let B=f.current;if(!(!B||s.disabled))return B.addEventListener(ec,A),()=>B.removeEventListener(ec,A)},[O,s.onSelect,s.disabled]);function A(){var B,J;w(),(J=(B=v.current).onSelect)==null||J.call(B,b.current)}function w(){j.setState("value",b.current,!0)}if(!O)return null;let{disabled:C,value:_,onSelect:$,forceMount:V,keywords:z,...L}=s;return m.createElement(it.div,{ref:zs(f,o),...L,id:d,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!M,"data-disabled":!!C,"data-selected":!!M,onPointerMove:C||h.getDisablePointerSelection()?void 0:w,onClick:C?void 0:A},s.children)}),Pv=m.forwardRef((s,o)=>{let{heading:i,children:u,forceMount:d,...f}=s,g=Nr(),h=m.useRef(null),v=m.useRef(null),x=Nr(),b=Wo(),j=ln(O=>d||b.filter()===!1?!0:O.search?O.filtered.groups.has(g):!0);In(()=>b.group(g),[]),am(g,h,[s.value,s.heading,v]);let M=m.useMemo(()=>({id:g,forceMount:d}),[d]);return m.createElement(it.div,{ref:zs(h,o),...f,"cmdk-group":"",role:"presentation",hidden:j?void 0:!0},i&&m.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:x},i),ki(s,O=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?x:void 0},m.createElement(om.Provider,{value:M},O))))}),_v=m.forwardRef((s,o)=>{let{alwaysRender:i,...u}=s,d=m.useRef(null),f=ln(g=>!g.search);return!i&&!f?null:m.createElement(it.div,{ref:zs(d,o),...u,"cmdk-separator":"",role:"separator"})}),Mv=m.forwardRef((s,o)=>{let{onValueChange:i,...u}=s,d=s.value!=null,f=mc(),g=ln(x=>x.search),h=ln(x=>x.selectedItemId),v=Wo();return m.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),m.createElement(it.input,{ref:o,...u,"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":h,id:v.inputId,type:"text",value:d?s.value:g,onChange:x=>{d||f.setState("search",x.target.value),i==null||i(x.target.value)}})}),Rv=m.forwardRef((s,o)=>{let{children:i,label:u="Suggestions",...d}=s,f=m.useRef(null),g=m.useRef(null),h=ln(x=>x.selectedItemId),v=Wo();return m.useEffect(()=>{if(g.current&&f.current){let x=g.current,b=f.current,j,M=new ResizeObserver(()=>{j=requestAnimationFrame(()=>{let O=x.offsetHeight;b.style.setProperty("--cmdk-list-height",O.toFixed(1)+"px")})});return M.observe(x),()=>{cancelAnimationFrame(j),M.unobserve(x)}}},[]),m.createElement(it.div,{ref:zs(f,o),...d,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":u,id:v.listId},ki(s,x=>m.createElement("div",{ref:zs(g,v.listInnerRef),"cmdk-list-sizer":""},x)))}),Ov=m.forwardRef((s,o)=>{let{open:i,onOpenChange:u,overlayClassName:d,contentClassName:f,container:g,...h}=s;return m.createElement(Gh,{open:i,onOpenChange:u},m.createElement(qh,{container:g},m.createElement(Zh,{"cmdk-overlay":"",className:d}),m.createElement(Yh,{"aria-label":s.label,"cmdk-dialog":"",className:f},m.createElement(lm,{ref:o,...h}))))}),Dv=m.forwardRef((s,o)=>ln(i=>i.filtered.count===0)?m.createElement(it.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Tv=m.forwardRef((s,o)=>{let{progress:i,children:u,label:d="Loading...",...f}=s;return m.createElement(it.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":d},ki(s,g=>m.createElement("div",{"aria-hidden":!0},g)))}),xs=Object.assign(lm,{List:Rv,Item:Ev,Input:Mv,Group:Pv,Separator:_v,Dialog:Ov,Empty:Dv,Loading:Tv});function Av(s,o){let i=s.nextElementSibling;for(;i;){if(i.matches(o))return i;i=i.nextElementSibling}}function zv(s,o){let i=s.previousElementSibling;for(;i;){if(i.matches(o))return i;i=i.previousElementSibling}}function im(s){let o=m.useRef(s);return In(()=>{o.current=s}),o}var In=typeof window>"u"?m.useEffect:m.useLayoutEffect;function vs(s){let o=m.useRef();return o.current===void 0&&(o.current=s()),o}function ln(s){let o=mc(),i=()=>s(o.snapshot());return m.useSyncExternalStore(o.subscribe,i,i)}function am(s,o,i,u=[]){let d=m.useRef(),f=Wo();return In(()=>{var g;let h=(()=>{var x;for(let b of i){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():d.current}})(),v=u.map(x=>x.trim());f.value(s,h,v),(g=o.current)==null||g.setAttribute(ys,h),d.current=h}),d}var Lv=()=>{let[s,o]=m.useState(),i=vs(()=>new Map);return In(()=>{i.current.forEach(u=>u()),i.current=new Map},[s]),(u,d)=>{i.current.set(u,d),o({})}};function Iv(s){let o=s.type;return typeof o=="function"?o(s.props):"render"in o?o.render(s.props):s}function ki({asChild:s,children:o},i){return s&&m.isValidElement(o)?m.cloneElement(Iv(o),{ref:o.ref},i(o.props.children)):i(o)}var Fv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Uv({onNavigate:s}){const[o,i]=m.useState(!1);return m.useEffect(()=>{const u=d=>{(d.metaKey||d.ctrlKey)&&d.key.toLowerCase()==="k"&&(d.preventDefault(),i(f=>!f))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[]),n.jsx(xs.Dialog,{open:o,onOpenChange:i,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>i(!1),children:n.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:u=>u.stopPropagation(),children:[n.jsx(xs.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"}),n.jsxs(xs.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(xs.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(xs.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Zu.map(u=>n.jsxs(xs.Item,{value:`${u.label} ${u.hint}`,onSelect:()=>{s(u.id),i(!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:[n.jsx(u.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:u.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:u.hint})]},u.id))})]})]})})}async function me(s,o){var v;const i={"Content-Type":"application/json",...o==null?void 0:o.headers},u=localStorage.getItem("mc_sudo_password"),d=localStorage.getItem("mc_hf_token");u&&(i["X-Sudo-Password"]=u);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;u&&!("sudo_password"in x)&&(x.sudo_password=u,b=!0),d&&!("hf_token"in x)&&(x.hf_token=d,b=!0),b&&(f=JSON.stringify(x))}catch{}else if(!f){const x={};u&&(x.sudo_password=u),d&&(x.hf_token=d),Object.keys(x).length>0&&(f=JSON.stringify(x))}}const h=await fetch(s,{...o,headers:i,body:f});if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return h.json()}function um(s){var o,i,u="";if(typeof s=="string"||typeof s=="number")u+=s;else if(typeof s=="object")if(Array.isArray(s)){var d=s.length;for(o=0;o{const o=Wv(s),{conflictingClassGroups:i,conflictingClassGroupModifiers:u}=s;return{getClassGroupId:g=>{const h=g.split(gc);return h[0]===""&&h.length!==1&&h.shift(),cm(h,o)||Hv(g)},getConflictingClassGroupIds:(g,h)=>{const v=i[g]||[];return h&&u[g]?[...v,...u[g]]:v}}},cm=(s,o)=>{var g;if(s.length===0)return o.classGroupId;const i=s[0],u=o.nextPart.get(i),d=u?cm(s.slice(1),u):void 0;if(d)return d;if(o.validators.length===0)return;const f=s.join(gc);return(g=o.validators.find(({validator:h})=>h(f)))==null?void 0:g.classGroupId},Wp=/^\[(.+)\]$/,Hv=s=>{if(Wp.test(s)){const o=Wp.exec(s)[1],i=o==null?void 0:o.substring(0,o.indexOf(":"));if(i)return"arbitrary.."+i}},Wv=s=>{const{theme:o,prefix:i}=s,u={nextPart:new Map,validators:[]};return Gv(Object.entries(s.classGroups),i).forEach(([f,g])=>{tc(g,u,f,o)}),u},tc=(s,o,i,u)=>{s.forEach(d=>{if(typeof d=="string"){const f=d===""?o:Vp(o,d);f.classGroupId=i;return}if(typeof d=="function"){if(Vv(d)){tc(d(u),o,i,u);return}o.validators.push({validator:d,classGroupId:i});return}Object.entries(d).forEach(([f,g])=>{tc(g,Vp(o,f),i,u)})})},Vp=(s,o)=>{let i=s;return o.split(gc).forEach(u=>{i.nextPart.has(u)||i.nextPart.set(u,{nextPart:new Map,validators:[]}),i=i.nextPart.get(u)}),i},Vv=s=>s.isThemeGetter,Gv=(s,o)=>o?s.map(([i,u])=>{const d=u.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([g,h])=>[o+g,h])):f);return[i,d]}):s,Kv=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,i=new Map,u=new Map;const d=(f,g)=>{i.set(f,g),o++,o>s&&(o=0,u=i,i=new Map)};return{get(f){let g=i.get(f);if(g!==void 0)return g;if((g=u.get(f))!==void 0)return d(f,g),g},set(f,g){i.has(f)?i.set(f,g):d(f,g)}}},dm="!",Qv=s=>{const{separator:o,experimentalParseClassName:i}=s,u=o.length===1,d=o[0],f=o.length,g=h=>{const v=[];let x=0,b=0,j;for(let C=0;Cb?j-b:void 0;return{modifiers:v,hasImportantModifier:O,baseClassName:A,maybePostfixModifierPosition:w}};return i?h=>i({className:h,parseClassName:g}):g},qv=s=>{if(s.length<=1)return s;const o=[];let i=[];return s.forEach(u=>{u[0]==="["?(o.push(...i.sort(),u),i=[]):i.push(u)}),o.push(...i.sort()),o},Zv=s=>({cache:Kv(s.cacheSize),parseClassName:Qv(s),...Bv(s)}),Yv=/\s+/,Jv=(s,o)=>{const{parseClassName:i,getClassGroupId:u,getConflictingClassGroupIds:d}=o,f=[],g=s.trim().split(Yv);let h="";for(let v=g.length-1;v>=0;v-=1){const x=g[v],{modifiers:b,hasImportantModifier:j,baseClassName:M,maybePostfixModifierPosition:O}=i(x);let A=!!O,w=u(A?M.substring(0,O):M);if(!w){if(!A){h=x+(h.length>0?" "+h:h);continue}if(w=u(M),!w){h=x+(h.length>0?" "+h:h);continue}A=!1}const C=qv(b).join(":"),_=j?C+dm:C,$=_+w;if(f.includes($))continue;f.push($);const V=d(w,A);for(let z=0;z0?" "+h:h)}return h};function Xv(){let s=0,o,i,u="";for(;s{if(typeof s=="string")return s;let o,i="";for(let u=0;uj(b),s());return i=Zv(x),u=i.cache.get,d=i.cache.set,f=h,h(v)}function h(v){const x=u(v);if(x)return x;const b=Jv(v,i);return d(v,b),b}return function(){return f(Xv.apply(null,arguments))}}const He=s=>{const o=i=>i[s]||[];return o.isThemeGetter=!0,o},pm=/^\[(?:([a-z-]+):)?(.+)\]$/i,tb=/^\d+\/\d+$/,rb=new Set(["px","full","screen"]),nb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sb=/\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$/,ob=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ib=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,br=s=>ws(s)||rb.has(s)||tb.test(s),Gr=s=>Is(s,"length",mb),ws=s=>!!s&&!Number.isNaN(Number(s)),Pu=s=>Is(s,"number",ws),Co=s=>!!s&&Number.isInteger(Number(s)),ab=s=>s.endsWith("%")&&ws(s.slice(0,-1)),Se=s=>pm.test(s),Kr=s=>nb.test(s),ub=new Set(["length","size","percentage"]),cb=s=>Is(s,ub,hm),db=s=>Is(s,"position",hm),fb=new Set(["image","url"]),pb=s=>Is(s,fb,xb),hb=s=>Is(s,"",gb),Eo=()=>!0,Is=(s,o,i)=>{const u=pm.exec(s);return u?u[1]?typeof o=="string"?u[1]===o:o.has(u[1]):i(u[2]):!1},mb=s=>sb.test(s)&&!ob.test(s),hm=()=>!1,gb=s=>lb.test(s),xb=s=>ib.test(s),yb=()=>{const s=He("colors"),o=He("spacing"),i=He("blur"),u=He("brightness"),d=He("borderColor"),f=He("borderRadius"),g=He("borderSpacing"),h=He("borderWidth"),v=He("contrast"),x=He("grayscale"),b=He("hueRotate"),j=He("invert"),M=He("gap"),O=He("gradientColorStops"),A=He("gradientColorStopPositions"),w=He("inset"),C=He("margin"),_=He("opacity"),$=He("padding"),V=He("saturate"),z=He("scale"),L=He("sepia"),B=He("skew"),J=He("space"),te=He("translate"),re=()=>["auto","contain","none"],ee=()=>["auto","hidden","clip","visible","scroll"],ge=()=>["auto",Se,o],ue=()=>[Se,o],Ae=()=>["",br,Gr],Ee=()=>["auto",ws,Se],De=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Me=()=>["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"],Q=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",Se],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>[ws,Se];return{cacheSize:500,separator:":",theme:{colors:[Eo],spacing:[br,Gr],blur:["none","",Kr,Se],brightness:E(),borderColor:[s],borderRadius:["none","","full",Kr,Se],borderSpacing:ue(),borderWidth:Ae(),contrast:E(),grayscale:ce(),hueRotate:E(),invert:ce(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[ab,Gr],inset:ge(),margin:ge(),opacity:E(),padding:ue(),saturate:E(),scale:E(),sepia:ce(),skew:E(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Se]}],container:["container"],columns:[{columns:[Kr]}],"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:[...De(),Se]}],overflow:[{overflow:ee()}],"overflow-x":[{"overflow-x":ee()}],"overflow-y":[{"overflow-y":ee()}],overscroll:[{overscroll:re()}],"overscroll-x":[{"overscroll-x":re()}],"overscroll-y":[{"overscroll-y":re()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Co,Se]}],basis:[{basis:ge()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Se]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",Co,Se]}],"grid-cols":[{"grid-cols":[Eo]}],"col-start-end":[{col:["auto",{span:["full",Co,Se]},Se]}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":[Eo]}],"row-start-end":[{row:["auto",{span:[Co,Se]},Se]}],"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",Se]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Se]}],gap:[{gap:[M]}],"gap-x":[{"gap-x":[M]}],"gap-y":[{"gap-y":[M]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[$]}],px:[{px:[$]}],py:[{py:[$]}],ps:[{ps:[$]}],pe:[{pe:[$]}],pt:[{pt:[$]}],pr:[{pr:[$]}],pb:[{pb:[$]}],pl:[{pl:[$]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[J]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[J]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Se,o]}],"min-w":[{"min-w":[Se,o,"min","max","fit"]}],"max-w":[{"max-w":[Se,o,"none","full","min","max","fit","prose",{screen:[Kr]},Kr]}],h:[{h:[Se,o,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Se,o,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Se,o,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Se,o,"auto","min","max","fit"]}],"font-size":[{text:["base",Kr,Gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pu]}],"font-family":[{font:[Eo]}],"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",Se]}],"line-clamp":[{"line-clamp":["none",ws,Pu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",br,Se]}],"list-image":[{"list-image":["none",Se]}],"list-style-type":[{list:["none","disc","decimal",Se]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[s]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Me(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",br,Gr]}],"underline-offset":[{"underline-offset":["auto",br,Se]}],"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",Se]}],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",Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...De(),db]}],"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:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"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:[h]}],"border-w-x":[{"border-x":[h]}],"border-w-y":[{"border-y":[h]}],"border-w-s":[{"border-s":[h]}],"border-w-e":[{"border-e":[h]}],"border-w-t":[{"border-t":[h]}],"border-w-r":[{"border-r":[h]}],"border-w-b":[{"border-b":[h]}],"border-w-l":[{"border-l":[h]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...Me(),"hidden"]}],"divide-x":[{"divide-x":[h]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[h]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:Me()}],"border-color":[{border:[d]}],"border-color-x":[{"border-x":[d]}],"border-color-y":[{"border-y":[d]}],"border-color-s":[{"border-s":[d]}],"border-color-e":[{"border-e":[d]}],"border-color-t":[{"border-t":[d]}],"border-color-r":[{"border-r":[d]}],"border-color-b":[{"border-b":[d]}],"border-color-l":[{"border-l":[d]}],"divide-color":[{divide:[d]}],"outline-style":[{outline:["",...Me()]}],"outline-offset":[{"outline-offset":[br,Se]}],"outline-w":[{outline:[br,Gr]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:Ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[br,Gr]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",Kr,hb]}],"shadow-color":[{shadow:[Eo]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...Pe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Pe()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[u]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",Kr,Se]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[j]}],saturate:[{saturate:[V]}],sepia:[{sepia:[L]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[u]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[j]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[V]}],"backdrop-sepia":[{"backdrop-sepia":[L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[g]}],"border-spacing-x":[{"border-spacing-x":[g]}],"border-spacing-y":[{"border-spacing-y":[g]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Se]}],duration:[{duration:E()}],ease:[{ease:["linear","in","out","in-out",Se]}],delay:[{delay:E()}],animate:[{animate:["none","spin","ping","pulse","bounce",Se]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[Co,Se]}],"translate-x":[{"translate-x":[te]}],"translate-y":[{"translate-y":[te]}],"skew-x":[{"skew-x":[B]}],"skew-y":[{"skew-y":[B]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Se]}],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",Se]}],"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",Se]}],fill:[{fill:[s,"none"]}],"stroke-w":[{stroke:[br,Gr,Pu]}],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"]}}},vb=eb(yb);function ne(...s){return vb($v(s))}function Lo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function St(s){return(s/1024**3).toFixed(1)}function rc(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function jn(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function bb(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Gp(s){return s?`${Math.round(s/1024)}k`:"—"}function Vo({type:s,title:o,message:i,defaultValue:u,onConfirm:d,onCancel:f}){const g=m.useRef(null);return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),n.jsx("button",{onClick:f||(()=>d()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:i}),s==="prompt"&&n.jsx("input",{ref:g,type:"text",defaultValue:u,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:h=>{var v;h.key==="Enter"&&d((v=g.current)==null?void 0:v.value)}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&n.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"}),n.jsx("button",{onClick:()=>{var v;const h=s==="prompt"?(v=g.current)==null?void 0:v.value:void 0;d(h)},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 ui({value:s,label:o,detail:i}){const d=2*Math.PI*24,f=d-Math.min(s,100)/100*d,g=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:ne("fill-none transition-all duration-700 ease-out",g),strokeWidth:"4.5",strokeDasharray:d,strokeDashoffset:f,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),i&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function wb(){var U;const[s,o]=m.useState(null),[i,u]=m.useState(null),[d,f]=m.useState([]),[g,h]=m.useState([]),[v,x]=m.useState([]),[b,j]=m.useState(null),[M,O]=m.useState([]),[A,w]=m.useState(null),[C,_]=m.useState(""),[$,V]=m.useState(!1),[z,L]=m.useState(""),[B,J]=m.useState(!1),[te,re]=m.useState({open:!1,actionPath:"",actionLabel:""}),[ee,ge]=m.useState(null),[ue,Ae]=m.useState(!1);async function Ee(F){try{await me("/api/agent/brain",{method:"POST",body:JSON.stringify({model:F})}),ge({type:"alert",title:"Erfolgreich",message:`Hermes-Gehirn wurde auf '${F}' geändert. Der Gateway-Dienst wurde neu gestartet.`,onConfirm:()=>ge(null)}),k(),Ae(!1)}catch(we){ge({type:"alert",title:"Fehler",message:`Fehler beim Wechseln des Gehirns: ${we.message}`,onConfirm:()=>ge(null)})}}function De(F,we,at){ge({type:"confirm",title:F,message:we,onConfirm:()=>{ge(null),at()},onCancel:()=>ge(null)})}const[Me,Pe]=m.useState(""),[Q,ce]=m.useState("stable"),[q,E]=m.useState(!1);function k(){me("/api/system/status").then(o).catch(()=>{}),me("/api/agent/status").then(u).catch(()=>{}),me("/api/models").then(F=>{f(F.models||[]),h(F.running||[])}).catch(()=>{}),me("/api/memory?category=").then(F=>x(F.slice(0,3))).catch(()=>{}),me("/api/maintenance/updates").then(j).catch(()=>{}),me("/api/jobs").then(F=>O(F.jobs||[])).catch(()=>{}),me("/api/system/token-stats").then(w).catch(()=>{})}m.useEffect(()=>{k();const F=setInterval(k,3e3);return()=>clearInterval(F)},[]);async function G(F,we,at,Ct){_(`${we} wird ausgeführt...`),V(!0);try{const Et={...at},Pt=await me(F,{method:"POST",body:JSON.stringify(Et)});if(Pt.status==="password_required"||Pt.status==="incorrect_password"){re({open:!0,actionPath:F,actionLabel:we,payload:at,error:Pt.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),_("");return}Pt.job_id?_(`${we} gestartet (Job-ID: ${Pt.job_id})`):Pt.ok?_(`${we} erfolgreich ausgeführt.`):_(`Fehler: ${Pt.err||"Unbekannter Fehler"}`),k()}catch(Et){_(`Fehler bei ${we}: ${Et.message}`)}finally{V(!1)}}async function X(){J(!0);try{const F={...te.payload,sudo_password:z},we=await me(te.actionPath,{method:"POST",body:JSON.stringify(F)});if(we.status==="password_required"||we.status==="incorrect_password"){re(at=>({...at,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}we.job_id?_(`${te.actionLabel} gestartet (Job-ID: ${we.job_id})`):we.ok?_(`${te.actionLabel} erfolgreich ausgeführt.`):_(`Fehler: ${we.err||"Unbekannter Fehler"}`),re({open:!1,actionPath:"",actionLabel:""}),L(""),k()}catch(F){_(`Fehler: ${F.message}`),re({open:!1,actionPath:"",actionLabel:""}),L("")}finally{J(!1)}}async function Z(F,we){_(`Upgrade für ${F} wird gestartet...`);try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:F,role:we,quant:"Q4_K_M",jinja:!0})}),_("Upgrade-Download gestartet."),k()}catch(at){_(`Upgrade fehlgeschlagen: ${at.message}`)}}async function ie(){if(!(!Me.trim()||q)){E(!0);try{await me("/api/memory",{method:"POST",body:JSON.stringify({content:Me,category:Q,source:"dashboard"})}),Pe(""),me("/api/memory?category=").then(F=>x(F.slice(0,3))).catch(()=>{})}catch(F){console.error(F)}finally{E(!1)}}}const he=M.find(F=>F.label.includes("OS-Update")&&(F.state==="running"||F.state==="queued")),xe=M.find(F=>F.label.includes("Engine-Update")&&(F.state==="running"||F.state==="queued"));return n.jsxs("div",{className:"space-y-6",children:[te.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{re({open:!1,actionPath:"",actionLabel:""}),L("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:te.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:z,onChange:F=>L(F.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:F=>F.key==="Enter"&&X(),autoFocus:!0}),te.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:te.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{re({open:!1,actionPath:"",actionLabel:""}),L("")},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"}),n.jsx("button",{onClick:X,disabled:!z||B,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:B?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(At,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(ui,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),n.jsx(ui,{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&&n.jsx(ui,{value:s.gpu.busy_percent,label:"GPU",detail:`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB`}),s.disk&&n.jsx(ui,{value:s.disk.percent,label:"Disk",detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`})]}):n.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)&&n.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&&n.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(P0,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(b==null?void 0:b.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(b.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),b?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:ne("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",b.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:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:b.os>0?`${b.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:ne("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",b.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:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:b.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:ne("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",b.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:b.models>0?`${b.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>G("/api/maintenance/os-update","OS-Update"),disabled:$||!!he,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:he?n.jsxs(n.Fragment,{children:[n.jsx(Tn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",he.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>G("/api/maintenance/engine-update","Engine-Update"),disabled:$||!!xe,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:xe?n.jsxs(n.Fragment,{children:[n.jsx(Tn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",xe.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{De("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>G("/api/maintenance/reboot","Reboot"))},disabled:$,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:[n.jsx(Ch,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),b.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:b.model_list.map(F=>n.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:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${F.role}: ${F.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:F.role}),": ",F.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>Z(F.repo,F.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:[n.jsx(An,{className:"h-2.5 w-2.5"})," Laden"]})]},F.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),C&&n.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:C}),n.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:[n.jsx(zn,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.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"})})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Oo,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(i==null?void 0:i.webui_url)&&n.jsxs("a",{href:Lo(i.webui_url),target:"_blank",rel:"noopener",className:ne("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",i.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(gi,{className:"h-3 w-3"})," Hermes öffnen"]})]}),i?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full",i.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:i.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full",i.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:i.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>Ae(!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 group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(At,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(To,{className:"h-3.5 w-3.5"}),i.brain_model?`model: ${i.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:["fast","heavy","coder","reasoning","vision","scout"].map(F=>{var Ct;const we=d.find(Et=>Et.role===F),at=we?g.includes(we.name):!1;return n.jsxs("div",{className:ne("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",at?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":we?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ne("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",F==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":F==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":F==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":F==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":F==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:F}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:we?(Ct=we.name.split("/").pop())==null?void 0:Ct.replace(/\.gguf$/i,""):"nicht zugewiesen"}),we&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[we.prompt_cache&&n.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"}),we.spec_draft_model&&n.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: ${we.spec_draft_model})`,children:"SPEC"}),we.parallel_slots>1&&n.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:`${we.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",we.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:we?at?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},F)})})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Do,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:Me,onChange:F=>Pe(F.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"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:Q,onChange:F=>ce(F.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:ie,disabled:!Me.trim()||q,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:[n.jsx(Sh,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:v.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):v.map(F=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:F.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:F.content,children:F.content})]},F.id))})]})]}),n.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."})]}),n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(m0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),A?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[A.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",A.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:A.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(U=A==null?void 0:A.pricing)!=null&&U.heavy?` (Ø ${A.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${A.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})]}),i&&ue&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(At,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>Ae(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...d.map(F=>{var we;return((we=F.name.split("/").pop())==null?void 0:we.replace(".gguf",""))||F.name})].map(F=>{const we=["auto","fast","heavy"].includes(F);return n.jsxs("button",{onClick:()=>Ee(F),className:ne("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",i.brain_model===F||!i.brain_model&&F==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:F}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:we?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(i.brain_model===F||!i.brain_model&&F==="auto")&&n.jsx(As,{className:"h-4 w-4 shrink-0 text-primary"})]},F)})})]})}),ee&&n.jsx(Vo,{type:ee.type,title:ee.title,message:ee.message,onConfirm:()=>ee.onConfirm(),onCancel:ee.onCancel})]})}function kn({children:s,tone:o="muted"}){const i={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${i[o]}`,children:s})}function Kp({caps:s}){return s?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&n.jsx(kn,{children:"💻 Code"}),s.vision&&n.jsx(kn,{children:"👁 Bild"}),s.reasoning&&n.jsx(kn,{children:"🧠 Reason"}),s.moe&&n.jsxs(kn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&n.jsx(kn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&n.jsx(kn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&n.jsx(kn,{children:"🔢 Embed"})]}):null}function jb({onError:s}){const[o,i]=m.useState([]),[u,d]=m.useState(null);function f(){me("/api/jobs").then(x=>i(x.jobs||[])).catch(()=>{})}m.useEffect(()=>{f();const x=setInterval(f,2e3);return()=>clearInterval(x)},[]);async function g(x){try{await me(`/api/jobs/${x}/cancel`,{method:"POST"}),f()}catch(b){s?s(b.message):d(b.message)}}const h=o.filter(x=>x.state==="running"||x.state==="queued"),v=o.filter(x=>x.state!=="running"&&x.state!=="queued").slice(-3);return h.length===0&&v.length===0?null:n.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:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),h.map(x=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:x.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[x.progress??0,"% • ",rc(x.done_bytes),"/",rc(x.total_bytes),x.eta_s?` • ETA ${bb(x.eta_s)}`:""]}),n.jsx("button",{onClick:()=>g(x.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"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${x.progress??0}%`}})})]},x.id)),v.map(x=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:x.label}),n.jsx("span",{className:ne("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",x.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:x.state})]},x.id)),u&&n.jsx(Vo,{type:"alert",title:"Fehler",message:u,onConfirm:()=>d(null)})]})}function kb({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 n.jsxs("span",{className:ne("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}const Nb=["fast","heavy","coder","reasoning","agent","vision","scout"];function Qp(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 Sb(){var Bn,Cr,ur,Hn,Us;const[s,o]=m.useState([]),[i,u]=m.useState([]),[d,f]=m.useState(null),[g,h]=m.useState(null),[v,x]=m.useState(null),[b,j]=m.useState(!0),[M,O]=m.useState(""),[A,w]=m.useState(null),[C,_]=m.useState(null),[$,V]=m.useState(!1),[z,L]=m.useState(null),[B,J]=m.useState("grid"),[te,re]=m.useState("all"),[ee,ge]=m.useState(null);function ue(T,le,ke){ge({type:"alert",title:T,message:le,onConfirm:()=>{ge(null)}})}function Ae(T,le,ke,Re){ge({type:"confirm",title:T,message:le,onConfirm:()=>{ge(null),ke()},onCancel:()=>{ge(null)}})}function Ee(T,le,ke,Re,Fe){ge({type:"prompt",title:T,message:le,defaultValue:ke,onConfirm:Ht=>{ge(null),Re(Ht)},onCancel:()=>{ge(null)}})}const De=s.filter(T=>te==="in_use"?!!T.role||i.includes(T.name):!0),[Me,Pe]=m.useState({width:800,height:360}),Q=m.useRef(null),ce=m.useCallback(T=>{if(Q.current&&(Q.current.disconnect(),Q.current=null),T){const le=new ResizeObserver(ke=>{if(!ke||ke.length===0)return;const Re=ke[0].contentRect;Pe({width:Re.width,height:Re.height})});le.observe(T),Q.current=le}},[]),q=Me.width,E=Me.height,k=T=>{const le=q*.1,ke=E*T,Re=q*.5,Fe=E*.5,Ht=q*.3,cr=ke,dr=q*.3;return`M ${le} ${ke} C ${Ht} ${cr}, ${dr} ${Fe}, ${Re} ${Fe}`},G=T=>{const le=q*.5,ke=E*.5,Re=q*.9,Fe=E*T,Ht=q*.7,cr=ke,dr=q*.7;return`M ${le} ${ke} C ${Ht} ${cr}, ${dr} ${Fe}, ${Re} ${Fe}`};function X(){Promise.all([me("/api/models"),me("/api/routing"),me("/api/connect"),me("/api/maintenance/updates")]).then(([T,le,ke,Re])=>{o(T.models||[]),u(T.running||[]),f(le),h(ke),x(Re)}).catch(T=>O(String(T))).finally(()=>j(!1))}m.useEffect(()=>{X();const T=setInterval(X,4e3);return()=>clearInterval(T)},[]);async function Z(T){try{await me(`/api/models/${encodeURIComponent(T)}/load`,{method:"POST"}),X()}catch(le){ue("Fehler",`Fehler beim Laden des Modells: ${le.message}`)}}async function ie(T){try{await me(`/api/models/${encodeURIComponent(T)}/unload`,{method:"POST"}),X()}catch(le){ue("Fehler",`Fehler beim Entladen des Modells: ${le.message}`)}}async function he(){try{await me("/api/models/unload",{method:"POST"}),X()}catch(T){ue("Fehler",`Fehler beim Entladen aller Modelle: ${T.message}`)}}async function xe(T,le){try{await me(`/api/models/${encodeURIComponent(le)}/role`,{method:"POST",body:JSON.stringify({role:T||null})}),X()}catch(ke){ue("Fehler",`Fehler beim Zuweisen der Rolle: ${ke.message||ke}`)}}async function U(T,le){Ee("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(le||32768),async ke=>{if(ke)try{await me(`/api/models/${encodeURIComponent(T)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ke,10)})}),X()}catch(Re){ue("Fehler",`Fehler beim Setzen des Kontexts: ${Re.message||Re}`)}})}async function F(T){Ae("Modell löschen?",`Modell '${T}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await me(`/api/models/${encodeURIComponent(T)}`,{method:"DELETE"}),X()}catch(le){ue("Fehler",`Fehler beim Löschen: ${le.message||le}`)}})}async function we(T,le,ke,Re){try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:T,role:le,quant:ke,jinja:Re})}),ue("Herunterladen gestartet",`Download für '${T}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Fe){ue("Fehler",`Fehler beim Starten des Upgrades: ${Fe.message||Fe}`)}}async function at(T){T&&(await navigator.clipboard.writeText(T),V(!0),setTimeout(()=>V(!1),1500))}if(b)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(M)return n.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 (",M,")."]});const Ct=s.filter(T=>i.includes(T.name)),Et=Ct.reduce((T,le)=>T+(le.size_bytes||0),0),Pt=16*1024**3,Fs=Et>Pt?Et*1.2:Pt,$n=T=>s.find(le=>le.role===T),Sr=T=>{const le=$n(T);return le?i.includes(le.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` - @keyframes flow-dash { - to { - stroke-dashoffset: -20; - } - } - .svg-flow-path { - stroke-dasharray: 4 6; - animation: flow-dash 1s linear infinite; - } - `}),n.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:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qu,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",jn(Et)," / ",jn(Fs)," geladen"]}),i.length>0&&n.jsx("button",{onClick:he,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"})]})]}),n.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:Ct.length===0?n.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"}):Ct.map((T,le)=>{var Fe;const ke=(T.size_bytes||0)/Fs*100,Re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][le%4];return n.jsxs("div",{style:{width:`${ke}%`},className:ne("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",Re),title:`${T.name} (${jn(T.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[T.role?`[${T.role}] `:"",(Fe=T.name.split("/").pop())==null?void 0:Fe.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:jn(T.size_bytes)})]},T.name)})})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.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."})]}),n.jsxs("div",{ref:ce,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:k(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="roocode"||A==="roocode")&&n.jsx("path",{d:k(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="cursor"||A==="cursor")&&n.jsx("path",{d:k(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="opencode"||A==="opencode")&&n.jsx("path",{d:k(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="zed"||A==="zed")&&n.jsx("path",{d:k(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="continue"||A==="continue")&&n.jsx("path",{d:k(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("fast")&&n.jsx("path",{d:G(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("heavy")&&n.jsx("path",{d:G(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("coder")&&n.jsx("path",{d:G(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("vision")&&n.jsx("path",{d:G(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("scout")&&n.jsx("path",{d:G(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>L("roocode"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.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:()=>L("cursor"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.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:()=>L("opencode"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.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:()=>L("zed"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.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:()=>L("continue"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.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:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",d!=null&&d.heavy_threshold_chars?d.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.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"})]}),Nb.map(T=>{var Ht;const le=["12%","31%","50%","69%","88%"],ke=$n(T),Re=ke?i.includes(ke.name):!1;if(T==="reasoning"||T==="agent")return null;const Fe={fast:0,heavy:1,coder:2,vision:3,scout:4}[T];return n.jsxs("div",{className:ne("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",Re?"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:le[Fe]},onClick:()=>_(T),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:T}),Re&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ke?(Ht=ke.name.split("/").pop())==null?void 0:Ht.replace(".gguf",""):"Keine Zuweisung"})]},T)}),A&&g&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[A==="roocode"&&"Roo Code Setup",A==="cursor"&&"Cursor Setup",A==="opencode"&&"OpenCode Setup",A==="zed"&&"Zed Setup",A==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>w(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[A==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),A==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),A==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),A==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),A==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),g.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var T,le,ke,Re,Fe;return at(A==="roocode"?(T=g.tools.cline)==null?void 0:T.snippet:A==="cursor"?(le=g.tools.cursor)==null?void 0:le.snippet:A==="opencode"?(ke=g.tools.opencode)==null?void 0:ke.snippet:A==="zed"?(Re=g.tools.zed)==null?void 0:Re.snippet:(Fe=g.tools.continue)==null?void 0:Fe.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[$?n.jsx(As,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Nh,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:$?"Kopiert":"Kopieren"})]})]}),n.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:n.jsxs("code",{children:[A==="roocode"&&((Bn=g.tools.cline)==null?void 0:Bn.snippet),A==="cursor"&&((Cr=g.tools.cursor)==null?void 0:Cr.snippet),A==="opencode"&&((ur=g.tools.opencode)==null?void 0:ur.snippet),A==="zed"&&((Hn=g.tools.zed)==null?void 0:Hn.snippet),A==="continue"&&((Us=g.tools.continue)==null?void 0:Us.snippet)]})})]}),n.jsx("button",{onClick:()=>w(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"})]})})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(T=>{var Re;const le=s.find(Fe=>Fe.role===T),ke=le?i.includes(le.name):!1;return n.jsxs("div",{onClick:()=>_(T),className:ne("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":le?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:ne("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",T==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":T==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":T==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":T==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":T==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:T}),ke&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:le==null?void 0:le.name,children:le?(Re=le.name.split("/").pop())==null?void 0:Re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},T)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",De.length," von ",s.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>re("all"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>re("in_use"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>J("grid"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",B==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>J("list"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",B==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),B==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:De.length===0?n.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:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):De.map(T=>{const le=i.includes(T.name),ke=v==null?void 0:v.model_list.find(Fe=>Fe.role===T.role),Re=Qp(T.name);return n.jsxs("div",{className:ne("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",le?"border-primary/45 shadow-primary/5":T.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:ne("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Re.color),title:Re.name,children:Re.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:T.name,children:T.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.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:T.quant||"GGUF"}),le&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(mi,{className:"h-3 w-3 animate-pulse"})," Warm"]}),T.role&&n.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:T.role}),T.prompt_cache&&n.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"}),T.spec_draft_model&&n.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: ${T.spec_draft_model})`,children:"SPEC"}),T.parallel_slots>1&&n.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:`${T.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",T.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(Kp,{caps:T.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(Qu,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:jn(T.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(k0,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:Gp(T.ctx)})]})]})]}),ke&&n.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:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",ke.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>we(ke.repo,T.role,T.quant||"Q4_K_M",T.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:[n.jsx(An,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>le?ie(T.name):Z(T.name),className:ne("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",le?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:le?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(T.name,T.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"}),n.jsx("button",{onClick:()=>F(T.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:n.jsx(qu,{className:"h-3.5 w-3.5"})})]})]})]},T.name)})}):n.jsx("div",{className:"space-y-2",children:De.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):De.map(T=>{const le=i.includes(T.name),ke=Qp(T.name);return n.jsxs("div",{className:ne("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",le?"border-primary/45":T.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:ne("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}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:T.name,children:T.name.split("/").pop()}),T.role&&n.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:T.role}),T.prompt_cache&&n.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"}),T.spec_draft_model&&n.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: ${T.spec_draft_model})`,children:"SPEC"}),T.parallel_slots>1&&n.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:`${T.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",T.parallel_slots]}),le&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",jn(T.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",Gp(T.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:T.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(Kp,{caps:T.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>le?ie(T.name):Z(T.name),className:ne("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",le?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:le?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(T.name,T.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"}),n.jsx("button",{onClick:()=>F(T.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:n.jsx(qu,{className:"h-3.5 w-3.5"})})]})]})]},T.name)})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",C,"' konfigurieren"]}),n.jsx("button",{onClick:()=>_(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:C}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{xe(C,""),_(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:n.jsx("span",{children:"Zuweisung entfernen"})}),s.map(T=>{var le;return n.jsxs("button",{onClick:()=>{xe(C,T.name),_(null)},className:ne("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",T.role===C?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(le=T.name.split("/").pop())==null?void 0:le.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[jn(T.size_bytes)," · ",T.quant]})]}),T.role===C&&n.jsx(As,{className:"h-4 w-4 shrink-0 text-primary"})]},T.name)})]})]})}),ee&&n.jsx(Vo,{type:ee.type,title:ee.title,message:ee.message,defaultValue:ee.defaultValue,onConfirm:ee.onConfirm,onCancel:ee.onCancel})]})}function Cb(){const[s,o]=m.useState(""),[i,u]=m.useState([]),[d,f]=m.useState("Q4_K_M"),[g,h]=m.useState(""),[v,x]=m.useState(""),[b,j]=m.useState([]);async function M(w){const C=w??s;if(C.trim()){h("Analysiere HuggingFace Repository...");try{const _=await me(`/api/hf/quants?repo=${encodeURIComponent(C)}`);o(_.repo),u(_.quants),_.quants.length&&f(_.quants.includes("Q4_K_M")?"Q4_K_M":_.quants[0]),h(_.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(_){h(`Fehler: ${_}`)}}}async function O(){if(v.trim()){h("Durchsuche HuggingFace...");try{const w=await me(`/api/hf/search?q=${encodeURIComponent(v)}`);j(w.results),h(w.results.length?"":"Keine Ergebnisse gefunden.")}catch(w){h(`Suche fehlgeschlagen: ${w}`)}}}async function A(){if(s.trim()){h("Download-Job wird initiiert...");try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:d,jinja:!0})}),h(`Download gestartet: ${s} (${d}). Fortschritt wird oben angezeigt.`)}catch(w){h(`Download-Fehler: ${w}`)}}}return n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:s,onChange:w=>o(w.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"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>M(),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"}),i.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:d,onChange:w=>f(w.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:i.map(w=>n.jsx("option",{value:w,className:"bg-popover text-foreground",children:w},w))}),n.jsxs("button",{onClick:A,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:[n.jsx(An,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:v,onChange:w=>x(w.target.value),onKeyDown:w=>w.key==="Enter"&&O(),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"}),n.jsx(dc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:O,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"})]}),b.length>0&&n.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:b.map(w=>n.jsxs("button",{onClick:()=>{o(w.repo),j([]),x(""),M(w.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:[n.jsx("span",{className:"font-semibold truncate",children:w.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(An,{className:"h-3 w-3"})," ",w.downloads.toLocaleString()]})]},w.repo))}),g&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:g})]})}const Eb={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Ku},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Vu},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Do},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Oo},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:Gu}};function Pb(){const[s,o]=m.useState(null),[i,u]=m.useState([]),[d,f]=m.useState(null),[g,h]=m.useState(""),[v,x]=m.useState(!0),[b,j]=m.useState({}),[M,O]=m.useState({}),[A,w]=m.useState(!1);m.useEffect(()=>{Promise.all([me("/api/discover"),me("/api/models"),me("/api/maintenance/updates").catch(()=>null)]).then(([_,$,V])=>{o(_),u($.models||[]),V&&f(V)}).catch(_=>h(String(_))).finally(()=>x(!1))},[]);async function C(_,$,V,z){j(L=>({...L,[_]:"Starte..."}));try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:_,role:$,quant:V,jinja:z})}),j(L=>({...L,[_]:"Download läuft"}))}catch{j(B=>({...B,[_]:"Fehler"}))}}return v?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):g||!s?n.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 (",g,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.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:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Eh,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(_=>{const $=Eb[_.role]||{title:_.title||_.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:To},V=$.icon,z=i.find(ee=>ee.role===_.role),L=d==null?void 0:d.model_list.find(ee=>ee.role===_.role),B=_.models.find(ee=>ee.repo===_.recommended)||_.models[0];if(!B)return null;const J=b[B.repo],te=_.models.filter(ee=>ee.repo!==_.recommended),re=!!M[_.role];return n.jsxs("div",{className:ne("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",z?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.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:n.jsx(V,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:$.title}),n.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: ",_.role]})]})]}),z?n.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:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.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"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:z?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:z.name,children:z.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",rc(z.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",z.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:B.name,children:B.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",B.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",B.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(kb,{fit:B.fit})})]})}),n.jsx("div",{className:"pt-1",children:z?L?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",L.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>C(L.repo,_.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!b[L.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:[n.jsx(An,{className:"h-3.5 w-3.5"}),b[L.repo]||"Auf neue Version aktualisieren"]})]}):n.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:[n.jsx(As,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>C(B.repo,_.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!J,className:ne("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",J?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(An,{className:"h-3.5 w-3.5"}),J||"Optimales Modell einsetzen"]})})]}),te.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>O(ee=>({...ee,[_.role]:!re})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[re?n.jsx(f0,{className:"h-3 w-3"}):n.jsx(u0,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",te.length,")"]})]}),re&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:te.map(ee=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:ee.name,children:ee.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",ee.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:ee.fit.text})]})]}),n.jsx("button",{onClick:()=>C(ee.repo,_.role,ee.quant||"Q4_K_M",ee.caps.tools!=="no"),disabled:!!b[ee.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:b[ee.repo]||"Installieren"})]},ee.repo))})]})]},_.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>w(!A),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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(dc,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:A?"Ausblenden ▲":"Anzeigen ▼"})]}),A&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(Cb,{})})]})]})}function _b(){const[s,o]=m.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(i=>n.jsx("button",{onClick:()=>o(i),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",s===i?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:i==="cockpit"?"Cockpit":"Modelle finden"},i))})]}),n.jsx(jb,{}),n.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?n.jsx(Sb,{}):n.jsx(Pb,{})})]})}const an={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],updates:["updates"],discover:["discover"],connect:s=>["connect",s??""],memory:(s,o)=>["memory",s??"",o??""]},Mb=()=>Fn({queryKey:an.health,queryFn:()=>me("/api/health"),refetchInterval:1e4}),mm=(s=5e3)=>Fn({queryKey:an.systemStatus,queryFn:()=>me("/api/system/status"),refetchInterval:s}),Rb=(s=3e3)=>Fn({queryKey:an.services,queryFn:()=>me("/api/system/services"),refetchInterval:s}),Ob=(s=4e3)=>Fn({queryKey:an.models,queryFn:()=>me("/api/models"),refetchInterval:s}),Db=(s=5e3)=>Fn({queryKey:an.agentStatus,queryFn:()=>me("/api/agent/status"),refetchInterval:s}),Tb=s=>Fn({queryKey:an.connect(s),queryFn:()=>me(s?`/api/connect?${s}`:"/api/connect")}),Ab=s=>Fn({queryKey:an.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),me(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function xc(){const[s,o]=m.useState(null),i=m.useCallback(()=>o(null),[]),u=m.useCallback((h,v,x)=>{o({type:"alert",title:h,message:v,onConfirm:()=>{o(null),x==null||x()}})},[]),d=m.useCallback((h,v,x,b)=>{o({type:"confirm",title:h,message:v,onConfirm:()=>{o(null),x()},onCancel:()=>{o(null),b==null||b()}})},[]),f=m.useCallback((h,v,x,b,j)=>{o({type:"prompt",title:h,message:v,defaultValue:x,onConfirm:M=>{o(null),b(M)},onCancel:()=>{o(null),j==null||j()}})},[]),g=s?n.jsx(Vo,{...s}):null;return{showAlert:u,showConfirm:d,showPrompt:f,close:i,dialogElement:g}}function ci({label:s,percent:o,detail:i,icon:u}){const d=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 n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(u,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:ne("h-full transition-all duration-700 ease-out",d),style:{width:`${Math.min(o,100)}%`}})}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function zb(){const{data:s,error:o}=mm(3e3),{data:i}=Rb(3e3),{showAlert:u,dialogElement:d}=xc(),f=o?String(o):"",[g,h]=m.useState(""),[v,x]=m.useState({});async function b(){h("Backup snapshotted...");try{const M=await me("/api/system/backup",{method:"POST"});h(M.ok?`Snapshot erzeugt: ${M.snapshot} (${M.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(M){h(`Fehler: ${M.message}`)}}async function j(M){x(O=>({...O,[M]:!0}));try{const O=await me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:M})});O.ok?u("Erfolgreich",`Dienst ${M} wurde erfolgreich neu gestartet.`):u("Fehler beim Neustart",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){u("Fehler",`Fehler: ${O.message}`)}finally{x(O=>({...O,[M]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.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&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(ci,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:At}),n.jsx(ci,{label:"RAM",percent:s.ram.percent,detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`,icon:mi}),s.gpu&&s.gpu.busy_percent!=null&&n.jsx(ci,{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:At}),s.disk&&n.jsx(ci,{label:"Disk",percent:s.disk.percent,detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`,icon:Qu})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&n.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&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&n.jsx("span",{children:"|"}),s.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),i&&n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.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"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:i.services.map(M=>n.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:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:ne("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",M.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:M.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:M.url})]})]}),n.jsx("button",{onClick:()=>j(M.name),disabled:v[M.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:n.jsx(Tn,{className:ne("h-3.5 w-3.5",v[M.name]&&"animate-spin")})})]},M.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Lo(i.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:[n.jsx(gi,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Lo(i.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:[n.jsx(gi,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.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:[n.jsx(S0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),g&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:g}),d]})}function Lb(){const[s,o]=m.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[i,u]=m.useState(localStorage.getItem("mc_mcp_path")||""),[d,f]=m.useState("cline"),[g,h]=m.useState(!1),v=new URLSearchParams({host:s});i&&v.set("mcp_path",i);const{data:x,error:b}=Tb(v.toString()),j=b?String(b):"";function M(C){o(C),C&&localStorage.setItem("mc_host",C)}function O(C){u(C),localStorage.setItem("mc_mcp_path",C)}const A=x==null?void 0:x.tools[d];async function w(){A&&(await navigator.clipboard.writeText(A.snippet),h(!0),setTimeout(()=>h(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.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:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(v0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:s,onChange:C=>M(C.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"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(y0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:i,onChange:C=>O(C.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"})]})]}),j&&n.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: ",j]}),x&&n.jsxs("div",{className:"space-y-4",children:[n.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(([C,_])=>n.jsx("button",{onClick:()=>f(C),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",d===C?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:_.label},C))}),A&&n.jsxs("div",{className:"space-y-3",children:[A.note&&n.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:[n.jsx(b0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:A.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.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:[n.jsx(xi,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:d==="cline"||d==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:w,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:[g?n.jsx(As,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Nh,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:g?"Kopiert":"Kopieren"})]})]}),n.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:n.jsx("code",{children:A.snippet})})]})]})]})]})}const qp=["user","instruction","stable","versioned","ephemeral"],_u={user:{label:"User",icon:O0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:C0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:zn,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:M0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:h0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Zp={label:"Gedächtnis",icon:kh,bg:"bg-muted/10",text:"text-muted-foreground"},Ib={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 Fb(){const[s,o]=m.useState(""),[i,u]=m.useState(""),[d,f]=m.useState(""),[g,h]=m.useState("stable"),[v,x]=m.useState(!1),b=cc(),{showAlert:j,showConfirm:M,dialogElement:O}=xc(),{data:A=[],error:w}=Ab({q:i,category:s}),C=w?String(w):"",_=()=>b.invalidateQueries({queryKey:["memory"]});async function $(){d.trim()&&(await me("/api/memory",{method:"POST",body:JSON.stringify({content:d,category:g,source:"ui"})}),f(""),_())}async function V(L){await me(`/api/memory/${L}`,{method:"DELETE"}),_()}async function z(){x(!0);try{const L=await me("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(L.duplicate_count===0){j("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${L.duplicate_count} Dublette(n) in ${L.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await me("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),_()}catch(B){j("Fehler",`Fehler beim Löschen: ${B.message}`)}})}catch(L){j("Fehler",`Fehler bei der Deduplizierung: ${L.message}`)}finally{x(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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)"}),n.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."})]}),n.jsxs("button",{onClick:z,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:[n.jsx(_0,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:d,onChange:L=>f(L.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"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:g,onChange:L=>h(L.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:qp.map(L=>{var B;return n.jsx("option",{value:L,className:"bg-popover text-foreground",children:((B=_u[L])==null?void 0:B.label)||L},L)})})]}),n.jsxs("button",{onClick:$,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:[n.jsx(Sh,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:i,onChange:L=>u(L.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"}),n.jsx(dc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.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:[n.jsx("button",{onClick:()=>o(""),className:ne("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"}),qp.map(L=>{const B=_u[L]||Zp,J=B.icon;return n.jsxs("button",{onClick:()=>o(L),className:ne("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===L?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(J,{className:"h-3 w-3"}),n.jsx("span",{children:B.label})]},L)})]})]}),C&&n.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: ",C]}),n.jsx("div",{className:"space-y-3",children:A.length===0?n.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."}):A.map(L=>{const B=_u[L.category]||Zp,J=B.icon;return n.jsxs("div",{className:ne("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",Ib[L.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:ne("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",B.bg,B.text),children:[n.jsx(J,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:B.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:L.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.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:L.source}),n.jsx("button",{onClick:()=>V(L.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:n.jsx(qu,{className:"h-3.5 w-3.5"})})]})]},L.id)})}),O]})}function di({label:s,ok:o,detail:i,icon:u,onClick:d}){return n.jsxs("div",{onClick:d,className:ne("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",d&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),n.jsx(u,{className:ne("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:i,children:i})]}),d&&n.jsxs("button",{onClick:f=>{f.stopPropagation(),d()},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:[n.jsx(At,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function Ub(){const{data:s,error:o}=Db(5e3),{data:i}=Ob(),{showAlert:u,dialogElement:d}=xc(),f=cc(),g=o?String(o):"",h=m.useMemo(()=>["auto","fast","heavy",...((i==null?void 0:i.models)??[]).map(L=>{var B;return((B=L.name.split("/").pop())==null?void 0:B.replace(".gguf",""))||L.name})],[i]),[v,x]=m.useState(null),[b,j]=m.useState(!1),[M,O]=m.useState({width:800,height:360}),A=m.useRef(null),w=m.useCallback(z=>{if(A.current&&(A.current.disconnect(),A.current=null),z){const L=new ResizeObserver(B=>{if(!B||B.length===0)return;const J=B[0].contentRect;O({width:J.width,height:J.height})});L.observe(z),A.current=L}},[]),C=M.width,_=M.height,$=(z,L,B,J)=>{const te=(z+B)/2;return`M ${z} ${L} C ${te} ${L}, ${te} ${J}, ${B} ${J}`};async function V(z){try{await me("/api/agent/brain",{method:"POST",body:JSON.stringify({model:z})}),u("Erfolgreich",`Hermes-Gehirn wurde auf '${z}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:an.agentStatus}),j(!1)}catch(L){u("Fehler",`Fehler beim Wechseln des Gehirns: ${L.message}`)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` - @keyframes flow-dash { - to { - stroke-dashoffset: -20; - } - } - .svg-flow-path { - stroke-dasharray: 4 6; - animation: flow-dash 1s linear infinite; - } - `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(s==null?void 0:s.webui_url)&&n.jsxs("a",{href:Lo(s.webui_url),target:"_blank",rel:"noopener",className:ne("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:[n.jsx(gi,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),g&&n.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 (",g,")."]}),s&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(di,{label:"Agent Gateway",ok:s.gateway_reachable,detail:"Port :8642 (REST API)",icon:Oo}),n.jsx(di,{label:"Agent WebUI",ok:s.webui_reachable,detail:"Port :8787 (Chat UI)",icon:mi}),n.jsx(di,{label:"Aktives Gehirn",ok:s.gateway_reachable,detail:s.brain_model?`Model: ${s.brain_model}`:"Model: auto",icon:At,onClick:()=>j(!0)}),n.jsx(di,{label:"Verdrahtung",ok:s.has_config,detail:`Config: ${s.has_config?"✓":"—"} · Skills: ${s.has_skills?"✓":"—"} · Memory: ${s.has_memories?"✓":"—"}`,icon:yi})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:w,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="webui"||s.webui_reachable)&&n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="brain"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="wiring"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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(Lo(s.webui_url),"_blank"),title:s.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(mi,{className:ne("h-3.5 w-3.5",s.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:ne("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",s.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Oo,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:ne("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"})]}),n.jsxs("div",{className:ne("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:()=>j(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(At,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),s.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.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"})]}),n.jsxs("div",{className:ne("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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(yi,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),s.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",s.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",s.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",s.has_memories?"✓":"—"]})]})]})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(zn,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!s.gateway_reachable&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(zn,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.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&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(At,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>j(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:h.map(z=>{const L=["auto","fast","heavy"].includes(z);return n.jsxs("button",{onClick:()=>V(z),className:ne("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===z||!s.brain_model&&z==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:z}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:L?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(s.brain_model===z||!s.brain_model&&z==="auto")&&n.jsx(As,{className:"h-4 w-4 shrink-0 text-primary"})]},z)})})]})}),d]})}function $b(){const[s,o]=m.useState("connect"),[i,u]=m.useState("roocode"),[d,f]=m.useState(null),g="192.168.178.151",[h,v]=m.useState(!1),[x,b]=m.useState(null);function j(){v(!0),me("/api/health").then(M=>{f(M),b(M.engine_reachable?"success":"partial")}).catch(()=>{f(null),b("fail")}).finally(()=>v(!1))}return m.useEffect(()=>{j()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>o("connect"),className:ne("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"}),n.jsx("button",{onClick:()=>o("concepts"),className:ne("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"?n.jsxs(n.Fragment,{children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:ne("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")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.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${(d==null?void 0:d.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..."]})]})]}),n.jsxs("button",{onClick:j,disabled:h,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:[n.jsx(Tn,{className:ne("h-3.5 w-3.5",h&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(kh,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(At,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.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."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(To,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Do,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.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."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(Vu,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>u("roocode"),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer flex items-center gap-1.5",i==="roocode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:[n.jsx(Eh,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>u("cursor"),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="cursor"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"Cursor IDE"}),n.jsx("button",{onClick:()=>u("opencode"),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="opencode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"OpenCode Desktop"})]}),n.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:[i==="roocode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",g,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),i==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",g,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.jsx("strong",{children:"auto"})," ein und wähle es als aktives Modell aus. Cursor leitet ab jetzt alle deine Anfragen an die Box weiter."]})]})]})]}),i==="opencode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",g,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.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.'})]})]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.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:[n.jsx(Gu,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.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."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(To,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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 ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Gu,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Do,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.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 -...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.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:",n.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:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.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 ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(At,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(yi,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(xi,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(Vu,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(yi,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.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."})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(zn,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Np,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Np,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.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 Bb({title:s,hint:o}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:s}),n.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),n.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:[n.jsx(x0,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Hb=[{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 Mu(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function Wb({open:s,onClose:o,defaultTab:i="maintenance"}){const[u,d]=m.useState(null),[f,g]=m.useState([]),[h,v]=m.useState("llama-swap"),[x,b]=m.useState(""),[j,M]=m.useState(!1),[O,A]=m.useState(null),[w,C]=m.useState({}),[_,$]=m.useState("maintenance"),[V,z]=m.useState(!1),[L,B]=m.useState(null);function J(U,F,we){B({type:"alert",title:U,message:F,onConfirm:()=>{B(null),we&&we()}})}function te(U,F,we){B({type:"confirm",title:U,message:F,onConfirm:()=>{B(null),we()},onCancel:()=>B(null)})}function re(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[ee,ge]=m.useState(""),[ue,Ae]=m.useState(""),[Ee,De]=m.useState(!1),[Me,Pe]=m.useState(!1);m.useEffect(()=>{s&&(ge(localStorage.getItem("mc_sudo_password")||""),Ae(localStorage.getItem("mc_hf_token")||""))},[s]),m.useEffect(()=>{s&&i&&$(i)},[s,i]);const Q=m.useRef(null);function ce(){me("/api/maintenance/updates").then(d).catch(U=>console.error("Error loading updates",U))}function q(){me("/api/jobs").then(U=>g(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function E(U){M(!0),A(null),me(`/api/maintenance/logs?service=${U}&lines=150`).then(F=>{F.ok?b(F.text):(b(`Fehler beim Laden der Logs: ${F.err||"Unbekannter Fehler"}`),(F.status==="incorrect_password"||F.status==="password_required")&&A(F.status))}).catch(F=>b(`Fehler: ${F.message}`)).finally(()=>{M(!1),setTimeout(()=>{Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},50)})}m.useEffect(()=>{if(!s)return;ce(),q();const U=setInterval(()=>{q(),ce()},3e3);return()=>clearInterval(U)},[s]),m.useEffect(()=>{!s||_!=="logs"||E(h)},[s,_,h]);async function k(){try{await me("/api/maintenance/os-update",{method:"POST"}),q(),$("maintenance")}catch(U){J("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function G(){try{await me("/api/maintenance/engine-update",{method:"POST"}),q(),$("maintenance")}catch(U){J("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function X(){z(!0);try{await me("/api/maintenance/check-updates",{method:"POST"}),q(),$("maintenance")}catch(U){J("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{z(!1)}}async function Z(U,F){try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:F})}),J("Gestartet",`Modell-Upgrade für '${F}' (${U}) gestartet.`),q(),$("maintenance")}catch(we){J("Fehler",`Fehler beim Starten des Modell-Upgrades: ${we.message}`)}}async function ie(){te("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await me("/api/maintenance/reboot",{method:"POST"}),J("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){J("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function he(U){C(F=>({...F,[U]:!0}));try{const F=await me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});F.ok?J("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&h===U&&E(U)}):J("Fehler",`Fehler beim Neustart: ${F.err||"Unbekannter Fehler"}`)}catch(F){J("Fehler",`Fehler beim Neustart: ${F.message}`)}finally{C(F=>({...F,[U]:!1}))}}async function xe(U){try{await me(`/api/jobs/${U}/cancel`,{method:"POST"}),q()}catch(F){J("Fehler",`Fehler beim Abbrechen: ${F.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:ne("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}),n.jsxs("div",{className:ne("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:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(At,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.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:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>$("maintenance"),className:ne("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>$("logs"),className:ne("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>$("settings"),className:ne("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",re(u.last_check)]}),n.jsxs("button",{onClick:X,disabled:V,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Tn,{className:ne("h-3 w-3",V&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:k,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:[n.jsx(zn,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.os?`${u.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:G,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:[n.jsx(E0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:ie,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:[n.jsx(Ch,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(u==null?void 0:u.model_list)&&u.model_list.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",re(u.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:u.model_list.map(U=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:U.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),n.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:[n.jsx(An,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.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"]})]}),n.jsx("div",{className:"space-y-3",children:f.length===0?n.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 F=U.state==="running"||U.state==="queued";return n.jsxs("div",{className:ne("p-3 rounded-xl border transition-all duration-300",F?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[F&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",U.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:ne(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})]})]}),F&&n.jsx("button",{onClick:()=>xe(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"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&n.jsxs("span",{children:[Mu(U.done_bytes)," / ",Mu(U.total_bytes),U.rate_bps!=null&&` (${Mu(U.rate_bps)}/s)`]}),U.eta_s!=null&&n.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),_==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:h,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:Hb.map(U=>n.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),n.jsxs("button",{onClick:()=>he(h),disabled:w[h],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[n.jsx(Tn,{className:ne("h-3.5 w-3.5",w[h]&&"animate-spin")}),"Restart"]})]}),n.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:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(xi,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",h]})]}),n.jsx("button",{onClick:()=>E(h),disabled:j,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Tn,{className:ne("h-3 w-3",j&&"animate-spin")})})]}),n.jsx("pre",{ref:Q,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"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(R0,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.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."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",h," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>$("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"})]}):j&&!x?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):x||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(zn,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Ee?"text":"password",value:ee,onChange:U=>ge(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"}),n.jsx("button",{type:"button",onClick:()=>De(!Ee),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ee?n.jsx(Sp,{className:"h-4 w-4"}):n.jsx(Ku,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(w0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Me?"text":"password",value:ue,onChange:U=>Ae(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"}),n.jsx("button",{type:"button",onClick:()=>Pe(!Me),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Me?n.jsx(Sp,{className:"h-4 w-4"}):n.jsx(Ku,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",ee),localStorage.setItem("mc_hf_token",ue),J("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"}),n.jsx("button",{onClick:()=>{ge(""),Ae(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),J("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"})]})]})]})]}),L&&n.jsx(Vo,{type:L.type,title:L.title,message:L.message,onConfirm:L.onConfirm,onCancel:L.onCancel})]})}function Vb(){var j,M,O,A,w;const[s,o]=m.useState("dashboard"),[i,u]=m.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[d,f]=m.useState(!1),[g,h]=m.useState("maintenance"),{data:v}=Mb(),{data:x}=mm(2e4);m.useEffect(()=>{document.documentElement.classList.add("dark")},[]),m.useEffect(()=>{const C=_=>{var V;h(((V=_.detail)==null?void 0:V.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",C),()=>window.removeEventListener("open-system-drawer",C)},[]);const b=Zu.find(C=>C.id===s);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.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]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Uv,{onNavigate:o}),n.jsx(Wb,{open:d,onClose:()=>f(!1),defaultTab:g}),n.jsxs("aside",{className:ne("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",i?"w-16":"w-60"),children:[n.jsxs("div",{className:ne("flex items-center py-4 border-b border-border/40 shrink-0",i?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!i&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{u(C=>{const _=!C;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:i?"Maximieren":"Minimieren",children:i?n.jsx(d0,{className:"h-4 w-4"}):n.jsx(c0,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Zu.map(C=>n.jsxs("button",{onClick:()=>o(C.id),className:ne("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",i?"justify-center p-2.5":"gap-3 px-3 py-2",s===C.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:i?C.label:void 0,children:[n.jsx(C.icon,{className:"h-4.5 w-4.5 shrink-0"}),!i&&n.jsx("span",{className:"truncate",children:C.label})]},C.id))}),n.jsx("div",{className:ne("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",i?"px-2 text-center":"px-5"),children:i?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:ne("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"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[v?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(x==null?void 0:x.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.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:[n.jsx("strong",{children:"MC2:"})," ",x.versions.mc2?`${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((j=x.versions.engine)==null?void 0:j.type)==="git"?`${x.versions.engine.branch}-${x.versions.engine.hash}${x.versions.engine.dirty?"*":""} (${x.versions.engine.date})`:((M=x.versions.engine)==null?void 0:M.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((O=x.versions.engine)==null?void 0:O.type)==="git"?`${x.versions.engine.hash}${x.versions.engine.dirty?"*":""}`:((w=(A=x.versions.engine)==null?void 0:A.version_text)==null?void 0:w.split(" ").pop())||"—"]}),n.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:[n.jsx("strong",{children:"Hermes UI:"})," ",x.versions.hermes_ui?`${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.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:[n.jsx("strong",{children:"Hermes Agent:"})," ",x.versions.hermes_agent?`${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.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:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.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"}),n.jsxs("button",{onClick:()=>{const C=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(C)},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:[n.jsx(g0,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&n.jsx(wb,{}),s==="models"&&n.jsx(_b,{}),s==="system"&&n.jsx(zb,{}),s==="connect"&&n.jsx(Lb,{}),s==="memory"&&n.jsx(Fb,{}),s==="agent"&&n.jsx(Ub,{}),s==="guide"&&n.jsx($b,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&n.jsx(Bb,{title:b.label,hint:b.hint})]})]})]})}const Gb=new Gx({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});bx.createRoot(document.getElementById("root")).render(n.jsx(ah.StrictMode,{children:n.jsx(Kx,{client:Gb,children:n.jsx(Vb,{})})})); diff --git a/frontend/dist/assets/index-CpG8j7ha.js b/frontend/dist/assets/index-CpG8j7ha.js new file mode 100644 index 0000000..9c8dffb --- /dev/null +++ b/frontend/dist/assets/index-CpG8j7ha.js @@ -0,0 +1,380 @@ +var lp=s=>{throw TypeError(s)};var mu=(s,o,i)=>o.has(s)||lp("Cannot "+i);var S=(s,o,i)=>(mu(s,o,"read from private field"),i?i.call(s):o.get(s)),ye=(s,o,i)=>o.has(s)?lp("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(s):o.set(s,i),se=(s,o,i,u)=>(mu(s,o,"write to private field"),u?u.call(s,i):o.set(s,i),i),Ce=(s,o,i)=>(mu(s,o,"access private method"),i);var ei=(s,o,i,u)=>({set _(d){se(s,o,d,i)},get _(){return S(s,o,u)}});function hx(s,o){for(var i=0;iu[d]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();function uh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var gu={exports:{}},No={},xu={exports:{}},Se={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ip;function mx(){if(ip)return Se;ip=1;var s=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),j=Symbol.iterator;function M(P){return P===null||typeof P!="object"?null:(P=j&&P[j]||P["@@iterator"],typeof P=="function"?P:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I=Object.assign,w={};function C(P,N,G){this.props=P,this.context=N,this.refs=w,this.updater=G||D}C.prototype.isReactComponent={},C.prototype.setState=function(P,N){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,N,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function _(){}_.prototype=C.prototype;function $(P,N,G){this.props=P,this.context=N,this.refs=w,this.updater=G||D}var H=$.prototype=new _;H.constructor=$,I(H,C.prototype),H.isPureReactComponent=!0;var z=Array.isArray,R=Object.prototype.hasOwnProperty,F={current:null},K={key:!0,ref:!0,__self:!0,__source:!0};function ne(P,N,G){var X,Y={},ie=null,pe=null;if(N!=null)for(X in N.ref!==void 0&&(pe=N.ref),N.key!==void 0&&(ie=""+N.key),N)R.call(N,X)&&!K.hasOwnProperty(X)&&(Y[X]=N[X]);var we=arguments.length-2;if(we===1)Y.children=G;else if(1>>1,N=Q[P];if(0>>1;Pd(Y,Z))ied(pe,Y)?(Q[P]=pe,Q[ie]=Z,P=ie):(Q[P]=Y,Q[X]=Z,P=X);else if(ied(pe,Z))Q[P]=pe,Q[ie]=Z,P=ie;else break e}}return ce}function d(Q,ce){var Z=Q.sortIndex-ce.sortIndex;return Z!==0?Z:Q.id-ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;s.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();s.unstable_now=function(){return m.now()-h}}var v=[],x=[],b=1,j=null,M=3,D=!1,I=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function H(Q){for(var ce=i(x);ce!==null;){if(ce.callback===null)u(x);else if(ce.startTime<=Q)u(x),ce.sortIndex=ce.expirationTime,o(v,ce);else break;ce=i(x)}}function z(Q){if(w=!1,H(Q),!I)if(i(v)!==null)I=!0,Te(R);else{var ce=i(x);ce!==null&&Me(z,ce.startTime-Q)}}function R(Q,ce){I=!1,w&&(w=!1,_(ne),ne=-1),D=!0;var Z=M;try{for(H(ce),j=i(v);j!==null&&(!(j.expirationTime>ce)||Q&&!ke());){var P=j.callback;if(typeof P=="function"){j.callback=null,M=j.priorityLevel;var N=P(j.expirationTime<=ce);ce=s.unstable_now(),typeof N=="function"?j.callback=N:j===i(v)&&u(v),H(ce)}else u(v);j=i(v)}if(j!==null)var G=!0;else{var X=i(x);X!==null&&Me(z,X.startTime-ce),G=!1}return G}finally{j=null,M=Z,D=!1}}var F=!1,K=null,ne=-1,ee=5,J=-1;function ke(){return!(s.unstable_now()-JQ||125P?(Q.sortIndex=Z,o(x,Q),i(v)===null&&Q===i(x)&&(w?(_(ne),ne=-1):w=!0,Me(z,Z-P))):(Q.sortIndex=N,o(v,Q),I||D||(I=!0,Te(R))),Q},s.unstable_shouldYield=ke,s.unstable_wrapCallback=function(Q){var ce=M;return function(){var Z=M;M=ce;try{return Q.apply(this,arguments)}finally{M=Z}}}})(bu)),bu}var fp;function vx(){return fp||(fp=1,vu.exports=yx()),vu.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var pp;function bx(){if(pp)return wt;pp=1;var s=lc(),o=vx();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,x=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,b={},j={};function M(e){return v.call(j,e)?!0:v.call(b,e)?!1:x.test(e)?j[e]=!0:(b[e]=!0,!1)}function D(e,t,r,l){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function I(e,t,r,l){if(t===null||typeof t>"u"||D(e,t,r,l))return!0;if(l)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function w(e,t,r,l,a,c,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=p}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new w(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new w(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new w(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new w(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new w(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new w(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new w(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new w(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new w(e,5,!1,e.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function $(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!0,!0)});function H(e,t,r,l){var a=C.hasOwnProperty(t)?C[t]:null;(a!==null?a.type!==0:l||!(2y||a[p]!==c[y]){var k=` +`+a[p].replace(" at new "," at ");return e.displayName&&k.includes("")&&(k=k.replace("",e.displayName)),k}while(1<=p&&0<=y);break}}}finally{G=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?N(e):""}function Y(e){switch(e.tag){case 5:return N(e.type);case 16:return N("Lazy");case 13:return N("Suspense");case 19:return N("SuspenseList");case 0:case 2:case 15:return e=X(e.type,!1),e;case 11:return e=X(e.type.render,!1),e;case 1:return e=X(e.type,!0),e;default:return""}}function ie(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case F:return"Portal";case ee:return"Profiler";case ne:return"StrictMode";case Le:return"Suspense";case _e:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ke:return(e.displayName||"Context")+".Consumer";case J:return(e._context.displayName||"Context")+".Provider";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Oe:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Te:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function we(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function U(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function me(e){var t=U(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,c=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(p){l=""+p,c.call(this,p)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return l},setValue:function(p){l=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function St(e){e._valueTracker||(e._valueTracker=me(e))}function Go(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),l="";return e&&(l=U(e)?e.checked?"true":"false":e.value),e=l,e!==r?(t.setValue(e),!0):!1}function kr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ln(e,t){var r=t.checked;return Z({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Is(e,t){var r=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;r=we(t.value!=null?t.value:r),e._wrapperState={initialChecked:l,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Fs(e,t){t=t.checked,t!=null&&H(e,"checked",t,!1)}function Fn(e,t){Fs(e,t);var r=we(t.value),l=t.type;if(r!=null)l==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Un(e,t.type,r):t.hasOwnProperty("defaultValue")&&Un(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Nr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Un(e,t,r){(t!=="number"||kr(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Sr=Array.isArray;function ir(e,t,r,l){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Ie.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ar(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ur={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ci=["Webkit","ms","Moz","O"];Object.keys(ur).forEach(function(e){Ci.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ur[t]=ur[e]})});function bc(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ur.hasOwnProperty(e)&&ur[e]?(""+t).trim():t+"px"}function wc(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var l=r.indexOf("--")===0,a=bc(r,t[r],l);r==="float"&&(r="cssFloat"),l?e.setProperty(r,a):e[r]=a}}var vm=Z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ei(e,t){if(t){if(vm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function Pi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _i=null;function Mi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ri=null,Bn=null,Hn=null;function jc(e){if(e=ao(e)){if(typeof Ri!="function")throw Error(i(280));var t=e.stateNode;t&&(t=ml(t),Ri(e.stateNode,e.type,t))}}function kc(e){Bn?Hn?Hn.push(e):Hn=[e]:Bn=e}function Nc(){if(Bn){var e=Bn,t=Hn;if(Hn=Bn=null,jc(e),t)for(e=0;e>>=0,e===0?32:31-(Mm(e)/Rm|0)|0}var Yo=64,Jo=4194304;function Ws(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Xo(e,t){var r=e.pendingLanes;if(r===0)return 0;var l=0,a=e.suspendedLanes,c=e.pingedLanes,p=r&268435455;if(p!==0){var y=p&~a;y!==0?l=Ws(y):(c&=p,c!==0&&(l=Ws(c)))}else p=r&~a,p!==0?l=Ws(p):c!==0&&(l=Ws(c));if(l===0)return 0;if(t!==0&&t!==l&&(t&a)===0&&(a=l&-l,c=t&-t,a>=c||a===16&&(c&4194240)!==0))return t;if((l&4)!==0&&(l|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0r;r++)t.push(e);return t}function Vs(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$t(t),e[t]=r}function Am(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0=Xs),Jc=" ",Xc=!1;function ed(e,t){switch(e){case"keyup":return ug.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function td(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gn=!1;function dg(e,t){switch(e){case"compositionend":return td(t);case"keypress":return t.which!==32?null:(Xc=!0,Jc);case"textInput":return e=t.data,e===Jc&&Xc?null:e;default:return null}}function fg(e,t){if(Gn)return e==="compositionend"||!qi&&ed(e,t)?(e=Gc(),sl=Hi=Mr=null,Gn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ad(r)}}function cd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dd(){for(var e=window,t=kr();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=kr(e.document)}return t}function Ji(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function wg(e){var t=dd(),r=e.focusedElem,l=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&cd(r.ownerDocument.documentElement,r)){if(l!==null&&Ji(r)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,c=Math.min(l.start,a);l=l.end===void 0?c:Math.min(l.end,a),!e.extend&&c>l&&(a=l,l=c,c=a),a=ud(r,c);var p=ud(r,l);a&&p&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),c>l?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Kn=null,Xi=null,no=null,ea=!1;function fd(e,t,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ea||Kn==null||Kn!==kr(l)||(l=Kn,"selectionStart"in l&&Ji(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),no&&ro(no,l)||(no=l,l=fl(Xi,"onSelect"),0Jn||(e.current=fa[Jn],fa[Jn]=null,Jn--)}function Fe(e,t){Jn++,fa[Jn]=e.current,e.current=t}var Tr={},it=Dr(Tr),gt=Dr(!1),cn=Tr;function Xn(e,t){var r=e.type.contextTypes;if(!r)return Tr;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var a={},c;for(c in r)a[c]=t[c];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function xt(e){return e=e.childContextTypes,e!=null}function gl(){$e(gt),$e(it)}function Ed(e,t,r){if(it.current!==Tr)throw Error(i(168));Fe(it,t),Fe(gt,r)}function Pd(e,t,r){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return r;l=l.getChildContext();for(var a in l)if(!(a in t))throw Error(i(108,pe(e)||"Unknown",a));return Z({},r,l)}function xl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Tr,cn=it.current,Fe(it,e),Fe(gt,gt.current),!0}function _d(e,t,r){var l=e.stateNode;if(!l)throw Error(i(169));r?(e=Pd(e,t,cn),l.__reactInternalMemoizedMergedChildContext=e,$e(gt),$e(it),Fe(it,e)):$e(gt),Fe(gt,r)}var dr=null,yl=!1,pa=!1;function Md(e){dr===null?dr=[e]:dr.push(e)}function Dg(e){yl=!0,Md(e)}function Ar(){if(!pa&&dr!==null){pa=!0;var e=0,t=ze;try{var r=dr;for(ze=1;e>=p,a-=p,fr=1<<32-$t(t)+a|r<je?(tt=xe,xe=null):tt=xe.sibling;var De=B(O,xe,T[je],q);if(De===null){xe===null&&(xe=tt);break}e&&xe&&De.alternate===null&&t(O,xe),E=c(De,E,je),ge===null?fe=De:ge.sibling=De,ge=De,xe=tt}if(je===T.length)return r(O,xe),He&&fn(O,je),fe;if(xe===null){for(;jeje?(tt=xe,xe=null):tt=xe.sibling;var Wr=B(O,xe,De.value,q);if(Wr===null){xe===null&&(xe=tt);break}e&&xe&&Wr.alternate===null&&t(O,xe),E=c(Wr,E,je),ge===null?fe=Wr:ge.sibling=Wr,ge=Wr,xe=tt}if(De.done)return r(O,xe),He&&fn(O,je),fe;if(xe===null){for(;!De.done;je++,De=T.next())De=V(O,De.value,q),De!==null&&(E=c(De,E,je),ge===null?fe=De:ge.sibling=De,ge=De);return He&&fn(O,je),fe}for(xe=l(O,xe);!De.done;je++,De=T.next())De=re(xe,O,je,De.value,q),De!==null&&(e&&De.alternate!==null&&xe.delete(De.key===null?je:De.key),E=c(De,E,je),ge===null?fe=De:ge.sibling=De,ge=De);return e&&xe.forEach(function(px){return t(O,px)}),He&&fn(O,je),fe}function qe(O,E,T,q){if(typeof T=="object"&&T!==null&&T.type===K&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case R:e:{for(var fe=T.key,ge=E;ge!==null;){if(ge.key===fe){if(fe=T.type,fe===K){if(ge.tag===7){r(O,ge.sibling),E=a(ge,T.props.children),E.return=O,O=E;break e}}else if(ge.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Te&&zd(fe)===ge.type){r(O,ge.sibling),E=a(ge,T.props),E.ref=uo(O,ge,T),E.return=O,O=E;break e}r(O,ge);break}else t(O,ge);ge=ge.sibling}T.type===K?(E=bn(T.props.children,O.mode,q,T.key),E.return=O,O=E):(q=Gl(T.type,T.key,T.props,null,O.mode,q),q.ref=uo(O,E,T),q.return=O,O=q)}return p(O);case F:e:{for(ge=T.key;E!==null;){if(E.key===ge)if(E.tag===4&&E.stateNode.containerInfo===T.containerInfo&&E.stateNode.implementation===T.implementation){r(O,E.sibling),E=a(E,T.children||[]),E.return=O,O=E;break e}else{r(O,E);break}else t(O,E);E=E.sibling}E=cu(T,O.mode,q),E.return=O,O=E}return p(O);case Te:return ge=T._init,qe(O,E,ge(T._payload),q)}if(Sr(T))return ae(O,E,T,q);if(ce(T))return de(O,E,T,q);jl(O,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,E!==null&&E.tag===6?(r(O,E.sibling),E=a(E,T),E.return=O,O=E):(r(O,E),E=uu(T,O.mode,q),E.return=O,O=E),p(O)):r(O,E)}return qe}var ns=Ld(!0),Id=Ld(!1),kl=Dr(null),Nl=null,ss=null,va=null;function ba(){va=ss=Nl=null}function wa(e){var t=kl.current;$e(kl),e._currentValue=t}function ja(e,t,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===r)break;e=e.return}}function os(e,t){Nl=e,va=ss=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(yt=!0),e.firstContext=null)}function At(e){var t=e._currentValue;if(va!==e)if(e={context:e,memoizedValue:t,next:null},ss===null){if(Nl===null)throw Error(i(308));ss=e,Nl.dependencies={lanes:0,firstContext:e}}else ss=ss.next=e;return t}var pn=null;function ka(e){pn===null?pn=[e]:pn.push(e)}function Fd(e,t,r,l){var a=t.interleaved;return a===null?(r.next=r,ka(t)):(r.next=a.next,a.next=r),t.interleaved=r,hr(e,l)}function hr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var zr=!1;function Na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ud(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function mr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Lr(e,t,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Re&2)!==0){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,hr(e,r)}return a=l.interleaved,a===null?(t.next=t,ka(l)):(t.next=a.next,a.next=t),l.interleaved=t,hr(e,r)}function Sl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,Ii(e,r)}}function $d(e,t){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var a=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var p={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};c===null?a=c=p:c=c.next=p,r=r.next}while(r!==null);c===null?a=c=t:c=c.next=t}else a=c=t;r={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:c,shared:l.shared,effects:l.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Cl(e,t,r,l){var a=e.updateQueue;zr=!1;var c=a.firstBaseUpdate,p=a.lastBaseUpdate,y=a.shared.pending;if(y!==null){a.shared.pending=null;var k=y,L=k.next;k.next=null,p===null?c=L:p.next=L,p=k;var W=e.alternate;W!==null&&(W=W.updateQueue,y=W.lastBaseUpdate,y!==p&&(y===null?W.firstBaseUpdate=L:y.next=L,W.lastBaseUpdate=k))}if(c!==null){var V=a.baseState;p=0,W=L=k=null,y=c;do{var B=y.lane,re=y.eventTime;if((l&B)===B){W!==null&&(W=W.next={eventTime:re,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var ae=e,de=y;switch(B=t,re=r,de.tag){case 1:if(ae=de.payload,typeof ae=="function"){V=ae.call(re,V,B);break e}V=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=de.payload,B=typeof ae=="function"?ae.call(re,V,B):ae,B==null)break e;V=Z({},V,B);break e;case 2:zr=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,B=a.effects,B===null?a.effects=[y]:B.push(y))}else re={eventTime:re,lane:B,tag:y.tag,payload:y.payload,callback:y.callback,next:null},W===null?(L=W=re,k=V):W=W.next=re,p|=B;if(y=y.next,y===null){if(y=a.shared.pending,y===null)break;B=y,y=B.next,B.next=null,a.lastBaseUpdate=B,a.shared.pending=null}}while(!0);if(W===null&&(k=V),a.baseState=k,a.firstBaseUpdate=L,a.lastBaseUpdate=W,t=a.shared.interleaved,t!==null){a=t;do p|=a.lane,a=a.next;while(a!==t)}else c===null&&(a.shared.lanes=0);gn|=p,e.lanes=p,e.memoizedState=V}}function Bd(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var l=_a.transition;_a.transition={};try{e(!1),t()}finally{ze=r,_a.transition=l}}function af(){return zt().memoizedState}function Lg(e,t,r){var l=$r(e);if(r={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null},uf(e))cf(t,r);else if(r=Fd(e,t,r,l),r!==null){var a=pt();Kt(r,e,l,a),df(r,t,l)}}function Ig(e,t,r){var l=$r(e),a={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null};if(uf(e))cf(t,a);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var p=t.lastRenderedState,y=c(p,r);if(a.hasEagerState=!0,a.eagerState=y,Bt(y,p)){var k=t.interleaved;k===null?(a.next=a,ka(t)):(a.next=k.next,k.next=a),t.interleaved=a;return}}catch{}finally{}r=Fd(e,t,a,l),r!==null&&(a=pt(),Kt(r,e,l,a),df(r,t,l))}}function uf(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function cf(e,t){ho=_l=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function df(e,t,r){if((r&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,Ii(e,r)}}var Ol={readContext:At,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useInsertionEffect:at,useLayoutEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useMutableSource:at,useSyncExternalStore:at,useId:at,unstable_isNewReconciler:!1},Fg={readContext:At,useCallback:function(e,t){return Xt().memoizedState=[e,t===void 0?null:t],e},useContext:At,useEffect:Xd,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Ml(4194308,4,rf.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Ml(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ml(4,2,e,t)},useMemo:function(e,t){var r=Xt();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var l=Xt();return t=r!==void 0?r(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=Lg.bind(null,Ve,e),[l.memoizedState,e]},useRef:function(e){var t=Xt();return e={current:e},t.memoizedState=e},useState:Yd,useDebugValue:za,useDeferredValue:function(e){return Xt().memoizedState=e},useTransition:function(){var e=Yd(!1),t=e[0];return e=zg.bind(null,e[1]),Xt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var l=Ve,a=Xt();if(He){if(r===void 0)throw Error(i(407));r=r()}else{if(r=t(),et===null)throw Error(i(349));(mn&30)!==0||Gd(l,t,r)}a.memoizedState=r;var c={value:r,getSnapshot:t};return a.queue=c,Xd(Qd.bind(null,l,c,e),[e]),l.flags|=2048,xo(9,Kd.bind(null,l,c,r,t),void 0,null),r},useId:function(){var e=Xt(),t=et.identifierPrefix;if(He){var r=pr,l=fr;r=(l&~(1<<32-$t(l)-1)).toString(32)+r,t=":"+t+"R"+r,r=mo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=p.createElement(r,{is:l.is}):(e=p.createElement(r),r==="select"&&(p=e,l.multiple?p.multiple=!0:l.size&&(p.size=l.size))):e=p.createElementNS(e,r),e[Yt]=t,e[io]=l,Rf(e,t,!1,!1),t.stateNode=e;e:{switch(p=Pi(r,l),r){case"dialog":Ue("cancel",e),Ue("close",e),a=l;break;case"iframe":case"object":case"embed":Ue("load",e),a=l;break;case"video":case"audio":for(a=0;acs&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304)}else{if(!l)if(e=El(p),e!==null){if(t.flags|=128,l=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),yo(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!He)return ut(t),null}else 2*Qe()-c.renderingStartTime>cs&&r!==1073741824&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304);c.isBackwards?(p.sibling=t.child,t.child=p):(r=c.last,r!==null?r.sibling=p:t.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Qe(),t.sibling=null,r=We.current,Fe(We,l?r&1|2:r&1),t):(ut(t),null);case 22:case 23:return lu(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(_t&1073741824)!==0&&(ut(t),t.subtreeFlags&6&&(t.flags|=8192)):ut(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Kg(e,t){switch(ma(t),t.tag){case 1:return xt(t.type)&&gl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ls(),$e(gt),$e(it),Pa(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ca(t),null;case 13:if($e(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));rs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(We),null;case 4:return ls(),null;case 10:return wa(t.type._context),null;case 22:case 23:return lu(),null;case 24:return null;default:return null}}var zl=!1,ct=!1,Qg=typeof WeakSet=="function"?WeakSet:Set,le=null;function as(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(l){Ge(e,t,l)}else r.current=null}function Qa(e,t,r){try{r()}catch(l){Ge(e,t,l)}}var Tf=!1;function qg(e,t){if(la=rl,e=dd(),Ji(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var a=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{r.nodeType,c.nodeType}catch{r=null;break e}var p=0,y=-1,k=-1,L=0,W=0,V=e,B=null;t:for(;;){for(var re;V!==r||a!==0&&V.nodeType!==3||(y=p+a),V!==c||l!==0&&V.nodeType!==3||(k=p+l),V.nodeType===3&&(p+=V.nodeValue.length),(re=V.firstChild)!==null;)B=V,V=re;for(;;){if(V===e)break t;if(B===r&&++L===a&&(y=p),B===c&&++W===l&&(k=p),(re=V.nextSibling)!==null)break;V=B,B=V.parentNode}V=re}r=y===-1||k===-1?null:{start:y,end:k}}else r=null}r=r||{start:0,end:0}}else r=null;for(ia={focusedElem:e,selectionRange:r},rl=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ae=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ae!==null){var de=ae.memoizedProps,qe=ae.memoizedState,O=t.stateNode,E=O.getSnapshotBeforeUpdate(t.elementType===t.type?de:Wt(t.type,de),qe);O.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var T=t.stateNode.containerInfo;T.nodeType===1?T.textContent="":T.nodeType===9&&T.documentElement&&T.removeChild(T.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(q){Ge(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ae=Tf,Tf=!1,ae}function vo(e,t,r){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var a=l=l.next;do{if((a.tag&e)===e){var c=a.destroy;a.destroy=void 0,c!==void 0&&Qa(t,r,c)}a=a.next}while(a!==l)}}function Ll(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var l=r.create;r.destroy=l()}r=r.next}while(r!==t)}}function qa(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Af(e){var t=e.alternate;t!==null&&(e.alternate=null,Af(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Yt],delete t[io],delete t[da],delete t[Rg],delete t[Og])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function zf(e){return e.tag===5||e.tag===3||e.tag===4}function Lf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Za(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=hl));else if(l!==4&&(e=e.child,e!==null))for(Za(e,t,r),e=e.sibling;e!==null;)Za(e,t,r),e=e.sibling}function Ya(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(Ya(e,t,r),e=e.sibling;e!==null;)Ya(e,t,r),e=e.sibling}var nt=null,Vt=!1;function Ir(e,t,r){for(r=r.child;r!==null;)If(e,t,r),r=r.sibling}function If(e,t,r){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(Zo,r)}catch{}switch(r.tag){case 5:ct||as(r,t);case 6:var l=nt,a=Vt;nt=null,Ir(e,t,r),nt=l,Vt=a,nt!==null&&(Vt?(e=nt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):nt.removeChild(r.stateNode));break;case 18:nt!==null&&(Vt?(e=nt,r=r.stateNode,e.nodeType===8?ca(e.parentNode,r):e.nodeType===1&&ca(e,r),Zs(e)):ca(nt,r.stateNode));break;case 4:l=nt,a=Vt,nt=r.stateNode.containerInfo,Vt=!0,Ir(e,t,r),nt=l,Vt=a;break;case 0:case 11:case 14:case 15:if(!ct&&(l=r.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){a=l=l.next;do{var c=a,p=c.destroy;c=c.tag,p!==void 0&&((c&2)!==0||(c&4)!==0)&&Qa(r,t,p),a=a.next}while(a!==l)}Ir(e,t,r);break;case 1:if(!ct&&(as(r,t),l=r.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=r.memoizedProps,l.state=r.memoizedState,l.componentWillUnmount()}catch(y){Ge(r,t,y)}Ir(e,t,r);break;case 21:Ir(e,t,r);break;case 22:r.mode&1?(ct=(l=ct)||r.memoizedState!==null,Ir(e,t,r),ct=l):Ir(e,t,r);break;default:Ir(e,t,r)}}function Ff(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Qg),t.forEach(function(l){var a=sx.bind(null,e,l);r.has(l)||(r.add(l),l.then(a,a))})}}function Gt(e,t){var r=t.deletions;if(r!==null)for(var l=0;la&&(a=p),l&=~c}if(l=a,l=Qe()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Yg(l/1960))-l,10e?16:e,Ur===null)var l=!1;else{if(e=Ur,Ur=null,Bl=0,(Re&6)!==0)throw Error(i(331));var a=Re;for(Re|=4,le=e.current;le!==null;){var c=le,p=c.child;if((le.flags&16)!==0){var y=c.deletions;if(y!==null){for(var k=0;kQe()-eu?yn(e,0):Xa|=r),bt(e,t)}function Jf(e,t){t===0&&((e.mode&1)===0?t=1:(t=Jo,Jo<<=1,(Jo&130023424)===0&&(Jo=4194304)));var r=pt();e=hr(e,t),e!==null&&(Vs(e,t,r),bt(e,r))}function nx(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Jf(e,r)}function sx(e,t){var r=0;switch(e.tag){case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(i(314))}l!==null&&l.delete(t),Jf(e,r)}var Xf;Xf=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||gt.current)yt=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return yt=!1,Vg(e,t,r);yt=(e.flags&131072)!==0}else yt=!1,He&&(t.flags&1048576)!==0&&Rd(t,bl,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Al(e,t),e=t.pendingProps;var a=Xn(t,it.current);os(t,r),a=Ra(null,t,l,e,a,r);var c=Oa();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xt(l)?(c=!0,xl(t)):c=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Na(t),a.updater=Dl,t.stateNode=a,a._reactInternals=t,Ia(t,l,e,r),t=Ba(null,t,l,!0,c,r)):(t.tag=0,He&&c&&ha(t),ft(null,t,a,r),t=t.child),t;case 16:l=t.elementType;e:{switch(Al(e,t),e=t.pendingProps,a=l._init,l=a(l._payload),t.type=l,a=t.tag=lx(l),e=Wt(l,e),a){case 0:t=$a(null,t,l,e,r);break e;case 1:t=Sf(null,t,l,e,r);break e;case 11:t=bf(null,t,l,e,r);break e;case 14:t=wf(null,t,l,Wt(l.type,e),r);break e}throw Error(i(306,l,""))}return t;case 0:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),$a(e,t,l,a,r);case 1:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),Sf(e,t,l,a,r);case 3:e:{if(Cf(t),e===null)throw Error(i(387));l=t.pendingProps,c=t.memoizedState,a=c.element,Ud(e,t),Cl(t,l,null,r);var p=t.memoizedState;if(l=p.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){a=is(Error(i(423)),t),t=Ef(e,t,l,r,a);break e}else if(l!==a){a=is(Error(i(424)),t),t=Ef(e,t,l,r,a);break e}else for(Pt=Or(t.stateNode.containerInfo.firstChild),Et=t,He=!0,Ht=null,r=Id(t,null,l,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(rs(),l===a){t=gr(e,t,r);break e}ft(e,t,l,r)}t=t.child}return t;case 5:return Hd(t),e===null&&xa(t),l=t.type,a=t.pendingProps,c=e!==null?e.memoizedProps:null,p=a.children,aa(l,a)?p=null:c!==null&&aa(l,c)&&(t.flags|=32),Nf(e,t),ft(e,t,p,r),t.child;case 6:return e===null&&xa(t),null;case 13:return Pf(e,t,r);case 4:return Sa(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ns(t,null,l,r):ft(e,t,l,r),t.child;case 11:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),bf(e,t,l,a,r);case 7:return ft(e,t,t.pendingProps,r),t.child;case 8:return ft(e,t,t.pendingProps.children,r),t.child;case 12:return ft(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(l=t.type._context,a=t.pendingProps,c=t.memoizedProps,p=a.value,Fe(kl,l._currentValue),l._currentValue=p,c!==null)if(Bt(c.value,p)){if(c.children===a.children&&!gt.current){t=gr(e,t,r);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var y=c.dependencies;if(y!==null){p=c.child;for(var k=y.firstContext;k!==null;){if(k.context===l){if(c.tag===1){k=mr(-1,r&-r),k.tag=2;var L=c.updateQueue;if(L!==null){L=L.shared;var W=L.pending;W===null?k.next=k:(k.next=W.next,W.next=k),L.pending=k}}c.lanes|=r,k=c.alternate,k!==null&&(k.lanes|=r),ja(c.return,r,t),y.lanes|=r;break}k=k.next}}else if(c.tag===10)p=c.type===t.type?null:c.child;else if(c.tag===18){if(p=c.return,p===null)throw Error(i(341));p.lanes|=r,y=p.alternate,y!==null&&(y.lanes|=r),ja(p,r,t),p=c.sibling}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===t){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}ft(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,l=t.pendingProps.children,os(t,r),a=At(a),l=l(a),t.flags|=1,ft(e,t,l,r),t.child;case 14:return l=t.type,a=Wt(l,t.pendingProps),a=Wt(l.type,a),wf(e,t,l,a,r);case 15:return jf(e,t,t.type,t.pendingProps,r);case 17:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),Al(e,t),t.tag=1,xt(l)?(e=!0,xl(t)):e=!1,os(t,r),pf(t,l,a),Ia(t,l,a,r),Ba(null,t,l,!0,e,r);case 19:return Mf(e,t,r);case 22:return kf(e,t,r)}throw Error(i(156,t.tag))};function ep(e,t){return Oc(e,t)}function ox(e,t,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function It(e,t,r,l){return new ox(e,t,r,l)}function au(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lx(e){if(typeof e=="function")return au(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===Oe)return 14}return 2}function Hr(e,t){var r=e.alternate;return r===null?(r=It(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Gl(e,t,r,l,a,c){var p=2;if(l=e,typeof e=="function")au(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case K:return bn(r.children,a,c,t);case ne:p=8,a|=8;break;case ee:return e=It(12,r,t,a|2),e.elementType=ee,e.lanes=c,e;case Le:return e=It(13,r,t,a),e.elementType=Le,e.lanes=c,e;case _e:return e=It(19,r,t,a),e.elementType=_e,e.lanes=c,e;case Me:return Kl(r,a,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J:p=10;break e;case ke:p=9;break e;case ue:p=11;break e;case Oe:p=14;break e;case Te:p=16,l=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=It(p,r,t,a),t.elementType=e,t.type=l,t.lanes=c,t}function bn(e,t,r,l){return e=It(7,e,l,t),e.lanes=r,e}function Kl(e,t,r,l){return e=It(22,e,l,t),e.elementType=Me,e.lanes=r,e.stateNode={isHidden:!1},e}function uu(e,t,r){return e=It(6,e,null,t),e.lanes=r,e}function cu(e,t,r){return t=It(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ix(e,t,r,l,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Li(0),this.expirationTimes=Li(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Li(0),this.identifierPrefix=l,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function du(e,t,r,l,a,c,p,y,k){return e=new ix(e,t,r,y,k),t===1?(t=1,c===!0&&(t|=8)):t=0,c=It(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:l,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Na(c),e}function ax(e,t,r){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),yu.exports=bx(),yu.exports}var mp;function wx(){if(mp)return ti;mp=1;var s=dh();return ti.createRoot=s.createRoot,ti.hydrateRoot=s.hydrateRoot,ti}var jx=wx();const kx=uh(jx);var Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Nn,qr,bs,Xp,Nx=(Xp=class extends Ho{constructor(){super();ye(this,Nn);ye(this,qr);ye(this,bs);se(this,bs,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){S(this,qr)||this.setEventListener(S(this,bs))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,qr))==null||o.call(this),se(this,qr,void 0))}setEventListener(o){var i;se(this,bs,o),(i=S(this,qr))==null||i.call(this),se(this,qr,o(u=>{typeof u=="boolean"?this.setFocused(u):this.onFocus()}))}setFocused(o){S(this,Nn)!==o&&(se(this,Nn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(i=>{i(o)})}isFocused(){var o;return typeof S(this,Nn)=="boolean"?S(this,Nn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},Nn=new WeakMap,qr=new WeakMap,bs=new WeakMap,Xp),ac=new Nx,Sx={setTimeout:(s,o)=>setTimeout(s,o),clearTimeout:s=>clearTimeout(s),setInterval:(s,o)=>setInterval(s,o),clearInterval:s=>clearInterval(s)},Zr,oc,eh,Cx=(eh=class{constructor(){ye(this,Zr,Sx);ye(this,oc,!1)}setTimeoutProvider(s){se(this,Zr,s)}setTimeout(s,o){return S(this,Zr).setTimeout(s,o)}clearTimeout(s){S(this,Zr).clearTimeout(s)}setInterval(s,o){return S(this,Zr).setInterval(s,o)}clearInterval(s){S(this,Zr).clearInterval(s)}},Zr=new WeakMap,oc=new WeakMap,eh),kn=new Cx;function Ex(s){setTimeout(s,0)}var Px=typeof window>"u"||"Deno"in globalThis;function kt(){}function _x(s,o){return typeof s=="function"?s(o):s}function Du(s){return typeof s=="number"&&s>=0&&s!==1/0}function fh(s,o){return Math.max(s+(o||0)-Date.now(),0)}function nn(s,o){return typeof s=="function"?s(o):s}function Rt(s,o){return typeof s=="function"?s(o):s}function gp(s,o){const{type:i="all",exact:u,fetchStatus:d,predicate:f,queryKey:m,stale:h}=s;if(m){if(u){if(o.queryHash!==uc(m,o.options))return!1}else if(!Mo(o.queryKey,m))return!1}if(i!=="all"){const v=o.isActive();if(i==="active"&&!v||i==="inactive"&&v)return!1}return!(typeof h=="boolean"&&o.isStale()!==h||d&&d!==o.state.fetchStatus||f&&!f(o))}function xp(s,o){const{exact:i,status:u,predicate:d,mutationKey:f}=s;if(f){if(!o.options.mutationKey)return!1;if(i){if(_o(o.options.mutationKey)!==_o(f))return!1}else if(!Mo(o.options.mutationKey,f))return!1}return!(u&&o.state.status!==u||d&&!d(o))}function uc(s,o){return((o==null?void 0:o.queryKeyHashFn)||_o)(s)}function _o(s){return JSON.stringify(s,(o,i)=>Au(i)?Object.keys(i).sort().reduce((u,d)=>(u[d]=i[d],u),{}):i)}function Mo(s,o){return s===o?!0:typeof s!=typeof o?!1:s&&o&&typeof s=="object"&&typeof o=="object"?Object.keys(o).every(i=>Mo(s[i],o[i])):!1}var Mx=Object.prototype.hasOwnProperty;function ph(s,o,i=0){if(s===o)return s;if(i>500)return o;const u=yp(s)&&yp(o);if(!u&&!(Au(s)&&Au(o)))return o;const f=(u?s:Object.keys(s)).length,m=u?o:Object.keys(o),h=m.length,v=u?new Array(h):{};let x=0;for(let b=0;b{kn.setTimeout(o,s)})}function zu(s,o,i){return typeof i.structuralSharing=="function"?i.structuralSharing(s,o):i.structuralSharing!==!1?ph(s,o):o}function Ox(s,o,i=0){const u=[...s,o];return i&&u.length>i?u.slice(1):u}function Dx(s,o,i=0){const u=[o,...s];return i&&u.length>i?u.slice(0,-1):u}var cc=Symbol();function hh(s,o){return!s.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!s.queryFn||s.queryFn===cc?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function mh(s,o){return typeof s=="function"?s(...o):!!s}function Tx(s,o,i){let u=!1,d;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(d??(d=o()),u||(u=!0,d.aborted?i():d.addEventListener("abort",i,{once:!0})),d)}),s}var Ro=(()=>{let s=()=>Px;return{isServer(){return s()},setIsServer(o){s=o}}})();function Lu(){let s,o;const i=new Promise((d,f)=>{s=d,o=f});i.status="pending",i.catch(()=>{});function u(d){Object.assign(i,d),delete i.resolve,delete i.reject}return i.resolve=d=>{u({status:"fulfilled",value:d}),s(d)},i.reject=d=>{u({status:"rejected",reason:d}),o(d)},i}var Ax=Ex;function zx(){let s=[],o=0,i=h=>{h()},u=h=>{h()},d=Ax;const f=h=>{o?s.push(h):d(()=>{i(h)})},m=()=>{const h=s;s=[],h.length&&d(()=>{u(()=>{h.forEach(v=>{i(v)})})})};return{batch:h=>{let v;o++;try{v=h()}finally{o--,o||m()}return v},batchCalls:h=>(...v)=>{f(()=>{h(...v)})},schedule:f,setNotifyFunction:h=>{i=h},setBatchNotifyFunction:h=>{u=h},setScheduler:h=>{d=h}}}var ot=zx(),ws,Yr,js,th,Lx=(th=class extends Ho{constructor(){super();ye(this,ws,!0);ye(this,Yr);ye(this,js);se(this,js,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o(!0),u=()=>o(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",u,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",u)}}})}onSubscribe(){S(this,Yr)||this.setEventListener(S(this,js))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,Yr))==null||o.call(this),se(this,Yr,void 0))}setEventListener(o){var i;se(this,js,o),(i=S(this,Yr))==null||i.call(this),se(this,Yr,o(this.setOnline.bind(this)))}setOnline(o){S(this,ws)!==o&&(se(this,ws,o),this.listeners.forEach(u=>{u(o)}))}isOnline(){return S(this,ws)}},ws=new WeakMap,Yr=new WeakMap,js=new WeakMap,th),mi=new Lx;function Ix(s){return Math.min(1e3*2**s,3e4)}function gh(s){return(s??"online")==="online"?mi.isOnline():!0}var Iu=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function xh(s){let o=!1,i=0,u;const d=Lu(),f=()=>d.status!=="pending",m=w=>{var C;if(!f()){const _=new Iu(w);M(_),(C=s.onCancel)==null||C.call(s,_)}},h=()=>{o=!0},v=()=>{o=!1},x=()=>ac.isFocused()&&(s.networkMode==="always"||mi.isOnline())&&s.canRun(),b=()=>gh(s.networkMode)&&s.canRun(),j=w=>{f()||(u==null||u(),d.resolve(w))},M=w=>{f()||(u==null||u(),d.reject(w))},D=()=>new Promise(w=>{var C;u=_=>{(f()||x())&&w(_)},(C=s.onPause)==null||C.call(s)}).then(()=>{var w;u=void 0,f()||(w=s.onContinue)==null||w.call(s)}),I=()=>{if(f())return;let w;const C=i===0?s.initialPromise:void 0;try{w=C??s.fn()}catch(_){w=Promise.reject(_)}Promise.resolve(w).then(j).catch(_=>{var F;if(f())return;const $=s.retry??(Ro.isServer()?0:3),H=s.retryDelay??Ix,z=typeof H=="function"?H(i,_):H,R=$===!0||typeof $=="number"&&i<$||typeof $=="function"&&$(i,_);if(o||!R){M(_);return}i++,(F=s.onFail)==null||F.call(s,i,_),Rx(z).then(()=>x()?void 0:D()).then(()=>{o?M(_):I()})})};return{promise:d,status:()=>d.status,cancel:m,continue:()=>(u==null||u(),d),cancelRetry:h,continueRetry:v,canStart:b,start:()=>(b()?I():D().then(I),d)}}var Sn,rh,yh=(rh=class{constructor(){ye(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Du(this.gcTime)&&se(this,Sn,kn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Ro.isServer()?1/0:300*1e3))}clearGcTimeout(){S(this,Sn)!==void 0&&(kn.clearTimeout(S(this,Sn)),se(this,Sn,void 0))}},Sn=new WeakMap,rh);function Fx(s){return{onFetch:(o,i)=>{var b,j,M,D,I;const u=o.options,d=(M=(j=(b=o.fetchOptions)==null?void 0:b.meta)==null?void 0:j.fetchMore)==null?void 0:M.direction,f=((D=o.state.data)==null?void 0:D.pages)||[],m=((I=o.state.data)==null?void 0:I.pageParams)||[];let h={pages:[],pageParams:[]},v=0;const x=async()=>{let w=!1;const C=H=>{Tx(H,()=>o.signal,()=>w=!0)},_=hh(o.options,o.fetchOptions),$=async(H,z,R)=>{if(w)return Promise.reject(o.signal.reason);if(z==null&&H.pages.length)return Promise.resolve(H);const K=(()=>{const ke={client:o.client,queryKey:o.queryKey,pageParam:z,direction:R?"backward":"forward",meta:o.options.meta};return C(ke),ke})(),ne=await _(K),{maxPages:ee}=o.options,J=R?Dx:Ox;return{pages:J(H.pages,ne,ee),pageParams:J(H.pageParams,z,ee)}};if(d&&f.length){const H=d==="backward",z=H?Ux:bp,R={pages:f,pageParams:m},F=z(u,R);h=await $(R,F,H)}else{const H=s??f.length;do{const z=v===0?m[0]??u.initialPageParam:bp(u,h);if(v>0&&z==null)break;h=await $(h,z),v++}while(v{var w,C;return(C=(w=o.options).persister)==null?void 0:C.call(w,x,{client:o.client,queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},i)}:o.fetchFn=x}}}function bp(s,{pages:o,pageParams:i}){const u=o.length-1;return o.length>0?s.getNextPageParam(o[u],o,i[u],i):void 0}function Ux(s,{pages:o,pageParams:i}){var u;return o.length>0?(u=s.getPreviousPageParam)==null?void 0:u.call(s,o[0],o,i[0],i):void 0}var ks,Cn,Ns,Ft,En,rt,Io,Pn,Mt,vh,vr,nh,$x=(nh=class extends yh{constructor(o){super();ye(this,Mt);ye(this,ks);ye(this,Cn);ye(this,Ns);ye(this,Ft);ye(this,En);ye(this,rt);ye(this,Io);ye(this,Pn);se(this,Pn,!1),se(this,Io,o.defaultOptions),this.setOptions(o.options),this.observers=[],se(this,En,o.client),se(this,Ft,S(this,En).getQueryCache()),this.queryKey=o.queryKey,this.queryHash=o.queryHash,se(this,Cn,jp(this.options)),this.state=o.state??S(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return S(this,ks)}get promise(){var o;return(o=S(this,rt))==null?void 0:o.promise}setOptions(o){if(this.options={...S(this,Io),...o},o!=null&&o._type&&se(this,ks,o._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=jp(this.options);i.data!==void 0&&(this.setState(wp(i.data,i.dataUpdatedAt)),se(this,Cn,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,Ft).remove(this)}setData(o,i){const u=zu(this.state.data,o,this.options);return Ce(this,Mt,vr).call(this,{data:u,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),u}setState(o){Ce(this,Mt,vr).call(this,{type:"setState",state:o})}cancel(o){var u,d;const i=(u=S(this,rt))==null?void 0:u.promise;return(d=S(this,rt))==null||d.cancel(o),i?i.then(kt).catch(kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return S(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(o=>Rt(o.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cc||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(o=>nn(o.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(o=>o.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(o=0){return this.state.data===void 0?!0:o==="static"?!1:this.state.isInvalidated?!0:!fh(this.state.dataUpdatedAt,o)}onFocus(){var i;const o=this.observers.find(u=>u.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,rt))==null||i.continue()}onOnline(){var i;const o=this.observers.find(u=>u.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,rt))==null||i.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),S(this,Ft).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(i=>i!==o),this.observers.length||(S(this,rt)&&(S(this,Pn)||Ce(this,Mt,vh).call(this)?S(this,rt).cancel({revert:!0}):S(this,rt).cancelRetry()),this.scheduleGc()),S(this,Ft).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ce(this,Mt,vr).call(this,{type:"invalidate"})}async fetch(o,i){var x,b,j,M,D,I,w,C,_,$,H;if(this.state.fetchStatus!=="idle"&&((x=S(this,rt))==null?void 0:x.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(S(this,rt))return S(this,rt).continueRetry(),S(this,rt).promise}if(o&&this.setOptions(o),!this.options.queryFn){const z=this.observers.find(R=>R.options.queryFn);z&&this.setOptions(z.options)}const u=new AbortController,d=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(se(this,Pn,!0),u.signal)})},f=()=>{const z=hh(this.options,i),F=(()=>{const K={client:S(this,En),queryKey:this.queryKey,meta:this.meta};return d(K),K})();return se(this,Pn,!1),this.options.persister?this.options.persister(z,F,this):z(F)},h=(()=>{const z={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:S(this,En),state:this.state,fetchFn:f};return d(z),z})(),v=S(this,ks)==="infinite"?Fx(this.options.pages):this.options.behavior;v==null||v.onFetch(h,this),se(this,Ns,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=h.fetchOptions)==null?void 0:b.meta))&&Ce(this,Mt,vr).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta}),se(this,rt,xh({initialPromise:i==null?void 0:i.initialPromise,fn:h.fetchFn,onCancel:z=>{z instanceof Iu&&z.revert&&this.setState({...S(this,Ns),fetchStatus:"idle"}),u.abort()},onFail:(z,R)=>{Ce(this,Mt,vr).call(this,{type:"failed",failureCount:z,error:R})},onPause:()=>{Ce(this,Mt,vr).call(this,{type:"pause"})},onContinue:()=>{Ce(this,Mt,vr).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const z=await S(this,rt).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(D=(M=S(this,Ft).config).onSuccess)==null||D.call(M,z,this),(w=(I=S(this,Ft).config).onSettled)==null||w.call(I,z,this.state.error,this),z}catch(z){if(z instanceof Iu){if(z.silent)return S(this,rt).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw Ce(this,Mt,vr).call(this,{type:"error",error:z}),(_=(C=S(this,Ft).config).onError)==null||_.call(C,z,this),(H=($=S(this,Ft).config).onSettled)==null||H.call($,this.state.data,z,this),z}finally{this.scheduleGc()}}},ks=new WeakMap,Cn=new WeakMap,Ns=new WeakMap,Ft=new WeakMap,En=new WeakMap,rt=new WeakMap,Io=new WeakMap,Pn=new WeakMap,Mt=new WeakSet,vh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},vr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...u,fetchStatus:"paused"};case"continue":return{...u,fetchStatus:"fetching"};case"fetch":return{...u,...bh(u.data,this.options),fetchMeta:o.meta??null};case"success":const d={...u,...wp(o.data,o.dataUpdatedAt),dataUpdateCount:u.dataUpdateCount+1,...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return se(this,Ns,o.manual?d:void 0),d;case"error":const f=o.error;return{...u,error:f,errorUpdateCount:u.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:u.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...u,isInvalidated:!0};case"setState":return{...u,...o.state}}};this.state=i(this.state),ot.batch(()=>{this.observers.forEach(u=>{u.onQueryUpdate()}),S(this,Ft).notify({query:this,type:"updated",action:o})})},nh);function bh(s,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gh(o.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function wp(s,o){return{data:s,dataUpdatedAt:o??Date.now(),error:null,isInvalidated:!1,status:"success"}}function jp(s){const o=typeof s.initialData=="function"?s.initialData():s.initialData,i=o!==void 0,u=i?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:i?u??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var jt,Pe,Fo,ht,_n,Ss,br,Jr,Uo,Cs,Es,Mn,Rn,Xr,Ps,Ae,Po,Fu,Uu,$u,Bu,Hu,Wu,Vu,wh,sh,Bx=(sh=class extends Ho{constructor(o,i){super();ye(this,Ae);ye(this,jt);ye(this,Pe);ye(this,Fo);ye(this,ht);ye(this,_n);ye(this,Ss);ye(this,br);ye(this,Jr);ye(this,Uo);ye(this,Cs);ye(this,Es);ye(this,Mn);ye(this,Rn);ye(this,Xr);ye(this,Ps,new Set);this.options=i,se(this,jt,o),se(this,Jr,null),se(this,br,Lu()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(S(this,Pe).addObserver(this),kp(S(this,Pe),this.options)?Ce(this,Ae,Po).call(this):this.updateResult(),Ce(this,Ae,Bu).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gu(S(this,Pe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gu(S(this,Pe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ce(this,Ae,Hu).call(this),Ce(this,Ae,Wu).call(this),S(this,Pe).removeObserver(this)}setOptions(o){const i=this.options,u=S(this,Pe);if(this.options=S(this,jt).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,S(this,Pe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ce(this,Ae,Vu).call(this),S(this,Pe).setOptions(this.options),i._defaulted&&!Tu(this.options,i)&&S(this,jt).getQueryCache().notify({type:"observerOptionsUpdated",query:S(this,Pe),observer:this});const d=this.hasListeners();d&&Np(S(this,Pe),u,this.options,i)&&Ce(this,Ae,Po).call(this),this.updateResult(),d&&(S(this,Pe)!==u||Rt(this.options.enabled,S(this,Pe))!==Rt(i.enabled,S(this,Pe))||nn(this.options.staleTime,S(this,Pe))!==nn(i.staleTime,S(this,Pe)))&&Ce(this,Ae,Fu).call(this);const f=Ce(this,Ae,Uu).call(this);d&&(S(this,Pe)!==u||Rt(this.options.enabled,S(this,Pe))!==Rt(i.enabled,S(this,Pe))||f!==S(this,Xr))&&Ce(this,Ae,$u).call(this,f)}getOptimisticResult(o){const i=S(this,jt).getQueryCache().build(S(this,jt),o),u=this.createResult(i,o);return Wx(this,u)&&(se(this,ht,u),se(this,Ss,this.options),se(this,_n,S(this,Pe).state)),u}getCurrentResult(){return S(this,ht)}trackResult(o,i){return new Proxy(o,{get:(u,d)=>(this.trackProp(d),i==null||i(d),d==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&S(this,br).status==="pending"&&S(this,br).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(u,d))})}trackProp(o){S(this,Ps).add(o)}getCurrentQuery(){return S(this,Pe)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const i=S(this,jt).defaultQueryOptions(o),u=S(this,jt).getQueryCache().build(S(this,jt),i);return u.fetch().then(()=>this.createResult(u,i))}fetch(o){return Ce(this,Ae,Po).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),S(this,ht)))}createResult(o,i){var ee;const u=S(this,Pe),d=this.options,f=S(this,ht),m=S(this,_n),h=S(this,Ss),x=o!==u?o.state:S(this,Fo),{state:b}=o;let j={...b},M=!1,D;if(i._optimisticResults){const J=this.hasListeners(),ke=!J&&kp(o,i),ue=J&&Np(o,u,i,d);(ke||ue)&&(j={...j,...bh(b.data,o.options)}),i._optimisticResults==="isRestoring"&&(j.fetchStatus="idle")}let{error:I,errorUpdatedAt:w,status:C}=j;D=j.data;let _=!1;if(i.placeholderData!==void 0&&D===void 0&&C==="pending"){let J;f!=null&&f.isPlaceholderData&&i.placeholderData===(h==null?void 0:h.placeholderData)?(J=f.data,_=!0):J=typeof i.placeholderData=="function"?i.placeholderData((ee=S(this,Es))==null?void 0:ee.state.data,S(this,Es)):i.placeholderData,J!==void 0&&(C="success",D=zu(f==null?void 0:f.data,J,i),M=!0)}if(i.select&&D!==void 0&&!_)if(f&&D===(m==null?void 0:m.data)&&i.select===S(this,Uo))D=S(this,Cs);else try{se(this,Uo,i.select),D=i.select(D),D=zu(f==null?void 0:f.data,D,i),se(this,Cs,D),se(this,Jr,null)}catch(J){se(this,Jr,J)}S(this,Jr)&&(I=S(this,Jr),D=S(this,Cs),w=Date.now(),C="error");const $=j.fetchStatus==="fetching",H=C==="pending",z=C==="error",R=H&&$,F=D!==void 0,ne={status:C,fetchStatus:j.fetchStatus,isPending:H,isSuccess:C==="success",isError:z,isInitialLoading:R,isLoading:R,data:D,dataUpdatedAt:j.dataUpdatedAt,error:I,errorUpdatedAt:w,failureCount:j.fetchFailureCount,failureReason:j.fetchFailureReason,errorUpdateCount:j.errorUpdateCount,isFetched:o.isFetched(),isFetchedAfterMount:j.dataUpdateCount>x.dataUpdateCount||j.errorUpdateCount>x.errorUpdateCount,isFetching:$,isRefetching:$&&!H,isLoadingError:z&&!F,isPaused:j.fetchStatus==="paused",isPlaceholderData:M,isRefetchError:z&&F,isStale:dc(o,i),refetch:this.refetch,promise:S(this,br),isEnabled:Rt(i.enabled,o)!==!1};if(this.options.experimental_prefetchInRender){const J=ne.data!==void 0,ke=ne.status==="error"&&!J,ue=Oe=>{ke?Oe.reject(ne.error):J&&Oe.resolve(ne.data)},Le=()=>{const Oe=se(this,br,ne.promise=Lu());ue(Oe)},_e=S(this,br);switch(_e.status){case"pending":o.queryHash===u.queryHash&&ue(_e);break;case"fulfilled":(ke||ne.data!==_e.value)&&Le();break;case"rejected":(!ke||ne.error!==_e.reason)&&Le();break}}return ne}updateResult(){const o=S(this,ht),i=this.createResult(S(this,Pe),this.options);if(se(this,_n,S(this,Pe).state),se(this,Ss,this.options),S(this,_n).data!==void 0&&se(this,Es,S(this,Pe)),Tu(i,o))return;se(this,ht,i);const u=()=>{if(!o)return!0;const{notifyOnChangeProps:d}=this.options,f=typeof d=="function"?d():d;if(f==="all"||!f&&!S(this,Ps).size)return!0;const m=new Set(f??S(this,Ps));return this.options.throwOnError&&m.add("error"),Object.keys(S(this,ht)).some(h=>{const v=h;return S(this,ht)[v]!==o[v]&&m.has(v)})};Ce(this,Ae,wh).call(this,{listeners:u()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ce(this,Ae,Bu).call(this)}},jt=new WeakMap,Pe=new WeakMap,Fo=new WeakMap,ht=new WeakMap,_n=new WeakMap,Ss=new WeakMap,br=new WeakMap,Jr=new WeakMap,Uo=new WeakMap,Cs=new WeakMap,Es=new WeakMap,Mn=new WeakMap,Rn=new WeakMap,Xr=new WeakMap,Ps=new WeakMap,Ae=new WeakSet,Po=function(o){Ce(this,Ae,Vu).call(this);let i=S(this,Pe).fetch(this.options,o);return o!=null&&o.throwOnError||(i=i.catch(kt)),i},Fu=function(){Ce(this,Ae,Hu).call(this);const o=nn(this.options.staleTime,S(this,Pe));if(Ro.isServer()||S(this,ht).isStale||!Du(o))return;const u=fh(S(this,ht).dataUpdatedAt,o)+1;se(this,Mn,kn.setTimeout(()=>{S(this,ht).isStale||this.updateResult()},u))},Uu=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(S(this,Pe)):this.options.refetchInterval)??!1},$u=function(o){Ce(this,Ae,Wu).call(this),se(this,Xr,o),!(Ro.isServer()||Rt(this.options.enabled,S(this,Pe))===!1||!Du(S(this,Xr))||S(this,Xr)===0)&&se(this,Rn,kn.setInterval(()=>{(this.options.refetchIntervalInBackground||ac.isFocused())&&Ce(this,Ae,Po).call(this)},S(this,Xr)))},Bu=function(){Ce(this,Ae,Fu).call(this),Ce(this,Ae,$u).call(this,Ce(this,Ae,Uu).call(this))},Hu=function(){S(this,Mn)!==void 0&&(kn.clearTimeout(S(this,Mn)),se(this,Mn,void 0))},Wu=function(){S(this,Rn)!==void 0&&(kn.clearInterval(S(this,Rn)),se(this,Rn,void 0))},Vu=function(){const o=S(this,jt).getQueryCache().build(S(this,jt),this.options);if(o===S(this,Pe))return;const i=S(this,Pe);se(this,Pe,o),se(this,Fo,o.state),this.hasListeners()&&(i==null||i.removeObserver(this),o.addObserver(this))},wh=function(o){ot.batch(()=>{o.listeners&&this.listeners.forEach(i=>{i(S(this,ht))}),S(this,jt).getQueryCache().notify({query:S(this,Pe),type:"observerResultsUpdated"})})},sh);function Hx(s,o){return Rt(o.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&Rt(o.retryOnMount,s)===!1)}function kp(s,o){return Hx(s,o)||s.state.data!==void 0&&Gu(s,o,o.refetchOnMount)}function Gu(s,o,i){if(Rt(o.enabled,s)!==!1&&nn(o.staleTime,s)!=="static"){const u=typeof i=="function"?i(s):i;return u==="always"||u!==!1&&dc(s,o)}return!1}function Np(s,o,i,u){return(s!==o||Rt(u.enabled,s)===!1)&&(!i.suspense||s.state.status!=="error")&&dc(s,i)}function dc(s,o){return Rt(o.enabled,s)!==!1&&s.isStaleByTime(nn(o.staleTime,s))}function Wx(s,o){return!Tu(s.getCurrentResult(),o)}var $o,rr,dt,On,nr,Kr,oh,Vx=(oh=class extends yh{constructor(o){super();ye(this,nr);ye(this,$o);ye(this,rr);ye(this,dt);ye(this,On);se(this,$o,o.client),this.mutationId=o.mutationId,se(this,dt,o.mutationCache),se(this,rr,[]),this.state=o.state||Gx(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){S(this,rr).includes(o)||(S(this,rr).push(o),this.clearGcTimeout(),S(this,dt).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){se(this,rr,S(this,rr).filter(i=>i!==o)),this.scheduleGc(),S(this,dt).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){S(this,rr).length||(this.state.status==="pending"?this.scheduleGc():S(this,dt).remove(this))}continue(){var o;return((o=S(this,On))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var m,h,v,x,b,j,M,D,I,w,C,_,$,H,z,R,F,K;const i=()=>{Ce(this,nr,Kr).call(this,{type:"continue"})},u={client:S(this,$o),meta:this.options.meta,mutationKey:this.options.mutationKey};se(this,On,xh({fn:()=>this.options.mutationFn?this.options.mutationFn(o,u):Promise.reject(new Error("No mutationFn found")),onFail:(ne,ee)=>{Ce(this,nr,Kr).call(this,{type:"failed",failureCount:ne,error:ee})},onPause:()=>{Ce(this,nr,Kr).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,dt).canRun(this)}));const d=this.state.status==="pending",f=!S(this,On).canStart();try{if(d)i();else{Ce(this,nr,Kr).call(this,{type:"pending",variables:o,isPaused:f}),S(this,dt).config.onMutate&&await S(this,dt).config.onMutate(o,this,u);const ee=await((h=(m=this.options).onMutate)==null?void 0:h.call(m,o,u));ee!==this.state.context&&Ce(this,nr,Kr).call(this,{type:"pending",context:ee,variables:o,isPaused:f})}const ne=await S(this,On).start();return await((x=(v=S(this,dt).config).onSuccess)==null?void 0:x.call(v,ne,o,this.state.context,this,u)),await((j=(b=this.options).onSuccess)==null?void 0:j.call(b,ne,o,this.state.context,u)),await((D=(M=S(this,dt).config).onSettled)==null?void 0:D.call(M,ne,null,this.state.variables,this.state.context,this,u)),await((w=(I=this.options).onSettled)==null?void 0:w.call(I,ne,null,o,this.state.context,u)),Ce(this,nr,Kr).call(this,{type:"success",data:ne}),ne}catch(ne){try{await((_=(C=S(this,dt).config).onError)==null?void 0:_.call(C,ne,o,this.state.context,this,u))}catch(ee){Promise.reject(ee)}try{await((H=($=this.options).onError)==null?void 0:H.call($,ne,o,this.state.context,u))}catch(ee){Promise.reject(ee)}try{await((R=(z=S(this,dt).config).onSettled)==null?void 0:R.call(z,void 0,ne,this.state.variables,this.state.context,this,u))}catch(ee){Promise.reject(ee)}try{await((K=(F=this.options).onSettled)==null?void 0:K.call(F,void 0,ne,o,this.state.context,u))}catch(ee){Promise.reject(ee)}throw Ce(this,nr,Kr).call(this,{type:"error",error:ne}),ne}finally{S(this,dt).runNext(this)}}},$o=new WeakMap,rr=new WeakMap,dt=new WeakMap,On=new WeakMap,nr=new WeakSet,Kr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...u,isPaused:!0};case"continue":return{...u,isPaused:!1};case"pending":return{...u,context:o.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:o.isPaused,status:"pending",variables:o.variables,submittedAt:Date.now()};case"success":return{...u,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...u,data:void 0,error:o.error,failureCount:u.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=i(this.state),ot.batch(()=>{S(this,rr).forEach(u=>{u.onMutationUpdate(o)}),S(this,dt).notify({mutation:this,type:"updated",action:o})})},oh);function Gx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wr,Qt,Bo,lh,Kx=(lh=class extends Ho{constructor(o={}){super();ye(this,wr);ye(this,Qt);ye(this,Bo);this.config=o,se(this,wr,new Set),se(this,Qt,new Map),se(this,Bo,0)}build(o,i,u){const d=new Vx({client:o,mutationCache:this,mutationId:++ei(this,Bo)._,options:o.defaultMutationOptions(i),state:u});return this.add(d),d}add(o){S(this,wr).add(o);const i=ri(o);if(typeof i=="string"){const u=S(this,Qt).get(i);u?u.push(o):S(this,Qt).set(i,[o])}this.notify({type:"added",mutation:o})}remove(o){if(S(this,wr).delete(o)){const i=ri(o);if(typeof i=="string"){const u=S(this,Qt).get(i);if(u)if(u.length>1){const d=u.indexOf(o);d!==-1&&u.splice(d,1)}else u[0]===o&&S(this,Qt).delete(i)}}this.notify({type:"removed",mutation:o})}canRun(o){const i=ri(o);if(typeof i=="string"){const u=S(this,Qt).get(i),d=u==null?void 0:u.find(f=>f.state.status==="pending");return!d||d===o}else return!0}runNext(o){var u;const i=ri(o);if(typeof i=="string"){const d=(u=S(this,Qt).get(i))==null?void 0:u.find(f=>f!==o&&f.state.isPaused);return(d==null?void 0:d.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ot.batch(()=>{S(this,wr).forEach(o=>{this.notify({type:"removed",mutation:o})}),S(this,wr).clear(),S(this,Qt).clear()})}getAll(){return Array.from(S(this,wr))}find(o){const i={exact:!0,...o};return this.getAll().find(u=>xp(i,u))}findAll(o={}){return this.getAll().filter(i=>xp(o,i))}notify(o){ot.batch(()=>{this.listeners.forEach(i=>{i(o)})})}resumePausedMutations(){const o=this.getAll().filter(i=>i.state.isPaused);return ot.batch(()=>Promise.all(o.map(i=>i.continue().catch(kt))))}},wr=new WeakMap,Qt=new WeakMap,Bo=new WeakMap,lh);function ri(s){var o;return(o=s.options.scope)==null?void 0:o.id}var sr,ih,Qx=(ih=class extends Ho{constructor(o={}){super();ye(this,sr);this.config=o,se(this,sr,new Map)}build(o,i,u){const d=i.queryKey,f=i.queryHash??uc(d,i);let m=this.get(f);return m||(m=new $x({client:o,queryKey:d,queryHash:f,options:o.defaultQueryOptions(i),state:u,defaultOptions:o.getQueryDefaults(d)}),this.add(m)),m}add(o){S(this,sr).has(o.queryHash)||(S(this,sr).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const i=S(this,sr).get(o.queryHash);i&&(o.destroy(),i===o&&S(this,sr).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){ot.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return S(this,sr).get(o)}getAll(){return[...S(this,sr).values()]}find(o){const i={exact:!0,...o};return this.getAll().find(u=>gp(i,u))}findAll(o={}){const i=this.getAll();return Object.keys(o).length>0?i.filter(u=>gp(o,u)):i}notify(o){ot.batch(()=>{this.listeners.forEach(i=>{i(o)})})}onFocus(){ot.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){ot.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},sr=new WeakMap,ih),Ke,en,tn,_s,Ms,rn,Rs,Os,ah,qx=(ah=class{constructor(s={}){ye(this,Ke);ye(this,en);ye(this,tn);ye(this,_s);ye(this,Ms);ye(this,rn);ye(this,Rs);ye(this,Os);se(this,Ke,s.queryCache||new Qx),se(this,en,s.mutationCache||new Kx),se(this,tn,s.defaultOptions||{}),se(this,_s,new Map),se(this,Ms,new Map),se(this,rn,0)}mount(){ei(this,rn)._++,S(this,rn)===1&&(se(this,Rs,ac.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Ke).onFocus())})),se(this,Os,mi.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Ke).onOnline())})))}unmount(){var s,o;ei(this,rn)._--,S(this,rn)===0&&((s=S(this,Rs))==null||s.call(this),se(this,Rs,void 0),(o=S(this,Os))==null||o.call(this),se(this,Os,void 0))}isFetching(s){return S(this,Ke).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return S(this,en).findAll({...s,status:"pending"}).length}getQueryData(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Ke).get(o.queryHash))==null?void 0:i.state.data}ensureQueryData(s){const o=this.defaultQueryOptions(s),i=S(this,Ke).build(this,o),u=i.state.data;return u===void 0?this.fetchQuery(s):(s.revalidateIfStale&&i.isStaleByTime(nn(o.staleTime,i))&&this.prefetchQuery(o),Promise.resolve(u))}getQueriesData(s){return S(this,Ke).findAll(s).map(({queryKey:o,state:i})=>{const u=i.data;return[o,u]})}setQueryData(s,o,i){const u=this.defaultQueryOptions({queryKey:s}),d=S(this,Ke).get(u.queryHash),f=d==null?void 0:d.state.data,m=_x(o,f);if(m!==void 0)return S(this,Ke).build(this,u).setData(m,{...i,manual:!0})}setQueriesData(s,o,i){return ot.batch(()=>S(this,Ke).findAll(s).map(({queryKey:u})=>[u,this.setQueryData(u,o,i)]))}getQueryState(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Ke).get(o.queryHash))==null?void 0:i.state}removeQueries(s){const o=S(this,Ke);ot.batch(()=>{o.findAll(s).forEach(i=>{o.remove(i)})})}resetQueries(s,o){const i=S(this,Ke);return ot.batch(()=>(i.findAll(s).forEach(u=>{u.reset()}),this.refetchQueries({type:"active",...s},o)))}cancelQueries(s,o={}){const i={revert:!0,...o},u=ot.batch(()=>S(this,Ke).findAll(s).map(d=>d.cancel(i)));return Promise.all(u).then(kt).catch(kt)}invalidateQueries(s,o={}){return ot.batch(()=>(S(this,Ke).findAll(s).forEach(i=>{i.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},o)))}refetchQueries(s,o={}){const i={...o,cancelRefetch:o.cancelRefetch??!0},u=ot.batch(()=>S(this,Ke).findAll(s).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let f=d.fetch(void 0,i);return i.throwOnError||(f=f.catch(kt)),d.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(u).then(kt)}fetchQuery(s){const o=this.defaultQueryOptions(s);o.retry===void 0&&(o.retry=!1);const i=S(this,Ke).build(this,o);return i.isStaleByTime(nn(o.staleTime,i))?i.fetch(o):Promise.resolve(i.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(kt).catch(kt)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(kt).catch(kt)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return mi.isOnline()?S(this,en).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,Ke)}getMutationCache(){return S(this,en)}getDefaultOptions(){return S(this,tn)}setDefaultOptions(s){se(this,tn,s)}setQueryDefaults(s,o){S(this,_s).set(_o(s),{queryKey:s,defaultOptions:o})}getQueryDefaults(s){const o=[...S(this,_s).values()],i={};return o.forEach(u=>{Mo(s,u.queryKey)&&Object.assign(i,u.defaultOptions)}),i}setMutationDefaults(s,o){S(this,Ms).set(_o(s),{mutationKey:s,defaultOptions:o})}getMutationDefaults(s){const o=[...S(this,Ms).values()],i={};return o.forEach(u=>{Mo(s,u.mutationKey)&&Object.assign(i,u.defaultOptions)}),i}defaultQueryOptions(s){if(s._defaulted)return s;const o={...S(this,tn).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return o.queryHash||(o.queryHash=uc(o.queryKey,o)),o.refetchOnReconnect===void 0&&(o.refetchOnReconnect=o.networkMode!=="always"),o.throwOnError===void 0&&(o.throwOnError=!!o.suspense),!o.networkMode&&o.persister&&(o.networkMode="offlineFirst"),o.queryFn===cc&&(o.enabled=!1),o}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...S(this,tn).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){S(this,Ke).clear(),S(this,en).clear()}},Ke=new WeakMap,en=new WeakMap,tn=new WeakMap,_s=new WeakMap,Ms=new WeakMap,rn=new WeakMap,Rs=new WeakMap,Os=new WeakMap,ah),jh=g.createContext(void 0),zs=s=>{const o=g.useContext(jh);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},Zx=({client:s,children:o})=>(g.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),n.jsx(jh.Provider,{value:s,children:o})),kh=g.createContext(!1),Yx=()=>g.useContext(kh);kh.Provider;function Jx(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Xx=g.createContext(Jx()),e0=()=>g.useContext(Xx),t0=(s,o,i)=>{const u=i!=null&&i.state.error&&typeof s.throwOnError=="function"?mh(s.throwOnError,[i.state.error,i]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||u)&&(o.isReset()||(s.retryOnMount=!1))},r0=s=>{g.useEffect(()=>{s.clearReset()},[s])},n0=({result:s,errorResetBoundary:o,throwOnError:i,query:u,suspense:d})=>s.isError&&!o.isReset()&&!s.isFetching&&u&&(d&&s.data===void 0||mh(i,[s.error,u])),s0=s=>{if(s.suspense){const i=d=>d==="static"?d:Math.max(d??1e3,1e3),u=s.staleTime;s.staleTime=typeof u=="function"?(...d)=>i(u(...d)):i(u),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},o0=(s,o)=>s.isLoading&&s.isFetching&&!o,l0=(s,o)=>(s==null?void 0:s.suspense)&&o.isPending,Sp=(s,o,i)=>o.fetchOptimistic(s).catch(()=>{i.clearReset()});function i0(s,o,i){var D,I,w,C;const u=Yx(),d=e0(),f=zs(),m=f.defaultQueryOptions(s);(I=(D=f.getDefaultOptions().queries)==null?void 0:D._experimental_beforeQuery)==null||I.call(D,m);const h=f.getQueryCache().get(m.queryHash),v=s.subscribed!==!1;m._optimisticResults=u?"isRestoring":v?"optimistic":void 0,s0(m),t0(m,d,h),r0(d);const x=!f.getQueryCache().get(m.queryHash),[b]=g.useState(()=>new o(f,m)),j=b.getOptimisticResult(m),M=!u&&v;if(g.useSyncExternalStore(g.useCallback(_=>{const $=M?b.subscribe(ot.batchCalls(_)):kt;return b.updateResult(),$},[b,M]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),g.useEffect(()=>{b.setOptions(m)},[m,b]),l0(m,j))throw Sp(m,b,d);if(n0({result:j,errorResetBoundary:d,throwOnError:m.throwOnError,query:h,suspense:m.suspense}))throw j.error;if((C=(w=f.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||C.call(w,m,j),m.experimental_prefetchInRender&&!Ro.isServer()&&o0(j,u)){const _=x?Sp(m,b,d):h==null?void 0:h.promise;_==null||_.catch(kt).finally(()=>{b.updateResult()})}return m.notifyOnChangeProps?j:b.trackResult(j)}function lr(s,o){return i0(s,Bx)}/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a0=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nh=(...s)=>s.filter((o,i,u)=>!!o&&o.trim()!==""&&u.indexOf(o)===i).join(" ").trim();/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var u0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c0=g.forwardRef(({color:s="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:m,...h},v)=>g.createElement("svg",{ref:v,...u0,width:o,height:o,stroke:s,strokeWidth:u?Number(i)*24/Number(o):i,className:Nh("lucide",d),...h},[...m.map(([x,b])=>g.createElement(x,b)),...Array.isArray(f)?f:[f]]));/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ve=(s,o)=>{const i=g.forwardRef(({className:u,...d},f)=>g.createElement(c0,{ref:f,iconNode:o,className:Nh(`lucide-${a0(s)}`,u),...d}));return i.displayName=`${s}`,i};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gi=ve("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cp=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sh=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Oo=ve("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. + * See the LICENSE file in the root directory of this source tree. + */const d0=ve("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Do=ve("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. + * See the LICENSE file in the root directory of this source tree. + */const Ds=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f0=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p0=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h0=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m0=ve("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g0=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x0=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ku=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y0=ve("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v0=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qu=ve("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b0=ve("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ch=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ot=ve("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tn=ve("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xi=ve("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. + * See the LICENSE file in the root directory of this source tree. + */const Ep=ve("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qu=ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w0=ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j0=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Zu=ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k0=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N0=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const To=ve("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. + * See the LICENSE file in the root directory of this source tree. + */const S0=ve("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C0=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E0=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Eh=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ph=ve("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dn=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P0=ve("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _0=ve("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fc=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M0=ve("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R0=ve("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const An=ve("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O0=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _h=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D0=ve("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yi=ve("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. + * See the LICENSE file in the root directory of this source tree. + */const Yu=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T0=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A0=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vi=ve("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. + * See the LICENSE file in the root directory of this source tree. + */const zn=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ju=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:S0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:d0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:Ot},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Do},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:E0},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Oo},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:g0}];var Pp=1,z0=.9,L0=.8,I0=.17,wu=.1,ju=.999,F0=.9999,U0=.99,$0=/[\\\/_+.#"@\[\(\{&]/,B0=/[\\\/_+.#"@\[\(\{&]/g,H0=/[\s-]/,Mh=/[\s-]/g;function Xu(s,o,i,u,d,f,m){if(f===o.length)return d===s.length?Pp:U0;var h=`${d},${f}`;if(m[h]!==void 0)return m[h];for(var v=u.charAt(f),x=i.indexOf(v,d),b=0,j,M,D,I;x>=0;)j=Xu(s,o,i,u,x+1,f+1,m),j>b&&(x===d?j*=Pp:$0.test(s.charAt(x-1))?(j*=L0,D=s.slice(d,x-1).match(B0),D&&d>0&&(j*=Math.pow(ju,D.length))):H0.test(s.charAt(x-1))?(j*=z0,I=s.slice(d,x-1).match(Mh),I&&d>0&&(j*=Math.pow(ju,I.length))):(j*=I0,d>0&&(j*=Math.pow(ju,x-d))),s.charAt(x)!==o.charAt(f)&&(j*=F0)),(jj&&(j=M*wu)),j>b&&(b=j),x=i.indexOf(v,x+1);return m[h]=b,b}function _p(s){return s.toLowerCase().replace(Mh," ")}function W0(s,o,i){return s=i&&i.length>0?`${s+" "+i.join(" ")}`:s,Xu(s,o,_p(s),_p(o),0,0,{})}function sn(s,o,{checkForDefaultPrevented:i=!0}={}){return function(d){if(s==null||s(d),i===!1||!d.defaultPrevented)return o==null?void 0:o(d)}}function Mp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Ts(...s){return o=>{let i=!1;const u=s.map(d=>{const f=Mp(d,o);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let d=0;d{var _;const{scope:M,children:D,...I}=j,w=((_=M==null?void 0:M[s])==null?void 0:_[v])||h,C=g.useMemo(()=>I,Object.values(I));return n.jsx(w.Provider,{value:C,children:D})};x.displayName=f+"Provider";function b(j,M){var w;const D=((w=M==null?void 0:M[s])==null?void 0:w[v])||h,I=g.useContext(D);if(I)return I;if(m!==void 0)return m;throw new Error(`\`${j}\` must be used within \`${f}\``)}return[x,b]}const d=()=>{const f=i.map(m=>g.createContext(m));return function(h){const v=(h==null?void 0:h[s])||f;return g.useMemo(()=>({[`__scope${s}`]:{...h,[s]:v}}),[h,v])}};return d.scopeName=s,[u,G0(d,...o)]}function G0(...s){const o=s[0];if(s.length===1)return o;const i=()=>{const u=s.map(d=>({useScope:d(),scopeName:d.scopeName}));return function(f){const m=u.reduce((h,{useScope:v,scopeName:x})=>{const j=v(f)[`__scope${x}`];return{...h,...j}},{});return g.useMemo(()=>({[`__scope${o.scopeName}`]:m}),[m])}};return i.scopeName=o.scopeName,i}var Ao=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},K0=ic[" useId ".trim().toString()]||(()=>{}),Q0=0;function jr(s){const[o,i]=g.useState(K0());return Ao(()=>{i(u=>u??String(Q0++))},[s]),o?`radix-${o}`:""}var q0=ic[" useInsertionEffect ".trim().toString()]||Ao;function Z0({prop:s,defaultProp:o,onChange:i=()=>{},caller:u}){const[d,f,m]=Y0({defaultProp:o,onChange:i}),h=s!==void 0,v=h?s:d;{const b=g.useRef(s!==void 0);g.useEffect(()=>{const j=b.current;j!==h&&console.warn(`${u} is changing from ${j?"controlled":"uncontrolled"} to ${h?"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=h},[h,u])}const x=g.useCallback(b=>{var j;if(h){const M=J0(b)?b(s):b;M!==s&&((j=m.current)==null||j.call(m,M))}else f(b)},[h,s,f,m]);return[v,x]}function Y0({defaultProp:s,onChange:o}){const[i,u]=g.useState(s),d=g.useRef(i),f=g.useRef(o);return q0(()=>{f.current=o},[o]),g.useEffect(()=>{var m;d.current!==i&&((m=f.current)==null||m.call(f,i),d.current=i)},[i,d]),[i,u,f]}function J0(s){return typeof s=="function"}var Rh=dh();function Oh(s){const o=g.forwardRef((i,u)=>{let{children:d,...f}=i,m=null,h=!1;const v=[];Rp(d)&&typeof ni=="function"&&(d=ni(d._payload)),g.Children.forEach(d,M=>{var D;if(ny(M)){h=!0;const I=M;let w="child"in I.props?I.props.child:I.props.children;Rp(w)&&typeof ni=="function"&&(w=ni(w._payload)),m=ey(I,w),v.push((D=m==null?void 0:m.props)==null?void 0:D.children)}else v.push(M)}),m?m=g.cloneElement(m,void 0,v):!h&&g.Children.count(d)===1&&g.isValidElement(d)&&(m=d);const x=m?ry(m):void 0,b=In(u,x);if(!m){if(d||d===0)throw new Error(h?iy(s):ly(s));return d}const j=ty(f,m.props??{});return m.type!==g.Fragment&&(j.ref=u?b:x),g.cloneElement(m,j)});return o.displayName=`${s}.Slot`,o}var X0=Symbol.for("radix.slottable"),ey=(s,o)=>{if("child"in s.props){const i=s.props.child;return g.isValidElement(i)?g.cloneElement(i,void 0,s.props.children(i.props.children)):null}return g.isValidElement(o)?o:null};function ty(s,o){const i={...o};for(const u in o){const d=s[u],f=o[u];/^on[A-Z]/.test(u)?d&&f?i[u]=(...h)=>{const v=f(...h);return d(...h),v}:d&&(i[u]=d):u==="style"?i[u]={...d,...f}:u==="className"&&(i[u]=[d,f].filter(Boolean).join(" "))}return{...s,...i}}function ry(s){var u,d;let o=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,i=o&&"isReactWarning"in o&&o.isReactWarning;return i?s.ref:(o=(d=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:d.get,i=o&&"isReactWarning"in o&&o.isReactWarning,i?s.props.ref:s.props.ref||s.ref)}function ny(s){return g.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===X0}var sy=Symbol.for("react.lazy");function Rp(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===sy&&"_payload"in s&&oy(s._payload)}function oy(s){return typeof s=="object"&&s!==null&&"then"in s}var ly=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,iy=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ni=ic[" use ".trim().toString()],ay=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=ay.reduce((s,o)=>{const i=Oh(`Primitive.${o}`),u=g.forwardRef((d,f)=>{const{asChild:m,...h}=d,v=m?i:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(v,{...h,ref:f})});return u.displayName=`Primitive.${o}`,{...s,[o]:u}},{});function uy(s,o){s&&Rh.flushSync(()=>s.dispatchEvent(o))}function zo(s){const o=g.useRef(s);return g.useEffect(()=>{o.current=s}),g.useMemo(()=>((...i)=>{var u;return(u=o.current)==null?void 0:u.call(o,...i)}),[])}function cy(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s);g.useEffect(()=>{const u=d=>{d.key==="Escape"&&i(d)};return o.addEventListener("keydown",u,{capture:!0}),()=>o.removeEventListener("keydown",u,{capture:!0})},[i,o])}var dy="DismissableLayer",ec="dismissableLayer.update",fy="dismissableLayer.pointerDownOutside",py="dismissableLayer.focusOutside",Op,pc=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Dh=g.forwardRef((s,o)=>{const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:u=!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:v,...x}=s,b=g.useContext(pc),[j,M]=g.useState(null),D=(j==null?void 0:j.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,I]=g.useState({}),w=In(o,ee=>M(ee)),C=Array.from(b.layers),[_]=[...b.layersWithOutsidePointerEventsDisabled].slice(-1),$=C.indexOf(_),H=j?C.indexOf(j):-1,z=b.layersWithOutsidePointerEventsDisabled.size>0,R=H>=$,F=g.useRef(!1),K=xy(ee=>{const J=ee.target;if(!(J instanceof Node))return;const ke=[...b.branches].some(ue=>ue.contains(J));!R||ke||(f==null||f(ee),h==null||h(ee),ee.defaultPrevented||v==null||v())},{ownerDocument:D,deferPointerDownOutside:u,isDeferredPointerDownOutsideRef:F,dismissableSurfaces:b.dismissableSurfaces}),ne=yy(ee=>{if(u&&F.current)return;const J=ee.target;[...b.branches].some(ue=>ue.contains(J))||(m==null||m(ee),h==null||h(ee),ee.defaultPrevented||v==null||v())},D);return cy(ee=>{H===b.layers.size-1&&(d==null||d(ee),!ee.defaultPrevented&&v&&(ee.preventDefault(),v()))},D),g.useEffect(()=>{if(j)return i&&(b.layersWithOutsidePointerEventsDisabled.size===0&&(Op=D.body.style.pointerEvents,D.body.style.pointerEvents="none"),b.layersWithOutsidePointerEventsDisabled.add(j)),b.layers.add(j),Dp(),()=>{i&&(b.layersWithOutsidePointerEventsDisabled.delete(j),b.layersWithOutsidePointerEventsDisabled.size===0&&(D.body.style.pointerEvents=Op))}},[j,D,i,b]),g.useEffect(()=>()=>{j&&(b.layers.delete(j),b.layersWithOutsidePointerEventsDisabled.delete(j),Dp())},[j,b]),g.useEffect(()=>{const ee=()=>I({});return document.addEventListener(ec,ee),()=>document.removeEventListener(ec,ee)},[]),n.jsx(lt.div,{...x,ref:w,style:{pointerEvents:z?R?"auto":"none":void 0,...s.style},onFocusCapture:sn(s.onFocusCapture,ne.onFocusCapture),onBlurCapture:sn(s.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:sn(s.onPointerDownCapture,K.onPointerDownCapture)})});Dh.displayName=dy;var hy="DismissableLayerBranch",my=g.forwardRef((s,o)=>{const i=g.useContext(pc),u=g.useRef(null),d=In(o,u);return g.useEffect(()=>{const f=u.current;if(f)return i.branches.add(f),()=>{i.branches.delete(f)}},[i.branches]),n.jsx(lt.div,{...s,ref:d})});my.displayName=hy;function gy(){const s=g.useContext(pc),[o,i]=g.useState(null);return g.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),i}function xy(s,o){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:u=!1,isDeferredPointerDownOutsideRef:d,dismissableSurfaces:f}=o,m=zo(s),h=g.useRef(!1),v=g.useRef(!1),x=g.useRef(new Map),b=g.useRef(()=>{});return g.useEffect(()=>{function j(){v.current=!1,d.current=!1,x.current.clear()}function M(){return Array.from(x.current.values()).some(Boolean)}function D($){if(!v.current)return;const H=$.target;H instanceof Node&&[...f].some(R=>R.contains(H))||x.current.set($.type,!0),$.type==="click"&&window.setTimeout(()=>{v.current&&b.current()},0)}function I($){v.current&&x.current.set($.type,!1)}const w=$=>{if($.target&&!h.current){let H=function(){i.removeEventListener("click",b.current);const R=M();j(),R||Th(fy,m,z,{discrete:!0})};const z={originalEvent:$};v.current=!0,d.current=u&&$.button===0,x.current.clear(),!u||$.button!==0?H():(i.removeEventListener("click",b.current),b.current=H,i.addEventListener("click",b.current,{once:!0}))}else i.removeEventListener("click",b.current),j();h.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const $ of C)i.addEventListener($,D,!0),i.addEventListener($,I);const _=window.setTimeout(()=>{i.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(_),i.removeEventListener("pointerdown",w),i.removeEventListener("click",b.current);for(const $ of C)i.removeEventListener($,D,!0),i.removeEventListener($,I)}},[i,m,u,d,f]),{onPointerDownCapture:()=>h.current=!0}}function yy(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s),u=g.useRef(!1);return g.useEffect(()=>{const d=f=>{f.target&&!u.current&&Th(py,i,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",d),()=>o.removeEventListener("focusin",d)},[o,i]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function Dp(){const s=new CustomEvent(ec);document.dispatchEvent(s)}function Th(s,o,i,{discrete:u}){const d=i.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:i});o&&d.addEventListener(s,o,{once:!0}),u?uy(d,f):d.dispatchEvent(f)}var ku="focusScope.autoFocusOnMount",Nu="focusScope.autoFocusOnUnmount",Tp={bubbles:!1,cancelable:!0},vy="FocusScope",Ah=g.forwardRef((s,o)=>{const{loop:i=!1,trapped:u=!1,onMountAutoFocus:d,onUnmountAutoFocus:f,...m}=s,[h,v]=g.useState(null),x=zo(d),b=zo(f),j=g.useRef(null),M=In(o,w=>v(w)),D=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(u){let w=function(H){if(D.paused||!h)return;const z=H.target;h.contains(z)?j.current=z:Qr(j.current,{select:!0})},C=function(H){if(D.paused||!h)return;const z=H.relatedTarget;z!==null&&(h.contains(z)||Qr(j.current,{select:!0}))},_=function(H){if(document.activeElement===document.body)for(const R of H)R.removedNodes.length>0&&Qr(h)};document.addEventListener("focusin",w),document.addEventListener("focusout",C);const $=new MutationObserver(_);return h&&$.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",C),$.disconnect()}}},[u,h,D.paused]),g.useEffect(()=>{if(h){zp.add(D);const w=document.activeElement;if(!h.contains(w)){const _=new CustomEvent(ku,Tp);h.addEventListener(ku,x),h.dispatchEvent(_),_.defaultPrevented||(by(Sy(zh(h)),{select:!0}),document.activeElement===w&&Qr(h))}return()=>{h.removeEventListener(ku,x),setTimeout(()=>{const _=new CustomEvent(Nu,Tp);h.addEventListener(Nu,b),h.dispatchEvent(_),_.defaultPrevented||Qr(w??document.body,{select:!0}),h.removeEventListener(Nu,b),zp.remove(D)},0)}}},[h,x,b,D]);const I=g.useCallback(w=>{if(!i&&!u||D.paused)return;const C=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,_=document.activeElement;if(C&&_){const $=w.currentTarget,[H,z]=wy($);H&&z?!w.shiftKey&&_===z?(w.preventDefault(),i&&Qr(H,{select:!0})):w.shiftKey&&_===H&&(w.preventDefault(),i&&Qr(z,{select:!0})):_===$&&w.preventDefault()}},[i,u,D.paused]);return n.jsx(lt.div,{tabIndex:-1,...m,ref:M,onKeyDown:I})});Ah.displayName=vy;function by(s,{select:o=!1}={}){const i=document.activeElement;for(const u of s)if(Qr(u,{select:o}),document.activeElement!==i)return}function wy(s){const o=zh(s),i=Ap(o,s),u=Ap(o.reverse(),s);return[i,u]}function zh(s){const o=[],i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:u=>{const d=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||d?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)o.push(i.currentNode);return o}function Ap(s,o){for(const i of s)if(!jy(i,{upTo:o}))return i}function jy(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 ky(s){return s instanceof HTMLInputElement&&"select"in s}function Qr(s,{select:o=!1}={}){if(s&&s.focus){const i=document.activeElement;s.focus({preventScroll:!0}),s!==i&&ky(s)&&o&&s.select()}}var zp=Ny();function Ny(){let s=[];return{add(o){const i=s[0];o!==i&&(i==null||i.pause()),s=Lp(s,o),s.unshift(o)},remove(o){var i;s=Lp(s,o),(i=s[0])==null||i.resume()}}}function Lp(s,o){const i=[...s],u=i.indexOf(o);return u!==-1&&i.splice(u,1),i}function Sy(s){return s.filter(o=>o.tagName!=="A")}var Cy="Portal",Lh=g.forwardRef((s,o)=>{var h;const{container:i,...u}=s,[d,f]=g.useState(!1);Ao(()=>f(!0),[]);const m=i||d&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return m?Rh.createPortal(n.jsx(lt.div,{...u,ref:o}),m):null});Lh.displayName=Cy;function Ey(s,o){return g.useReducer((i,u)=>o[i][u]??i,s)}var wi=s=>{const{present:o,children:i}=s,u=Py(o),d=typeof i=="function"?i({present:u.isPresent}):g.Children.only(i),f=_y(u.ref,My(d));return typeof i=="function"||u.isPresent?g.cloneElement(d,{ref:f}):null};wi.displayName="Presence";function Py(s){const[o,i]=g.useState(),u=g.useRef(null),d=g.useRef(s),f=g.useRef("none"),m=s?"mounted":"unmounted",[h,v]=Ey(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const x=si(u.current);f.current=h==="mounted"?x:"none"},[h]),Ao(()=>{const x=u.current,b=d.current;if(b!==s){const M=f.current,D=si(x);s?v("MOUNT"):D==="none"||(x==null?void 0:x.display)==="none"?v("UNMOUNT"):v(b&&M!==D?"ANIMATION_OUT":"UNMOUNT"),d.current=s}},[s,v]),Ao(()=>{if(o){let x;const b=o.ownerDocument.defaultView??window,j=D=>{const w=si(u.current).includes(CSS.escape(D.animationName));if(D.target===o&&w&&(v("ANIMATION_END"),!d.current)){const C=o.style.animationFillMode;o.style.animationFillMode="forwards",x=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=C)})}},M=D=>{D.target===o&&(f.current=si(u.current))};return o.addEventListener("animationstart",M),o.addEventListener("animationcancel",j),o.addEventListener("animationend",j),()=>{b.clearTimeout(x),o.removeEventListener("animationstart",M),o.removeEventListener("animationcancel",j),o.removeEventListener("animationend",j)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:g.useCallback(x=>{u.current=x?getComputedStyle(x):null,i(x)},[])}}function Ip(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function _y(...s){const o=g.useRef(s);return o.current=s,g.useCallback(i=>{const u=o.current;let d=!1;const f=u.map(m=>{const h=Ip(m,i);return!d&&typeof h=="function"&&(d=!0),h});if(d)return()=>{for(let m=0;m{tr||(tr={start:Fp(),end:Fp()});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),oi++,()=>{oi===1&&(tr==null||tr.start.remove(),tr==null||tr.end.remove(),tr=null),oi=Math.max(0,oi-1)}},[])}function Fp(){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 i,u=1,d=arguments.length;u"u")return Qy;var o=qy(s),i=document.documentElement.clientWidth,u=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,u-i+o[2]-o[0])}},Yy=$h(),ys="data-scroll-locked",Jy=function(s,o,i,u){var d=s.left,f=s.top,m=s.right,h=s.gap;return i===void 0&&(i="margin"),` + .`.concat(Dy,` { + overflow: hidden `).concat(u,`; + padding-right: `).concat(h,"px ").concat(u,`; + } + body[`).concat(ys,`] { + overflow: hidden `).concat(u,`; + overscroll-behavior: contain; + `).concat([o&&"position: relative ".concat(u,";"),i==="margin"&&` + padding-left: `.concat(d,`px; + padding-top: `).concat(f,`px; + padding-right: `).concat(m,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(h,"px ").concat(u,`; + `),i==="padding"&&"padding-right: ".concat(h,"px ").concat(u,";")].filter(Boolean).join(""),` + } + + .`).concat(pi,` { + right: `).concat(h,"px ").concat(u,`; + } + + .`).concat(hi,` { + margin-right: `).concat(h,"px ").concat(u,`; + } + + .`).concat(pi," .").concat(pi,` { + right: 0 `).concat(u,`; + } + + .`).concat(hi," .").concat(hi,` { + margin-right: 0 `).concat(u,`; + } + + body[`).concat(ys,`] { + `).concat(Ty,": ").concat(h,`px; + } +`)},$p=function(){var s=parseInt(document.body.getAttribute(ys)||"0",10);return isFinite(s)?s:0},Xy=function(){g.useEffect(function(){return document.body.setAttribute(ys,($p()+1).toString()),function(){var s=$p()-1;s<=0?document.body.removeAttribute(ys):document.body.setAttribute(ys,s.toString())}},[])},ev=function(s){var o=s.noRelative,i=s.noImportant,u=s.gapMode,d=u===void 0?"margin":u;Xy();var f=g.useMemo(function(){return Zy(d)},[d]);return g.createElement(Yy,{styles:Jy(f,!o,d,i?"":"!important")})},tc=!1;if(typeof window<"u")try{var li=Object.defineProperty({},"passive",{get:function(){return tc=!0,!0}});window.addEventListener("test",li,li),window.removeEventListener("test",li,li)}catch{tc=!1}var fs=tc?{passive:!1}:!1,tv=function(s){return s.tagName==="TEXTAREA"},Bh=function(s,o){if(!(s instanceof Element))return!1;var i=window.getComputedStyle(s);return i[o]!=="hidden"&&!(i.overflowY===i.overflowX&&!tv(s)&&i[o]==="visible")},rv=function(s){return Bh(s,"overflowY")},nv=function(s){return Bh(s,"overflowX")},Bp=function(s,o){var i=o.ownerDocument,u=o;do{typeof ShadowRoot<"u"&&u instanceof ShadowRoot&&(u=u.host);var d=Hh(s,u);if(d){var f=Wh(s,u),m=f[1],h=f[2];if(m>h)return!0}u=u.parentNode}while(u&&u!==i.body);return!1},sv=function(s){var o=s.scrollTop,i=s.scrollHeight,u=s.clientHeight;return[o,i,u]},ov=function(s){var o=s.scrollLeft,i=s.scrollWidth,u=s.clientWidth;return[o,i,u]},Hh=function(s,o){return s==="v"?rv(o):nv(o)},Wh=function(s,o){return s==="v"?sv(o):ov(o)},lv=function(s,o){return s==="h"&&o==="rtl"?-1:1},iv=function(s,o,i,u,d){var f=lv(s,window.getComputedStyle(o).direction),m=f*u,h=i.target,v=o.contains(h),x=!1,b=m>0,j=0,M=0;do{if(!h)break;var D=Wh(s,h),I=D[0],w=D[1],C=D[2],_=w-C-f*I;(I||_)&&Hh(s,h)&&(j+=_,M+=I);var $=h.parentNode;h=$&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE?$.host:$}while(!v&&h!==document.body||v&&(o.contains(h)||o===h));return(b&&Math.abs(j)<1||!b&&Math.abs(M)<1)&&(x=!0),x},ii=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},Hp=function(s){return[s.deltaX,s.deltaY]},Wp=function(s){return s&&"current"in s?s.current:s},av=function(s,o){return s[0]===o[0]&&s[1]===o[1]},uv=function(s){return` + .block-interactivity-`.concat(s,` {pointer-events: none;} + .allow-interactivity-`).concat(s,` {pointer-events: all;} +`)},cv=0,ps=[];function dv(s){var o=g.useRef([]),i=g.useRef([0,0]),u=g.useRef(),d=g.useState(cv++)[0],f=g.useState($h)[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(d));var w=Oy([s.lockRef.current],(s.shards||[]).map(Wp),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(d))}),function(){document.body.classList.remove("block-interactivity-".concat(d)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(d))})}}},[s.inert,s.lockRef.current,s.shards]);var h=g.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!m.current.allowPinchZoom;var _=ii(w),$=i.current,H="deltaX"in w?w.deltaX:$[0]-_[0],z="deltaY"in w?w.deltaY:$[1]-_[1],R,F=w.target,K=Math.abs(H)>Math.abs(z)?"h":"v";if("touches"in w&&K==="h"&&F.type==="range")return!1;var ne=window.getSelection(),ee=ne&&ne.anchorNode,J=ee?ee===F||ee.contains(F):!1;if(J)return!1;var ke=Bp(K,F);if(!ke)return!0;if(ke?R=K:(R=K==="v"?"h":"v",ke=Bp(K,F)),!ke)return!1;if(!u.current&&"changedTouches"in w&&(H||z)&&(u.current=R),!R)return!0;var ue=u.current||R;return iv(ue,C,w,ue==="h"?H:z)},[]),v=g.useCallback(function(w){var C=w;if(!(!ps.length||ps[ps.length-1]!==f)){var _="deltaY"in C?Hp(C):ii(C),$=o.current.filter(function(R){return R.name===C.type&&(R.target===C.target||C.target===R.shadowParent)&&av(R.delta,_)})[0];if($&&$.should){C.cancelable&&C.preventDefault();return}if(!$){var H=(m.current.shards||[]).map(Wp).filter(Boolean).filter(function(R){return R.contains(C.target)}),z=H.length>0?h(C,H[0]):!m.current.noIsolation;z&&C.cancelable&&C.preventDefault()}}},[]),x=g.useCallback(function(w,C,_,$){var H={name:w,delta:C,target:_,should:$,shadowParent:fv(_)};o.current.push(H),setTimeout(function(){o.current=o.current.filter(function(z){return z!==H})},1)},[]),b=g.useCallback(function(w){i.current=ii(w),u.current=void 0},[]),j=g.useCallback(function(w){x(w.type,Hp(w),w.target,h(w,s.lockRef.current))},[]),M=g.useCallback(function(w){x(w.type,ii(w),w.target,h(w,s.lockRef.current))},[]);g.useEffect(function(){return ps.push(f),s.setCallbacks({onScrollCapture:j,onWheelCapture:j,onTouchMoveCapture:M}),document.addEventListener("wheel",v,fs),document.addEventListener("touchmove",v,fs),document.addEventListener("touchstart",b,fs),function(){ps=ps.filter(function(w){return w!==f}),document.removeEventListener("wheel",v,fs),document.removeEventListener("touchmove",v,fs),document.removeEventListener("touchstart",b,fs)}},[]);var D=s.removeScrollBar,I=s.inert;return g.createElement(g.Fragment,null,I?g.createElement(f,{styles:uv(d)}):null,D?g.createElement(ev,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function fv(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const pv=$y(Uh,dv);var Vh=g.forwardRef(function(s,o){return g.createElement(ji,or({},s,{ref:o,sideCar:pv}))});Vh.classNames=ji.classNames;var hv=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},hs=new WeakMap,ai=new WeakMap,ui={},Pu=0,Gh=function(s){return s&&(s.host||Gh(s.parentNode))},mv=function(s,o){return o.map(function(i){if(s.contains(i))return i;var u=Gh(i);return u&&s.contains(u)?u:(console.error("aria-hidden",i,"in not contained inside",s,". Doing nothing"),null)}).filter(function(i){return!!i})},gv=function(s,o,i,u){var d=mv(o,Array.isArray(s)?s:[s]);ui[i]||(ui[i]=new WeakMap);var f=ui[i],m=[],h=new Set,v=new Set(d),x=function(j){!j||h.has(j)||(h.add(j),x(j.parentNode))};d.forEach(x);var b=function(j){!j||v.has(j)||Array.prototype.forEach.call(j.children,function(M){if(h.has(M))b(M);else try{var D=M.getAttribute(u),I=D!==null&&D!=="false",w=(hs.get(M)||0)+1,C=(f.get(M)||0)+1;hs.set(M,w),f.set(M,C),m.push(M),w===1&&I&&ai.set(M,!0),C===1&&M.setAttribute(i,"true"),I||M.setAttribute(u,"true")}catch(_){console.error("aria-hidden: cannot operate on ",M,_)}})};return b(o),h.clear(),Pu++,function(){m.forEach(function(j){var M=hs.get(j)-1,D=f.get(j)-1;hs.set(j,M),f.set(j,D),M||(ai.has(j)||j.removeAttribute(u),ai.delete(j)),D||j.removeAttribute(i)}),Pu--,Pu||(hs=new WeakMap,hs=new WeakMap,ai=new WeakMap,ui={})}},xv=function(s,o,i){i===void 0&&(i="data-aria-hidden");var u=Array.from(Array.isArray(s)?s:[s]),d=hv(s);return d?(u.push.apply(u,Array.from(d.querySelectorAll("[aria-live], script"))),gv(u,d,i,"aria-hidden")):function(){return null}},ki="Dialog",[Kh]=V0(ki),[yv,qt]=Kh(ki),Qh=s=>{const{__scopeDialog:o,children:i,open:u,defaultOpen:d,onOpenChange:f,modal:m=!0}=s,h=g.useRef(null),v=g.useRef(null),[x,b]=Z0({prop:u,defaultProp:d??!1,onChange:f,caller:ki});return n.jsx(yv,{scope:o,triggerRef:h,contentRef:v,contentId:jr(),titleId:jr(),descriptionId:jr(),open:x,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(j=>!j),[b]),modal:m,children:i})};Qh.displayName=ki;var qh="DialogTrigger",vv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(qh,i),f=In(o,d.triggerRef);return n.jsx(lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":mc(d.open),...u,ref:f,onClick:sn(s.onClick,d.onOpenToggle)})});vv.displayName=qh;var hc="DialogPortal",[bv,Zh]=Kh(hc,{forceMount:void 0}),Yh=s=>{const{__scopeDialog:o,forceMount:i,children:u,container:d}=s,f=qt(hc,o);return n.jsx(bv,{scope:o,forceMount:i,children:g.Children.map(u,m=>n.jsx(wi,{present:i||f.open,children:n.jsx(Lh,{asChild:!0,container:d,children:m})}))})};Yh.displayName=hc;var bi="DialogOverlay",Jh=g.forwardRef((s,o)=>{const i=Zh(bi,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=qt(bi,s.__scopeDialog);return f.modal?n.jsx(wi,{present:u||f.open,children:n.jsx(jv,{...d,ref:o})}):null});Jh.displayName=bi;var wv=Oh("DialogOverlay.RemoveScroll"),jv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(bi,i),f=gy(),m=In(o,f);return n.jsx(Vh,{as:wv,allowPinchZoom:!0,shards:[d.contentRef],children:n.jsx(lt.div,{"data-state":mc(d.open),...u,ref:m,style:{pointerEvents:"auto",...u.style}})})}),As="DialogContent",Xh=g.forwardRef((s,o)=>{const i=Zh(As,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=qt(As,s.__scopeDialog);return n.jsx(wi,{present:u||f.open,children:f.modal?n.jsx(kv,{...d,ref:o}):n.jsx(Nv,{...d,ref:o})})});Xh.displayName=As;var kv=g.forwardRef((s,o)=>{const i=qt(As,s.__scopeDialog),u=g.useRef(null),d=In(o,i.contentRef,u);return g.useEffect(()=>{const f=u.current;if(f)return xv(f)},[]),n.jsx(em,{...s,ref:d,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:sn(s.onCloseAutoFocus,f=>{var m;f.preventDefault(),(m=i.triggerRef.current)==null||m.focus()}),onPointerDownOutside:sn(s.onPointerDownOutside,f=>{const m=f.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0;(m.button===2||h)&&f.preventDefault()}),onFocusOutside:sn(s.onFocusOutside,f=>f.preventDefault())})}),Nv=g.forwardRef((s,o)=>{const i=qt(As,s.__scopeDialog),u=g.useRef(!1),d=g.useRef(!1);return n.jsx(em,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var m,h;(m=s.onCloseAutoFocus)==null||m.call(s,f),f.defaultPrevented||(u.current||(h=i.triggerRef.current)==null||h.focus(),f.preventDefault()),u.current=!1,d.current=!1},onInteractOutside:f=>{var v,x;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(u.current=!0,f.detail.originalEvent.type==="pointerdown"&&(d.current=!0));const m=f.target;((x=i.triggerRef.current)==null?void 0:x.contains(m))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&d.current&&f.preventDefault()}})}),em=g.forwardRef((s,o)=>{const{__scopeDialog:i,trapFocus:u,onOpenAutoFocus:d,onCloseAutoFocus:f,...m}=s,h=qt(As,i);return Ry(),n.jsx(n.Fragment,{children:n.jsx(Ah,{asChild:!0,loop:!0,trapped:u,onMountAutoFocus:d,onUnmountAutoFocus:f,children:n.jsx(Dh,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":mc(h.open),...m,ref:o,deferPointerDownOutside:!0,onDismiss:()=>h.onOpenChange(!1)})})})}),tm="DialogTitle",Sv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(tm,i);return n.jsx(lt.h2,{id:d.titleId,...u,ref:o})});Sv.displayName=tm;var rm="DialogDescription",Cv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(rm,i);return n.jsx(lt.p,{id:d.descriptionId,...u,ref:o})});Cv.displayName=rm;var nm="DialogClose",Ev=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(nm,i);return n.jsx(lt.button,{type:"button",...u,ref:o,onClick:sn(s.onClick,()=>d.onOpenChange(!1))})});Ev.displayName=nm;function mc(s){return s?"open":"closed"}var So='[cmdk-group=""]',_u='[cmdk-group-items=""]',Pv='[cmdk-group-heading=""]',sm='[cmdk-item=""]',Vp=`${sm}:not([aria-disabled="true"])`,rc="cmdk-item-select",gs="data-value",_v=(s,o,i)=>W0(s,o,i),om=g.createContext(void 0),Wo=()=>g.useContext(om),lm=g.createContext(void 0),gc=()=>g.useContext(lm),im=g.createContext(void 0),am=g.forwardRef((s,o)=>{let i=xs(()=>{var N,G;return{search:"",value:(G=(N=s.value)!=null?N:s.defaultValue)!=null?G:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=xs(()=>new Set),d=xs(()=>new Map),f=xs(()=>new Map),m=xs(()=>new Set),h=um(s),{label:v,children:x,value:b,onValueChange:j,filter:M,shouldFilter:D,loop:I,disablePointerSelection:w=!1,vimBindings:C=!0,..._}=s,$=jr(),H=jr(),z=jr(),R=g.useRef(null),F=Uv();Ln(()=>{if(b!==void 0){let N=b.trim();i.current.value=N,K.emit()}},[b]),Ln(()=>{F(6,Le)},[]);let K=g.useMemo(()=>({subscribe:N=>(m.current.add(N),()=>m.current.delete(N)),snapshot:()=>i.current,setState:(N,G,X)=>{var Y,ie,pe,we;if(!Object.is(i.current[N],G)){if(i.current[N]=G,N==="search")ue(),J(),F(1,ke);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(z);U?U.focus():(Y=document.getElementById($))==null||Y.focus()}if(F(7,()=>{var U;i.current.selectedItemId=(U=_e())==null?void 0:U.id,K.emit()}),X||F(5,Le),((ie=h.current)==null?void 0:ie.value)!==void 0){let U=G??"";(we=(pe=h.current).onValueChange)==null||we.call(pe,U);return}}K.emit()}},emit:()=>{m.current.forEach(N=>N())}}),[]),ne=g.useMemo(()=>({value:(N,G,X)=>{var Y;G!==((Y=f.current.get(N))==null?void 0:Y.value)&&(f.current.set(N,{value:G,keywords:X}),i.current.filtered.items.set(N,ee(G,X)),F(2,()=>{J(),K.emit()}))},item:(N,G)=>(u.current.add(N),G&&(d.current.has(G)?d.current.get(G).add(N):d.current.set(G,new Set([N]))),F(3,()=>{ue(),J(),i.current.value||ke(),K.emit()}),()=>{f.current.delete(N),u.current.delete(N),i.current.filtered.items.delete(N);let X=_e();F(4,()=>{ue(),(X==null?void 0:X.getAttribute("id"))===N&&ke(),K.emit()})}),group:N=>(d.current.has(N)||d.current.set(N,new Set),()=>{f.current.delete(N),d.current.delete(N)}),filter:()=>h.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:$,inputId:z,labelId:H,listInnerRef:R}),[]);function ee(N,G){var X,Y;let ie=(Y=(X=h.current)==null?void 0:X.filter)!=null?Y:_v;return N?ie(N,i.current.search,G):0}function J(){if(!i.current.search||h.current.shouldFilter===!1)return;let N=i.current.filtered.items,G=[];i.current.filtered.groups.forEach(Y=>{let ie=d.current.get(Y),pe=0;ie.forEach(we=>{let U=N.get(we);pe=Math.max(U,pe)}),G.push([Y,pe])});let X=R.current;Oe().sort((Y,ie)=>{var pe,we;let U=Y.getAttribute("id"),me=ie.getAttribute("id");return((pe=N.get(me))!=null?pe:0)-((we=N.get(U))!=null?we:0)}).forEach(Y=>{let ie=Y.closest(_u);ie?ie.appendChild(Y.parentElement===ie?Y:Y.closest(`${_u} > *`)):X.appendChild(Y.parentElement===X?Y:Y.closest(`${_u} > *`))}),G.sort((Y,ie)=>ie[1]-Y[1]).forEach(Y=>{var ie;let pe=(ie=R.current)==null?void 0:ie.querySelector(`${So}[${gs}="${encodeURIComponent(Y[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function ke(){let N=Oe().find(X=>X.getAttribute("aria-disabled")!=="true"),G=N==null?void 0:N.getAttribute(gs);K.setState("value",G||void 0)}function ue(){var N,G,X,Y;if(!i.current.search||h.current.shouldFilter===!1){i.current.filtered.count=u.current.size;return}i.current.filtered.groups=new Set;let ie=0;for(let pe of u.current){let we=(G=(N=f.current.get(pe))==null?void 0:N.value)!=null?G:"",U=(Y=(X=f.current.get(pe))==null?void 0:X.keywords)!=null?Y:[],me=ee(we,U);i.current.filtered.items.set(pe,me),me>0&&ie++}for(let[pe,we]of d.current)for(let U of we)if(i.current.filtered.items.get(U)>0){i.current.filtered.groups.add(pe);break}i.current.filtered.count=ie}function Le(){var N,G,X;let Y=_e();Y&&(((N=Y.parentElement)==null?void 0:N.firstChild)===Y&&((X=(G=Y.closest(So))==null?void 0:G.querySelector(Pv))==null||X.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function _e(){var N;return(N=R.current)==null?void 0:N.querySelector(`${sm}[aria-selected="true"]`)}function Oe(){var N;return Array.from(((N=R.current)==null?void 0:N.querySelectorAll(Vp))||[])}function Te(N){let G=Oe()[N];G&&K.setState("value",G.getAttribute(gs))}function Me(N){var G;let X=_e(),Y=Oe(),ie=Y.findIndex(we=>we===X),pe=Y[ie+N];(G=h.current)!=null&&G.loop&&(pe=ie+N<0?Y[Y.length-1]:ie+N===Y.length?Y[0]:Y[ie+N]),pe&&K.setState("value",pe.getAttribute(gs))}function Q(N){let G=_e(),X=G==null?void 0:G.closest(So),Y;for(;X&&!Y;)X=N>0?Iv(X,So):Fv(X,So),Y=X==null?void 0:X.querySelector(Vp);Y?K.setState("value",Y.getAttribute(gs)):Me(N)}let ce=()=>Te(Oe().length-1),Z=N=>{N.preventDefault(),N.metaKey?ce():N.altKey?Q(1):Me(1)},P=N=>{N.preventDefault(),N.metaKey?Te(0):N.altKey?Q(-1):Me(-1)};return g.createElement(lt.div,{ref:o,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:N=>{var G;(G=_.onKeyDown)==null||G.call(_,N);let X=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||X))switch(N.key){case"n":case"j":{C&&N.ctrlKey&&Z(N);break}case"ArrowDown":{Z(N);break}case"p":case"k":{C&&N.ctrlKey&&P(N);break}case"ArrowUp":{P(N);break}case"Home":{N.preventDefault(),Te(0);break}case"End":{N.preventDefault(),ce();break}case"Enter":{N.preventDefault();let Y=_e();if(Y){let ie=new Event(rc);Y.dispatchEvent(ie)}}}}},g.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Bv},v),Ni(s,N=>g.createElement(lm.Provider,{value:K},g.createElement(om.Provider,{value:ne},N))))}),Mv=g.forwardRef((s,o)=>{var i,u;let d=jr(),f=g.useRef(null),m=g.useContext(im),h=Wo(),v=um(s),x=(u=(i=v.current)==null?void 0:i.forceMount)!=null?u:m==null?void 0:m.forceMount;Ln(()=>{if(!x)return h.item(d,m==null?void 0:m.id)},[x]);let b=cm(d,f,[s.value,s.children,f],s.keywords),j=gc(),M=on(F=>F.value&&F.value===b.current),D=on(F=>x||h.filter()===!1?!0:F.search?F.filtered.items.get(d)>0:!0);g.useEffect(()=>{let F=f.current;if(!(!F||s.disabled))return F.addEventListener(rc,I),()=>F.removeEventListener(rc,I)},[D,s.onSelect,s.disabled]);function I(){var F,K;w(),(K=(F=v.current).onSelect)==null||K.call(F,b.current)}function w(){j.setState("value",b.current,!0)}if(!D)return null;let{disabled:C,value:_,onSelect:$,forceMount:H,keywords:z,...R}=s;return g.createElement(lt.div,{ref:Ts(f,o),...R,id:d,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!M,"data-disabled":!!C,"data-selected":!!M,onPointerMove:C||h.getDisablePointerSelection()?void 0:w,onClick:C?void 0:I},s.children)}),Rv=g.forwardRef((s,o)=>{let{heading:i,children:u,forceMount:d,...f}=s,m=jr(),h=g.useRef(null),v=g.useRef(null),x=jr(),b=Wo(),j=on(D=>d||b.filter()===!1?!0:D.search?D.filtered.groups.has(m):!0);Ln(()=>b.group(m),[]),cm(m,h,[s.value,s.heading,v]);let M=g.useMemo(()=>({id:m,forceMount:d}),[d]);return g.createElement(lt.div,{ref:Ts(h,o),...f,"cmdk-group":"",role:"presentation",hidden:j?void 0:!0},i&&g.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:x},i),Ni(s,D=>g.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?x:void 0},g.createElement(im.Provider,{value:M},D))))}),Ov=g.forwardRef((s,o)=>{let{alwaysRender:i,...u}=s,d=g.useRef(null),f=on(m=>!m.search);return!i&&!f?null:g.createElement(lt.div,{ref:Ts(d,o),...u,"cmdk-separator":"",role:"separator"})}),Dv=g.forwardRef((s,o)=>{let{onValueChange:i,...u}=s,d=s.value!=null,f=gc(),m=on(x=>x.search),h=on(x=>x.selectedItemId),v=Wo();return g.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),g.createElement(lt.input,{ref:o,...u,"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":h,id:v.inputId,type:"text",value:d?s.value:m,onChange:x=>{d||f.setState("search",x.target.value),i==null||i(x.target.value)}})}),Tv=g.forwardRef((s,o)=>{let{children:i,label:u="Suggestions",...d}=s,f=g.useRef(null),m=g.useRef(null),h=on(x=>x.selectedItemId),v=Wo();return g.useEffect(()=>{if(m.current&&f.current){let x=m.current,b=f.current,j,M=new ResizeObserver(()=>{j=requestAnimationFrame(()=>{let D=x.offsetHeight;b.style.setProperty("--cmdk-list-height",D.toFixed(1)+"px")})});return M.observe(x),()=>{cancelAnimationFrame(j),M.unobserve(x)}}},[]),g.createElement(lt.div,{ref:Ts(f,o),...d,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":u,id:v.listId},Ni(s,x=>g.createElement("div",{ref:Ts(m,v.listInnerRef),"cmdk-list-sizer":""},x)))}),Av=g.forwardRef((s,o)=>{let{open:i,onOpenChange:u,overlayClassName:d,contentClassName:f,container:m,...h}=s;return g.createElement(Qh,{open:i,onOpenChange:u},g.createElement(Yh,{container:m},g.createElement(Jh,{"cmdk-overlay":"",className:d}),g.createElement(Xh,{"aria-label":s.label,"cmdk-dialog":"",className:f},g.createElement(am,{ref:o,...h}))))}),zv=g.forwardRef((s,o)=>on(i=>i.filtered.count===0)?g.createElement(lt.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Lv=g.forwardRef((s,o)=>{let{progress:i,children:u,label:d="Loading...",...f}=s;return g.createElement(lt.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":d},Ni(s,m=>g.createElement("div",{"aria-hidden":!0},m)))}),ms=Object.assign(am,{List:Tv,Item:Mv,Input:Dv,Group:Rv,Separator:Ov,Dialog:Av,Empty:zv,Loading:Lv});function Iv(s,o){let i=s.nextElementSibling;for(;i;){if(i.matches(o))return i;i=i.nextElementSibling}}function Fv(s,o){let i=s.previousElementSibling;for(;i;){if(i.matches(o))return i;i=i.previousElementSibling}}function um(s){let o=g.useRef(s);return Ln(()=>{o.current=s}),o}var Ln=typeof window>"u"?g.useEffect:g.useLayoutEffect;function xs(s){let o=g.useRef();return o.current===void 0&&(o.current=s()),o}function on(s){let o=gc(),i=()=>s(o.snapshot());return g.useSyncExternalStore(o.subscribe,i,i)}function cm(s,o,i,u=[]){let d=g.useRef(),f=Wo();return Ln(()=>{var m;let h=(()=>{var x;for(let b of i){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():d.current}})(),v=u.map(x=>x.trim());f.value(s,h,v),(m=o.current)==null||m.setAttribute(gs,h),d.current=h}),d}var Uv=()=>{let[s,o]=g.useState(),i=xs(()=>new Map);return Ln(()=>{i.current.forEach(u=>u()),i.current=new Map},[s]),(u,d)=>{i.current.set(u,d),o({})}};function $v(s){let o=s.type;return typeof o=="function"?o(s.props):"render"in o?o.render(s.props):s}function Ni({asChild:s,children:o},i){return s&&g.isValidElement(o)?g.cloneElement($v(o),{ref:o.ref},i(o.props.children)):i(o)}var Bv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Hv({onNavigate:s}){const[o,i]=g.useState(!1);return g.useEffect(()=>{const u=d=>{(d.metaKey||d.ctrlKey)&&d.key.toLowerCase()==="k"&&(d.preventDefault(),i(f=>!f))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[]),n.jsx(ms.Dialog,{open:o,onOpenChange:i,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>i(!1),children:n.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:u=>u.stopPropagation(),children:[n.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"}),n.jsxs(ms.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(ms.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(ms.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Ju.map(u=>n.jsxs(ms.Item,{value:`${u.label} ${u.hint}`,onSelect:()=>{s(u.id),i(!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:[n.jsx(u.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:u.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:u.hint})]},u.id))})]})]})})}async function he(s,o){var v;const i={"Content-Type":"application/json",...o==null?void 0:o.headers},u=localStorage.getItem("mc_sudo_password"),d=localStorage.getItem("mc_hf_token");u&&(i["X-Sudo-Password"]=u);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;u&&!("sudo_password"in x)&&(x.sudo_password=u,b=!0),d&&!("hf_token"in x)&&(x.hf_token=d,b=!0),b&&(f=JSON.stringify(x))}catch{}else if(!f){const x={};u&&(x.sudo_password=u),d&&(x.hf_token=d),Object.keys(x).length>0&&(f=JSON.stringify(x))}}const h=await fetch(s,{...o,headers:i,body:f});if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return h.json()}const mt={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],updates:["updates"],discover:["discover"],connect:s=>["connect",s??""],memory:(s,o)=>["memory",s??"",o??""]},Wv=()=>lr({queryKey:mt.health,queryFn:()=>he("/api/health"),refetchInterval:1e4}),xc=(s=5e3)=>lr({queryKey:mt.systemStatus,queryFn:()=>he("/api/system/status"),refetchInterval:s}),Vv=(s=3e3)=>lr({queryKey:mt.services,queryFn:()=>he("/api/system/services"),refetchInterval:s}),yc=(s=4e3)=>lr({queryKey:mt.models,queryFn:()=>he("/api/models"),refetchInterval:s}),Gv=(s=2e3)=>lr({queryKey:mt.jobs,queryFn:()=>he("/api/jobs"),refetchInterval:s,select:o=>o.jobs??[]}),Kv=(s=3e3)=>lr({queryKey:mt.tokenStats,queryFn:()=>he("/api/system/token-stats"),refetchInterval:s}),dm=(s=5e3)=>lr({queryKey:mt.agentStatus,queryFn:()=>he("/api/agent/status"),refetchInterval:s}),Qv=s=>lr({queryKey:mt.updates,queryFn:()=>he("/api/maintenance/updates"),refetchInterval:s}),qv=s=>lr({queryKey:mt.connect(s),queryFn:()=>he(s?`/api/connect?${s}`:"/api/connect")}),fm=s=>lr({queryKey:mt.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),he(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function Nt(s){return(s/1024**3).toFixed(1)}function nc(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function wn(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function Zv(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Gp(s){return s?`${Math.round(s/1024)}k`:"—"}function pm(s){var o,i,u="";if(typeof s=="string"||typeof s=="number")u+=s;else if(typeof s=="object")if(Array.isArray(s)){var d=s.length;for(o=0;o{const o=eb(s),{conflictingClassGroups:i,conflictingClassGroupModifiers:u}=s;return{getClassGroupId:m=>{const h=m.split(vc);return h[0]===""&&h.length!==1&&h.shift(),hm(h,o)||Xv(m)},getConflictingClassGroupIds:(m,h)=>{const v=i[m]||[];return h&&u[m]?[...v,...u[m]]:v}}},hm=(s,o)=>{var m;if(s.length===0)return o.classGroupId;const i=s[0],u=o.nextPart.get(i),d=u?hm(s.slice(1),u):void 0;if(d)return d;if(o.validators.length===0)return;const f=s.join(vc);return(m=o.validators.find(({validator:h})=>h(f)))==null?void 0:m.classGroupId},Kp=/^\[(.+)\]$/,Xv=s=>{if(Kp.test(s)){const o=Kp.exec(s)[1],i=o==null?void 0:o.substring(0,o.indexOf(":"));if(i)return"arbitrary.."+i}},eb=s=>{const{theme:o,prefix:i}=s,u={nextPart:new Map,validators:[]};return rb(Object.entries(s.classGroups),i).forEach(([f,m])=>{sc(m,u,f,o)}),u},sc=(s,o,i,u)=>{s.forEach(d=>{if(typeof d=="string"){const f=d===""?o:Qp(o,d);f.classGroupId=i;return}if(typeof d=="function"){if(tb(d)){sc(d(u),o,i,u);return}o.validators.push({validator:d,classGroupId:i});return}Object.entries(d).forEach(([f,m])=>{sc(m,Qp(o,f),i,u)})})},Qp=(s,o)=>{let i=s;return o.split(vc).forEach(u=>{i.nextPart.has(u)||i.nextPart.set(u,{nextPart:new Map,validators:[]}),i=i.nextPart.get(u)}),i},tb=s=>s.isThemeGetter,rb=(s,o)=>o?s.map(([i,u])=>{const d=u.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([m,h])=>[o+m,h])):f);return[i,d]}):s,nb=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,i=new Map,u=new Map;const d=(f,m)=>{i.set(f,m),o++,o>s&&(o=0,u=i,i=new Map)};return{get(f){let m=i.get(f);if(m!==void 0)return m;if((m=u.get(f))!==void 0)return d(f,m),m},set(f,m){i.has(f)?i.set(f,m):d(f,m)}}},mm="!",sb=s=>{const{separator:o,experimentalParseClassName:i}=s,u=o.length===1,d=o[0],f=o.length,m=h=>{const v=[];let x=0,b=0,j;for(let C=0;Cb?j-b:void 0;return{modifiers:v,hasImportantModifier:D,baseClassName:I,maybePostfixModifierPosition:w}};return i?h=>i({className:h,parseClassName:m}):m},ob=s=>{if(s.length<=1)return s;const o=[];let i=[];return s.forEach(u=>{u[0]==="["?(o.push(...i.sort(),u),i=[]):i.push(u)}),o.push(...i.sort()),o},lb=s=>({cache:nb(s.cacheSize),parseClassName:sb(s),...Jv(s)}),ib=/\s+/,ab=(s,o)=>{const{parseClassName:i,getClassGroupId:u,getConflictingClassGroupIds:d}=o,f=[],m=s.trim().split(ib);let h="";for(let v=m.length-1;v>=0;v-=1){const x=m[v],{modifiers:b,hasImportantModifier:j,baseClassName:M,maybePostfixModifierPosition:D}=i(x);let I=!!D,w=u(I?M.substring(0,D):M);if(!w){if(!I){h=x+(h.length>0?" "+h:h);continue}if(w=u(M),!w){h=x+(h.length>0?" "+h:h);continue}I=!1}const C=ob(b).join(":"),_=j?C+mm:C,$=_+w;if(f.includes($))continue;f.push($);const H=d(w,I);for(let z=0;z0?" "+h:h)}return h};function ub(){let s=0,o,i,u="";for(;s{if(typeof s=="string")return s;let o,i="";for(let u=0;uj(b),s());return i=lb(x),u=i.cache.get,d=i.cache.set,f=h,h(v)}function h(v){const x=u(v);if(x)return x;const b=ab(v,i);return d(v,b),b}return function(){return f(ub.apply(null,arguments))}}const Be=s=>{const o=i=>i[s]||[];return o.isThemeGetter=!0,o},xm=/^\[(?:([a-z-]+):)?(.+)\]$/i,db=/^\d+\/\d+$/,fb=new Set(["px","full","screen"]),pb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hb=/\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$/,mb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,yr=s=>vs(s)||fb.has(s)||db.test(s),Vr=s=>Ls(s,"length",Sb),vs=s=>!!s&&!Number.isNaN(Number(s)),Mu=s=>Ls(s,"number",vs),Co=s=>!!s&&Number.isInteger(Number(s)),yb=s=>s.endsWith("%")&&vs(s.slice(0,-1)),Ne=s=>xm.test(s),Gr=s=>pb.test(s),vb=new Set(["length","size","percentage"]),bb=s=>Ls(s,vb,ym),wb=s=>Ls(s,"position",ym),jb=new Set(["image","url"]),kb=s=>Ls(s,jb,Eb),Nb=s=>Ls(s,"",Cb),Eo=()=>!0,Ls=(s,o,i)=>{const u=xm.exec(s);return u?u[1]?typeof o=="string"?u[1]===o:o.has(u[1]):i(u[2]):!1},Sb=s=>hb.test(s)&&!mb.test(s),ym=()=>!1,Cb=s=>gb.test(s),Eb=s=>xb.test(s),Pb=()=>{const s=Be("colors"),o=Be("spacing"),i=Be("blur"),u=Be("brightness"),d=Be("borderColor"),f=Be("borderRadius"),m=Be("borderSpacing"),h=Be("borderWidth"),v=Be("contrast"),x=Be("grayscale"),b=Be("hueRotate"),j=Be("invert"),M=Be("gap"),D=Be("gradientColorStops"),I=Be("gradientColorStopPositions"),w=Be("inset"),C=Be("margin"),_=Be("opacity"),$=Be("padding"),H=Be("saturate"),z=Be("scale"),R=Be("sepia"),F=Be("skew"),K=Be("space"),ne=Be("translate"),ee=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],ke=()=>["auto",Ne,o],ue=()=>[Ne,o],Le=()=>["",yr,Vr],_e=()=>["auto",vs,Ne],Oe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Te=()=>["solid","dashed","dotted","double","none"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",Ne],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[vs,Ne];return{cacheSize:500,separator:":",theme:{colors:[Eo],spacing:[yr,Vr],blur:["none","",Gr,Ne],brightness:P(),borderColor:[s],borderRadius:["none","","full",Gr,Ne],borderSpacing:ue(),borderWidth:Le(),contrast:P(),grayscale:ce(),hueRotate:P(),invert:ce(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[yb,Vr],inset:ke(),margin:ke(),opacity:P(),padding:ue(),saturate:P(),scale:P(),sepia:ce(),skew:P(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[Gr]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"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:[...Oe(),Ne]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Co,Ne]}],basis:[{basis:ke()}],"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:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",Co,Ne]}],"grid-cols":[{"grid-cols":[Eo]}],"col-start-end":[{col:["auto",{span:["full",Co,Ne]},Ne]}],"col-start":[{"col-start":_e()}],"col-end":[{"col-end":_e()}],"grid-rows":[{"grid-rows":[Eo]}],"row-start-end":[{row:["auto",{span:[Co,Ne]},Ne]}],"row-start":[{"row-start":_e()}],"row-end":[{"row-end":_e()}],"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:[M]}],"gap-x":[{"gap-x":[M]}],"gap-y":[{"gap-y":[M]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[$]}],px:[{px:[$]}],py:[{py:[$]}],ps:[{ps:[$]}],pe:[{pe:[$]}],pt:[{pt:[$]}],pr:[{pr:[$]}],pb:[{pb:[$]}],pl:[{pl:[$]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[K]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[K]}],"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:[Gr]},Gr]}],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",Gr,Vr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mu]}],"font-family":[{font:[Eo]}],"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",vs,Mu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",yr,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":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Te(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",yr,Vr]}],"underline-offset":[{"underline-offset":["auto",yr,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":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Oe(),wb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",bb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kb]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[I]}],"gradient-via-pos":[{via:[I]}],"gradient-to-pos":[{to:[I]}],"gradient-from":[{from:[D]}],"gradient-via":[{via:[D]}],"gradient-to":[{to:[D]}],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:[h]}],"border-w-x":[{"border-x":[h]}],"border-w-y":[{"border-y":[h]}],"border-w-s":[{"border-s":[h]}],"border-w-e":[{"border-e":[h]}],"border-w-t":[{"border-t":[h]}],"border-w-r":[{"border-r":[h]}],"border-w-b":[{"border-b":[h]}],"border-w-l":[{"border-l":[h]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...Te(),"hidden"]}],"divide-x":[{"divide-x":[h]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[h]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:Te()}],"border-color":[{border:[d]}],"border-color-x":[{"border-x":[d]}],"border-color-y":[{"border-y":[d]}],"border-color-s":[{"border-s":[d]}],"border-color-e":[{"border-e":[d]}],"border-color-t":[{"border-t":[d]}],"border-color-r":[{"border-r":[d]}],"border-color-b":[{"border-b":[d]}],"border-color-l":[{"border-l":[d]}],"divide-color":[{divide:[d]}],"outline-style":[{outline:["",...Te()]}],"outline-offset":[{"outline-offset":[yr,Ne]}],"outline-w":[{outline:[yr,Vr]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:Le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[yr,Vr]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",Gr,Nb]}],"shadow-color":[{shadow:[Eo]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...Me(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Me()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[u]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",Gr,Ne]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[j]}],saturate:[{saturate:[H]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[u]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[j]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[R]}],"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:P()}],ease:[{ease:["linear","in","out","in-out",Ne]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ne]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[Co,Ne]}],"translate-x":[{"translate-x":[ne]}],"translate-y":[{"translate-y":[ne]}],"skew-x":[{"skew-x":[F]}],"skew-y":[{"skew-y":[F]}],"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:[yr,Vr,Mu]}],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"]}}},_b=cb(Pb);function te(...s){return _b(Yv(s))}function Lo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function ci({value:s,label:o,detail:i}){const d=2*Math.PI*24,f=d-Math.min(s,100)/100*d,m=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:te("fill-none transition-all duration-700 ease-out",m),strokeWidth:"4.5",strokeDasharray:d,strokeDashoffset:f,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),i&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Mb(){const{data:s}=xc(3e3);return n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(ci,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),n.jsx(ci,{value:s.ram.percent,label:"RAM",detail:`${Nt(s.ram.used)} / ${Nt(s.ram.total)} GB`}),s.gpu&&s.gpu.busy_percent!=null&&s.gpu.gtt_used!=null&&s.gpu.gtt_total!=null&&n.jsx(ci,{value:s.gpu.busy_percent,label:"GPU",detail:`${Nt(s.gpu.gtt_used)} / ${Nt(s.gpu.gtt_total)} GB`}),s.disk&&n.jsx(ci,{value:s.disk.percent,label:"Disk",detail:`${Nt(s.disk.used)} / ${Nt(s.disk.total)} GB`})]}):n.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)&&n.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&&n.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]})}function Si({type:s,title:o,message:i,defaultValue:u,onConfirm:d,onCancel:f}){const m=g.useRef(null);return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),n.jsx("button",{onClick:f||(()=>d()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:i}),s==="prompt"&&n.jsx("input",{ref:m,type:"text",defaultValue:u,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:h=>{var v;h.key==="Enter"&&d((v=m.current)==null?void 0:v.value)}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&n.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"}),n.jsx("button",{onClick:()=>{var v;const h=s==="prompt"?(v=m.current)==null?void 0:v.value:void 0;d(h)},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 Vo(){const[s,o]=g.useState(null),i=g.useCallback(()=>o(null),[]),u=g.useCallback((h,v,x)=>{o({type:"alert",title:h,message:v,onConfirm:()=>{o(null),x==null||x()}})},[]),d=g.useCallback((h,v,x,b)=>{o({type:"confirm",title:h,message:v,onConfirm:()=>{o(null),x()},onCancel:()=>{o(null),b==null||b()}})},[]),f=g.useCallback((h,v,x,b,j)=>{o({type:"prompt",title:h,message:v,defaultValue:x,onConfirm:M=>{o(null),b(M)},onCancel:()=>{o(null),j==null||j()}})},[]),m=s?n.jsx(Si,{...s}):null;return{showAlert:u,showConfirm:d,showPrompt:f,close:i,dialogElement:m}}function Rb(){const s=zs(),{data:o}=Qv(3e3),{data:i=[]}=Gv(3e3),{showConfirm:u,dialogElement:d}=Vo(),[f,m]=g.useState(""),[h,v]=g.useState(!1),[x,b]=g.useState(""),[j,M]=g.useState(!1),[D,I]=g.useState({open:!1,actionPath:"",actionLabel:""}),w=()=>{s.invalidateQueries({queryKey:mt.updates}),s.invalidateQueries({queryKey:mt.jobs}),s.invalidateQueries({queryKey:mt.models})};async function C(R,F,K,ne){m(`${F} wird ausgeführt...`),v(!0);try{const ee={...K},J=await he(R,{method:"POST",body:JSON.stringify(ee)});if(J.status==="password_required"||J.status==="incorrect_password"){I({open:!0,actionPath:R,actionLabel:F,payload:K,error:J.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),m("");return}J.job_id?m(`${F} gestartet (Job-ID: ${J.job_id})`):J.ok?m(`${F} erfolgreich ausgeführt.`):m(`Fehler: ${J.err||"Unbekannter Fehler"}`),w()}catch(ee){m(`Fehler bei ${F}: ${ee.message}`)}finally{v(!1)}}async function _(){M(!0);try{const R={...D.payload,sudo_password:x},F=await he(D.actionPath,{method:"POST",body:JSON.stringify(R)});if(F.status==="password_required"||F.status==="incorrect_password"){I(K=>({...K,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}F.job_id?m(`${D.actionLabel} gestartet (Job-ID: ${F.job_id})`):F.ok?m(`${D.actionLabel} erfolgreich ausgeführt.`):m(`Fehler: ${F.err||"Unbekannter Fehler"}`),I({open:!1,actionPath:"",actionLabel:""}),b(""),w()}catch(R){m(`Fehler: ${R.message}`),I({open:!1,actionPath:"",actionLabel:""}),b("")}finally{M(!1)}}async function $(R,F){m(`Upgrade für ${R} wird gestartet...`);try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:R,role:F,quant:"Q4_K_M",jinja:!0})}),m("Upgrade-Download gestartet."),w()}catch(K){m(`Upgrade fehlgeschlagen: ${K.message}`)}}const H=i.find(R=>R.label.includes("OS-Update")&&(R.state==="running"||R.state==="queued")),z=i.find(R=>R.label.includes("Engine-Update")&&(R.state==="running"||R.state==="queued"));return n.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:[D.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{I({open:!1,actionPath:"",actionLabel:""}),b("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:D.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:x,onChange:R=>b(R.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:R=>R.key==="Enter"&&_(),autoFocus:!0}),D.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:D.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{I({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"}),n.jsx("button",{onClick:_,disabled:!x||j,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:j?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(R0,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(o==null?void 0:o.last_check)&&n.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?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:te("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:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:o.os>0?`${o.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:te("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:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:o.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:te("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:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:o.models>0?`${o.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>C("/api/maintenance/os-update","OS-Update"),disabled:h||!!H,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:H?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",H.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>C("/api/maintenance/engine-update","Engine-Update"),disabled:h||!!z,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:z?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",z.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{u("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>C("/api/maintenance/reboot","Reboot"))},disabled:h,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:[n.jsx(Ph,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),o.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:o.model_list.map(R=>n.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:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${R.role}: ${R.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:R.role}),": ",R.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>$(R.repo,R.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:[n.jsx(Tn,{className:"h-2.5 w-2.5"})," Laden"]})]},R.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),f&&n.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}),n.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:[n.jsx(An,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.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"})}),d]})}function Ob(){const s=zs(),{data:o}=dm(3e3),{data:i}=yc(),{showAlert:u,dialogElement:d}=Vo(),[f,m]=g.useState(!1),h=(i==null?void 0:i.models)??[];async function v(x){try{await he("/api/agent/brain",{method:"POST",body:JSON.stringify({model:x})}),u("Erfolgreich",`Hermes-Gehirn wurde auf '${x}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:mt.agentStatus}),m(!1)}catch(b){u("Fehler",`Fehler beim Wechseln des Gehirns: ${b.message}`)}}return n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Oo,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(o==null?void 0:o.webui_url)&&n.jsxs("a",{href:Lo(o.webui_url),target:"_blank",rel:"noopener",className:te("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:[n.jsx(xi,{className:"h-3 w-3"})," Hermes öffnen"]})]}),o?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full",o.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:o.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full",o.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:o.webui_reachable?"Online":"Offline"})]})]})]}),n.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 group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(Ot,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(To,{className:"h-3.5 w-3.5"}),o.brain_model?`model: ${o.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."}),o&&f&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(Ot,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>m(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...h.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 n.jsxs("button",{onClick:()=>v(x),className:te("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:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:x}),n.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")&&n.jsx(Ds,{className:"h-4 w-4 shrink-0 text-primary"})]},x)})})]})}),d]})}const Db=["fast","heavy","coder","reasoning","vision","scout"];function Tb(){const{data:s}=yc(3e3),o=(s==null?void 0:s.models)??[],i=(s==null?void 0:s.running)??[];return n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:Db.map(u=>{var m;const d=o.find(h=>h.role===u),f=d?i.includes(d.name):!1;return n.jsxs("div",{className:te("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":d?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:te("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",u==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":u==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":u==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":u==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":u==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:u}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:d?(m=d.name.split("/").pop())==null?void 0:m.replace(/\.gguf$/i,""):"nicht zugewiesen"}),d&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[d.prompt_cache&&n.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"}),d.spec_draft_model&&n.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: ${d.spec_draft_model})`,children:"SPEC"}),d.parallel_slots>1&&n.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:`${d.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",d.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:d?f?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},u)})})]}),n.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 Ab(){const s=zs(),{data:o=[]}=fm({limit:3}),[i,u]=g.useState(""),[d,f]=g.useState("stable"),[m,h]=g.useState(!1);async function v(){if(!(!i.trim()||m)){h(!0);try{await he("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:d,source:"dashboard"})}),u(""),s.invalidateQueries({queryKey:["memory"]})}catch(x){console.error(x)}finally{h(!1)}}}return n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Do,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:i,onChange:x=>u(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"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:d,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:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:v,disabled:!i.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:[n.jsx(Eh,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:o.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):o.map(x=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.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}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:x.content,children:x.content})]},x.id))})]})]}),n.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 zb(){var o;const{data:s}=Kv(3e3);return n.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:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(y0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),s?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.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})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",s.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:s.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[s.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[s.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(o=s==null?void 0:s.pricing)!=null&&o.heavy?` (Ø ${s.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${s.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})}function Lb(){return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.jsx(Mb,{}),n.jsx(Rb,{})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.jsx(Ob,{}),n.jsx(Tb,{}),n.jsx(Ab,{}),n.jsx(zb,{})]})]})}function jn({children:s,tone:o="muted"}){const i={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${i[o]}`,children:s})}function qp({caps:s}){return s?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&n.jsx(jn,{children:"💻 Code"}),s.vision&&n.jsx(jn,{children:"👁 Bild"}),s.reasoning&&n.jsx(jn,{children:"🧠 Reason"}),s.moe&&n.jsxs(jn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&n.jsx(jn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&n.jsx(jn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&n.jsx(jn,{children:"🔢 Embed"})]}):null}function Ib({onError:s}){const[o,i]=g.useState([]),[u,d]=g.useState(null);function f(){he("/api/jobs").then(x=>i(x.jobs||[])).catch(()=>{})}g.useEffect(()=>{f();const x=setInterval(f,2e3);return()=>clearInterval(x)},[]);async function m(x){try{await he(`/api/jobs/${x}/cancel`,{method:"POST"}),f()}catch(b){s?s(b.message):d(b.message)}}const h=o.filter(x=>x.state==="running"||x.state==="queued"),v=o.filter(x=>x.state!=="running"&&x.state!=="queued").slice(-3);return h.length===0&&v.length===0?null:n.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:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),h.map(x=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:x.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[x.progress??0,"% • ",nc(x.done_bytes),"/",nc(x.total_bytes),x.eta_s?` • ETA ${Zv(x.eta_s)}`:""]}),n.jsx("button",{onClick:()=>m(x.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"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${x.progress??0}%`}})})]},x.id)),v.map(x=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:x.label}),n.jsx("span",{className:te("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",x.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:x.state})]},x.id)),u&&n.jsx(Si,{type:"alert",title:"Fehler",message:u,onConfirm:()=>d(null)})]})}function Fb({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 n.jsxs("span",{className:te("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}const Ub=["fast","heavy","coder","reasoning","agent","vision","scout"];function Zp(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 $b(){var Un,Sr,ir,$n,Us;const[s,o]=g.useState([]),[i,u]=g.useState([]),[d,f]=g.useState(null),[m,h]=g.useState(null),[v,x]=g.useState(null),[b,j]=g.useState(!0),[M,D]=g.useState(""),[I,w]=g.useState(null),[C,_]=g.useState(null),[$,H]=g.useState(!1),[z,R]=g.useState(null),[F,K]=g.useState("grid"),[ne,ee]=g.useState("all"),[J,ke]=g.useState(null);function ue(A,oe,be){ke({type:"alert",title:A,message:oe,onConfirm:()=>{ke(null)}})}function Le(A,oe,be,Ee){ke({type:"confirm",title:A,message:oe,onConfirm:()=>{ke(null),be()},onCancel:()=>{ke(null)}})}function _e(A,oe,be,Ee,Ie){ke({type:"prompt",title:A,message:oe,defaultValue:be,onConfirm:Ut=>{ke(null),Ee(Ut)},onCancel:()=>{ke(null)}})}const Oe=s.filter(A=>ne==="in_use"?!!A.role||i.includes(A.name):!0),[Te,Me]=g.useState({width:800,height:360}),Q=g.useRef(null),ce=g.useCallback(A=>{if(Q.current&&(Q.current.disconnect(),Q.current=null),A){const oe=new ResizeObserver(be=>{if(!be||be.length===0)return;const Ee=be[0].contentRect;Me({width:Ee.width,height:Ee.height})});oe.observe(A),Q.current=oe}},[]),Z=Te.width,P=Te.height,N=A=>{const oe=Z*.1,be=P*A,Ee=Z*.5,Ie=P*.5,Ut=Z*.3,ar=be,ur=Z*.3;return`M ${oe} ${be} C ${Ut} ${ar}, ${ur} ${Ie}, ${Ee} ${Ie}`},G=A=>{const oe=Z*.5,be=P*.5,Ee=Z*.9,Ie=P*A,Ut=Z*.7,ar=be,ur=Z*.7;return`M ${oe} ${be} C ${Ut} ${ar}, ${ur} ${Ie}, ${Ee} ${Ie}`};function X(){Promise.all([he("/api/models"),he("/api/routing"),he("/api/connect"),he("/api/maintenance/updates")]).then(([A,oe,be,Ee])=>{o(A.models||[]),u(A.running||[]),f(oe),h(be),x(Ee)}).catch(A=>D(String(A))).finally(()=>j(!1))}g.useEffect(()=>{X();const A=setInterval(X,4e3);return()=>clearInterval(A)},[]);async function Y(A){try{await he(`/api/models/${encodeURIComponent(A)}/load`,{method:"POST"}),X()}catch(oe){ue("Fehler",`Fehler beim Laden des Modells: ${oe.message}`)}}async function ie(A){try{await he(`/api/models/${encodeURIComponent(A)}/unload`,{method:"POST"}),X()}catch(oe){ue("Fehler",`Fehler beim Entladen des Modells: ${oe.message}`)}}async function pe(){try{await he("/api/models/unload",{method:"POST"}),X()}catch(A){ue("Fehler",`Fehler beim Entladen aller Modelle: ${A.message}`)}}async function we(A,oe){try{await he(`/api/models/${encodeURIComponent(oe)}/role`,{method:"POST",body:JSON.stringify({role:A||null})}),X()}catch(be){ue("Fehler",`Fehler beim Zuweisen der Rolle: ${be.message||be}`)}}async function U(A,oe){_e("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(oe||32768),async be=>{if(be)try{await he(`/api/models/${encodeURIComponent(A)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(be,10)})}),X()}catch(Ee){ue("Fehler",`Fehler beim Setzen des Kontexts: ${Ee.message||Ee}`)}})}async function me(A){Le("Modell löschen?",`Modell '${A}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await he(`/api/models/${encodeURIComponent(A)}`,{method:"DELETE"}),X()}catch(oe){ue("Fehler",`Fehler beim Löschen: ${oe.message||oe}`)}})}async function St(A,oe,be,Ee){try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:A,role:oe,quant:be,jinja:Ee})}),ue("Herunterladen gestartet",`Download für '${A}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Ie){ue("Fehler",`Fehler beim Starten des Upgrades: ${Ie.message||Ie}`)}}async function Go(A){A&&(await navigator.clipboard.writeText(A),H(!0),setTimeout(()=>H(!1),1500))}if(b)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(M)return n.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 (",M,")."]});const kr=s.filter(A=>i.includes(A.name)),ln=kr.reduce((A,oe)=>A+(oe.size_bytes||0),0),Is=16*1024**3,Fs=ln>Is?ln*1.2:Is,Fn=A=>s.find(oe=>oe.role===A),Nr=A=>{const oe=Fn(A);return oe?i.includes(oe.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` + @keyframes flow-dash { + to { + stroke-dashoffset: -20; + } + } + .svg-flow-path { + stroke-dasharray: 4 6; + animation: flow-dash 1s linear infinite; + } + `}),n.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:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Zu,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",wn(ln)," / ",wn(Fs)," geladen"]}),i.length>0&&n.jsx("button",{onClick:pe,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"})]})]}),n.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:kr.length===0?n.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"}):kr.map((A,oe)=>{var Ie;const be=(A.size_bytes||0)/Fs*100,Ee=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][oe%4];return n.jsxs("div",{style:{width:`${be}%`},className:te("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",Ee),title:`${A.name} (${wn(A.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[A.role?`[${A.role}] `:"",(Ie=A.name.split("/").pop())==null?void 0:Ie.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:wn(A.size_bytes)})]},A.name)})})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.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."})]}),n.jsxs("div",{ref:ce,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:N(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="roocode"||I==="roocode")&&n.jsx("path",{d:N(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="cursor"||I==="cursor")&&n.jsx("path",{d:N(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="opencode"||I==="opencode")&&n.jsx("path",{d:N(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="zed"||I==="zed")&&n.jsx("path",{d:N(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="continue"||I==="continue")&&n.jsx("path",{d:N(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("fast")&&n.jsx("path",{d:G(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("heavy")&&n.jsx("path",{d:G(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("coder")&&n.jsx("path",{d:G(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("vision")&&n.jsx("path",{d:G(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("scout")&&n.jsx("path",{d:G(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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:()=>R("roocode"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.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:()=>R("cursor"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.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:()=>R("opencode"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.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:()=>R("zed"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.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:()=>R("continue"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.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:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",d!=null&&d.heavy_threshold_chars?d.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.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"})]}),Ub.map(A=>{var Ut;const oe=["12%","31%","50%","69%","88%"],be=Fn(A),Ee=be?i.includes(be.name):!1;if(A==="reasoning"||A==="agent")return null;const Ie={fast:0,heavy:1,coder:2,vision:3,scout:4}[A];return n.jsxs("div",{className:te("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",Ee?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":be?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:oe[Ie]},onClick:()=>_(A),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:A}),Ee&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:be?(Ut=be.name.split("/").pop())==null?void 0:Ut.replace(".gguf",""):"Keine Zuweisung"})]},A)}),I&&m&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[I==="roocode"&&"Roo Code Setup",I==="cursor"&&"Cursor Setup",I==="opencode"&&"OpenCode Setup",I==="zed"&&"Zed Setup",I==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>w(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[I==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),I==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),I==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),I==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),I==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),m.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var A,oe,be,Ee,Ie;return Go(I==="roocode"?(A=m.tools.cline)==null?void 0:A.snippet:I==="cursor"?(oe=m.tools.cursor)==null?void 0:oe.snippet:I==="opencode"?(be=m.tools.opencode)==null?void 0:be.snippet:I==="zed"?(Ee=m.tools.zed)==null?void 0:Ee.snippet:(Ie=m.tools.continue)==null?void 0:Ie.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[$?n.jsx(Ds,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Ch,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:$?"Kopiert":"Kopieren"})]})]}),n.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:n.jsxs("code",{children:[I==="roocode"&&((Un=m.tools.cline)==null?void 0:Un.snippet),I==="cursor"&&((Sr=m.tools.cursor)==null?void 0:Sr.snippet),I==="opencode"&&((ir=m.tools.opencode)==null?void 0:ir.snippet),I==="zed"&&(($n=m.tools.zed)==null?void 0:$n.snippet),I==="continue"&&((Us=m.tools.continue)==null?void 0:Us.snippet)]})})]}),n.jsx("button",{onClick:()=>w(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"})]})})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(A=>{var Ee;const oe=s.find(Ie=>Ie.role===A),be=oe?i.includes(oe.name):!1;return n.jsxs("div",{onClick:()=>_(A),className:te("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]",be?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":oe?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:te("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==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-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}),be&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:oe==null?void 0:oe.name,children:oe?(Ee=oe.name.split("/").pop())==null?void 0:Ee.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},A)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Oe.length," von ",s.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>ee("all"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>ee("in_use"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>K("grid"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",F==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>K("list"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",F==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),F==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Oe.length===0?n.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:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Oe.map(A=>{const oe=i.includes(A.name),be=v==null?void 0:v.model_list.find(Ie=>Ie.role===A.role),Ee=Zp(A.name);return n.jsxs("div",{className:te("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",oe?"border-primary/45 shadow-primary/5":A.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:te("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ee.color),title:Ee.name,children:Ee.initial}),n.jsxs("div",{className:"min-w-0",children:[n.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()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.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"}),oe&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(gi,{className:"h-3 w-3 animate-pulse"})," Warm"]}),A.role&&n.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&&n.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_draft_model&&n.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.parallel_slots>1&&n.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]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(qp,{caps:A.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(Zu,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:wn(A.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(C0,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:Gp(A.ctx)})]})]})]}),be&&n.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:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",be.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>St(be.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:[n.jsx(Tn,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>oe?ie(A.name):Y(A.name),className:te("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",oe?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:oe?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(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"}),n.jsx("button",{onClick:()=>me(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:n.jsx(Yu,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})}):n.jsx("div",{className:"space-y-2",children:Oe.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Oe.map(A=>{const oe=i.includes(A.name),be=Zp(A.name);return n.jsxs("div",{className:te("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",oe?"border-primary/45":A.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:te("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",be.color),title:be.name,children:be.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.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&&n.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&&n.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_draft_model&&n.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.parallel_slots>1&&n.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]}),oe&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",wn(A.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",Gp(A.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:A.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(qp,{caps:A.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>oe?ie(A.name):Y(A.name),className:te("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",oe?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:oe?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(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"}),n.jsx("button",{onClick:()=>me(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:n.jsx(Yu,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",C,"' konfigurieren"]}),n.jsx("button",{onClick:()=>_(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:C}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{we(C,""),_(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:n.jsx("span",{children:"Zuweisung entfernen"})}),s.map(A=>{var oe;return n.jsxs("button",{onClick:()=>{we(C,A.name),_(null)},className:te("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===C?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(oe=A.name.split("/").pop())==null?void 0:oe.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[wn(A.size_bytes)," · ",A.quant]})]}),A.role===C&&n.jsx(Ds,{className:"h-4 w-4 shrink-0 text-primary"})]},A.name)})]})]})}),J&&n.jsx(Si,{type:J.type,title:J.title,message:J.message,defaultValue:J.defaultValue,onConfirm:J.onConfirm,onCancel:J.onCancel})]})}function Bb(){const[s,o]=g.useState(""),[i,u]=g.useState([]),[d,f]=g.useState("Q4_K_M"),[m,h]=g.useState(""),[v,x]=g.useState(""),[b,j]=g.useState([]);async function M(w){const C=w??s;if(C.trim()){h("Analysiere HuggingFace Repository...");try{const _=await he(`/api/hf/quants?repo=${encodeURIComponent(C)}`);o(_.repo),u(_.quants),_.quants.length&&f(_.quants.includes("Q4_K_M")?"Q4_K_M":_.quants[0]),h(_.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(_){h(`Fehler: ${_}`)}}}async function D(){if(v.trim()){h("Durchsuche HuggingFace...");try{const w=await he(`/api/hf/search?q=${encodeURIComponent(v)}`);j(w.results),h(w.results.length?"":"Keine Ergebnisse gefunden.")}catch(w){h(`Suche fehlgeschlagen: ${w}`)}}}async function I(){if(s.trim()){h("Download-Job wird initiiert...");try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:d,jinja:!0})}),h(`Download gestartet: ${s} (${d}). Fortschritt wird oben angezeigt.`)}catch(w){h(`Download-Fehler: ${w}`)}}}return n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:s,onChange:w=>o(w.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"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>M(),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"}),i.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:d,onChange:w=>f(w.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:i.map(w=>n.jsx("option",{value:w,className:"bg-popover text-foreground",children:w},w))}),n.jsxs("button",{onClick:I,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:[n.jsx(Tn,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:v,onChange:w=>x(w.target.value),onKeyDown:w=>w.key==="Enter"&&D(),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"}),n.jsx(fc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:D,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"})]}),b.length>0&&n.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:b.map(w=>n.jsxs("button",{onClick:()=>{o(w.repo),j([]),x(""),M(w.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:[n.jsx("span",{className:"font-semibold truncate",children:w.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(Tn,{className:"h-3 w-3"})," ",w.downloads.toLocaleString()]})]},w.repo))}),m&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:m})]})}const Hb={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:qu},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Ku},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Do},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Oo},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:Qu}};function Wb(){const[s,o]=g.useState(null),[i,u]=g.useState([]),[d,f]=g.useState(null),[m,h]=g.useState(""),[v,x]=g.useState(!0),[b,j]=g.useState({}),[M,D]=g.useState({}),[I,w]=g.useState(!1);g.useEffect(()=>{Promise.all([he("/api/discover"),he("/api/models"),he("/api/maintenance/updates").catch(()=>null)]).then(([_,$,H])=>{o(_),u($.models||[]),H&&f(H)}).catch(_=>h(String(_))).finally(()=>x(!1))},[]);async function C(_,$,H,z){j(R=>({...R,[_]:"Starte..."}));try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:_,role:$,quant:H,jinja:z})}),j(R=>({...R,[_]:"Download läuft"}))}catch{j(F=>({...F,[_]:"Fehler"}))}}return v?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):m||!s?n.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,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.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:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(_h,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(_=>{const $=Hb[_.role]||{title:_.title||_.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:To},H=$.icon,z=i.find(J=>J.role===_.role),R=d==null?void 0:d.model_list.find(J=>J.role===_.role),F=_.models.find(J=>J.repo===_.recommended)||_.models[0];if(!F)return null;const K=b[F.repo],ne=_.models.filter(J=>J.repo!==_.recommended),ee=!!M[_.role];return n.jsxs("div",{className:te("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",z?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.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:n.jsx(H,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:$.title}),n.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: ",_.role]})]})]}),z?n.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:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.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"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:z?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:z.name,children:z.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",nc(z.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",z.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:F.name,children:F.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",F.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",F.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(Fb,{fit:F.fit})})]})}),n.jsx("div",{className:"pt-1",children:z?R?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",R.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>C(R.repo,_.role,F.quant||"Q4_K_M",F.caps.tools!=="no"),disabled:!!b[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:[n.jsx(Tn,{className:"h-3.5 w-3.5"}),b[R.repo]||"Auf neue Version aktualisieren"]})]}):n.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:[n.jsx(Ds,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>C(F.repo,_.role,F.quant||"Q4_K_M",F.caps.tools!=="no"),disabled:!!K,className:te("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",K?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(Tn,{className:"h-3.5 w-3.5"}),K||"Optimales Modell einsetzen"]})})]}),ne.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>D(J=>({...J,[_.role]:!ee})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[ee?n.jsx(m0,{className:"h-3 w-3"}):n.jsx(f0,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",ne.length,")"]})]}),ee&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:ne.map(J=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:J.name,children:J.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",J.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:J.fit.text})]})]}),n.jsx("button",{onClick:()=>C(J.repo,_.role,J.quant||"Q4_K_M",J.caps.tools!=="no"),disabled:!!b[J.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:b[J.repo]||"Installieren"})]},J.repo))})]})]},_.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>w(!I),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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(fc,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:I?"Ausblenden ▲":"Anzeigen ▼"})]}),I&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(Bb,{})})]})]})}function Vb(){const[s,o]=g.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(i=>n.jsx("button",{onClick:()=>o(i),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",s===i?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:i==="cockpit"?"Cockpit":"Modelle finden"},i))})]}),n.jsx(Ib,{}),n.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?n.jsx($b,{}):n.jsx(Wb,{})})]})}function di({label:s,percent:o,detail:i,icon:u}){const d=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 n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(u,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:te("h-full transition-all duration-700 ease-out",d),style:{width:`${Math.min(o,100)}%`}})}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Gb(){const{data:s,error:o}=xc(3e3),{data:i}=Vv(3e3),{showAlert:u,dialogElement:d}=Vo(),f=o?String(o):"",[m,h]=g.useState(""),[v,x]=g.useState({});async function b(){h("Backup snapshotted...");try{const M=await he("/api/system/backup",{method:"POST"});h(M.ok?`Snapshot erzeugt: ${M.snapshot} (${M.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(M){h(`Fehler: ${M.message}`)}}async function j(M){x(D=>({...D,[M]:!0}));try{const D=await he("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:M})});D.ok?u("Erfolgreich",`Dienst ${M} wurde erfolgreich neu gestartet.`):u("Fehler beim Neustart",`Fehler beim Neustart: ${D.err||"Unbekannter Fehler"}`)}catch(D){u("Fehler",`Fehler: ${D.message}`)}finally{x(D=>({...D,[M]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.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&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(di,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:Ot}),n.jsx(di,{label:"RAM",percent:s.ram.percent,detail:`${Nt(s.ram.used)} / ${Nt(s.ram.total)} GB`,icon:gi}),s.gpu&&s.gpu.busy_percent!=null&&n.jsx(di,{label:"GPU",percent:s.gpu.busy_percent,detail:s.gpu.gtt_used!=null&&s.gpu.gtt_total?`${Nt(s.gpu.gtt_used)} / ${Nt(s.gpu.gtt_total)} GB (GTT/unified)`:s.gpu.vram_used!=null&&s.gpu.vram_total?`${Nt(s.gpu.vram_used)} / ${Nt(s.gpu.vram_total)} GB VRAM`:void 0,icon:Ot}),s.disk&&n.jsx(di,{label:"Disk",percent:s.disk.percent,detail:`${Nt(s.disk.used)} / ${Nt(s.disk.total)} GB`,icon:Zu})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&n.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&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&n.jsx("span",{children:"|"}),s.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),i&&n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.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"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:i.services.map(M=>n.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:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:te("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",M.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:M.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:M.url})]})]}),n.jsx("button",{onClick:()=>j(M.name),disabled:v[M.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:n.jsx(Dn,{className:te("h-3.5 w-3.5",v[M.name]&&"animate-spin")})})]},M.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Lo(i.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:[n.jsx(xi,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Lo(i.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:[n.jsx(xi,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.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:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.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:[n.jsx(P0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),m&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:m}),d]})}function Kb(){const[s,o]=g.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[i,u]=g.useState(localStorage.getItem("mc_mcp_path")||""),[d,f]=g.useState("cline"),[m,h]=g.useState(!1),v=new URLSearchParams({host:s});i&&v.set("mcp_path",i);const{data:x,error:b}=qv(v.toString()),j=b?String(b):"";function M(C){o(C),C&&localStorage.setItem("mc_host",C)}function D(C){u(C),localStorage.setItem("mc_mcp_path",C)}const I=x==null?void 0:x.tools[d];async function w(){I&&(await navigator.clipboard.writeText(I.snippet),h(!0),setTimeout(()=>h(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.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:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(j0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:s,onChange:C=>M(C.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"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(w0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:i,onChange:C=>D(C.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"})]})]}),j&&n.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: ",j]}),x&&n.jsxs("div",{className:"space-y-4",children:[n.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(([C,_])=>n.jsx("button",{onClick:()=>f(C),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",d===C?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:_.label},C))}),I&&n.jsxs("div",{className:"space-y-3",children:[I.note&&n.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:[n.jsx(k0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:I.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.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:[n.jsx(yi,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:d==="cline"||d==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:w,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?n.jsx(Ds,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Ch,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:m?"Kopiert":"Kopieren"})]})]}),n.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:n.jsx("code",{children:I.snippet})})]})]})]})]})}const Yp=["user","instruction","stable","versioned","ephemeral"],Ru={user:{label:"User",icon:A0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:_0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:An,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:D0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:x0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Jp={label:"Gedächtnis",icon:Sh,bg:"bg-muted/10",text:"text-muted-foreground"},Qb={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 qb(){const[s,o]=g.useState(""),[i,u]=g.useState(""),[d,f]=g.useState(""),[m,h]=g.useState("stable"),[v,x]=g.useState(!1),b=zs(),{showAlert:j,showConfirm:M,dialogElement:D}=Vo(),{data:I=[],error:w}=fm({q:i,category:s}),C=w?String(w):"",_=()=>b.invalidateQueries({queryKey:["memory"]});async function $(){d.trim()&&(await he("/api/memory",{method:"POST",body:JSON.stringify({content:d,category:m,source:"ui"})}),f(""),_())}async function H(R){await he(`/api/memory/${R}`,{method:"DELETE"}),_()}async function z(){x(!0);try{const R=await he("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(R.duplicate_count===0){j("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${R.duplicate_count} Dublette(n) in ${R.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await he("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),_()}catch(F){j("Fehler",`Fehler beim Löschen: ${F.message}`)}})}catch(R){j("Fehler",`Fehler bei der Deduplizierung: ${R.message}`)}finally{x(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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)"}),n.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."})]}),n.jsxs("button",{onClick:z,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:[n.jsx(O0,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.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:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:d,onChange:R=>f(R.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"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:m,onChange:R=>h(R.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:Yp.map(R=>{var F;return n.jsx("option",{value:R,className:"bg-popover text-foreground",children:((F=Ru[R])==null?void 0:F.label)||R},R)})})]}),n.jsxs("button",{onClick:$,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:[n.jsx(Eh,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:i,onChange:R=>u(R.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"}),n.jsx(fc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.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:[n.jsx("button",{onClick:()=>o(""),className:te("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"}),Yp.map(R=>{const F=Ru[R]||Jp,K=F.icon;return n.jsxs("button",{onClick:()=>o(R),className:te("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===R?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(K,{className:"h-3 w-3"}),n.jsx("span",{children:F.label})]},R)})]})]}),C&&n.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: ",C]}),n.jsx("div",{className:"space-y-3",children:I.length===0?n.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."}):I.map(R=>{const F=Ru[R.category]||Jp,K=F.icon;return n.jsxs("div",{className:te("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",Qb[R.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:te("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",F.bg,F.text),children:[n.jsx(K,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:F.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:R.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.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:R.source}),n.jsx("button",{onClick:()=>H(R.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:n.jsx(Yu,{className:"h-3.5 w-3.5"})})]})]},R.id)})}),D]})}function fi({label:s,ok:o,detail:i,icon:u,onClick:d}){return n.jsxs("div",{onClick:d,className:te("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",d&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),n.jsx(u,{className:te("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:i,children:i})]}),d&&n.jsxs("button",{onClick:f=>{f.stopPropagation(),d()},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:[n.jsx(Ot,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function Zb(){const{data:s,error:o}=dm(5e3),{data:i}=yc(),{showAlert:u,dialogElement:d}=Vo(),f=zs(),m=o?String(o):"",h=g.useMemo(()=>["auto","fast","heavy",...((i==null?void 0:i.models)??[]).map(R=>{var F;return((F=R.name.split("/").pop())==null?void 0:F.replace(".gguf",""))||R.name})],[i]),[v,x]=g.useState(null),[b,j]=g.useState(!1),[M,D]=g.useState({width:800,height:360}),I=g.useRef(null),w=g.useCallback(z=>{if(I.current&&(I.current.disconnect(),I.current=null),z){const R=new ResizeObserver(F=>{if(!F||F.length===0)return;const K=F[0].contentRect;D({width:K.width,height:K.height})});R.observe(z),I.current=R}},[]),C=M.width,_=M.height,$=(z,R,F,K)=>{const ne=(z+F)/2;return`M ${z} ${R} C ${ne} ${R}, ${ne} ${K}, ${F} ${K}`};async function H(z){try{await he("/api/agent/brain",{method:"POST",body:JSON.stringify({model:z})}),u("Erfolgreich",`Hermes-Gehirn wurde auf '${z}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:mt.agentStatus}),j(!1)}catch(R){u("Fehler",`Fehler beim Wechseln des Gehirns: ${R.message}`)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` + @keyframes flow-dash { + to { + stroke-dashoffset: -20; + } + } + .svg-flow-path { + stroke-dasharray: 4 6; + animation: flow-dash 1s linear infinite; + } + `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.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"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(s==null?void 0:s.webui_url)&&n.jsxs("a",{href:Lo(s.webui_url),target:"_blank",rel:"noopener",className:te("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:[n.jsx(xi,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),m&&n.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&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(fi,{label:"Agent Gateway",ok:s.gateway_reachable,detail:"Port :8642 (REST API)",icon:Oo}),n.jsx(fi,{label:"Agent WebUI",ok:s.webui_reachable,detail:"Port :8787 (Chat UI)",icon:gi}),n.jsx(fi,{label:"Aktives Gehirn",ok:s.gateway_reachable,detail:s.brain_model?`Model: ${s.brain_model}`:"Model: auto",icon:Ot,onClick:()=>j(!0)}),n.jsx(fi,{label:"Verdrahtung",ok:s.has_config,detail:`Config: ${s.has_config?"✓":"—"} · Skills: ${s.has_skills?"✓":"—"} · Memory: ${s.has_memories?"✓":"—"}`,icon:vi})]}),n.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:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:w,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="webui"||s.webui_reachable)&&n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="brain"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="wiring"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.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(Lo(s.webui_url),"_blank"),title:s.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(gi,{className:te("h-3.5 w-3.5",s.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:te("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",s.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Oo,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:te("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"})]}),n.jsxs("div",{className:te("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:()=>j(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(Ot,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),s.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.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"})]}),n.jsxs("div",{className:te("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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(vi,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),s.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",s.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",s.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",s.has_memories?"✓":"—"]})]})]})]}),n.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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(An,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!s.gateway_reachable&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(An,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.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&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.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:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(Ot,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>j(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.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 (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:h.map(z=>{const R=["auto","fast","heavy"].includes(z);return n.jsxs("button",{onClick:()=>H(z),className:te("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===z||!s.brain_model&&z==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:z}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:R?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(s.brain_model===z||!s.brain_model&&z==="auto")&&n.jsx(Ds,{className:"h-4 w-4 shrink-0 text-primary"})]},z)})})]})}),d]})}function Yb(){const[s,o]=g.useState("connect"),[i,u]=g.useState("roocode"),[d,f]=g.useState(null),m="192.168.178.151",[h,v]=g.useState(!1),[x,b]=g.useState(null);function j(){v(!0),he("/api/health").then(M=>{f(M),b(M.engine_reachable?"success":"partial")}).catch(()=>{f(null),b("fail")}).finally(()=>v(!1))}return g.useEffect(()=>{j()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.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"}),n.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."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>o("connect"),className:te("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"}),n.jsx("button",{onClick:()=>o("concepts"),className:te("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"?n.jsxs(n.Fragment,{children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:te("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")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.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${(d==null?void 0:d.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..."]})]})]}),n.jsxs("button",{onClick:j,disabled:h,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:[n.jsx(Dn,{className:te("h-3.5 w-3.5",h&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(Sh,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Ot,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.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."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(To,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Do,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.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."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(Ku,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>u("roocode"),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer flex items-center gap-1.5",i==="roocode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:[n.jsx(_h,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>u("cursor"),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="cursor"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"Cursor IDE"}),n.jsx("button",{onClick:()=>u("opencode"),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="opencode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"OpenCode Desktop"})]}),n.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:[i==="roocode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),i==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",m,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.jsx("strong",{children:"auto"})," ein und wähle es als aktives Modell aus. Cursor leitet ab jetzt alle deine Anfragen an die Box weiter."]})]})]})]}),i==="opencode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.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."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.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"]}),n.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.'})]})]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(yi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.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:[n.jsx(Qu,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.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."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(To,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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 ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Qu,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsxs("p",{children:[n.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."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]}),n.jsxs("li",{children:[n.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."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Do,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.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 +...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.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:",n.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:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.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 ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.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."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Ot,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.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."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(vi,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(yi,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(Ku,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(vi,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.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."})]})]})]}),n.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:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(An,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Cp,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Cp,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.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 Jb({title:s,hint:o}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:s}),n.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),n.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:[n.jsx(b0,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Xb=[{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 Ou(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function e1({open:s,onClose:o,defaultTab:i="maintenance"}){const[u,d]=g.useState(null),[f,m]=g.useState([]),[h,v]=g.useState("llama-swap"),[x,b]=g.useState(""),[j,M]=g.useState(!1),[D,I]=g.useState(null),[w,C]=g.useState({}),[_,$]=g.useState("maintenance"),[H,z]=g.useState(!1),[R,F]=g.useState(null);function K(U,me,St){F({type:"alert",title:U,message:me,onConfirm:()=>{F(null),St&&St()}})}function ne(U,me,St){F({type:"confirm",title:U,message:me,onConfirm:()=>{F(null),St()},onCancel:()=>F(null)})}function ee(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[J,ke]=g.useState(""),[ue,Le]=g.useState(""),[_e,Oe]=g.useState(!1),[Te,Me]=g.useState(!1);g.useEffect(()=>{s&&(ke(localStorage.getItem("mc_sudo_password")||""),Le(localStorage.getItem("mc_hf_token")||""))},[s]),g.useEffect(()=>{s&&i&&$(i)},[s,i]);const Q=g.useRef(null);function ce(){he("/api/maintenance/updates").then(d).catch(U=>console.error("Error loading updates",U))}function Z(){he("/api/jobs").then(U=>m(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function P(U){M(!0),I(null),he(`/api/maintenance/logs?service=${U}&lines=150`).then(me=>{me.ok?b(me.text):(b(`Fehler beim Laden der Logs: ${me.err||"Unbekannter Fehler"}`),(me.status==="incorrect_password"||me.status==="password_required")&&I(me.status))}).catch(me=>b(`Fehler: ${me.message}`)).finally(()=>{M(!1),setTimeout(()=>{Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},50)})}g.useEffect(()=>{if(!s)return;ce(),Z();const U=setInterval(()=>{Z(),ce()},3e3);return()=>clearInterval(U)},[s]),g.useEffect(()=>{!s||_!=="logs"||P(h)},[s,_,h]);async function N(){try{await he("/api/maintenance/os-update",{method:"POST"}),Z(),$("maintenance")}catch(U){K("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function G(){try{await he("/api/maintenance/engine-update",{method:"POST"}),Z(),$("maintenance")}catch(U){K("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function X(){z(!0);try{await he("/api/maintenance/check-updates",{method:"POST"}),Z(),$("maintenance")}catch(U){K("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{z(!1)}}async function Y(U,me){try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:me})}),K("Gestartet",`Modell-Upgrade für '${me}' (${U}) gestartet.`),Z(),$("maintenance")}catch(St){K("Fehler",`Fehler beim Starten des Modell-Upgrades: ${St.message}`)}}async function ie(){ne("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await he("/api/maintenance/reboot",{method:"POST"}),K("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){K("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function pe(U){C(me=>({...me,[U]:!0}));try{const me=await he("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});me.ok?K("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&h===U&&P(U)}):K("Fehler",`Fehler beim Neustart: ${me.err||"Unbekannter Fehler"}`)}catch(me){K("Fehler",`Fehler beim Neustart: ${me.message}`)}finally{C(me=>({...me,[U]:!1}))}}async function we(U){try{await he(`/api/jobs/${U}/cancel`,{method:"POST"}),Z()}catch(me){K("Fehler",`Fehler beim Abbrechen: ${me.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:te("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}),n.jsxs("div",{className:te("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:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.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:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>$("maintenance"),className:te("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>$("logs"),className:te("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>$("settings"),className:te("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",ee(u.last_check)]}),n.jsxs("button",{onClick:X,disabled:H,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Dn,{className:te("h-3 w-3",H&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:N,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:[n.jsx(An,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.os?`${u.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:G,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:[n.jsx(M0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:ie,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:[n.jsx(Ph,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(u==null?void 0:u.model_list)&&u.model_list.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",ee(u.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:u.model_list.map(U=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:U.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),n.jsxs("button",{onClick:()=>Y(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:[n.jsx(Tn,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.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"]})]}),n.jsx("div",{className:"space-y-3",children:f.length===0?n.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 me=U.state==="running"||U.state==="queued";return n.jsxs("div",{className:te("p-3 rounded-xl border transition-all duration-300",me?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[me&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",U.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:te(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})]})]}),me&&n.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"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&n.jsxs("span",{children:[Ou(U.done_bytes)," / ",Ou(U.total_bytes),U.rate_bps!=null&&` (${Ou(U.rate_bps)}/s)`]}),U.eta_s!=null&&n.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),_==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:h,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:Xb.map(U=>n.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),n.jsxs("button",{onClick:()=>pe(h),disabled:w[h],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[n.jsx(Dn,{className:te("h-3.5 w-3.5",w[h]&&"animate-spin")}),"Restart"]})]}),n.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:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(yi,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",h]})]}),n.jsx("button",{onClick:()=>P(h),disabled:j,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Dn,{className:te("h-3 w-3",j&&"animate-spin")})})]}),n.jsx("pre",{ref:Q,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:D==="password_required"||D==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(T0,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:D==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",h," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>$("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"})]}):j&&!x?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):x||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(An,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:_e?"text":"password",value:J,onChange:U=>ke(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"}),n.jsx("button",{type:"button",onClick:()=>Oe(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:_e?n.jsx(Ep,{className:"h-4 w-4"}):n.jsx(qu,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(N0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Te?"text":"password",value:ue,onChange:U=>Le(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"}),n.jsx("button",{type:"button",onClick:()=>Me(!Te),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Te?n.jsx(Ep,{className:"h-4 w-4"}):n.jsx(qu,{className:"h-4 w-4"})})]}),n.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."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",J),localStorage.setItem("mc_hf_token",ue),K("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"}),n.jsx("button",{onClick:()=>{ke(""),Le(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),K("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&&n.jsx(Si,{type:R.type,title:R.title,message:R.message,onConfirm:R.onConfirm,onCancel:R.onCancel})]})}function t1(){var j,M,D,I,w;const[s,o]=g.useState("dashboard"),[i,u]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[d,f]=g.useState(!1),[m,h]=g.useState("maintenance"),{data:v}=Wv(),{data:x}=xc(2e4);g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const C=_=>{var H;h(((H=_.detail)==null?void 0:H.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",C),()=>window.removeEventListener("open-system-drawer",C)},[]);const b=Ju.find(C=>C.id===s);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.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]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Hv,{onNavigate:o}),n.jsx(e1,{open:d,onClose:()=>f(!1),defaultTab:m}),n.jsxs("aside",{className:te("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",i?"w-16":"w-60"),children:[n.jsxs("div",{className:te("flex items-center py-4 border-b border-border/40 shrink-0",i?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!i&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{u(C=>{const _=!C;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:i?"Maximieren":"Minimieren",children:i?n.jsx(h0,{className:"h-4 w-4"}):n.jsx(p0,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Ju.map(C=>n.jsxs("button",{onClick:()=>o(C.id),className:te("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",i?"justify-center p-2.5":"gap-3 px-3 py-2",s===C.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:i?C.label:void 0,children:[n.jsx(C.icon,{className:"h-4.5 w-4.5 shrink-0"}),!i&&n.jsx("span",{className:"truncate",children:C.label})]},C.id))}),n.jsx("div",{className:te("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",i?"px-2 text-center":"px-5"),children:i?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:te("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"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[v?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(x==null?void 0:x.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.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:[n.jsx("strong",{children:"MC2:"})," ",x.versions.mc2?`${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((j=x.versions.engine)==null?void 0:j.type)==="git"?`${x.versions.engine.branch}-${x.versions.engine.hash}${x.versions.engine.dirty?"*":""} (${x.versions.engine.date})`:((M=x.versions.engine)==null?void 0:M.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((D=x.versions.engine)==null?void 0:D.type)==="git"?`${x.versions.engine.hash}${x.versions.engine.dirty?"*":""}`:((w=(I=x.versions.engine)==null?void 0:I.version_text)==null?void 0:w.split(" ").pop())||"—"]}),n.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:[n.jsx("strong",{children:"Hermes UI:"})," ",x.versions.hermes_ui?`${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.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:[n.jsx("strong",{children:"Hermes Agent:"})," ",x.versions.hermes_agent?`${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.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:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.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"}),n.jsxs("button",{onClick:()=>{const C=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(C)},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:[n.jsx(v0,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&n.jsx(Lb,{}),s==="models"&&n.jsx(Vb,{}),s==="system"&&n.jsx(Gb,{}),s==="connect"&&n.jsx(Kb,{}),s==="memory"&&n.jsx(qb,{}),s==="agent"&&n.jsx(Zb,{}),s==="guide"&&n.jsx(Yb,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&n.jsx(Jb,{title:b.label,hint:b.hint})]})]})]})}const r1=new qx({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});kx.createRoot(document.getElementById("root")).render(n.jsx(ch.StrictMode,{children:n.jsx(Zx,{client:r1,children:n.jsx(t1,{})})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index d27c3e5..714b7ab 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/AgentStatusCard.tsx b/frontend/src/components/dashboard/AgentStatusCard.tsx new file mode 100644 index 0000000..6ec5e81 --- /dev/null +++ b/frontend/src/components/dashboard/AgentStatusCard.tsx @@ -0,0 +1,149 @@ +import { useState } from "react" +import { Bot, ExternalLink, Cpu, Layers, X, Check } from "lucide-react" +import { api } from "@/lib/api" +import { useAgentStatus, useModels, useQueryClient, qk } from "@/lib/queries" +import { useDialog } from "@/lib/useDialog" +import { cn, resolveExternalUrl } from "@/lib/utils" + +export function AgentStatusCard() { + const qc = useQueryClient() + const { data: agent } = useAgentStatus(3_000) + const { data: modelsData } = useModels() + const { showAlert, dialogElement } = useDialog() + const [showBrainSelect, setShowBrainSelect] = useState(false) + + const models = modelsData?.models ?? [] + + async function changeBrainModel(model: string) { + try { + await api("/api/agent/brain", { method: "POST", body: JSON.stringify({ model }) }) + showAlert("Erfolgreich", `Hermes-Gehirn wurde auf '${model}' geändert. Der Gateway-Dienst wurde neu gestartet.`) + qc.invalidateQueries({ queryKey: qk.agentStatus }) + setShowBrainSelect(false) + } catch (e: any) { + showAlert("Fehler", `Fehler beim Wechseln des Gehirns: ${e.message}`) + } + } + + return ( +
+
+
+
+ +

Hermes Agent

+
+ {agent?.webui_url && ( + + Hermes öffnen + + )} +
+ + {agent ? ( +
+
+
+
Gateway
+
+ + {agent.gateway_reachable ? "Online" : "Offline"} +
+
+
+
WebUI
+
+ + {agent.webui_reachable ? "Online" : "Offline"} +
+
+
+ +
setShowBrainSelect(true)} + 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 group" + > +
+ Aktives Gehirn + +
+
+ + {agent.brain_model ? `model: ${agent.brain_model}` : "model: auto"} +
+
+
+ ) : ( +
Lade Agenten-Status…
+ )} +
+
+ Gedächtnis & Stack-Tools via MCP gekoppelt. +
+ + {agent && showBrainSelect && ( +
+
+
+

+ + Hermes-Gehirn konfigurieren +

+ +
+

+ Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (auto / fast / heavy): +

+ +
+ {(["auto", "fast", "heavy", ...models.map(m => m.name.split("/").pop()?.replace(".gguf", "") || m.name)]).map((m) => { + const isAlias = ["auto", "fast", "heavy"].includes(m) + return ( + + ) + })} +
+
+
+ )} + + {dialogElement} +
+ ) +} diff --git a/frontend/src/components/dashboard/MemoryInputCard.tsx b/frontend/src/components/dashboard/MemoryInputCard.tsx new file mode 100644 index 0000000..0e01341 --- /dev/null +++ b/frontend/src/components/dashboard/MemoryInputCard.tsx @@ -0,0 +1,92 @@ +import { useState } from "react" +import { Brain, Plus } from "lucide-react" +import { api } from "@/lib/api" +import { useMemory, useQueryClient } from "@/lib/queries" + +export function MemoryInputCard() { + const qc = useQueryClient() + const { data: memories = [] } = useMemory({ limit: 3 }) + const [memContent, setMemContent] = useState("") + const [memCat, setMemCat] = useState("stable") + const [savingMem, setSavingMem] = useState(false) + + async function saveQuickMemory() { + if (!memContent.trim() || savingMem) return + setSavingMem(true) + try { + await api("/api/memory", { + method: "POST", + body: JSON.stringify({ content: memContent, category: memCat, source: "dashboard" }), + }) + setMemContent("") + qc.invalidateQueries({ queryKey: ["memory"] }) + } catch (e) { + console.error(e) + } finally { + setSavingMem(false) + } + } + + return ( +
+
+
+ +

Gedächtnis

+
+ +
+