From a2bfe0e480ef2b4c5358ee3613431793a28705d7 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Mon, 13 Jul 2026 15:42:41 +0200 Subject: [PATCH] Fix: Speicher-Anzeige einheitlich (Box-Health == System-Status) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die 'Box gesund'-Speicher-Pille zeigte den GTT-Pool (GPU-Sicht auf den Unified-Memory der APU), die System-Status-Kachel daneben den System-RAM — zwei verschiedene Zahlen fuer denselben Speicher (z.B. 73/124 vs 90/122). useLucyHealth: Speicher-Ampel jetzt aus sys.ram (dieselbe Quelle wie die RAM-Zeile), Schwellen am RAM-Charakter geeicht (warn 85%, full 93%; 4 Modelle warm ~78% bleibt gruen). CockpitView: Pille auf 1 Nachkommastelle wie gb(). Live verifiziert: beide zeigen jetzt identisch 95.9/122.7 GB. Co-Authored-By: Claude Fable 5 --- ...entView-D526Xur0.js => AgentView-gOpOu3OL.js} | 2 +- ...-ChhNmDrz.js => AuftragsbuchView-Bhd2qL6R.js} | 2 +- ...kView-DkwJISEG.js => ChronikView-Cee_mQ-B.js} | 2 +- ...tView-Dxf6Cyum.js => ConnectView-QFMbbPya.js} | 2 +- ...aphView-CFtsCBky.js => GraphView-DeHbFeQ_.js} | 2 +- ...ideView-BS1gSjak.js => GuideView-DPDeItXc.js} | 2 +- ...eView-Noe5RIOu.js => KonsoleView-BmijGyLC.js} | 2 +- ...ryView-rgfxKFS7.js => MemoryView-DiYUL6xq.js} | 6 +++--- ...lsView-XFK_eBt6.js => ModelsView-LvY8upF2.js} | 2 +- ...enView-WgvQqTOM.js => WissenView-CFoCOSAi.js} | 2 +- ...ok-open--4d0RiO4.js => book-open-7pFuv-J-.js} | 2 +- .../{copy-B0FtVA11.js => copy-BTbDyEDy.js} | 2 +- ...-open-CKukPWQR.js => folder-open-Bqv661mo.js} | 2 +- .../{index-DbrEnusY.js => index-D-OYo7d4.js} | 6 +++--- ...ghtbulb-xA-FtqvM.js => lightbulb-BDMFIwf9.js} | 2 +- .../{send-CyhU48GF.js => send-BF6peil_.js} | 2 +- .../assets/{zap-Cojq_aI_.js => zap-nk89an7Z.js} | 2 +- frontend/dist/index.html | 2 +- frontend/src/lib/useLucyHealth.ts | 16 ++++++++++------ frontend/src/views/cockpit/CockpitView.tsx | 2 +- 20 files changed, 33 insertions(+), 29 deletions(-) rename frontend/dist/assets/{AgentView-D526Xur0.js => AgentView-gOpOu3OL.js} (99%) rename frontend/dist/assets/{AuftragsbuchView-ChhNmDrz.js => AuftragsbuchView-Bhd2qL6R.js} (99%) rename frontend/dist/assets/{ChronikView-DkwJISEG.js => ChronikView-Cee_mQ-B.js} (99%) rename frontend/dist/assets/{ConnectView-Dxf6Cyum.js => ConnectView-QFMbbPya.js} (98%) rename frontend/dist/assets/{GraphView-CFtsCBky.js => GraphView-DeHbFeQ_.js} (99%) rename frontend/dist/assets/{GuideView-BS1gSjak.js => GuideView-DPDeItXc.js} (99%) rename frontend/dist/assets/{KonsoleView-Noe5RIOu.js => KonsoleView-BmijGyLC.js} (97%) rename frontend/dist/assets/{MemoryView-rgfxKFS7.js => MemoryView-DiYUL6xq.js} (98%) rename frontend/dist/assets/{ModelsView-XFK_eBt6.js => ModelsView-LvY8upF2.js} (99%) rename frontend/dist/assets/{WissenView-WgvQqTOM.js => WissenView-CFoCOSAi.js} (98%) rename frontend/dist/assets/{book-open--4d0RiO4.js => book-open-7pFuv-J-.js} (90%) rename frontend/dist/assets/{copy-B0FtVA11.js => copy-BTbDyEDy.js} (90%) rename frontend/dist/assets/{folder-open-CKukPWQR.js => folder-open-Bqv661mo.js} (90%) rename frontend/dist/assets/{index-DbrEnusY.js => index-D-OYo7d4.js} (99%) rename frontend/dist/assets/{lightbulb-xA-FtqvM.js => lightbulb-BDMFIwf9.js} (90%) rename frontend/dist/assets/{send-CyhU48GF.js => send-BF6peil_.js} (90%) rename frontend/dist/assets/{zap-Cojq_aI_.js => zap-nk89an7Z.js} (97%) diff --git a/frontend/dist/assets/AgentView-D526Xur0.js b/frontend/dist/assets/AgentView-gOpOu3OL.js similarity index 99% rename from frontend/dist/assets/AgentView-D526Xur0.js rename to frontend/dist/assets/AgentView-gOpOu3OL.js index 0734ac5..e32fe71 100644 --- a/frontend/dist/assets/AgentView-D526Xur0.js +++ b/frontend/dist/assets/AgentView-gOpOu3OL.js @@ -1,4 +1,4 @@ -import{c as k,R as _,m as S,b as C,u as H,r as E,j as e,U as A,e as a,V as u,W as p,Y as B,s as h,Z as D,Q as P,X as M,C as g,g as b,q as i}from"./index-DbrEnusY.js";/** +import{c as k,R as _,m as S,b as C,u as H,r as E,j as e,U as A,e as a,V as u,W as p,Y as B,s as h,Z as D,Q as P,X as M,C as g,g as b,q as i}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/AuftragsbuchView-ChhNmDrz.js b/frontend/dist/assets/AuftragsbuchView-Bhd2qL6R.js similarity index 99% rename from frontend/dist/assets/AuftragsbuchView-ChhNmDrz.js rename to frontend/dist/assets/AuftragsbuchView-Bhd2qL6R.js index 95bf17a..7ca91bc 100644 --- a/frontend/dist/assets/AuftragsbuchView-ChhNmDrz.js +++ b/frontend/dist/assets/AuftragsbuchView-Bhd2qL6R.js @@ -1,4 +1,4 @@ -import{c as L,a4 as P,u as T,b as V,r as b,j as e,a5 as H,e as v,L as m,C as R,N as M,a6 as Q,O as E,X as C,T as D,w as O,F as $,g as S,a7 as q,q as F}from"./index-DbrEnusY.js";import{L as G}from"./lightbulb-xA-FtqvM.js";import{S as _}from"./send-CyhU48GF.js";/** +import{c as L,a4 as P,u as T,b as V,r as b,j as e,a5 as H,e as v,L as m,C as R,N as M,a6 as Q,O as E,X as C,T as D,w as O,F as $,g as S,a7 as q,q as F}from"./index-D-OYo7d4.js";import{L as G}from"./lightbulb-BDMFIwf9.js";import{S as _}from"./send-BF6peil_.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/ChronikView-DkwJISEG.js b/frontend/dist/assets/ChronikView-Cee_mQ-B.js similarity index 99% rename from frontend/dist/assets/ChronikView-DkwJISEG.js rename to frontend/dist/assets/ChronikView-Cee_mQ-B.js index 24de0ee..b945907 100644 --- a/frontend/dist/assets/ChronikView-DkwJISEG.js +++ b/frontend/dist/assets/ChronikView-Cee_mQ-B.js @@ -1,4 +1,4 @@ -import{c as h,a8 as S,r as c,j as e,a9 as z,L as g,N as M,aa as C,a7 as D,ab as A,ac as B,ad as Z,e as E,ae as L,u as q,b as R,g as k,q as T}from"./index-DbrEnusY.js";/** +import{c as h,a8 as S,r as c,j as e,a9 as z,L as g,N as M,aa as C,a7 as D,ab as A,ac as B,ad as Z,e as E,ae as L,u as q,b as R,g as k,q as T}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/ConnectView-Dxf6Cyum.js b/frontend/dist/assets/ConnectView-QFMbbPya.js similarity index 98% rename from frontend/dist/assets/ConnectView-Dxf6Cyum.js rename to frontend/dist/assets/ConnectView-QFMbbPya.js index e119279..2a69c21 100644 --- a/frontend/dist/assets/ConnectView-Dxf6Cyum.js +++ b/frontend/dist/assets/ConnectView-QFMbbPya.js @@ -1,4 +1,4 @@ -import{c as p,r as c,z as D,A as I,j as e,D as f,s as z,B,w as H,F as E,e as M,L as F,G as T,C as K}from"./index-DbrEnusY.js";import{F as O}from"./folder-open-CKukPWQR.js";import{C as R}from"./copy-B0FtVA11.js";/** +import{c as p,r as c,z as D,A as I,j as e,D as f,s as z,B,w as H,F as E,e as M,L as F,G as T,C as K}from"./index-D-OYo7d4.js";import{F as O}from"./folder-open-Bqv661mo.js";import{C as R}from"./copy-BTbDyEDy.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/GraphView-CFtsCBky.js b/frontend/dist/assets/GraphView-DeHbFeQ_.js similarity index 99% rename from frontend/dist/assets/GraphView-CFtsCBky.js rename to frontend/dist/assets/GraphView-DeHbFeQ_.js index 6a0644a..2992895 100644 --- a/frontend/dist/assets/GraphView-CFtsCBky.js +++ b/frontend/dist/assets/GraphView-DeHbFeQ_.js @@ -1,4 +1,4 @@ -import{ai as Lt,r as V,aj as Zi,ak as Gn,al as Vn,am as Ki,an as Qi,ao as Wn,ap as Bn,aq as Ji,j as lt,a5 as to}from"./index-DbrEnusY.js";function eo(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var Xn=180/Math.PI,un={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vr(e,n,r,i,o,a){var s,u,f;return(s=Math.sqrt(e*e+n*n))&&(e/=s,n/=s),(f=e*r+n*i)&&(r-=e*f,i-=n*f),(u=Math.sqrt(r*r+i*i))&&(r/=u,i/=u,f/=u),e*i180?c+=360:c-l>180&&(l+=360),d.push({i:h.push(o(h)+"rotate(",null,i)-2,x:Lt(l,c)})):c&&h.push(o(h)+"rotate("+c+i)}function u(l,c,h,d){l!==c?d.push({i:h.push(o(h)+"skewX(",null,i)-2,x:Lt(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,p,y){if(l!==h||c!==d){var v=p.push(o(p)+"scale(",null,",",null,")");y.push({i:v-4,x:Lt(l,h)},{i:v-2,x:Lt(c,d)})}else(h!==1||d!==1)&&p.push(o(p)+"scale("+h+","+d+")")}return function(l,c){var h=[],d=[];return l=e(l),c=e(c),a(l.translateX,l.translateY,c.translateX,c.translateY,h,d),s(l.rotate,c.rotate,h,d),u(l.skewX,c.skewX,h,d),f(l.scaleX,l.scaleY,c.scaleX,c.scaleY,h,d),l=c=null,function(p){for(var y=-1,v=d.length,_;++ye.length)&&(n=e.length);for(var r=0,i=new Array(n);r180?c+=360:c-l>180&&(l+=360),d.push({i:h.push(o(h)+"rotate(",null,i)-2,x:Lt(l,c)})):c&&h.push(o(h)+"rotate("+c+i)}function u(l,c,h,d){l!==c?d.push({i:h.push(o(h)+"skewX(",null,i)-2,x:Lt(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,p,y){if(l!==h||c!==d){var v=p.push(o(p)+"scale(",null,",",null,")");y.push({i:v-4,x:Lt(l,h)},{i:v-2,x:Lt(c,d)})}else(h!==1||d!==1)&&p.push(o(p)+"scale("+h+","+d+")")}return function(l,c){var h=[],d=[];return l=e(l),c=e(c),a(l.translateX,l.translateY,c.translateX,c.translateY,h,d),s(l.rotate,c.rotate,h,d),u(l.skewX,c.skewX,h,d),f(l.scaleX,l.scaleY,c.scaleX,c.scaleY,h,d),l=c=null,function(p){for(var y=-1,v=d.length,_;++ye.length)&&(n=e.length);for(var r=0,i=new Array(n);ra,methodNames:i=[],initPropNames:o=[]}={}){return V.forwardRef((a,s)=>{const u=V.useRef(),f=V.useMemo(()=>{const h=Object.fromEntries(o.filter(d=>a.hasOwnProperty(d)).map(d=>[d,a[d]]));return e(h)},[]);Kn(()=>{f(r(u.current))},V.useLayoutEffect),Kn(()=>f._destructor instanceof Function?f._destructor:void 0);const l=V.useCallback((h,...d)=>f[h]instanceof Function?f[h](...d):void 0,[f]),c=V.useRef({});return Object.keys(xo(a,[...i,...o])).filter(h=>c.current[h]!==a[h]).forEach(h=>l(h,a[h])),c.current=a,V.useImperativeHandle(s,()=>Object.fromEntries(i.map(h=>[h,(...d)=>l(h,...d)])),[l]),Zi.createElement(n,{ref:u})})}function Kn(e,n=V.useEffect){const r=V.useRef(),i=V.useRef(!1),o=V.useRef(!1),[a,s]=V.useState(0);i.current&&(o.current=!0),n(()=>(i.current||(r.current=e(),i.current=!0),s(u=>u+1),()=>{o.current&&(r.current&&r.current(),r.current=void 0,i.current=!1,o.current=!1)}),[])}var fn="http://www.w3.org/1999/xhtml";const Qn={svg:"http://www.w3.org/2000/svg",xhtml:fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qe(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Qn.hasOwnProperty(n)?{space:Qn[n],local:e}:e}function ko(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===fn&&n.documentElement.namespaceURI===fn?n.createElement(e):n.createElementNS(r,e)}}function Co(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xr(e){var n=qe(e);return(n.local?Co:ko)(n)}function Ao(){}function An(e){return e==null?Ao:function(){return this.querySelector(e)}}function So(e){typeof e!="function"&&(e=An(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o=T&&(T=w+1);!(b=_[T])&&++T=0;)(s=i[o])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function Ko(e){e||(e=Qo);function n(h,d){return h&&d?e(h.__data__,d.__data__):!h-!d}for(var r=this._groups,i=r.length,o=new Array(i),a=0;an?1:e>=n?0:NaN}function Jo(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ta(){return Array.from(this)}function ea(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?ha:typeof n=="function"?pa:da)(e,n,r??"")):Bt(this.node(),e)}function Bt(e,n){return e.style.getPropertyValue(n)||Jr(e).getComputedStyle(e,null).getPropertyValue(n)}function ya(e){return function(){delete this[e]}}function _a(e,n){return function(){this[e]=n}}function va(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function ma(e,n){return arguments.length>1?this.each((n==null?ya:typeof n=="function"?va:_a)(e,n)):this.node()[e]}function ti(e){return e.trim().split(/^|\s+/)}function Sn(e){return e.classList||new ei(e)}function ei(e){this._node=e,this._names=ti(e.getAttribute("class")||"")}ei.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ni(e,n){for(var r=Sn(e),i=-1,o=n.length;++i=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function Ba(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,a;r{}};function ve(){for(var e=0,n=arguments.length,r={},i;e=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Ae.prototype=ve.prototype={constructor:Ae,on:function(e,n){var r=this._,i=rs(e+"",r),o,a=-1,s=i.length;if(arguments.length<2){for(;++a0)for(var r=new Array(o),i=0,o,a;i()=>e;function cn(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:a,x:s,y:u,dx:f,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}cn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function as(e){return!e.ctrlKey&&!e.button}function ss(){return this.parentNode}function us(e,n){return n??{x:e.x,y:e.y}}function ls(){return navigator.maxTouchPoints||"ontouchstart"in this}function fs(){var e=as,n=ss,r=us,i=ls,o={},a=ve("start","drag","end"),s=0,u,f,l,c,h=0;function d(x){x.on("mousedown.drag",p).filter(i).on("touchstart.drag",_).on("touchmove.drag",g,os).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,b){if(!(c||!e.call(this,x,b))){var C=T(this,n.call(this,x,b),x,b,"mouse");C&&(pt(x.view).on("mousemove.drag",y,pe).on("mouseup.drag",v,pe),ai(x.view),Ze(x),l=!1,u=x.clientX,f=x.clientY,C("start",x))}}function y(x){if(Wt(x),!l){var b=x.clientX-u,C=x.clientY-f;l=b*b+C*C>h}o.mouse("drag",x)}function v(x){pt(x.view).on("mousemove.drag mouseup.drag",null),si(x.view,l),Wt(x),o.mouse("end",x)}function _(x,b){if(e.call(this,x,b)){var C=x.changedTouches,S=n.call(this,x,b),M=C.length,N,P;for(N=0;N=0&&e._call.call(void 0,n),e=e._next;--Xt}function tr(){Ht=(Re=ge.now())+Ge,Xt=ae=0;try{hs()}finally{Xt=0,ps(),Ht=0}}function ds(){var e=ge.now(),n=e-Re;n>ui&&(Ge-=n,Re=e)}function ps(){for(var e,n=ze,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:ze=r);se=e,hn(i)}function hn(e){if(!Xt){ae&&(ae=clearTimeout(ae));var n=e-Ht;n>24?(e<1/0&&(ae=setTimeout(tr,e-ge.now()-Ge)),Qt&&(Qt=clearInterval(Qt))):(Qt||(Re=ge.now(),Qt=setInterval(ds,ui)),Xt=1,li(tr))}}function er(e,n,r){var i=new Ne;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var gs=ve("start","end","cancel","interrupt"),ys=[],fi=0,nr=1,dn=2,Se=3,rr=4,pn=5,Te=6;function Ve(e,n,r,i,o,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;_s(e,r,{name:n,index:i,group:o,on:gs,tween:ys,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:fi})}function Pn(e,n){var r=vt(e,n);if(r.state>fi)throw new Error("too late; already scheduled");return r}function Ct(e,n){var r=vt(e,n);if(r.state>Se)throw new Error("too late; already running");return r}function vt(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function _s(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=Mn(a,0,r.time);function a(l){r.state=nr,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var c,h,d,p;if(r.state!==nr)return f();for(c in i)if(p=i[c],p.name===r.name){if(p.state===Se)return er(s);p.state===rr?(p.state=Te,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[c]):+cdn&&i.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function Bs(e,n,r){var i,o,a=Ws(n)?Pn:Ct;return function(){var s=a(this,e),u=s.on;u!==i&&(o=(i=u).copy()).on(n,r),s.on=o}}function Xs(e,n){var r=this._id;return arguments.length<2?vt(this.node(),r).on.on(e):this.each(Bs(r,e,n))}function Ys(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function Zs(){return this.on("end.remove",Ys(this._id))}function Ks(e){var n=this._name,r=this._id;typeof e!="function"&&(e=An(e));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s()=>e;function wu(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Et(e,n,r){this.k=e,this.x=n,this.y=r}Et.prototype={constructor:Et,scale:function(e){return e===1?this:new Et(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Et(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var En=new Et(1,0,0);mt.prototype=Et.prototype;function mt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return En;return e.__zoom}function Ke(e){e.stopImmediatePropagation()}function Jt(e){e.preventDefault(),e.stopImmediatePropagation()}function ku(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Cu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ir(){return this.__zoom||En}function Au(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Su(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tu(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],a=e.invertY(n[0][1])-r[0][1],s=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}function Mu(){var e=ku,n=Cu,r=Tu,i=Au,o=Su,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],u=250,f=lo,l=ve("start","zoom","end"),c,h,d,p=500,y=150,v=0,_=10;function g(A){A.property("__zoom",ir).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",R).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(A,I,E,k){var O=A.selection?A.selection():A;O.property("__zoom",ir),A!==O?b(A,I,E,k):O.interrupt().each(function(){C(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},g.scaleBy=function(A,I,E,k){g.scaleTo(A,function(){var O=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return O*j},E,k)},g.scaleTo=function(A,I,E,k){g.transform(A,function(){var O=n.apply(this,arguments),j=this.__zoom,$=E==null?x(O):typeof E=="function"?E.apply(this,arguments):E,U=j.invert($),F=typeof I=="function"?I.apply(this,arguments):I;return r(T(w(j,F),$,U),O,s)},E,k)},g.translateBy=function(A,I,E,k){g.transform(A,function(){return r(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof E=="function"?E.apply(this,arguments):E),n.apply(this,arguments),s)},null,k)},g.translateTo=function(A,I,E,k,O){g.transform(A,function(){var j=n.apply(this,arguments),$=this.__zoom,U=k==null?x(j):typeof k=="function"?k.apply(this,arguments):k;return r(En.translate(U[0],U[1]).scale($.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof E=="function"?-E.apply(this,arguments):-E),j,s)},k,O)};function w(A,I){return I=Math.max(a[0],Math.min(a[1],I)),I===A.k?A:new Et(I,A.x,A.y)}function T(A,I,E){var k=I[0]-E[0]*A.k,O=I[1]-E[1]*A.k;return k===A.x&&O===A.y?A:new Et(A.k,k,O)}function x(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function b(A,I,E,k){A.on("start.zoom",function(){C(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(k).end()}).tween("zoom",function(){var O=this,j=arguments,$=C(O,j).event(k),U=n.apply(O,j),F=E==null?x(U):typeof E=="function"?E.apply(O,j):E,q=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),G=O.__zoom,B=typeof I=="function"?I.apply(O,j):I,J=f(G.invert(F).concat(q/G.k),B.invert(F).concat(q/B.k));return function(Y){if(Y===1)Y=B;else{var at=J(Y),tt=q/at[2];Y=new Et(tt,F[0]-at[0]*tt,F[1]-at[1]*tt)}$.zoom(null,Y)}})}function C(A,I,E){return!E&&A.__zooming||new S(A,I)}function S(A,I){this.that=A,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(A,I),this.taps=0}S.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,I){return this.mouse&&A!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var I=pt(this.that).datum();l.call(A,this.that,new wu(A,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:l}),I)}};function M(A,...I){if(!e.apply(this,arguments))return;var E=C(this,I).event(A),k=this.__zoom,O=Math.max(a[0],Math.min(a[1],k.k*Math.pow(2,i.apply(this,arguments)))),j=bt(A);if(E.wheel)(E.mouse[0][0]!==j[0]||E.mouse[0][1]!==j[1])&&(E.mouse[1]=k.invert(E.mouse[0]=j)),clearTimeout(E.wheel);else{if(k.k===O)return;E.mouse=[j,k.invert(j)],Me(this),E.start()}Jt(A),E.wheel=setTimeout($,y),E.zoom("mouse",r(T(w(k,O),E.mouse[0],E.mouse[1]),E.extent,s));function $(){E.wheel=null,E.end()}}function N(A,...I){if(d||!e.apply(this,arguments))return;var E=A.currentTarget,k=C(this,I,!0).event(A),O=pt(A.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",q,!0),j=bt(A,E),$=A.clientX,U=A.clientY;ai(A.view),Ke(A),k.mouse=[j,this.__zoom.invert(j)],Me(this),k.start();function F(G){if(Jt(G),!k.moved){var B=G.clientX-$,J=G.clientY-U;k.moved=B*B+J*J>v}k.event(G).zoom("mouse",r(T(k.that.__zoom,k.mouse[0]=bt(G,E),k.mouse[1]),k.extent,s))}function q(G){O.on("mousemove.zoom mouseup.zoom",null),si(G.view,k.moved),Jt(G),k.event(G).end()}}function P(A,...I){if(e.apply(this,arguments)){var E=this.__zoom,k=bt(A.changedTouches?A.changedTouches[0]:A,this),O=E.invert(k),j=E.k*(A.shiftKey?.5:2),$=r(T(w(E,j),k,O),n.apply(this,I),s);Jt(A),u>0?pt(this).transition().duration(u).call(b,$,k,A):pt(this).call(g.transform,$,k,A)}}function R(A,...I){if(e.apply(this,arguments)){var E=A.touches,k=E.length,O=C(this,I,A.changedTouches.length===k).event(A),j,$,U,F;for(Ke(A),$=0;$=n||S<0||h&&M>=a}function g(){var C=Qe();if(_(C))return w(C);u=setTimeout(g,v(C))}function w(C){return u=void 0,d&&i?p(C):(i=o=void 0,s)}function T(){u!==void 0&&clearTimeout(u),l=0,i=f=o=u=void 0}function x(){return u===void 0?s:w(Qe())}function b(){var C=Qe(),S=_(C);if(i=arguments,o=this,f=C,S){if(u===void 0)return y(f);if(h)return clearTimeout(u),u=setTimeout(g,n),p(f)}return u===void 0&&(u=setTimeout(g,n)),s}return b.cancel=T,b.flush=x,b}var tl="Expected a function";function el(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(tl);return De(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),yi(e,n,{leading:i,maxWait:n,trailing:o})}var Ut=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Ut.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Ut.Bounce.In(e*2)*.5:Ut.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),ue=function(){return performance.now()},_i=(function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(n){this._tweens[n.getId()]=n,this._tweensAddedDuringUpdate[n.getId()]=n},e.prototype.remove=function(n){delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]},e.prototype.update=function(n,r){n===void 0&&(n=ue()),r===void 0&&(r=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o1?a(e[r],e[r-1],r-i):a(e[o],e[o+1>r?r:o+1],i-o)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},vi=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),yn=new _i,ur=(function(){function e(n,r){r===void 0&&(r=yn),this._object=n,this._group=r,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ut.Linear.None,this._interpolationFunction=gn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=vi.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=ue()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var a in this._valuesEnd)o[a]=this._valuesEnd[a];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,o,a){for(var s in i){var u=n[s],f=Array.isArray(u),l=f?"array":typeof u,c=!f&&Array.isArray(i[s]);if(!(l==="undefined"||l==="function")){if(c){var h=i[s];if(h.length===0)continue;for(var d=[u],p=0,y=h.length;p"u"||a)&&(r[s]=u),f||(r[s]*=1),c?o[s]=i[s].slice().reverse():o[s]=r[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(n){return n===void 0&&(n=ue()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this._group&&this._group.remove(this),this)},e.prototype.resume=function(n){return n===void 0&&(n=ue()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;ns)return!1;r&&this.start(n,!0)}if(this._goToEnd=!1,nl)return 1;var _=Math.trunc(u/f),g=u-_*f,w=Math.min(g/i._duration,1);return w===0&&u===i._duration?1:w},h=c(),d=this._easingFunction(h);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),this._duration===0||u>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((u-this._duration)/f)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=f*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var y=0,v=this._chainedTweens.length;ye.length)&&(n=e.length);for(var r=0,i=Array(n);r=0,a=!r&&o&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return H(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(bl,arguments)},brighten:function(){return this._applyModification(xl,arguments)},darken:function(){return this._applyModification(wl,arguments)},desaturate:function(){return this._applyModification(_l,arguments)},saturate:function(){return this._applyModification(vl,arguments)},greyscale:function(){return this._applyModification(ml,arguments)},spin:function(){return this._applyModification(kl,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(Sl,arguments)},complement:function(){return this._applyCombination(Cl,arguments)},monochromatic:function(){return this._applyCombination(Tl,arguments)},splitcomplement:function(){return this._applyCombination(Al,arguments)},triad:function(){return this._applyCombination(pr,[3])},tetrad:function(){return this._applyCombination(pr,[4])}};H.fromRatio=function(e,n){if(je(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=le(e[i]));e=r}return H(e,n)};function hl(e){var n={r:0,g:0,b:0},r=1,i=null,o=null,a=null,s=!1,u=!1;return typeof e=="string"&&(e=zl(e)),je(e)=="object"&&(Tt(e.r)&&Tt(e.g)&&Tt(e.b)?(n=dl(e.r,e.g,e.b),s=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Tt(e.h)&&Tt(e.s)&&Tt(e.v)?(i=le(e.s),o=le(e.v),n=gl(e.h,i,o),s=!0,u="hsv"):Tt(e.h)&&Tt(e.s)&&Tt(e.l)&&(i=le(e.s),a=le(e.l),n=pl(e.h,i,a),s=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=mi(r),{ok:s,format:e.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function dl(e,n,r){return{r:K(e,255)*255,g:K(n,255)*255,b:K(r,255)*255}}function fr(e,n,r){e=K(e,255),n=K(n,255),r=K(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=(i+o)/2;if(i==o)a=s=0;else{var f=i-o;switch(s=u>.5?f/(2-i-o):f/(i+o),i){case e:a=(n-r)/f+(n1&&(h-=1),h<1/6?l+(c-l)*6*h:h<1/2?c:h<2/3?l+(c-l)*(2/3-h)*6:l}if(n===0)i=o=a=r;else{var u=r<.5?r*(1+n):r+n-r*n,f=2*r-u;i=s(f,u,e+1/3),o=s(f,u,e),a=s(f,u,e-1/3)}return{r:i*255,g:o*255,b:a*255}}function cr(e,n,r){e=K(e,255),n=K(n,255),r=K(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=i,f=i-o;if(s=i===0?0:f/i,i==o)a=0;else{switch(i){case e:a=(n-r)/f+(n>1)+720)%360;--n;)i.h=(i.h+o)%360,a.push(H(i));return a}function Tl(e,n){n=n||6;for(var r=H(e).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/n;n--;)s.push(H({h:i,s:o,v:a})),a=(a+u)%1;return s}H.mix=function(e,n,r){r=r===0?0:r||50;var i=H(e).toRgb(),o=H(n).toRgb(),a=r/100,s={r:(o.r-i.r)*a+i.r,g:(o.g-i.g)*a+i.g,b:(o.b-i.b)*a+i.b,a:(o.a-i.a)*a+i.a};return H(s)};H.readability=function(e,n){var r=H(e),i=H(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};H.isReadable=function(e,n,r){var i=H.readability(e,n),o,a;switch(a=!1,o=Rl(r),o.level+o.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};H.mostReadable=function(e,n,r){var i=null,o=0,a,s,u,f;r=r||{},s=r.includeFallbackColors,u=r.level,f=r.size;for(var l=0;lo&&(o=a,i=H(n[l]));return H.isReadable(e,i,{level:u,size:f})||!s?i:(r.includeFallbackColors=!1,H.mostReadable(e,["#fff","#000"],r))};var _n=H.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Ml=H.hexNames=Pl(_n);function Pl(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function mi(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function K(e,n){Ol(e)&&(e="100%");var r=El(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function We(e){return Math.min(1,Math.max(0,e))}function ft(e){return parseInt(e,16)}function Ol(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function El(e){return typeof e=="string"&&e.indexOf("%")!=-1}function _t(e){return e.length==1?"0"+e:""+e}function le(e){return e<=1&&(e=e*100+"%"),e}function bi(e){return Math.round(parseFloat(e)*255).toString(16)}function gr(e){return ft(e)/255}var yt=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Tt(e){return!!yt.CSS_UNIT.exec(e)}function zl(e){e=e.replace(fl,"").replace(cl,"").toLowerCase();var n=!1;if(_n[e])e=_n[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=yt.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=yt.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=yt.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=yt.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=yt.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=yt.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=yt.hex8.exec(e))?{r:ft(r[1]),g:ft(r[2]),b:ft(r[3]),a:gr(r[4]),format:n?"name":"hex8"}:(r=yt.hex6.exec(e))?{r:ft(r[1]),g:ft(r[2]),b:ft(r[3]),format:n?"name":"hex"}:(r=yt.hex4.exec(e))?{r:ft(r[1]+""+r[1]),g:ft(r[2]+""+r[2]),b:ft(r[3]+""+r[3]),a:gr(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=yt.hex3.exec(e))?{r:ft(r[1]+""+r[1]),g:ft(r[2]+""+r[2]),b:ft(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function Rl(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function vn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);ri.map(i=>d[i]); -var ke=Object.defineProperty;var ve=(d,i,c)=>i in d?ke(d,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[i]=c;var U=(d,i,c)=>ve(d,typeof i!="symbol"?i+"":i,c);import{c as h,r as s,j as e,u as Ne,b as Se,I as J,J as Ce,C as W,K as Ee,S as Me,M as ze,N as _,e as x,O as _e,Q as Oe,X,v as Z,_ as Te,g as j}from"./index-DbrEnusY.js";import{C as Y}from"./copy-B0FtVA11.js";import{S as Ae}from"./send-CyhU48GF.js";import{B as De}from"./book-open--4d0RiO4.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphView-DeHbFeQ_.js","assets/index-D-OYo7d4.js","assets/index-CK-hmH9c.css"])))=>i.map(i=>d[i]); +var ke=Object.defineProperty;var ve=(d,i,c)=>i in d?ke(d,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[i]=c;var U=(d,i,c)=>ve(d,typeof i!="symbol"?i+"":i,c);import{c as h,r as s,j as e,u as Ne,b as Se,I as J,J as Ce,C as W,K as Ee,S as Me,M as ze,N as _,e as x,O as _e,Q as Oe,X,v as Z,_ as Te,g as j}from"./index-D-OYo7d4.js";import{C as Y}from"./copy-BTbDyEDy.js";import{S as Ae}from"./send-BF6peil_.js";import{B as De}from"./book-open-7pFuv-J-.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -34,7 +34,7 @@ var ke=Object.defineProperty;var ve=(d,i,c)=>i in d?ke(d,i,{enumerable:!0,config * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Re=h("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"}]]);class re extends s.Component{constructor(){super(...arguments);U(this,"state",{error:null})}static getDerivedStateFromError(c){return{error:c}}render(){return this.state.error?e.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[e.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),e.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const te=s.lazy(()=>Te(()=>import("./GraphView-CFtsCBky.js"),__vite__mapDeps([0,1,2])).then(d=>({default:d.GraphView}))),k=["identity","knowledge","rules","events"],se=new Set(["auto","agent","hermes"]),O={identity:{label:"Identität",icon:Re,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Oe,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:Pe,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:_e,bg:"bg-amber-500/10",text:"text-amber-400"}},ne={label:"Gedächtnis",icon:De,text:"text-muted-foreground"},Ve={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},ae=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: + */const Re=h("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"}]]);class re extends s.Component{constructor(){super(...arguments);U(this,"state",{error:null})}static getDerivedStateFromError(c){return{error:c}}render(){return this.state.error?e.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[e.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),e.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const te=s.lazy(()=>Te(()=>import("./GraphView-DeHbFeQ_.js"),__vite__mapDeps([0,1,2])).then(d=>({default:d.GraphView}))),k=["identity","knowledge","rules","events"],se=new Set(["auto","agent","hermes"]),O={identity:{label:"Identität",icon:Re,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Oe,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:Pe,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:_e,bg:"bg-amber-500/10",text:"text-amber-400"}},ne={label:"Gedächtnis",icon:De,text:"text-muted-foreground"},Ve={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},ae=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: 1) wer ich bin und woran ich gerade arbeite, 2) wie ich angesprochen werden möchte, 3) meine bevorzugten Tools, Sprachen und Arbeitsweise, diff --git a/frontend/dist/assets/ModelsView-XFK_eBt6.js b/frontend/dist/assets/ModelsView-LvY8upF2.js similarity index 99% rename from frontend/dist/assets/ModelsView-XFK_eBt6.js rename to frontend/dist/assets/ModelsView-LvY8upF2.js index 76503f0..ae6c2fa 100644 --- a/frontend/dist/assets/ModelsView-XFK_eBt6.js +++ b/frontend/dist/assets/ModelsView-LvY8upF2.js @@ -1,4 +1,4 @@ -import{c as D,u as Ce,a as Ee,b as Se,j as e,f as ce,d as De,e as g,g as B,q as te,B as ae,h as qe,E as _e,i as Ge,r as y,X as Re,C as J,T as re,k as Z,H as Ae,l as P,m as me,n as Fe,o as Ke,p as Oe,S as pe,s as Ie,P as Te,t as Ue,v as He,w as Le,x as Pe,y as Qe}from"./index-DbrEnusY.js";import{C as xe,Z as ue,L as Ve,a as We,b as Je}from"./zap-Cojq_aI_.js";/** +import{c as D,u as Ce,a as Ee,b as Se,j as e,f as ce,d as De,e as g,g as B,q as te,B as ae,h as qe,E as _e,i as Ge,r as y,X as Re,C as J,T as re,k as Z,H as Ae,l as P,m as me,n as Fe,o as Ke,p as Oe,S as pe,s as Ie,P as Te,t as Ue,v as He,w as Le,x as Pe,y as Qe}from"./index-D-OYo7d4.js";import{C as xe,Z as ue,L as Ve,a as We,b as Je}from"./zap-nk89an7Z.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/WissenView-WgvQqTOM.js b/frontend/dist/assets/WissenView-CFoCOSAi.js similarity index 98% rename from frontend/dist/assets/WissenView-WgvQqTOM.js rename to frontend/dist/assets/WissenView-CFoCOSAi.js index cf44834..8e5c49b 100644 --- a/frontend/dist/assets/WissenView-WgvQqTOM.js +++ b/frontend/dist/assets/WissenView-CFoCOSAi.js @@ -1,4 +1,4 @@ -import{af as y,r as x,g as L,j as e,L as v,S,ag as W,N as C,e as w,ah as E}from"./index-DbrEnusY.js";import{F as M}from"./folder-open-CKukPWQR.js";const D={"":"Allgemein",traeume:"Träume",muster:"Muster","skill-kandidaten":"Skill-Kandidaten","skill-kandidaten/beauftragt":"Skill-Kandidaten · beauftragt","skill-kandidaten/verworfen":"Skill-Kandidaten · verworfen"};function T(){const{data:o,isLoading:h}=y(),[l,f]=x.useState(null),[d,r]=x.useState(null),[u,i]=x.useState(!1),[a,p]=x.useState(""),t=x.useMemo(()=>(o==null?void 0:o.files)??[],[o]),m=x.useMemo(()=>{const s=new Map;for(const n of t)s.set(n.name.toLowerCase(),n.path);return s},[t]),g=x.useMemo(()=>{if(!a.trim())return t;const s=a.toLowerCase();return t.filter(n=>n.title.toLowerCase().includes(s)||n.path.toLowerCase().includes(s))},[t,a]),b=x.useMemo(()=>{const s=[];for(const n of g){const c=s.find(k=>k.dir===n.dir);c?c.files.push(n):s.push({dir:n.dir,files:[n]})}return s.sort((n,c)=>n.dir===""?-1:c.dir===""?1:n.dir.localeCompare(c.dir))},[g]);x.useEffect(()=>{if(!l&&t.length){const s=t.find(n=>n.path.toLowerCase()==="index.md");f((s==null?void 0:s.path)??t[0].path)}},[t,l]),x.useEffect(()=>{l&&(i(!0),L(`/api/wissen/datei?pfad=${encodeURIComponent(l)}`).then(r).catch(()=>r({path:l,content:"*(Notiz nicht ladbar)*",mtime:0})).finally(()=>i(!1)))},[l]);const j=s=>{const n=m.get(s.toLowerCase());n&&f(n)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Wissen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was sich die Box nachts erschließt — Traum-Notizen, Muster und Skill-Ideen aus dem Wissens-Vault, verlinkt wie ein Wiki."})]}),o&&!o.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Der Wissens-Vault liegt auf der Box (~/wissens-vault) — im lokalen Dev-Modus nicht verfügbar."}),h&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Vault wird geladen …"]}),(o==null?void 0:o.available)&&t.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 text-center text-xs text-muted-foreground",children:"Noch keine Notizen. Der nächtliche Traum (03:15) legt sie an — morgen früh steht hier die erste."}),t.length>0&&e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row",children:[e.jsxs("aside",{className:"w-full shrink-0 space-y-3 lg:w-72",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{value:a,onChange:s=>p(s.target.value),type:"search",placeholder:"Notizen durchsuchen…","aria-label":"Notizen durchsuchen",className:"h-9 w-full rounded-lg border border-border/60 bg-card/45 pl-8 pr-3 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary/50"}),e.jsx(S,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("div",{className:"max-h-[70vh] space-y-3 overflow-y-auto pr-1 scrollbar-thin",children:b.map(({dir:s,files:n})=>e.jsxs("div",{children:[e.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(M,{className:"h-3 w-3"})," ",D[s]??s]}),e.jsx("div",{className:"space-y-0.5",children:n.map(c=>e.jsxs("button",{onClick:()=>f(c.path),className:w("flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs transition-all cursor-pointer",l===c.path?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(W,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",title:c.title,children:c.name}),c.neu&&e.jsxs("span",{className:"ml-auto flex items-center gap-0.5 rounded bg-violet-500/15 px-1 py-0.5 text-[8px] font-bold uppercase text-violet-300",children:[e.jsx(C,{className:"h-2.5 w-2.5"}),"neu"]})]},c.path))})]},s||"__root"))})]}),e.jsx("div",{className:"min-w-0 flex-1 mc-card p-5",children:u?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Notiz wird geladen …"]}):d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between border-b border-border/40 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[e.jsx(E,{className:"h-3.5 w-3.5"})," ",d.path]}),d.mtime>0&&e.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Stand ",new Date(d.mtime*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),e.jsx(z,{text:d.content,onWikiLink:j,known:m})]}):null})]})]})}function z({text:o,onWikiLink:h,known:l}){const f=o.split(` +import{af as y,r as x,g as L,j as e,L as v,S,ag as W,N as C,e as w,ah as E}from"./index-D-OYo7d4.js";import{F as M}from"./folder-open-Bqv661mo.js";const D={"":"Allgemein",traeume:"Träume",muster:"Muster","skill-kandidaten":"Skill-Kandidaten","skill-kandidaten/beauftragt":"Skill-Kandidaten · beauftragt","skill-kandidaten/verworfen":"Skill-Kandidaten · verworfen"};function T(){const{data:o,isLoading:h}=y(),[l,f]=x.useState(null),[d,r]=x.useState(null),[u,i]=x.useState(!1),[a,p]=x.useState(""),t=x.useMemo(()=>(o==null?void 0:o.files)??[],[o]),m=x.useMemo(()=>{const s=new Map;for(const n of t)s.set(n.name.toLowerCase(),n.path);return s},[t]),g=x.useMemo(()=>{if(!a.trim())return t;const s=a.toLowerCase();return t.filter(n=>n.title.toLowerCase().includes(s)||n.path.toLowerCase().includes(s))},[t,a]),b=x.useMemo(()=>{const s=[];for(const n of g){const c=s.find(k=>k.dir===n.dir);c?c.files.push(n):s.push({dir:n.dir,files:[n]})}return s.sort((n,c)=>n.dir===""?-1:c.dir===""?1:n.dir.localeCompare(c.dir))},[g]);x.useEffect(()=>{if(!l&&t.length){const s=t.find(n=>n.path.toLowerCase()==="index.md");f((s==null?void 0:s.path)??t[0].path)}},[t,l]),x.useEffect(()=>{l&&(i(!0),L(`/api/wissen/datei?pfad=${encodeURIComponent(l)}`).then(r).catch(()=>r({path:l,content:"*(Notiz nicht ladbar)*",mtime:0})).finally(()=>i(!1)))},[l]);const j=s=>{const n=m.get(s.toLowerCase());n&&f(n)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Wissen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was sich die Box nachts erschließt — Traum-Notizen, Muster und Skill-Ideen aus dem Wissens-Vault, verlinkt wie ein Wiki."})]}),o&&!o.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Der Wissens-Vault liegt auf der Box (~/wissens-vault) — im lokalen Dev-Modus nicht verfügbar."}),h&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Vault wird geladen …"]}),(o==null?void 0:o.available)&&t.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 text-center text-xs text-muted-foreground",children:"Noch keine Notizen. Der nächtliche Traum (03:15) legt sie an — morgen früh steht hier die erste."}),t.length>0&&e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row",children:[e.jsxs("aside",{className:"w-full shrink-0 space-y-3 lg:w-72",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{value:a,onChange:s=>p(s.target.value),type:"search",placeholder:"Notizen durchsuchen…","aria-label":"Notizen durchsuchen",className:"h-9 w-full rounded-lg border border-border/60 bg-card/45 pl-8 pr-3 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary/50"}),e.jsx(S,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("div",{className:"max-h-[70vh] space-y-3 overflow-y-auto pr-1 scrollbar-thin",children:b.map(({dir:s,files:n})=>e.jsxs("div",{children:[e.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(M,{className:"h-3 w-3"})," ",D[s]??s]}),e.jsx("div",{className:"space-y-0.5",children:n.map(c=>e.jsxs("button",{onClick:()=>f(c.path),className:w("flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs transition-all cursor-pointer",l===c.path?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(W,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",title:c.title,children:c.name}),c.neu&&e.jsxs("span",{className:"ml-auto flex items-center gap-0.5 rounded bg-violet-500/15 px-1 py-0.5 text-[8px] font-bold uppercase text-violet-300",children:[e.jsx(C,{className:"h-2.5 w-2.5"}),"neu"]})]},c.path))})]},s||"__root"))})]}),e.jsx("div",{className:"min-w-0 flex-1 mc-card p-5",children:u?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Notiz wird geladen …"]}):d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between border-b border-border/40 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[e.jsx(E,{className:"h-3.5 w-3.5"})," ",d.path]}),d.mtime>0&&e.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Stand ",new Date(d.mtime*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),e.jsx(z,{text:d.content,onWikiLink:j,known:m})]}):null})]})]})}function z({text:o,onWikiLink:h,known:l}){const f=o.split(` `),d=[];let r=[],u=null;const i=a=>{r.length&&(d.push(e.jsx("ul",{className:"mb-3 ml-4 list-disc space-y-1",children:r},a)),r=[])};return f.forEach((a,p)=>{const t=`l${p}`;if(u!==null){a.trimEnd()==="```"?(d.push(e.jsx("pre",{className:"mb-3 overflow-x-auto rounded-xl border border-border/50 bg-background/50 p-3 font-mono text-[11px] leading-relaxed text-foreground/85",children:u.join(` `)},t)),u=null):u.push(a);return}if(a.trimStart().startsWith("```")){i(t),u=[];return}const m=a.trimEnd();if(!m.trim()){i(t);return}const g=m.match(/^(#{1,4})\s+(.*)$/);if(g){i(t);const j=g[1].length,s=j===1?"text-lg font-bold mt-1 mb-3":j===2?"text-base font-bold mt-4 mb-2":"text-sm font-bold mt-3 mb-1.5";d.push(e.jsx("p",{className:w(s,"font-space text-foreground"),children:N(g[2],h,l,t)},t));return}const b=m.match(/^\s*[-*•]\s+(.*)$/);if(b){r.push(e.jsx("li",{className:"text-xs leading-relaxed text-foreground/85",children:N(b[1],h,l,t)},t));return}i(t),d.push(e.jsx("p",{className:"mb-2 text-xs leading-relaxed text-foreground/85",children:N(m,h,l,t)},t))}),i("end"),u!==null&&d.push(e.jsx("pre",{className:"mb-3 overflow-x-auto rounded-xl border border-border/50 bg-background/50 p-3 font-mono text-[11px]",children:u.join(` `)},"code-end")),e.jsx("div",{className:"max-w-3xl",children:d})}function N(o,h,l,f){return o.split(/(\[\[[^\]]+\]\]|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g).map((r,u)=>{const i=`${f}-${u}`,a=r.match(/^\[\[([^\]|]+)(?:\|([^\]]+))?\]\]$/);if(a){const p=a[1].trim(),t=(a[2]??a[1]).trim();return l.has(p.toLowerCase())?e.jsx("button",{onClick:()=>h(p),className:"rounded bg-primary/10 px-1 text-primary underline decoration-primary/40 underline-offset-2 hover:bg-primary/20 cursor-pointer",children:t},i):e.jsx("span",{className:"rounded bg-background/40 px-1 text-muted-foreground",title:"Notiz existiert (noch) nicht",children:t},i)}return r.startsWith("**")&&r.endsWith("**")?e.jsx("b",{className:"font-semibold text-foreground",children:r.slice(2,-2)},i):r.startsWith("*")&&r.endsWith("*")&&r.length>2?e.jsx("i",{children:r.slice(1,-1)},i):r.startsWith("`")&&r.endsWith("`")?e.jsx("code",{className:"rounded bg-background/50 px-1 font-mono text-[11px] text-teal-300",children:r.slice(1,-1)},i):e.jsx("span",{children:r},i)})}export{T as WissenView}; diff --git a/frontend/dist/assets/book-open--4d0RiO4.js b/frontend/dist/assets/book-open-7pFuv-J-.js similarity index 90% rename from frontend/dist/assets/book-open--4d0RiO4.js rename to frontend/dist/assets/book-open-7pFuv-J-.js index ff545ba..c8fbd26 100644 --- a/frontend/dist/assets/book-open--4d0RiO4.js +++ b/frontend/dist/assets/book-open-7pFuv-J-.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-DbrEnusY.js";/** +import{c as a}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/copy-B0FtVA11.js b/frontend/dist/assets/copy-BTbDyEDy.js similarity index 90% rename from frontend/dist/assets/copy-B0FtVA11.js rename to frontend/dist/assets/copy-BTbDyEDy.js index f867ff0..9a7f6de 100644 --- a/frontend/dist/assets/copy-B0FtVA11.js +++ b/frontend/dist/assets/copy-BTbDyEDy.js @@ -1,4 +1,4 @@ -import{c}from"./index-DbrEnusY.js";/** +import{c}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/folder-open-CKukPWQR.js b/frontend/dist/assets/folder-open-Bqv661mo.js similarity index 90% rename from frontend/dist/assets/folder-open-CKukPWQR.js rename to frontend/dist/assets/folder-open-Bqv661mo.js index 53b7187..b2f8b6b 100644 --- a/frontend/dist/assets/folder-open-CKukPWQR.js +++ b/frontend/dist/assets/folder-open-Bqv661mo.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-DbrEnusY.js";/** +import{c as a}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/index-DbrEnusY.js b/frontend/dist/assets/index-D-OYo7d4.js similarity index 99% rename from frontend/dist/assets/index-DbrEnusY.js rename to frontend/dist/assets/index-D-OYo7d4.js index 01787c0..cc7a53f 100644 --- a/frontend/dist/assets/index-DbrEnusY.js +++ b/frontend/dist/assets/index-D-OYo7d4.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsView-XFK_eBt6.js","assets/zap-Cojq_aI_.js","assets/ConnectView-Dxf6Cyum.js","assets/folder-open-CKukPWQR.js","assets/copy-B0FtVA11.js","assets/MemoryView-rgfxKFS7.js","assets/send-CyhU48GF.js","assets/book-open--4d0RiO4.js","assets/GuideView-BS1gSjak.js","assets/lightbulb-xA-FtqvM.js","assets/AuftragsbuchView-ChhNmDrz.js","assets/WissenView-WgvQqTOM.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsView-LvY8upF2.js","assets/zap-nk89an7Z.js","assets/ConnectView-QFMbbPya.js","assets/folder-open-Bqv661mo.js","assets/copy-BTbDyEDy.js","assets/MemoryView-DiYUL6xq.js","assets/send-BF6peil_.js","assets/book-open-7pFuv-J-.js","assets/GuideView-DPDeItXc.js","assets/lightbulb-BDMFIwf9.js","assets/AuftragsbuchView-Bhd2qL6R.js","assets/WissenView-CFoCOSAi.js"])))=>i.map(i=>d[i]); var BI=Object.defineProperty;var p1=e=>{throw TypeError(e)};var UI=(e,t,r)=>t in e?BI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Os=(e,t,r)=>UI(e,typeof t!="symbol"?t+"":t,r),vm=(e,t,r)=>t.has(e)||p1("Cannot "+r);var R=(e,t,r)=>(vm(e,t,"read from private field"),r?r.call(e):t.get(e)),_e=(e,t,r)=>t.has(e)?p1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),fe=(e,t,r,n)=>(vm(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),$e=(e,t,r)=>(vm(e,t,"access private method"),r);var Qc=(e,t,r,n)=>({set _(i){fe(e,t,i,r)},get _(){return R(e,t,n)}});function WI(e,t){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();function Iy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ym={exports:{}},Cs={},gm={exports:{}},Re={};/** * @license React * react.production.min.js @@ -384,7 +384,7 @@ Error generating stack: `+w.message+` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},JD=0,No=[];function eR(e){var t=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),i=g.useState(JD++)[0],o=g.useState(YP)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=wD([e.lockRef.current],(e.shards||[]).map(tw),!0).filter(Boolean);return S.forEach(function(E){return E.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=g.useCallback(function(S,E){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!s.current.allowPinchZoom;var P=nd(S),C=r.current,_="deltaX"in S?S.deltaX:C[0]-P[0],O="deltaY"in S?S.deltaY:C[1]-P[1],N,j=S.target,D=Math.abs(_)>Math.abs(O)?"h":"v";if("touches"in S&&D==="h"&&j.type==="range")return!1;var B=window.getSelection(),F=B&&B.anchorNode,z=F?F===j||F.contains(j):!1;if(z)return!1;var G=J1(D,j);if(!G)return!0;if(G?N=D:(N=D==="v"?"h":"v",G=J1(D,j)),!G)return!1;if(!n.current&&"changedTouches"in S&&(_||O)&&(n.current=N),!N)return!0;var U=n.current||N;return QD(U,E,S,U==="h"?_:O)},[]),d=g.useCallback(function(S){var E=S;if(!(!No.length||No[No.length-1]!==o)){var P="deltaY"in E?ew(E):nd(E),C=t.current.filter(function(N){return N.name===E.type&&(N.target===E.target||E.target===N.shadowParent)&&XD(N.delta,P)})[0];if(C&&C.should){E.cancelable&&E.preventDefault();return}if(!C){var _=(s.current.shards||[]).map(tw).filter(Boolean).filter(function(N){return N.contains(E.target)}),O=_.length>0?u(E,_[0]):!s.current.noIsolation;O&&E.cancelable&&E.preventDefault()}}},[]),f=g.useCallback(function(S,E,P,C){var _={name:S,delta:E,target:P,should:C,shadowParent:tR(P)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(O){return O!==_})},1)},[]),h=g.useCallback(function(S){r.current=nd(S),n.current=void 0},[]),m=g.useCallback(function(S){f(S.type,ew(S),S.target,u(S,e.lockRef.current))},[]),v=g.useCallback(function(S){f(S.type,nd(S),S.target,u(S,e.lockRef.current))},[]);g.useEffect(function(){return No.push(o),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:v}),document.addEventListener("wheel",d,_o),document.addEventListener("touchmove",d,_o),document.addEventListener("touchstart",h,_o),function(){No=No.filter(function(S){return S!==o}),document.removeEventListener("wheel",d,_o),document.removeEventListener("touchmove",d,_o),document.removeEventListener("touchstart",h,_o)}},[]);var b=e.removeScrollBar,k=e.inert;return g.createElement(g.Fragment,null,k?g.createElement(o,{styles:ZD(i)}):null,b?g.createElement(WD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tR(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rR=_D(GP,eR);var JP=g.forwardRef(function(e,t){return g.createElement(Df,Sn({},e,{ref:t,sideCar:rR}))});JP.classNames=Df.classNames;var nR=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Io=new WeakMap,id=new WeakMap,ad={},jm=0,eA=function(e){return e&&(e.host||eA(e.parentNode))},iR=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=eA(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},aR=function(e,t,r,n){var i=iR(t,Array.isArray(e)?e:[e]);ad[r]||(ad[r]=new WeakMap);var o=ad[r],s=[],u=new Set,d=new Set(i),f=function(m){!m||u.has(m)||(u.add(m),f(m.parentNode))};i.forEach(f);var h=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(v){if(u.has(v))h(v);else try{var b=v.getAttribute(n),k=b!==null&&b!=="false",S=(Io.get(v)||0)+1,E=(o.get(v)||0)+1;Io.set(v,S),o.set(v,E),s.push(v),S===1&&k&&id.set(v,!0),E===1&&v.setAttribute(r,"true"),k||v.setAttribute(n,"true")}catch(P){console.error("aria-hidden: cannot operate on ",v,P)}})};return h(t),u.clear(),jm++,function(){s.forEach(function(m){var v=Io.get(m)-1,b=o.get(m)-1;Io.set(m,v),o.set(m,b),v||(id.has(m)||m.removeAttribute(n),id.delete(m)),b||m.removeAttribute(r)}),jm--,jm||(Io=new WeakMap,Io=new WeakMap,id=new WeakMap,ad={})}},oR=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=nR(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),aR(n,i,r,"aria-hidden")):function(){return null}},Rf="Dialog",[tA]=TT(Rf),[lR,sn]=tA(Rf),rA=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,u=g.useRef(null),d=g.useRef(null),[f,h]=zT({prop:n,defaultProp:i??!1,onChange:o,caller:Rf});return x.jsx(lR,{scope:t,triggerRef:u,contentRef:d,contentId:Zn(),titleId:Zn(),descriptionId:Zn(),open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(m=>!m),[h]),modal:s,children:r})};rA.displayName=Rf;var nA="DialogTrigger",sR=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=sn(nA,r),o=eo(t,i.triggerRef);return x.jsx(Wt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Vy(i.open),...n,ref:o,onClick:Zi(e.onClick,i.onOpenToggle)})});sR.displayName=nA;var Ky="DialogPortal",[uR,iA]=tA(Ky,{forceMount:void 0}),aA=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,o=sn(Ky,t);return x.jsx(uR,{scope:t,forceMount:r,children:g.Children.map(n,s=>x.jsx(Tf,{present:r||o.open,children:x.jsx(KP,{asChild:!0,container:i,children:s})}))})};aA.displayName=Ky;var Md="DialogOverlay",oA=g.forwardRef((e,t)=>{const r=iA(Md,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=sn(Md,e.__scopeDialog);return o.modal?x.jsx(Tf,{present:n||o.open,children:x.jsx(dR,{...i,ref:t})}):null});oA.displayName=Md;var cR=FP("DialogOverlay.RemoveScroll"),dR=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=sn(Md,r),o=aD(),s=eo(t,o);return x.jsx(JP,{as:cR,allowPinchZoom:!0,shards:[i.contentRef],children:x.jsx(Wt.div,{"data-state":Vy(i.open),...n,ref:s,style:{pointerEvents:"auto",...n.style}})})}),ml="DialogContent",lA=g.forwardRef((e,t)=>{const r=iA(ml,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=sn(ml,e.__scopeDialog);return x.jsx(Tf,{present:n||o.open,children:o.modal?x.jsx(fR,{...i,ref:t}):x.jsx(hR,{...i,ref:t})})});lA.displayName=ml;var fR=g.forwardRef((e,t)=>{const r=sn(ml,e.__scopeDialog),n=g.useRef(null),i=eo(t,r.contentRef,n);return g.useEffect(()=>{const o=n.current;if(o)return oR(o)},[]),x.jsx(sA,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Zi(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=r.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Zi(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,u=s.button===0&&s.ctrlKey===!0;(s.button===2||u)&&o.preventDefault()}),onFocusOutside:Zi(e.onFocusOutside,o=>o.preventDefault())})}),hR=g.forwardRef((e,t)=>{const r=sn(ml,e.__scopeDialog),n=g.useRef(!1),i=g.useRef(!1);return x.jsx(sA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,u;(s=e.onCloseAutoFocus)==null||s.call(e,o),o.defaultPrevented||(n.current||(u=r.triggerRef.current)==null||u.focus(),o.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:o=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((f=r.triggerRef.current)==null?void 0:f.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),sA=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,u=sn(ml,r);return bD(),x.jsx(x.Fragment,{children:x.jsx(WP,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o,children:x.jsx(BP,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Vy(u.open),...s,ref:t,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})}),uA="DialogTitle",pR=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=sn(uA,r);return x.jsx(Wt.h2,{id:i.titleId,...n,ref:t})});pR.displayName=uA;var cA="DialogDescription",mR=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=sn(cA,r);return x.jsx(Wt.p,{id:i.descriptionId,...n,ref:t})});mR.displayName=cA;var dA="DialogClose",vR=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=sn(dA,r);return x.jsx(Wt.button,{type:"button",...n,ref:t,onClick:Zi(e.onClick,()=>i.onOpenChange(!1))})});vR.displayName=dA;function Vy(e){return e?"open":"closed"}var js='[cmdk-group=""]',_m='[cmdk-group-items=""]',yR='[cmdk-group-heading=""]',fA='[cmdk-item=""]',rw=`${fA}:not([aria-disabled="true"])`,_v="cmdk-item-select",Wo="data-value",gR=(e,t,r)=>MT(e,t,r),hA=g.createContext(void 0),Au=()=>g.useContext(hA),pA=g.createContext(void 0),qy=()=>g.useContext(pA),mA=g.createContext(void 0),vA=g.forwardRef((e,t)=>{let r=Ho(()=>{var M,X;return{search:"",value:(X=(M=e.value)!=null?M:e.defaultValue)!=null?X:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Ho(()=>new Set),i=Ho(()=>new Map),o=Ho(()=>new Map),s=Ho(()=>new Set),u=yA(e),{label:d,children:f,value:h,onValueChange:m,filter:v,shouldFilter:b,loop:k,disablePointerSelection:S=!1,vimBindings:E=!0,...P}=e,C=Zn(),_=Zn(),O=Zn(),N=g.useRef(null),j=jR();Ka(()=>{if(h!==void 0){let M=h.trim();r.current.value=M,D.emit()}},[h]),Ka(()=>{j(6,ue)},[]);let D=g.useMemo(()=>({subscribe:M=>(s.current.add(M),()=>s.current.delete(M)),snapshot:()=>r.current,setState:(M,X,le)=>{var re,ce,he,Pe;if(!Object.is(r.current[M],X)){if(r.current[M]=X,M==="search")U(),z(),j(1,G);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let J=document.getElementById(O);J?J.focus():(re=document.getElementById(C))==null||re.focus()}if(j(7,()=>{var J;r.current.selectedItemId=(J=ae())==null?void 0:J.id,D.emit()}),le||j(5,ue),((ce=u.current)==null?void 0:ce.value)!==void 0){let J=X??"";(Pe=(he=u.current).onValueChange)==null||Pe.call(he,J);return}}D.emit()}},emit:()=>{s.current.forEach(M=>M())}}),[]),B=g.useMemo(()=>({value:(M,X,le)=>{var re;X!==((re=o.current.get(M))==null?void 0:re.value)&&(o.current.set(M,{value:X,keywords:le}),r.current.filtered.items.set(M,F(X,le)),j(2,()=>{z(),D.emit()}))},item:(M,X)=>(n.current.add(M),X&&(i.current.has(X)?i.current.get(X).add(M):i.current.set(X,new Set([M]))),j(3,()=>{U(),z(),r.current.value||G(),D.emit()}),()=>{o.current.delete(M),n.current.delete(M),r.current.filtered.items.delete(M);let le=ae();j(4,()=>{U(),(le==null?void 0:le.getAttribute("id"))===M&&G(),D.emit()})}),group:M=>(i.current.has(M)||i.current.set(M,new Set),()=>{o.current.delete(M),i.current.delete(M)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:C,inputId:O,labelId:_,listInnerRef:N}),[]);function F(M,X){var le,re;let ce=(re=(le=u.current)==null?void 0:le.filter)!=null?re:gR;return M?ce(M,r.current.search,X):0}function z(){if(!r.current.search||u.current.shouldFilter===!1)return;let M=r.current.filtered.items,X=[];r.current.filtered.groups.forEach(re=>{let ce=i.current.get(re),he=0;ce.forEach(Pe=>{let J=M.get(Pe);he=Math.max(J,he)}),X.push([re,he])});let le=N.current;ye().sort((re,ce)=>{var he,Pe;let J=re.getAttribute("id"),we=ce.getAttribute("id");return((he=M.get(we))!=null?he:0)-((Pe=M.get(J))!=null?Pe:0)}).forEach(re=>{let ce=re.closest(_m);ce?ce.appendChild(re.parentElement===ce?re:re.closest(`${_m} > *`)):le.appendChild(re.parentElement===le?re:re.closest(`${_m} > *`))}),X.sort((re,ce)=>ce[1]-re[1]).forEach(re=>{var ce;let he=(ce=N.current)==null?void 0:ce.querySelector(`${js}[${Wo}="${encodeURIComponent(re[0])}"]`);he==null||he.parentElement.appendChild(he)})}function G(){let M=ye().find(le=>le.getAttribute("aria-disabled")!=="true"),X=M==null?void 0:M.getAttribute(Wo);D.setState("value",X||void 0)}function U(){var M,X,le,re;if(!r.current.search||u.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let ce=0;for(let he of n.current){let Pe=(X=(M=o.current.get(he))==null?void 0:M.value)!=null?X:"",J=(re=(le=o.current.get(he))==null?void 0:le.keywords)!=null?re:[],we=F(Pe,J);r.current.filtered.items.set(he,we),we>0&&ce++}for(let[he,Pe]of i.current)for(let J of Pe)if(r.current.filtered.items.get(J)>0){r.current.filtered.groups.add(he);break}r.current.filtered.count=ce}function ue(){var M,X,le;let re=ae();re&&(((M=re.parentElement)==null?void 0:M.firstChild)===re&&((le=(X=re.closest(js))==null?void 0:X.querySelector(yR))==null||le.scrollIntoView({block:"nearest"})),re.scrollIntoView({block:"nearest"}))}function ae(){var M;return(M=N.current)==null?void 0:M.querySelector(`${fA}[aria-selected="true"]`)}function ye(){var M;return Array.from(((M=N.current)==null?void 0:M.querySelectorAll(rw))||[])}function pe(M){let X=ye()[M];X&&D.setState("value",X.getAttribute(Wo))}function se(M){var X;let le=ae(),re=ye(),ce=re.findIndex(Pe=>Pe===le),he=re[ce+M];(X=u.current)!=null&&X.loop&&(he=ce+M<0?re[re.length-1]:ce+M===re.length?re[0]:re[ce+M]),he&&D.setState("value",he.getAttribute(Wo))}function Y(M){let X=ae(),le=X==null?void 0:X.closest(js),re;for(;le&&!re;)le=M>0?OR(le,js):CR(le,js),re=le==null?void 0:le.querySelector(rw);re?D.setState("value",re.getAttribute(Wo)):se(M)}let Q=()=>pe(ye().length-1),Z=M=>{M.preventDefault(),M.metaKey?Q():M.altKey?Y(1):se(1)},$=M=>{M.preventDefault(),M.metaKey?pe(0):M.altKey?Y(-1):se(-1)};return g.createElement(Wt.div,{ref:t,tabIndex:-1,...P,"cmdk-root":"",onKeyDown:M=>{var X;(X=P.onKeyDown)==null||X.call(P,M);let le=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||le))switch(M.key){case"n":case"j":{E&&M.ctrlKey&&Z(M);break}case"ArrowDown":{Z(M);break}case"p":case"k":{E&&M.ctrlKey&&$(M);break}case"ArrowUp":{$(M);break}case"Home":{M.preventDefault(),pe(0);break}case"End":{M.preventDefault(),Q();break}case"Enter":{M.preventDefault();let re=ae();if(re){let ce=new Event(_v);re.dispatchEvent(ce)}}}}},g.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:NR},d),$f(e,M=>g.createElement(pA.Provider,{value:D},g.createElement(hA.Provider,{value:B},M))))}),xR=g.forwardRef((e,t)=>{var r,n;let i=Zn(),o=g.useRef(null),s=g.useContext(mA),u=Au(),d=yA(e),f=(n=(r=d.current)==null?void 0:r.forceMount)!=null?n:s==null?void 0:s.forceMount;Ka(()=>{if(!f)return u.item(i,s==null?void 0:s.id)},[f]);let h=gA(i,o,[e.value,e.children,o],e.keywords),m=qy(),v=ta(j=>j.value&&j.value===h.current),b=ta(j=>f||u.filter()===!1?!0:j.search?j.filtered.items.get(i)>0:!0);g.useEffect(()=>{let j=o.current;if(!(!j||e.disabled))return j.addEventListener(_v,k),()=>j.removeEventListener(_v,k)},[b,e.onSelect,e.disabled]);function k(){var j,D;S(),(D=(j=d.current).onSelect)==null||D.call(j,h.current)}function S(){m.setState("value",h.current,!0)}if(!b)return null;let{disabled:E,value:P,onSelect:C,forceMount:_,keywords:O,...N}=e;return g.createElement(Wt.div,{ref:pl(o,t),...N,id:i,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!v,"data-disabled":!!E,"data-selected":!!v,onPointerMove:E||u.getDisablePointerSelection()?void 0:S,onClick:E?void 0:k},e.children)}),bR=g.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:i,...o}=e,s=Zn(),u=g.useRef(null),d=g.useRef(null),f=Zn(),h=Au(),m=ta(b=>i||h.filter()===!1?!0:b.search?b.filtered.groups.has(s):!0);Ka(()=>h.group(s),[]),gA(s,u,[e.value,e.heading,d]);let v=g.useMemo(()=>({id:s,forceMount:i}),[i]);return g.createElement(Wt.div,{ref:pl(u,t),...o,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},r&&g.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:f},r),$f(e,b=>g.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?f:void 0},g.createElement(mA.Provider,{value:v},b))))}),wR=g.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,i=g.useRef(null),o=ta(s=>!s.search);return!r&&!o?null:g.createElement(Wt.div,{ref:pl(i,t),...n,"cmdk-separator":"",role:"separator"})}),SR=g.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,i=e.value!=null,o=qy(),s=ta(f=>f.search),u=ta(f=>f.selectedItemId),d=Au();return g.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),g.createElement(Wt.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:i?e.value:s,onChange:f=>{i||o.setState("search",f.target.value),r==null||r(f.target.value)}})}),kR=g.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...i}=e,o=g.useRef(null),s=g.useRef(null),u=ta(f=>f.selectedItemId),d=Au();return g.useEffect(()=>{if(s.current&&o.current){let f=s.current,h=o.current,m,v=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let b=f.offsetHeight;h.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return v.observe(f),()=>{cancelAnimationFrame(m),v.unobserve(f)}}},[]),g.createElement(Wt.div,{ref:pl(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":n,id:d.listId},$f(e,f=>g.createElement("div",{ref:pl(s,d.listInnerRef),"cmdk-list-sizer":""},f)))}),ER=g.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:o,container:s,...u}=e;return g.createElement(rA,{open:r,onOpenChange:n},g.createElement(aA,{container:s},g.createElement(oA,{"cmdk-overlay":"",className:i}),g.createElement(lA,{"aria-label":e.label,"cmdk-dialog":"",className:o},g.createElement(vA,{ref:t,...u}))))}),PR=g.forwardRef((e,t)=>ta(r=>r.filtered.count===0)?g.createElement(Wt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),AR=g.forwardRef((e,t)=>{let{progress:r,children:n,label:i="Loading...",...o}=e;return g.createElement(Wt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$f(e,s=>g.createElement("div",{"aria-hidden":!0},s)))}),Mo=Object.assign(vA,{List:kR,Item:xR,Input:SR,Group:bR,Separator:wR,Dialog:ER,Empty:PR,Loading:AR});function OR(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function CR(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function yA(e){let t=g.useRef(e);return Ka(()=>{t.current=e}),t}var Ka=typeof window>"u"?g.useEffect:g.useLayoutEffect;function Ho(e){let t=g.useRef();return t.current===void 0&&(t.current=e()),t}function ta(e){let t=qy(),r=()=>e(t.snapshot());return g.useSyncExternalStore(t.subscribe,r,r)}function gA(e,t,r,n=[]){let i=g.useRef(),o=Au();return Ka(()=>{var s;let u=(()=>{var f;for(let h of r){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(f=h.current.textContent)==null?void 0:f.trim():i.current}})(),d=n.map(f=>f.trim());o.value(e,u,d),(s=t.current)==null||s.setAttribute(Wo,u),i.current=u}),i}var jR=()=>{let[e,t]=g.useState(),r=Ho(()=>new Map);return Ka(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,i)=>{r.current.set(n,i),t({})}};function _R(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function $f({asChild:e,children:t},r){return e&&g.isValidElement(t)?g.cloneElement(_R(t),{ref:t.ref},r(t.props.children)):r(t)}var NR={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function IR({onNavigate:e}){const[t,r]=g.useState(!1);return g.useEffect(()=>{const n=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),r(o=>!o))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),x.jsx(Mo.Dialog,{open:t,onOpenChange:r,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh] overscroll-contain",onClick:()=>r(!1),children:x.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:n=>n.stopPropagation(),children:[x.jsx(Mo.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"}),x.jsxs(Mo.List,{className:"max-h-80 overflow-y-auto p-2",children:[x.jsx(Mo.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),x.jsx(Mo.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Yo.map(n=>x.jsxs(Mo.Item,{value:`${n.label} ${n.hint}`,onSelect:()=>{e(n.id),r(!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:[x.jsx(n.icon,{className:"h-4 w-4 text-primary"}),x.jsx("span",{children:n.label}),x.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:n.hint})]},n.id))})]})]})})}const xA="mc_expert_mode",Nv="mc-expert-mode-change",MR=()=>{try{return localStorage.getItem(xA)==="true"}catch{return!1}};function TR(e){return window.addEventListener(Nv,e),window.addEventListener("storage",e),()=>{window.removeEventListener(Nv,e),window.removeEventListener("storage",e)}}function nw(e){localStorage.setItem(xA,String(e)),window.dispatchEvent(new Event(Nv))}function DR(){return g.useSyncExternalStore(TR,MR,()=>!1)}function bA(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=LR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{const u=s.split(Gy);return u[0]===""&&u.length!==1&&u.shift(),wA(u,t)||$R(s)},getConflictingClassGroupIds:(s,u)=>{const d=r[s]||[];return u&&n[s]?[...d,...n[s]]:d}}},wA=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),i=n?wA(e.slice(1),n):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Gy);return(s=t.validators.find(({validator:u})=>u(o)))==null?void 0:s.classGroupId},iw=/^\[(.+)\]$/,$R=e=>{if(iw.test(e)){const t=iw.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},LR=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return FR(Object.entries(e.classGroups),r).forEach(([o,s])=>{Iv(s,n,o,t)}),n},Iv=(e,t,r,n)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:aw(t,i);o.classGroupId=r;return}if(typeof i=="function"){if(zR(i)){Iv(i(n),t,r,n);return}t.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([o,s])=>{Iv(s,aw(t,o),r,n)})})},aw=(e,t)=>{let r=e;return t.split(Gy).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},zR=e=>e.isThemeGetter,FR=(e,t)=>t?e.map(([r,n])=>{const i=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,u])=>[t+s,u])):o);return[r,i]}):e,BR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const i=(o,s)=>{r.set(o,s),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let s=r.get(o);if(s!==void 0)return s;if((s=n.get(o))!==void 0)return i(o,s),s},set(o,s){r.has(o)?r.set(o,s):i(o,s)}}},SA="!",UR=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,i=t[0],o=t.length,s=u=>{const d=[];let f=0,h=0,m;for(let E=0;Eh?m-h:void 0;return{modifiers:d,hasImportantModifier:b,baseClassName:k,maybePostfixModifierPosition:S}};return r?u=>r({className:u,parseClassName:s}):s},WR=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},HR=e=>({cache:BR(e.cacheSize),parseClassName:UR(e),...RR(e)}),KR=/\s+/,VR=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(KR);let u="";for(let d=s.length-1;d>=0;d-=1){const f=s[d],{modifiers:h,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:b}=r(f);let k=!!b,S=n(k?v.substring(0,b):v);if(!S){if(!k){u=f+(u.length>0?" "+u:u);continue}if(S=n(v),!S){u=f+(u.length>0?" "+u:u);continue}k=!1}const E=WR(h).join(":"),P=m?E+SA:E,C=P+S;if(o.includes(C))continue;o.push(C);const _=i(S,k);for(let O=0;O<_.length;++O){const N=_[O];o.push(P+N)}u=f+(u.length>0?" "+u:u)}return u};function qR(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;nm(h),e());return r=HR(f),n=r.cache.get,i=r.cache.set,o=u,u(d)}function u(d){const f=n(d);if(f)return f;const h=VR(d,r);return i(d,h),h}return function(){return o(qR.apply(null,arguments))}}const tt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},EA=/^\[(?:([a-z-]+):)?(.+)\]$/i,YR=/^\d+\/\d+$/,QR=new Set(["px","full","screen"]),XR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZR=/\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$/,JR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,e3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,t3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wn=e=>Xo(e)||QR.has(e)||YR.test(e),Ti=e=>Al(e,"length",u3),Xo=e=>!!e&&!Number.isNaN(Number(e)),Nm=e=>Al(e,"number",Xo),_s=e=>!!e&&Number.isInteger(Number(e)),r3=e=>e.endsWith("%")&&Xo(e.slice(0,-1)),Te=e=>EA.test(e),Di=e=>XR.test(e),n3=new Set(["length","size","percentage"]),i3=e=>Al(e,n3,PA),a3=e=>Al(e,"position",PA),o3=new Set(["image","url"]),l3=e=>Al(e,o3,d3),s3=e=>Al(e,"",c3),Ns=()=>!0,Al=(e,t,r)=>{const n=EA.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},u3=e=>ZR.test(e)&&!JR.test(e),PA=()=>!1,c3=e=>e3.test(e),d3=e=>t3.test(e),f3=()=>{const e=tt("colors"),t=tt("spacing"),r=tt("blur"),n=tt("brightness"),i=tt("borderColor"),o=tt("borderRadius"),s=tt("borderSpacing"),u=tt("borderWidth"),d=tt("contrast"),f=tt("grayscale"),h=tt("hueRotate"),m=tt("invert"),v=tt("gap"),b=tt("gradientColorStops"),k=tt("gradientColorStopPositions"),S=tt("inset"),E=tt("margin"),P=tt("opacity"),C=tt("padding"),_=tt("saturate"),O=tt("scale"),N=tt("sepia"),j=tt("skew"),D=tt("space"),B=tt("translate"),F=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",Te,t],U=()=>[Te,t],ue=()=>["",Wn,Ti],ae=()=>["auto",Xo,Te],ye=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],pe=()=>["solid","dashed","dotted","double","none"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",Te],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Xo,Te];return{cacheSize:500,separator:":",theme:{colors:[Ns],spacing:[Wn,Ti],blur:["none","",Di,Te],brightness:$(),borderColor:[e],borderRadius:["none","","full",Di,Te],borderSpacing:U(),borderWidth:ue(),contrast:$(),grayscale:Q(),hueRotate:$(),invert:Q(),gap:U(),gradientColorStops:[e],gradientColorStopPositions:[r3,Ti],inset:G(),margin:G(),opacity:$(),padding:U(),saturate:$(),scale:$(),sepia:Q(),skew:$(),space:U(),translate:U()},classGroups:{aspect:[{aspect:["auto","square","video",Te]}],container:["container"],columns:[{columns:[Di]}],"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:[...ye(),Te]}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],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",_s,Te]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Te]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",_s,Te]}],"grid-cols":[{"grid-cols":[Ns]}],"col-start-end":[{col:["auto",{span:["full",_s,Te]},Te]}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":[Ns]}],"row-start-end":[{row:["auto",{span:[_s,Te]},Te]}],"row-start":[{"row-start":ae()}],"row-end":[{"row-end":ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Te]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[E]}],mx:[{mx:[E]}],my:[{my:[E]}],ms:[{ms:[E]}],me:[{me:[E]}],mt:[{mt:[E]}],mr:[{mr:[E]}],mb:[{mb:[E]}],ml:[{ml:[E]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Te,t]}],"min-w":[{"min-w":[Te,t,"min","max","fit"]}],"max-w":[{"max-w":[Te,t,"none","full","min","max","fit","prose",{screen:[Di]},Di]}],h:[{h:[Te,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Te,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Te,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Te,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Di,Ti]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Nm]}],"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",Te]}],"line-clamp":[{"line-clamp":["none",Xo,Nm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Wn,Te]}],"list-image":[{"list-image":["none",Te]}],"list-style-type":[{list:["none","disc","decimal",Te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[P]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Wn,Ti]}],"underline-offset":[{"underline-offset":["auto",Wn,Te]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:U()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te]}],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",Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[P]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ye(),a3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",i3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},l3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[P]}],"border-style":[{border:[...pe(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[P]}],"divide-style":[{divide:pe()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...pe()]}],"outline-offset":[{"outline-offset":[Wn,Te]}],"outline-w":[{outline:[Wn,Ti]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[P]}],"ring-offset-w":[{"ring-offset":[Wn,Ti]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Di,s3]}],"shadow-color":[{shadow:[Ns]}],opacity:[{opacity:[P]}],"mix-blend":[{"mix-blend":[...se(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":se()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",Di,Te]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[m]}],saturate:[{saturate:[_]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[P]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Te]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",Te]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",Te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[O]}],"scale-x":[{"scale-x":[O]}],"scale-y":[{"scale-y":[O]}],rotate:[{rotate:[_s,Te]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Te]}],accent:[{accent:["auto",e]}],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",Te]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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",Te]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Wn,Ti,Nm]}],stroke:[{stroke:[e,"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"]}}},h3=GR(f3);function De(...e){return h3(Xe(e))}function jQ(e){return e?e.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function p3(){const e=DR();return x.jsxs("div",{className:"flex items-center rounded-md border border-border/40 bg-background/40 p-0.5",role:"group","aria-label":"Ansichtsmodus",title:"Einfach zeigt nur das Wichtigste. Experte zeigt alle technischen Details.",children:[x.jsxs("button",{onClick:()=>nw(!1),"aria-pressed":!e,className:De("flex items-center gap-1 rounded px-2 py-1 text-xs font-semibold transition-all cursor-pointer",e?"text-muted-foreground hover:text-foreground":"bg-primary/15 text-primary shadow-sm"),children:[x.jsx(bT,{className:"h-3.5 w-3.5"})," Einfach"]}),x.jsxs("button",{onClick:()=>nw(!0),"aria-pressed":e,className:De("flex items-center gap-1 rounded px-2 py-1 text-xs font-semibold transition-all cursor-pointer",e?"bg-primary/15 text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),children:[x.jsx(xT,{className:"h-3.5 w-3.5"})," Experte"]})]})}function m3({title:e,hint:t}){return x.jsxs("div",{className:"space-y-4",children:[x.jsxs("div",{children:[x.jsx("h1",{className:"text-xl font-semibold",children:e}),x.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),x.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:[x.jsx(tT,{className:"h-8 w-8 text-muted-foreground"}),x.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}async function Me(e,t){var d;const r={"Content-Type":"application/json",...t==null?void 0:t.headers},n=((d=t==null?void 0:t.method)==null?void 0:d.toUpperCase())||"GET",i=n==="GET"?null:localStorage.getItem("mc_sudo_password"),o=n==="GET"?null:localStorage.getItem("mc_hf_token");i&&(r["X-Sudo-Password"]=i);let s=t==null?void 0:t.body;if(n==="POST"){if(typeof s=="string")try{const f=JSON.parse(s);let h=!1;i&&!("sudo_password"in f)&&(f.sudo_password=i,h=!0),o&&!("hf_token"in f)&&(f.hf_token=o,h=!0),h&&(s=JSON.stringify(f))}catch{}else if(!s){const f={};i&&(f.sudo_password=i),o&&(f.hf_token=o),Object.keys(f).length>0&&(s=JSON.stringify(f))}}const u=await fetch(e,{...t,headers:r,body:s});if(!u.ok)throw new Error(`${u.status} ${u.statusText}`);return u.json()}function AA({type:e,title:t,message:r,defaultValue:n,autoValue:i,autoLabel:o,onConfirm:s,onCancel:u}){const d=g.useRef(null);return x.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":t,children:x.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:[x.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:t}),x.jsx("button",{onClick:u||(()=>s()),"aria-label":"Schließen",className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:x.jsx(Pu,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.jsx("p",{className:"max-h-72 overflow-y-auto whitespace-pre-line text-xs text-muted-foreground leading-relaxed scrollbar-thin",children:r}),e==="prompt"&&x.jsxs("div",{className:"flex gap-2",children:[x.jsx("input",{ref:d,type:"text",defaultValue:n,"aria-label":t,className:"flex-1 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:f=>{var h;f.key==="Enter"&&s((h=d.current)==null?void 0:h.value)}}),i!==void 0&&x.jsx("button",{type:"button",onClick:()=>{d.current&&(d.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:o||"Auto"})]}),x.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(e==="confirm"||e==="prompt")&&x.jsx("button",{onClick:u,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"}),x.jsx("button",{onClick:()=>{var h;const f=e==="prompt"?(h=d.current)==null?void 0:h.value:void 0;s(f)},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:e==="confirm"?"Ja, fortfahren":e==="prompt"?"Übernehmen":"OK"})]})]})})}const ow=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"voice-service",label:"Voice (Sprache)",type:"user",reach:"voice"},{id:"hermes-builtin-ui",label:"Hermes GUI (Desktop-Gateway)",type:"user",reach:"hermes-gui"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function Is({icon:e,iconClass:t,name:r,status:n,available:i,busy:o,actionLabel:s,onAction:u}){return x.jsxs("div",{className:De("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[x.jsx(e,{className:De("h-4 w-4 shrink-0",t)}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("div",{className:"text-xs text-foreground truncate",children:r}),x.jsx("div",{className:De("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:n})]}),x.jsx("button",{onClick:u,disabled:!i||o,className:De("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:o?"…":s})]})}function v3({label:e,ok:t,system:r,busy:n,onRestart:i,onLogs:o}){return x.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[x.jsx("span",{className:De("w-1.5 h-1.5 rounded-full shrink-0",t===!0?"bg-emerald-500":t===!1?"bg-red-500":"bg-muted-foreground/40")}),x.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[e,r&&x.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),x.jsx("button",{onClick:i,disabled:n,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:x.jsx(Go,{className:De("h-3.5 w-3.5",n&&"animate-spin")})}),x.jsx("button",{onClick:o,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:x.jsx(nT,{className:"h-3.5 w-3.5"})})]})}function Im(e){return e==null?"":e>1024**3?`${(e/1024**3).toFixed(2)} GB`:`${(e/1024**2).toFixed(1)} MB`}const y3=/\b(error|fehler|fail(ed|ure)?|fatal|critical|crit|panic|traceback|exception|denied|refused|unable|emerg|alert|oom|killed)\b/i,g3=/\b(warn(ing)?|deprecat\w*|retry(ing)?|timeout|timed out|degraded|missing|not found|nicht gefunden)\b/i;function x3(e){return y3.test(e)?"error":g3.test(e)?"warn":"info"}const b3={error:"text-red-400",warn:"text-amber-300",info:"text-cyan-300/80"};function w3({service:e,text:t,loading:r,logStatus:n,onRefresh:i,onOpenSettings:o}){const[s,u]=g.useState(!1),[d,f]=g.useState(""),h=g.useRef(null),m=g.useMemo(()=>t?t.split(` -`).map(E=>({t:E,level:x3(E)})):[],[t]),v=g.useMemo(()=>m.filter(E=>E.level!=="info").length,[m]),b=d.trim().toLowerCase(),k=m.filter(E=>(!s||E.level!=="info")&&(!b||E.t.toLowerCase().includes(b))),S=n==="password_required"||n==="incorrect_password";return x.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:[x.jsxs("div",{className:"flex h-10 items-center justify-between gap-2 px-3 border-b border-border/40 bg-black/30 shrink-0",children:[x.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground shrink-0",children:[x.jsx(ST,{className:"h-3 w-3 text-primary"}),x.jsx("span",{className:"hidden sm:inline",children:"stdout/stderr —"})," ",e]}),x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsxs("div",{className:"relative",children:[x.jsx(yT,{className:"pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),x.jsx("input",{value:d,onChange:E=>f(E.target.value),placeholder:"filtern…",className:"h-7 w-24 sm:w-36 rounded-md border border-border/50 bg-background/40 pl-6 pr-2 text-[10px] text-foreground outline-none focus:border-primary/50"})]}),x.jsxs("button",{onClick:()=>u(E=>!E),title:"Nur Fehler und Warnungen zeigen",className:De("flex h-7 items-center gap-1 rounded-md border px-2 text-[10px] font-semibold transition-colors",s?"border-amber-500/50 bg-amber-500/15 text-amber-300":"border-border/50 bg-background/20 text-muted-foreground hover:text-foreground"),children:[x.jsx(eu,{className:"h-3 w-3"}),"Nur Probleme",v>0?` (${v})`:""]}),x.jsx("button",{onClick:i,disabled:r,title:"Neu laden",className:"flex h-7 w-7 items-center justify-center rounded-md border border-border/50 bg-background/20 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:x.jsx(Go,{className:De("h-3 w-3",r&&"animate-spin")})})]})]}),x.jsx("div",{ref:h,className:"flex-1 overflow-y-auto p-3 text-[10px] font-mono leading-relaxed scrollbar-thin select-text",children:S?x.jsxs("div",{className:"flex h-full flex-col items-center justify-center space-y-3 p-6 text-center",children:[x.jsx(eu,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),x.jsx("div",{className:"text-xs font-semibold text-amber-300",children:n==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),x.jsxs("p",{className:"max-w-xs text-[10px] leading-normal text-muted-foreground",children:["Für das Auslesen der systemd-Logs von ",e," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),x.jsx("button",{onClick:o,className:"mt-2 rounded-md bg-primary px-3 py-1.5 text-[10px] font-semibold text-primary-foreground transition-colors hover:bg-primary/95",children:"Sudo-Passwort eintragen"})]}):r&&!t?x.jsx("span",{className:"text-muted-foreground",children:"Lade Logs…"}):m.length===0?x.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."}):k.length===0?x.jsx("span",{className:"text-muted-foreground",children:s?"Keine Fehler oder Warnungen — der Dienst läuft sauber. ✓":"Kein Treffer für den Filter."}):k.map((E,P)=>x.jsx("div",{className:De("whitespace-pre-wrap",b3[E.level]),children:E.t||" "},P))})]})}function S3({open:e,showAlert:t}){const[r,n]=g.useState(""),[i,o]=g.useState(""),[s,u]=g.useState(!1),[d,f]=g.useState(!1);return g.useEffect(()=>{e&&(n(localStorage.getItem("mc_sudo_password")||""),o(localStorage.getItem("mc_hf_token")||""))},[e]),x.jsxs("div",{className:"space-y-6",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),x.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."})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[x.jsx(Wy,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),x.jsxs("div",{className:"relative",children:[x.jsx("input",{type:s?"text":"password",value:r,onChange:h=>n(h.target.value),"aria-label":"Host Sudo-Passwort",name:"sudo-password",autoComplete:"off",spellCheck:!1,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"}),x.jsx("button",{type:"button",onClick:()=>u(!s),"aria-label":s?"Passwort verbergen":"Passwort anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:s?x.jsx(R1,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(Av,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.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."})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[x.jsx(uT,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),x.jsxs("div",{className:"relative",children:[x.jsx("input",{type:d?"text":"password",value:i,onChange:h=>o(h.target.value),"aria-label":"HuggingFace API Token",name:"hf-token",autoComplete:"off",spellCheck:!1,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"}),x.jsx("button",{type:"button",onClick:()=>f(!d),"aria-label":d?"Token verbergen":"Token anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:d?x.jsx(R1,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(Av,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.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."})]}),x.jsxs("div",{className:"flex gap-3 pt-2",children:[x.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",r),localStorage.setItem("mc_hf_token",i),t("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"}),x.jsx("button",{onClick:()=>{n(""),o(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),t("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"})]})]})}function k3({detail:e,maintenanceJob:t,onClose:r,onApply:n}){var d,f;const i=e.data,o={os:{icon:Wy,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:Uy,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:LP,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:Nf,cls:"text-amber-400",title:"Hermes-Agent"}}[e.kind],s=o.icon,u=i?e.kind==="os"?(i.count??0)===0:e.kind==="hermes"?(i.behind??0)===0:i.installed_build!=null&&i.latest_build!=null&&i.latest_build<=i.installed_build:!0;return x.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[x.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:r}),x.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[x.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(s,{className:De("h-4.5 w-4.5",o.cls)}),x.jsx("h3",{className:"text-sm font-semibold",children:o.title})]}),x.jsx("button",{onClick:r,className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:x.jsx(Pu,{className:"h-4 w-4"})})]}),x.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:e.loading?x.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[x.jsx(Go,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):i!=null&&i.error?x.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:i.error}):x.jsxs(x.Fragment,{children:[(i==null?void 0:i.action_needed)!=null&&x.jsxs("div",{className:De("flex items-start gap-2 rounded-lg border p-3",i.action_needed?"border-amber-500/40 bg-amber-500/10":"border-emerald-500/40 bg-emerald-500/10"),children:[i.action_needed?x.jsx(eu,{className:"h-4 w-4 text-amber-400 shrink-0 mt-0.5"}):x.jsx(QM,{className:"h-4 w-4 text-emerald-400 shrink-0 mt-0.5"}),x.jsxs("div",{className:"min-w-0",children:[x.jsxs("div",{className:De("text-xs font-semibold",i.action_needed?"text-amber-300":"text-emerald-300"),children:["Musst du etwas tun? ",i.action_needed?"Ja":"Nein — die Box regelt das (Fangnetz)"]}),i.action_needed&&i.action_text&&x.jsx("div",{className:"mt-0.5 text-[11px] text-foreground/90",children:i.action_text})]})]}),(i==null?void 0:i.summary)&&x.jsxs("div",{className:"rounded-lg border border-primary/25 bg-primary/5 p-3 space-y-1",children:[x.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-primary",children:"Was dieses Update bedeutet (Zusammenfassung der Box)"}),x.jsx("pre",{className:"whitespace-pre-wrap text-[11px] leading-relaxed text-foreground/90 font-sans",children:i.summary})]}),e.kind==="os"?x.jsxs(x.Fragment,{children:[((i==null?void 0:i.count)??0)===0?x.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"text-muted-foreground",children:[i.count," Paket(e) werden aktualisiert:"]}),x.jsx("div",{className:"space-y-1",children:i.packages.map(h=>x.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[x.jsx($1,{className:"h-3 w-3 text-cyan-400 shrink-0"}),h.name]}),x.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[x.jsx("span",{children:h.current}),x.jsx(D1,{className:"h-3 w-3"}),x.jsx("span",{className:"text-emerald-400",children:h.candidate})]})]},h.name))})]}),(((d=i==null?void 0:i.held_back)==null?void 0:d.length)??0)>0&&x.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border/40 bg-background/20 p-3",children:[x.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground",children:[x.jsx(ZM,{className:"h-3.5 w-3.5"})," Vom Hersteller zurückgestellt — kein Handeln nötig"]}),x.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Pakete gäbe es bereits, Ubuntu spielt sie aber gestaffelt aus (Phasen-Rollout) bzw. hält sie kurz zurück. Sie kommen bei einem der nächsten automatischen Läufe von selbst — das ist kein Fehler und nichts hängt fest."}),x.jsx("div",{className:"space-y-1",children:i.held_back.map(h=>x.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/30 bg-background/30 px-2.5 py-1.5",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[x.jsx($1,{className:"h-3 w-3 text-muted-foreground shrink-0"}),h.name]}),x.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:h.reason==="phasing"?"Phasen-Rollout":"vorerst zurückgehalten"})]},h.name))})]})]}):e.kind==="engine"||e.kind==="swap"?x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[x.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(i==null?void 0:i.installed_build)??"?"]}),x.jsx(D1,{className:"h-3.5 w-3.5 text-muted-foreground"}),x.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(i==null?void 0:i.latest_build)??"?"]})]}),((i==null?void 0:i.name)||(i==null?void 0:i.latest_tag))&&x.jsxs("div",{className:"text-muted-foreground",children:["Release: ",x.jsx("span",{className:"text-foreground",children:i==null?void 0:i.name}),i!=null&&i.latest_tag?` (${i.latest_tag})`:""]}),(i==null?void 0:i.url)&&x.jsxs("a",{href:i.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Original-Release-Notes auf GitHub ",x.jsx(rT,{className:"h-3 w-3"})]}),(i==null?void 0:i.body)&&x.jsxs("details",{className:"group",children:[x.jsx("summary",{className:"cursor-pointer text-[10px] text-muted-foreground hover:text-foreground",children:"Original-Notizen (englisch) anzeigen"}),x.jsx("pre",{className:"mt-1.5 whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:i.body})]})]}):(((f=i==null?void 0:i.commits)==null?void 0:f.length)??0)===0?x.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"text-muted-foreground",children:[i.behind," neue Commit(s) auf ",x.jsxs("span",{className:"font-mono text-foreground",children:["origin/",i.branch]}),":"]}),x.jsx("div",{className:"space-y-1",children:i.commits.map(h=>x.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[x.jsx(aT,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),x.jsxs("div",{className:"min-w-0",children:[x.jsx("div",{className:"text-[11px] truncate",children:h.subject}),x.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[h.hash," · ",h.when]})]})]},h.hash))})]}),e.kind!=="os"&&!u&&x.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border/40 bg-background/20 p-2.5",children:[x.jsx(gT,{className:"h-3.5 w-3.5 text-emerald-400 shrink-0 mt-0.5"}),x.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Vor dem Update sichert die Box automatisch den alten Stand. Danach prüft sie den ganzen Stack per echter Anfrage — läuft etwas nicht, rollt sie von selbst zurück",e.kind==="hermes"?" und startet den Gateway neu":"","."]})]})]})}),x.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[x.jsx("button",{onClick:r,className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),x.jsx("button",{onClick:n,disabled:e.loading||u||!!t,title:t?`Update läuft bereits: ${t.label}`:void 0,className:"h-9 flex-1 rounded-lg bg-primary text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-40 disabled:cursor-default",children:t?"Update läuft…":"Jetzt aktualisieren"})]})]})]})}function E3({open:e,onClose:t,defaultTab:r="maintenance"}){var Bl,Ul;const[n,i]=g.useState(null),[o,s]=g.useState([]),[u,d]=g.useState("llama-swap"),[f,h]=g.useState(""),[m,v]=g.useState(!1),[b,k]=g.useState(null),[S,E]=g.useState({}),[P,C]=g.useState("maintenance"),[_,O]=g.useState(!1),[N,j]=g.useState(""),[D,B]=g.useState(!1),[F,z]=g.useState(null),[G,U]=g.useState([]),[ue,ae]=g.useState(!1),[ye,pe]=g.useState(null),[se,Y]=g.useState(null);function Q(H,Ne,Ze){Y({type:"alert",title:H,message:Ne,onConfirm:()=>{Y(null),Ze&&Ze()}})}function Z(H,Ne,Ze){Y({type:"confirm",title:H,message:Ne,onConfirm:()=>{Y(null),Ze()},onCancel:()=>Y(null)})}function $(H){return H?new Date(H*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}g.useEffect(()=>{e&&r&&C(r)},[e,r]);function M(){Me("/api/maintenance/updates").then(i).catch(H=>console.error("Error loading updates",H))}function X(){Me("/api/jobs").then(H=>s(H.jobs||[])).catch(H=>console.error("Error loading jobs",H))}function le(){Me("/api/system/services").then(z).catch(()=>{})}function re(){Me("/api/system/backups").then(H=>U(H.backups||[])).catch(()=>{})}function ce(H){v(!0),k(null),Me(`/api/maintenance/logs?service=${H}&lines=150`).then(Ne=>{Ne.ok?h(Ne.text):(h(`Fehler beim Laden der Logs: ${Ne.err||"Unbekannter Fehler"}`),(Ne.status==="incorrect_password"||Ne.status==="password_required")&&k(Ne.status))}).catch(Ne=>h(`Fehler: ${Ne.message}`)).finally(()=>v(!1))}g.useEffect(()=>{if(!e)return;M(),X(),le(),re();const H=setInterval(()=>{X(),M(),le()},3e3);return()=>clearInterval(H)},[e]),g.useEffect(()=>{!e||P!=="logs"||ce(u)},[e,P,u]);function he(H){return(H==null?void 0:H.status)==="busy"?(Q("Update läuft bereits",`Es läuft gerade „${H.running}". Bitte warte, bis es fertig ist.`),X(),!0):!1}function Pe(H){return(H==null?void 0:H.status)==="password_required"||(H==null?void 0:H.status)==="incorrect_password"?(Q("Box-Passwort nötig",(H.status==="incorrect_password"?"Das gespeicherte Box-Passwort stimmt nicht. ":"Für dieses Update braucht die Box dein Passwort. ")+"Bitte oben im Reiter „Einstellungen“ setzen bzw. korrigieren."),!0):H&&H.ok===!1?(Q("Update fehlgeschlagen",H.err||"Unbekannter Fehler."),!0):!1}async function J(){try{const H=await Me("/api/maintenance/os-update",{method:"POST"});if(he(H)||Pe(H))return;X(),C("maintenance")}catch(H){Q("Fehler",`Fehler beim Starten des OS-Updates: ${H.message}`)}}async function we(){try{const H=await Me("/api/maintenance/engine-update",{method:"POST"});if(he(H)||Pe(H))return;X(),C("maintenance")}catch(H){Q("Fehler",`Fehler beim Engine-Update: ${H.message}`)}}async function Oe(){try{const H=await Me("/api/maintenance/swap-update",{method:"POST"});if(he(H)||Pe(H))return;X(),C("maintenance")}catch(H){Q("Fehler",`Fehler beim Router-Update: ${H.message}`)}}async function ne(){ae(!0);try{const H=await Me("/api/maintenance/hermes-update",{method:"POST"});if(he(H))return;X()}catch(H){Q("Fehler",`Hermes-Update fehlgeschlagen: ${H.message}`)}finally{ae(!1)}}async function Ge(H){pe({kind:H,loading:!0,data:null});try{const Ne=await Me(`/api/maintenance/update-details?kind=${H}`);pe({kind:H,loading:!1,data:Ne})}catch(Ne){pe({kind:H,loading:!1,data:{kind:H,error:Ne.message}})}}function Be(){const H=ye==null?void 0:ye.kind;pe(null),H==="os"?J():H==="engine"?we():H==="swap"?Oe():H==="hermes"&&ne()}function Ae(){var Ne;const H=[n!=null&&n.engine?"Engine":null,n!=null&&n.swap?"Router":null,(Ne=n==null?void 0:n.components)!=null&&Ne.some(Ze=>Ze.update===!0)?"Hermes-Agent":null,n!=null&&n.os?`OS (${n.os} Pakete)`:null].filter(Boolean);Z("Alle Updates einspielen?",`Nacheinander in einem Job: ${H.join(" → ")}. Jeder Schritt sichert und prüft sich selbst; schlägt einer fehl, stoppt der Rest. (OS braucht das Box-Passwort aus den Einstellungen — fehlt es, wird OS übersprungen.)`,async()=>{try{const Ze=await Me("/api/maintenance/update-all",{method:"POST"});if(he(Ze)||Pe(Ze))return;if((Ze==null?void 0:Ze.status)==="nothing"){Q("Nichts zu tun","Es stehen keine Updates aus.");return}X(),C("maintenance")}catch(Ze){Q("Fehler",`„Alle aktualisieren" konnte nicht starten: ${Ze.message}`)}})}async function Pt(){O(!0);try{await Me("/api/maintenance/check-updates",{method:"POST"}),X(),C("maintenance")}catch(H){Q("Fehler",`Fehler bei der Update-Suche: ${H.message}`)}finally{O(!1)}}async function gr(H,Ne){try{await Me("/api/models/install",{method:"POST",body:JSON.stringify({repo:H,role:Ne})}),Q("Gestartet",`Modell-Upgrade für '${Ne}' (${H}) gestartet.`),X(),C("maintenance")}catch(Ze){Q("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Ze.message}`)}}async function aa(){Z("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await Me("/api/maintenance/reboot",{method:"POST"}),Q("Reboot","Reboot ausgelöst. System startet neu...",()=>{t()})}catch(H){Q("Fehler",`Fehler beim Reboot: ${H.message}`)}})}async function zl(){B(!0),j("Snapshot wird erzeugt...");try{const H=await Me("/api/system/backup",{method:"POST"});j(H.ok?`Snapshot erzeugt: ${H.snapshot} (${H.files.length} Komponenten)`:"Backup fehlgeschlagen."),re()}catch(H){j(`Fehler: ${H.message}`)}finally{B(!1)}}async function hi(H){E(Ne=>({...Ne,[H]:!0}));try{const Ne=await Me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:H})});Ne.ok?Q("Dienst neu gestartet",`Dienst ${H} wurde erfolgreich neu gestartet.`,()=>{P==="logs"&&u===H&&ce(H)}):Q("Fehler",`Fehler beim Neustart: ${Ne.err||"Unbekannter Fehler"}`)}catch(Ne){Q("Fehler",`Fehler beim Neustart: ${Ne.message}`)}finally{E(Ne=>({...Ne,[H]:!1}))}}async function pi(H){try{await Me(`/api/jobs/${H}/cancel`,{method:"POST"}),X()}catch(Ne){Q("Fehler",`Fehler beim Abbrechen: ${Ne.message}`)}}const Tn=o.find(H=>(H.state==="running"||H.state==="queued")&&H.group==="maintenance"),Fl=(n?(n.os>0?1:0)+(n.engine?1:0)+(n.swap?1:0):0)+(((Bl=n==null?void 0:n.components)==null?void 0:Bl.filter(H=>H.update===!0).length)??0);return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:De("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:t}),x.jsxs("div",{className:De("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",e?"translate-x-0":"translate-x-full"),children:[x.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(RP,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),x.jsx("button",{onClick:t,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:x.jsx(Pu,{className:"h-4 w-4"})})]}),x.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[x.jsx("button",{onClick:()=>C("maintenance"),className:De("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",P==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),x.jsx("button",{onClick:()=>C("logs"),className:De("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",P==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),x.jsx("button",{onClick:()=>C("settings"),className:De("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",P==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),x.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[P==="maintenance"&&x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"space-y-2.5",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),x.jsxs("div",{className:"flex items-center gap-3",children:[Fl>0&&x.jsxs("button",{onClick:Ae,disabled:!!Tn,className:"flex items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-2 py-1 text-[10px] font-bold text-primary transition-colors hover:bg-primary/20 disabled:opacity-50",children:[x.jsx(JM,{className:"h-3 w-3"})," Alle aktualisieren (",Fl,")"]}),x.jsxs("button",{onClick:Pt,disabled:_||!!Tn,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[x.jsx(Go,{className:De("h-3 w-3",_&&"animate-spin")})," Nach Updates suchen"]})]})]}),(n==null?void 0:n.last_check)&&x.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",$(n.last_check)]}),Tn&&x.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300",children:[x.jsx(Go,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),x.jsxs("span",{children:["Update läuft: ",x.jsx("span",{className:"font-semibold",children:Tn.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),x.jsxs("div",{className:"space-y-1.5",children:[x.jsx(Is,{icon:Wy,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(n!=null&&n.os),status:n!=null&&n.os?`${n.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("os")}),x.jsx(Is,{icon:Uy,iconClass:"text-violet-400",name:"Inferenz-Engine (llama.cpp)",available:!!(n!=null&&n.engine),status:n!=null&&n.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("engine")}),x.jsx(Is,{icon:LP,iconClass:"text-fuchsia-400",name:"Router (llama-swap)",available:!!(n!=null&&n.swap),status:n!=null&&n.swap?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("swap")}),(()=>{var Ne;const H=(Ne=n==null?void 0:n.components)==null?void 0:Ne.find(Ze=>Ze.key==="hermes_agent");return x.jsx(Is,{icon:Nf,iconClass:"text-amber-400",name:"Hermes-Agent",available:(H==null?void 0:H.update)===!0,busy:ue,status:(H==null?void 0:H.update)===!0?`Update: ${H.latest}`:(H==null?void 0:H.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("hermes")})})(),(Ul=n==null?void 0:n.model_list)==null?void 0:Ul.map(H=>x.jsx(Is,{icon:KM,iconClass:"text-emerald-400",name:`Modell · ${H.role}`,available:!0,status:H.title,actionLabel:"Upgrade",onAction:()=>gr(H.repo,H.role)},H.role))]})]}),x.jsxs("div",{className:"space-y-2.5",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),x.jsx("div",{className:"space-y-1.5",children:ow.map(H=>{var Ne;return x.jsx(v3,{label:H.label,system:H.type==="system",ok:(Ne=F==null?void 0:F.services.find(Ze=>Ze.name.toLowerCase().includes(H.reach)))==null?void 0:Ne.ok,busy:S[H.id],onRestart:()=>hi(H.id),onLogs:()=>{d(H.id),C("logs")}},H.id)})})]}),x.jsxs("div",{className:"space-y-2.5",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),x.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("div",{className:"text-xs text-foreground truncate",children:G[0]?`Letztes: ${G[0].snapshot}`:"Noch kein Backup"}),x.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[G.length," Snapshots · Restore per CLI (restore.sh)"]})]}),x.jsxs("button",{onClick:zl,disabled:D,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[x.jsx(VM,{className:De("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),N&&x.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:N})]}),x.jsxs("div",{className:"space-y-2.5",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),x.jsxs("button",{onClick:aa,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[x.jsx(mT,{className:"h-4.5 w-4.5"}),x.jsxs("div",{children:[x.jsx("div",{children:"Host-System neu starten"}),x.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),x.jsxs("div",{className:"space-y-3",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),x.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[o.filter(H=>H.state==="running"||H.state==="queued").length," Aktiv"]})]}),x.jsx("div",{className:"space-y-3",children:o.length===0?x.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."}):o.map(H=>{const Ne=H.state==="running"||H.state==="queued";return x.jsxs("div",{className:De("p-3 rounded-xl border transition-all duration-300",Ne?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[x.jsxs("div",{className:"flex items-start justify-between gap-3",children:[x.jsxs("div",{className:"space-y-1",children:[x.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Ne&&x.jsxs("span",{className:"flex h-2 w-2 relative",children:[x.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),x.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),H.label]}),x.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[x.jsxs("span",{children:["ID: ",H.id]}),x.jsx("span",{children:"•"}),x.jsx("span",{className:De(H.state==="done"&&"text-emerald-400",H.state==="failed"&&"text-red-400",H.state==="running"&&"text-primary",H.state==="queued"&&"text-amber-400",H.state==="canceled"&&"text-muted-foreground"),children:H.state})]})]}),Ne&&x.jsx("button",{onClick:()=>pi(H.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"})]}),H.state==="running"&&x.jsxs("div",{className:"mt-3 space-y-1",children:[x.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:x.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${H.progress??0}%`}})}),x.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[x.jsxs("span",{children:[H.progress??0,"%"]}),H.done_bytes!=null&&H.total_bytes!=null&&x.jsxs("span",{children:[Im(H.done_bytes)," / ",Im(H.total_bytes),H.rate_bps!=null&&` (${Im(H.rate_bps)}/s)`]}),H.eta_s!=null&&x.jsxs("span",{children:["ETA: ",H.eta_s,"s"]})]})]})]},H.id)})})]})]}),P==="logs"&&x.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("select",{value:u,onChange:H=>d(H.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:ow.map(H=>x.jsxs("option",{value:H.id,children:[H.label," (",H.type==="system"?"systemd-root":"user",")"]},H.id))}),x.jsxs("button",{onClick:()=>hi(u),disabled:S[u],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:[x.jsx(Go,{className:De("h-3.5 w-3.5",S[u]&&"animate-spin")}),"Restart"]})]}),x.jsx(w3,{service:u,text:f,loading:m,logStatus:b,onRefresh:()=>ce(u),onOpenSettings:()=>C("settings")})]}),P==="settings"&&x.jsx(S3,{open:e,showAlert:Q})]})]}),ye&&x.jsx(k3,{detail:ye,maintenanceJob:Tn,onClose:()=>pe(null),onApply:Be}),se&&x.jsx(AA,{type:se.type,title:se.title,message:se.message,onConfirm:se.onConfirm,onCancel:se.onCancel})]})}const Qe={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],groups:["groups"],routing:["routing"],routingPolicy:["routing-policy"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:e=>["drafts",e??""],connect:e=>["connect",e??""],connectHealth:["connect-health"],memory:(e,t)=>["memory",e??"",t??""],memoryGraph:["memory-graph"],voiceTrace:["voice-trace"],auftragsbuch:["auftragsbuch"],ideen:["ideen"],chronik:["chronik"],wissen:["wissen"],zeitmaschine:["zeitmaschine"],reminders:["reminders"]},vr={graph:3e3,schnell:8e3,normal:1e4,gemuetlich:3e4,traege:6e4},P3=(e=vr.schnell)=>ht({queryKey:Qe.auftragsbuch,queryFn:()=>Me("/api/auftragsbuch"),refetchInterval:e}),_Q=(e=vr.gemuetlich)=>ht({queryKey:Qe.ideen,queryFn:()=>Me("/api/ideen"),refetchInterval:e}),A3=(e=150,t=vr.gemuetlich)=>ht({queryKey:Qe.chronik,queryFn:()=>Me(`/api/chronik?limit=${e}`),refetchInterval:t,select:r=>r.items??[]}),NQ=()=>ht({queryKey:Qe.wissen,queryFn:()=>Me("/api/wissen")}),IQ=(e=vr.traege)=>ht({queryKey:Qe.zeitmaschine,queryFn:()=>Me("/api/zeitmaschine"),refetchInterval:e}),O3=(e=vr.traege)=>ht({queryKey:Qe.reminders,queryFn:()=>Me("/api/reminders"),refetchInterval:e,select:t=>t.items??[]}),C3=(e=12,t=vr.schnell)=>ht({queryKey:Qe.voiceTrace,queryFn:()=>Me(`/api/voice/trace?limit=${e}`),refetchInterval:t,select:r=>r.turns??[]}),MQ=(e=!0)=>ht({queryKey:Qe.memoryGraph,queryFn:()=>Me("/api/memory/graph"),enabled:e}),OA=()=>ht({queryKey:Qe.health,queryFn:()=>Me("/api/health"),refetchInterval:vr.normal}),Lf=(e=vr.graph)=>ht({queryKey:Qe.systemStatus,queryFn:()=>Me("/api/system/status"),refetchInterval:e}),CA=(e=vr.normal)=>ht({queryKey:Qe.services,queryFn:()=>Me("/api/system/services"),refetchInterval:e}),jA=(e=vr.schnell)=>ht({queryKey:Qe.models,queryFn:()=>Me("/api/models"),refetchInterval:e}),TQ=(e=vr.normal)=>ht({queryKey:Qe.groups,queryFn:()=>Me("/api/groups"),refetchInterval:e}),DQ=(e=3e3)=>ht({queryKey:Qe.jobs,queryFn:()=>Me("/api/jobs"),refetchInterval:e,select:t=>t.jobs??[]}),_A=(e=vr.graph)=>ht({queryKey:Qe.tokenStats,queryFn:()=>Me("/api/system/token-stats"),refetchInterval:e}),j3=(e=vr.normal)=>ht({queryKey:Qe.agentStatus,queryFn:()=>Me("/api/agent/status"),refetchInterval:e}),_3=(e=vr.traege)=>ht({queryKey:Qe.updates,queryFn:()=>Me("/api/maintenance/updates"),refetchInterval:e}),RQ=()=>ht({queryKey:Qe.discover,queryFn:()=>Me("/api/discover")}),$Q=e=>ht({queryKey:Qe.drafts(e),queryFn:()=>Me(`/api/models/drafts?target=${encodeURIComponent(e??"")}`),enabled:!!e}),LQ=e=>ht({queryKey:Qe.connect(e),queryFn:()=>Me(e?`/api/connect?${e}`:"/api/connect")}),N3=()=>ht({queryKey:Qe.connectHealth,queryFn:()=>Me("/api/connect/health"),refetchInterval:15e3}),I3=e=>ht({queryKey:Qe.memory(e==null?void 0:e.q,e==null?void 0:e.category),queryFn:()=>{const t=new URLSearchParams;return e!=null&&e.q&&t.set("q",e.q),e!=null&&e.category&&t.set("category",e.category),Me(`/api/memory?${t}`)},select:t=>e!=null&&e.limit?t.slice(0,e.limit):t});let Mv=[],Tv=[];const Dv=new Set,NA=()=>Dv.forEach(e=>e());function IA(e){return Dv.add(e),()=>{Dv.delete(e)}}function M3(e){Mv=[...Mv,e].slice(-40),NA()}function T3(e){Tv=[...Tv,e].slice(-40),NA()}const D3=()=>g.useSyncExternalStore(IA,()=>Mv),R3=()=>g.useSyncExternalStore(IA,()=>Tv);function $3(){const{data:e,dataUpdatedAt:t}=Lf(),{data:r,dataUpdatedAt:n}=_A(),i=g.useRef(null);g.useEffect(()=>{var o,s,u,d;e&&M3({t:Date.now(),cpu:((o=e.cpu)==null?void 0:o.percent)??0,ram:((s=e.ram)==null?void 0:s.percent)??0,gpu:((u=e.gpu)==null?void 0:u.busy_percent)??null,disk:((d=e.disk)==null?void 0:d.percent)??null})},[t]),g.useEffect(()=>{if(!r)return;const o=Date.now(),s=r.prompt_tokens,u=r.completion_tokens;if(i.current){const d=Math.max((o-i.current.t)/1e3,.001);T3({t:o,prompt:Math.max(0,(s-i.current.p)/d),completion:Math.max(0,(u-i.current.c)/d)})}i.current={p:s,c:u,t:o}},[n])}function L3(){var O,N,j,D,B,F;const{data:e}=OA(),{data:t}=CA(),{data:r}=jA(),{data:n}=Lf(),i=!!e&&!!t,o=z=>{var G;return(G=t==null?void 0:t.services.find(U=>U.name.toLowerCase().includes(z)))==null?void 0:G.ok},s=e==null?void 0:e.engine_reachable,u=(O=e==null?void 0:e.brain)==null?void 0:O.ready,d=((N=e==null?void 0:e.brain)==null?void 0:N.model)||((j=r==null?void 0:r.models.find(z=>z.role==="hermes"))==null?void 0:j.name)||"",f=[];f.push((()=>{const z={id:"brain",label:"Lucys Hirn",icon:zy,critical:!0};return i?s===!1?{...z,status:"down",detail:"Die Motor-Maschine (Engine) läuft nicht — Lucy kann gerade gar nicht denken.",repair:{kind:"restart",service:"llama-swap",label:"Motor neu starten",needsSudo:!0}}:u===!1?{...z,status:"down",detail:"Lucys Hirn ist gerade eingeschlafen — einmal aufwecken.",repair:d?{kind:"loadModel",model:d,label:"Hirn aufwecken"}:void 0}:{...z,status:"ok",detail:"Wach und ansprechbar."}:{...z,status:"loading",detail:"Wird geprüft …"}})()),f.push((()=>{const z={id:"vision",label:"Lucys Augen",icon:Av,critical:!1};if(!i||!r)return{...z,status:"loading",detail:"Wird geprüft …"};const G=r.models.find(ue=>ue.role==="vision");return G?(r.running??[]).includes(G.name)?{...z,status:"ok",detail:"Sieht gerade zu (geladen, solange Lucy sie nutzt)."}:{...z,status:"ok",detail:"Augen ruhen — sie laden von selbst, sobald Lucy startet oder ein Bild kommt.",repair:{kind:"loadModel",model:G.name,label:"Augen wecken"}}:{...z,status:"warn",detail:"Kein Augen-Modell eingerichtet — Lucy kann keine Bilder ansehen."}})()),f.push((()=>{const z={id:"memory",label:"Lucys Gedächtnis",icon:HM,critical:!0},G=o("mem0");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Merkt sich Neues und findet Altes wieder."}:{...z,status:"down",detail:"Lucy kann sich gerade nichts merken — das Gedächtnis antwortet nicht.",repair:{kind:"restart",service:"mem0-service",label:"Gedächtnis neu starten"}}})()),f.push((()=>{const z={id:"gateway",label:"Verbindung (Gateway)",icon:By,critical:!0},G=e?e.gateway_reachable:o("integriert");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Apps und IDEs können Lucy erreichen."}:{...z,status:"down",detail:"Die Verbindungs-Zentrale antwortet nicht — Apps erreichen Lucy nicht.",repair:{kind:"restart",service:"mission-control-2",label:"Zentrale neu starten"}}})()),f.push((()=>{const z={id:"agent",label:"Lucys Agent (Hermes)",icon:Nf,critical:!0},G=o("hermes-gateway");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Lucy ist bereit zu reden und zu handeln."}:{...z,status:"down",detail:"Lucys Agent ist offline — sie reagiert gerade nicht.",repair:{kind:"restart",service:"hermes-gateway",label:"Agent neu starten"}}})()),f.push((()=>{const z={id:"voice",label:"Lucys Stimme",icon:hT,critical:!1},G=o("voice");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Lucy kann hören und sprechen."}:{...z,status:"warn",detail:"Sprechen ist gerade aus — Tippen geht weiter normal.",repair:{kind:"restart",service:"voice-service",label:"Stimme neu starten"}}})());const h=((D=n==null?void 0:n.gpu)==null?void 0:D.gtt_total)||((B=n==null?void 0:n.gpu)==null?void 0:B.vram_total)||0,m=((F=n==null?void 0:n.gpu)==null?void 0:F.gtt_used)||0,v=h>0?Math.min(100,m/h*100):0,b=1024**3,k=h?v>=90?{status:"full",usedGb:m/b,totalGb:h/b,pct:v,text:"Speicher fast voll — Lucy könnte langsamer werden."}:v>=72?{status:"warn",usedGb:m/b,totalGb:h/b,pct:v,text:"Speicher gut gefüllt — noch okay."}:{status:"ok",usedGb:m/b,totalGb:h/b,pct:v,text:"Genug Speicher frei."}:{status:"unknown",usedGb:0,totalGb:0,pct:0,text:"Speicher-Auslastung unbekannt."},S=f.some(z=>z.status==="loading"),E=f.filter(z=>z.critical&&z.status==="down"),P=f.filter(z=>z.status==="warn"||!z.critical&&z.status==="down"),C=k.status==="full";return{verdict:S&&!E.length?"loading":E.length?"problem":P.length||C?"warn":"gut",checks:f,memory:k,problems:E,warns:P}}function MA(){const[e,t]=g.useState(null),r=g.useCallback(()=>t(null),[]),n=g.useCallback((u,d,f)=>{t({type:"alert",title:u,message:d,onConfirm:()=>{t(null),f==null||f()}})},[]),i=g.useCallback((u,d,f,h)=>{t({type:"confirm",title:u,message:d,onConfirm:()=>{t(null),f()},onCancel:()=>{t(null),h==null||h()}})},[]),o=g.useCallback((u,d,f,h,m,v)=>{t({type:"prompt",title:u,message:d,defaultValue:f,autoValue:v==null?void 0:v.autoValue,autoLabel:v==null?void 0:v.autoLabel,onConfirm:b=>{t(null),h(b)},onCancel:()=>{t(null),m==null||m()}})},[]),s=e?x.jsx(AA,{...e}):null;return{showAlert:n,showConfirm:i,showPrompt:o,close:r,dialogElement:s}}const z3={ok:"bg-emerald-500",warn:"bg-amber-500",alert:"bg-red-500",muted:"bg-muted-foreground/40",loading:"bg-muted-foreground/40 animate-pulse"},F3={ok:"hover:border-emerald-500/40",warn:"hover:border-amber-500/50",alert:"hover:border-red-500/50",muted:"hover:border-primary/40",loading:"hover:border-border/60"};function To({icon:e,title:t,value:r,unit:n,tone:i="muted",hint:o,onClick:s}){return x.jsxs("button",{onClick:s,className:De("group relative flex flex-col items-start mc-card p-5 text-left cursor-pointer",F3[i]),children:[x.jsxs("div",{className:"mb-4 flex w-full items-center justify-between",children:[x.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-border/40 bg-background/30 text-foreground/80 transition-colors group-hover:text-primary",children:x.jsx(e,{className:"h-5 w-5"})}),x.jsx("span",{className:De("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",z3[i]),title:o})]}),x.jsxs("div",{className:"flex items-baseline gap-1.5",children:[x.jsx("span",{className:"text-2xl font-bold tracking-tight text-foreground font-space tabular-nums",children:r}),n&&x.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n})]}),x.jsxs("div",{className:"mt-1 flex w-full items-center justify-between",children:[x.jsx("span",{className:"text-sm font-semibold text-foreground/90",children:t}),x.jsx(Js,{className:"h-4 w-4 text-muted-foreground/40 transition-all group-hover:translate-x-0.5 group-hover:text-primary"})]}),o&&x.jsx("span",{className:"mt-0.5 text-[11px] text-muted-foreground",children:o})]})}function B3(){var s;const{data:e=[]}=A3(150,6e4),[t,r]=g.useState(!1),n=e.find(u=>u.source==="chef-gutachter");if(!n)return null;const i=new Date(n.ts*1e3).toLocaleString("de-DE",{weekday:"long",day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}),o=(s=n.text.split(` +`).map(E=>({t:E,level:x3(E)})):[],[t]),v=g.useMemo(()=>m.filter(E=>E.level!=="info").length,[m]),b=d.trim().toLowerCase(),k=m.filter(E=>(!s||E.level!=="info")&&(!b||E.t.toLowerCase().includes(b))),S=n==="password_required"||n==="incorrect_password";return x.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:[x.jsxs("div",{className:"flex h-10 items-center justify-between gap-2 px-3 border-b border-border/40 bg-black/30 shrink-0",children:[x.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground shrink-0",children:[x.jsx(ST,{className:"h-3 w-3 text-primary"}),x.jsx("span",{className:"hidden sm:inline",children:"stdout/stderr —"})," ",e]}),x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsxs("div",{className:"relative",children:[x.jsx(yT,{className:"pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),x.jsx("input",{value:d,onChange:E=>f(E.target.value),placeholder:"filtern…",className:"h-7 w-24 sm:w-36 rounded-md border border-border/50 bg-background/40 pl-6 pr-2 text-[10px] text-foreground outline-none focus:border-primary/50"})]}),x.jsxs("button",{onClick:()=>u(E=>!E),title:"Nur Fehler und Warnungen zeigen",className:De("flex h-7 items-center gap-1 rounded-md border px-2 text-[10px] font-semibold transition-colors",s?"border-amber-500/50 bg-amber-500/15 text-amber-300":"border-border/50 bg-background/20 text-muted-foreground hover:text-foreground"),children:[x.jsx(eu,{className:"h-3 w-3"}),"Nur Probleme",v>0?` (${v})`:""]}),x.jsx("button",{onClick:i,disabled:r,title:"Neu laden",className:"flex h-7 w-7 items-center justify-center rounded-md border border-border/50 bg-background/20 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:x.jsx(Go,{className:De("h-3 w-3",r&&"animate-spin")})})]})]}),x.jsx("div",{ref:h,className:"flex-1 overflow-y-auto p-3 text-[10px] font-mono leading-relaxed scrollbar-thin select-text",children:S?x.jsxs("div",{className:"flex h-full flex-col items-center justify-center space-y-3 p-6 text-center",children:[x.jsx(eu,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),x.jsx("div",{className:"text-xs font-semibold text-amber-300",children:n==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),x.jsxs("p",{className:"max-w-xs text-[10px] leading-normal text-muted-foreground",children:["Für das Auslesen der systemd-Logs von ",e," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),x.jsx("button",{onClick:o,className:"mt-2 rounded-md bg-primary px-3 py-1.5 text-[10px] font-semibold text-primary-foreground transition-colors hover:bg-primary/95",children:"Sudo-Passwort eintragen"})]}):r&&!t?x.jsx("span",{className:"text-muted-foreground",children:"Lade Logs…"}):m.length===0?x.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."}):k.length===0?x.jsx("span",{className:"text-muted-foreground",children:s?"Keine Fehler oder Warnungen — der Dienst läuft sauber. ✓":"Kein Treffer für den Filter."}):k.map((E,P)=>x.jsx("div",{className:De("whitespace-pre-wrap",b3[E.level]),children:E.t||" "},P))})]})}function S3({open:e,showAlert:t}){const[r,n]=g.useState(""),[i,o]=g.useState(""),[s,u]=g.useState(!1),[d,f]=g.useState(!1);return g.useEffect(()=>{e&&(n(localStorage.getItem("mc_sudo_password")||""),o(localStorage.getItem("mc_hf_token")||""))},[e]),x.jsxs("div",{className:"space-y-6",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),x.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."})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[x.jsx(Wy,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),x.jsxs("div",{className:"relative",children:[x.jsx("input",{type:s?"text":"password",value:r,onChange:h=>n(h.target.value),"aria-label":"Host Sudo-Passwort",name:"sudo-password",autoComplete:"off",spellCheck:!1,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"}),x.jsx("button",{type:"button",onClick:()=>u(!s),"aria-label":s?"Passwort verbergen":"Passwort anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:s?x.jsx(R1,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(Av,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.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."})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[x.jsx(uT,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),x.jsxs("div",{className:"relative",children:[x.jsx("input",{type:d?"text":"password",value:i,onChange:h=>o(h.target.value),"aria-label":"HuggingFace API Token",name:"hf-token",autoComplete:"off",spellCheck:!1,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"}),x.jsx("button",{type:"button",onClick:()=>f(!d),"aria-label":d?"Token verbergen":"Token anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:d?x.jsx(R1,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(Av,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.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."})]}),x.jsxs("div",{className:"flex gap-3 pt-2",children:[x.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",r),localStorage.setItem("mc_hf_token",i),t("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"}),x.jsx("button",{onClick:()=>{n(""),o(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),t("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"})]})]})}function k3({detail:e,maintenanceJob:t,onClose:r,onApply:n}){var d,f;const i=e.data,o={os:{icon:Wy,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:Uy,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:LP,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:Nf,cls:"text-amber-400",title:"Hermes-Agent"}}[e.kind],s=o.icon,u=i?e.kind==="os"?(i.count??0)===0:e.kind==="hermes"?(i.behind??0)===0:i.installed_build!=null&&i.latest_build!=null&&i.latest_build<=i.installed_build:!0;return x.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[x.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:r}),x.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[x.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(s,{className:De("h-4.5 w-4.5",o.cls)}),x.jsx("h3",{className:"text-sm font-semibold",children:o.title})]}),x.jsx("button",{onClick:r,className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:x.jsx(Pu,{className:"h-4 w-4"})})]}),x.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:e.loading?x.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[x.jsx(Go,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):i!=null&&i.error?x.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:i.error}):x.jsxs(x.Fragment,{children:[(i==null?void 0:i.action_needed)!=null&&x.jsxs("div",{className:De("flex items-start gap-2 rounded-lg border p-3",i.action_needed?"border-amber-500/40 bg-amber-500/10":"border-emerald-500/40 bg-emerald-500/10"),children:[i.action_needed?x.jsx(eu,{className:"h-4 w-4 text-amber-400 shrink-0 mt-0.5"}):x.jsx(QM,{className:"h-4 w-4 text-emerald-400 shrink-0 mt-0.5"}),x.jsxs("div",{className:"min-w-0",children:[x.jsxs("div",{className:De("text-xs font-semibold",i.action_needed?"text-amber-300":"text-emerald-300"),children:["Musst du etwas tun? ",i.action_needed?"Ja":"Nein — die Box regelt das (Fangnetz)"]}),i.action_needed&&i.action_text&&x.jsx("div",{className:"mt-0.5 text-[11px] text-foreground/90",children:i.action_text})]})]}),(i==null?void 0:i.summary)&&x.jsxs("div",{className:"rounded-lg border border-primary/25 bg-primary/5 p-3 space-y-1",children:[x.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-primary",children:"Was dieses Update bedeutet (Zusammenfassung der Box)"}),x.jsx("pre",{className:"whitespace-pre-wrap text-[11px] leading-relaxed text-foreground/90 font-sans",children:i.summary})]}),e.kind==="os"?x.jsxs(x.Fragment,{children:[((i==null?void 0:i.count)??0)===0?x.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"text-muted-foreground",children:[i.count," Paket(e) werden aktualisiert:"]}),x.jsx("div",{className:"space-y-1",children:i.packages.map(h=>x.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[x.jsx($1,{className:"h-3 w-3 text-cyan-400 shrink-0"}),h.name]}),x.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[x.jsx("span",{children:h.current}),x.jsx(D1,{className:"h-3 w-3"}),x.jsx("span",{className:"text-emerald-400",children:h.candidate})]})]},h.name))})]}),(((d=i==null?void 0:i.held_back)==null?void 0:d.length)??0)>0&&x.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border/40 bg-background/20 p-3",children:[x.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground",children:[x.jsx(ZM,{className:"h-3.5 w-3.5"})," Vom Hersteller zurückgestellt — kein Handeln nötig"]}),x.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Pakete gäbe es bereits, Ubuntu spielt sie aber gestaffelt aus (Phasen-Rollout) bzw. hält sie kurz zurück. Sie kommen bei einem der nächsten automatischen Läufe von selbst — das ist kein Fehler und nichts hängt fest."}),x.jsx("div",{className:"space-y-1",children:i.held_back.map(h=>x.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/30 bg-background/30 px-2.5 py-1.5",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[x.jsx($1,{className:"h-3 w-3 text-muted-foreground shrink-0"}),h.name]}),x.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:h.reason==="phasing"?"Phasen-Rollout":"vorerst zurückgehalten"})]},h.name))})]})]}):e.kind==="engine"||e.kind==="swap"?x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[x.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(i==null?void 0:i.installed_build)??"?"]}),x.jsx(D1,{className:"h-3.5 w-3.5 text-muted-foreground"}),x.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(i==null?void 0:i.latest_build)??"?"]})]}),((i==null?void 0:i.name)||(i==null?void 0:i.latest_tag))&&x.jsxs("div",{className:"text-muted-foreground",children:["Release: ",x.jsx("span",{className:"text-foreground",children:i==null?void 0:i.name}),i!=null&&i.latest_tag?` (${i.latest_tag})`:""]}),(i==null?void 0:i.url)&&x.jsxs("a",{href:i.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Original-Release-Notes auf GitHub ",x.jsx(rT,{className:"h-3 w-3"})]}),(i==null?void 0:i.body)&&x.jsxs("details",{className:"group",children:[x.jsx("summary",{className:"cursor-pointer text-[10px] text-muted-foreground hover:text-foreground",children:"Original-Notizen (englisch) anzeigen"}),x.jsx("pre",{className:"mt-1.5 whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:i.body})]})]}):(((f=i==null?void 0:i.commits)==null?void 0:f.length)??0)===0?x.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"text-muted-foreground",children:[i.behind," neue Commit(s) auf ",x.jsxs("span",{className:"font-mono text-foreground",children:["origin/",i.branch]}),":"]}),x.jsx("div",{className:"space-y-1",children:i.commits.map(h=>x.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[x.jsx(aT,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),x.jsxs("div",{className:"min-w-0",children:[x.jsx("div",{className:"text-[11px] truncate",children:h.subject}),x.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[h.hash," · ",h.when]})]})]},h.hash))})]}),e.kind!=="os"&&!u&&x.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border/40 bg-background/20 p-2.5",children:[x.jsx(gT,{className:"h-3.5 w-3.5 text-emerald-400 shrink-0 mt-0.5"}),x.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Vor dem Update sichert die Box automatisch den alten Stand. Danach prüft sie den ganzen Stack per echter Anfrage — läuft etwas nicht, rollt sie von selbst zurück",e.kind==="hermes"?" und startet den Gateway neu":"","."]})]})]})}),x.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[x.jsx("button",{onClick:r,className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),x.jsx("button",{onClick:n,disabled:e.loading||u||!!t,title:t?`Update läuft bereits: ${t.label}`:void 0,className:"h-9 flex-1 rounded-lg bg-primary text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-40 disabled:cursor-default",children:t?"Update läuft…":"Jetzt aktualisieren"})]})]})]})}function E3({open:e,onClose:t,defaultTab:r="maintenance"}){var Bl,Ul;const[n,i]=g.useState(null),[o,s]=g.useState([]),[u,d]=g.useState("llama-swap"),[f,h]=g.useState(""),[m,v]=g.useState(!1),[b,k]=g.useState(null),[S,E]=g.useState({}),[P,C]=g.useState("maintenance"),[_,O]=g.useState(!1),[N,j]=g.useState(""),[D,B]=g.useState(!1),[F,z]=g.useState(null),[G,U]=g.useState([]),[ue,ae]=g.useState(!1),[ye,pe]=g.useState(null),[se,Y]=g.useState(null);function Q(H,Ne,Ze){Y({type:"alert",title:H,message:Ne,onConfirm:()=>{Y(null),Ze&&Ze()}})}function Z(H,Ne,Ze){Y({type:"confirm",title:H,message:Ne,onConfirm:()=>{Y(null),Ze()},onCancel:()=>Y(null)})}function $(H){return H?new Date(H*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}g.useEffect(()=>{e&&r&&C(r)},[e,r]);function M(){Me("/api/maintenance/updates").then(i).catch(H=>console.error("Error loading updates",H))}function X(){Me("/api/jobs").then(H=>s(H.jobs||[])).catch(H=>console.error("Error loading jobs",H))}function le(){Me("/api/system/services").then(z).catch(()=>{})}function re(){Me("/api/system/backups").then(H=>U(H.backups||[])).catch(()=>{})}function ce(H){v(!0),k(null),Me(`/api/maintenance/logs?service=${H}&lines=150`).then(Ne=>{Ne.ok?h(Ne.text):(h(`Fehler beim Laden der Logs: ${Ne.err||"Unbekannter Fehler"}`),(Ne.status==="incorrect_password"||Ne.status==="password_required")&&k(Ne.status))}).catch(Ne=>h(`Fehler: ${Ne.message}`)).finally(()=>v(!1))}g.useEffect(()=>{if(!e)return;M(),X(),le(),re();const H=setInterval(()=>{X(),M(),le()},3e3);return()=>clearInterval(H)},[e]),g.useEffect(()=>{!e||P!=="logs"||ce(u)},[e,P,u]);function he(H){return(H==null?void 0:H.status)==="busy"?(Q("Update läuft bereits",`Es läuft gerade „${H.running}". Bitte warte, bis es fertig ist.`),X(),!0):!1}function Pe(H){return(H==null?void 0:H.status)==="password_required"||(H==null?void 0:H.status)==="incorrect_password"?(Q("Box-Passwort nötig",(H.status==="incorrect_password"?"Das gespeicherte Box-Passwort stimmt nicht. ":"Für dieses Update braucht die Box dein Passwort. ")+"Bitte oben im Reiter „Einstellungen“ setzen bzw. korrigieren."),!0):H&&H.ok===!1?(Q("Update fehlgeschlagen",H.err||"Unbekannter Fehler."),!0):!1}async function J(){try{const H=await Me("/api/maintenance/os-update",{method:"POST"});if(he(H)||Pe(H))return;X(),C("maintenance")}catch(H){Q("Fehler",`Fehler beim Starten des OS-Updates: ${H.message}`)}}async function we(){try{const H=await Me("/api/maintenance/engine-update",{method:"POST"});if(he(H)||Pe(H))return;X(),C("maintenance")}catch(H){Q("Fehler",`Fehler beim Engine-Update: ${H.message}`)}}async function Oe(){try{const H=await Me("/api/maintenance/swap-update",{method:"POST"});if(he(H)||Pe(H))return;X(),C("maintenance")}catch(H){Q("Fehler",`Fehler beim Router-Update: ${H.message}`)}}async function ne(){ae(!0);try{const H=await Me("/api/maintenance/hermes-update",{method:"POST"});if(he(H))return;X()}catch(H){Q("Fehler",`Hermes-Update fehlgeschlagen: ${H.message}`)}finally{ae(!1)}}async function Ge(H){pe({kind:H,loading:!0,data:null});try{const Ne=await Me(`/api/maintenance/update-details?kind=${H}`);pe({kind:H,loading:!1,data:Ne})}catch(Ne){pe({kind:H,loading:!1,data:{kind:H,error:Ne.message}})}}function Be(){const H=ye==null?void 0:ye.kind;pe(null),H==="os"?J():H==="engine"?we():H==="swap"?Oe():H==="hermes"&&ne()}function Ae(){var Ne;const H=[n!=null&&n.engine?"Engine":null,n!=null&&n.swap?"Router":null,(Ne=n==null?void 0:n.components)!=null&&Ne.some(Ze=>Ze.update===!0)?"Hermes-Agent":null,n!=null&&n.os?`OS (${n.os} Pakete)`:null].filter(Boolean);Z("Alle Updates einspielen?",`Nacheinander in einem Job: ${H.join(" → ")}. Jeder Schritt sichert und prüft sich selbst; schlägt einer fehl, stoppt der Rest. (OS braucht das Box-Passwort aus den Einstellungen — fehlt es, wird OS übersprungen.)`,async()=>{try{const Ze=await Me("/api/maintenance/update-all",{method:"POST"});if(he(Ze)||Pe(Ze))return;if((Ze==null?void 0:Ze.status)==="nothing"){Q("Nichts zu tun","Es stehen keine Updates aus.");return}X(),C("maintenance")}catch(Ze){Q("Fehler",`„Alle aktualisieren" konnte nicht starten: ${Ze.message}`)}})}async function Pt(){O(!0);try{await Me("/api/maintenance/check-updates",{method:"POST"}),X(),C("maintenance")}catch(H){Q("Fehler",`Fehler bei der Update-Suche: ${H.message}`)}finally{O(!1)}}async function gr(H,Ne){try{await Me("/api/models/install",{method:"POST",body:JSON.stringify({repo:H,role:Ne})}),Q("Gestartet",`Modell-Upgrade für '${Ne}' (${H}) gestartet.`),X(),C("maintenance")}catch(Ze){Q("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Ze.message}`)}}async function aa(){Z("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await Me("/api/maintenance/reboot",{method:"POST"}),Q("Reboot","Reboot ausgelöst. System startet neu...",()=>{t()})}catch(H){Q("Fehler",`Fehler beim Reboot: ${H.message}`)}})}async function zl(){B(!0),j("Snapshot wird erzeugt...");try{const H=await Me("/api/system/backup",{method:"POST"});j(H.ok?`Snapshot erzeugt: ${H.snapshot} (${H.files.length} Komponenten)`:"Backup fehlgeschlagen."),re()}catch(H){j(`Fehler: ${H.message}`)}finally{B(!1)}}async function hi(H){E(Ne=>({...Ne,[H]:!0}));try{const Ne=await Me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:H})});Ne.ok?Q("Dienst neu gestartet",`Dienst ${H} wurde erfolgreich neu gestartet.`,()=>{P==="logs"&&u===H&&ce(H)}):Q("Fehler",`Fehler beim Neustart: ${Ne.err||"Unbekannter Fehler"}`)}catch(Ne){Q("Fehler",`Fehler beim Neustart: ${Ne.message}`)}finally{E(Ne=>({...Ne,[H]:!1}))}}async function pi(H){try{await Me(`/api/jobs/${H}/cancel`,{method:"POST"}),X()}catch(Ne){Q("Fehler",`Fehler beim Abbrechen: ${Ne.message}`)}}const Tn=o.find(H=>(H.state==="running"||H.state==="queued")&&H.group==="maintenance"),Fl=(n?(n.os>0?1:0)+(n.engine?1:0)+(n.swap?1:0):0)+(((Bl=n==null?void 0:n.components)==null?void 0:Bl.filter(H=>H.update===!0).length)??0);return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:De("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:t}),x.jsxs("div",{className:De("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",e?"translate-x-0":"translate-x-full"),children:[x.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(RP,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),x.jsx("button",{onClick:t,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:x.jsx(Pu,{className:"h-4 w-4"})})]}),x.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[x.jsx("button",{onClick:()=>C("maintenance"),className:De("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",P==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),x.jsx("button",{onClick:()=>C("logs"),className:De("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",P==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),x.jsx("button",{onClick:()=>C("settings"),className:De("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",P==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),x.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[P==="maintenance"&&x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"space-y-2.5",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),x.jsxs("div",{className:"flex items-center gap-3",children:[Fl>0&&x.jsxs("button",{onClick:Ae,disabled:!!Tn,className:"flex items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-2 py-1 text-[10px] font-bold text-primary transition-colors hover:bg-primary/20 disabled:opacity-50",children:[x.jsx(JM,{className:"h-3 w-3"})," Alle aktualisieren (",Fl,")"]}),x.jsxs("button",{onClick:Pt,disabled:_||!!Tn,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[x.jsx(Go,{className:De("h-3 w-3",_&&"animate-spin")})," Nach Updates suchen"]})]})]}),(n==null?void 0:n.last_check)&&x.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",$(n.last_check)]}),Tn&&x.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300",children:[x.jsx(Go,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),x.jsxs("span",{children:["Update läuft: ",x.jsx("span",{className:"font-semibold",children:Tn.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),x.jsxs("div",{className:"space-y-1.5",children:[x.jsx(Is,{icon:Wy,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(n!=null&&n.os),status:n!=null&&n.os?`${n.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("os")}),x.jsx(Is,{icon:Uy,iconClass:"text-violet-400",name:"Inferenz-Engine (llama.cpp)",available:!!(n!=null&&n.engine),status:n!=null&&n.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("engine")}),x.jsx(Is,{icon:LP,iconClass:"text-fuchsia-400",name:"Router (llama-swap)",available:!!(n!=null&&n.swap),status:n!=null&&n.swap?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("swap")}),(()=>{var Ne;const H=(Ne=n==null?void 0:n.components)==null?void 0:Ne.find(Ze=>Ze.key==="hermes_agent");return x.jsx(Is,{icon:Nf,iconClass:"text-amber-400",name:"Hermes-Agent",available:(H==null?void 0:H.update)===!0,busy:ue,status:(H==null?void 0:H.update)===!0?`Update: ${H.latest}`:(H==null?void 0:H.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>Ge("hermes")})})(),(Ul=n==null?void 0:n.model_list)==null?void 0:Ul.map(H=>x.jsx(Is,{icon:KM,iconClass:"text-emerald-400",name:`Modell · ${H.role}`,available:!0,status:H.title,actionLabel:"Upgrade",onAction:()=>gr(H.repo,H.role)},H.role))]})]}),x.jsxs("div",{className:"space-y-2.5",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),x.jsx("div",{className:"space-y-1.5",children:ow.map(H=>{var Ne;return x.jsx(v3,{label:H.label,system:H.type==="system",ok:(Ne=F==null?void 0:F.services.find(Ze=>Ze.name.toLowerCase().includes(H.reach)))==null?void 0:Ne.ok,busy:S[H.id],onRestart:()=>hi(H.id),onLogs:()=>{d(H.id),C("logs")}},H.id)})})]}),x.jsxs("div",{className:"space-y-2.5",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),x.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("div",{className:"text-xs text-foreground truncate",children:G[0]?`Letztes: ${G[0].snapshot}`:"Noch kein Backup"}),x.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[G.length," Snapshots · Restore per CLI (restore.sh)"]})]}),x.jsxs("button",{onClick:zl,disabled:D,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[x.jsx(VM,{className:De("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),N&&x.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:N})]}),x.jsxs("div",{className:"space-y-2.5",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),x.jsxs("button",{onClick:aa,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[x.jsx(mT,{className:"h-4.5 w-4.5"}),x.jsxs("div",{children:[x.jsx("div",{children:"Host-System neu starten"}),x.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),x.jsxs("div",{className:"space-y-3",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),x.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[o.filter(H=>H.state==="running"||H.state==="queued").length," Aktiv"]})]}),x.jsx("div",{className:"space-y-3",children:o.length===0?x.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."}):o.map(H=>{const Ne=H.state==="running"||H.state==="queued";return x.jsxs("div",{className:De("p-3 rounded-xl border transition-all duration-300",Ne?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[x.jsxs("div",{className:"flex items-start justify-between gap-3",children:[x.jsxs("div",{className:"space-y-1",children:[x.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Ne&&x.jsxs("span",{className:"flex h-2 w-2 relative",children:[x.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),x.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),H.label]}),x.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[x.jsxs("span",{children:["ID: ",H.id]}),x.jsx("span",{children:"•"}),x.jsx("span",{className:De(H.state==="done"&&"text-emerald-400",H.state==="failed"&&"text-red-400",H.state==="running"&&"text-primary",H.state==="queued"&&"text-amber-400",H.state==="canceled"&&"text-muted-foreground"),children:H.state})]})]}),Ne&&x.jsx("button",{onClick:()=>pi(H.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"})]}),H.state==="running"&&x.jsxs("div",{className:"mt-3 space-y-1",children:[x.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:x.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${H.progress??0}%`}})}),x.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[x.jsxs("span",{children:[H.progress??0,"%"]}),H.done_bytes!=null&&H.total_bytes!=null&&x.jsxs("span",{children:[Im(H.done_bytes)," / ",Im(H.total_bytes),H.rate_bps!=null&&` (${Im(H.rate_bps)}/s)`]}),H.eta_s!=null&&x.jsxs("span",{children:["ETA: ",H.eta_s,"s"]})]})]})]},H.id)})})]})]}),P==="logs"&&x.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("select",{value:u,onChange:H=>d(H.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:ow.map(H=>x.jsxs("option",{value:H.id,children:[H.label," (",H.type==="system"?"systemd-root":"user",")"]},H.id))}),x.jsxs("button",{onClick:()=>hi(u),disabled:S[u],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:[x.jsx(Go,{className:De("h-3.5 w-3.5",S[u]&&"animate-spin")}),"Restart"]})]}),x.jsx(w3,{service:u,text:f,loading:m,logStatus:b,onRefresh:()=>ce(u),onOpenSettings:()=>C("settings")})]}),P==="settings"&&x.jsx(S3,{open:e,showAlert:Q})]})]}),ye&&x.jsx(k3,{detail:ye,maintenanceJob:Tn,onClose:()=>pe(null),onApply:Be}),se&&x.jsx(AA,{type:se.type,title:se.title,message:se.message,onConfirm:se.onConfirm,onCancel:se.onCancel})]})}const Qe={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],groups:["groups"],routing:["routing"],routingPolicy:["routing-policy"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:e=>["drafts",e??""],connect:e=>["connect",e??""],connectHealth:["connect-health"],memory:(e,t)=>["memory",e??"",t??""],memoryGraph:["memory-graph"],voiceTrace:["voice-trace"],auftragsbuch:["auftragsbuch"],ideen:["ideen"],chronik:["chronik"],wissen:["wissen"],zeitmaschine:["zeitmaschine"],reminders:["reminders"]},vr={graph:3e3,schnell:8e3,normal:1e4,gemuetlich:3e4,traege:6e4},P3=(e=vr.schnell)=>ht({queryKey:Qe.auftragsbuch,queryFn:()=>Me("/api/auftragsbuch"),refetchInterval:e}),_Q=(e=vr.gemuetlich)=>ht({queryKey:Qe.ideen,queryFn:()=>Me("/api/ideen"),refetchInterval:e}),A3=(e=150,t=vr.gemuetlich)=>ht({queryKey:Qe.chronik,queryFn:()=>Me(`/api/chronik?limit=${e}`),refetchInterval:t,select:r=>r.items??[]}),NQ=()=>ht({queryKey:Qe.wissen,queryFn:()=>Me("/api/wissen")}),IQ=(e=vr.traege)=>ht({queryKey:Qe.zeitmaschine,queryFn:()=>Me("/api/zeitmaschine"),refetchInterval:e}),O3=(e=vr.traege)=>ht({queryKey:Qe.reminders,queryFn:()=>Me("/api/reminders"),refetchInterval:e,select:t=>t.items??[]}),C3=(e=12,t=vr.schnell)=>ht({queryKey:Qe.voiceTrace,queryFn:()=>Me(`/api/voice/trace?limit=${e}`),refetchInterval:t,select:r=>r.turns??[]}),MQ=(e=!0)=>ht({queryKey:Qe.memoryGraph,queryFn:()=>Me("/api/memory/graph"),enabled:e}),OA=()=>ht({queryKey:Qe.health,queryFn:()=>Me("/api/health"),refetchInterval:vr.normal}),Lf=(e=vr.graph)=>ht({queryKey:Qe.systemStatus,queryFn:()=>Me("/api/system/status"),refetchInterval:e}),CA=(e=vr.normal)=>ht({queryKey:Qe.services,queryFn:()=>Me("/api/system/services"),refetchInterval:e}),jA=(e=vr.schnell)=>ht({queryKey:Qe.models,queryFn:()=>Me("/api/models"),refetchInterval:e}),TQ=(e=vr.normal)=>ht({queryKey:Qe.groups,queryFn:()=>Me("/api/groups"),refetchInterval:e}),DQ=(e=3e3)=>ht({queryKey:Qe.jobs,queryFn:()=>Me("/api/jobs"),refetchInterval:e,select:t=>t.jobs??[]}),_A=(e=vr.graph)=>ht({queryKey:Qe.tokenStats,queryFn:()=>Me("/api/system/token-stats"),refetchInterval:e}),j3=(e=vr.normal)=>ht({queryKey:Qe.agentStatus,queryFn:()=>Me("/api/agent/status"),refetchInterval:e}),_3=(e=vr.traege)=>ht({queryKey:Qe.updates,queryFn:()=>Me("/api/maintenance/updates"),refetchInterval:e}),RQ=()=>ht({queryKey:Qe.discover,queryFn:()=>Me("/api/discover")}),$Q=e=>ht({queryKey:Qe.drafts(e),queryFn:()=>Me(`/api/models/drafts?target=${encodeURIComponent(e??"")}`),enabled:!!e}),LQ=e=>ht({queryKey:Qe.connect(e),queryFn:()=>Me(e?`/api/connect?${e}`:"/api/connect")}),N3=()=>ht({queryKey:Qe.connectHealth,queryFn:()=>Me("/api/connect/health"),refetchInterval:15e3}),I3=e=>ht({queryKey:Qe.memory(e==null?void 0:e.q,e==null?void 0:e.category),queryFn:()=>{const t=new URLSearchParams;return e!=null&&e.q&&t.set("q",e.q),e!=null&&e.category&&t.set("category",e.category),Me(`/api/memory?${t}`)},select:t=>e!=null&&e.limit?t.slice(0,e.limit):t});let Mv=[],Tv=[];const Dv=new Set,NA=()=>Dv.forEach(e=>e());function IA(e){return Dv.add(e),()=>{Dv.delete(e)}}function M3(e){Mv=[...Mv,e].slice(-40),NA()}function T3(e){Tv=[...Tv,e].slice(-40),NA()}const D3=()=>g.useSyncExternalStore(IA,()=>Mv),R3=()=>g.useSyncExternalStore(IA,()=>Tv);function $3(){const{data:e,dataUpdatedAt:t}=Lf(),{data:r,dataUpdatedAt:n}=_A(),i=g.useRef(null);g.useEffect(()=>{var o,s,u,d;e&&M3({t:Date.now(),cpu:((o=e.cpu)==null?void 0:o.percent)??0,ram:((s=e.ram)==null?void 0:s.percent)??0,gpu:((u=e.gpu)==null?void 0:u.busy_percent)??null,disk:((d=e.disk)==null?void 0:d.percent)??null})},[t]),g.useEffect(()=>{if(!r)return;const o=Date.now(),s=r.prompt_tokens,u=r.completion_tokens;if(i.current){const d=Math.max((o-i.current.t)/1e3,.001);T3({t:o,prompt:Math.max(0,(s-i.current.p)/d),completion:Math.max(0,(u-i.current.c)/d)})}i.current={p:s,c:u,t:o}},[n])}function L3(){var O,N,j,D,B,F;const{data:e}=OA(),{data:t}=CA(),{data:r}=jA(),{data:n}=Lf(),i=!!e&&!!t,o=z=>{var G;return(G=t==null?void 0:t.services.find(U=>U.name.toLowerCase().includes(z)))==null?void 0:G.ok},s=e==null?void 0:e.engine_reachable,u=(O=e==null?void 0:e.brain)==null?void 0:O.ready,d=((N=e==null?void 0:e.brain)==null?void 0:N.model)||((j=r==null?void 0:r.models.find(z=>z.role==="hermes"))==null?void 0:j.name)||"",f=[];f.push((()=>{const z={id:"brain",label:"Lucys Hirn",icon:zy,critical:!0};return i?s===!1?{...z,status:"down",detail:"Die Motor-Maschine (Engine) läuft nicht — Lucy kann gerade gar nicht denken.",repair:{kind:"restart",service:"llama-swap",label:"Motor neu starten",needsSudo:!0}}:u===!1?{...z,status:"down",detail:"Lucys Hirn ist gerade eingeschlafen — einmal aufwecken.",repair:d?{kind:"loadModel",model:d,label:"Hirn aufwecken"}:void 0}:{...z,status:"ok",detail:"Wach und ansprechbar."}:{...z,status:"loading",detail:"Wird geprüft …"}})()),f.push((()=>{const z={id:"vision",label:"Lucys Augen",icon:Av,critical:!1};if(!i||!r)return{...z,status:"loading",detail:"Wird geprüft …"};const G=r.models.find(ue=>ue.role==="vision");return G?(r.running??[]).includes(G.name)?{...z,status:"ok",detail:"Sieht gerade zu (geladen, solange Lucy sie nutzt)."}:{...z,status:"ok",detail:"Augen ruhen — sie laden von selbst, sobald Lucy startet oder ein Bild kommt.",repair:{kind:"loadModel",model:G.name,label:"Augen wecken"}}:{...z,status:"warn",detail:"Kein Augen-Modell eingerichtet — Lucy kann keine Bilder ansehen."}})()),f.push((()=>{const z={id:"memory",label:"Lucys Gedächtnis",icon:HM,critical:!0},G=o("mem0");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Merkt sich Neues und findet Altes wieder."}:{...z,status:"down",detail:"Lucy kann sich gerade nichts merken — das Gedächtnis antwortet nicht.",repair:{kind:"restart",service:"mem0-service",label:"Gedächtnis neu starten"}}})()),f.push((()=>{const z={id:"gateway",label:"Verbindung (Gateway)",icon:By,critical:!0},G=e?e.gateway_reachable:o("integriert");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Apps und IDEs können Lucy erreichen."}:{...z,status:"down",detail:"Die Verbindungs-Zentrale antwortet nicht — Apps erreichen Lucy nicht.",repair:{kind:"restart",service:"mission-control-2",label:"Zentrale neu starten"}}})()),f.push((()=>{const z={id:"agent",label:"Lucys Agent (Hermes)",icon:Nf,critical:!0},G=o("hermes-gateway");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Lucy ist bereit zu reden und zu handeln."}:{...z,status:"down",detail:"Lucys Agent ist offline — sie reagiert gerade nicht.",repair:{kind:"restart",service:"hermes-gateway",label:"Agent neu starten"}}})()),f.push((()=>{const z={id:"voice",label:"Lucys Stimme",icon:hT,critical:!1},G=o("voice");return!i||G===void 0?{...z,status:"loading",detail:"Wird geprüft …"}:G?{...z,status:"ok",detail:"Lucy kann hören und sprechen."}:{...z,status:"warn",detail:"Sprechen ist gerade aus — Tippen geht weiter normal.",repair:{kind:"restart",service:"voice-service",label:"Stimme neu starten"}}})());const h=((D=n==null?void 0:n.ram)==null?void 0:D.total)??0,m=((B=n==null?void 0:n.ram)==null?void 0:B.used)??0,v=((F=n==null?void 0:n.ram)==null?void 0:F.percent)??(h>0?Math.min(100,m/h*100):0),b=1024**3,k=h?v>=93?{status:"full",usedGb:m/b,totalGb:h/b,pct:v,text:"Speicher fast voll — Lucy könnte langsamer werden."}:v>=85?{status:"warn",usedGb:m/b,totalGb:h/b,pct:v,text:"Speicher gut gefüllt — noch okay."}:{status:"ok",usedGb:m/b,totalGb:h/b,pct:v,text:"Genug Speicher frei."}:{status:"unknown",usedGb:0,totalGb:0,pct:0,text:"Speicher-Auslastung unbekannt."},S=f.some(z=>z.status==="loading"),E=f.filter(z=>z.critical&&z.status==="down"),P=f.filter(z=>z.status==="warn"||!z.critical&&z.status==="down"),C=k.status==="full";return{verdict:S&&!E.length?"loading":E.length?"problem":P.length||C?"warn":"gut",checks:f,memory:k,problems:E,warns:P}}function MA(){const[e,t]=g.useState(null),r=g.useCallback(()=>t(null),[]),n=g.useCallback((u,d,f)=>{t({type:"alert",title:u,message:d,onConfirm:()=>{t(null),f==null||f()}})},[]),i=g.useCallback((u,d,f,h)=>{t({type:"confirm",title:u,message:d,onConfirm:()=>{t(null),f()},onCancel:()=>{t(null),h==null||h()}})},[]),o=g.useCallback((u,d,f,h,m,v)=>{t({type:"prompt",title:u,message:d,defaultValue:f,autoValue:v==null?void 0:v.autoValue,autoLabel:v==null?void 0:v.autoLabel,onConfirm:b=>{t(null),h(b)},onCancel:()=>{t(null),m==null||m()}})},[]),s=e?x.jsx(AA,{...e}):null;return{showAlert:n,showConfirm:i,showPrompt:o,close:r,dialogElement:s}}const z3={ok:"bg-emerald-500",warn:"bg-amber-500",alert:"bg-red-500",muted:"bg-muted-foreground/40",loading:"bg-muted-foreground/40 animate-pulse"},F3={ok:"hover:border-emerald-500/40",warn:"hover:border-amber-500/50",alert:"hover:border-red-500/50",muted:"hover:border-primary/40",loading:"hover:border-border/60"};function To({icon:e,title:t,value:r,unit:n,tone:i="muted",hint:o,onClick:s}){return x.jsxs("button",{onClick:s,className:De("group relative flex flex-col items-start mc-card p-5 text-left cursor-pointer",F3[i]),children:[x.jsxs("div",{className:"mb-4 flex w-full items-center justify-between",children:[x.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-border/40 bg-background/30 text-foreground/80 transition-colors group-hover:text-primary",children:x.jsx(e,{className:"h-5 w-5"})}),x.jsx("span",{className:De("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",z3[i]),title:o})]}),x.jsxs("div",{className:"flex items-baseline gap-1.5",children:[x.jsx("span",{className:"text-2xl font-bold tracking-tight text-foreground font-space tabular-nums",children:r}),n&&x.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n})]}),x.jsxs("div",{className:"mt-1 flex w-full items-center justify-between",children:[x.jsx("span",{className:"text-sm font-semibold text-foreground/90",children:t}),x.jsx(Js,{className:"h-4 w-4 text-muted-foreground/40 transition-all group-hover:translate-x-0.5 group-hover:text-primary"})]}),o&&x.jsx("span",{className:"mt-0.5 text-[11px] text-muted-foreground",children:o})]})}function B3(){var s;const{data:e=[]}=A3(150,6e4),[t,r]=g.useState(!1),n=e.find(u=>u.source==="chef-gutachter");if(!n)return null;const i=new Date(n.ts*1e3).toLocaleString("de-DE",{weekday:"long",day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}),o=(s=n.text.split(` `).find(u=>u.trim().startsWith("VERDIKT:")))==null?void 0:s.replace(/^\s*VERDIKT:\s*/,"");return x.jsxs("div",{className:"rounded-2xl border border-violet-500/25 bg-violet-500/[0.05] p-4 shadow-lg shadow-black/15 backdrop-blur-md",children:[x.jsxs("button",{onClick:()=>r(u=>!u),className:"flex w-full items-center gap-3 text-left cursor-pointer",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-violet-500/30 bg-background/30 text-violet-300",children:x.jsx(pT,{className:"h-4.5 w-4.5"})}),x.jsxs("span",{className:"min-w-0 flex-1",children:[x.jsx("span",{className:"block text-sm font-bold text-foreground",children:"Morgenlage"}),x.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:o||n.subject||"Nächtliches Gutachten über die autonome Arbeit"})]}),x.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground/60",children:i}),t?x.jsx(GM,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):x.jsx(Js,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]}),t&&x.jsxs("div",{className:"mt-3 border-t border-violet-500/15 pt-3",children:[n.subject&&x.jsx("p",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-violet-300/80",children:n.subject}),x.jsx("p",{className:"whitespace-pre-wrap text-xs leading-relaxed text-foreground/85",children:n.text})]})]})}const lw={"":"einmalig",daily:"täglich",weekdays:"werktags",weekly:"wöchentlich"};function U3(){const{data:e=[],isLoading:t}=O3(),r=Ly(),{showAlert:n,showConfirm:i,dialogElement:o}=MA(),[s,u]=g.useState(!1),[d,f]=g.useState(""),[h,m]=g.useState(""),[v,b]=g.useState(""),[k,S]=g.useState(!1),E=()=>r.invalidateQueries({queryKey:Qe.reminders});async function P(){if(!(!d.trim()||!h)){S(!0);try{await Me("/api/reminders",{method:"POST",body:JSON.stringify({text:d,when:h,repeat:v})}),f(""),m(""),b(""),u(!1),E()}catch(O){n("Anlegen fehlgeschlagen",String((O==null?void 0:O.message)||O))}finally{S(!1)}}}function C(O,N){i("Erinnerung löschen?",`„${N}" wird entfernt.`,async()=>{try{await Me(`/api/reminders/${O}`,{method:"DELETE"}),E()}catch(j){n("Fehler",String((j==null?void 0:j.message)||j))}})}const _=[...e].sort((O,N)=>O.next_ts-N.next_ts);return x.jsxs("div",{className:"mc-card p-4",children:[x.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[x.jsxs("span",{className:"flex items-center gap-2 text-sm font-bold text-foreground",children:[x.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 bg-background/30 text-amber-300",children:x.jsx(WM,{className:"h-4 w-4"})}),"Anstehendes"]}),x.jsxs("button",{onClick:()=>u(O=>!O),className:"flex h-8 items-center gap-1 rounded-lg border border-border/60 bg-background/30 px-2.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground hover:border-primary/40 transition-all cursor-pointer",children:[s?x.jsx(Pu,{className:"h-3.5 w-3.5"}):x.jsx(L1,{className:"h-3.5 w-3.5"})," ",s?"Abbrechen":"Neu"]})]}),s&&x.jsxs("div",{className:"mb-3 space-y-2 rounded-xl border border-border/50 bg-background/30 p-3",children:[x.jsx("input",{value:d,onChange:O=>f(O.target.value),placeholder:"Woran soll Lucy erinnern?","aria-label":"Erinnerungstext",className:"h-9 w-full rounded-lg border border-border/60 bg-card/45 px-3 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary/50"}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx("input",{type:"datetime-local",value:h,onChange:O=>m(O.target.value),"aria-label":"Zeitpunkt",className:"h-9 rounded-lg border border-border/60 bg-card/45 px-2 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary/50 [color-scheme:dark]"}),x.jsx("select",{value:v,onChange:O=>b(O.target.value),"aria-label":"Wiederholung",className:"h-9 cursor-pointer rounded-lg border border-border/60 bg-card/45 px-2 text-xs font-semibold text-foreground outline-none",children:Object.entries(lw).map(([O,N])=>x.jsx("option",{value:O,className:"bg-popover",children:N},O))}),x.jsxs("button",{onClick:P,disabled:k||!d.trim()||!h,className:"ml-auto flex h-9 items-center gap-1.5 rounded-lg bg-primary px-3 text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50",children:[k?x.jsx(If,{className:"h-3.5 w-3.5 animate-spin"}):x.jsx(L1,{className:"h-3.5 w-3.5"})," Anlegen"]})]})]}),t?x.jsx("p",{className:"text-xs text-muted-foreground",children:"Wird geladen …"}):_.length===0?x.jsx("p",{className:"text-xs text-muted-foreground",children:"Keine Erinnerungen. Lucy sagt dir hier (und per Stimme) Bescheid, wenn etwas ansteht."}):x.jsxs("div",{className:"space-y-1.5",children:[_.slice(0,6).map(O=>{const N=O.next_ts*1e3C(O.id,O.text),"aria-label":"Erinnerung löschen",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-red-500/5 hover:text-red-400 group-hover:opacity-100 cursor-pointer",children:x.jsx(kT,{className:"h-3.5 w-3.5"})})]},O.id)}),_.length>6&&x.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["+",_.length-6," weitere"]})]}),o]})}function W3(){const{data:e,error:t}=Lf(),r=D3();return{sys:e,hist:r,error:t}}function Do(e){return(e/1024**3).toFixed(1)}function zQ(e){return e?e>1024**3?`${(e/1024**3).toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`:""}function FQ(e){if(!e)return"—";const t=e/1024**3;return t>=1?`${t.toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`}function BQ(e){if(!e)return"";const t=Math.floor(e/60);return t>0?`${t} min`:`${e} s`}function UQ(e){return e?`${Math.round(e/1024)}k`:"—"}var H3=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Yy(e){if(typeof e!="string")return!1;var t=H3;return t.includes(e)}var K3=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],V3=new Set(K3);function TA(e){return typeof e!="string"?!1:V3.has(e)}function DA(e){return typeof e=="string"&&e.startsWith("data-")}function on(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(TA(r)||DA(r))&&(t[r]=e[r]);return t}function zf(e){if(e==null)return null;if(g.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return on(t)}return typeof e=="object"&&!Array.isArray(e)?on(e):null}function Br(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(TA(r)||DA(r)||Yy(r))&&(t[r]=e[r]);return t}function q3(e){return e==null?null:g.isValidElement(e)?Br(e.props):typeof e=="object"&&!Array.isArray(e)?Br(e):null}var G3=["children","width","height","viewBox","className","style","title","desc"];function Rv(){return Rv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=e.children,n=e.width,i=e.height,o=e.viewBox,s=e.className,u=e.style,d=e.title,f=e.desc,h=Y3(e,G3),m=o||{width:n,height:i,x:0,y:0},v=Xe("recharts-surface",s);return g.createElement("svg",Rv({},Br(h),{className:v,width:n,height:i,style:u,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height),ref:t}),g.createElement("title",null,d),g.createElement("desc",null,f),r)}),X3=["children","className"];function $v(){return $v=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=e.children,n=e.className,i=Z3(e,X3),o=Xe("recharts-layer",n);return g.createElement("g",$v({className:o},Br(i),{ref:t}),r)}),e5=g.createContext(null);function dt(e){return function(){return e}}const Lv=Math.PI,zv=2*Lv,ka=1e-6,t5=zv-ka;function $A(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return $A;const r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;ika)if(!(Math.abs(m*d-f*h)>ka)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let b=n-s,k=i-u,S=d*d+f*f,E=b*b+k*k,P=Math.sqrt(S),C=Math.sqrt(v),_=o*Math.tan((Lv-Math.acos((S+v-E)/(2*P*C)))/2),O=_/C,N=_/P;Math.abs(O-1)>ka&&this._append`L${t+O*h},${r+O*m}`,this._append`A${o},${o},0,0,${+(m*b>h*k)},${this._x1=t+N*d},${this._y1=r+N*f}`}}arc(t,r,n,i,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),d=n*Math.sin(i),f=t+u,h=r+d,m=1^s,v=s?i-o:o-i;this._x1===null?this._append`M${f},${h}`:(Math.abs(this._x1-f)>ka||Math.abs(this._y1-h)>ka)&&this._append`L${f},${h}`,n&&(v<0&&(v=v%zv+zv),v>t5?this._append`A${n},${n},0,1,${m},${t-u},${r-d}A${n},${n},0,1,${m},${this._x1=f},${this._y1=h}`:v>ka&&this._append`A${n},${n},0,${+(v>=Lv)},${m},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function LA(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new n5(t)}function Qy(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zA(e){this._context=e}zA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ff(e){return new zA(e)}function FA(e){return e[0]}function BA(e){return e[1]}function UA(e,t){var r=dt(!0),n=null,i=Ff,o=null,s=LA(u);e=typeof e=="function"?e:e===void 0?FA:dt(e),t=typeof t=="function"?t:t===void 0?BA:dt(t);function u(d){var f,h=(d=Qy(d)).length,m,v=!1,b;for(n==null&&(o=i(b=s())),f=0;f<=h;++f)!(f=b;--k)u.point(_[k],O[k]);u.lineEnd(),u.areaEnd()}P&&(_[v]=+e(E,v,m),O[v]=+t(E,v,m),u.point(n?+n(E,v,m):_[v],r?+r(E,v,m):O[v]))}if(C)return u=null,C+""||null}function h(){return UA().defined(i).curve(s).context(o)}return f.x=function(m){return arguments.length?(e=typeof m=="function"?m:dt(+m),n=null,f):e},f.x0=function(m){return arguments.length?(e=typeof m=="function"?m:dt(+m),f):e},f.x1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:dt(+m),f):n},f.y=function(m){return arguments.length?(t=typeof m=="function"?m:dt(+m),r=null,f):t},f.y0=function(m){return arguments.length?(t=typeof m=="function"?m:dt(+m),f):t},f.y1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:dt(+m),f):r},f.lineX0=f.lineY0=function(){return h().x(e).y(t)},f.lineY1=function(){return h().x(e).y(r)},f.lineX1=function(){return h().x(n).y(t)},f.defined=function(m){return arguments.length?(i=typeof m=="function"?m:dt(!!m),f):i},f.curve=function(m){return arguments.length?(s=m,o!=null&&(u=s(o)),f):s},f.context=function(m){return arguments.length?(m==null?o=u=null:u=s(o=m),f):o},f}class WA{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function i5(e){return new WA(e,!0)}function a5(e){return new WA(e,!1)}function Td(){}function Dd(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function HA(e){this._context=e}HA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Dd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Dd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function o5(e){return new HA(e)}function KA(e){this._context=e}KA.prototype={areaStart:Td,areaEnd:Td,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Dd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function l5(e){return new KA(e)}function VA(e){this._context=e}VA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Dd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function s5(e){return new VA(e)}function qA(e){this._context=e}qA.prototype={areaStart:Td,areaEnd:Td,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function u5(e){return new qA(e)}function sw(e){return e<0?-1:1}function uw(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),u=(o*i+s*n)/(n+i);return(sw(o)+sw(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(u))||0}function cw(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Mm(e,t,r){var n=e._x0,i=e._y0,o=e._x1,s=e._y1,u=(o-n)/3;e._context.bezierCurveTo(n+u,i+u*t,o-u,s-u*r,o,s)}function Rd(e){this._context=e}Rd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Mm(this,this._t0,cw(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Mm(this,cw(this,r=uw(this,e,t)),r);break;default:Mm(this,this._t0,r=uw(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function GA(e){this._context=new YA(e)}(GA.prototype=Object.create(Rd.prototype)).point=function(e,t){Rd.prototype.point.call(this,t,e)};function YA(e){this._context=e}YA.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function c5(e){return new Rd(e)}function d5(e){return new GA(e)}function QA(e){this._context=e}QA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=dw(e),i=dw(t),o=0,s=1;s=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function h5(e){return new Bf(e,.5)}function p5(e){return new Bf(e,0)}function m5(e){return new Bf(e,1)}function Va(e,t){if((s=e.length)>1)for(var r=1,n,i,o=e[t[0]],s,u=o.length;r=0;)r[t]=t;return r}function v5(e,t){return e[t]}function y5(e){const t=[];return t.key=e,t}function g5(){var e=dt([]),t=Fv,r=Va,n=v5;function i(o){var s=Array.from(e.apply(this,arguments),y5),u,d=s.length,f=-1,h;for(const m of o)for(u=0,++f;u0){for(var r,n,i=0,o=e[0].length,s;i0){for(var r=0,n=e[t[0]],i,o=n.length;r0)||!((o=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,o,s;n1&&arguments[1]!==void 0?arguments[1]:k5,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function Lt(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n{var u=r[s-1];return typeof u=="string"?i+u+o:u!==void 0?i+Qi(u)+o:i+o},"")}var Lr=e=>e===0?0:e>0?1:-1,On=e=>typeof e=="number"&&e!=+e,qa=e=>typeof e=="string"&&e.length>1&&e.indexOf("%")===e.length-1,be=e=>(typeof e=="number"||e instanceof Number)&&!On(e),Cn=e=>be(e)||typeof e=="string",E5=0,nu=e=>{var t=++E5;return"".concat(e||"").concat(t)},ra=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!be(t)&&typeof t!="string")return n;var o;if(qa(t)){if(r==null)return n;var s=t.indexOf("%");o=r*parseFloat(t.slice(0,s))/100}else o=+t;return On(o)&&(o=n),i&&r!=null&&o>r&&(o=r),o},JA=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):to(n,t))===r)}var Ut=e=>e===null||typeof e>"u",Jy=e=>Ut(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function pr(e){return e!=null}function Ol(){}var t2=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,eg=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(g.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{Yy(i)&&typeof r[i]=="function"&&(n[i]=(o=>r[i](r,o)))}),n},P5=(e,t,r)=>n=>(e(t,r,n),null),A5=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var o=e[i];Yy(i)&&typeof o=="function"&&(n||(n={}),n[i]=P5(o,t,r))}),n};function fw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function O5(e){for(var t=1;t(s[u]===void 0&&n[u]!==void 0&&(s[u]=n[u]),s),r);return o}function N5(e,t){const r=new Map;for(let n=0;nObject.prototype.propertyIsEnumerable.call(e,t))}function tg(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const R5="[object RegExp]",n2="[object String]",i2="[object Number]",a2="[object Boolean]",o2="[object Arguments]",$5="[object Symbol]",L5="[object Date]",z5="[object Map]",F5="[object Set]",B5="[object Array]",U5="[object ArrayBuffer]",W5="[object Object]",H5="[object DataView]",K5="[object Uint8Array]",V5="[object Uint8ClampedArray]",q5="[object Uint16Array]",G5="[object Uint32Array]",Y5="[object Int8Array]",Q5="[object Int16Array]",X5="[object Int32Array]",Z5="[object Float32Array]",J5="[object Float64Array]",hw=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function e$(e){return typeof hw.Buffer<"u"&&hw.Buffer.isBuffer(e)}function t$(e,t){return Oa(e,void 0,e,new Map,t)}function Oa(e,t,r,n=new Map,i=void 0){const o=i==null?void 0:i(e,t,r,n);if(o!==void 0)return o;if(Uv(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const s=new Array(e.length);n.set(e,s);for(let u=0;u{}):Wv(e,t,function n(i,o,s,u,d,f){const h=r(i,o,s,u,d,f);return h!==void 0?!!h:Wv(i,o,n,f,!1)},new Map,!0)}function Wv(e,t,r,n,i=!1){if(t===e)return!0;switch(typeof t){case"object":return i$(e,t,r,n);case"function":return Object.keys(t).length>0?Wv(e,{...t},r,n,i):Pd(e,t);default:return l2(e)&&i?typeof t=="string"?t==="":!0:Pd(e,t)}}function i$(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return u2(e,t,r,n);if(t instanceof Map)return a$(e,t,r,n);if(t instanceof Set)return o$(e,t,r,n);const i=Object.keys(t);if(e==null||Uv(e))return i.length===0;if(i.length===0)return!0;if(n!=null&&n.has(t))return n.get(t)===e;n==null||n.set(t,e);try{for(let o=0;o{})}function l$(e){return e=n$(e),t=>c2(t,e)}function s$(e,t){return t$(e,(r,n,i,o)=>{if(typeof e=="object"){if(tg(e)==="[object Object]"&&typeof e.constructor!="function"){const s={};return o.set(e,s),en(s,e,i,o),s}switch(Object.prototype.toString.call(e)){case i2:case n2:case a2:{const s=new e.constructor(e==null?void 0:e.valueOf());return en(s,e),s}case o2:{const s={};return en(s,e),s.length=e.length,s[Symbol.iterator]=e[Symbol.iterator],s}default:return}}})}function u$(e){return s$(e)}const c$=/^(?:0|[1-9]\d*)$/;function d2(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e=0}function f2(e){return e!=null&&typeof e!="function"&&m$(e.length)}function v$(e){return typeof e=="object"&&e!==null}function y$(e){return v$(e)&&f2(e)}function pw(e,t=r2){return y$(e)?N5(Array.from(e),I5(p$(t),1)):[]}function g$(e,t,r){return t===!0?pw(e,r):typeof t=="function"?pw(e,t):e}var Tm={exports:{}},Dm={},Rm={exports:{}},$m={};/** * @license React * use-sync-external-store-shim.production.js @@ -463,4 +463,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SY(e,t){if(e){if(typeof e=="string")return iP(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?iP(e,t):void 0}}function iP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{if(n!=null){var s=n.getBoundingClientRect(),u=s.width/n.offsetWidth;Le(u)&&u!==o&&e(Y4(u))}},[n,e,o]),i}function aP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function AY(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r(LW(),null);function Cf(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var DY=g.forwardRef((e,t)=>{var r,n,i=g.useRef(null),o=g.useState({containerWidth:Cf((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Cf((n=e.style)===null||n===void 0?void 0:n.height)}),s=Of(o,2),u=s[0],d=s[1],f=g.useCallback((m,v)=>{d(b=>{var k=Math.round(m),S=Math.round(v);return b.containerWidth===k&&b.containerHeight===S?b:{containerWidth:k,containerHeight:S}})},[]),h=g.useCallback(m=>{if(typeof t=="function"&&t(m),i.current!=null&&(i.current.disconnect(),i.current=null),m!=null&&typeof ResizeObserver<"u"){var v=m.getBoundingClientRect(),b=v.width,k=v.height;f(b,k);var S=P=>{var C=P[0];if(C!=null){var _=C.contentRect,O=_.width,N=_.height;f(O,N)}},E=new ResizeObserver(S);E.observe(m),i.current=E}},[t,f]);return g.useEffect(()=>()=>{var m=i.current;m!=null&&m.disconnect()},[f]),g.createElement(g.Fragment,null,g.createElement(_u,{width:u.containerWidth,height:u.containerHeight}),g.createElement("div",ea({ref:h},e)))}),RY=g.forwardRef((e,t)=>{var r=e.width,n=e.height,i=g.useState({containerWidth:Cf(r),containerHeight:Cf(n)}),o=Of(i,2),s=o[0],u=o[1],d=g.useCallback((h,m)=>{u(v=>{var b=Math.round(h),k=Math.round(m);return v.containerWidth===b&&v.containerHeight===k?v:{containerWidth:b,containerHeight:k}})},[]),f=g.useCallback(h=>{if(typeof t=="function"&&t(h),h!=null){var m=h.getBoundingClientRect(),v=m.width,b=m.height;d(v,b)}},[t,d]);return g.createElement(g.Fragment,null,g.createElement(_u,{width:s.containerWidth,height:s.containerHeight}),g.createElement("div",ea({ref:f},e)))}),$Y=g.forwardRef((e,t)=>{var r=e.width,n=e.height;return g.createElement(g.Fragment,null,g.createElement(_u,{width:r,height:n}),g.createElement("div",ea({ref:t},e)))}),LY=g.forwardRef((e,t)=>{var r=e.width,n=e.height;return typeof r=="string"||typeof n=="string"?g.createElement(RY,ea({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?g.createElement($Y,ea({},e,{width:r,height:n,ref:t})):g.createElement(g.Fragment,null,g.createElement(_u,{width:r,height:n}),g.createElement("div",ea({ref:t},e)))});function zY(e){return e?DY:LY}var FY=g.forwardRef((e,t)=>{var r=e.children,n=e.className,i=e.height,o=e.onClick,s=e.onContextMenu,u=e.onDoubleClick,d=e.onMouseDown,f=e.onMouseEnter,h=e.onMouseLeave,m=e.onMouseMove,v=e.onMouseUp,b=e.onTouchEnd,k=e.onTouchMove,S=e.onTouchStart,E=e.style,P=e.width,C=e.responsive,_=e.dispatchTouchEvents,O=_===void 0?!0:_,N=g.useRef(null),j=gt(),D=g.useState(null),B=Of(D,2),F=B[0],z=B[1],G=g.useState(null),U=Of(G,2),ue=U[0],ae=U[1],ye=PY(),pe=ug(),se=(pe==null?void 0:pe.width)>0?pe.width:P,Y=(pe==null?void 0:pe.height)>0?pe.height:i,Q=g.useCallback(Ae=>{ye(Ae),typeof t=="function"&&t(Ae),z(Ae),ae(Ae),Ae!=null&&(N.current=Ae)},[ye,t,z,ae]),Z=g.useCallback(Ae=>{j(j_(Ae)),j(Rr({handler:o,reactEvent:Ae}))},[j,o]),$=g.useCallback(Ae=>{j(Cy(Ae)),j(Rr({handler:f,reactEvent:Ae}))},[j,f]),M=g.useCallback(Ae=>{j(mj()),j(Rr({handler:h,reactEvent:Ae}))},[j,h]),X=g.useCallback(Ae=>{j(Cy(Ae)),j(Rr({handler:m,reactEvent:Ae}))},[j,m]),le=g.useCallback(()=>{j(D_())},[j]),re=g.useCallback(()=>{j(R_())},[j]),ce=g.useCallback(Ae=>{j(T_(Ae.key))},[j]),he=g.useCallback(Ae=>{j(Rr({handler:s,reactEvent:Ae}))},[j,s]),Pe=g.useCallback(Ae=>{j(Rr({handler:u,reactEvent:Ae}))},[j,u]),J=g.useCallback(Ae=>{j(Rr({handler:d,reactEvent:Ae}))},[j,d]),we=g.useCallback(Ae=>{j(Rr({handler:v,reactEvent:Ae}))},[j,v]),Oe=g.useCallback(Ae=>{j(Rr({handler:S,reactEvent:Ae}))},[j,S]),ne=g.useCallback(Ae=>{O&&j(z_(Ae)),j(Rr({handler:k,reactEvent:Ae}))},[j,O,k]),Ge=g.useCallback(Ae=>{j(Rr({handler:b,reactEvent:Ae}))},[j,b]),Be=zY(C);return g.createElement($j.Provider,{value:F},g.createElement(e5.Provider,{value:ue},g.createElement(Be,{width:se??(E==null?void 0:E.width),height:Y??(E==null?void 0:E.height),className:Xe("recharts-wrapper",n),style:AY({position:"relative",cursor:"default",width:se,height:Y},E),onClick:Z,onContextMenu:he,onDoubleClick:Pe,onFocus:le,onBlur:re,onKeyDown:ce,onMouseDown:J,onMouseEnter:$,onMouseLeave:M,onMouseMove:X,onMouseUp:we,onTouchEnd:Ge,onTouchMove:ne,onTouchStart:Oe,ref:Q},g.createElement(TY,null),r)))}),BY=["width","height","responsive","children","className","style","compact","title","desc"];function UY(e,t){if(e==null)return{};var r,n,i=WY(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n{var r=e.width,n=e.height,i=e.responsive,o=e.children,s=e.className,u=e.style,d=e.compact,f=e.title,h=e.desc,m=UY(e,BY),v=on(m);return d?g.createElement(g.Fragment,null,g.createElement(_u,{width:r,height:n}),g.createElement(nP,{otherAttributes:v,title:f,desc:h},o)):g.createElement(FY,{className:s,style:u,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},g.createElement(nP,{otherAttributes:v,title:f,desc:h,ref:t},g.createElement(HV,null,o)))});function jy(){return jy=Object.assign?Object.assign.bind():function(e){for(var t=1;tg.createElement(XY,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:ZY,tooltipPayloadSearcher:SW,categoricalChartProps:e,ref:t}));const eQ="rgba(130,130,150,0.14)",sP="rgba(130,130,150,0.85)";function tQ(e){if(e<=0)return 10;const t=Math.pow(10,Math.floor(Math.log10(e))),r=e/t;return(r<=1?1:r<=2?2:r<=5?5:10)*t}function W_(e,t){return`${t==="%"?Math.round(e):e>=1e3?`${(e/1e3).toFixed(1)}k`:Math.round(e).toString()}${t}`}function rQ({active:e,payload:t,unit:r}){return!e||!(t!=null&&t.length)?null:x.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:x.jsx("div",{className:"space-y-1",children:t.map(n=>x.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[x.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:n.color}}),x.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:n.name}),x.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:W_(n.value,r)})]},n.dataKey))})})}function H_({data:e,series:t,unit:r="%",yMode:n="percent",height:i=176}){const o=e.reduce((u,d)=>t.reduce((f,h)=>Math.max(f,Number(d[h.key])||0),u),0),s=n==="percent"?Math.min(100,Math.max(25,Math.ceil(o*1.2/25)*25)):Math.max(tQ(o*1.15),10);return x.jsx("div",{style:{height:i},className:"w-full",children:x.jsx(VL,{width:"100%",height:"100%",children:x.jsxs(JY,{data:e,margin:{top:8,right:6,bottom:0,left:-12},children:[x.jsx("defs",{children:t.map(u=>x.jsxs("linearGradient",{id:`grad-${u.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[x.jsx("stop",{offset:"0%",stopColor:u.color,stopOpacity:.22}),x.jsx("stop",{offset:"100%",stopColor:u.color,stopOpacity:0})]},u.key))}),x.jsx(p_,{vertical:!1,stroke:eQ}),x.jsx(O_,{dataKey:"t",hide:!0}),x.jsx(C_,{domain:[0,s],ticks:[0,s/2,s],tickFormatter:u=>W_(u,r),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:sP}}),x.jsx(XW,{content:x.jsx(rQ,{unit:r}),cursor:{stroke:sP,strokeOpacity:.4,strokeDasharray:"3 3"}}),t.map(u=>x.jsx(P_,{type:"monotone",dataKey:u.key,name:u.label,stroke:u.color,strokeWidth:2,fill:`url(#grad-${u.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},u.key))]})})})}const nQ=[{key:"cpu",label:"CPU",color:"#2dd4bf"},{key:"ram",label:"RAM",color:"#38bdf8"},{key:"gpu",label:"GPU",color:"#a78bfa"},{key:"disk",label:"Disk",color:"#fbbf24"}];function iQ(){var s,u,d,f;const{sys:e,hist:t}=W3(),r=!!(e!=null&&e.gpu&&e.gpu.busy_percent!=null&&e.gpu.gtt_used!=null&&e.gpu.gtt_total!=null),n=nQ.filter(h=>h.key!=="gpu"||r),i={cpu:(s=e==null?void 0:e.cpu)==null?void 0:s.percent,ram:(u=e==null?void 0:e.ram)==null?void 0:u.percent,gpu:r?e.gpu.busy_percent:null,disk:(d=e==null?void 0:e.disk)==null?void 0:d.percent},o={cpu:(f=e==null?void 0:e.cpu)!=null&&f.cores?`${e.cpu.cores} Cores`:"",ram:e?`${Do(e.ram.used)}/${Do(e.ram.total)} GB`:"",gpu:r?`${Do(e.gpu.gtt_used)}/${Do(e.gpu.gtt_total)} GB`:"",disk:e!=null&&e.disk?`${Do(e.disk.used)}/${Do(e.disk.total)} GB`:""};return x.jsxs("div",{className:"flex flex-col justify-between mc-card p-5",children:[x.jsxs("div",{children:[x.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[x.jsx(RP,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),x.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[x.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),e?x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:n.map(h=>x.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[x.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:h.color}}),x.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:h.label}),x.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[h.key]??0),"%"]}),o[h.key]&&x.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:o[h.key]})]},h.key))}),x.jsx(H_,{data:t,series:n,unit:"%",yMode:"percent",height:176})]}):x.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(e==null?void 0:e.temp)&&(e.temp.cpu||e.temp.gpu)&&x.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[e.temp.cpu!=null&&x.jsxs("span",{children:["CPU Temp: ",e.temp.cpu," °C"]}),e.temp.gpu!=null&&x.jsxs("span",{children:["GPU Temp: ",e.temp.gpu," °C"]})]})]})}const uP=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function aQ(){const{data:e}=_A(),t=R3(),r=t[t.length-1],n=r?Math.round(r.prompt+r.completion):0;return x.jsxs("div",{className:"mc-card p-5",children:[x.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[x.jsxs("div",{children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(UM,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),x.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[x.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),e&&x.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[x.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:n.toLocaleString("de-DE")}),x.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),e&&x.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[x.jsxs("div",{children:[e.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",x.jsxs("span",{className:"text-emerald-400/90",children:[e.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),x.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",e.prompt_tokens.toLocaleString("de-DE")," · Output ",e.completion_tokens.toLocaleString("de-DE")]})]})]}),x.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:uP.map(i=>x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),x.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),x.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((r==null?void 0:r[i.key])??0)})]},i.key))})]}),e?x.jsx(H_,{data:t,series:uP,unit:" tok/s",yMode:"auto",height:150}):x.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),x.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}const El=[{key:"stt_ms",label:"STT",color:"#f59e0b"},{key:"vision_ms",label:"Sehen",color:"#a78bfa"},{key:"hirn_ms",label:"Hirn",color:"#2dd4bf"},{key:"gen_ms",label:"Antwort",color:"#60a5fa"}],Ia=e=>e==null?"–":`${(e/1e3).toLocaleString("de-DE",{minimumFractionDigits:1,maximumFractionDigits:1})} s`;function oQ(e){const t=Math.max(0,Date.now()/1e3-e);return t<60?`vor ${Math.round(t)} s`:t<3600?`vor ${Math.round(t/60)} min`:`vor ${Math.round(t/3600)} h`}function _y(e){return El.reduce((t,r)=>t+(e[r.key]??0),0)}function lQ(e){let t=null;for(const r of El){const n=e[r.key];n!=null&&(t==null||n>t.ms)&&(t={label:r.label,color:r.color,ms:n})}return t}function sQ({t:e,scale:t}){const r=El.map(n=>`${n.label} ${Ia(e[n.key])}`).join(" · ")+(e.mem0_ms!=null?` (davon Mem0 ${Ia(e.mem0_ms)})`:"");return x.jsxs("div",{className:"flex items-center gap-2.5",children:[x.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[10px] text-muted-foreground/60",children:oQ(e.ts)}),x.jsxs("div",{className:"relative h-4 flex-1 overflow-hidden rounded-sm bg-muted/25",title:r,children:[x.jsx("div",{className:"absolute inset-0 flex",children:El.map(n=>{const i=e[n.key];return!i||i<=0?null:x.jsx("div",{style:{width:`${i/t*100}%`,background:n.color},className:"h-full first:rounded-l-sm"},n.key)})}),e.error&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-rose-500/15 text-[10px] font-semibold text-rose-300",children:"Fehler"})]}),x.jsx("span",{className:"w-12 shrink-0 text-right font-mono text-[11px] font-semibold tabular-nums text-foreground",children:e.error?"–":Ia(_y(e))})]})}function uQ(){const{data:e}=C3(12),t=e??[],r=Math.max(1,...t.map(o=>_y(o))),n=t[0],i=n?lQ(n):null;return x.jsxs("div",{className:"mc-card p-5",children:[x.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[x.jsxs("div",{children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(iT,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Latenz je Turn"}),x.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[x.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),n?x.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[x.jsx("span",{className:`font-space text-3xl font-bold tracking-tight tabular-nums ${n.error?"text-rose-400":"text-foreground"}`,children:n.error?"Fehler":Ia(_y(n))}),x.jsxs("span",{className:"text-xs text-muted-foreground",children:["letzter Turn",!n.error&&i&&x.jsxs(x.Fragment,{children:[" · Täter: ",x.jsx("span",{style:{color:i.color},className:"font-semibold",children:i.label})," ",Ia(i.ms)]})]})]}):x.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Noch kein Voice-Turn aufgezeichnet."}),n&&!n.error&&x.jsxs("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground/70",children:[El.filter(o=>n[o.key]!=null).map(o=>`${o.label} ${Ia(n[o.key])}`).join(" · "),n.mem0_ms!=null&&x.jsxs("span",{className:"text-muted-foreground/50",children:[" · davon Mem0 ",Ia(n.mem0_ms)]})]})]}),x.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1 pt-1",children:El.map(o=>x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:o.color}}),x.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:o.label})]},o.key))})]}),t.length>0?x.jsx("div",{className:"space-y-1.5",children:t.map(o=>x.jsx(sQ,{t:o,scale:r},o.id))}):x.jsx("div",{className:"flex h-[120px] items-center justify-center px-6 text-center text-xs text-muted-foreground",children:"Sprich einmal mit Lucy — dann erscheint hier der Zeit-Wasserfall pro Turn, damit man den einen Hänger sofort sieht."}),x.jsx("div",{className:"mt-3 border-t border-border/30 pt-2 text-[10px] leading-relaxed text-muted-foreground/70",children:'„Hirn" = Zeit bis zum ersten Wort (Agent + Mem0-Suche + Modell); Tool-Runden stecken in „Antwort". Reine Telegram-Turns laufen an MC2 vorbei und erscheinen hier nicht.'})]})}const jf=e=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:e}}));function cQ({onNavigate:e}){var ue,ae,ye,pe;const{data:t}=jA(),{data:r}=CA(),{data:n}=_3(),{data:i}=I3(),{data:o}=j3(),{data:s}=N3(),{data:u}=P3(),d=L3(),{showAlert:f,dialogElement:h}=MA(),m=Ly(),[v,b]=g.useState({});async function k(se,Y){b(Q=>({...Q,[se]:!0}));try{if(Y.kind==="loadModel")await Me(`/api/models/${encodeURIComponent(Y.model)}/load`,{method:"POST"});else{const Q=await Me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:Y.service})});Q.ok||f("Reparatur nicht ganz geklappt",(Q.err||"Unbekannter Fehler")+(Y.needsSudo?` -Tipp: Dafür wird evtl. das Box-Passwort gebraucht (oben rechts hinterlegen).`:""))}m.invalidateQueries({queryKey:Qe.health}),m.invalidateQueries({queryKey:Qe.services}),m.invalidateQueries({queryKey:Qe.models})}catch(Q){f("Reparatur fehlgeschlagen",String((Q==null?void 0:Q.message)||Q))}finally{b(Q=>({...Q,[se]:!1}))}}const S=((ue=t==null?void 0:t.running)==null?void 0:ue.length)??0,E=(r==null?void 0:r.services.filter(se=>se.ok).length)??0,P=(r==null?void 0:r.services.length)??0,C=P-E,_=(i==null?void 0:i.length)??0,O=(n?(n.os>0?1:0)+(n.engine>0?1:0)+(n.swap>0?1:0)+(n.models>0?1:0):0)+(((ae=n==null?void 0:n.components)==null?void 0:ae.filter(se=>se.update===!0).length)??0),N=(s==null?void 0:s.gateway.ok)&&(s==null?void 0:s.memory.ok),j=u!=null&&u.available?u.open_count:0,D=(ye=t==null?void 0:t.models)==null?void 0:ye.find(se=>se.role==="hermes"),B=D!=null&&D.name?(pe=D.name.split("/").pop())==null?void 0:pe.replace(/\.gguf$/i,""):"",F=i?i.filter(se=>["auto","agent","hermes"].includes(se.source)).length:0,z=r==null?void 0:r.services.filter(se=>!se.ok).map(se=>se.name).join(", "),G=n?[n.os>0&&"OS",n.engine>0&&"Engine",n.swap>0&&"Swap",n.models>0&&"Modelle"].filter(Boolean):[],U=G.length>0?G.join(" + "):"";return x.jsxs("div",{className:"space-y-6",children:[x.jsxs("div",{children:[x.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Cockpit"}),x.jsx("p",{className:"text-sm text-muted-foreground",children:"Deine Box auf einen Blick — Details hinter jeder Kachel."})]}),x.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 items-start",children:[x.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[x.jsx(dQ,{verdict:d.verdict,memory:d.memory,warns:d.warns}),x.jsx(B3,{}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Leistung"}),x.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[x.jsx(iQ,{}),x.jsx(aQ,{})]}),x.jsx("div",{className:"mt-4",children:x.jsx(uQ,{})})]}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Bereiche"}),x.jsxs("div",{className:"grid gap-4 grid-cols-2 md:grid-cols-3",children:[x.jsx(To,{icon:Fy,title:"Auftragsbuch",value:u!=null&&u.available?j:"—",unit:j===1?"Vorschlag":"Vorschläge",tone:u?j>0?"warn":"ok":"loading",hint:j>0?`${j} offene Patches`:"Keine ausstehenden Vorschläge",onClick:()=>e("auftraege")}),x.jsx(To,{icon:DP,title:"Modelle",value:S,unit:"warm",tone:S>0?"ok":"muted",hint:B?`Hirn: ${B}`:"Kein Hermes-Modell geladen",onClick:()=>e("models")}),x.jsx(To,{icon:zy,title:"Gedächtnis",value:i?_:"…",unit:"Notizen",tone:i?"ok":"loading",hint:i?`${_} Fakten (${F} auto gelernt)`:"Gedächtnis-Pool laden...",onClick:()=>e("memory")}),x.jsx(To,{icon:Uy,title:"Dienste",value:r?`${E}/${P}`:"…",unit:"laufen",tone:r?C>0?"warn":"ok":"loading",hint:z?`Ausfall: ${z}`:"Alle Dienste online",onClick:()=>jf("maintenance")}),x.jsx(To,{icon:$P,title:"Updates",value:n?O>0?O:"0":"…",unit:O>0?"bereit":"aktuell",tone:n?O>0?"warn":"ok":"loading",hint:O>0?`Verfügbar: ${U}`:"Alles auf dem neuesten Stand",onClick:()=>jf("maintenance")}),x.jsx(To,{icon:By,title:"Verbinden",value:"Zed",unit:N?"· bereit":"",tone:s?N?"ok":"warn":"loading",hint:o!=null&&o.pc_executor_reachable?"IDE & PC online (:7777)":"IDE-Kopplung (PC offline)",onClick:()=>e("connect")})]})]})]}),x.jsxs("div",{className:"space-y-6",children:[x.jsx(fQ,{problems:d.problems,pendingCount:O,openAuftraege:j,busy:v,onRepair:k,onNavigate:e}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Anstehendes"}),x.jsx(U3,{})]}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Werkzeuge & Diagnose"}),x.jsx(hQ,{agent:o,svcErrors:C,onNavigate:e})]})]})]}),h]})}function Sd({children:e}){return x.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:e})}function dQ({verdict:e,memory:t,warns:r}){const n=r.length?`${r[0].label}: ${r[0].detail}${r.length>1?` (+${r.length-1} weitere)`:""}`:t.status==="full"?t.text:"Nichts Schlimmes — nur ein Hinweis.",i={loading:{ring:"border-border/60 bg-card/45",icon:If,iconCls:"text-muted-foreground animate-spin",title:"Box wird geprüft …",sub:"Einen Moment."},gut:{ring:"border-emerald-500/40 bg-emerald-500/5",icon:lT,iconCls:"text-emerald-400",title:"Box gesund",sub:"Alle wichtigen Dienste laufen."},warn:{ring:"border-amber-500/40 bg-amber-500/5",icon:eu,iconCls:"text-amber-400",title:"Kleinigkeit an der Box",sub:n},problem:{ring:"border-red-500/50 bg-red-500/5",icon:eu,iconCls:"text-red-400",title:"Box braucht Hilfe",sub:"Ein wichtiger Dienst hakt."}}[e],o=i.icon,s={ok:"text-emerald-400",warn:"text-amber-400",full:"text-red-400",unknown:"text-muted-foreground"}[t.status],u={ok:"bg-emerald-500",warn:"bg-amber-500",full:"bg-red-500",unknown:"bg-muted-foreground/40"}[t.status];return x.jsxs("div",{className:De("flex flex-col gap-4 rounded-2xl border p-5 shadow-lg shadow-black/15 backdrop-blur-md transition-colors sm:flex-row sm:items-center sm:justify-between h-full",i.ring),children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-border/40 bg-background/30",children:x.jsx(o,{className:De("h-6 w-6",i.iconCls)})}),x.jsxs("div",{className:"min-w-0",children:[x.jsx("h2",{className:"text-base font-bold tracking-tight text-foreground",children:i.title}),x.jsx("p",{className:"text-xs text-muted-foreground",children:i.sub})]})]}),x.jsxs("div",{className:"w-full max-w-[16rem] rounded-xl border border-border/30 bg-background/20 p-3",children:[x.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",children:[x.jsx(oT,{className:"h-3.5 w-3.5"})," Speicher"]}),x.jsx("span",{className:De("font-mono font-bold",s),children:t.status==="unknown"?"—":`${t.usedGb.toFixed(0)} / ${t.totalGb.toFixed(0)} GB`})]}),x.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:x.jsx("div",{className:De("h-full rounded-full transition-all duration-500",u),style:{width:`${t.pct}%`}})})]})]})}function fQ({problems:e,pendingCount:t,openAuftraege:r,busy:n,onRepair:i,onNavigate:o}){const s=t>0,u=r>0,d=e.length===0&&!s&&!u;return x.jsx("div",{className:"h-full flex flex-col justify-between",children:d?x.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-emerald-500/25 bg-emerald-500/5 p-4 h-full",children:[x.jsx(qM,{className:"h-5 w-5 shrink-0 text-emerald-400"}),x.jsxs("div",{children:[x.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Nichts zu tun"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Alles läuft. Du musst gerade nichts abnicken."})]})]}):x.jsxs("div",{className:"space-y-2 h-full flex flex-col justify-center",children:[e.map(f=>x.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-2xl border border-red-500/25 bg-red-500/5 p-4",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3 w-full",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-red-500/30 bg-background/30 text-red-300",children:x.jsx(f.icon,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:"text-sm font-bold text-foreground",children:f.label}),x.jsx("p",{className:"truncate text-xs text-muted-foreground",children:f.detail})]})]}),f.repair&&x.jsxs("button",{onClick:()=>f.repair&&i(f.id,f.repair),disabled:!!n[f.id],className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300 transition-all hover:bg-red-500/20 cursor-pointer disabled:opacity-60 w-full sm:w-auto justify-center",children:[n[f.id]?x.jsx(If,{className:"h-3.5 w-3.5 animate-spin"}):x.jsx(ET,{className:"h-3.5 w-3.5"}),f.repair.label]})]},f.id)),u&&x.jsxs("button",{onClick:()=>o("auftraege"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-primary/30 bg-primary/5 p-4 text-left transition-all hover:bg-primary/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-primary/30 bg-background/30 text-primary",children:x.jsx(Fy,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[r," Vorschl",r===1?"ag":"äge"," im Auftragsbuch"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Annehmen oder ablehnen."})]})]}),x.jsx(Js,{className:"h-4 w-4 shrink-0 text-primary/70"})]}),s&&x.jsxs("button",{onClick:()=>jf("maintenance"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-left transition-all hover:bg-amber-500/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-amber-500/30 bg-background/30 text-amber-300",children:x.jsx($P,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[t," Update",t===1?"":"s"," bereit"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Ansehen und entscheiden."})]})]}),x.jsx(Js,{className:"h-4 w-4 shrink-0 text-amber-300/70"})]})]})})}function hQ({agent:e,svcErrors:t,onNavigate:r}){const n=[{label:"Hermes Agent",status:e?e.gateway_reachable?"Bereit":"Offline":"…",tone:e?e.gateway_reachable?"ok":"alert":"loading",action:()=>r("agent")},{label:"Direkte Box-Shell (SSH)",status:e?e.box_console_reachable?"Bereit":"Offline":"…",tone:e?e.box_console_reachable?"ok":"warn":"loading",action:()=>r("konsole")},{label:"Systemlogs & Diagnose",status:t>0?`${t} Fehler`:"Keine Fehler",tone:t>0?"alert":"ok",action:()=>jf("logs")},{label:"Interaktives Terminal",status:"Öffnen",tone:"muted",action:()=>r("konsole")},{label:"Wissens-Vault",status:"Öffnen",tone:"muted",action:()=>r("wissen")},{label:"Chronik & Zeitmaschine",status:"Öffnen",tone:"muted",action:()=>r("chronik")}];return x.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/30 p-4 space-y-3 shadow-sm",children:x.jsx("div",{className:"divide-y divide-border/20",children:n.map((i,o)=>{const s={loading:"bg-muted-foreground/45 animate-pulse",ok:"bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.4)]",warn:"bg-amber-500 shadow-[0_0_8px_rgba(245,158,11,0.4)]",alert:"bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.4)]",muted:"bg-muted-foreground/30"}[i.tone];return x.jsxs("button",{onClick:i.action,className:"w-full py-2.5 px-1.5 flex items-center justify-between text-left hover:bg-card/45 rounded-lg transition-all group cursor-pointer text-xs",children:[x.jsx("span",{className:"text-muted-foreground group-hover:text-foreground transition-colors font-medium",children:i.label}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:De("text-[10px] font-semibold font-mono",i.tone==="ok"?"text-emerald-400":i.tone==="warn"?"text-amber-400":i.tone==="alert"?"text-red-400":"text-muted-foreground/60"),children:i.status}),x.jsx("span",{className:De("h-1.5 w-1.5 rounded-full",s)})]})]},o)})})})}const pQ=g.lazy(()=>ai(()=>import("./ModelsView-XFK_eBt6.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ModelsView}))),mQ=g.lazy(()=>ai(()=>import("./ConnectView-Dxf6Cyum.js"),__vite__mapDeps([2,3,4])).then(e=>({default:e.ConnectView}))),vQ=g.lazy(()=>ai(()=>import("./MemoryView-rgfxKFS7.js"),__vite__mapDeps([5,4,6,7])).then(e=>({default:e.MemoryView}))),yQ=g.lazy(()=>ai(()=>import("./AgentView-D526Xur0.js"),[]).then(e=>({default:e.AgentView}))),gQ=g.lazy(()=>ai(()=>import("./KonsoleView-Noe5RIOu.js"),[]).then(e=>({default:e.KonsoleView}))),xQ=g.lazy(()=>ai(()=>import("./GuideView-BS1gSjak.js"),__vite__mapDeps([8,7,1,9])).then(e=>({default:e.GuideView}))),bQ=g.lazy(()=>ai(()=>import("./AuftragsbuchView-ChhNmDrz.js"),__vite__mapDeps([10,9,6])).then(e=>({default:e.AuftragsbuchView}))),wQ=g.lazy(()=>ai(()=>import("./ChronikView-DkwJISEG.js"),[]).then(e=>({default:e.ChronikView}))),SQ=g.lazy(()=>ai(()=>import("./WissenView-WgvQqTOM.js"),__vite__mapDeps([11,3])).then(e=>({default:e.WissenView})));function kQ(){return x.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:x.jsx(If,{className:"h-5 w-5 animate-spin","aria-label":"Lädt …"})})}const EQ=/Mac|iPhone|iPad/.test(navigator.platform);function PQ(){$3();const[e,t]=g.useState(()=>{const k=window.location.hash.slice(1);return Yo.some(S=>S.id===k)?k:"dashboard"}),r=g.useCallback(k=>{window.location.hash.slice(1)===k?t(k):window.location.hash=k},[]),[n,i]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[o,s]=g.useState(!1),[u,d]=g.useState(!1),[f,h]=g.useState("maintenance"),{data:m}=OA(),{data:v}=Lf();g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const k=S=>{var P;h(((P=S.detail)==null?void 0:P.tab)||"maintenance"),d(!0)};return window.addEventListener("open-system-drawer",k),()=>window.removeEventListener("open-system-drawer",k)},[]),g.useEffect(()=>{const k=S=>{var P;const E=(P=S.detail)==null?void 0:P.view;E&&r(E)};return window.addEventListener("mc-navigate",k),()=>window.removeEventListener("mc-navigate",k)},[r]),g.useEffect(()=>{const k=()=>{const S=window.location.hash.slice(1);Yo.some(E=>E.id===S)&&t(S)};return window.addEventListener("hashchange",k),()=>window.removeEventListener("hashchange",k)},[]),g.useEffect(()=>{s(!1)},[e]);const b=Yo.find(k=>k.id===e);return x.jsxs("div",{className:"flex h-full relative",children:[x.jsx("div",{className:"fixed inset-0 -z-50 pointer-events-none",style:{backgroundColor:"hsl(224,30%,6%)",backgroundImage:["radial-gradient(45% 40% at 12% 8%, hsl(172 72% 50% / 0.10), transparent 70%)","radial-gradient(50% 45% at 88% 92%, hsl(270 70% 60% / 0.10), transparent 70%)","radial-gradient(40% 35% at 75% 30%, hsl(239 70% 62% / 0.07), transparent 70%)"].join(", ")}}),x.jsx(IR,{onNavigate:r}),x.jsx(E3,{open:u,onClose:()=>d(!1),defaultTab:f}),x.jsx("aside",{className:De("hidden md:flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:x.jsx(cP,{collapsed:n,onToggleCollapse:()=>{i(k=>{const S=!k;return localStorage.setItem("mc_sidebar_collapsed",S.toString()),S})},view:e,health:m,sysStatus:v})}),x.jsxs("div",{className:De("md:hidden fixed inset-0 z-50 transition-opacity duration-200",o?"opacity-100":"pointer-events-none opacity-0"),"aria-hidden":!o,children:[x.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:()=>s(!1)}),x.jsx("aside",{className:De("absolute inset-y-0 left-0 flex w-72 max-w-[85vw] flex-col border-r border-border/40 bg-[hsl(224,28%,8%)] transition-transform duration-300 ease-in-out",o?"translate-x-0":"-translate-x-full"),children:x.jsx(cP,{collapsed:!1,onClose:()=>s(!1),view:e,health:m,sysStatus:v})})]}),x.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[x.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between gap-3 border-b border-border/40 px-4 md:px-6 bg-card/20 backdrop-blur-sm",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[x.jsx("button",{onClick:()=>s(!0),className:"md:hidden p-1.5 -ml-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation öffnen",children:x.jsx(fT,{className:"h-5 w-5","aria-hidden":"true"})}),x.jsx("div",{className:"truncate text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint})]}),x.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[x.jsx(p3,{}),x.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"hidden sm: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"}),x.jsxs("button",{onClick:()=>{const k=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(k)},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:[x.jsx(eT,{className:"h-3.5 w-3.5"}),x.jsx("span",{className:"hidden sm:inline",children:"Suchen"}),x.jsx("kbd",{className:"hidden sm:inline rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:EQ?"⌘K":"Strg+K"})]})]})]}),x.jsx("main",{className:"flex-1 overflow-y-auto p-4 md:p-6 scrollbar-thin",children:x.jsxs(g.Suspense,{fallback:x.jsx(kQ,{}),children:[e==="dashboard"&&x.jsx(cQ,{onNavigate:k=>r(k)}),e==="auftraege"&&x.jsx(bQ,{}),e==="models"&&x.jsx(pQ,{}),e==="connect"&&x.jsx(mQ,{}),e==="memory"&&x.jsx(vQ,{}),e==="wissen"&&x.jsx(SQ,{}),e==="chronik"&&x.jsx(wQ,{}),e==="agent"&&x.jsx(yQ,{}),e==="konsole"&&x.jsx(gQ,{}),e==="guide"&&x.jsx(xQ,{}),!["dashboard","auftraege","models","connect","memory","wissen","chronik","agent","konsole","guide"].includes(e)&&x.jsx(m3,{title:b.label,hint:b.hint})]})})]})]})}function cP({collapsed:e,onToggleCollapse:t,onClose:r,view:n,health:i,sysStatus:o}){var s,u,d,f,h;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:De("flex items-center py-4 border-b border-border/40 shrink-0",e?"flex-col gap-3 px-2":"justify-between px-5"),children:[x.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[x.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!e&&x.jsxs("div",{className:"leading-tight",children:[x.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),x.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),t&&x.jsx("button",{onClick:t,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":e?"Seitenleiste ausklappen":"Seitenleiste einklappen",title:e?"Maximieren":"Minimieren",children:e?x.jsx(Js,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(YM,{className:"h-4 w-4","aria-hidden":"true"})}),r&&x.jsx("button",{onClick:r,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation schließen",children:x.jsx(Pu,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:(()=>{let m=null;return Yo.map(v=>{const b=v.group!==m;return m=v.group,x.jsxs("div",{className:"space-y-1",children:[b&&(e?m!==Yo[0].group&&x.jsx("div",{className:"my-3 border-t border-border/30"}):x.jsx("div",{className:"mt-5 mb-1.5 px-3 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/40 first:mt-0 select-none",children:v.group})),x.jsxs("a",{href:`#${v.id}`,onClick:r,"aria-current":n===v.id?"page":void 0,className:De("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",e?"justify-center p-2.5":"gap-3 px-3 py-2",n===v.id?e?"nav-active-collapsed":"nav-active":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:e?v.label:void 0,"aria-label":e?v.label:void 0,children:[x.jsx(v.icon,{className:"h-4.5 w-4.5 shrink-0","aria-hidden":"true"}),!e&&x.jsx("span",{className:"truncate",children:v.label})]})]},v.id)})})()}),x.jsx("div",{className:De("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",e?"px-2 text-center":"px-5"),children:e?x.jsx("div",{className:"flex justify-center",children:x.jsx("span",{className:De("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",i?i.engine_reachable?i.brain&&!i.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:i?i.engine_reachable?i.brain&&!i.brain.ready?`Hirn offline (${i.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):x.jsxs("div",{className:"space-y-2 text-left",children:[i?x.jsxs(x.Fragment,{children:[x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:De("h-2 w-2 rounded-full animate-pulse",i.engine_reachable?"bg-emerald-500":"bg-amber-500")}),x.jsxs("span",{className:"truncate",children:["Engine ",i.engine_reachable?"online":"offline"]})]}),i.brain&&!i.brain.ready&&x.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${i.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),x.jsxs("span",{className:"truncate",children:["Hirn offline",i.brain.model?` (${i.brain.model})`:""]})]})]}):x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",x.jsx("span",{className:"truncate",children:"Backend offline"})]}),(o==null?void 0:o.versions)&&x.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[x.jsxs("div",{className:"truncate",title:o.versions.mc2?`${o.versions.mc2.branch}-${o.versions.mc2.hash}${o.versions.mc2.dirty?"*":""} (${o.versions.mc2.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"MC2:"})," ",o.versions.mc2?`${o.versions.mc2.hash}${o.versions.mc2.dirty?"*":""}`:"—"]}),x.jsxs("div",{className:"truncate",title:((s=o.versions.engine)==null?void 0:s.type)==="git"?`${o.versions.engine.branch}-${o.versions.engine.hash}${o.versions.engine.dirty?"*":""} (${o.versions.engine.date})`:((u=o.versions.engine)==null?void 0:u.version_text)||"unbekannt",children:[x.jsx("strong",{children:"Engine:"})," ",((d=o.versions.engine)==null?void 0:d.type)==="git"?`${o.versions.engine.hash}${o.versions.engine.dirty?"*":""}`:((h=(f=o.versions.engine)==null?void 0:f.version_text)==null?void 0:h.split(" ").pop())||"—"]}),x.jsxs("div",{className:"truncate",title:o.versions.hermes_agent?`${o.versions.hermes_agent.branch}-${o.versions.hermes_agent.hash}${o.versions.hermes_agent.dirty?"*":""} (${o.versions.hermes_agent.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"Hermes Agent:"})," ",o.versions.hermes_agent?`${o.versions.hermes_agent.hash}${o.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]})}class AQ extends My.Component{constructor(){super(...arguments);Os(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,n){console.error("Unbehandelter UI-Fehler:",r,n.componentStack)}render(){return this.state.error?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-neutral-950 text-neutral-200 p-8",children:x.jsxs("div",{className:"max-w-lg space-y-4 text-center",children:[x.jsx("div",{className:"text-2xl",children:"Da ist etwas schiefgelaufen."}),x.jsx("div",{className:"text-sm text-neutral-400 break-all",children:this.state.error.message}),x.jsx("button",{className:"px-4 py-2 rounded-lg bg-neutral-800 hover:bg-neutral-700 border border-neutral-700",onClick:()=>window.location.reload(),children:"Neu laden"})]})}):this.props.children}}const OQ=new EM({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});ZI.createRoot(document.getElementById("root")).render(x.jsx(My.StrictMode,{children:x.jsx(AQ,{children:x.jsx(PM,{client:OQ,children:x.jsx(PQ,{})})})}));export{wT as $,N3 as A,zy as B,qM as C,D1 as D,Av as E,Js as F,QM as G,oT as H,I3 as I,MQ as J,ST as K,If as L,L1 as M,bT as N,ZM as O,mT as P,Wy as Q,j3 as R,yT as S,eu as T,rT as U,jQ as V,Nf as W,Pu as X,UM as Y,ET as Z,ai as _,DQ as a,Uy as a0,DP as a1,By as a2,iT as a3,P3 as a4,Go as a5,_Q as a6,Fy as a7,A3 as a8,sT as a9,WM as aa,pT as ab,$P as ac,lT as ad,IQ as ae,NQ as af,nT as ag,dT as ah,uf as ai,My as aj,pu as ak,yk as al,C8 as am,jg as an,sk as ao,lk as ap,Iy as aq,MA as b,ke as c,BQ as d,De as e,zQ as f,Me as g,HM as h,$Q as i,x as j,FQ as k,Do as l,jA as m,Lf as n,TQ as o,DR as p,Qe as q,g as r,RP as s,UQ as t,Ly as u,kT as v,GM as w,RQ as x,_3 as y,LQ as z}; +Tipp: Dafür wird evtl. das Box-Passwort gebraucht (oben rechts hinterlegen).`:""))}m.invalidateQueries({queryKey:Qe.health}),m.invalidateQueries({queryKey:Qe.services}),m.invalidateQueries({queryKey:Qe.models})}catch(Q){f("Reparatur fehlgeschlagen",String((Q==null?void 0:Q.message)||Q))}finally{b(Q=>({...Q,[se]:!1}))}}const S=((ue=t==null?void 0:t.running)==null?void 0:ue.length)??0,E=(r==null?void 0:r.services.filter(se=>se.ok).length)??0,P=(r==null?void 0:r.services.length)??0,C=P-E,_=(i==null?void 0:i.length)??0,O=(n?(n.os>0?1:0)+(n.engine>0?1:0)+(n.swap>0?1:0)+(n.models>0?1:0):0)+(((ae=n==null?void 0:n.components)==null?void 0:ae.filter(se=>se.update===!0).length)??0),N=(s==null?void 0:s.gateway.ok)&&(s==null?void 0:s.memory.ok),j=u!=null&&u.available?u.open_count:0,D=(ye=t==null?void 0:t.models)==null?void 0:ye.find(se=>se.role==="hermes"),B=D!=null&&D.name?(pe=D.name.split("/").pop())==null?void 0:pe.replace(/\.gguf$/i,""):"",F=i?i.filter(se=>["auto","agent","hermes"].includes(se.source)).length:0,z=r==null?void 0:r.services.filter(se=>!se.ok).map(se=>se.name).join(", "),G=n?[n.os>0&&"OS",n.engine>0&&"Engine",n.swap>0&&"Swap",n.models>0&&"Modelle"].filter(Boolean):[],U=G.length>0?G.join(" + "):"";return x.jsxs("div",{className:"space-y-6",children:[x.jsxs("div",{children:[x.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Cockpit"}),x.jsx("p",{className:"text-sm text-muted-foreground",children:"Deine Box auf einen Blick — Details hinter jeder Kachel."})]}),x.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 items-start",children:[x.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[x.jsx(dQ,{verdict:d.verdict,memory:d.memory,warns:d.warns}),x.jsx(B3,{}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Leistung"}),x.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[x.jsx(iQ,{}),x.jsx(aQ,{})]}),x.jsx("div",{className:"mt-4",children:x.jsx(uQ,{})})]}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Bereiche"}),x.jsxs("div",{className:"grid gap-4 grid-cols-2 md:grid-cols-3",children:[x.jsx(To,{icon:Fy,title:"Auftragsbuch",value:u!=null&&u.available?j:"—",unit:j===1?"Vorschlag":"Vorschläge",tone:u?j>0?"warn":"ok":"loading",hint:j>0?`${j} offene Patches`:"Keine ausstehenden Vorschläge",onClick:()=>e("auftraege")}),x.jsx(To,{icon:DP,title:"Modelle",value:S,unit:"warm",tone:S>0?"ok":"muted",hint:B?`Hirn: ${B}`:"Kein Hermes-Modell geladen",onClick:()=>e("models")}),x.jsx(To,{icon:zy,title:"Gedächtnis",value:i?_:"…",unit:"Notizen",tone:i?"ok":"loading",hint:i?`${_} Fakten (${F} auto gelernt)`:"Gedächtnis-Pool laden...",onClick:()=>e("memory")}),x.jsx(To,{icon:Uy,title:"Dienste",value:r?`${E}/${P}`:"…",unit:"laufen",tone:r?C>0?"warn":"ok":"loading",hint:z?`Ausfall: ${z}`:"Alle Dienste online",onClick:()=>jf("maintenance")}),x.jsx(To,{icon:$P,title:"Updates",value:n?O>0?O:"0":"…",unit:O>0?"bereit":"aktuell",tone:n?O>0?"warn":"ok":"loading",hint:O>0?`Verfügbar: ${U}`:"Alles auf dem neuesten Stand",onClick:()=>jf("maintenance")}),x.jsx(To,{icon:By,title:"Verbinden",value:"Zed",unit:N?"· bereit":"",tone:s?N?"ok":"warn":"loading",hint:o!=null&&o.pc_executor_reachable?"IDE & PC online (:7777)":"IDE-Kopplung (PC offline)",onClick:()=>e("connect")})]})]})]}),x.jsxs("div",{className:"space-y-6",children:[x.jsx(fQ,{problems:d.problems,pendingCount:O,openAuftraege:j,busy:v,onRepair:k,onNavigate:e}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Anstehendes"}),x.jsx(U3,{})]}),x.jsxs("section",{children:[x.jsx(Sd,{children:"Werkzeuge & Diagnose"}),x.jsx(hQ,{agent:o,svcErrors:C,onNavigate:e})]})]})]}),h]})}function Sd({children:e}){return x.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:e})}function dQ({verdict:e,memory:t,warns:r}){const n=r.length?`${r[0].label}: ${r[0].detail}${r.length>1?` (+${r.length-1} weitere)`:""}`:t.status==="full"?t.text:"Nichts Schlimmes — nur ein Hinweis.",i={loading:{ring:"border-border/60 bg-card/45",icon:If,iconCls:"text-muted-foreground animate-spin",title:"Box wird geprüft …",sub:"Einen Moment."},gut:{ring:"border-emerald-500/40 bg-emerald-500/5",icon:lT,iconCls:"text-emerald-400",title:"Box gesund",sub:"Alle wichtigen Dienste laufen."},warn:{ring:"border-amber-500/40 bg-amber-500/5",icon:eu,iconCls:"text-amber-400",title:"Kleinigkeit an der Box",sub:n},problem:{ring:"border-red-500/50 bg-red-500/5",icon:eu,iconCls:"text-red-400",title:"Box braucht Hilfe",sub:"Ein wichtiger Dienst hakt."}}[e],o=i.icon,s={ok:"text-emerald-400",warn:"text-amber-400",full:"text-red-400",unknown:"text-muted-foreground"}[t.status],u={ok:"bg-emerald-500",warn:"bg-amber-500",full:"bg-red-500",unknown:"bg-muted-foreground/40"}[t.status];return x.jsxs("div",{className:De("flex flex-col gap-4 rounded-2xl border p-5 shadow-lg shadow-black/15 backdrop-blur-md transition-colors sm:flex-row sm:items-center sm:justify-between h-full",i.ring),children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-border/40 bg-background/30",children:x.jsx(o,{className:De("h-6 w-6",i.iconCls)})}),x.jsxs("div",{className:"min-w-0",children:[x.jsx("h2",{className:"text-base font-bold tracking-tight text-foreground",children:i.title}),x.jsx("p",{className:"text-xs text-muted-foreground",children:i.sub})]})]}),x.jsxs("div",{className:"w-full max-w-[16rem] rounded-xl border border-border/30 bg-background/20 p-3",children:[x.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",children:[x.jsx(oT,{className:"h-3.5 w-3.5"})," Speicher"]}),x.jsx("span",{className:De("font-mono font-bold",s),children:t.status==="unknown"?"—":`${t.usedGb.toFixed(1)} / ${t.totalGb.toFixed(1)} GB`})]}),x.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:x.jsx("div",{className:De("h-full rounded-full transition-all duration-500",u),style:{width:`${t.pct}%`}})})]})]})}function fQ({problems:e,pendingCount:t,openAuftraege:r,busy:n,onRepair:i,onNavigate:o}){const s=t>0,u=r>0,d=e.length===0&&!s&&!u;return x.jsx("div",{className:"h-full flex flex-col justify-between",children:d?x.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-emerald-500/25 bg-emerald-500/5 p-4 h-full",children:[x.jsx(qM,{className:"h-5 w-5 shrink-0 text-emerald-400"}),x.jsxs("div",{children:[x.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Nichts zu tun"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Alles läuft. Du musst gerade nichts abnicken."})]})]}):x.jsxs("div",{className:"space-y-2 h-full flex flex-col justify-center",children:[e.map(f=>x.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-2xl border border-red-500/25 bg-red-500/5 p-4",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3 w-full",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-red-500/30 bg-background/30 text-red-300",children:x.jsx(f.icon,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:"text-sm font-bold text-foreground",children:f.label}),x.jsx("p",{className:"truncate text-xs text-muted-foreground",children:f.detail})]})]}),f.repair&&x.jsxs("button",{onClick:()=>f.repair&&i(f.id,f.repair),disabled:!!n[f.id],className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300 transition-all hover:bg-red-500/20 cursor-pointer disabled:opacity-60 w-full sm:w-auto justify-center",children:[n[f.id]?x.jsx(If,{className:"h-3.5 w-3.5 animate-spin"}):x.jsx(ET,{className:"h-3.5 w-3.5"}),f.repair.label]})]},f.id)),u&&x.jsxs("button",{onClick:()=>o("auftraege"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-primary/30 bg-primary/5 p-4 text-left transition-all hover:bg-primary/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-primary/30 bg-background/30 text-primary",children:x.jsx(Fy,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[r," Vorschl",r===1?"ag":"äge"," im Auftragsbuch"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Annehmen oder ablehnen."})]})]}),x.jsx(Js,{className:"h-4 w-4 shrink-0 text-primary/70"})]}),s&&x.jsxs("button",{onClick:()=>jf("maintenance"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-left transition-all hover:bg-amber-500/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-amber-500/30 bg-background/30 text-amber-300",children:x.jsx($P,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[t," Update",t===1?"":"s"," bereit"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Ansehen und entscheiden."})]})]}),x.jsx(Js,{className:"h-4 w-4 shrink-0 text-amber-300/70"})]})]})})}function hQ({agent:e,svcErrors:t,onNavigate:r}){const n=[{label:"Hermes Agent",status:e?e.gateway_reachable?"Bereit":"Offline":"…",tone:e?e.gateway_reachable?"ok":"alert":"loading",action:()=>r("agent")},{label:"Direkte Box-Shell (SSH)",status:e?e.box_console_reachable?"Bereit":"Offline":"…",tone:e?e.box_console_reachable?"ok":"warn":"loading",action:()=>r("konsole")},{label:"Systemlogs & Diagnose",status:t>0?`${t} Fehler`:"Keine Fehler",tone:t>0?"alert":"ok",action:()=>jf("logs")},{label:"Interaktives Terminal",status:"Öffnen",tone:"muted",action:()=>r("konsole")},{label:"Wissens-Vault",status:"Öffnen",tone:"muted",action:()=>r("wissen")},{label:"Chronik & Zeitmaschine",status:"Öffnen",tone:"muted",action:()=>r("chronik")}];return x.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/30 p-4 space-y-3 shadow-sm",children:x.jsx("div",{className:"divide-y divide-border/20",children:n.map((i,o)=>{const s={loading:"bg-muted-foreground/45 animate-pulse",ok:"bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.4)]",warn:"bg-amber-500 shadow-[0_0_8px_rgba(245,158,11,0.4)]",alert:"bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.4)]",muted:"bg-muted-foreground/30"}[i.tone];return x.jsxs("button",{onClick:i.action,className:"w-full py-2.5 px-1.5 flex items-center justify-between text-left hover:bg-card/45 rounded-lg transition-all group cursor-pointer text-xs",children:[x.jsx("span",{className:"text-muted-foreground group-hover:text-foreground transition-colors font-medium",children:i.label}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:De("text-[10px] font-semibold font-mono",i.tone==="ok"?"text-emerald-400":i.tone==="warn"?"text-amber-400":i.tone==="alert"?"text-red-400":"text-muted-foreground/60"),children:i.status}),x.jsx("span",{className:De("h-1.5 w-1.5 rounded-full",s)})]})]},o)})})})}const pQ=g.lazy(()=>ai(()=>import("./ModelsView-LvY8upF2.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ModelsView}))),mQ=g.lazy(()=>ai(()=>import("./ConnectView-QFMbbPya.js"),__vite__mapDeps([2,3,4])).then(e=>({default:e.ConnectView}))),vQ=g.lazy(()=>ai(()=>import("./MemoryView-DiYUL6xq.js"),__vite__mapDeps([5,4,6,7])).then(e=>({default:e.MemoryView}))),yQ=g.lazy(()=>ai(()=>import("./AgentView-gOpOu3OL.js"),[]).then(e=>({default:e.AgentView}))),gQ=g.lazy(()=>ai(()=>import("./KonsoleView-BmijGyLC.js"),[]).then(e=>({default:e.KonsoleView}))),xQ=g.lazy(()=>ai(()=>import("./GuideView-DPDeItXc.js"),__vite__mapDeps([8,7,1,9])).then(e=>({default:e.GuideView}))),bQ=g.lazy(()=>ai(()=>import("./AuftragsbuchView-Bhd2qL6R.js"),__vite__mapDeps([10,9,6])).then(e=>({default:e.AuftragsbuchView}))),wQ=g.lazy(()=>ai(()=>import("./ChronikView-Cee_mQ-B.js"),[]).then(e=>({default:e.ChronikView}))),SQ=g.lazy(()=>ai(()=>import("./WissenView-CFoCOSAi.js"),__vite__mapDeps([11,3])).then(e=>({default:e.WissenView})));function kQ(){return x.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:x.jsx(If,{className:"h-5 w-5 animate-spin","aria-label":"Lädt …"})})}const EQ=/Mac|iPhone|iPad/.test(navigator.platform);function PQ(){$3();const[e,t]=g.useState(()=>{const k=window.location.hash.slice(1);return Yo.some(S=>S.id===k)?k:"dashboard"}),r=g.useCallback(k=>{window.location.hash.slice(1)===k?t(k):window.location.hash=k},[]),[n,i]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[o,s]=g.useState(!1),[u,d]=g.useState(!1),[f,h]=g.useState("maintenance"),{data:m}=OA(),{data:v}=Lf();g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const k=S=>{var P;h(((P=S.detail)==null?void 0:P.tab)||"maintenance"),d(!0)};return window.addEventListener("open-system-drawer",k),()=>window.removeEventListener("open-system-drawer",k)},[]),g.useEffect(()=>{const k=S=>{var P;const E=(P=S.detail)==null?void 0:P.view;E&&r(E)};return window.addEventListener("mc-navigate",k),()=>window.removeEventListener("mc-navigate",k)},[r]),g.useEffect(()=>{const k=()=>{const S=window.location.hash.slice(1);Yo.some(E=>E.id===S)&&t(S)};return window.addEventListener("hashchange",k),()=>window.removeEventListener("hashchange",k)},[]),g.useEffect(()=>{s(!1)},[e]);const b=Yo.find(k=>k.id===e);return x.jsxs("div",{className:"flex h-full relative",children:[x.jsx("div",{className:"fixed inset-0 -z-50 pointer-events-none",style:{backgroundColor:"hsl(224,30%,6%)",backgroundImage:["radial-gradient(45% 40% at 12% 8%, hsl(172 72% 50% / 0.10), transparent 70%)","radial-gradient(50% 45% at 88% 92%, hsl(270 70% 60% / 0.10), transparent 70%)","radial-gradient(40% 35% at 75% 30%, hsl(239 70% 62% / 0.07), transparent 70%)"].join(", ")}}),x.jsx(IR,{onNavigate:r}),x.jsx(E3,{open:u,onClose:()=>d(!1),defaultTab:f}),x.jsx("aside",{className:De("hidden md:flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:x.jsx(cP,{collapsed:n,onToggleCollapse:()=>{i(k=>{const S=!k;return localStorage.setItem("mc_sidebar_collapsed",S.toString()),S})},view:e,health:m,sysStatus:v})}),x.jsxs("div",{className:De("md:hidden fixed inset-0 z-50 transition-opacity duration-200",o?"opacity-100":"pointer-events-none opacity-0"),"aria-hidden":!o,children:[x.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:()=>s(!1)}),x.jsx("aside",{className:De("absolute inset-y-0 left-0 flex w-72 max-w-[85vw] flex-col border-r border-border/40 bg-[hsl(224,28%,8%)] transition-transform duration-300 ease-in-out",o?"translate-x-0":"-translate-x-full"),children:x.jsx(cP,{collapsed:!1,onClose:()=>s(!1),view:e,health:m,sysStatus:v})})]}),x.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[x.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between gap-3 border-b border-border/40 px-4 md:px-6 bg-card/20 backdrop-blur-sm",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[x.jsx("button",{onClick:()=>s(!0),className:"md:hidden p-1.5 -ml-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation öffnen",children:x.jsx(fT,{className:"h-5 w-5","aria-hidden":"true"})}),x.jsx("div",{className:"truncate text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint})]}),x.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[x.jsx(p3,{}),x.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"hidden sm: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"}),x.jsxs("button",{onClick:()=>{const k=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(k)},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:[x.jsx(eT,{className:"h-3.5 w-3.5"}),x.jsx("span",{className:"hidden sm:inline",children:"Suchen"}),x.jsx("kbd",{className:"hidden sm:inline rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:EQ?"⌘K":"Strg+K"})]})]})]}),x.jsx("main",{className:"flex-1 overflow-y-auto p-4 md:p-6 scrollbar-thin",children:x.jsxs(g.Suspense,{fallback:x.jsx(kQ,{}),children:[e==="dashboard"&&x.jsx(cQ,{onNavigate:k=>r(k)}),e==="auftraege"&&x.jsx(bQ,{}),e==="models"&&x.jsx(pQ,{}),e==="connect"&&x.jsx(mQ,{}),e==="memory"&&x.jsx(vQ,{}),e==="wissen"&&x.jsx(SQ,{}),e==="chronik"&&x.jsx(wQ,{}),e==="agent"&&x.jsx(yQ,{}),e==="konsole"&&x.jsx(gQ,{}),e==="guide"&&x.jsx(xQ,{}),!["dashboard","auftraege","models","connect","memory","wissen","chronik","agent","konsole","guide"].includes(e)&&x.jsx(m3,{title:b.label,hint:b.hint})]})})]})]})}function cP({collapsed:e,onToggleCollapse:t,onClose:r,view:n,health:i,sysStatus:o}){var s,u,d,f,h;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:De("flex items-center py-4 border-b border-border/40 shrink-0",e?"flex-col gap-3 px-2":"justify-between px-5"),children:[x.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[x.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!e&&x.jsxs("div",{className:"leading-tight",children:[x.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),x.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),t&&x.jsx("button",{onClick:t,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":e?"Seitenleiste ausklappen":"Seitenleiste einklappen",title:e?"Maximieren":"Minimieren",children:e?x.jsx(Js,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(YM,{className:"h-4 w-4","aria-hidden":"true"})}),r&&x.jsx("button",{onClick:r,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation schließen",children:x.jsx(Pu,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:(()=>{let m=null;return Yo.map(v=>{const b=v.group!==m;return m=v.group,x.jsxs("div",{className:"space-y-1",children:[b&&(e?m!==Yo[0].group&&x.jsx("div",{className:"my-3 border-t border-border/30"}):x.jsx("div",{className:"mt-5 mb-1.5 px-3 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/40 first:mt-0 select-none",children:v.group})),x.jsxs("a",{href:`#${v.id}`,onClick:r,"aria-current":n===v.id?"page":void 0,className:De("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",e?"justify-center p-2.5":"gap-3 px-3 py-2",n===v.id?e?"nav-active-collapsed":"nav-active":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:e?v.label:void 0,"aria-label":e?v.label:void 0,children:[x.jsx(v.icon,{className:"h-4.5 w-4.5 shrink-0","aria-hidden":"true"}),!e&&x.jsx("span",{className:"truncate",children:v.label})]})]},v.id)})})()}),x.jsx("div",{className:De("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",e?"px-2 text-center":"px-5"),children:e?x.jsx("div",{className:"flex justify-center",children:x.jsx("span",{className:De("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",i?i.engine_reachable?i.brain&&!i.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:i?i.engine_reachable?i.brain&&!i.brain.ready?`Hirn offline (${i.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):x.jsxs("div",{className:"space-y-2 text-left",children:[i?x.jsxs(x.Fragment,{children:[x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:De("h-2 w-2 rounded-full animate-pulse",i.engine_reachable?"bg-emerald-500":"bg-amber-500")}),x.jsxs("span",{className:"truncate",children:["Engine ",i.engine_reachable?"online":"offline"]})]}),i.brain&&!i.brain.ready&&x.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${i.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),x.jsxs("span",{className:"truncate",children:["Hirn offline",i.brain.model?` (${i.brain.model})`:""]})]})]}):x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",x.jsx("span",{className:"truncate",children:"Backend offline"})]}),(o==null?void 0:o.versions)&&x.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[x.jsxs("div",{className:"truncate",title:o.versions.mc2?`${o.versions.mc2.branch}-${o.versions.mc2.hash}${o.versions.mc2.dirty?"*":""} (${o.versions.mc2.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"MC2:"})," ",o.versions.mc2?`${o.versions.mc2.hash}${o.versions.mc2.dirty?"*":""}`:"—"]}),x.jsxs("div",{className:"truncate",title:((s=o.versions.engine)==null?void 0:s.type)==="git"?`${o.versions.engine.branch}-${o.versions.engine.hash}${o.versions.engine.dirty?"*":""} (${o.versions.engine.date})`:((u=o.versions.engine)==null?void 0:u.version_text)||"unbekannt",children:[x.jsx("strong",{children:"Engine:"})," ",((d=o.versions.engine)==null?void 0:d.type)==="git"?`${o.versions.engine.hash}${o.versions.engine.dirty?"*":""}`:((h=(f=o.versions.engine)==null?void 0:f.version_text)==null?void 0:h.split(" ").pop())||"—"]}),x.jsxs("div",{className:"truncate",title:o.versions.hermes_agent?`${o.versions.hermes_agent.branch}-${o.versions.hermes_agent.hash}${o.versions.hermes_agent.dirty?"*":""} (${o.versions.hermes_agent.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"Hermes Agent:"})," ",o.versions.hermes_agent?`${o.versions.hermes_agent.hash}${o.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]})}class AQ extends My.Component{constructor(){super(...arguments);Os(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,n){console.error("Unbehandelter UI-Fehler:",r,n.componentStack)}render(){return this.state.error?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-neutral-950 text-neutral-200 p-8",children:x.jsxs("div",{className:"max-w-lg space-y-4 text-center",children:[x.jsx("div",{className:"text-2xl",children:"Da ist etwas schiefgelaufen."}),x.jsx("div",{className:"text-sm text-neutral-400 break-all",children:this.state.error.message}),x.jsx("button",{className:"px-4 py-2 rounded-lg bg-neutral-800 hover:bg-neutral-700 border border-neutral-700",onClick:()=>window.location.reload(),children:"Neu laden"})]})}):this.props.children}}const OQ=new EM({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});ZI.createRoot(document.getElementById("root")).render(x.jsx(My.StrictMode,{children:x.jsx(AQ,{children:x.jsx(PM,{client:OQ,children:x.jsx(PQ,{})})})}));export{wT as $,N3 as A,zy as B,qM as C,D1 as D,Av as E,Js as F,QM as G,oT as H,I3 as I,MQ as J,ST as K,If as L,L1 as M,bT as N,ZM as O,mT as P,Wy as Q,j3 as R,yT as S,eu as T,rT as U,jQ as V,Nf as W,Pu as X,UM as Y,ET as Z,ai as _,DQ as a,Uy as a0,DP as a1,By as a2,iT as a3,P3 as a4,Go as a5,_Q as a6,Fy as a7,A3 as a8,sT as a9,WM as aa,pT as ab,$P as ac,lT as ad,IQ as ae,NQ as af,nT as ag,dT as ah,uf as ai,My as aj,pu as ak,yk as al,C8 as am,jg as an,sk as ao,lk as ap,Iy as aq,MA as b,ke as c,BQ as d,De as e,zQ as f,Me as g,HM as h,$Q as i,x as j,FQ as k,Do as l,jA as m,Lf as n,TQ as o,DR as p,Qe as q,g as r,RP as s,UQ as t,Ly as u,kT as v,GM as w,RQ as x,_3 as y,LQ as z}; diff --git a/frontend/dist/assets/lightbulb-xA-FtqvM.js b/frontend/dist/assets/lightbulb-BDMFIwf9.js similarity index 90% rename from frontend/dist/assets/lightbulb-xA-FtqvM.js rename to frontend/dist/assets/lightbulb-BDMFIwf9.js index 3dbfeb6..929a88e 100644 --- a/frontend/dist/assets/lightbulb-xA-FtqvM.js +++ b/frontend/dist/assets/lightbulb-BDMFIwf9.js @@ -1,4 +1,4 @@ -import{c as t}from"./index-DbrEnusY.js";/** +import{c as t}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/send-CyhU48GF.js b/frontend/dist/assets/send-BF6peil_.js similarity index 90% rename from frontend/dist/assets/send-CyhU48GF.js rename to frontend/dist/assets/send-BF6peil_.js index 25c3bfe..66602ca 100644 --- a/frontend/dist/assets/send-CyhU48GF.js +++ b/frontend/dist/assets/send-BF6peil_.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-DbrEnusY.js";/** +import{c as a}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/zap-Cojq_aI_.js b/frontend/dist/assets/zap-nk89an7Z.js similarity index 97% rename from frontend/dist/assets/zap-Cojq_aI_.js rename to frontend/dist/assets/zap-nk89an7Z.js index 803b82e..904f8cf 100644 --- a/frontend/dist/assets/zap-Cojq_aI_.js +++ b/frontend/dist/assets/zap-nk89an7Z.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-DbrEnusY.js";/** +import{c as a}from"./index-D-OYo7d4.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 416d01e..86f6b29 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/lib/useLucyHealth.ts b/frontend/src/lib/useLucyHealth.ts index d4a718c..be88710 100644 --- a/frontend/src/lib/useLucyHealth.ts +++ b/frontend/src/lib/useLucyHealth.ts @@ -164,16 +164,20 @@ export function useLucyHealth(): LucyHealth { } })()) - // Speicher-Ampel aus dem echten GTT-Pool (unified RAM inkl. KV-Cache). - const total = sys?.gpu?.gtt_total || sys?.gpu?.vram_total || 0 - const used = sys?.gpu?.gtt_used || 0 - const pct = total > 0 ? Math.min(100, (used / total) * 100) : 0 + // Speicher-Ampel = System-RAM, DIESELBE Quelle wie die RAM-Zeile in der + // System-Status-Kachel. Vorher zeigte die Pille den GTT-Pool (GPU-Sicht auf den + // Unified-Memory) — der weicht auf der APU vom System-RAM ab, wodurch „Box gesund" + // und „System-Status" zwei verschiedene Speicher-Zahlen zeigten. Eine Box, eine Zahl. + // Schwellen am RAM-Charakter geeicht: 4 Modelle warm ≈ 78 % gilt als gesund → grün. + const total = sys?.ram?.total ?? 0 + const used = sys?.ram?.used ?? 0 + const pct = sys?.ram?.percent ?? (total > 0 ? Math.min(100, (used / total) * 100) : 0) const B = 1024 ** 3 const memory: MemoryAmpel = !total ? { status: "unknown", usedGb: 0, totalGb: 0, pct: 0, text: "Speicher-Auslastung unbekannt." } - : pct >= 90 + : pct >= 93 ? { status: "full", usedGb: used / B, totalGb: total / B, pct, text: "Speicher fast voll — Lucy könnte langsamer werden." } - : pct >= 72 + : pct >= 85 ? { status: "warn", usedGb: used / B, totalGb: total / B, pct, text: "Speicher gut gefüllt — noch okay." } : { status: "ok", usedGb: used / B, totalGb: total / B, pct, text: "Genug Speicher frei." } diff --git a/frontend/src/views/cockpit/CockpitView.tsx b/frontend/src/views/cockpit/CockpitView.tsx index 5e81e84..2c4c1dd 100644 --- a/frontend/src/views/cockpit/CockpitView.tsx +++ b/frontend/src/views/cockpit/CockpitView.tsx @@ -239,7 +239,7 @@ function StatusLine({ verdict, memory, warns }: { Speicher - {memory.status === "unknown" ? "—" : `${memory.usedGb.toFixed(0)} / ${memory.totalGb.toFixed(0)} GB`} + {memory.status === "unknown" ? "—" : `${memory.usedGb.toFixed(1)} / ${memory.totalGb.toFixed(1)} GB`}