From a261462857fd941a2c44ebc79c519e0579a6d375 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Thu, 9 Jul 2026 12:22:02 +0200 Subject: [PATCH] Fix: d3ReheatSimulation anstelle von unzulaessigem alpha.restart aufgerufen (behebt 'alpha is not a function' Fehler) --- .../assets/{GraphView-Ce-iMRLX.js => GraphView-Cbw5_PCb.js} | 4 ++-- frontend/dist/assets/{index-BcsTzr2v.js => index-DNXEzn-Z.js} | 2 +- frontend/dist/index.html | 2 +- frontend/src/views/GraphView.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename frontend/dist/assets/{GraphView-Ce-iMRLX.js => GraphView-Cbw5_PCb.js} (96%) rename frontend/dist/assets/{index-BcsTzr2v.js => index-DNXEzn-Z.js} (99%) diff --git a/frontend/dist/assets/GraphView-Ce-iMRLX.js b/frontend/dist/assets/GraphView-Cbw5_PCb.js similarity index 96% rename from frontend/dist/assets/GraphView-Ce-iMRLX.js rename to frontend/dist/assets/GraphView-Cbw5_PCb.js index 6d04b31..73075af 100644 --- a/frontend/dist/assets/GraphView-Ce-iMRLX.js +++ b/frontend/dist/assets/GraphView-Cbw5_PCb.js @@ -1,4 +1,4 @@ -import{i as It,r as Z,R as qi,c as $n,a as Fn,b as Gi,o as Vi,m as Un,d as Ln,g as Wi,j as G,e as Bi,S as Xi,f as Hn,T as Yi}from"./index-BcsTzr2v.js";function Zi(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var qn=180/Math.PI,nn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fr(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:It(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:It(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,p,y){if(l!==h||c!==d){var x=p.push(o(p)+"scale(",null,",",null,")");y.push({i:x-4,x:It(l,h)},{i:x-2,x:It(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,x=d.length,b;++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:It(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:It(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,p,y){if(l!==h||c!==d){var x=p.push(o(p)+"scale(",null,",",null,")");y.push({i:x-4,x:It(l,h)},{i:x-2,x:It(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,x=d.length,b;++ye.length)&&(n=e.length);for(var r=0,i=new Array(n);ra,methodNames:i=[],initPropNames:o=[]}={}){return Z.forwardRef((a,s)=>{const u=Z.useRef(),f=Z.useMemo(()=>{const h=Object.fromEntries(o.filter(d=>a.hasOwnProperty(d)).map(d=>[d,a[d]]));return e(h)},[]);Wn(()=>{f(r(u.current))},Z.useLayoutEffect),Wn(()=>f._destructor instanceof Function?f._destructor:void 0);const l=Z.useCallback((h,...d)=>f[h]instanceof Function?f[h](...d):void 0,[f]),c=Z.useRef({});return Object.keys(yo(a,[...i,...o])).filter(h=>c.current[h]!==a[h]).forEach(h=>l(h,a[h])),c.current=a,Z.useImperativeHandle(s,()=>Object.fromEntries(i.map(h=>[h,(...d)=>l(h,...d)])),[l]),qi.createElement(n,{ref:u})})}function Wn(e,n=Z.useEffect){const r=Z.useRef(),i=Z.useRef(!1),o=Z.useRef(!1),[a,s]=Z.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 on="http://www.w3.org/1999/xhtml";const Bn={svg:"http://www.w3.org/2000/svg",xhtml:on,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Bn.hasOwnProperty(n)?{space:Bn[n],local:e}:e}function vo(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===on&&n.documentElement.namespaceURI===on?n.createElement(e):n.createElementNS(r,e)}}function mo(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hr(e){var n=De(e);return(n.local?mo:vo)(n)}function bo(){}function bn(e){return e==null?bo:function(){return this.querySelector(e)}}function xo(e){typeof e!="function"&&(e=bn(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o=v&&(v=k+1);!(m=b[v])&&++v=0;)(s=i[o])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function Wo(e){e||(e=Bo);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 Xo(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Yo(){return Array.from(this)}function Zo(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?sa:typeof n=="function"?la:ua)(e,n,r??"")):Ht(this.node(),e)}function Ht(e,n){return e.style.getPropertyValue(n)||Br(e).getComputedStyle(e,null).getPropertyValue(n)}function ca(e){return function(){delete this[e]}}function ha(e,n){return function(){this[e]=n}}function da(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function pa(e,n){return arguments.length>1?this.each((n==null?ca:typeof n=="function"?da:ha)(e,n)):this.node()[e]}function Xr(e){return e.trim().split(/^|\s+/)}function xn(e){return e.classList||new Yr(e)}function Yr(e){this._node=e,this._names=Xr(e.getAttribute("class")||"")}Yr.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 Zr(e,n){for(var r=xn(e),i=-1,o=n.length;++i=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function Ha(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,a;r{}};function ce(){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}})}ve.prototype=ce.prototype={constructor:ve,on:function(e,n){var r=this._,i=Qa(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 an(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}})}an.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function es(e){return!e.ctrlKey&&!e.button}function ns(){return this.parentNode}function rs(e,n){return n??{x:e.x,y:e.y}}function is(){return navigator.maxTouchPoints||"ontouchstart"in this}function os(){var e=es,n=ns,r=rs,i=is,o={},a=ce("start","drag","end"),s=0,u,f,l,c,h=0;function d(_){_.on("mousedown.drag",p).filter(i).on("touchstart.drag",b).on("touchmove.drag",g,ts).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,m){if(!(c||!e.call(this,_,m))){var A=v(this,n.call(this,_,m),_,m,"mouse");A&&(st(_.view).on("mousemove.drag",y,se).on("mouseup.drag",x,se),ti(_.view),Ge(_),l=!1,u=_.clientX,f=_.clientY,A("start",_))}}function y(_){if(Lt(_),!l){var m=_.clientX-u,A=_.clientY-f;l=m*m+A*A>h}o.mouse("drag",_)}function x(_){st(_.view).on("mousemove.drag mouseup.drag",null),ei(_.view,l),Lt(_),o.mouse("end",_)}function b(_,m){if(e.call(this,_,m)){var A=_.changedTouches,S=n.call(this,_,m),T=A.length,z,M;for(z=0;z=0&&e._call.call(void 0,n),e=e._next;--qt}function Yn(){jt=(Se=ue.now())+je,qt=Jt=0;try{ss()}finally{qt=0,ls(),jt=0}}function us(){var e=ue.now(),n=e-Se;n>ni&&(je-=n,Se=e)}function ls(){for(var e,n=Ce,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:Ce=r);te=e,sn(i)}function sn(e){if(!qt){Jt&&(Jt=clearTimeout(Jt));var n=e-jt;n>24?(e<1/0&&(Jt=setTimeout(Yn,e-ue.now()-je)),Vt&&(Vt=clearInterval(Vt))):(Vt||(Se=ue.now(),Vt=setInterval(us,ni)),qt=1,ri(Yn))}}function Zn(e,n,r){var i=new Te;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var fs=ce("start","end","cancel","interrupt"),cs=[],ii=0,Kn=1,un=2,me=3,Qn=4,ln=5,be=6;function $e(e,n,r,i,o,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;hs(e,r,{name:n,index:i,group:o,on:fs,tween:cs,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ii})}function An(e,n){var r=dt(e,n);if(r.state>ii)throw new Error("too late; already scheduled");return r}function mt(e,n){var r=dt(e,n);if(r.state>me)throw new Error("too late; already running");return r}function dt(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function hs(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=kn(a,0,r.time);function a(l){r.state=Kn,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!==Kn)return f();for(c in i)if(p=i[c],p.name===r.name){if(p.state===me)return Zn(s);p.state===Qn?(p.state=be,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[c]):+cun&&i.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function Hs(e,n,r){var i,o,a=Ls(n)?An:mt;return function(){var s=a(this,e),u=s.on;u!==i&&(o=(i=u).copy()).on(n,r),s.on=o}}function qs(e,n){var r=this._id;return arguments.length<2?dt(this.node(),r).on.on(e):this.each(Hs(r,e,n))}function Gs(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function Vs(){return this.on("end.remove",Gs(this._id))}function Ws(e){var n=this._name,r=this._id;typeof e!="function"&&(e=bn(e));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s()=>e;function _u(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 Tt(e,n,r){this.k=e,this.x=n,this.y=r}Tt.prototype={constructor:Tt,scale:function(e){return e===1?this:new Tt(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Tt(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 Sn=new Tt(1,0,0);pt.prototype=Tt.prototype;function pt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Sn;return e.__zoom}function Ve(e){e.stopImmediatePropagation()}function Wt(e){e.preventDefault(),e.stopImmediatePropagation()}function vu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function mu(){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 Jn(){return this.__zoom||Sn}function bu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function xu(){return navigator.maxTouchPoints||"ontouchstart"in this}function wu(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 ku(){var e=vu,n=mu,r=wu,i=bu,o=xu,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],u=250,f=io,l=ce("start","zoom","end"),c,h,d,p=500,y=150,x=0,b=10;function g(C){C.property("__zoom",Jn).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",M).filter(o).on("touchstart.zoom",O).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(C,R,P,I){var U=C.selection?C.selection():C;U.property("__zoom",Jn),C!==U?m(C,R,P,I):U.interrupt().each(function(){A(this,arguments).event(I).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},g.scaleBy=function(C,R,P,I){g.scaleTo(C,function(){var U=this.__zoom.k,D=typeof R=="function"?R.apply(this,arguments):R;return U*D},P,I)},g.scaleTo=function(C,R,P,I){g.transform(C,function(){var U=n.apply(this,arguments),D=this.__zoom,$=P==null?_(U):typeof P=="function"?P.apply(this,arguments):P,L=D.invert($),H=typeof R=="function"?R.apply(this,arguments):R;return r(v(k(D,H),$,L),U,s)},P,I)},g.translateBy=function(C,R,P,I){g.transform(C,function(){return r(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof P=="function"?P.apply(this,arguments):P),n.apply(this,arguments),s)},null,I)},g.translateTo=function(C,R,P,I,U){g.transform(C,function(){var D=n.apply(this,arguments),$=this.__zoom,L=I==null?_(D):typeof I=="function"?I.apply(this,arguments):I;return r(Sn.translate(L[0],L[1]).scale($.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof P=="function"?-P.apply(this,arguments):-P),D,s)},I,U)};function k(C,R){return R=Math.max(a[0],Math.min(a[1],R)),R===C.k?C:new Tt(R,C.x,C.y)}function v(C,R,P){var I=R[0]-P[0]*C.k,U=R[1]-P[1]*C.k;return I===C.x&&U===C.y?C:new Tt(C.k,I,U)}function _(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function m(C,R,P,I){C.on("start.zoom",function(){A(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(I).end()}).tween("zoom",function(){var U=this,D=arguments,$=A(U,D).event(I),L=n.apply(U,D),H=P==null?_(L):typeof P=="function"?P.apply(U,D):P,q=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),K=U.__zoom,lt=typeof R=="function"?R.apply(U,D):R,bt=f(K.invert(H).concat(q/K.k),lt.invert(H).concat(q/lt.k));return function(ft){if(ft===1)ft=lt;else{var xt=bt(ft),qe=q/xt[2];ft=new Tt(qe,H[0]-xt[0]*qe,H[1]-xt[1]*qe)}$.zoom(null,ft)}})}function A(C,R,P){return!P&&C.__zooming||new S(C,R)}function S(C,R){this.that=C,this.args=R,this.active=0,this.sourceEvent=null,this.extent=n.apply(C,R),this.taps=0}S.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,R){return this.mouse&&C!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var R=st(this.that).datum();l.call(C,this.that,new _u(C,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:l}),R)}};function T(C,...R){if(!e.apply(this,arguments))return;var P=A(this,R).event(C),I=this.__zoom,U=Math.max(a[0],Math.min(a[1],I.k*Math.pow(2,i.apply(this,arguments)))),D=gt(C);if(P.wheel)(P.mouse[0][0]!==D[0]||P.mouse[0][1]!==D[1])&&(P.mouse[1]=I.invert(P.mouse[0]=D)),clearTimeout(P.wheel);else{if(I.k===U)return;P.mouse=[D,I.invert(D)],xe(this),P.start()}Wt(C),P.wheel=setTimeout($,y),P.zoom("mouse",r(v(k(I,U),P.mouse[0],P.mouse[1]),P.extent,s));function $(){P.wheel=null,P.end()}}function z(C,...R){if(d||!e.apply(this,arguments))return;var P=C.currentTarget,I=A(this,R,!0).event(C),U=st(C.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",q,!0),D=gt(C,P),$=C.clientX,L=C.clientY;ti(C.view),Ve(C),I.mouse=[D,this.__zoom.invert(D)],xe(this),I.start();function H(K){if(Wt(K),!I.moved){var lt=K.clientX-$,bt=K.clientY-L;I.moved=lt*lt+bt*bt>x}I.event(K).zoom("mouse",r(v(I.that.__zoom,I.mouse[0]=gt(K,P),I.mouse[1]),I.extent,s))}function q(K){U.on("mousemove.zoom mouseup.zoom",null),ei(K.view,I.moved),Wt(K),I.event(K).end()}}function M(C,...R){if(e.apply(this,arguments)){var P=this.__zoom,I=gt(C.changedTouches?C.changedTouches[0]:C,this),U=P.invert(I),D=P.k*(C.shiftKey?.5:2),$=r(v(k(P,D),I,U),n.apply(this,R),s);Wt(C),u>0?st(this).transition().duration(u).call(m,$,I,C):st(this).call(g.transform,$,I,C)}}function O(C,...R){if(e.apply(this,arguments)){var P=C.touches,I=P.length,U=A(this,R,C.changedTouches.length===I).event(C),D,$,L,H;for(Ve(C),$=0;$=n||S<0||h&&T>=a}function g(){var A=We();if(b(A))return k(A);u=setTimeout(g,x(A))}function k(A){return u=void 0,d&&i?p(A):(i=o=void 0,s)}function v(){u!==void 0&&clearTimeout(u),l=0,i=f=o=u=void 0}function _(){return u===void 0?s:k(We())}function m(){var A=We(),S=b(A);if(i=arguments,o=this,f=A,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 m.cancel=v,m.flush=_,m}var Yu="Expected a function";function Zu(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(Yu);return Pe(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),fi(e,n,{leading:i,maxWait:n,trailing:o})}var Dt=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-Dt.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?Dt.Bounce.In(e*2)*.5:Dt.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}}}}),ee=function(){return performance.now()},ci=(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=ee()),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}}},hi=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),cn=new ci,rr=(function(){function e(n,r){r===void 0&&(r=cn),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=Dt.Linear.None,this._interpolationFunction=fn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=hi.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=ee()),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=ee()),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=ee()),!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 b=Math.trunc(u/f),g=u-b*f,k=Math.min(g/i._duration,1);return k===0&&u===i._duration?1:k},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,x=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 F(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(gl,arguments)},brighten:function(){return this._applyModification(yl,arguments)},darken:function(){return this._applyModification(_l,arguments)},desaturate:function(){return this._applyModification(hl,arguments)},saturate:function(){return this._applyModification(dl,arguments)},greyscale:function(){return this._applyModification(pl,arguments)},spin:function(){return this._applyModification(vl,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(xl,arguments)},complement:function(){return this._applyCombination(ml,arguments)},monochromatic:function(){return this._applyCombination(wl,arguments)},splitcomplement:function(){return this._applyCombination(bl,arguments)},triad:function(){return this._applyCombination(lr,[3])},tetrad:function(){return this._applyCombination(lr,[4])}};F.fromRatio=function(e,n){if(Oe(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=ne(e[i]));e=r}return F(e,n)};function sl(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=Tl(e)),Oe(e)=="object"&&(kt(e.r)&&kt(e.g)&&kt(e.b)?(n=ul(e.r,e.g,e.b),s=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):kt(e.h)&&kt(e.s)&&kt(e.v)?(i=ne(e.s),o=ne(e.v),n=fl(e.h,i,o),s=!0,u="hsv"):kt(e.h)&&kt(e.s)&&kt(e.l)&&(i=ne(e.s),a=ne(e.l),n=ll(e.h,i,a),s=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=di(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 ul(e,n,r){return{r:X(e,255)*255,g:X(n,255)*255,b:X(r,255)*255}}function or(e,n,r){e=X(e,255),n=X(n,255),r=X(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 ar(e,n,r){e=X(e,255),n=X(n,255),r=X(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(F(i));return a}function wl(e,n){n=n||6;for(var r=F(e).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/n;n--;)s.push(F({h:i,s:o,v:a})),a=(a+u)%1;return s}F.mix=function(e,n,r){r=r===0?0:r||50;var i=F(e).toRgb(),o=F(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 F(s)};F.readability=function(e,n){var r=F(e),i=F(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};F.isReadable=function(e,n,r){var i=F.readability(e,n),o,a;switch(a=!1,o=Ml(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};F.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=F(n[l]));return F.isReadable(e,i,{level:u,size:f})||!s?i:(r.includeFallbackColors=!1,F.mostReadable(e,["#fff","#000"],r))};var hn=F.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"},kl=F.hexNames=Al(hn);function Al(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function di(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function X(e,n){Cl(e)&&(e="100%");var r=Sl(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 Fe(e){return Math.min(1,Math.max(0,e))}function rt(e){return parseInt(e,16)}function Cl(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Sl(e){return typeof e=="string"&&e.indexOf("%")!=-1}function ht(e){return e.length==1?"0"+e:""+e}function ne(e){return e<=1&&(e=e*100+"%"),e}function pi(e){return Math.round(parseFloat(e)*255).toString(16)}function fr(e){return rt(e)/255}var ct=(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 kt(e){return!!ct.CSS_UNIT.exec(e)}function Tl(e){e=e.replace(ol,"").replace(al,"").toLowerCase();var n=!1;if(hn[e])e=hn[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=ct.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=ct.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=ct.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=ct.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=ct.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=ct.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=ct.hex8.exec(e))?{r:rt(r[1]),g:rt(r[2]),b:rt(r[3]),a:fr(r[4]),format:n?"name":"hex8"}:(r=ct.hex6.exec(e))?{r:rt(r[1]),g:rt(r[2]),b:rt(r[3]),format:n?"name":"hex"}:(r=ct.hex4.exec(e))?{r:rt(r[1]+""+r[1]),g:rt(r[2]+""+r[2]),b:rt(r[3]+""+r[3]),a:fr(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=ct.hex3.exec(e))?{r:rt(r[1]+""+r[1]),g:rt(r[2]+""+r[2]),b:rt(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function Ml(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 dn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);re.length)&&(n=e.length);for(var r=0,i=Array(n);r2&&arguments[2]!==void 0?arguments[2]:{},a=o.nodeFilter,s=a===void 0?function(){return!0}:a,u=o.onLoopError,f=u===void 0?function(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:u,l={};r.forEach(function(p){return l[n(p)]={data:p,out:[],depth:-1,skip:!s(p)}}),i.forEach(function(p){var y=p.source,x=p.target,b=_(y),g=_(x);if(!l.hasOwnProperty(b))throw"Missing source node with id: ".concat(b);if(!l.hasOwnProperty(g))throw"Missing target node with id: ".concat(g);var k=l[b],v=l[g];k.out.push(v);function _(m){return mn(m)==="object"?n(m):m}});var c=[];d(Object.values(l));var h=Object.assign.apply(Object,[{}].concat(ut(Object.entries(l).filter(function(p){var y=ae(p,2),x=y[1];return!x.skip}).map(function(p){var y=ae(p,2),x=y[0],b=y[1];return le({},x,b.depth)}))));return h;function d(p){for(var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,b=function(){var _=p[g];if(y.indexOf(_)!==-1){var m=[].concat(ut(y.slice(y.indexOf(_))),[_]).map(function(A){return n(A.data)});return c.some(function(A){return A.length===m.length&&A.every(function(S,T){return S===m[T]})})||(c.push(m),f(m)),1}x>_.depth&&(_.depth=x,d(_.out,[].concat(ut(y),[_]),x+(_.skip?0:1)))},g=0,k=p.length;gn.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()0){var N=Math.atan2(M.y-z.y,M.x-z.x),j=O*T,C={x:(z.x+M.x)/2+j*Math.cos(N-Math.PI/2),y:(z.y+M.y)/2+j*Math.sin(N-Math.PI/2)};S.__controlPoints=[C.x,C.y]}else{var R=T*70;S.__controlPoints=[M.x,M.y-R,M.x+R,M.y]}}}}function a(){var u=1.6,f=.2,l=V(n.linkDirectionalArrowLength),c=V(n.linkDirectionalArrowRelPos),h=V(n.linkVisibility),d=V(n.linkDirectionalArrowColor||n.linkColor),p=V(n.nodeVal),y=n.ctx;y.save(),n.graphData.links.filter(h).forEach(function(x){var b=l(x);if(!(!b||b<0)){var g=x.source,k=x.target;if(!(!g||!k||!g.hasOwnProperty("x")||!k.hasOwnProperty("x"))){var v=Math.sqrt(Math.max(0,p(g)||1))*n.nodeRelSize,_=Math.sqrt(Math.max(0,p(k)||1))*n.nodeRelSize,m=Math.min(1,Math.max(0,c(x))),A=d(x)||"rgba(0,0,0,0.28)",S=b/u/2,T=x.__controlPoints&&Pr(B,[g.x,g.y].concat(ut(x.__controlPoints),[k.x,k.y])),z=T?function(P){return T.get(P)}:function(P){return{x:g.x+(k.x-g.x)*P||0,y:g.y+(k.y-g.y)*P||0}},M=T?T.length():Math.sqrt(Math.pow(k.x-g.x,2)+Math.pow(k.y-g.y,2)),O=v+b+(M-v-_-b)*m,N=z(O/M),j=z((O-b)/M),C=z((O-b*(1-f))/M),R=Math.atan2(N.y-j.y,N.x-j.x)-Math.PI/2;y.beginPath(),y.moveTo(N.x,N.y),y.lineTo(j.x+S*Math.cos(R),j.y+S*Math.sin(R)),y.lineTo(C.x,C.y),y.lineTo(j.x-S*Math.cos(R),j.y-S*Math.sin(R)),y.fillStyle=A,y.fill()}}}),y.restore()}function s(){var u=V(n.linkDirectionalParticles),f=V(n.linkDirectionalParticleSpeed),l=V(n.linkDirectionalParticleOffset),c=V(n.linkDirectionalParticleWidth),h=V(n.linkVisibility),d=V(n.linkDirectionalParticleColor||n.linkColor),p=n.ctx;p.save(),n.graphData.links.filter(h).forEach(function(y){var x=u(y);if(!(!y.hasOwnProperty("__photons")||!y.__photons.length)){var b=y.source,g=y.target;if(!(!b||!g||!b.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var k=f(y),v=Math.abs(l(y)),_=y.__photons||[],m=Math.max(0,c(y)/2)/Math.sqrt(n.globalScale),A=d(y)||"rgba(0,0,0,0.28)";p.fillStyle=A;var S=y.__controlPoints?Pr(B,[b.x,b.y].concat(ut(y.__controlPoints),[g.x,g.y])):null,T=0,z=!1;_.forEach(function(M){var O=!!M.__singleHop;if(M.hasOwnProperty("__progressRatio")||(M.__progressRatio=O?k<0?1:0:(T+v)/x),!O&&T++,M.__progressRatio+=k,M.__progressRatio>=1||M.__progressRatio<0)if(!O)M.__progressRatio=M.__progressRatio%1,M.__progressRatio<0&&M.__progressRatio++;else{z=!0;return}var N=M.__progressRatio,j=S?S.get(N):{x:b.x+(g.x-b.x)*N||0,y:b.y+(g.y-b.y)*N||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(j.x,j.y,y,p,n.globalScale):(p.beginPath(),p.arc(j.x,j.y,m,0,2*Math.PI,!1),p.fill())}),z&&(y.__photons=y.__photons.filter(function(M){return!M.__singleHop||M.__progressRatio<=1&&M.__progressRatio>=0}))}}}),p.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:mc().force("link",cc()).force("charge",bc()).force("center",df()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Er(n.graphData.nodes,V(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Er(n.graphData.links,V(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(d){d.source=d[n.linkSource],d.target=d[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(d){return d[n.nodeId]}).links(n.graphData.links);var o=n.dagMode&&eh(n.graphData,function(d){return d[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,ut(Object.values(o||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*nh*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var u=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return delete d[u]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var f=["rl","bu"].includes(n.dagMode),l=function(p){return(o[p[n.nodeId]]-a/2)*s*(f?-1:1)},c=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return d[c]=l(d)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?xc(function(d){var p=o[d[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-p:p)*s}).strength(function(d){return n.dagNodeFilter(d)?1:0}):null);for(var h=0;h0&&n.forceLayout.alpha()1?u-1:0),l=1;l1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,a=new Array(o>3?o-3:0),s=3;s1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=V(n.nodeVal),o=function(u){return Math.sqrt(Math.max(0,i(u)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(r).map(function(s){return{x:s.x,y:s.y,r:o(s)}});return a.length?{x:[Un(a,function(s){return s.x-s.r}),Ln(a,function(s){return s.x+s.r})],y:[Un(a,function(s){return s.y-s.r}),Ln(a,function(s){return s.y+s.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},uh),stateInit:function(){return{lastSetZoom:1,zoom:ku(),forceGraph:new Ie,shadowGraph:new Ie().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new ql,tweenGroup:new ci}},init:function(n,r){var i=this;n.innerHTML="";var o=document.createElement("div");o.classList.add("force-graph-container"),o.style.position="relative",n.appendChild(o),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),o.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var a=r.canvas.getContext("2d"),s=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),u={x:-1e12,y:-1e12},f=function(){var h=null,d=window.devicePixelRatio,p=u.x>0&&u.y>0?s.getImageData(u.x*d,u.y*d,1,1):null;return p&&(h=r.colorTracker.lookup(p.data)),h};st(r.canvas).call(os().subject(function(){if(!r.enableNodeDrag)return null;var c=f();return c&&c.type==="Node"?c.d:null}).on("start",function(c){var h=c.subject;h.__initialDragPos={x:h.x,y:h.y,fx:h.fx,fy:h.fy},c.active||(h.fx=h.x,h.fy=h.y),r.canvas.classList.add("grabbable")}).on("drag",function(c){var h=c.subject,d=h.__initialDragPos,p=c,y=pt(r.canvas).k,x={x:d.x+(p.x-d.x)/y-h.x,y:d.y+(p.y-d.y)/y-h.y};["x","y"].forEach(function(b){return h["f".concat(b)]=h[b]=d[b]+(p[b]-d[b])/y}),!(!h.__dragged&&oh>=Math.sqrt(Zi(["x","y"].map(function(b){return Math.pow(c[b]-d[b],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,h.__dragged=!0,r.onNodeDrag(h,x))}).on("end",function(c){var h=c.subject,d=h.__initialDragPos,p={x:h.x-d.x,y:h.y-d.y};d.fx===void 0&&(h.fx=void 0),d.fy===void 0&&(h.fy=void 0),delete h.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,h.__dragged&&(delete h.__dragged,r.onNodeDragEnd(h,p))})),r.zoom(r.zoom.__baseElem=st(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(c){return!c.button&&r.enableZoomPanInteraction&&(c.type!=="wheel"||V(r.enableZoomInteraction)(c))&&(c.type==="wheel"||V(r.enablePanInteraction)(c))}).on("zoom",function(c){var h=c.transform;[a,s].forEach(function(d){Li(d),d.translate(h.x,h.y),d.scale(h.k,h.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Ft(Ft({},h),i.centerAt())),r.needsRedraw=!0}).on("end",function(c){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Ft(Ft({},c.transform),i.centerAt()))}),Ke(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){pt(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=ih/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new hf(o),["pointermove","pointerdown"].forEach(function(c){return o.addEventListener(c,function(h){c==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=h),!r.isPointerDragging&&h.type==="pointermove"&&r.onBackgroundClick&&(h.pressure>0||r.isPointerPressed)&&(h.pointerType==="mouse"||h.movementX===void 0||[h.movementX,h.movementY].some(function(y){return Math.abs(y)>1}))&&(r.isPointerDragging=!0);var d=p(o);u.x=h.pageX-d.left,u.y=h.pageY-d.top;function p(y){var x=y.getBoundingClientRect(),b=window.pageXOffset||document.documentElement.scrollLeft,g=window.pageYOffset||document.documentElement.scrollTop;return{top:x.top+g,left:x.left+b}}},{passive:!0})}),o.addEventListener("pointerup",function(c){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var h=[c,r.pointerDownEvent];requestAnimationFrame(function(){if(c.button===0)if(r.hoverObj){var d=r["on".concat(r.hoverObj.type,"Click")];d&&d.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,h);if(c.button===2)if(r.hoverObj){var p=r["on".concat(r.hoverObj.type,"RightClick")];p&&p.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,h)})}},{passive:!0}),o.addEventListener("contextmenu",function(c){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(c.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(s);var l=Zu(function(){Rr(s,r.width,r.height),r.shadowGraph.linkWidth(function(h){return V(r.linkWidth)(h)+r.linkHoverPrecision});var c=pt(r.canvas);r.shadowGraph.globalScale(c.k).tickFrame()},rh);r.flushShadowCanvas=l.flush,(this._animationCycle=function c(){var h=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(v){return v.__photons&&v.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var d=r.isPointerDragging?null:f();if(d!==r.hoverObj){var p=r.hoverObj,y=p?p.type:null,x=d?d.type:null;if(y&&y!==x){var b=r["on".concat(y,"Hover")];b&&b(null,p.d)}if(x){var g=r["on".concat(x,"Hover")];g&&g(d.d,y===x?p.d:null)}r.tooltip.content(d&&V(r["".concat(d.type.toLowerCase(),"Label")])(d.d)||null),r.canvas.classList[(d&&r["on".concat(x,"Click")]||!d&&r.onBackgroundClick)&&V(r.showPointerCursor)(d==null?void 0:d.d)?"add":"remove"]("clickable"),r.hoverObj=d}h&&l()}if(h){Rr(a,r.width,r.height);var k=pt(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,k),r.forceGraph.globalScale(k).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,k)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(c)})()},update:function(n){}}),Qe={exports:{}},Je,Nr;function fh(){if(Nr)return Je;Nr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Je=e,Je}var tn,Ir;function ch(){if(Ir)return tn;Ir=1;var e=fh();function n(){}function r(){}return r.resetWarningCache=n,tn=function(){function i(s,u,f,l,c,h){if(h!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}i.isRequired=i;function o(){return i}var a={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:o,element:i,elementType:i,instanceOf:o,node:i,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:n};return a.PropTypes=a,a},tn}var Dr;function hh(){return Dr||(Dr=1,Qe.exports=ch()()),Qe.exports}var dh=hh();const w=Wi(dh),He={width:w.number,height:w.number,graphData:w.shape({nodes:w.arrayOf(w.object).isRequired,links:w.arrayOf(w.object).isRequired}),backgroundColor:w.string,nodeRelSize:w.number,nodeId:w.string,nodeLabel:w.oneOfType([w.string,w.func]),nodeVal:w.oneOfType([w.number,w.string,w.func]),nodeVisibility:w.oneOfType([w.bool,w.string,w.func]),nodeColor:w.oneOfType([w.string,w.func]),nodeAutoColorBy:w.oneOfType([w.string,w.func]),onNodeHover:w.func,onNodeClick:w.func,linkSource:w.string,linkTarget:w.string,linkLabel:w.oneOfType([w.string,w.func]),linkVisibility:w.oneOfType([w.bool,w.string,w.func]),linkColor:w.oneOfType([w.string,w.func]),linkAutoColorBy:w.oneOfType([w.string,w.func]),linkWidth:w.oneOfType([w.number,w.string,w.func]),linkCurvature:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowLength:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowColor:w.oneOfType([w.string,w.func]),linkDirectionalArrowRelPos:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticles:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleSpeed:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleOffset:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleWidth:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleColor:w.oneOfType([w.string,w.func]),onLinkHover:w.func,onLinkClick:w.func,dagMode:w.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:w.number,dagNodeFilter:w.func,onDagError:w.func,d3AlphaMin:w.number,d3AlphaDecay:w.number,d3VelocityDecay:w.number,warmupTicks:w.number,cooldownTicks:w.number,cooldownTime:w.number,onEngineTick:w.func,onEngineStop:w.func,getGraphBbox:w.func},Hi={zoomToFit:w.func,onNodeRightClick:w.func,onNodeDrag:w.func,onNodeDragEnd:w.func,onLinkRightClick:w.func,linkHoverPrecision:w.number,onBackgroundClick:w.func,onBackgroundRightClick:w.func,showPointerCursor:w.oneOfType([w.bool,w.func]),enablePointerInteraction:w.bool,enableNodeDrag:w.bool},Dn={showNavInfo:w.bool,nodeOpacity:w.number,nodeResolution:w.number,nodeThreeObject:w.oneOfType([w.object,w.string,w.func]),nodeThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),nodePositionUpdate:w.func,linkOpacity:w.number,linkResolution:w.number,linkCurveRotation:w.oneOfType([w.number,w.string,w.func]),linkMaterial:w.oneOfType([w.object,w.string,w.func]),linkThreeObject:w.oneOfType([w.object,w.string,w.func]),linkThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),linkPositionUpdate:w.func,linkDirectionalArrowResolution:w.number,linkDirectionalParticleResolution:w.number,linkDirectionalParticleThreeObject:w.oneOfType([w.object,w.string,w.func]),forceEngine:w.oneOf(["d3","ngraph"]),ngraphPhysics:w.object,numDimensions:w.oneOf([1,2,3])},ph=Object.assign({},He,Hi,{linkLineDash:w.oneOfType([w.arrayOf(w.number),w.string,w.func]),nodeCanvasObjectMode:w.oneOfType([w.string,w.func]),nodeCanvasObject:w.func,nodePointerAreaPaint:w.func,linkCanvasObjectMode:w.oneOfType([w.string,w.func]),linkCanvasObject:w.func,linkPointerAreaPaint:w.func,linkDirectionalParticleCanvasObject:w.func,autoPauseRedraw:w.bool,minZoom:w.number,maxZoom:w.number,enableZoomInteraction:w.oneOfType([w.bool,w.func]),enablePanInteraction:w.oneOfType([w.bool,w.func]),onZoom:w.func,onZoomEnd:w.func,onRenderFramePre:w.func,onRenderFramePost:w.func});Object.assign({},He,Hi,Dn,{enableNavigationControls:w.bool,controlType:w.oneOf(["trackball","orbit","fly"]),rendererConfig:w.object,extraRenderers:w.arrayOf(w.shape({render:w.func.isRequired}))});Object.assign({},He,Dn,{nodeDesc:w.oneOfType([w.string,w.func]),linkDesc:w.oneOfType([w.string,w.func])});Object.assign({},He,Dn,{markerAttrs:w.object,yOffset:w.number,glScale:w.number});const jn=_o(lh,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});jn.displayName="ForceGraph2D";jn.propTypes=ph;function _t(e){return function(){return e}}function jr(e){return(e()-.5)*1e-6}function gh(e){return e.x+e.vx}function yh(e){return e.y+e.vy}function _h(e){var n,r,i,o=1,a=1;typeof e!="function"&&(e=_t(e==null?1:+e));function s(){for(var l,c=n.length,h,d,p,y,x,b,g=0;gd.index){var O=p-T.x-T.vx,N=y-T.y-T.vy,j=O*O+N*N;jp+M||Ay+M||Sl.r&&(l.r=l[c].r)}function f(){if(n){var l,c=n.length,h;for(r=new Array(c),l=0;l{if(!s.current)return;const v=new ResizeObserver(_=>{for(let m of _)m.contentRect.width>0&&m.contentRect.height>0&&l({width:Math.floor(m.contentRect.width),height:Math.floor(m.contentRect.height)})});return v.observe(s.current),()=>v.disconnect()},[]);const c=Z.useMemo(()=>({nodes:e.nodes.map(v=>({...v})),links:e.edges.map(v=>({source:v.source,target:v.target,weight:v.weight||0}))}),[e]),h=Z.useMemo(()=>{const v={};return e.edges.forEach(_=>{v[_.source]=(v[_.source]||0)+1,v[_.target]=(v[_.target]||0)+1}),v},[e]),d=v=>({identity:-160,knowledge:160,rules:-160,events:160})[v]||0,p=v=>({identity:-160,knowledge:-160,rules:160,events:160})[v]||0;Z.useEffect(()=>{const v=u.current;if(!v)return;v.d3Force("x",vh().x(A=>d(A.category)).strength(.14)),v.d3Force("y",mh().y(A=>p(A.category)).strength(.14)),v.d3Force("collide",_h().radius(A=>{const S=h[A.id]||0;return 28+Math.min(S,12)*1.5}).iterations(2));const _=v.d3Force("charge");_&&_.strength(-60);const m=v.d3Force("link");m&&m.distance(50),v.alpha(.8).restart()},[c]);const y=o||r,x=()=>{u.current&&u.current.zoomToFit(400,40)},b=r?e.nodes.find(v=>v.id===r)??null:null,g=Z.useMemo(()=>{if(!r)return[];const v=new Set;return e.edges.forEach(_=>{_.source===r&&v.add(_.target),_.target===r&&v.add(_.source)}),e.nodes.filter(_=>v.has(_.id))},[r,e]),k=Z.useMemo(()=>{if(!y)return new Set;const v=new Set;return e.edges.forEach(_=>{_.source===y&&v.add(_.target),_.target===y&&v.add(_.source)}),v},[y,e]);return e.nodes.length?G.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-3",children:[G.jsxs("div",{className:"relative h-[calc(100vh-13rem)] min-h-[560px] rounded-2xl border border-border/60 overflow-hidden",ref:s,style:{background:"radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, #030712 100%)"},children:[G.jsx(jn,{ref:u,width:f.width,height:f.height,graphData:c,backgroundColor:"rgba(0,0,0,0)",nodeRelSize:4,cooldownTicks:120,onNodeClick:v=>i(v.id),onBackgroundClick:()=>i(null),onNodeHover:v=>{a(v?v.id:null),s.current&&(s.current.style.cursor=v?"pointer":"default")},linkColor:v=>{const _=typeof v.source=="object"?v.source.id:v.source,m=typeof v.target=="object"?v.target.id:v.target;if(y===_||y===m)return bh;if(y)return xh;const A=c.nodes.find(T=>T.id===_),S=A?Ut[A.category]:"#64748b";return wh(S,.16)},linkWidth:v=>{const _=typeof v.source=="object"?v.source.id:v.source,m=typeof v.target=="object"?v.target.id:v.target;return y===_||y===m?2.5:1.2},linkDirectionalParticles:v=>{const _=typeof v.source=="object"?v.source.id:v.source,m=typeof v.target=="object"?v.target.id:v.target;return y===_||y===m?4:0},linkDirectionalParticleWidth:2.2,linkDirectionalParticleSpeed:.006,nodeCanvasObject:(v,_,m)=>{const A=v.x??0,S=v.y??0,T=5.5+Math.min(h[v.id]||0,12)*.9,z=Ut[v.category]||"#64748b",M=v.id===o,O=v.id===r,N=y&&v.id!==y&&!k.has(v.id),j=N?"#1e293b":z;N||(_.shadowColor=z,_.shadowBlur=M||O?12:6),_.beginPath(),_.arc(A,S,T,0,2*Math.PI,!1),_.fillStyle=j,_.fill(),_.shadowBlur=0,(M||O)&&(_.beginPath(),_.arc(A,S,T+2,0,2*Math.PI,!1),_.strokeStyle=O?"#ffffff":"rgba(255, 255, 255, 0.7)",_.lineWidth=1.5,_.stroke());const C=v.content.length>30?v.content.slice(0,29)+"…":v.content,P=(M||O?10:9)/Math.max(.6,m);_.font=`${M||O?"bold":"500"} ${P}px "Space Grotesk", sans-serif`;const I=_.measureText(C).width,U=4/Math.max(.6,m);_.fillStyle=N?"rgba(10, 15, 25, 0.45)":"rgba(8, 12, 20, 0.85)",_.beginPath();const D=A-I/2-U,$=S+T+5/Math.max(.6,m),L=I+U*2,H=P+U*1.5,q=4/Math.max(.6,m);_.beginPath(),_.moveTo(D+q,$),_.lineTo(D+L-q,$),_.quadraticCurveTo(D+L,$,D+L,$+q),_.lineTo(D+L,$+H-q),_.quadraticCurveTo(D+L,$+H,D+L-q,$+H),_.lineTo(D+q,$+H),_.quadraticCurveTo(D,$+H,D,$+H-q),_.lineTo(D,$+q),_.quadraticCurveTo(D,$,D+q,$),_.closePath(),_.fill(),_.strokeStyle=M||O?"rgba(255, 255, 255, 0.15)":"rgba(255, 255, 255, 0.05)",_.lineWidth=.5/Math.max(.6,m),_.stroke(),_.textAlign="center",_.textBaseline="top",_.fillStyle=N?"#475569":M||O?"#ffffff":"#cbd5e1",_.fillText(C,A,S+T+6/Math.max(.6,m))}}),G.jsxs("button",{onClick:x,title:"Knoten neu anordnen",className:"absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded-lg border border-border/60 bg-background/50 px-2.5 py-1.5 text-[11px] text-muted-foreground hover:text-foreground backdrop-blur-sm transition-colors cursor-pointer",children:[G.jsx(Bi,{className:"h-3.5 w-3.5"})," Zentrieren"]}),G.jsx("div",{className:"absolute left-3 bottom-3 flex flex-wrap gap-2 rounded-lg bg-background/40 px-2.5 py-1.5 backdrop-blur-sm",children:Object.entries($r).map(([v,_])=>G.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[G.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:Ut[v]}}),_]},v))})]}),G.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 h-[calc(100vh-13rem)] min-h-[560px] overflow-y-auto scrollbar-thin",children:b?G.jsxs(G.Fragment,{children:[G.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[G.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Ut[b.category],boxShadow:`0 0 0 2px ${en.has(b.source)?"#34d399":"#475569"}`}}),G.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:Ut[b.category]},children:$r[b.category]||b.category}),G.jsxs("span",{className:`ml-auto text-[10px] font-mono flex items-center gap-1 ${en.has(b.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[en.has(b.source)&&G.jsx(Xi,{className:"h-2.5 w-2.5"}),b.source]})]}),G.jsx("div",{className:"text-sm text-foreground leading-relaxed mb-4 break-words",children:b.content}),G.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70 mb-2 flex items-center gap-1",children:[G.jsx(Hn,{className:"h-3 w-3"})," verwandte Fakten"]}),G.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:g.length?g.map(v=>G.jsxs("button",{onClick:()=>i(v.id),className:"flex items-center gap-2 text-[11px] text-muted-foreground hover:text-foreground text-left transition-colors cursor-pointer",children:[G.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Ut[v.category]}}),G.jsx("span",{className:"truncate",children:v.content})]},v.id)):G.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"—"})}),G.jsxs("button",{onClick:()=>{n(b.id),i(null)},className:"flex items-center gap-1.5 text-[11px] text-red-400 border border-red-500/20 rounded-lg px-2.5 py-1.5 hover:bg-red-500/5 transition-all cursor-pointer",children:[G.jsx(Yi,{className:"h-3.5 w-3.5"})," vergessen"]})]}):G.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center text-muted-foreground/70 gap-2 pt-24",children:[G.jsx(Hn,{className:"h-6 w-6"}),G.jsx("div",{className:"text-xs max-w-[180px] leading-relaxed",children:"Auf einen Knoten klicken, um den Fakt und seine semantischen Nachbarn zu sehen. Hover hebt das Netz hervor."})]})})]}):G.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Noch keine Fakten — der Graph füllt sich, sobald Hermes lernt oder du Einträge anlegst."})}export{Ah as GraphView}; +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Or(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function Ft(e){for(var n=1;n2&&arguments[2]!==void 0?arguments[2]:{},a=o.nodeFilter,s=a===void 0?function(){return!0}:a,u=o.onLoopError,f=u===void 0?function(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:u,l={};r.forEach(function(p){return l[n(p)]={data:p,out:[],depth:-1,skip:!s(p)}}),i.forEach(function(p){var y=p.source,x=p.target,b=_(y),g=_(x);if(!l.hasOwnProperty(b))throw"Missing source node with id: ".concat(b);if(!l.hasOwnProperty(g))throw"Missing target node with id: ".concat(g);var k=l[b],v=l[g];k.out.push(v);function _(m){return mn(m)==="object"?n(m):m}});var c=[];d(Object.values(l));var h=Object.assign.apply(Object,[{}].concat(ut(Object.entries(l).filter(function(p){var y=ae(p,2),x=y[1];return!x.skip}).map(function(p){var y=ae(p,2),x=y[0],b=y[1];return le({},x,b.depth)}))));return h;function d(p){for(var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,b=function(){var _=p[g];if(y.indexOf(_)!==-1){var m=[].concat(ut(y.slice(y.indexOf(_))),[_]).map(function(A){return n(A.data)});return c.some(function(A){return A.length===m.length&&A.every(function(S,T){return S===m[T]})})||(c.push(m),f(m)),1}x>_.depth&&(_.depth=x,d(_.out,[].concat(ut(y),[_]),x+(_.skip?0:1)))},g=0,k=p.length;gn.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()0){var N=Math.atan2(M.y-z.y,M.x-z.x),j=O*T,C={x:(z.x+M.x)/2+j*Math.cos(N-Math.PI/2),y:(z.y+M.y)/2+j*Math.sin(N-Math.PI/2)};S.__controlPoints=[C.x,C.y]}else{var R=T*70;S.__controlPoints=[M.x,M.y-R,M.x+R,M.y]}}}}function a(){var u=1.6,f=.2,l=V(n.linkDirectionalArrowLength),c=V(n.linkDirectionalArrowRelPos),h=V(n.linkVisibility),d=V(n.linkDirectionalArrowColor||n.linkColor),p=V(n.nodeVal),y=n.ctx;y.save(),n.graphData.links.filter(h).forEach(function(x){var b=l(x);if(!(!b||b<0)){var g=x.source,k=x.target;if(!(!g||!k||!g.hasOwnProperty("x")||!k.hasOwnProperty("x"))){var v=Math.sqrt(Math.max(0,p(g)||1))*n.nodeRelSize,_=Math.sqrt(Math.max(0,p(k)||1))*n.nodeRelSize,m=Math.min(1,Math.max(0,c(x))),A=d(x)||"rgba(0,0,0,0.28)",S=b/u/2,T=x.__controlPoints&&Pr(B,[g.x,g.y].concat(ut(x.__controlPoints),[k.x,k.y])),z=T?function(P){return T.get(P)}:function(P){return{x:g.x+(k.x-g.x)*P||0,y:g.y+(k.y-g.y)*P||0}},M=T?T.length():Math.sqrt(Math.pow(k.x-g.x,2)+Math.pow(k.y-g.y,2)),O=v+b+(M-v-_-b)*m,N=z(O/M),j=z((O-b)/M),C=z((O-b*(1-f))/M),R=Math.atan2(N.y-j.y,N.x-j.x)-Math.PI/2;y.beginPath(),y.moveTo(N.x,N.y),y.lineTo(j.x+S*Math.cos(R),j.y+S*Math.sin(R)),y.lineTo(C.x,C.y),y.lineTo(j.x-S*Math.cos(R),j.y-S*Math.sin(R)),y.fillStyle=A,y.fill()}}}),y.restore()}function s(){var u=V(n.linkDirectionalParticles),f=V(n.linkDirectionalParticleSpeed),l=V(n.linkDirectionalParticleOffset),c=V(n.linkDirectionalParticleWidth),h=V(n.linkVisibility),d=V(n.linkDirectionalParticleColor||n.linkColor),p=n.ctx;p.save(),n.graphData.links.filter(h).forEach(function(y){var x=u(y);if(!(!y.hasOwnProperty("__photons")||!y.__photons.length)){var b=y.source,g=y.target;if(!(!b||!g||!b.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var k=f(y),v=Math.abs(l(y)),_=y.__photons||[],m=Math.max(0,c(y)/2)/Math.sqrt(n.globalScale),A=d(y)||"rgba(0,0,0,0.28)";p.fillStyle=A;var S=y.__controlPoints?Pr(B,[b.x,b.y].concat(ut(y.__controlPoints),[g.x,g.y])):null,T=0,z=!1;_.forEach(function(M){var O=!!M.__singleHop;if(M.hasOwnProperty("__progressRatio")||(M.__progressRatio=O?k<0?1:0:(T+v)/x),!O&&T++,M.__progressRatio+=k,M.__progressRatio>=1||M.__progressRatio<0)if(!O)M.__progressRatio=M.__progressRatio%1,M.__progressRatio<0&&M.__progressRatio++;else{z=!0;return}var N=M.__progressRatio,j=S?S.get(N):{x:b.x+(g.x-b.x)*N||0,y:b.y+(g.y-b.y)*N||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(j.x,j.y,y,p,n.globalScale):(p.beginPath(),p.arc(j.x,j.y,m,0,2*Math.PI,!1),p.fill())}),z&&(y.__photons=y.__photons.filter(function(M){return!M.__singleHop||M.__progressRatio<=1&&M.__progressRatio>=0}))}}}),p.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:mc().force("link",cc()).force("charge",bc()).force("center",df()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Er(n.graphData.nodes,V(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Er(n.graphData.links,V(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(d){d.source=d[n.linkSource],d.target=d[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(d){return d[n.nodeId]}).links(n.graphData.links);var o=n.dagMode&&eh(n.graphData,function(d){return d[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,ut(Object.values(o||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*nh*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var u=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return delete d[u]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var f=["rl","bu"].includes(n.dagMode),l=function(p){return(o[p[n.nodeId]]-a/2)*s*(f?-1:1)},c=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return d[c]=l(d)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?xc(function(d){var p=o[d[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-p:p)*s}).strength(function(d){return n.dagNodeFilter(d)?1:0}):null);for(var h=0;h0&&n.forceLayout.alpha()1?u-1:0),l=1;l1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,a=new Array(o>3?o-3:0),s=3;s1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=V(n.nodeVal),o=function(u){return Math.sqrt(Math.max(0,i(u)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(r).map(function(s){return{x:s.x,y:s.y,r:o(s)}});return a.length?{x:[Un(a,function(s){return s.x-s.r}),Ln(a,function(s){return s.x+s.r})],y:[Un(a,function(s){return s.y-s.r}),Ln(a,function(s){return s.y+s.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},uh),stateInit:function(){return{lastSetZoom:1,zoom:ku(),forceGraph:new Ie,shadowGraph:new Ie().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new ql,tweenGroup:new ci}},init:function(n,r){var i=this;n.innerHTML="";var o=document.createElement("div");o.classList.add("force-graph-container"),o.style.position="relative",n.appendChild(o),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),o.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var a=r.canvas.getContext("2d"),s=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),u={x:-1e12,y:-1e12},f=function(){var h=null,d=window.devicePixelRatio,p=u.x>0&&u.y>0?s.getImageData(u.x*d,u.y*d,1,1):null;return p&&(h=r.colorTracker.lookup(p.data)),h};st(r.canvas).call(os().subject(function(){if(!r.enableNodeDrag)return null;var c=f();return c&&c.type==="Node"?c.d:null}).on("start",function(c){var h=c.subject;h.__initialDragPos={x:h.x,y:h.y,fx:h.fx,fy:h.fy},c.active||(h.fx=h.x,h.fy=h.y),r.canvas.classList.add("grabbable")}).on("drag",function(c){var h=c.subject,d=h.__initialDragPos,p=c,y=pt(r.canvas).k,x={x:d.x+(p.x-d.x)/y-h.x,y:d.y+(p.y-d.y)/y-h.y};["x","y"].forEach(function(b){return h["f".concat(b)]=h[b]=d[b]+(p[b]-d[b])/y}),!(!h.__dragged&&oh>=Math.sqrt(Zi(["x","y"].map(function(b){return Math.pow(c[b]-d[b],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,h.__dragged=!0,r.onNodeDrag(h,x))}).on("end",function(c){var h=c.subject,d=h.__initialDragPos,p={x:h.x-d.x,y:h.y-d.y};d.fx===void 0&&(h.fx=void 0),d.fy===void 0&&(h.fy=void 0),delete h.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,h.__dragged&&(delete h.__dragged,r.onNodeDragEnd(h,p))})),r.zoom(r.zoom.__baseElem=st(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(c){return!c.button&&r.enableZoomPanInteraction&&(c.type!=="wheel"||V(r.enableZoomInteraction)(c))&&(c.type==="wheel"||V(r.enablePanInteraction)(c))}).on("zoom",function(c){var h=c.transform;[a,s].forEach(function(d){Li(d),d.translate(h.x,h.y),d.scale(h.k,h.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Ft(Ft({},h),i.centerAt())),r.needsRedraw=!0}).on("end",function(c){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Ft(Ft({},c.transform),i.centerAt()))}),Ke(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){pt(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=ih/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new hf(o),["pointermove","pointerdown"].forEach(function(c){return o.addEventListener(c,function(h){c==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=h),!r.isPointerDragging&&h.type==="pointermove"&&r.onBackgroundClick&&(h.pressure>0||r.isPointerPressed)&&(h.pointerType==="mouse"||h.movementX===void 0||[h.movementX,h.movementY].some(function(y){return Math.abs(y)>1}))&&(r.isPointerDragging=!0);var d=p(o);u.x=h.pageX-d.left,u.y=h.pageY-d.top;function p(y){var x=y.getBoundingClientRect(),b=window.pageXOffset||document.documentElement.scrollLeft,g=window.pageYOffset||document.documentElement.scrollTop;return{top:x.top+g,left:x.left+b}}},{passive:!0})}),o.addEventListener("pointerup",function(c){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var h=[c,r.pointerDownEvent];requestAnimationFrame(function(){if(c.button===0)if(r.hoverObj){var d=r["on".concat(r.hoverObj.type,"Click")];d&&d.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,h);if(c.button===2)if(r.hoverObj){var p=r["on".concat(r.hoverObj.type,"RightClick")];p&&p.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,h)})}},{passive:!0}),o.addEventListener("contextmenu",function(c){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(c.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(s);var l=Zu(function(){Rr(s,r.width,r.height),r.shadowGraph.linkWidth(function(h){return V(r.linkWidth)(h)+r.linkHoverPrecision});var c=pt(r.canvas);r.shadowGraph.globalScale(c.k).tickFrame()},rh);r.flushShadowCanvas=l.flush,(this._animationCycle=function c(){var h=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(v){return v.__photons&&v.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var d=r.isPointerDragging?null:f();if(d!==r.hoverObj){var p=r.hoverObj,y=p?p.type:null,x=d?d.type:null;if(y&&y!==x){var b=r["on".concat(y,"Hover")];b&&b(null,p.d)}if(x){var g=r["on".concat(x,"Hover")];g&&g(d.d,y===x?p.d:null)}r.tooltip.content(d&&V(r["".concat(d.type.toLowerCase(),"Label")])(d.d)||null),r.canvas.classList[(d&&r["on".concat(x,"Click")]||!d&&r.onBackgroundClick)&&V(r.showPointerCursor)(d==null?void 0:d.d)?"add":"remove"]("clickable"),r.hoverObj=d}h&&l()}if(h){Rr(a,r.width,r.height);var k=pt(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,k),r.forceGraph.globalScale(k).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,k)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(c)})()},update:function(n){}}),Qe={exports:{}},Je,Nr;function fh(){if(Nr)return Je;Nr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Je=e,Je}var tn,Ir;function ch(){if(Ir)return tn;Ir=1;var e=fh();function n(){}function r(){}return r.resetWarningCache=n,tn=function(){function i(s,u,f,l,c,h){if(h!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}i.isRequired=i;function o(){return i}var a={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:o,element:i,elementType:i,instanceOf:o,node:i,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:n};return a.PropTypes=a,a},tn}var Dr;function hh(){return Dr||(Dr=1,Qe.exports=ch()()),Qe.exports}var dh=hh();const w=Wi(dh),He={width:w.number,height:w.number,graphData:w.shape({nodes:w.arrayOf(w.object).isRequired,links:w.arrayOf(w.object).isRequired}),backgroundColor:w.string,nodeRelSize:w.number,nodeId:w.string,nodeLabel:w.oneOfType([w.string,w.func]),nodeVal:w.oneOfType([w.number,w.string,w.func]),nodeVisibility:w.oneOfType([w.bool,w.string,w.func]),nodeColor:w.oneOfType([w.string,w.func]),nodeAutoColorBy:w.oneOfType([w.string,w.func]),onNodeHover:w.func,onNodeClick:w.func,linkSource:w.string,linkTarget:w.string,linkLabel:w.oneOfType([w.string,w.func]),linkVisibility:w.oneOfType([w.bool,w.string,w.func]),linkColor:w.oneOfType([w.string,w.func]),linkAutoColorBy:w.oneOfType([w.string,w.func]),linkWidth:w.oneOfType([w.number,w.string,w.func]),linkCurvature:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowLength:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowColor:w.oneOfType([w.string,w.func]),linkDirectionalArrowRelPos:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticles:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleSpeed:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleOffset:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleWidth:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleColor:w.oneOfType([w.string,w.func]),onLinkHover:w.func,onLinkClick:w.func,dagMode:w.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:w.number,dagNodeFilter:w.func,onDagError:w.func,d3AlphaMin:w.number,d3AlphaDecay:w.number,d3VelocityDecay:w.number,warmupTicks:w.number,cooldownTicks:w.number,cooldownTime:w.number,onEngineTick:w.func,onEngineStop:w.func,getGraphBbox:w.func},Hi={zoomToFit:w.func,onNodeRightClick:w.func,onNodeDrag:w.func,onNodeDragEnd:w.func,onLinkRightClick:w.func,linkHoverPrecision:w.number,onBackgroundClick:w.func,onBackgroundRightClick:w.func,showPointerCursor:w.oneOfType([w.bool,w.func]),enablePointerInteraction:w.bool,enableNodeDrag:w.bool},Dn={showNavInfo:w.bool,nodeOpacity:w.number,nodeResolution:w.number,nodeThreeObject:w.oneOfType([w.object,w.string,w.func]),nodeThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),nodePositionUpdate:w.func,linkOpacity:w.number,linkResolution:w.number,linkCurveRotation:w.oneOfType([w.number,w.string,w.func]),linkMaterial:w.oneOfType([w.object,w.string,w.func]),linkThreeObject:w.oneOfType([w.object,w.string,w.func]),linkThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),linkPositionUpdate:w.func,linkDirectionalArrowResolution:w.number,linkDirectionalParticleResolution:w.number,linkDirectionalParticleThreeObject:w.oneOfType([w.object,w.string,w.func]),forceEngine:w.oneOf(["d3","ngraph"]),ngraphPhysics:w.object,numDimensions:w.oneOf([1,2,3])},ph=Object.assign({},He,Hi,{linkLineDash:w.oneOfType([w.arrayOf(w.number),w.string,w.func]),nodeCanvasObjectMode:w.oneOfType([w.string,w.func]),nodeCanvasObject:w.func,nodePointerAreaPaint:w.func,linkCanvasObjectMode:w.oneOfType([w.string,w.func]),linkCanvasObject:w.func,linkPointerAreaPaint:w.func,linkDirectionalParticleCanvasObject:w.func,autoPauseRedraw:w.bool,minZoom:w.number,maxZoom:w.number,enableZoomInteraction:w.oneOfType([w.bool,w.func]),enablePanInteraction:w.oneOfType([w.bool,w.func]),onZoom:w.func,onZoomEnd:w.func,onRenderFramePre:w.func,onRenderFramePost:w.func});Object.assign({},He,Hi,Dn,{enableNavigationControls:w.bool,controlType:w.oneOf(["trackball","orbit","fly"]),rendererConfig:w.object,extraRenderers:w.arrayOf(w.shape({render:w.func.isRequired}))});Object.assign({},He,Dn,{nodeDesc:w.oneOfType([w.string,w.func]),linkDesc:w.oneOfType([w.string,w.func])});Object.assign({},He,Dn,{markerAttrs:w.object,yOffset:w.number,glScale:w.number});const jn=_o(lh,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});jn.displayName="ForceGraph2D";jn.propTypes=ph;function _t(e){return function(){return e}}function jr(e){return(e()-.5)*1e-6}function gh(e){return e.x+e.vx}function yh(e){return e.y+e.vy}function _h(e){var n,r,i,o=1,a=1;typeof e!="function"&&(e=_t(e==null?1:+e));function s(){for(var l,c=n.length,h,d,p,y,x,b,g=0;gd.index){var O=p-T.x-T.vx,N=y-T.y-T.vy,j=O*O+N*N;jp+M||Ay+M||Sl.r&&(l.r=l[c].r)}function f(){if(n){var l,c=n.length,h;for(r=new Array(c),l=0;l{if(!s.current)return;const v=new ResizeObserver(_=>{for(let m of _)m.contentRect.width>0&&m.contentRect.height>0&&l({width:Math.floor(m.contentRect.width),height:Math.floor(m.contentRect.height)})});return v.observe(s.current),()=>v.disconnect()},[]);const c=Z.useMemo(()=>({nodes:e.nodes.map(v=>({...v})),links:e.edges.map(v=>({source:v.source,target:v.target,weight:v.weight||0}))}),[e]),h=Z.useMemo(()=>{const v={};return e.edges.forEach(_=>{v[_.source]=(v[_.source]||0)+1,v[_.target]=(v[_.target]||0)+1}),v},[e]),d=v=>({identity:-160,knowledge:160,rules:-160,events:160})[v]||0,p=v=>({identity:-160,knowledge:-160,rules:160,events:160})[v]||0;Z.useEffect(()=>{const v=u.current;if(!v)return;v.d3Force("x",vh().x(A=>d(A.category)).strength(.14)),v.d3Force("y",mh().y(A=>p(A.category)).strength(.14)),v.d3Force("collide",_h().radius(A=>{const S=h[A.id]||0;return 28+Math.min(S,12)*1.5}).iterations(2));const _=v.d3Force("charge");_&&_.strength(-60);const m=v.d3Force("link");m&&m.distance(50),v.d3ReheatSimulation()},[c]);const y=o||r,x=()=>{u.current&&u.current.zoomToFit(400,40)},b=r?e.nodes.find(v=>v.id===r)??null:null,g=Z.useMemo(()=>{if(!r)return[];const v=new Set;return e.edges.forEach(_=>{_.source===r&&v.add(_.target),_.target===r&&v.add(_.source)}),e.nodes.filter(_=>v.has(_.id))},[r,e]),k=Z.useMemo(()=>{if(!y)return new Set;const v=new Set;return e.edges.forEach(_=>{_.source===y&&v.add(_.target),_.target===y&&v.add(_.source)}),v},[y,e]);return e.nodes.length?G.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-3",children:[G.jsxs("div",{className:"relative h-[calc(100vh-13rem)] min-h-[560px] rounded-2xl border border-border/60 overflow-hidden",ref:s,style:{background:"radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, #030712 100%)"},children:[G.jsx(jn,{ref:u,width:f.width,height:f.height,graphData:c,backgroundColor:"rgba(0,0,0,0)",nodeRelSize:4,cooldownTicks:120,onNodeClick:v=>i(v.id),onBackgroundClick:()=>i(null),onNodeHover:v=>{a(v?v.id:null),s.current&&(s.current.style.cursor=v?"pointer":"default")},linkColor:v=>{const _=typeof v.source=="object"?v.source.id:v.source,m=typeof v.target=="object"?v.target.id:v.target;if(y===_||y===m)return bh;if(y)return xh;const A=c.nodes.find(T=>T.id===_),S=A?Ut[A.category]:"#64748b";return wh(S,.16)},linkWidth:v=>{const _=typeof v.source=="object"?v.source.id:v.source,m=typeof v.target=="object"?v.target.id:v.target;return y===_||y===m?2.5:1.2},linkDirectionalParticles:v=>{const _=typeof v.source=="object"?v.source.id:v.source,m=typeof v.target=="object"?v.target.id:v.target;return y===_||y===m?4:0},linkDirectionalParticleWidth:2.2,linkDirectionalParticleSpeed:.006,nodeCanvasObject:(v,_,m)=>{const A=v.x??0,S=v.y??0,T=5.5+Math.min(h[v.id]||0,12)*.9,z=Ut[v.category]||"#64748b",M=v.id===o,O=v.id===r,N=y&&v.id!==y&&!k.has(v.id),j=N?"#1e293b":z;N||(_.shadowColor=z,_.shadowBlur=M||O?12:6),_.beginPath(),_.arc(A,S,T,0,2*Math.PI,!1),_.fillStyle=j,_.fill(),_.shadowBlur=0,(M||O)&&(_.beginPath(),_.arc(A,S,T+2,0,2*Math.PI,!1),_.strokeStyle=O?"#ffffff":"rgba(255, 255, 255, 0.7)",_.lineWidth=1.5,_.stroke());const C=v.content.length>30?v.content.slice(0,29)+"…":v.content,P=(M||O?10:9)/Math.max(.6,m);_.font=`${M||O?"bold":"500"} ${P}px "Space Grotesk", sans-serif`;const I=_.measureText(C).width,U=4/Math.max(.6,m);_.fillStyle=N?"rgba(10, 15, 25, 0.45)":"rgba(8, 12, 20, 0.85)",_.beginPath();const D=A-I/2-U,$=S+T+5/Math.max(.6,m),L=I+U*2,H=P+U*1.5,q=4/Math.max(.6,m);_.beginPath(),_.moveTo(D+q,$),_.lineTo(D+L-q,$),_.quadraticCurveTo(D+L,$,D+L,$+q),_.lineTo(D+L,$+H-q),_.quadraticCurveTo(D+L,$+H,D+L-q,$+H),_.lineTo(D+q,$+H),_.quadraticCurveTo(D,$+H,D,$+H-q),_.lineTo(D,$+q),_.quadraticCurveTo(D,$,D+q,$),_.closePath(),_.fill(),_.strokeStyle=M||O?"rgba(255, 255, 255, 0.15)":"rgba(255, 255, 255, 0.05)",_.lineWidth=.5/Math.max(.6,m),_.stroke(),_.textAlign="center",_.textBaseline="top",_.fillStyle=N?"#475569":M||O?"#ffffff":"#cbd5e1",_.fillText(C,A,S+T+6/Math.max(.6,m))}}),G.jsxs("button",{onClick:x,title:"Knoten neu anordnen",className:"absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded-lg border border-border/60 bg-background/50 px-2.5 py-1.5 text-[11px] text-muted-foreground hover:text-foreground backdrop-blur-sm transition-colors cursor-pointer",children:[G.jsx(Bi,{className:"h-3.5 w-3.5"})," Zentrieren"]}),G.jsx("div",{className:"absolute left-3 bottom-3 flex flex-wrap gap-2 rounded-lg bg-background/40 px-2.5 py-1.5 backdrop-blur-sm",children:Object.entries($r).map(([v,_])=>G.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[G.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:Ut[v]}}),_]},v))})]}),G.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 h-[calc(100vh-13rem)] min-h-[560px] overflow-y-auto scrollbar-thin",children:b?G.jsxs(G.Fragment,{children:[G.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[G.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Ut[b.category],boxShadow:`0 0 0 2px ${en.has(b.source)?"#34d399":"#475569"}`}}),G.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:Ut[b.category]},children:$r[b.category]||b.category}),G.jsxs("span",{className:`ml-auto text-[10px] font-mono flex items-center gap-1 ${en.has(b.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[en.has(b.source)&&G.jsx(Xi,{className:"h-2.5 w-2.5"}),b.source]})]}),G.jsx("div",{className:"text-sm text-foreground leading-relaxed mb-4 break-words",children:b.content}),G.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70 mb-2 flex items-center gap-1",children:[G.jsx(Hn,{className:"h-3 w-3"})," verwandte Fakten"]}),G.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:g.length?g.map(v=>G.jsxs("button",{onClick:()=>i(v.id),className:"flex items-center gap-2 text-[11px] text-muted-foreground hover:text-foreground text-left transition-colors cursor-pointer",children:[G.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Ut[v.category]}}),G.jsx("span",{className:"truncate",children:v.content})]},v.id)):G.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"—"})}),G.jsxs("button",{onClick:()=>{n(b.id),i(null)},className:"flex items-center gap-1.5 text-[11px] text-red-400 border border-red-500/20 rounded-lg px-2.5 py-1.5 hover:bg-red-500/5 transition-all cursor-pointer",children:[G.jsx(Yi,{className:"h-3.5 w-3.5"})," vergessen"]})]}):G.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center text-muted-foreground/70 gap-2 pt-24",children:[G.jsx(Hn,{className:"h-6 w-6"}),G.jsx("div",{className:"text-xs max-w-[180px] leading-relaxed",children:"Auf einen Knoten klicken, um den Fakt und seine semantischen Nachbarn zu sehen. Hover hebt das Netz hervor."})]})})]}):G.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Noch keine Fakten — der Graph füllt sich, sobald Hermes lernt oder du Einträge anlegst."})}export{Ah as GraphView}; diff --git a/frontend/dist/assets/index-BcsTzr2v.js b/frontend/dist/assets/index-DNXEzn-Z.js similarity index 99% rename from frontend/dist/assets/index-BcsTzr2v.js rename to frontend/dist/assets/index-DNXEzn-Z.js index ff9283f..c2b9100 100644 --- a/frontend/dist/assets/index-BcsTzr2v.js +++ b/frontend/dist/assets/index-DNXEzn-Z.js @@ -639,7 +639,7 @@ Error generating stack: `+j.message+` .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},YT=0,os=[];function ZT(e){var t=x.useRef([]),r=x.useRef([0,0]),n=x.useRef(),i=x.useState(YT++)[0],o=x.useState(E5)[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=xT([e.lockRef.current],(e.shards||[]).map(ek),!0).filter(Boolean);return w.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=x.useCallback(function(w,k){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!c.current.allowPinchZoom;var N=Td(w),E=r.current,C="deltaX"in w?w.deltaX:E[0]-N[0],A="deltaY"in w?w.deltaY:E[1]-N[1],_,O=w.target,D=Math.abs(C)>Math.abs(A)?"h":"v";if("touches"in w&&D==="h"&&O.type==="range")return!1;var B=window.getSelection(),F=B&&B.anchorNode,$=F?F===O||F.contains(O):!1;if($)return!1;var q=Xw(D,O);if(!q)return!0;if(q?_=D:(_=D==="v"?"h":"v",q=Xw(D,O)),!q)return!1;if(!n.current&&"changedTouches"in w&&(C||A)&&(n.current=_),!_)return!0;var U=n.current||_;return VT(U,k,w,U==="h"?C:A)},[]),f=x.useCallback(function(w){var k=w;if(!(!os.length||os[os.length-1]!==o)){var N="deltaY"in k?Jw(k):Td(k),E=t.current.filter(function(_){return _.name===k.type&&(_.target===k.target||k.target===_.shadowParent)&&qT(_.delta,N)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var C=(c.current.shards||[]).map(ek).filter(Boolean).filter(function(_){return _.contains(k.target)}),A=C.length>0?u(k,C[0]):!c.current.noIsolation;A&&k.cancelable&&k.preventDefault()}}},[]),h=x.useCallback(function(w,k,N,E){var C={name:w,delta:k,target:N,should:E,shadowParent:XT(N)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(A){return A!==C})},1)},[]),m=x.useCallback(function(w){r.current=Td(w),n.current=void 0},[]),p=x.useCallback(function(w){h(w.type,Jw(w),w.target,u(w,e.lockRef.current))},[]),v=x.useCallback(function(w){h(w.type,Td(w),w.target,u(w,e.lockRef.current))},[]);x.useEffect(function(){return os.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",f,as),document.addEventListener("touchmove",f,as),document.addEventListener("touchstart",m,as),function(){os=os.filter(function(w){return w!==o}),document.removeEventListener("wheel",f,as),document.removeEventListener("touchmove",f,as),document.removeEventListener("touchstart",m,as)}},[]);var b=e.removeScrollBar,S=e.inert;return x.createElement(x.Fragment,null,S?x.createElement(o,{styles:QT(i)}):null,b?x.createElement(FT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function XT(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const JT=AT(N5,ZT);var O5=x.forwardRef(function(e,t){return x.createElement(xh,Fn({},e,{ref:t,sideCar:JT}))});O5.classNames=xh.classNames;var eD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ss=new WeakMap,Dd=new WeakMap,Rd={},mg=0,_5=function(e){return e&&(e.host||_5(e.parentNode))},tD=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=_5(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})},rD=function(e,t,r,n){var i=tD(t,Array.isArray(e)?e:[e]);Rd[r]||(Rd[r]=new WeakMap);var o=Rd[r],c=[],u=new Set,f=new Set(i),h=function(p){!p||u.has(p)||(u.add(p),h(p.parentNode))};i.forEach(h);var m=function(p){!p||f.has(p)||Array.prototype.forEach.call(p.children,function(v){if(u.has(v))m(v);else try{var b=v.getAttribute(n),S=b!==null&&b!=="false",w=(ss.get(v)||0)+1,k=(o.get(v)||0)+1;ss.set(v,w),o.set(v,k),c.push(v),w===1&&S&&Dd.set(v,!0),k===1&&v.setAttribute(r,"true"),S||v.setAttribute(n,"true")}catch(N){console.error("aria-hidden: cannot operate on ",v,N)}})};return m(t),u.clear(),mg++,function(){c.forEach(function(p){var v=ss.get(p)-1,b=o.get(p)-1;ss.set(p,v),o.set(p,b),v||(Dd.has(p)||p.removeAttribute(n),Dd.delete(p)),b||p.removeAttribute(r)}),mg--,mg||(ss=new WeakMap,ss=new WeakMap,Dd=new WeakMap,Rd={})}},nD=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=eD(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),rD(n,i,r,"aria-hidden")):function(){return null}},yh="Dialog",[M5]=_I(yh),[iD,Sn]=M5(yh),I5=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:c=!0}=e,u=x.useRef(null),f=x.useRef(null),[h,m]=RI({prop:n,defaultProp:i??!1,onChange:o,caller:yh});return s.jsx(iD,{scope:t,triggerRef:u,contentRef:f,contentId:vi(),titleId:vi(),descriptionId:vi(),open:h,onOpenChange:m,onOpenToggle:x.useCallback(()=>m(p=>!p),[m]),modal:c,children:r})};I5.displayName=yh;var T5="DialogTrigger",aD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(T5,r),o=Co(t,i.triggerRef);return s.jsx(Jt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Bx(i.open),...n,ref:o,onClick:xa(e.onClick,i.onOpenToggle)})});aD.displayName=T5;var Fx="DialogPortal",[oD,D5]=M5(Fx,{forceMount:void 0}),R5=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,o=Sn(Fx,t);return s.jsx(oD,{scope:t,forceMount:r,children:x.Children.map(n,c=>s.jsx(vh,{present:r||o.open,children:s.jsx(k5,{asChild:!0,container:i,children:c})}))})};R5.displayName=Fx;var mf="DialogOverlay",L5=x.forwardRef((e,t)=>{const r=D5(mf,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=Sn(mf,e.__scopeDialog);return o.modal?s.jsx(vh,{present:n||o.open,children:s.jsx(lD,{...i,ref:t})}):null});L5.displayName=mf;var sD=v5("DialogOverlay.RemoveScroll"),lD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(mf,r),o=rT(),c=Co(t,o);return s.jsx(O5,{as:sD,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(Jt.div,{"data-state":Bx(i.open),...n,ref:c,style:{pointerEvents:"auto",...n.style}})})}),Ks="DialogContent",$5=x.forwardRef((e,t)=>{const r=D5(Ks,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=Sn(Ks,e.__scopeDialog);return s.jsx(vh,{present:n||o.open,children:o.modal?s.jsx(cD,{...i,ref:t}):s.jsx(uD,{...i,ref:t})})});$5.displayName=Ks;var cD=x.forwardRef((e,t)=>{const r=Sn(Ks,e.__scopeDialog),n=x.useRef(null),i=Co(t,r.contentRef,n);return x.useEffect(()=>{const o=n.current;if(o)return nD(o)},[]),s.jsx(z5,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:xa(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:xa(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&o.preventDefault()}),onFocusOutside:xa(e.onFocusOutside,o=>o.preventDefault())})}),uD=x.forwardRef((e,t)=>{const r=Sn(Ks,e.__scopeDialog),n=x.useRef(!1),i=x.useRef(!1);return s.jsx(z5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,u;(c=e.onCloseAutoFocus)==null||c.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 f,h;(f=e.onInteractOutside)==null||f.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=o.target;((h=r.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),z5=x.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...c}=e,u=Sn(Ks,r);return vT(),s.jsx(s.Fragment,{children:s.jsx(b5,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o,children:s.jsx(x5,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Bx(u.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})}),F5="DialogTitle",dD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(F5,r);return s.jsx(Jt.h2,{id:i.titleId,...n,ref:t})});dD.displayName=F5;var B5="DialogDescription",fD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(B5,r);return s.jsx(Jt.p,{id:i.descriptionId,...n,ref:t})});fD.displayName=B5;var U5="DialogClose",hD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(U5,r);return s.jsx(Jt.button,{type:"button",...n,ref:t,onClick:xa(e.onClick,()=>i.onOpenChange(!1))})});hD.displayName=U5;function Bx(e){return e?"open":"closed"}var nc='[cmdk-group=""]',pg='[cmdk-group-items=""]',mD='[cmdk-group-heading=""]',W5='[cmdk-item=""]',tk=`${W5}:not([aria-disabled="true"])`,kv="cmdk-item-select",xs="data-value",pD=(e,t,r)=>OI(e,t,r),H5=x.createContext(void 0),nu=()=>x.useContext(H5),K5=x.createContext(void 0),Ux=()=>x.useContext(K5),G5=x.createContext(void 0),V5=x.forwardRef((e,t)=>{let r=ys(()=>{var M,W;return{search:"",value:(W=(M=e.value)!=null?M:e.defaultValue)!=null?W:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=ys(()=>new Set),i=ys(()=>new Map),o=ys(()=>new Map),c=ys(()=>new Set),u=q5(e),{label:f,children:h,value:m,onValueChange:p,filter:v,shouldFilter:b,loop:S,disablePointerSelection:w=!1,vimBindings:k=!0,...N}=e,E=vi(),C=vi(),A=vi(),_=x.useRef(null),O=ED();yo(()=>{if(m!==void 0){let M=m.trim();r.current.value=M,D.emit()}},[m]),yo(()=>{O(6,ge)},[]);let D=x.useMemo(()=>({subscribe:M=>(c.current.add(M),()=>c.current.delete(M)),snapshot:()=>r.current,setState:(M,W,ie)=>{var te,J,se,pe;if(!Object.is(r.current[M],W)){if(r.current[M]=W,M==="search")U(),$(),O(1,q);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ne=document.getElementById(A);ne?ne.focus():(te=document.getElementById(E))==null||te.focus()}if(O(7,()=>{var ne;r.current.selectedItemId=(ne=ce())==null?void 0:ne.id,D.emit()}),ie||O(5,ge),((J=u.current)==null?void 0:J.value)!==void 0){let ne=W??"";(pe=(se=u.current).onValueChange)==null||pe.call(se,ne);return}}D.emit()}},emit:()=>{c.current.forEach(M=>M())}}),[]),B=x.useMemo(()=>({value:(M,W,ie)=>{var te;W!==((te=o.current.get(M))==null?void 0:te.value)&&(o.current.set(M,{value:W,keywords:ie}),r.current.filtered.items.set(M,F(W,ie)),O(2,()=>{$(),D.emit()}))},item:(M,W)=>(n.current.add(M),W&&(i.current.has(W)?i.current.get(W).add(M):i.current.set(W,new Set([M]))),O(3,()=>{U(),$(),r.current.value||q(),D.emit()}),()=>{o.current.delete(M),n.current.delete(M),r.current.filtered.items.delete(M);let ie=ce();O(4,()=>{U(),(ie==null?void 0:ie.getAttribute("id"))===M&&q(),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:f||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:E,inputId:A,labelId:C,listInnerRef:_}),[]);function F(M,W){var ie,te;let J=(te=(ie=u.current)==null?void 0:ie.filter)!=null?te:pD;return M?J(M,r.current.search,W):0}function $(){if(!r.current.search||u.current.shouldFilter===!1)return;let M=r.current.filtered.items,W=[];r.current.filtered.groups.forEach(te=>{let J=i.current.get(te),se=0;J.forEach(pe=>{let ne=M.get(pe);se=Math.max(ne,se)}),W.push([te,se])});let ie=_.current;me().sort((te,J)=>{var se,pe;let ne=te.getAttribute("id"),ye=J.getAttribute("id");return((se=M.get(ye))!=null?se:0)-((pe=M.get(ne))!=null?pe:0)}).forEach(te=>{let J=te.closest(pg);J?J.appendChild(te.parentElement===J?te:te.closest(`${pg} > *`)):ie.appendChild(te.parentElement===ie?te:te.closest(`${pg} > *`))}),W.sort((te,J)=>J[1]-te[1]).forEach(te=>{var J;let se=(J=_.current)==null?void 0:J.querySelector(`${nc}[${xs}="${encodeURIComponent(te[0])}"]`);se==null||se.parentElement.appendChild(se)})}function q(){let M=me().find(ie=>ie.getAttribute("aria-disabled")!=="true"),W=M==null?void 0:M.getAttribute(xs);D.setState("value",W||void 0)}function U(){var M,W,ie,te;if(!r.current.search||u.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let J=0;for(let se of n.current){let pe=(W=(M=o.current.get(se))==null?void 0:M.value)!=null?W:"",ne=(te=(ie=o.current.get(se))==null?void 0:ie.keywords)!=null?te:[],ye=F(pe,ne);r.current.filtered.items.set(se,ye),ye>0&&J++}for(let[se,pe]of i.current)for(let ne of pe)if(r.current.filtered.items.get(ne)>0){r.current.filtered.groups.add(se);break}r.current.filtered.count=J}function ge(){var M,W,ie;let te=ce();te&&(((M=te.parentElement)==null?void 0:M.firstChild)===te&&((ie=(W=te.closest(nc))==null?void 0:W.querySelector(mD))==null||ie.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function ce(){var M;return(M=_.current)==null?void 0:M.querySelector(`${W5}[aria-selected="true"]`)}function me(){var M;return Array.from(((M=_.current)==null?void 0:M.querySelectorAll(tk))||[])}function oe(M){let W=me()[M];W&&D.setState("value",W.getAttribute(xs))}function ae(M){var W;let ie=ce(),te=me(),J=te.findIndex(pe=>pe===ie),se=te[J+M];(W=u.current)!=null&&W.loop&&(se=J+M<0?te[te.length-1]:J+M===te.length?te[0]:te[J+M]),se&&D.setState("value",se.getAttribute(xs))}function Z(M){let W=ce(),ie=W==null?void 0:W.closest(nc),te;for(;ie&&!te;)ie=M>0?SD(ie,nc):ND(ie,nc),te=ie==null?void 0:ie.querySelector(tk);te?D.setState("value",te.getAttribute(xs)):ae(M)}let ee=()=>oe(me().length-1),re=M=>{M.preventDefault(),M.metaKey?ee():M.altKey?Z(1):ae(1)},I=M=>{M.preventDefault(),M.metaKey?oe(0):M.altKey?Z(-1):ae(-1)};return x.createElement(Jt.div,{ref:t,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:M=>{var W;(W=N.onKeyDown)==null||W.call(N,M);let ie=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||ie))switch(M.key){case"n":case"j":{k&&M.ctrlKey&&re(M);break}case"ArrowDown":{re(M);break}case"p":case"k":{k&&M.ctrlKey&&I(M);break}case"ArrowUp":{I(M);break}case"Home":{M.preventDefault(),oe(0);break}case"End":{M.preventDefault(),ee();break}case"Enter":{M.preventDefault();let te=ce();if(te){let J=new Event(kv);te.dispatchEvent(J)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:CD},f),bh(e,M=>x.createElement(K5.Provider,{value:D},x.createElement(H5.Provider,{value:B},M))))}),gD=x.forwardRef((e,t)=>{var r,n;let i=vi(),o=x.useRef(null),c=x.useContext(G5),u=nu(),f=q5(e),h=(n=(r=f.current)==null?void 0:r.forceMount)!=null?n:c==null?void 0:c.forceMount;yo(()=>{if(!h)return u.item(i,c==null?void 0:c.id)},[h]);let m=Q5(i,o,[e.value,e.children,o],e.keywords),p=Ux(),v=ka(O=>O.value&&O.value===m.current),b=ka(O=>h||u.filter()===!1?!0:O.search?O.filtered.items.get(i)>0:!0);x.useEffect(()=>{let O=o.current;if(!(!O||e.disabled))return O.addEventListener(kv,S),()=>O.removeEventListener(kv,S)},[b,e.onSelect,e.disabled]);function S(){var O,D;w(),(D=(O=f.current).onSelect)==null||D.call(O,m.current)}function w(){p.setState("value",m.current,!0)}if(!b)return null;let{disabled:k,value:N,onSelect:E,forceMount:C,keywords:A,..._}=e;return x.createElement(Jt.div,{ref:Hs(o,t),..._,id:i,"cmdk-item":"",role:"option","aria-disabled":!!k,"aria-selected":!!v,"data-disabled":!!k,"data-selected":!!v,onPointerMove:k||u.getDisablePointerSelection()?void 0:w,onClick:k?void 0:S},e.children)}),vD=x.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:i,...o}=e,c=vi(),u=x.useRef(null),f=x.useRef(null),h=vi(),m=nu(),p=ka(b=>i||m.filter()===!1?!0:b.search?b.filtered.groups.has(c):!0);yo(()=>m.group(c),[]),Q5(c,u,[e.value,e.heading,f]);let v=x.useMemo(()=>({id:c,forceMount:i}),[i]);return x.createElement(Jt.div,{ref:Hs(u,t),...o,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},r&&x.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),bh(e,b=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},x.createElement(G5.Provider,{value:v},b))))}),xD=x.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,i=x.useRef(null),o=ka(c=>!c.search);return!r&&!o?null:x.createElement(Jt.div,{ref:Hs(i,t),...n,"cmdk-separator":"",role:"separator"})}),yD=x.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,i=e.value!=null,o=Ux(),c=ka(h=>h.search),u=ka(h=>h.selectedItemId),f=nu();return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(Jt.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":u,id:f.inputId,type:"text",value:i?e.value:c,onChange:h=>{i||o.setState("search",h.target.value),r==null||r(h.target.value)}})}),bD=x.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...i}=e,o=x.useRef(null),c=x.useRef(null),u=ka(h=>h.selectedItemId),f=nu();return x.useEffect(()=>{if(c.current&&o.current){let h=c.current,m=o.current,p,v=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let b=h.offsetHeight;m.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return v.observe(h),()=>{cancelAnimationFrame(p),v.unobserve(h)}}},[]),x.createElement(Jt.div,{ref:Hs(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":n,id:f.listId},bh(e,h=>x.createElement("div",{ref:Hs(c,f.listInnerRef),"cmdk-list-sizer":""},h)))}),wD=x.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:o,container:c,...u}=e;return x.createElement(I5,{open:r,onOpenChange:n},x.createElement(R5,{container:c},x.createElement(L5,{"cmdk-overlay":"",className:i}),x.createElement($5,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(V5,{ref:t,...u}))))}),kD=x.forwardRef((e,t)=>ka(r=>r.filtered.count===0)?x.createElement(Jt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),jD=x.forwardRef((e,t)=>{let{progress:r,children:n,label:i="Loading...",...o}=e;return x.createElement(Jt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},bh(e,c=>x.createElement("div",{"aria-hidden":!0},c)))}),ls=Object.assign(V5,{List:bD,Item:gD,Input:yD,Group:vD,Separator:xD,Dialog:wD,Empty:kD,Loading:jD});function SD(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function ND(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function q5(e){let t=x.useRef(e);return yo(()=>{t.current=e}),t}var yo=typeof window>"u"?x.useEffect:x.useLayoutEffect;function ys(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function ka(e){let t=Ux(),r=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,r,r)}function Q5(e,t,r,n=[]){let i=x.useRef(),o=nu();return yo(()=>{var c;let u=(()=>{var h;for(let m of r){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():i.current}})(),f=n.map(h=>h.trim());o.value(e,u,f),(c=t.current)==null||c.setAttribute(xs,u),i.current=u}),i}var ED=()=>{let[e,t]=x.useState(),r=ys(()=>new Map);return yo(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,i)=>{r.current.set(n,i),t({})}};function AD(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function bh({asChild:e,children:t},r){return e&&x.isValidElement(t)?x.cloneElement(AD(t),{ref:t.ref},r(t.props.children)):r(t)}var CD={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function PD({onNavigate:e}){const[t,r]=x.useState(!1);return x.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)},[]),s.jsx(ls.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:s.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:[s.jsx(ls.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"}),s.jsxs(ls.List,{className:"max-h-80 overflow-y-auto p-2",children:[s.jsx(ls.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),s.jsx(ls.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:vs.map(n=>s.jsxs(ls.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:[s.jsx(n.icon,{className:"h-4 w-4 text-primary"}),s.jsx("span",{children:n.label}),s.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:n.hint})]},n.id))})]})]})})}const Y5="mc_expert_mode",jv="mc-expert-mode-change",OD=()=>{try{return localStorage.getItem(Y5)==="true"}catch{return!1}};function _D(e){return window.addEventListener(jv,e),window.addEventListener("storage",e),()=>{window.removeEventListener(jv,e),window.removeEventListener("storage",e)}}function rk(e){localStorage.setItem(Y5,String(e)),window.dispatchEvent(new Event(jv))}function Wx(){return x.useSyncExternalStore(_D,OD,()=>!1)}function Z5(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=TD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:c=>{const u=c.split(Hx);return u[0]===""&&u.length!==1&&u.shift(),X5(u,t)||ID(c)},getConflictingClassGroupIds:(c,u)=>{const f=r[c]||[];return u&&n[c]?[...f,...n[c]]:f}}},X5=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),i=n?X5(e.slice(1),n):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Hx);return(c=t.validators.find(({validator:u})=>u(o)))==null?void 0:c.classGroupId},nk=/^\[(.+)\]$/,ID=e=>{if(nk.test(e)){const t=nk.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},TD=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return RD(Object.entries(e.classGroups),r).forEach(([o,c])=>{Sv(c,n,o,t)}),n},Sv=(e,t,r,n)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:ik(t,i);o.classGroupId=r;return}if(typeof i=="function"){if(DD(i)){Sv(i(n),t,r,n);return}t.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([o,c])=>{Sv(c,ik(t,o),r,n)})})},ik=(e,t)=>{let r=e;return t.split(Hx).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},DD=e=>e.isThemeGetter,RD=(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(([c,u])=>[t+c,u])):o);return[r,i]}):e,LD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const i=(o,c)=>{r.set(o,c),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let c=r.get(o);if(c!==void 0)return c;if((c=n.get(o))!==void 0)return i(o,c),c},set(o,c){r.has(o)?r.set(o,c):i(o,c)}}},J5="!",$D=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,i=t[0],o=t.length,c=u=>{const f=[];let h=0,m=0,p;for(let k=0;km?p-m:void 0;return{modifiers:f,hasImportantModifier:b,baseClassName:S,maybePostfixModifierPosition:w}};return r?u=>r({className:u,parseClassName:c}):c},zD=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},FD=e=>({cache:LD(e.cacheSize),parseClassName:$D(e),...MD(e)}),BD=/\s+/,UD=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=t,o=[],c=e.trim().split(BD);let u="";for(let f=c.length-1;f>=0;f-=1){const h=c[f],{modifiers:m,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:b}=r(h);let S=!!b,w=n(S?v.substring(0,b):v);if(!w){if(!S){u=h+(u.length>0?" "+u:u);continue}if(w=n(v),!w){u=h+(u.length>0?" "+u:u);continue}S=!1}const k=zD(m).join(":"),N=p?k+J5:k,E=N+w;if(o.includes(E))continue;o.push(E);const C=i(w,S);for(let A=0;A0?" "+u:u)}return u};function WD(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;np(m),e());return r=FD(h),n=r.cache.get,i=r.cache.set,o=u,u(f)}function u(f){const h=n(f);if(h)return h;const m=UD(f,r);return i(f,m),m}return function(){return o(WD.apply(null,arguments))}}const st=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},tE=/^\[(?:([a-z-]+):)?(.+)\]$/i,KD=/^\d+\/\d+$/,GD=new Set(["px","full","screen"]),VD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qD=/\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$/,QD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,YD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,li=e=>Ns(e)||GD.has(e)||KD.test(e),Ji=e=>il(e,"length",aR),Ns=e=>!!e&&!Number.isNaN(Number(e)),gg=e=>il(e,"number",Ns),ic=e=>!!e&&Number.isInteger(Number(e)),XD=e=>e.endsWith("%")&&Ns(e.slice(0,-1)),ze=e=>tE.test(e),ea=e=>VD.test(e),JD=new Set(["length","size","percentage"]),eR=e=>il(e,JD,rE),tR=e=>il(e,"position",rE),rR=new Set(["image","url"]),nR=e=>il(e,rR,sR),iR=e=>il(e,"",oR),ac=()=>!0,il=(e,t,r)=>{const n=tE.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},aR=e=>qD.test(e)&&!QD.test(e),rE=()=>!1,oR=e=>YD.test(e),sR=e=>ZD.test(e),lR=()=>{const e=st("colors"),t=st("spacing"),r=st("blur"),n=st("brightness"),i=st("borderColor"),o=st("borderRadius"),c=st("borderSpacing"),u=st("borderWidth"),f=st("contrast"),h=st("grayscale"),m=st("hueRotate"),p=st("invert"),v=st("gap"),b=st("gradientColorStops"),S=st("gradientColorStopPositions"),w=st("inset"),k=st("margin"),N=st("opacity"),E=st("padding"),C=st("saturate"),A=st("scale"),_=st("sepia"),O=st("skew"),D=st("space"),B=st("translate"),F=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",ze,t],U=()=>[ze,t],ge=()=>["",li,Ji],ce=()=>["auto",Ns,ze],me=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],ee=()=>["","0",ze],re=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Ns,ze];return{cacheSize:500,separator:":",theme:{colors:[ac],spacing:[li,Ji],blur:["none","",ea,ze],brightness:I(),borderColor:[e],borderRadius:["none","","full",ea,ze],borderSpacing:U(),borderWidth:ge(),contrast:I(),grayscale:ee(),hueRotate:I(),invert:ee(),gap:U(),gradientColorStops:[e],gradientColorStopPositions:[XD,Ji],inset:q(),margin:q(),opacity:I(),padding:U(),saturate:I(),scale:I(),sepia:ee(),skew:I(),space:U(),translate:U()},classGroups:{aspect:[{aspect:["auto","square","video",ze]}],container:["container"],columns:[{columns:[ea]}],"break-after":[{"break-after":re()}],"break-before":[{"break-before":re()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...me(),ze]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ic,ze]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ze]}],grow:[{grow:ee()}],shrink:[{shrink:ee()}],order:[{order:["first","last","none",ic,ze]}],"grid-cols":[{"grid-cols":[ac]}],"col-start-end":[{col:["auto",{span:["full",ic,ze]},ze]}],"col-start":[{"col-start":ce()}],"col-end":[{"col-end":ce()}],"grid-rows":[{"grid-rows":[ac]}],"row-start-end":[{row:["auto",{span:[ic,ze]},ze]}],"row-start":[{"row-start":ce()}],"row-end":[{"row-end":ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ze]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ze]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"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",ze,t]}],"min-w":[{"min-w":[ze,t,"min","max","fit"]}],"max-w":[{"max-w":[ze,t,"none","full","min","max","fit","prose",{screen:[ea]},ea]}],h:[{h:[ze,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ze,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ea,Ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gg]}],"font-family":[{font:[ac]}],"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",ze]}],"line-clamp":[{"line-clamp":["none",Ns,gg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",li,ze]}],"list-image":[{"list-image":["none",ze]}],"list-style-type":[{list:["none","disc","decimal",ze]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",li,Ji]}],"underline-offset":[{"underline-offset":["auto",li,ze]}],"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",ze]}],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",ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...me(),tR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",eR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},nR]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"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":[N]}],"border-style":[{border:[...oe(),"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":[N]}],"divide-style":[{divide:oe()}],"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:["",...oe()]}],"outline-offset":[{"outline-offset":[li,ze]}],"outline-w":[{outline:[li,Ji]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ge()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[li,Ji]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ea,iR]}],"shadow-color":[{shadow:[ac]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...ae(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ae()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",ea,ze]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ze]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",ze]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",ze]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[A]}],"scale-x":[{"scale-x":[A]}],"scale-y":[{"scale-y":[A]}],rotate:[{rotate:[ic,ze]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ze]}],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",ze]}],"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",ze]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[li,Ji,gg]}],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"]}}},cR=HD(lR);function X(...e){return cR(nt(e))}function Nv(e){return e?e.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function nE(){const e=Wx();return s.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:[s.jsxs("button",{onClick:()=>rk(!1),"aria-pressed":!e,className:X("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:[s.jsx(zn,{className:"h-3.5 w-3.5"})," Einfach"]}),s.jsxs("button",{onClick:()=>rk(!0),"aria-pressed":e,className:X("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:[s.jsx(vI,{className:"h-3.5 w-3.5"})," Experte"]})]})}async function xe(e,t){var f;const r={"Content-Type":"application/json",...t==null?void 0:t.headers},n=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");n&&(r["X-Sudo-Password"]=n);let o=t==null?void 0:t.body;if((((f=t==null?void 0:t.method)==null?void 0:f.toUpperCase())||"GET")==="POST"){if(typeof o=="string")try{const h=JSON.parse(o);let m=!1;n&&!("sudo_password"in h)&&(h.sudo_password=n,m=!0),i&&!("hf_token"in h)&&(h.hf_token=i,m=!0),m&&(o=JSON.stringify(h))}catch{}else if(!o){const h={};n&&(h.sudo_password=n),i&&(h.hf_token=i),Object.keys(h).length>0&&(o=JSON.stringify(h))}}const u=await fetch(e,{...t,headers:r,body:o});if(!u.ok)throw new Error(`${u.status} ${u.statusText}`);return u.json()}const iE=(e,t,r=!1,n=!0)=>xe("/api/groups",{method:"PUT",body:JSON.stringify({group:e,members:t,swap:r,persist:n})}),uR=e=>xe("/api/routing/policy",{method:"PUT",body:JSON.stringify(e)}),$e={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"],chronik:["chronik"],wissen:["wissen"],zeitmaschine:["zeitmaschine"],reminders:["reminders"]},aE=(e=8e3)=>gt({queryKey:$e.auftragsbuch,queryFn:()=>xe("/api/auftragsbuch"),refetchInterval:e}),oE=(e=150,t=15e3)=>gt({queryKey:$e.chronik,queryFn:()=>xe(`/api/chronik?limit=${e}`),refetchInterval:t,select:r=>r.items??[]}),dR=()=>gt({queryKey:$e.wissen,queryFn:()=>xe("/api/wissen")}),fR=(e=3e4)=>gt({queryKey:$e.zeitmaschine,queryFn:()=>xe("/api/zeitmaschine"),refetchInterval:e}),hR=(e=2e4)=>gt({queryKey:$e.reminders,queryFn:()=>xe("/api/reminders"),refetchInterval:e,select:t=>t.items??[]}),mR=(e=12,t=4e3)=>gt({queryKey:$e.voiceTrace,queryFn:()=>xe(`/api/voice/trace?limit=${e}`),refetchInterval:t,select:r=>r.turns??[]}),pR=(e=!0)=>gt({queryKey:$e.memoryGraph,queryFn:()=>xe("/api/memory/graph"),enabled:e}),Kx=()=>gt({queryKey:$e.health,queryFn:()=>xe("/api/health"),refetchInterval:1e4}),Po=(e=5e3)=>gt({queryKey:$e.systemStatus,queryFn:()=>xe("/api/system/status"),refetchInterval:e}),sE=(e=3e3)=>gt({queryKey:$e.services,queryFn:()=>xe("/api/system/services"),refetchInterval:e}),Ni=(e=4e3)=>gt({queryKey:$e.models,queryFn:()=>xe("/api/models"),refetchInterval:e}),Gx=(e=8e3)=>gt({queryKey:$e.groups,queryFn:()=>xe("/api/groups"),refetchInterval:e}),gR=()=>gt({queryKey:$e.routingPolicy,queryFn:()=>xe("/api/routing/policy")}),vR=(e=2e3)=>gt({queryKey:$e.jobs,queryFn:()=>xe("/api/jobs"),refetchInterval:e,select:t=>t.jobs??[]}),lE=(e=3e3)=>gt({queryKey:$e.tokenStats,queryFn:()=>xe("/api/system/token-stats"),refetchInterval:e}),Vx=(e=5e3)=>gt({queryKey:$e.agentStatus,queryFn:()=>xe("/api/agent/status"),refetchInterval:e}),cE=(e=6e4)=>gt({queryKey:$e.hermesBrain,queryFn:()=>xe("/api/agent/brain"),refetchInterval:e}),wh=e=>gt({queryKey:$e.updates,queryFn:()=>xe("/api/maintenance/updates"),refetchInterval:e}),xR=()=>gt({queryKey:$e.discover,queryFn:()=>xe("/api/discover")}),yR=e=>gt({queryKey:$e.drafts(e),queryFn:()=>xe(`/api/models/drafts?target=${encodeURIComponent(e??"")}`),enabled:!!e}),bR=e=>gt({queryKey:$e.connect(e),queryFn:()=>xe(e?`/api/connect?${e}`:"/api/connect")}),uE=()=>gt({queryKey:$e.connectHealth,queryFn:()=>xe("/api/connect/health"),refetchInterval:15e3}),Ev=e=>gt({queryKey:$e.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),xe(`/api/memory?${t}`)},select:t=>e!=null&&e.limit?t.slice(0,e.limit):t});function dE({type:e,title:t,message:r,defaultValue:n,autoValue:i,autoLabel:o,onConfirm:c,onCancel:u}){const f=x.useRef(null);return s.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:s.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:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[s.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:t}),s.jsx("button",{onClick:u||(()=>c()),"aria-label":"Schließen",className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:s.jsx(rn,{className:"h-4 w-4","aria-hidden":"true"})})]}),s.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"&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{ref:f,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:h=>{var m;h.key==="Enter"&&c((m=f.current)==null?void 0:m.value)}}),i!==void 0&&s.jsx("button",{type:"button",onClick:()=>{f.current&&(f.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"})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(e==="confirm"||e==="prompt")&&s.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"}),s.jsx("button",{onClick:()=>{var m;const h=e==="prompt"?(m=f.current)==null?void 0:m.value:void 0;c(h)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:e==="confirm"?"Ja, fortfahren":e==="prompt"?"Übernehmen":"OK"})]})]})})}function Nn(){const[e,t]=x.useState(null),r=x.useCallback(()=>t(null),[]),n=x.useCallback((u,f,h)=>{t({type:"alert",title:u,message:f,onConfirm:()=>{t(null),h==null||h()}})},[]),i=x.useCallback((u,f,h,m)=>{t({type:"confirm",title:u,message:f,onConfirm:()=>{t(null),h()},onCancel:()=>{t(null),m==null||m()}})},[]),o=x.useCallback((u,f,h,m,p,v)=>{t({type:"prompt",title:u,message:f,defaultValue:h,autoValue:v==null?void 0:v.autoValue,autoLabel:v==null?void 0:v.autoLabel,onConfirm:b=>{t(null),m(b)},onCancel:()=>{t(null),p==null||p()}})},[]),c=e?s.jsx(dE,{...e}):null;return{showAlert:n,showConfirm:i,showPrompt:o,close:r,dialogElement:c}}function Xr(e){return(e/1024**3).toFixed(1)}function Av(e){return e?e>1024**3?`${(e/1024**3).toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`:""}function lr(e){if(!e)return"—";const t=e/1024**3;return t>=1?`${t.toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`}function wR(e){if(!e)return"";const t=Math.floor(e/60);return t>0?`${t} min`:`${e} s`}function Cv(e){return e?`${Math.round(e/1024)}k`:"—"}function kR(){const e=Wr(),{data:t=[]}=vR(2e3),{showAlert:r,dialogElement:n}=Nn();async function i(u){try{await xe(`/api/jobs/${u}/cancel`,{method:"POST"}),e.invalidateQueries({queryKey:$e.jobs})}catch(f){r("Fehler",f.message)}}const o=t.filter(u=>u.state==="running"||u.state==="queued"),c=t.filter(u=>u.state!=="running"&&u.state!=="queued").slice(-3);return o.length===0&&c.length===0?null:s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[s.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),o.map(u=>s.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[s.jsxs("div",{className:"flex justify-between items-center text-xs",children:[s.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:u.label}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"text-muted-foreground font-mono",children:[u.progress??0,"% • ",Av(u.done_bytes),"/",Av(u.total_bytes),u.eta_s?` • ETA ${wR(u.eta_s)}`:""]}),s.jsx("button",{onClick:()=>i(u.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),s.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${u.progress??0}%`}})})]},u.id)),c.map(u=>s.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[s.jsx("span",{className:"truncate",children:u.label}),s.jsx("span",{className:X("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",u.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:u.state})]},u.id)),n]})}function Fa({children:e,tone:t="muted"}){const r={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return s.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${r[t]}`,children:e})}function Pv({caps:e}){return e?s.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[e.coder&&s.jsx(Fa,{children:"💻 Code"}),e.vision&&s.jsx(Fa,{children:"👁 Bild"}),e.reasoning&&s.jsx(Fa,{children:"🧠 Reason"}),e.moe&&s.jsxs(Fa,{tone:"primary",children:["🧩 MoE",e.active_b?`·${e.active_b}b`:""]}),e.tools==="yes"&&s.jsx(Fa,{tone:"primary",children:"🛠 Tools"}),e.tools==="likely"&&s.jsx(Fa,{tone:"warn",children:"🛠 Tools?"}),e.embedding&&s.jsx(Fa,{children:"🔢 Embed"})]}):null}const qx=[{role:"hermes",label:"Lucys Hirn",short:"Hirn",icon:Sa,desc:"Lucys Alltags-Verstand — denkt und redet mit dir. Immer bereit.",tone:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25",protected:!0},{role:"embed",label:"Lucys Gedächtnis",short:"Gedächtnis",icon:XN,desc:"Merkt sich Wichtiges und findet es später wieder.",tone:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",protected:!0},{role:"reranker",label:"Gedächtnis-Sortierer",short:"Sortierer",icon:rI,desc:"Ordnet gefundene Erinnerungen nach echter Relevanz — die Feinsortierung hinter dem Gedächtnis.",tone:"bg-lime-500/15 text-lime-400 border-lime-500/25"},{role:"vision",label:"Lucys Augen",short:"Augen",icon:Cc,desc:"Sieht Bilder und Screenshots und beschreibt, was drauf ist.",tone:"bg-pink-500/15 text-pink-400 border-pink-500/25"},{role:"heavy",label:"Großes Hirn",short:"Groß",icon:TM,desc:"Das schwere Geschütz — wird für besonders knifflige Fragen dazugeholt.",tone:"bg-amber-500/15 text-amber-400 border-amber-500/25"},{role:"coder-lite",label:"Programmierer (schnell)",short:"Code schnell",icon:Us,desc:"Schnelles Programmieren im Alltag.",tone:"bg-violet-500/15 text-violet-400 border-violet-500/25"},{role:"coder",label:"Programmierer (gründlich)",short:"Code gründlich",icon:Us,desc:"Schreibt und prüft Code besonders sorgfältig — für schwere Coding-Aufgaben.",tone:"bg-fuchsia-500/15 text-fuchsia-400 border-fuchsia-500/25"},{role:"scout",label:"Späher",short:"Späher",icon:bI,desc:"Schneller erster Blick und grobe Einschätzung.",tone:"bg-teal-500/15 text-teal-400 border-teal-500/25"},{role:"kritiker",label:"Kritiker",short:"Kritiker",icon:d5,desc:"Die unbestechliche Zweitmeinung — prüft Behauptungen und Patches (anderer Hersteller als das Hirn).",tone:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25"}],jR=qx.map(e=>e.role),ak=Object.fromEntries(qx.map(e=>[e.role,e])),ok=e=>({role:e||"?",label:e||"unbekannt",short:e||"?",icon:Sa,desc:"Rolle ohne hinterlegten Klartext-Namen.",tone:"bg-slate-500/15 text-slate-300 border-slate-500/25"}),SR={fast:"hermes",coder_lite:"coder-lite"};function dt(e){return e&&(ak[e]||ak[SR[e]])||ok(e)}function mo({role:e,dense:t=!1,className:r}){const n=dt(e),i=n.icon;return s.jsxs("span",{className:X("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold border tracking-wide",n.tone,r),title:`${n.desc} (${n.role})`,children:[s.jsx(i,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),t?n.short:n.label]})}function NR({fit:e}){const t={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[e.level];return s.jsxs("span",{className:X("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",t),children:[e.text," • ",e.req_gb," GB RAM"]})}function pf(e){const t=e.toLowerCase();return t.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:t.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:t.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:t.includes("mistral")||t.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:t.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:t.includes("hermes")||t.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:t.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function fE({model:e,onClose:t,onChanged:r}){var w,k;const{data:n,isLoading:i}=yR(e.gguf_path),[o,c]=x.useState(null),[u,f]=x.useState(""),h=n==null?void 0:n.target_vocab,m=(n==null?void 0:n.drafts)??[],p=m.filter(N=>N.compatible===!0),v=e.spec_draft_model;async function b(N){c(N??"__clear__"),f("");try{await xe(`/api/models/${encodeURIComponent(e.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:N})}),r(),t()}catch(E){f(String((E==null?void 0:E.message)||E)),c(null)}}const S=N=>{var E;return N?`${N.pre??"?"} · ${((E=N.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return s.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[s.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[s.jsx(wa,{className:"h-4 w-4"})," Speculative Draft"]}),s.jsx("button",{onClick:t,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:s.jsx(rn,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',s.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),s.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:(w=e.name.split("/").pop())==null?void 0:w.replace(/\.gguf$/i,"")}),s.jsxs("span",{className:"text-foreground",children:["Vocab: ",S(h)]})]}),e.spec_active&&v&&s.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[s.jsx(Mt,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",v]}),s.jsx("button",{onClick:()=>b(null),disabled:o!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(n!=null&&n.target_exists)&&s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[s.jsx(vr,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),s.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?s.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):m.length===0?s.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",s.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):m.map(N=>{var A,_;const E=N.filename===v,C=N.compatible===!0;return s.jsxs("div",{className:X("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",C?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate flex items-center gap-1.5",children:[N.filename,N.mtp&&s.jsx("span",{className:"shrink-0 rounded bg-indigo-500/15 px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-wider text-indigo-400 border border-indigo-500/25",title:"MTP-Kopf (Multi-Token-Prediction) — by-construction vocab-identisch, höchste Akzeptanzrate",children:"MTP"})]}),s.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[lr(N.size_bytes)," · Vocab: ",S(N.vocab)]})]}),C?E?s.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[s.jsx(Mt,{className:"h-3.5 w-3.5"})," Aktiv"]}):s.jsx("button",{onClick:()=>b(N.path),disabled:o!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):s.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:N.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(A=N.vocab)==null?void 0:A.pre}/${(_=N.vocab)==null?void 0:_.n_vocab} ≠ Modell ${h==null?void 0:h.pre}/${h==null?void 0:h.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[s.jsx(vr,{className:"h-3.5 w-3.5"})," ",N.compatible===!1?"Vocab ≠":"n/a"]})]},N.path)})}),!i&&(n==null?void 0:n.target_exists)&&m.length>0&&p.length===0&&s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",s.jsx("span",{className:"font-mono",children:h==null?void 0:h.pre}),", n_vocab=",s.jsx("span",{className:"font-mono",children:(k=h==null?void 0:h.n_vocab)==null?void 0:k.toLocaleString()}),")."]}),u&&s.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:u})]})})}const sk={hermes:{bar:"bg-indigo-500",dot:"bg-indigo-500",text:"text-indigo-400"},embed:{bar:"bg-emerald-500",dot:"bg-emerald-500",text:"text-emerald-400"},vision:{bar:"bg-pink-500",dot:"bg-pink-500",text:"text-pink-400"},heavy:{bar:"bg-amber-500",dot:"bg-amber-500",text:"text-amber-400"},"coder-lite":{bar:"bg-violet-500",dot:"bg-violet-500",text:"text-violet-400"},coder:{bar:"bg-fuchsia-500",dot:"bg-fuchsia-500",text:"text-fuchsia-400"},scout:{bar:"bg-teal-500",dot:"bg-teal-500",text:"text-teal-400"},kritiker:{bar:"bg-cyan-500",dot:"bg-cyan-500",text:"text-cyan-400"},reranker:{bar:"bg-lime-500",dot:"bg-lime-500",text:"text-lime-400"}},ER={fast:"hermes",coder_lite:"coder-lite"},lk={bar:"bg-slate-400",dot:"bg-slate-400",text:"text-slate-300"};function gf(e){return e&&(sk[e]||sk[ER[e]])||lk}const ck=1024**3,uk=e=>{var t;return((t=e.split("/").pop())==null?void 0:t.replace(/\.gguf$/i,""))??e};function AR({running:e,capacityBytes:t,realUsedBytes:r,selected:n,onSelect:i}){const o=t>2*ck?t:124*ck,c=e.reduce((h,m)=>h+(m.size_bytes||0),0),u=Math.max(0,o-c),f=u/o*100;return s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-5 shadow-lg shadow-black/15 backdrop-blur-md",children:[s.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(va,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Arbeitsspeicher"}),s.jsxs("div",{className:"font-space text-xl font-bold tracking-tight text-foreground",children:[Xr(o)," GB ",s.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"gesamt"})]})]})]}),s.jsxs("div",{className:"text-right text-[11px] font-mono text-muted-foreground",children:[s.jsxs("div",{children:[s.jsxs("span",{className:"font-bold text-foreground",children:[Xr(c)," GB"]})," Modelle geladen"]}),r>0&&s.jsxs("div",{children:[Xr(r)," GB real belegt (inkl. KV-Cache)"]}),s.jsxs("div",{className:"text-emerald-400",children:[Xr(u)," GB frei"]})]})]}),s.jsx("div",{className:"flex h-12 w-full overflow-hidden rounded-xl border border-border/40 bg-background/50 p-1",children:e.length===0?s.jsx("div",{className:"flex w-full items-center justify-center text-[11px] italic text-muted-foreground/60",children:"Kein Modell geladen — Auto-Swap holt bei Anfrage automatisch das passende."}):s.jsxs(s.Fragment,{children:[e.map(h=>{const m=(h.size_bytes||0)/o*100,p=gf(h.role),v=n===h.name;return s.jsxs("button",{onClick:()=>i==null?void 0:i(h.name),style:{width:`${m}%`},title:`${dt(h.role).label} · ${uk(h.name)} · ${lr(h.size_bytes)}`,className:X("group flex h-full min-w-[2.5rem] shrink-0 flex-col justify-center gap-0.5 rounded-lg px-2 text-left text-white transition-all",p.bar,v?"ring-2 ring-white/70":"opacity-90 hover:opacity-100"),children:[s.jsx("span",{className:"truncate font-space text-[10px] font-bold leading-tight tracking-wide",children:dt(h.role).short}),s.jsx("span",{className:"truncate font-mono text-[9px] leading-tight opacity-85",children:lr(h.size_bytes)})]},h.name)}),f>1.5&&s.jsx("div",{style:{width:`${f}%`},className:"flex h-full min-w-[2rem] items-center justify-center rounded-lg text-[9px] font-mono text-muted-foreground/50",title:`${Xr(u)} GB frei`,children:"frei"})]})}),e.length>0&&s.jsxs("div",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1.5",children:[e.map(h=>{const m=gf(h.role);return s.jsxs("button",{onClick:()=>i==null?void 0:i(h.name),className:"flex items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[s.jsx("span",{className:X("h-2.5 w-2.5 rounded-sm",m.dot)}),s.jsx("span",{className:X("font-semibold",m.text),children:dt(h.role).short}),s.jsx("span",{className:"font-mono text-muted-foreground/70",children:uk(h.name)})]},h.name)}),s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60",children:[s.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-border/50 bg-background/50"})," frei · ",Xr(u)," GB"]})]})]})}const dk=1024**3,Ga=e=>{var t;return((t=e.split("/").pop())==null?void 0:t.replace(/\.gguf$/i,""))??e};function CR(){var M,W,ie,te;const e=Wr(),{data:t,isLoading:r,error:n}=Ni(4e3),{data:i}=Po(),{data:o}=Gx(),{showAlert:c,showConfirm:u,showPrompt:f,dialogElement:h}=Nn(),m=Wx(),p=(t==null?void 0:t.models)??[],v=(t==null?void 0:t.running)??[],b=J=>!!dt(J).protected,S=(M=o==null?void 0:o.groups)==null?void 0:M.brains,w=(S==null?void 0:S.members)??[],k=J=>w.includes(J),[N,E]=x.useState(null),[C,A]=x.useState(""),[_,O]=x.useState("all"),[D,B]=x.useState(null),F=()=>{e.invalidateQueries({queryKey:$e.models}),e.invalidateQueries({queryKey:$e.routing}),e.invalidateQueries({queryKey:$e.groups})},$=p.filter(J=>v.includes(J.name)),q=((W=i==null?void 0:i.gpu)==null?void 0:W.gtt_total)||((ie=i==null?void 0:i.gpu)==null?void 0:ie.vram_total)||0,U=((te=i==null?void 0:i.gpu)==null?void 0:te.gtt_used)||0,ge=q>2*dk?q:124*dk,ce=x.useMemo(()=>{const J=C.trim().toLowerCase();return p.filter(se=>_==="in_use"?!!se.role||v.includes(se.name):!0).filter(se=>J?se.name.toLowerCase().includes(J):!0).sort((se,pe)=>{const ne=v.includes(se.name)?0:1,ye=v.includes(pe.name)?0:1;return ne!==ye?ne-ye:Ga(se.name).localeCompare(Ga(pe.name))})},[p,v,_,C]),me=p.find(J=>J.name===N)??null;async function oe(J){try{await xe(`/api/models/${encodeURIComponent(J)}/load`,{method:"POST"}),F()}catch(se){c("Fehler",`Laden fehlgeschlagen: ${se.message||se}`)}}async function ae(J){const se=w.some(pe=>v.includes(pe));if(S&&se&&!k(J)){const pe=w.filter(ne=>v.includes(ne)).map(Ga).join(", ");u("Verdrängt das Hirn?",`„${Ga(J)}" ist nicht ko-resident. Beim Laden wirft es das warme Hirn (${pe}) raus — Lucy verliert Hirn bzw. Augen. -Trotzdem exklusiv laden?`,()=>oe(J));return}oe(J)}async function Z(J){const se=p.find(pe=>pe.name===J);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" ist lebenswichtig und bleibt geladen.`);return}try{await xe(`/api/models/${encodeURIComponent(J)}/unload`,{method:"POST"}),F()}catch(pe){c("Fehler",`Entladen fehlgeschlagen: ${pe.message||pe}`)}}async function ee(J,se){try{const pe=await xe(`/api/models/${encodeURIComponent(se)}/role`,{method:"POST",body:JSON.stringify({role:J||null})});F(),pe!=null&&pe.warning&&c("Rolle gesetzt — Hinweis",pe.warning)}catch(pe){c("Fehler",`Rolle zuweisen fehlgeschlagen: ${pe.message||pe}`)}}async function re(J,se){let pe=null;try{pe=await xe(`/api/models/${encodeURIComponent(J)}/ctx/auto`)}catch{}const ne=pe?`Optimal für dein Setup: ${(pe.ctx/1024).toFixed(0)}k (${pe.ctx}). »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",ne,String(se||32768),async ye=>{if(ye)try{await xe(`/api/models/${encodeURIComponent(J)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ye,10)})}),F()}catch(Oe){c("Fehler",`Kontext setzen fehlgeschlagen: ${Oe.message||Oe}`)}},void 0,pe?{autoValue:String(pe.ctx),autoLabel:`Auto (${(pe.ctx/1024).toFixed(0)}k)`}:void 0)}async function I(J){const se=p.find(pe=>pe.name===J);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" kann nicht gelöscht werden. Weise die Rolle zuerst einem anderen Modell zu.`);return}u("Modell löschen?",`„${Ga(J)}" und alle GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await xe(`/api/models/${encodeURIComponent(J)}`,{method:"DELETE"}),N===J&&E(null),F()}catch(pe){c("Fehler",`Löschen fehlgeschlagen: ${pe.message||pe}`)}})}return r?s.jsx("div",{className:"py-16 text-center text-xs text-muted-foreground",children:"Werkbank wird geladen …"}):n?s.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",String(n),")."]}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(AR,{running:$,capacityBytes:ge,realUsedBytes:U,selected:N,onSelect:E}),s.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)]",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-4 shadow-lg shadow-black/15 backdrop-blur-md",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(xo,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),s.jsx("input",{value:C,onChange:J=>A(J.target.value),placeholder:"Modell suchen …",className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 pl-8 pr-2 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"})]}),s.jsx("div",{className:"flex rounded-lg border border-border/40 bg-background/30 p-0.5",children:["all","in_use"].map(J=>s.jsx("button",{onClick:()=>O(J),className:X("rounded-md px-2 py-1 text-[9px] font-bold uppercase transition-all cursor-pointer",_===J?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:J==="all"?"Alle":"In Benutzung"},J))})]}),s.jsx("div",{className:"max-h-[60vh] space-y-1.5 overflow-y-auto scrollbar-thin pr-1",children:ce.length===0?s.jsx("div",{className:"rounded-xl border border-dashed border-border/50 p-8 text-center text-xs text-muted-foreground",children:"Keine Modelle."}):ce.map(J=>{const se=v.includes(J.name),pe=N===J.name,ne=pf(J.name),ye=gf(J.role);return s.jsxs("button",{onClick:()=>E(J.name),className:X("flex w-full items-center gap-2.5 rounded-xl border p-2.5 text-left transition-all cursor-pointer",pe?"border-primary/60 bg-primary/10":"border-border/40 bg-background/20 hover:border-primary/30 hover:bg-background/40"),children:[s.jsx("span",{className:X("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border text-[10px] font-bold",ne.color),children:ne.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate font-mono text-xs font-semibold text-foreground",children:Ga(J.name)}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[J.role&&s.jsx("span",{className:X("h-2 w-2 rounded-sm",ye.dot)}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:J.role?dt(J.role).short:"keine Rolle"}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:["· ",lr(J.size_bytes)]})]})]}),se?s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[9px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]}):J.incomplete?s.jsx("span",{className:"shrink-0 text-[9px] font-bold uppercase text-amber-400",children:"⚠ fehlt"}):s.jsx("span",{className:"shrink-0 text-[9px] font-semibold uppercase text-muted-foreground/50",children:"bereit"})]},J.name)})})]}),s.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-5 shadow-lg shadow-black/15 backdrop-blur-md",children:me?s.jsx(PR,{m:me,warm:v.includes(me.name),expert:m,protectedRole:b(me.role),coresident:k(me.name),onLoad:()=>ae(me.name),onUnload:()=>Z(me.name),onRole:J=>ee(J,me.name),onCtx:()=>re(me.name,me.ctx),onSpec:()=>B(me),onDelete:()=>I(me.name)}):s.jsxs("div",{className:"flex h-full min-h-[16rem] flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[s.jsx(bi,{className:"h-8 w-8 opacity-40"}),s.jsx("p",{className:"text-sm font-semibold",children:"Links ein Modell wählen"}),s.jsx("p",{className:"text-xs",children:"Dann verwaltest du es hier — laden, Rolle, Kontext, löschen."})]})})]}),D&&s.jsx(fE,{model:D,onClose:()=>B(null),onChanged:F}),h]})}function PR({m:e,warm:t,expert:r,protectedRole:n,coresident:i,onLoad:o,onUnload:c,onRole:u,onCtx:f,onSpec:h,onDelete:m}){const p=pf(e.name),v=t&&n;return s.jsxs("div",{className:"flex h-full flex-col gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:X("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border text-sm font-bold",p.color),children:p.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"break-all font-mono text-sm font-bold text-foreground",children:Ga(e.name)}),s.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[e.role?s.jsx(mo,{role:e.role}):s.jsx("span",{className:"rounded border border-dashed border-border/50 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"keine Rolle"}),n&&s.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 text-[10px] text-muted-foreground",title:"Lebenswichtig — geschützt",children:[s.jsx(s5,{className:"mr-0.5 inline h-3 w-3"}),"geschützt"]}),i&&s.jsxs("span",{className:"rounded border border-fuchsia-500/30 bg-fuchsia-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase text-fuchsia-300",children:[s.jsx(Sa,{className:"mr-0.5 inline h-3 w-3"}),"Ko-resident"]}),t&&s.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]})]})]})]}),s.jsxs("button",{onClick:t?c:o,disabled:e.incomplete&&!t||v,className:X("flex h-11 w-full items-center justify-center gap-2 rounded-xl border text-sm font-bold transition-all cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",t?"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20":"border-primary/40 bg-primary/10 text-primary hover:bg-primary/20"),title:v?`„${dt(e.role).label}" bleibt geladen (geschützt).`:void 0,children:[t?s.jsx(cI,{className:"h-4 w-4"}):s.jsx(u5,{className:"h-4 w-4"}),v?"🔒 bleibt geladen":t?"Entladen":"Ins Warm-Set laden"]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Rolle"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx(fk,{active:!e.role,onClick:()=>u(""),dot:"bg-slate-400",label:"keine"}),qx.map(b=>s.jsx(fk,{active:e.role===b.role,onClick:()=>u(b.role),dot:gf(b.role).dot,label:b.short},b.role))]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[s.jsx(OR,{icon:va,label:"Größe",value:lr(e.size_bytes)}),s.jsxs("button",{onClick:f,className:"group flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5 text-left transition-colors hover:border-primary/40 cursor-pointer",children:[s.jsx(c5,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:"Kontext · ändern"}),s.jsx("div",{className:"font-semibold text-foreground",children:Cv(e.ctx)})]})]})]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Beschleuniger"}),r&&s.jsxs("button",{onClick:h,className:X("flex h-6 items-center gap-1 rounded-lg border px-2 text-[9px] font-bold uppercase transition-colors cursor-pointer",e.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":e.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),children:[s.jsx(wa,{className:"h-3 w-3"})," Spec"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.spec_active&&s.jsx(Ld,{tone:"emerald",label:"Spec-Decoding aktiv"}),!e.spec_active&&e.spec_draft_model&&s.jsx(Ld,{tone:"amber",label:"Spec inaktiv"}),e.prompt_cache&&s.jsx(Ld,{tone:"cyan",label:"Prompt-Cache"}),e.parallel_slots>1&&s.jsx(Ld,{tone:"violet",label:`${e.parallel_slots} Slots`}),!e.spec_active&&!e.spec_draft_model&&!e.prompt_cache&&e.parallel_slots<=1&&s.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"keine aktiv"})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:s.jsx(Pv,{caps:e.capabilities})}),s.jsxs("button",{onClick:m,disabled:n,className:X("mt-auto flex h-9 items-center justify-center gap-1.5 rounded-lg border text-xs font-semibold transition-colors",n?"cursor-not-allowed border-border/30 text-muted-foreground/40":"border-red-500/30 text-red-400 hover:bg-red-500/10 cursor-pointer"),children:[s.jsx(Oc,{className:"h-3.5 w-3.5"})," ",n?"geschützt — nicht löschbar":"Modell löschen"]})]})}function fk({active:e,onClick:t,dot:r,label:n}){return s.jsxs("button",{onClick:t,className:X("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[10px] font-semibold transition-all cursor-pointer",e?"border-primary/60 bg-primary/15 text-foreground":"border-border/40 bg-background/20 text-muted-foreground hover:border-primary/30"),children:[s.jsx("span",{className:X("h-2 w-2 rounded-sm",r)}),n,e&&s.jsx(Mt,{className:"h-3 w-3 text-primary"})]})}function OR({icon:e,label:t,value:r}){return s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5",children:[s.jsx(e,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t}),s.jsx("div",{className:"font-semibold text-foreground",children:r})]})]})}function Ld({tone:e,label:t}){const r={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20",cyan:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",violet:"bg-violet-500/10 text-violet-400 border-violet-500/20"}[e];return s.jsx("span",{className:X("rounded border px-1.5 py-0.5 text-[10px] font-semibold",r),children:t})}const _R=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],MR=["fast","heavy","coder","vision","hermes","scout"],IR=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function hk(e){return IR.format(e)}function TR(){const{data:e}=Ni(),t=(e==null?void 0:e.models)??[],[r,n]=x.useState(""),[i,o]=x.useState([]),[c,u]=x.useState(!1),[f,h]=x.useState(""),[m,p]=x.useState("popular"),[v,b]=x.useState(""),[S,w]=x.useState(null),[k,N]=x.useState([]),[E,C]=x.useState("Q4_K_M"),[A,_]=x.useState(""),[O,D]=x.useState(null),[B,F]=x.useState(!1),[$,q]=x.useState({});async function U(M){u(!0),h("");try{const W=await xe(`/api/hf/search?q=${encodeURIComponent(M)}`);o(W.results),W.results.length||h("Keine Ergebnisse.")}catch(W){h(`Suche fehlgeschlagen: ${W}`)}finally{u(!1)}}x.useEffect(()=>{U("")},[]);function ge(M){p(M.key),n(""),U(M.q)}function ce(){p(""),U(r)}async function me(M,W,ie){F(!1);try{const te=await xe(`/api/fit?params_b=0&quant=${encodeURIComponent(W)}&ctx=8192&name=${encodeURIComponent(M)}&role=${encodeURIComponent(ie)}`);D(te)}catch{D(null)}}async function oe(M){if(S===M){w(null);return}w(M),N([]),D(null),_(""),F(!1),h("Analysiere Repository…");try{const W=await xe(`/api/hf/quants?repo=${encodeURIComponent(M)}`);N(W.quants);const ie=W.quants.includes("Q4_K_M")?"Q4_K_M":W.quants[0]||"Q4_K_M";C(ie),h(W.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),W.quants.length&&me(W.repo,ie,"")}catch(W){h(`Fehler: ${W}`)}}function ae(){const M=v.trim();M&&(o(W=>W.some(ie=>ie.repo===M)?W:[{repo:M,downloads:0,likes:0},...W]),b(""),oe(M))}const Z=A?t.find(M=>(M.role||"").toLowerCase()===A):void 0;async function ee(M){if((O==null?void 0:O.fit.level)==="too_tight"&&!B){F(!0);return}q(W=>({...W,[M]:"Starte…"}));try{await xe("/api/models/install",{method:"POST",body:JSON.stringify({repo:M,quant:E,role:A||void 0,jinja:!0})}),q(W=>({...W,[M]:"Download läuft"})),F(!1)}catch{q(ie=>({...ie,[M]:"Fehler"}))}}const re=M=>{var ie;const W=((ie=M.split("/").pop())==null?void 0:ie.toLowerCase().replace(/-gguf$/i,""))||"";return W.length>3&&t.some(te=>te.name.toLowerCase().includes(W))},I=M=>M==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":M==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(xo,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx("input",{value:r,onChange:M=>n(M.target.value),onKeyDown:M=>M.key==="Enter"&&ce(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),s.jsx("button",{onClick:ce,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:_R.map(M=>s.jsxs("button",{onClick:()=>ge(M),className:X("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",m===M.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[M.key==="popular"&&s.jsx(GM,{className:"h-3 w-3"}),M.label]},M.key))}),c?s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):s.jsxs("div",{className:"space-y-2",children:[i.map(M=>{const W=S===M.repo,ie=re(M.repo),te=M.repo.includes("/")?M.repo.split("/")[0]:"—",J=M.repo.split("/").pop();return s.jsxs("div",{className:X("rounded-xl border bg-card/45 backdrop-blur-md transition-all",W?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[s.jsxs("button",{onClick:()=>oe(M.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:M.repo,children:J}),ie&&s.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[s.jsx(Mt,{className:"h-2.5 w-2.5"})," installiert"]})]}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[s.jsx("span",{children:te}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Ws,{className:"h-3 w-3"})," ",hk(M.downloads)]}),M.likes>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ZM,{className:"h-3 w-3"})," ",hk(M.likes)]})]})]}),W?s.jsx(JN,{className:"h-4 w-4 text-muted-foreground shrink-0"}):s.jsx(rl,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),W&&s.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:k.length===0?s.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:f||"Lade Quants…"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),s.jsx("select",{value:E,onChange:se=>{C(se.target.value),me(M.repo,se.target.value,A)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:k.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))}),s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),s.jsxs("select",{value:A,onChange:se=>{_(se.target.value),me(M.repo,E,se.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[s.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),MR.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))]}),s.jsx("button",{onClick:()=>ee(M.repo),disabled:!!$[M.repo]&&$[M.repo]==="Download läuft",className:X("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",B?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:$[M.repo]?$[M.repo]:B?s.jsxs(s.Fragment,{children:[s.jsx(vr,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):s.jsxs(s.Fragment,{children:[s.jsx(Ws,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),O&&s.jsxs("div",{className:X("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",I(O.fit.level)),children:[s.jsx("span",{className:"font-bold uppercase tracking-wide",children:O.fit.text}),s.jsxs("span",{className:"font-mono opacity-90",children:["~",O.params_b,"B · ~",O.fit.req_gb," GB / ",O.sys_ram_gb," GB · ~",O.fit.tps," t/s"]}),O.fit.level!=="too_tight"?s.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(O.assigned_ctx/1024).toFixed(0),"k"]}):s.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),Z&&s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-400",children:[s.jsx(vr,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),s.jsxs("span",{children:["Rolle ",s.jsxs("strong",{children:["„",A,'"']})," hält aktuell ",s.jsx("strong",{children:Z.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},M.repo)}),!i.length&&!c&&s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:f||"Keine Ergebnisse."})]}),s.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),s.jsx("input",{value:v,onChange:M=>b(M.target.value),onKeyDown:M=>M.key==="Enter"&&ae(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground font-mono"}),s.jsx("button",{onClick:ae,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Laden"})]})]})}const DR={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:wa},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:Sa},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Us},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Cc},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:IM},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:vv},kritiker:{title:"Kritisches Prüf-Hirn",desc:"Schärfer Blick für Fehler, Schwachstellen und Sicherheitslücken — denkt skeptisch, bevor du deployst.",icon:d5},reranker:{title:"Gedächtnis-Sortierer",desc:"Sortiert und gewichtet gespeicherte Fakten nach Relevanz — damit die richtige Info sofort da ist.",icon:xo}};function RR(){const{data:e,isLoading:t,error:r}=xR(),{data:n}=Ni(),{data:i}=wh(),o=(n==null?void 0:n.models)??[],c=r?String(r):"",[u,f]=x.useState({}),[h,m]=x.useState({}),[p,v]=x.useState("recommended");async function b(S,w,k,N){f(E=>({...E,[S]:"Starte..."}));try{await xe("/api/models/install",{method:"POST",body:JSON.stringify({repo:S,role:w,quant:k,jinja:N})}),f(E=>({...E,[S]:"Download läuft"}))}catch{f(C=>({...C,[S]:"Fehler"}))}}return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([S,w])=>s.jsx("button",{onClick:()=>v(S),className:X("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",p===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:w},S))}),p==="browse"?s.jsx(TR,{}):t?s.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):c||!e?s.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",c,")."]}):s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[s.jsxs("div",{children:["Modell-Registry geladen für ",s.jsxs("span",{className:"text-foreground font-bold",children:[e.sys_ram_gb," GB"]})," System-RAM."]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(yI,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),s.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),s.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:e.categories.map(S=>{const w=DR[S.role]||{title:S.title||S.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:a5},k=w.icon,N=o.find(D=>D.role===S.role||(D.aliases||[]).includes(S.role)),E=i==null?void 0:i.model_list.find(D=>D.role===S.role),C=S.models.find(D=>D.repo===S.recommended)||S.models[0];if(!C)return null;const A=u[C.repo],_=S.models.filter(D=>D.repo!==S.recommended),O=!!h[S.role];return s.jsxs("div",{className:X("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",N?"border-border/60":"border-primary/20 shadow-primary/5"),children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:s.jsx(k,{className:"h-5.5 w-5.5"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:w.title}),s.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",S.role]})]})]}),N?s.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):s.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:w.desc}),s.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:N?s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:N.name,children:N.name.split("/").pop()}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[s.jsxs("span",{children:["Größe: ",Av(N.size_bytes||0)]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",N.quant||"GGUF"]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:C.name,children:C.name}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{children:["Ersteller: ",C.author]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",C.quant]})]}),s.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:s.jsx(NR,{fit:C.fit})})]})}),s.jsx("div",{className:"pt-1",children:N?E?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),s.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),s.jsxs("button",{onClick:()=>b(E.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!u[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[s.jsx(Ws,{className:"h-3.5 w-3.5"}),u[E.repo]||"Auf neue Version aktualisieren"]})]}):s.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[s.jsx(Mt,{className:"h-4 w-4"})," Auf neuestem Stand"]}):s.jsxs("button",{onClick:()=>b(C.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!A,className:X("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",A?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[s.jsx(Ws,{className:"h-3.5 w-3.5"}),A||"Optimales Modell einsetzen"]})})]}),_.length>0&&s.jsxs("div",{className:"border-t border-border/20 pt-3",children:[s.jsxs("button",{onClick:()=>m(D=>({...D,[S.role]:!O})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[O?s.jsx(JN,{className:"h-3 w-3"}):s.jsx(rl,{className:"h-3 w-3"}),s.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",_.length,")"]})]}),O&&s.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:_.map(D=>s.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),s.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[s.jsxs("span",{children:["Quant: ",D.quant]}),s.jsx("span",{children:"•"}),s.jsx("span",{children:D.fit.text})]})]}),s.jsx("button",{onClick:()=>b(D.repo,S.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!u[D.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:u[D.repo]||"Installieren"})]},D.repo))})]})]},S.role)})})]})]})}function LR(){const[e,t]=x.useState("cockpit");return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(r=>s.jsx("button",{onClick:()=>t(r),className:X("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",e===r?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:r==="cockpit"?"Werkbank":"Modelle finden"},r))})]}),s.jsx(kR,{}),s.jsx("div",{className:"transition-all duration-300",children:e==="cockpit"?s.jsx(CR,{}):s.jsx(RR,{})})]})}const mk={hermes_desktop:"Hermes Desktop: Browser-Login",kilo:"Kilo: Einstellungen → API Provider",claude_code:"env / Übersetzer"};function vg({line:e,loading:t}){return t||!e?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[s.jsx(Bt,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):e.ok?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[s.jsx(e5,{className:"h-3 w-3"})," ",e.detail]}):s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[s.jsx(zM,{className:"h-3 w-3"})," ",e.detail]})}function xg({tool:e,fileName:t,accent:r,copied:n,onCopy:i}){return s.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[s.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),s.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:s.jsx("span",{children:t})}),s.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[n?s.jsx(Mt,{className:"h-3.5 w-3.5 text-emerald-400"}):s.jsx(xv,{className:"h-3.5 w-3.5"}),s.jsx("span",{children:n?"Kopiert":"Kopieren"})]})]}),s.jsx("pre",{className:X("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",r==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:s.jsx("code",{children:e.snippet})})]})}function hE(){const[e,t]=x.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[r,n]=x.useState(localStorage.getItem("mc_mcp_path")||""),[i,o]=x.useState("kilo"),[c,u]=x.useState(!1),[f,h]=x.useState(null),m=new URLSearchParams({host:e});r&&m.set("mcp_path",r);const{data:p,error:v}=bR(m.toString()),{data:b,isLoading:S}=uE(),w=v?String(v):"";function k(_){t(_),_&&localStorage.setItem("mc_host",_)}function N(_){n(_),localStorage.setItem("mc_mcp_path",_)}const E=p==null?void 0:p.tools.hermes_desktop,C=p==null?void 0:p.tools[i];async function A(_,O){O&&(await navigator.clipboard.writeText(O),h(_),setTimeout(()=>h(null),1500))}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"text-foreground",children:"Hermes Desktop"})," ist die Tür zur Box — einmal verbinden, fertig. Für Spezialfälle gibt es darunter die rohen Leitungen (Gateway /v1 + Gedächtnis-MCP) für sonstige Tools."]})]}),s.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[s.jsx(og,{className:"h-7 w-7 mx-auto text-muted-foreground"}),s.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),s.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Hermes Desktop · Kilo Code · Claude Code …"})]}),s.jsxs("div",{className:"flex flex-col gap-2.5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[s.jsx(bi,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),s.jsx(vg,{line:b==null?void 0:b.gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[s.jsx(Sa,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),s.jsx(vg,{line:b==null?void 0:b.memory,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-emerald-500/25 bg-emerald-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-emerald-300",children:[s.jsx(og,{className:"h-3.5 w-3.5"})," Leitung 3 — Desktop-Gateway"]}),s.jsx(vg,{line:b==null?void 0:b.desktop_gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-emerald-300/80",children:"Desktop-Gateway · :9119 · API-Status"})]})]})]})]}),s.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",s.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",s.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," und das Desktop-Gateway bietet die Agenten-Schnittstelle — alle drei Leitungen werden unabhängig eingerichtet."]})]}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(QM,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),s.jsx("input",{value:e,onChange:_=>k(_.target.value),"aria-label":"Box LAN IP-Adresse",spellCheck:!1,placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(r5,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",s.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),s.jsx("input",{value:r,onChange:_=>N(_.target.value),"aria-label":"Lokaler MCP-Scriptpfad",spellCheck:!1,placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),w&&s.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",w]}),p&&s.jsxs("div",{className:"space-y-5",children:[E&&s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-emerald-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx(og,{className:"h-4 w-4 text-emerald-400"}),"Hermes Desktop anbinden",s.jsx("span",{className:"text-[10px] font-medium text-emerald-400/90 normal-case",children:"der Hauptweg"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Die Desktop-App dockt remote an die Box an — volle Agent-Oberfläche, Projekte, Review, Gedächtnis inklusive."})]}),E.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-emerald-400 shrink-0 mt-0.5"}),s.jsx("span",{children:E.note})]}),s.jsx(xg,{tool:E,fileName:mk.hermes_desktop,accent:"teal",copied:f==="desktop",onCopy:()=>A("desktop",E.snippet)})]}),s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/30",children:[s.jsxs("button",{onClick:()=>u(_=>!_),className:"flex w-full items-center gap-2 p-4 text-sm font-space font-bold text-foreground cursor-pointer hover:text-primary transition-colors",children:[c?s.jsx(rl,{className:"h-4 w-4"}):s.jsx(Gn,{className:"h-4 w-4"}),"Sonstige Tools (roher /v1-Zugang + Gedächtnis-MCP)",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"Kilo Code · Claude Code · Eigenbau"})]}),c&&s.jsxs("div",{className:"grid gap-5 lg:grid-cols-2 p-4 pt-0",children:[s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(p.tools).filter(([_])=>_!=="hermes_desktop").map(([_,O])=>s.jsx("button",{onClick:()=>o(_),className:X("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===_?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:O.label},_))}),C&&s.jsxs(s.Fragment,{children:[C.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),s.jsx("span",{children:C.note})]}),s.jsx(xg,{tool:C,fileName:mk[i]||"config.json",accent:"teal",copied:f==="model",onCopy:()=>A("model",C.snippet)})]})]}),s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",s.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),s.jsx("span",{children:p.memory.note})]}),s.jsx(xg,{tool:p.memory,fileName:"mcp.json",accent:"violet",copied:f==="memory",onCopy:()=>A("memory",p.memory.snippet)})]})]})]})]})]})}const $R="modulepreload",zR=function(e){return"/"+e},pk={},FR=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){let c=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=c(r.map(h=>{if(h=zR(h),h in pk)return;pk[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":$R,m||(v.as="script"),v.crossOrigin="",v.href=h,f&&v.setAttribute("nonce",f),document.head.appendChild(v),m)return new Promise((b,S)=>{v.addEventListener("load",b),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return i.then(c=>{for(const u of c||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};class BR extends x.Component{constructor(){super(...arguments);is(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?s.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:[s.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),s.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const UR=x.lazy(()=>FR(()=>import("./GraphView-Ce-iMRLX.js"),[]).then(e=>({default:e.GraphView}))),$d=["identity","knowledge","rules","events"],gk=new Set(["auto","agent","hermes"]),yg={identity:{label:"Identität",icon:wI,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:nl,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:hI,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:mh,bg:"bg-amber-500/10",text:"text-amber-400"}},vk={label:"Gedächtnis",icon:gv,text:"text-muted-foreground"},WR={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},xk=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: +Trotzdem exklusiv laden?`,()=>oe(J));return}oe(J)}async function Z(J){const se=p.find(pe=>pe.name===J);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" ist lebenswichtig und bleibt geladen.`);return}try{await xe(`/api/models/${encodeURIComponent(J)}/unload`,{method:"POST"}),F()}catch(pe){c("Fehler",`Entladen fehlgeschlagen: ${pe.message||pe}`)}}async function ee(J,se){try{const pe=await xe(`/api/models/${encodeURIComponent(se)}/role`,{method:"POST",body:JSON.stringify({role:J||null})});F(),pe!=null&&pe.warning&&c("Rolle gesetzt — Hinweis",pe.warning)}catch(pe){c("Fehler",`Rolle zuweisen fehlgeschlagen: ${pe.message||pe}`)}}async function re(J,se){let pe=null;try{pe=await xe(`/api/models/${encodeURIComponent(J)}/ctx/auto`)}catch{}const ne=pe?`Optimal für dein Setup: ${(pe.ctx/1024).toFixed(0)}k (${pe.ctx}). »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",ne,String(se||32768),async ye=>{if(ye)try{await xe(`/api/models/${encodeURIComponent(J)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ye,10)})}),F()}catch(Oe){c("Fehler",`Kontext setzen fehlgeschlagen: ${Oe.message||Oe}`)}},void 0,pe?{autoValue:String(pe.ctx),autoLabel:`Auto (${(pe.ctx/1024).toFixed(0)}k)`}:void 0)}async function I(J){const se=p.find(pe=>pe.name===J);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" kann nicht gelöscht werden. Weise die Rolle zuerst einem anderen Modell zu.`);return}u("Modell löschen?",`„${Ga(J)}" und alle GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await xe(`/api/models/${encodeURIComponent(J)}`,{method:"DELETE"}),N===J&&E(null),F()}catch(pe){c("Fehler",`Löschen fehlgeschlagen: ${pe.message||pe}`)}})}return r?s.jsx("div",{className:"py-16 text-center text-xs text-muted-foreground",children:"Werkbank wird geladen …"}):n?s.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",String(n),")."]}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(AR,{running:$,capacityBytes:ge,realUsedBytes:U,selected:N,onSelect:E}),s.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)]",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-4 shadow-lg shadow-black/15 backdrop-blur-md",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(xo,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),s.jsx("input",{value:C,onChange:J=>A(J.target.value),placeholder:"Modell suchen …",className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 pl-8 pr-2 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"})]}),s.jsx("div",{className:"flex rounded-lg border border-border/40 bg-background/30 p-0.5",children:["all","in_use"].map(J=>s.jsx("button",{onClick:()=>O(J),className:X("rounded-md px-2 py-1 text-[9px] font-bold uppercase transition-all cursor-pointer",_===J?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:J==="all"?"Alle":"In Benutzung"},J))})]}),s.jsx("div",{className:"max-h-[60vh] space-y-1.5 overflow-y-auto scrollbar-thin pr-1",children:ce.length===0?s.jsx("div",{className:"rounded-xl border border-dashed border-border/50 p-8 text-center text-xs text-muted-foreground",children:"Keine Modelle."}):ce.map(J=>{const se=v.includes(J.name),pe=N===J.name,ne=pf(J.name),ye=gf(J.role);return s.jsxs("button",{onClick:()=>E(J.name),className:X("flex w-full items-center gap-2.5 rounded-xl border p-2.5 text-left transition-all cursor-pointer",pe?"border-primary/60 bg-primary/10":"border-border/40 bg-background/20 hover:border-primary/30 hover:bg-background/40"),children:[s.jsx("span",{className:X("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border text-[10px] font-bold",ne.color),children:ne.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate font-mono text-xs font-semibold text-foreground",children:Ga(J.name)}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[J.role&&s.jsx("span",{className:X("h-2 w-2 rounded-sm",ye.dot)}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:J.role?dt(J.role).short:"keine Rolle"}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:["· ",lr(J.size_bytes)]})]})]}),se?s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[9px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]}):J.incomplete?s.jsx("span",{className:"shrink-0 text-[9px] font-bold uppercase text-amber-400",children:"⚠ fehlt"}):s.jsx("span",{className:"shrink-0 text-[9px] font-semibold uppercase text-muted-foreground/50",children:"bereit"})]},J.name)})})]}),s.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-5 shadow-lg shadow-black/15 backdrop-blur-md",children:me?s.jsx(PR,{m:me,warm:v.includes(me.name),expert:m,protectedRole:b(me.role),coresident:k(me.name),onLoad:()=>ae(me.name),onUnload:()=>Z(me.name),onRole:J=>ee(J,me.name),onCtx:()=>re(me.name,me.ctx),onSpec:()=>B(me),onDelete:()=>I(me.name)}):s.jsxs("div",{className:"flex h-full min-h-[16rem] flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[s.jsx(bi,{className:"h-8 w-8 opacity-40"}),s.jsx("p",{className:"text-sm font-semibold",children:"Links ein Modell wählen"}),s.jsx("p",{className:"text-xs",children:"Dann verwaltest du es hier — laden, Rolle, Kontext, löschen."})]})})]}),D&&s.jsx(fE,{model:D,onClose:()=>B(null),onChanged:F}),h]})}function PR({m:e,warm:t,expert:r,protectedRole:n,coresident:i,onLoad:o,onUnload:c,onRole:u,onCtx:f,onSpec:h,onDelete:m}){const p=pf(e.name),v=t&&n;return s.jsxs("div",{className:"flex h-full flex-col gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:X("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border text-sm font-bold",p.color),children:p.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"break-all font-mono text-sm font-bold text-foreground",children:Ga(e.name)}),s.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[e.role?s.jsx(mo,{role:e.role}):s.jsx("span",{className:"rounded border border-dashed border-border/50 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"keine Rolle"}),n&&s.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 text-[10px] text-muted-foreground",title:"Lebenswichtig — geschützt",children:[s.jsx(s5,{className:"mr-0.5 inline h-3 w-3"}),"geschützt"]}),i&&s.jsxs("span",{className:"rounded border border-fuchsia-500/30 bg-fuchsia-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase text-fuchsia-300",children:[s.jsx(Sa,{className:"mr-0.5 inline h-3 w-3"}),"Ko-resident"]}),t&&s.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]})]})]})]}),s.jsxs("button",{onClick:t?c:o,disabled:e.incomplete&&!t||v,className:X("flex h-11 w-full items-center justify-center gap-2 rounded-xl border text-sm font-bold transition-all cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",t?"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20":"border-primary/40 bg-primary/10 text-primary hover:bg-primary/20"),title:v?`„${dt(e.role).label}" bleibt geladen (geschützt).`:void 0,children:[t?s.jsx(cI,{className:"h-4 w-4"}):s.jsx(u5,{className:"h-4 w-4"}),v?"🔒 bleibt geladen":t?"Entladen":"Ins Warm-Set laden"]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Rolle"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx(fk,{active:!e.role,onClick:()=>u(""),dot:"bg-slate-400",label:"keine"}),qx.map(b=>s.jsx(fk,{active:e.role===b.role,onClick:()=>u(b.role),dot:gf(b.role).dot,label:b.short},b.role))]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[s.jsx(OR,{icon:va,label:"Größe",value:lr(e.size_bytes)}),s.jsxs("button",{onClick:f,className:"group flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5 text-left transition-colors hover:border-primary/40 cursor-pointer",children:[s.jsx(c5,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:"Kontext · ändern"}),s.jsx("div",{className:"font-semibold text-foreground",children:Cv(e.ctx)})]})]})]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Beschleuniger"}),r&&s.jsxs("button",{onClick:h,className:X("flex h-6 items-center gap-1 rounded-lg border px-2 text-[9px] font-bold uppercase transition-colors cursor-pointer",e.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":e.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),children:[s.jsx(wa,{className:"h-3 w-3"})," Spec"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.spec_active&&s.jsx(Ld,{tone:"emerald",label:"Spec-Decoding aktiv"}),!e.spec_active&&e.spec_draft_model&&s.jsx(Ld,{tone:"amber",label:"Spec inaktiv"}),e.prompt_cache&&s.jsx(Ld,{tone:"cyan",label:"Prompt-Cache"}),e.parallel_slots>1&&s.jsx(Ld,{tone:"violet",label:`${e.parallel_slots} Slots`}),!e.spec_active&&!e.spec_draft_model&&!e.prompt_cache&&e.parallel_slots<=1&&s.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"keine aktiv"})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:s.jsx(Pv,{caps:e.capabilities})}),s.jsxs("button",{onClick:m,disabled:n,className:X("mt-auto flex h-9 items-center justify-center gap-1.5 rounded-lg border text-xs font-semibold transition-colors",n?"cursor-not-allowed border-border/30 text-muted-foreground/40":"border-red-500/30 text-red-400 hover:bg-red-500/10 cursor-pointer"),children:[s.jsx(Oc,{className:"h-3.5 w-3.5"})," ",n?"geschützt — nicht löschbar":"Modell löschen"]})]})}function fk({active:e,onClick:t,dot:r,label:n}){return s.jsxs("button",{onClick:t,className:X("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[10px] font-semibold transition-all cursor-pointer",e?"border-primary/60 bg-primary/15 text-foreground":"border-border/40 bg-background/20 text-muted-foreground hover:border-primary/30"),children:[s.jsx("span",{className:X("h-2 w-2 rounded-sm",r)}),n,e&&s.jsx(Mt,{className:"h-3 w-3 text-primary"})]})}function OR({icon:e,label:t,value:r}){return s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5",children:[s.jsx(e,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t}),s.jsx("div",{className:"font-semibold text-foreground",children:r})]})]})}function Ld({tone:e,label:t}){const r={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20",cyan:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",violet:"bg-violet-500/10 text-violet-400 border-violet-500/20"}[e];return s.jsx("span",{className:X("rounded border px-1.5 py-0.5 text-[10px] font-semibold",r),children:t})}const _R=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],MR=["fast","heavy","coder","vision","hermes","scout"],IR=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function hk(e){return IR.format(e)}function TR(){const{data:e}=Ni(),t=(e==null?void 0:e.models)??[],[r,n]=x.useState(""),[i,o]=x.useState([]),[c,u]=x.useState(!1),[f,h]=x.useState(""),[m,p]=x.useState("popular"),[v,b]=x.useState(""),[S,w]=x.useState(null),[k,N]=x.useState([]),[E,C]=x.useState("Q4_K_M"),[A,_]=x.useState(""),[O,D]=x.useState(null),[B,F]=x.useState(!1),[$,q]=x.useState({});async function U(M){u(!0),h("");try{const W=await xe(`/api/hf/search?q=${encodeURIComponent(M)}`);o(W.results),W.results.length||h("Keine Ergebnisse.")}catch(W){h(`Suche fehlgeschlagen: ${W}`)}finally{u(!1)}}x.useEffect(()=>{U("")},[]);function ge(M){p(M.key),n(""),U(M.q)}function ce(){p(""),U(r)}async function me(M,W,ie){F(!1);try{const te=await xe(`/api/fit?params_b=0&quant=${encodeURIComponent(W)}&ctx=8192&name=${encodeURIComponent(M)}&role=${encodeURIComponent(ie)}`);D(te)}catch{D(null)}}async function oe(M){if(S===M){w(null);return}w(M),N([]),D(null),_(""),F(!1),h("Analysiere Repository…");try{const W=await xe(`/api/hf/quants?repo=${encodeURIComponent(M)}`);N(W.quants);const ie=W.quants.includes("Q4_K_M")?"Q4_K_M":W.quants[0]||"Q4_K_M";C(ie),h(W.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),W.quants.length&&me(W.repo,ie,"")}catch(W){h(`Fehler: ${W}`)}}function ae(){const M=v.trim();M&&(o(W=>W.some(ie=>ie.repo===M)?W:[{repo:M,downloads:0,likes:0},...W]),b(""),oe(M))}const Z=A?t.find(M=>(M.role||"").toLowerCase()===A):void 0;async function ee(M){if((O==null?void 0:O.fit.level)==="too_tight"&&!B){F(!0);return}q(W=>({...W,[M]:"Starte…"}));try{await xe("/api/models/install",{method:"POST",body:JSON.stringify({repo:M,quant:E,role:A||void 0,jinja:!0})}),q(W=>({...W,[M]:"Download läuft"})),F(!1)}catch{q(ie=>({...ie,[M]:"Fehler"}))}}const re=M=>{var ie;const W=((ie=M.split("/").pop())==null?void 0:ie.toLowerCase().replace(/-gguf$/i,""))||"";return W.length>3&&t.some(te=>te.name.toLowerCase().includes(W))},I=M=>M==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":M==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(xo,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx("input",{value:r,onChange:M=>n(M.target.value),onKeyDown:M=>M.key==="Enter"&&ce(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),s.jsx("button",{onClick:ce,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:_R.map(M=>s.jsxs("button",{onClick:()=>ge(M),className:X("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",m===M.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[M.key==="popular"&&s.jsx(GM,{className:"h-3 w-3"}),M.label]},M.key))}),c?s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):s.jsxs("div",{className:"space-y-2",children:[i.map(M=>{const W=S===M.repo,ie=re(M.repo),te=M.repo.includes("/")?M.repo.split("/")[0]:"—",J=M.repo.split("/").pop();return s.jsxs("div",{className:X("rounded-xl border bg-card/45 backdrop-blur-md transition-all",W?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[s.jsxs("button",{onClick:()=>oe(M.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:M.repo,children:J}),ie&&s.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[s.jsx(Mt,{className:"h-2.5 w-2.5"})," installiert"]})]}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[s.jsx("span",{children:te}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Ws,{className:"h-3 w-3"})," ",hk(M.downloads)]}),M.likes>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ZM,{className:"h-3 w-3"})," ",hk(M.likes)]})]})]}),W?s.jsx(JN,{className:"h-4 w-4 text-muted-foreground shrink-0"}):s.jsx(rl,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),W&&s.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:k.length===0?s.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:f||"Lade Quants…"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),s.jsx("select",{value:E,onChange:se=>{C(se.target.value),me(M.repo,se.target.value,A)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:k.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))}),s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),s.jsxs("select",{value:A,onChange:se=>{_(se.target.value),me(M.repo,E,se.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[s.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),MR.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))]}),s.jsx("button",{onClick:()=>ee(M.repo),disabled:!!$[M.repo]&&$[M.repo]==="Download läuft",className:X("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",B?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:$[M.repo]?$[M.repo]:B?s.jsxs(s.Fragment,{children:[s.jsx(vr,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):s.jsxs(s.Fragment,{children:[s.jsx(Ws,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),O&&s.jsxs("div",{className:X("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",I(O.fit.level)),children:[s.jsx("span",{className:"font-bold uppercase tracking-wide",children:O.fit.text}),s.jsxs("span",{className:"font-mono opacity-90",children:["~",O.params_b,"B · ~",O.fit.req_gb," GB / ",O.sys_ram_gb," GB · ~",O.fit.tps," t/s"]}),O.fit.level!=="too_tight"?s.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(O.assigned_ctx/1024).toFixed(0),"k"]}):s.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),Z&&s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-400",children:[s.jsx(vr,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),s.jsxs("span",{children:["Rolle ",s.jsxs("strong",{children:["„",A,'"']})," hält aktuell ",s.jsx("strong",{children:Z.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},M.repo)}),!i.length&&!c&&s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:f||"Keine Ergebnisse."})]}),s.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),s.jsx("input",{value:v,onChange:M=>b(M.target.value),onKeyDown:M=>M.key==="Enter"&&ae(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground font-mono"}),s.jsx("button",{onClick:ae,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Laden"})]})]})}const DR={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:wa},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:Sa},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Us},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Cc},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:IM},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:vv},kritiker:{title:"Kritisches Prüf-Hirn",desc:"Schärfer Blick für Fehler, Schwachstellen und Sicherheitslücken — denkt skeptisch, bevor du deployst.",icon:d5},reranker:{title:"Gedächtnis-Sortierer",desc:"Sortiert und gewichtet gespeicherte Fakten nach Relevanz — damit die richtige Info sofort da ist.",icon:xo}};function RR(){const{data:e,isLoading:t,error:r}=xR(),{data:n}=Ni(),{data:i}=wh(),o=(n==null?void 0:n.models)??[],c=r?String(r):"",[u,f]=x.useState({}),[h,m]=x.useState({}),[p,v]=x.useState("recommended");async function b(S,w,k,N){f(E=>({...E,[S]:"Starte..."}));try{await xe("/api/models/install",{method:"POST",body:JSON.stringify({repo:S,role:w,quant:k,jinja:N})}),f(E=>({...E,[S]:"Download läuft"}))}catch{f(C=>({...C,[S]:"Fehler"}))}}return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([S,w])=>s.jsx("button",{onClick:()=>v(S),className:X("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",p===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:w},S))}),p==="browse"?s.jsx(TR,{}):t?s.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):c||!e?s.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",c,")."]}):s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[s.jsxs("div",{children:["Modell-Registry geladen für ",s.jsxs("span",{className:"text-foreground font-bold",children:[e.sys_ram_gb," GB"]})," System-RAM."]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(yI,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),s.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),s.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:e.categories.map(S=>{const w=DR[S.role]||{title:S.title||S.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:a5},k=w.icon,N=o.find(D=>D.role===S.role||(D.aliases||[]).includes(S.role)),E=i==null?void 0:i.model_list.find(D=>D.role===S.role),C=S.models.find(D=>D.repo===S.recommended)||S.models[0];if(!C)return null;const A=u[C.repo],_=S.models.filter(D=>D.repo!==S.recommended),O=!!h[S.role];return s.jsxs("div",{className:X("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",N?"border-border/60":"border-primary/20 shadow-primary/5"),children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:s.jsx(k,{className:"h-5.5 w-5.5"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:w.title}),s.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",S.role]})]})]}),N?s.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):s.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:w.desc}),s.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:N?s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:N.name,children:N.name.split("/").pop()}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[s.jsxs("span",{children:["Größe: ",Av(N.size_bytes||0)]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",N.quant||"GGUF"]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:C.name,children:C.name}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{children:["Ersteller: ",C.author]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",C.quant]})]}),s.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:s.jsx(NR,{fit:C.fit})})]})}),s.jsx("div",{className:"pt-1",children:N?E?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),s.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),s.jsxs("button",{onClick:()=>b(E.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!u[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[s.jsx(Ws,{className:"h-3.5 w-3.5"}),u[E.repo]||"Auf neue Version aktualisieren"]})]}):s.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[s.jsx(Mt,{className:"h-4 w-4"})," Auf neuestem Stand"]}):s.jsxs("button",{onClick:()=>b(C.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!A,className:X("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",A?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[s.jsx(Ws,{className:"h-3.5 w-3.5"}),A||"Optimales Modell einsetzen"]})})]}),_.length>0&&s.jsxs("div",{className:"border-t border-border/20 pt-3",children:[s.jsxs("button",{onClick:()=>m(D=>({...D,[S.role]:!O})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[O?s.jsx(JN,{className:"h-3 w-3"}):s.jsx(rl,{className:"h-3 w-3"}),s.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",_.length,")"]})]}),O&&s.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:_.map(D=>s.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),s.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[s.jsxs("span",{children:["Quant: ",D.quant]}),s.jsx("span",{children:"•"}),s.jsx("span",{children:D.fit.text})]})]}),s.jsx("button",{onClick:()=>b(D.repo,S.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!u[D.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:u[D.repo]||"Installieren"})]},D.repo))})]})]},S.role)})})]})]})}function LR(){const[e,t]=x.useState("cockpit");return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(r=>s.jsx("button",{onClick:()=>t(r),className:X("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",e===r?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:r==="cockpit"?"Werkbank":"Modelle finden"},r))})]}),s.jsx(kR,{}),s.jsx("div",{className:"transition-all duration-300",children:e==="cockpit"?s.jsx(CR,{}):s.jsx(RR,{})})]})}const mk={hermes_desktop:"Hermes Desktop: Browser-Login",kilo:"Kilo: Einstellungen → API Provider",claude_code:"env / Übersetzer"};function vg({line:e,loading:t}){return t||!e?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[s.jsx(Bt,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):e.ok?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[s.jsx(e5,{className:"h-3 w-3"})," ",e.detail]}):s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[s.jsx(zM,{className:"h-3 w-3"})," ",e.detail]})}function xg({tool:e,fileName:t,accent:r,copied:n,onCopy:i}){return s.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[s.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),s.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:s.jsx("span",{children:t})}),s.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[n?s.jsx(Mt,{className:"h-3.5 w-3.5 text-emerald-400"}):s.jsx(xv,{className:"h-3.5 w-3.5"}),s.jsx("span",{children:n?"Kopiert":"Kopieren"})]})]}),s.jsx("pre",{className:X("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",r==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:s.jsx("code",{children:e.snippet})})]})}function hE(){const[e,t]=x.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[r,n]=x.useState(localStorage.getItem("mc_mcp_path")||""),[i,o]=x.useState("kilo"),[c,u]=x.useState(!1),[f,h]=x.useState(null),m=new URLSearchParams({host:e});r&&m.set("mcp_path",r);const{data:p,error:v}=bR(m.toString()),{data:b,isLoading:S}=uE(),w=v?String(v):"";function k(_){t(_),_&&localStorage.setItem("mc_host",_)}function N(_){n(_),localStorage.setItem("mc_mcp_path",_)}const E=p==null?void 0:p.tools.hermes_desktop,C=p==null?void 0:p.tools[i];async function A(_,O){O&&(await navigator.clipboard.writeText(O),h(_),setTimeout(()=>h(null),1500))}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"text-foreground",children:"Hermes Desktop"})," ist die Tür zur Box — einmal verbinden, fertig. Für Spezialfälle gibt es darunter die rohen Leitungen (Gateway /v1 + Gedächtnis-MCP) für sonstige Tools."]})]}),s.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[s.jsx(og,{className:"h-7 w-7 mx-auto text-muted-foreground"}),s.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),s.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Hermes Desktop · Kilo Code · Claude Code …"})]}),s.jsxs("div",{className:"flex flex-col gap-2.5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[s.jsx(bi,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),s.jsx(vg,{line:b==null?void 0:b.gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[s.jsx(Sa,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),s.jsx(vg,{line:b==null?void 0:b.memory,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-emerald-500/25 bg-emerald-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-emerald-300",children:[s.jsx(og,{className:"h-3.5 w-3.5"})," Leitung 3 — Desktop-Gateway"]}),s.jsx(vg,{line:b==null?void 0:b.desktop_gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-emerald-300/80",children:"Desktop-Gateway · :9119 · API-Status"})]})]})]})]}),s.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",s.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",s.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," und das Desktop-Gateway bietet die Agenten-Schnittstelle — alle drei Leitungen werden unabhängig eingerichtet."]})]}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(QM,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),s.jsx("input",{value:e,onChange:_=>k(_.target.value),"aria-label":"Box LAN IP-Adresse",spellCheck:!1,placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(r5,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",s.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),s.jsx("input",{value:r,onChange:_=>N(_.target.value),"aria-label":"Lokaler MCP-Scriptpfad",spellCheck:!1,placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),w&&s.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",w]}),p&&s.jsxs("div",{className:"space-y-5",children:[E&&s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-emerald-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx(og,{className:"h-4 w-4 text-emerald-400"}),"Hermes Desktop anbinden",s.jsx("span",{className:"text-[10px] font-medium text-emerald-400/90 normal-case",children:"der Hauptweg"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Die Desktop-App dockt remote an die Box an — volle Agent-Oberfläche, Projekte, Review, Gedächtnis inklusive."})]}),E.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-emerald-400 shrink-0 mt-0.5"}),s.jsx("span",{children:E.note})]}),s.jsx(xg,{tool:E,fileName:mk.hermes_desktop,accent:"teal",copied:f==="desktop",onCopy:()=>A("desktop",E.snippet)})]}),s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/30",children:[s.jsxs("button",{onClick:()=>u(_=>!_),className:"flex w-full items-center gap-2 p-4 text-sm font-space font-bold text-foreground cursor-pointer hover:text-primary transition-colors",children:[c?s.jsx(rl,{className:"h-4 w-4"}):s.jsx(Gn,{className:"h-4 w-4"}),"Sonstige Tools (roher /v1-Zugang + Gedächtnis-MCP)",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"Kilo Code · Claude Code · Eigenbau"})]}),c&&s.jsxs("div",{className:"grid gap-5 lg:grid-cols-2 p-4 pt-0",children:[s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(p.tools).filter(([_])=>_!=="hermes_desktop").map(([_,O])=>s.jsx("button",{onClick:()=>o(_),className:X("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===_?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:O.label},_))}),C&&s.jsxs(s.Fragment,{children:[C.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),s.jsx("span",{children:C.note})]}),s.jsx(xg,{tool:C,fileName:mk[i]||"config.json",accent:"teal",copied:f==="model",onCopy:()=>A("model",C.snippet)})]})]}),s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",s.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),s.jsx("span",{children:p.memory.note})]}),s.jsx(xg,{tool:p.memory,fileName:"mcp.json",accent:"violet",copied:f==="memory",onCopy:()=>A("memory",p.memory.snippet)})]})]})]})]})]})}const $R="modulepreload",zR=function(e){return"/"+e},pk={},FR=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){let c=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=c(r.map(h=>{if(h=zR(h),h in pk)return;pk[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":$R,m||(v.as="script"),v.crossOrigin="",v.href=h,f&&v.setAttribute("nonce",f),document.head.appendChild(v),m)return new Promise((b,S)=>{v.addEventListener("load",b),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return i.then(c=>{for(const u of c||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};class BR extends x.Component{constructor(){super(...arguments);is(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?s.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:[s.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),s.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const UR=x.lazy(()=>FR(()=>import("./GraphView-Cbw5_PCb.js"),[]).then(e=>({default:e.GraphView}))),$d=["identity","knowledge","rules","events"],gk=new Set(["auto","agent","hermes"]),yg={identity:{label:"Identität",icon:wI,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:nl,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:hI,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:mh,bg:"bg-amber-500/10",text:"text-amber-400"}},vk={label:"Gedächtnis",icon:gv,text:"text-muted-foreground"},WR={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},xk=`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/index.html b/frontend/dist/index.html index 3d4d35e..2c7687e 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/views/GraphView.tsx b/frontend/src/views/GraphView.tsx index e2181ce..3d2f70b 100644 --- a/frontend/src/views/GraphView.tsx +++ b/frontend/src/views/GraphView.tsx @@ -112,7 +112,7 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id if (link) link.distance(50) // Simulation neu anschubsen bei neuen Daten - fg.alpha(0.8).restart() + fg.d3ReheatSimulation() }, [graphData]) const activeNode = hovered || selected