diff --git a/frontend/dist/assets/GraphView-Ce-iMRLX.js b/frontend/dist/assets/GraphView-Ce-iMRLX.js new file mode 100644 index 0000000..6d04b31 --- /dev/null +++ b/frontend/dist/assets/GraphView-Ce-iMRLX.js @@ -0,0 +1,44 @@ +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);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);r0&&arguments[0]!==void 0?arguments[0]:6;El(this,e),cr(this,Nt,void 0),cr(this,At,void 0),hr(At,this,n),this.reset()}return Rl(e,[{key:"reset",value:function(){hr(Nt,this,["__reserved for background__"])}},{key:"register",value:function(r){if(ot(Nt,this).length>=Math.pow(2,24-ot(At,this)))return null;var i=ot(Nt,this).length,o=dr(i,ot(At,this)),a=Ll(i+(o<<24-ot(At,this)));return ot(Nt,this).push(r),a}},{key:"lookup",value:function(r){if(!r)return null;var i=typeof r=="string"?Hl(r):yi.apply(void 0,Dl(r));if(!i)return null;var o=i&Math.pow(2,24-ot(At,this))-1,a=i>>24-ot(At,this)&Math.pow(2,ot(At,this))-1;return dr(o,ot(At,this))!==a||o>=ot(Nt,this).length?null:ot(Nt,this)[o]}}])})(),he,Y,_i,vi,Rt,pr,mi,bi,Be,we,re,xi,Mn,pn,gn,Ee={},ze=[],Gl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ue=Array.isArray;function yt(e,n){for(var r in n)e[r]=n[r];return e}function Pn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Vl(e,n,r){var i,o,a,s={};for(a in n)a=="key"?i=n[a]:a=="ref"?o=n[a]:s[a]=n[a];if(arguments.length>2&&(s.children=arguments.length>3?he.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return ie(e,s,i,o,null)}function ie(e,n,r,i,o){var a={type:e,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++_i,__i:-1,__u:0};return o==null&&Y.vnode!=null&&Y.vnode(a),a}function Le(e){return e.children}function ke(e,n){this.props=e,this.context=n}function Gt(e,n){if(n==null)return e.__?Gt(e.__,e.__i+1):null;for(var r;nn&&Rt.sort(bi),e=Rt.shift(),n=Rt.length,Wl(e)}finally{Rt.length=Re.__r=0}}function ki(e,n,r,i,o,a,s,u,f,l,c){var h,d,p,y,x,b,g,k=i&&i.__k||ze,v=n.length;for(f=Bl(r,n,k,f,v),h=0;h0?s=e.__k[a]=ie(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,f=a+d,s.__=e,s.__b=e.__b+1,u=null,(l=s.__i=Xl(s,r,f,h))!=-1&&(h--,(u=r[l])&&(u.__u|=2)),u==null||u.__v==null?(l==-1&&(o>c?d--:of?d--:d++,s.__u|=4))):e.__k[a]=null;if(h)for(a=0;a(c?1:0)){for(o=r-1,a=r+1;o>=0||a=0?o--:a++])!=null&&(2&l.__u)==0&&u==l.key&&f==l.type)return s}return-1}function yr(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||Gl.test(n)?r:r+"px"}function ye(e,n,r,i,o){var a,s;t:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)r&&n in r||yr(e.style,n,"");if(r)for(n in r)i&&r[n]==i[n]||yr(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(xi,"$1")),s=n.toLowerCase(),n=s in e||n=="onFocusOut"||n=="onFocusIn"?s.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=r,r?i?r[re]=i[re]:(r[re]=Mn,e.addEventListener(n,a?gn:pn,a)):e.removeEventListener(n,a?gn:pn,a);else{if(o=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function _r(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[we]==null)n[we]=Mn++;else if(n[we]0?e:Ue(e)?e.map(Ti):e.constructor!==void 0?null:yt({},e)}function Yl(e,n,r,i,o,a,s,u,f){var l,c,h,d,p,y,x,b=r.props||Ee,g=n.props,k=n.type;if(k=="svg"?o="http://www.w3.org/2000/svg":k=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(l=0;l2&&(u.children=arguments.length>3?he.call(arguments,2):r),ie(e.type,u,i||e.key,o||e.ref,null)}he=ze.slice,Y={__e:function(e,n,r,i){for(var o,a,s;n=n.__;)if((o=n.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),s=o.__d),s)return o.__E=o}catch(u){e=u}throw e}},_i=0,vi=function(e){return e!=null&&e.constructor===void 0},ke.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=yt({},this.state),typeof e=="function"&&(e=e(yt({},r),this.props)),e&&yt(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),gr(this))},ke.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gr(this))},ke.prototype.render=Le,Rt=[],mi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,bi=function(e,n){return e.__v.__b-n.__v.__b},Re.__r=0,Be=Math.random().toString(8),we="__d"+Be,re="__a"+Be,xi=/(PointerCapture)$|Capture$/i,Mn=0,pn=_r(!1),gn=_r(!0);function vr(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var cf=`.float-tooltip-kap { + position: absolute; + width: max-content; /* prevent shrinking near right edge */ + max-width: max(50%, 150px); + padding: 3px 5px; + border-radius: 3px; + font: 12px sans-serif; + color: #eee; + background: rgba(0,0,0,0.6); + pointer-events: none; +} +`;ff(cf);var hf=Tn({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.style,a=o===void 0?{}:o,s=!!n&&Ne(n)==="object"&&!!n.node&&typeof n.node=="function",u=st(s?n.node():n);u.style("position")==="static"&&u.style("position","relative"),r.tooltipEl=u.append("div").attr("class","float-tooltip-kap"),Object.entries(a).forEach(function(l){var c=rf(l,2),h=c[0],d=c[1];return r.tooltipEl.style(h,d)}),r.tooltipEl.style("left","-10000px").style("display","none");var f="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,u.on("mousemove.".concat(f),function(l){r.mouseInside=!0;var c=gt(l),h=u.node(),d=h.offsetWidth,p=h.offsetHeight,y=[r.offsetX===null||r.offsetX===void 0?"-".concat(c[0]/d*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?p>130&&p-c[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",c[0]+"px").style("top",c[1]+"px").style("transform","translate(".concat(y.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseover.".concat(f),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseout.".concat(f),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):uf(n.content)?(n.tooltipEl.text(""),lf(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function df(e,n,r){var i,o=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function a(){var s,u=i.length,f,l=0,c=0,h=0;for(s=0;s=(f=(s+u)/2))?s=f:u=f,i=o,!(o=o[h=+c]))return i[h]=a,e;if(l=+e._x.call(null,o.data),n===l)return a.next=o,i?i[h]=a:e._root=a,e;do i=i?i[h]=new Array(2):e._root=new Array(2),(c=n>=(f=(s+u)/2))?s=f:u=f;while((h=+c)==(d=+(l>=f)));return i[d]=o,i[h]=a,e}function gf(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let i=1/0,o=-1/0;for(let a=0,s;ao&&(o=s));if(i>o)return this;this.cover(i).cover(o);for(let a=0;ae||e>=r;)switch(s=+(es||(a=l.x1)=h))&&(l=u[u.length-1],u[u.length-1]=u[u.length-1-c],u[u.length-1-c]=l)}else{var d=Math.abs(e-+this._x.call(null,f.data));d=(l=(s+u)/2))?s=l:u=l,n=r,!(r=r[h=+c]))return this;if(!r.length)break;n[h+1&1]&&(i=n,d=h)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,o?(a?o.next=a:delete o.next,this):n?(a?n[h]=a:delete n[h],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(i?i[d]=r:this._root=r),this):(this._root=a,this)}function xf(e){for(var n=0,r=e.length;n=(h=(u+l)/2))?u=h:l=h,(b=r>=(d=(f+c)/2))?f=d:c=d,o=a,!(a=a[g=b<<1|x]))return o[g]=s,e;if(p=+e._x.call(null,a.data),y=+e._y.call(null,a.data),n===p&&r===y)return s.next=a,o?o[g]=s:e._root=s,e;do o=o?o[g]=new Array(4):e._root=new Array(4),(x=n>=(h=(u+l)/2))?u=h:l=h,(b=r>=(d=(f+c)/2))?f=d:c=d;while((g=b<<1|x)===(k=(y>=d)<<1|p>=h));return o[k]=a,o[g]=s,e}function Pf(e){var n,r,i=e.length,o,a,s=new Array(i),u=new Array(i),f=1/0,l=1/0,c=-1/0,h=-1/0;for(r=0;rc&&(c=o),ah&&(h=a));if(f>c||l>h)return this;for(this.cover(f,l).cover(c,h),r=0;re||e>=o||i>n||n>=a;)switch(l=(nc||(u=y.y0)>h||(f=y.x1)=g)<<1|e>=b)&&(y=d[d.length-1],d[d.length-1]=d[d.length-1-x],d[d.length-1-x]=y)}else{var k=e-+this._x.call(null,p.data),v=n-+this._y.call(null,p.data),_=k*k+v*v;if(_=(d=(s+f)/2))?s=d:f=d,(x=h>=(p=(u+l)/2))?u=p:l=p,n=r,!(r=r[b=x<<1|y]))return this;if(!r.length)break;(n[b+1&3]||n[b+2&3]||n[b+3&3])&&(i=n,g=b)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,o?(a?o.next=a:delete o.next,this):n?(a?n[b]=a:delete n[b],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[g]=r:this._root=r),this):(this._root=a,this)}function If(e){for(var n=0,r=e.length;n=(y=(f+h)/2))?f=y:h=y,(m=r>=(x=(l+d)/2))?l=x:d=x,(A=i>=(b=(c+p)/2))?c=b:p=b,a=s,!(s=s[S=A<<2|m<<1|_]))return a[S]=u,e;if(g=+e._x.call(null,s.data),k=+e._y.call(null,s.data),v=+e._z.call(null,s.data),n===g&&r===k&&i===v)return u.next=s,a?a[S]=u:e._root=u,e;do a=a?a[S]=new Array(8):e._root=new Array(8),(_=n>=(y=(f+h)/2))?f=y:h=y,(m=r>=(x=(l+d)/2))?l=x:d=x,(A=i>=(b=(c+p)/2))?c=b:p=b;while((S=A<<2|m<<1|_)===(T=(v>=b)<<2|(k>=x)<<1|g>=y));return a[T]=s,a[S]=u,e}function Vf(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),i=new Float64Array(n),o=new Float64Array(n);let a=1/0,s=1/0,u=1/0,f=-1/0,l=-1/0,c=-1/0;for(let h=0,d,p,y,x;hf&&(f=p),yl&&(l=y),xc&&(c=x));if(a>f||s>l||u>c)return this;this.cover(a,s,u).cover(f,l,c);for(let h=0;he||e>=s||o>n||n>=u||a>r||r>=f;)switch(d=(ry||(l=v.y0)>x||(c=v.z0)>b||(h=v.x1)=S)<<2|(n>=A)<<1|e>=m)&&(v=g[g.length-1],g[g.length-1]=g[g.length-1-_],g[g.length-1-_]=v)}else{var T=e-+this._x.call(null,k.data),z=n-+this._y.call(null,k.data),M=r-+this._z.call(null,k.data),O=T*T+z*z+M*M;if(OMath.sqrt((e-i)**2+(n-o)**2+(r-a)**2);function Kf(e,n,r,i){const o=[],a=e-i,s=n-i,u=r-i,f=e+i,l=n+i,c=r+i;return this.visit((h,d,p,y,x,b,g)=>{if(!h.length)do{const k=h.data;Zf(e,n,r,this._x(k),this._y(k),this._z(k))<=i&&o.push(k)}while(h=h.next);return d>f||p>l||y>c||x=(x=(s+l)/2))?s=x:l=x,(v=p>=(b=(u+c)/2))?u=b:c=b,(_=y>=(g=(f+h)/2))?f=g:h=g,n=r,!(r=r[m=_<<2|v<<1|k]))return this;if(!r.length)break;(n[m+1&7]||n[m+2&7]||n[m+3&7]||n[m+4&7]||n[m+5&7]||n[m+6&7]||n[m+7&7])&&(i=n,A=m)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,o?(a?o.next=a:delete o.next,this):n?(a?n[m]=a:delete n[m],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[A]=r:this._root=r),this):(this._root=a,this)}function Jf(e){for(var n=0,r=e.length;n1&&(z=S.y+S.vy-A.y-A.vy||St(c)),u>2&&(M=S.z+S.vz-A.z-A.vz||St(c)),O=Math.sqrt(T*T+z*z+M*M),O=(O-a[_])/O*g*i[_],T*=O,z*=O,M*=O,S.vx-=T*(N=l[_]),u>1&&(S.vy-=z*N),u>2&&(S.vz-=M*N),A.vx+=T*(N=1-N),u>1&&(A.vy+=z*N),u>2&&(A.vz+=M*N)}function y(){if(s){var g,k=s.length,v=e.length,_=new Map(s.map((A,S)=>[n(A,S,s),A])),m;for(g=0,f=new Array(k);gtypeof v=="function")||Math.random,u=k.find(v=>[1,2,3].includes(v))||2,y()},p.links=function(g){return arguments.length?(e=g,y(),p):e},p.id=function(g){return arguments.length?(n=g,p):n},p.iterations=function(g){return arguments.length?(h=+g,p):h},p.strength=function(g){return arguments.length?(r=typeof g=="function"?g:Mt(+g),x(),p):r},p.distance=function(g){return arguments.length?(o=typeof g=="function"?g:Mt(+g),b(),p):o},p}const hc=1664525,dc=1013904223,Ar=4294967296;function pc(){let e=1;return()=>(e=(hc*e+dc)%Ar)/Ar}var Cr=3;function Xe(e){return e.x}function Sr(e){return e.y}function gc(e){return e.z}var yc=10,_c=Math.PI*(3-Math.sqrt(5)),vc=Math.PI*20/(9+Math.sqrt(221));function mc(e,n){n=n||2;var r=Math.min(Cr,Math.max(1,Math.round(n))),i,o=1,a=.001,s=1-Math.pow(a,1/300),u=0,f=.6,l=new Map,c=kn(p),h=ce("tick","end"),d=pc();e==null&&(e=[]);function p(){y(),h.call("tick",i),o1&&(_.fy==null?_.y+=_.vy*=f:(_.y=_.fy,_.vy=0)),r>2&&(_.fz==null?_.z+=_.vz*=f:(_.z=_.fz,_.vz=0));return i}function x(){for(var g=0,k=e.length,v;g1&&isNaN(v.y)||r>2&&isNaN(v.z)){var _=yc*(r>2?Math.cbrt(.5+g):r>1?Math.sqrt(.5+g):g),m=g*_c,A=g*vc;r===1?v.x=_:r===2?(v.x=_*Math.cos(m),v.y=_*Math.sin(m)):(v.x=_*Math.sin(m)*Math.cos(A),v.y=_*Math.cos(m),v.z=_*Math.sin(m)*Math.sin(A))}(isNaN(v.vx)||r>1&&isNaN(v.vy)||r>2&&isNaN(v.vz))&&(v.vx=0,r>1&&(v.vy=0),r>2&&(v.vz=0))}}function b(g){return g.initialize&&g.initialize(e,d,r),g}return x(),i={tick:y,restart:function(){return c.restart(p),i},stop:function(){return c.stop(),i},numDimensions:function(g){return arguments.length?(r=Math.min(Cr,Math.max(1,Math.round(g))),l.forEach(b),i):r},nodes:function(g){return arguments.length?(e=g,x(),l.forEach(b),i):e},alpha:function(g){return arguments.length?(o=+g,i):o},alphaMin:function(g){return arguments.length?(a=+g,i):a},alphaDecay:function(g){return arguments.length?(s=+g,i):+s},alphaTarget:function(g){return arguments.length?(u=+g,i):u},velocityDecay:function(g){return arguments.length?(f=1-g,i):1-f},randomSource:function(g){return arguments.length?(d=g,l.forEach(b),i):d},force:function(g,k){return arguments.length>1?(k==null?l.delete(g):l.set(g,b(k)),i):l.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),k=g.shift()||0,v=(r>1?g.shift():null)||0,_=(r>2?g.shift():null)||0,m=g.shift()||1/0,A=0,S=e.length,T,z,M,O,N,j;for(m*=m,A=0;A1?(h.on(g,k),i):h.on(g)}}}function bc(){var e,n,r,i,o,a=Mt(-30),s,u=1,f=1/0,l=.81;function c(y){var x,b=e.length,g=(n===1?Ei(e,Xe):n===2?Rn(e,Xe,Sr):n===3?Ni(e,Xe,Sr,gc):null).visitAfter(d);for(o=y,x=0;x1&&(y.y=_/k),n>2&&(y.z=m/k)}else{b=y,b.x=b.data.x,n>1&&(b.y=b.data.y),n>2&&(b.z=b.data.z);do x+=s[b.data.index];while(b=b.next)}y.value=x}function p(y,x,b,g,k){if(!y.value)return!0;var v=[b,g,k][n-1],_=y.x-r.x,m=n>1?y.y-r.y:0,A=n>2?y.z-r.z:0,S=v-x,T=_*_+m*m+A*A;if(S*S/l1&&m===0&&(m=St(i),T+=m*m),n>2&&A===0&&(A=St(i),T+=A*A),T1&&(r.vy+=m*y.value*o/T),n>2&&(r.vz+=A*y.value*o/T)),!0;if(y.length||T>=f)return;(y.data!==r||y.next)&&(_===0&&(_=St(i),T+=_*_),n>1&&m===0&&(m=St(i),T+=m*m),n>2&&A===0&&(A=St(i),T+=A*A),T1&&(r.vy+=m*S),n>2&&(r.vz+=A*S));while(y=y.next)}return c.initialize=function(y,...x){e=y,i=x.find(b=>typeof b=="function")||Math.random,n=x.find(b=>[1,2,3].includes(b))||2,h()},c.strength=function(y){return arguments.length?(a=typeof y=="function"?y:Mt(+y),h(),c):a},c.distanceMin=function(y){return arguments.length?(u=y*y,c):Math.sqrt(u)},c.distanceMax=function(y){return arguments.length?(f=y*y,c):Math.sqrt(f)},c.theta=function(y){return arguments.length?(l=y*y,c):Math.sqrt(l)},c}function xc(e,n,r,i){var o,a,s=Mt(.1),u,f;typeof e!="function"&&(e=Mt(+e)),n==null&&(n=0),r==null&&(r=0),i==null&&(i=0);function l(h){for(var d=0,p=o.length;d1&&(y.vy+=b*v),a>2&&(y.vz+=g*v)}}function c(){if(o){var h,d=o.length;for(u=new Array(d),f=new Array(d),h=0;h[1,2,3].includes(p))||2,c()},l.strength=function(h){return arguments.length?(s=typeof h=="function"?h:Mt(+h),c(),l):s},l.radius=function(h){return arguments.length?(e=typeof h=="function"?h:Mt(+h),c(),l):e},l.x=function(h){return arguments.length?(n=+h,l):n},l.y=function(h){return arguments.length?(r=+h,l):r},l.z=function(h){return arguments.length?(i=+h,l):i},l}const{abs:Xt,cos:Ct,sin:$t,acos:wc,atan2:Yt,sqrt:Et,pow:at}=Math;function Zt(e){return e<0?-at(-e,1/3):at(e,1/3)}const Ii=Math.PI,_e=2*Ii,zt=Ii/2,kc=1e-6,Ye=Number.MAX_SAFE_INTEGER||9007199254740991,Ze=Number.MIN_SAFE_INTEGER||-9007199254740991,Ac={x:0,y:0,z:0},E={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let i=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(i+=r.z*r.z),Et(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const i=n.length-1;if(e===1)return n[i].t=1,n[i];const o=1-e;let a=n;if(i===0)return n[0].t=e,n[0];if(i===1){const u={x:o*a[0].x+e*a[1].x,y:o*a[0].y+e*a[1].y,t:e};return r&&(u.z=o*a[0].z+e*a[1].z),u}if(i<4){let u=o*o,f=e*e,l,c,h,d=0;i===2?(a=[a[0],a[1],a[2],Ac],l=u,c=o*e*2,h=f):i===3&&(l=u*o,c=u*e*3,h=o*f*3,d=e*f);const p={x:l*a[0].x+c*a[1].x+h*a[2].x+d*a[3].x,y:l*a[0].y+c*a[1].y+h*a[2].y+d*a[3].y,t:e};return r&&(p.z=l*a[0].z+c*a[1].z+h*a[2].z+d*a[3].z),p}const s=JSON.parse(JSON.stringify(n));for(;s.length>1;){for(let u=0;u1;o--,a--){const s=[];for(let u=0,f;u"u")e=.5;else if(e===0||e===1)return e;const r=at(e,n)+at(1-e,n),i=r-1;return Xt(i/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=at(1-e,n),i=at(e,n)+r;return r/i},lli8:function(e,n,r,i,o,a,s,u){const f=(e*i-n*r)*(o-s)-(e-r)*(o*u-a*s),l=(e*i-n*r)*(a-u)-(n-i)*(o*u-a*s),c=(e-r)*(a-u)-(n-i)*(o-s);return c==0?!1:{x:f/c,y:l/c}},lli4:function(e,n,r,i){const o=e.x,a=e.y,s=n.x,u=n.y,f=r.x,l=r.y,c=i.x,h=i.y;return E.lli8(o,a,s,u,f,l,c,h)},lli:function(e,n){return E.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new B(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=Ye,r=Ye,i=Ze,o=Ze;return e.forEach(function(a){const s=a.bbox();n>s.x.min&&(n=s.x.min),r>s.y.min&&(r=s.y.min),i0&&(c.c1=f,c.c2=l,c.s1=e,c.s2=r,a.push(c))})}),a},makeshape:function(e,n,r){const i=n.points.length,o=e.points.length,a=E.makeline(n.points[i-1],e.points[0]),s=E.makeline(e.points[o-1],n.points[0]),u={startcap:a,forward:e,back:n,endcap:s,bbox:E.findbbox([a,e,n,s])};return u.intersections=function(f){return E.shapeintersections(u,u.bbox,f,f.bbox,r)},u},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=Ye,o=Ze,a,s;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let u=0,f=r.length;uo&&(o=s[n]);return{min:i,mid:(i+o)/2,max:o,size:o-i}},align:function(e,n){const r=n.p1.x,i=n.p1.y,o=-Yt(n.p2.y-i,n.p2.x-r),a=function(s){return{x:(s.x-r)*Ct(o)-(s.y-i)*$t(o),y:(s.x-r)*$t(o)+(s.y-i)*Ct(o)}};return e.map(a)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,i=E.align(e,n),o=function(S){return 0<=S&&S<=1};if(r===2){const S=i[0].y,T=i[1].y,z=i[2].y,M=S-2*T+z;if(M!==0){const O=-Et(T*T-S*z),N=-S+T,j=-(O+N)/M,C=-(-O+N)/M;return[j,C].filter(o)}else if(T!==z&&M===0)return[(2*T-z)/(2*T-2*z)].filter(o);return[]}const a=i[0].y,s=i[1].y,u=i[2].y,f=i[3].y;let l=-a+3*s-3*u+f,c=3*a-6*s+3*u,h=-3*a+3*s,d=a;if(E.approximately(l,0)){if(E.approximately(c,0))return E.approximately(h,0)?[]:[-d/h].filter(o);const S=Et(h*h-4*c*d),T=2*c;return[(S-h)/T,(-h-S)/T].filter(o)}c/=l,h/=l,d/=l;const p=(3*h-c*c)/3,y=p/3,x=(2*c*c*c-9*c*h+27*d)/27,b=x/2,g=b*b+y*y*y;let k,v,_,m,A;if(g<0){const S=-p/3,T=S*S*S,z=Et(T),M=-x/(2*z),O=M<-1?-1:M>1?1:M,N=wc(O),j=Zt(z),C=2*j;return _=C*Ct(N/3)-c/3,m=C*Ct((N+_e)/3)-c/3,A=C*Ct((N+2*_e)/3)-c/3,[_,m,A].filter(o)}else{if(g===0)return k=b<0?Zt(-b):-Zt(b),_=2*k-c/3,m=-k-c/3,[_,m].filter(o);{const S=Et(g);return k=Zt(-b+S),v=Zt(b+S),[k-v-c/3].filter(o)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],i=e[2],o=n-2*r+i;if(o!==0){const a=-Et(r*r-n*i),s=-n+r,u=-(a+s)/o,f=-(-a+s)/o;return[u,f]}else if(r!==i&&o===0)return[(2*r-i)/(2*(r-i))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,i,o){let a,s,u,f,l=0,c=0;const h=E.compute(e,n),d=E.compute(e,r),p=h.x*h.x+h.y*h.y;if(i?(a=Et(at(h.y*d.z-d.y*h.z,2)+at(h.z*d.x-d.z*h.x,2)+at(h.x*d.y-d.x*h.y,2)),s=at(p+h.z*h.z,3/2)):(a=h.x*d.y-h.y*d.x,s=at(p,3/2)),a===0||s===0)return{k:0,r:0};if(l=a/s,c=s/a,!o){const y=E.curvature(e-.001,n,r,i,!0).k,x=E.curvature(e+.001,n,r,i,!0).k;f=(x-l+(l-y))/2,u=(Xt(x-l)+Xt(l-y))/2}return{k:l,r:c,dk:f,adk:u}},inflections:function(e){if(e.length<4)return[];const n=E.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,o=n[1].x*n[2].y,a=n[3].x*n[2].y,s=18*(-3*r+2*i+3*o-a),u=18*(3*r-i-3*o),f=18*(o-r);if(E.approximately(s,0)){if(!E.approximately(u,0)){let d=-f/u;if(0<=d&&d<=1)return[d]}return[]}const l=2*s;if(E.approximately(l,0))return[];const c=u*u-4*s*f;if(c<0)return[];const h=Math.sqrt(c);return[(h-u)/l,-(u+h)/l].filter(function(d){return 0<=d&&d<=1})},bboxoverlap:function(e,n){const r=["x","y"],i=r.length;for(let o=0,a,s,u,f;o=f)return!1;return!0},expandbox:function(e,n){n.x.mine.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const i=e.bbox(),o=n.bbox(),a=1e5,s=r||.5;if(i.x.size+i.y.sizeA||A>S)&&(m+=_e),m>S&&(T=S,S=m,m=T)):S4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");o=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const s=this._3d=!o&&(a===9||a===12)||n&&n[0]&&typeof n[0].z<"u",u=this.points=[];for(let p=0,y=s?3:2;pp+Kt(y.y),0)"u"&&(o=.5),o===0)return new B(r,r,i);if(o===1)return new B(n,r,r);const a=B.getABC(2,n,r,i,o);return new B(n,a.A,i)}static cubicFromPoints(n,r,i,o,a){typeof o>"u"&&(o=.5);const s=B.getABC(3,n,r,i,o);typeof a>"u"&&(a=E.dist(r,s.C));const u=a*(1-o)/o,f=E.dist(n,i),l=(i.x-n.x)/f,c=(i.y-n.y)/f,h=a*l,d=a*c,p=u*l,y=u*c,x={x:r.x-h,y:r.y-d},b={x:r.x+p,y:r.y+y},g=s.A,k={x:g.x+(x.x-g.x)/(1-o),y:g.y+(x.y-g.y)/(1-o)},v={x:g.x+(b.x-g.x)/o,y:g.y+(b.y-g.y)/o},_={x:n.x+(k.x-n.x)/o,y:n.y+(k.y-n.y)/o},m={x:i.x+(v.x-i.x)/(1-o),y:i.y+(v.y-i.y)/(1-o)};return new B(n,_,m,i)}static getUtils(){return E}getUtils(){return B.getUtils()}static get PolyBezier(){return oe}valueOf(){return this.toString()}toString(){return E.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,i=n[0].y,o=["M",r,i,this.order===2?"Q":"C"];for(let a=1,s=n.length;a0}length(){return E.length(this.derivative.bind(this))}static getABC(n=2,r,i,o,a=.5){const s=E.projectionratio(a,n),u=1-s,f={x:s*r.x+u*o.x,y:s*r.y+u*o.y},l=E.abcratio(a,n);return{A:{x:i.x+(i.x-f.x)/l,y:i.y+(i.y-f.y)/l},B:i,C:f,S:r,E:o}}getABC(n,r){r=r||this.get(n);let i=this.points[0],o=this.points[this.order];return B.getABC(this.order,i,r,o,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,i,o;r1?1:h,d=this.compute(h),d.t=h,d.d=l,d}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?E.computeWithRatios(n,this.points,this.ratios,this._3d):E.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],i=n.length;for(let o=1,a,s;o1;){i=[];for(let s=0,u,f=r.length-1;s=0&&s<=1}),r=r.concat(n[i].sort(E.numberSort))}).bind(this)),n.values=r.sort(E.numberSort).filter(function(i,o){return r.indexOf(i)===o}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(i){r[i]=E.getminmax(this,i,n[i])}).bind(this)),r}overlaps(n){const r=this.bbox(),i=n.bbox();return E.bboxoverlap(r,i)}offset(n,r){if(typeof r<"u"){const i=this.get(n),o=this.normal(n),a={c:i,n:o,x:i.x+o.x*r,y:i.y+o.y*r};return this._3d&&(a.z=i.z+o.z*r),a}if(this._linear){const i=this.normal(0),o=this.points.map(function(a){const s={x:a.x+n*i.x,y:a.y+n*i.y};return a.z&&i.z&&(s.z=a.z+n*i.z),s});return[new B(o)]}return this.reduce().map(function(i){return i._linear?i.offset(n)[0]:i.scale(n)})}simple(){if(this.order===3){const o=E.angle(this.points[0],this.points[3],this.points[1]),a=E.angle(this.points[0],this.points[3],this.points[2]);if(o>0&&a<0||o<0&&a>0)return!1}const n=this.normal(0),r=this.normal(1);let i=n.x*r.x+n.y*r.y;return this._3d&&(i+=n.z*r.z),Kt(Tc(i))(1-u/o)*r+u/o*i);return new B(this.points.map((s,u)=>({x:s.x+n.x*a[u],y:s.y+n.y*a[u]})))}scale(n){const r=this.order;let i=!1;if(typeof n=="function"&&(i=n),i&&r===2)return this.raise().scale(i);const o=this.clockwise,a=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);const s=i?i(0):n,u=i?i(1):n,f=[this.offset(0,10),this.offset(1,10)],l=[],c=E.lli4(f[0],f[0].c,f[1],f[1].c);if(!c)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(h){const d=l[h*r]=E.copy(a[h*r]);d.x+=(h?u:s)*f[h].n.x,d.y+=(h?u:s)*f[h].n.y}),i?([0,1].forEach(function(h){if(!(r===2&&h)){var d=a[h+1],p={x:d.x-c.x,y:d.y-c.y},y=i?i((h+1)/r):n;i&&!o&&(y=-y);var x=Qt(p.x*p.x+p.y*p.y);p.x/=x,p.y/=x,l[h+1]={x:d.x+y*p.x,y:d.y+y*p.y}}}),new B(l)):([0,1].forEach(h=>{if(r===2&&h)return;const d=l[h*r],p=this.derivative(h),y={x:d.x+p.x,y:d.y+p.y};l[h+1]=E.lli4(d,y,c,a[h+1])}),new B(l))}outline(n,r,i,o){if(r=r===void 0?n:r,this._linear){const m=this.normal(0),A=this.points[0],S=this.points[this.points.length-1];let T,z,M;i===void 0&&(i=n,o=r),T={x:A.x+m.x*n,y:A.y+m.y*n},M={x:S.x+m.x*i,y:S.y+m.y*i},z={x:(T.x+M.x)/2,y:(T.y+M.y)/2};const O=[T,z,M];T={x:A.x-m.x*r,y:A.y-m.y*r},M={x:S.x-m.x*o,y:S.y-m.y*o},z={x:(T.x+M.x)/2,y:(T.y+M.y)/2};const N=[M,z,T],j=E.makeline(N[2],O[0]),C=E.makeline(O[2],N[0]),R=[j,new B(O),C,new B(N)];return new oe(R)}const a=this.reduce(),s=a.length,u=[];let f=[],l,c=0,h=this.length();const d=typeof i<"u"&&typeof o<"u";function p(m,A,S,T,z){return function(M){const O=T/S,N=(T+z)/S,j=A-m;return E.map(M,0,1,m+O*j,m+N*j)}}a.forEach(function(m){const A=m.length();d?(u.push(m.scale(p(n,i,h,c,A))),f.push(m.scale(p(-r,-o,h,c,A)))):(u.push(m.scale(n)),f.push(m.scale(-r))),c+=A}),f=f.map(function(m){return l=m.points,l[3]?m.points=[l[3],l[2],l[1],l[0]]:m.points=[l[2],l[1],l[0]],m}).reverse();const y=u[0].points[0],x=u[s-1].points[u[s-1].points.length-1],b=f[s-1].points[f[s-1].points.length-1],g=f[0].points[0],k=E.makeline(b,y),v=E.makeline(x,g),_=[k].concat(u).concat([v]).concat(f);return new oe(_)}outlineshapes(n,r,i){r=r||n;const o=this.outline(n,r).curves,a=[];for(let s=1,u=o.length;s1,f.endcap.virtual=s{var u=this.get(s);return E.between(u.x,r,o)&&E.between(u.y,i,a)})}selfintersects(n){const r=this.reduce(),i=r.length-2,o=[];for(let a=0,s,u,f;a0&&(a=a.concat(u))}),a}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,i,o){const a=(o-i)/4,s=this.get(i+a),u=this.get(o-a),f=E.dist(n,r),l=E.dist(n,s),c=E.dist(n,u);return Kt(l-f)+Kt(c-f)}_iterate(n,r){let i=0,o=1,a;do{a=0,o=1;let s=this.get(i),u,f,l,c,h=!1,d=!1,p,y=o,x=1;do if(d=h,c=l,y=(i+o)/2,u=this.get(y),f=this.get(o),l=E.getccenter(s,u,f),l.interval={start:i,end:o},h=this._error(l,s,i,o)<=n,p=d&&!h,p||(x=o),h){if(o>=1){if(l.interval.end=x=1,c=l,o>1){let g={x:l.x+l.r*Cc(l.e),y:l.y+l.r*Sc(l.e)};l.e+=E.angle({x:l.x,y:l.y},g,this.get(1))}break}o=o+(o-i)/2}else o=y;while(!p&&a++<100);if(a>=100)break;c=c||l,r.push(c),i=x}while(o<1);return r}}function _n(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(u){return{keyAccessor:u,isProp:!(u instanceof Function)}}),a=e.reduce(function(u,f){var l=u,c=f;return o.forEach(function(h,d){var p=h.keyAccessor,y=h.isProp,x;if(y){var b=c,g=b[p],k=Ic(b,[p].map(Uc));x=g,c=k}else x=p(c,d);d+11&&arguments[1]!==void 0?arguments[1]:1;l===o.length?Object.keys(f).forEach(function(c){return f[c]=r(f[c])}):Object.values(f).forEach(function(c){return u(c,l+1)})})(a);var s=a;return i&&(s=[],(function u(f){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];l.length===o.length?s.push({keys:l,vals:f}):Object.entries(f).forEach(function(c){var h=jc(c,2),d=h[0],p=h[1];return u(p,[].concat($c(l),[d]))})})(a),n instanceof Array&&n.length===0&&s.length===1&&(s[0].keys=[])),s});function Hc(e){for(var n=e.length/6|0,r=new Array(n),i=0;i"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var Vc=`.force-graph-container canvas { + display: block; + user-select: none; + outline: none; + -webkit-tap-highlight-color: transparent; +} + +.force-graph-container .clickable { + cursor: pointer; +} + +.force-graph-container .grabbable { + cursor: move; + cursor: grab; + cursor: -moz-grab; + cursor: -webkit-grab; +} + +.force-graph-container .grabbable:active { + cursor: grabbing; + cursor: -moz-grabbing; + cursor: -webkit-grabbing; +} +`;Gc(Vc);function vn(e,n){(n==null||n>e.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}; diff --git a/frontend/dist/assets/GraphView-DAjHGBm0.js b/frontend/dist/assets/GraphView-DAjHGBm0.js deleted file mode 100644 index 10d83e6..0000000 --- a/frontend/dist/assets/GraphView-DAjHGBm0.js +++ /dev/null @@ -1,44 +0,0 @@ -import{i as Nt,r as Y,R as Li,c as Dn,a as jn,b as qi,o as Hi,m as $n,d as Fn,g as Gi,j as H,e as Vi,S as Wi,f as Un,T as Bi}from"./index-BrDDv3Dl.js";function Xi(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var Ln=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Dr(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?d+=360:d-l>180&&(l+=360),h.push({i:c.push(o(c)+"rotate(",null,i)-2,x:Nt(l,d)})):d&&c.push(o(c)+"rotate("+d+i)}function u(l,d,c,h){l!==d?h.push({i:c.push(o(c)+"skewX(",null,i)-2,x:Nt(l,d)}):d&&c.push(o(c)+"skewX("+d+i)}function f(l,d,c,h,g,y){if(l!==c||d!==h){var x=g.push(o(g)+"scale(",null,",",null,")");y.push({i:x-4,x:Nt(l,c)},{i:x-2,x:Nt(d,h)})}else(c!==1||h!==1)&&g.push(o(g)+"scale("+c+","+h+")")}return function(l,d){var c=[],h=[];return l=e(l),d=e(d),a(l.translateX,l.translateY,d.translateX,d.translateY,c,h),s(l.rotate,d.rotate,c,h),u(l.skewX,d.skewX,c,h),f(l.scaleX,l.scaleY,d.scaleX,d.scaleY,c,h),l=d=null,function(g){for(var y=-1,x=h.length,v;++ye.length)&&(n=e.length);for(var r=0,i=new Array(n);ra,methodNames:i=[],initPropNames:o=[]}={}){return Y.forwardRef((a,s)=>{const u=Y.useRef(),f=Y.useMemo(()=>{const c=Object.fromEntries(o.filter(h=>a.hasOwnProperty(h)).map(h=>[h,a[h]]));return e(c)},[]);Gn(()=>{f(r(u.current))},Y.useLayoutEffect),Gn(()=>f._destructor instanceof Function?f._destructor:void 0);const l=Y.useCallback((c,...h)=>f[c]instanceof Function?f[c](...h):void 0,[f]),d=Y.useRef({});return Object.keys(po(a,[...i,...o])).filter(c=>d.current[c]!==a[c]).forEach(c=>l(c,a[c])),d.current=a,Y.useImperativeHandle(s,()=>Object.fromEntries(i.map(c=>[c,(...h)=>l(c,...h)])),[l]),Li.createElement(n,{ref:u})})}function Gn(e,n=Y.useEffect){const r=Y.useRef(),i=Y.useRef(!1),o=Y.useRef(!1),[a,s]=Y.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 rn="http://www.w3.org/1999/xhtml";const Vn={svg:"http://www.w3.org/2000/svg",xhtml:rn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ie(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Vn.hasOwnProperty(n)?{space:Vn[n],local:e}:e}function yo(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===rn&&n.documentElement.namespaceURI===rn?n.createElement(e):n.createElementNS(r,e)}}function _o(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fr(e){var n=Ie(e);return(n.local?_o:yo)(n)}function vo(){}function mn(e){return e==null?vo:function(){return this.querySelector(e)}}function mo(e){typeof e!="function"&&(e=mn(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o=k&&(k=_+1);!(m=v[k])&&++k=0;)(s=i[o])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function Go(e){e||(e=Vo);function n(c,h){return c&&h?e(c.__data__,h.__data__):!c-!h}for(var r=this._groups,i=r.length,o=new Array(i),a=0;an?1:e>=n?0:NaN}function Wo(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Bo(){return Array.from(this)}function Xo(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?oa:typeof n=="function"?sa:aa)(e,n,r??"")):Ut(this.node(),e)}function Ut(e,n){return e.style.getPropertyValue(n)||Gr(e).getComputedStyle(e,null).getPropertyValue(n)}function la(e){return function(){delete this[e]}}function fa(e,n){return function(){this[e]=n}}function ca(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function ha(e,n){return arguments.length>1?this.each((n==null?la:typeof n=="function"?ca:fa)(e,n)):this.node()[e]}function Vr(e){return e.trim().split(/^|\s+/)}function bn(e){return e.classList||new Wr(e)}function Wr(e){this._node=e,this._names=Vr(e.getAttribute("class")||"")}Wr.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 Br(e,n){for(var r=bn(e),i=-1,o=n.length;++i=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function Ua(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,a;r{}};function fe(){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}})}_e.prototype=fe.prototype={constructor:_e,on:function(e,n){var r=this._,i=Za(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 on(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:a,x:s,y:u,dx:f,dy:l,dispatch:d}){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:d}})}on.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ja(e){return!e.ctrlKey&&!e.button}function ts(){return this.parentNode}function es(e,n){return n??{x:e.x,y:e.y}}function ns(){return navigator.maxTouchPoints||"ontouchstart"in this}function rs(){var e=Ja,n=ts,r=es,i=ns,o={},a=fe("start","drag","end"),s=0,u,f,l,d,c=0;function h(w){w.on("mousedown.drag",g).filter(i).on("touchstart.drag",v).on("touchmove.drag",p,Qa).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,m){if(!(d||!e.call(this,w,m))){var A=k(this,n.call(this,w,m),w,m,"mouse");A&&(st(w.view).on("mousemove.drag",y,ae).on("mouseup.drag",x,ae),Kr(w.view),He(w),l=!1,u=w.clientX,f=w.clientY,A("start",w))}}function y(w){if(Ft(w),!l){var m=w.clientX-u,A=w.clientY-f;l=m*m+A*A>c}o.mouse("drag",w)}function x(w){st(w.view).on("mousemove.drag mouseup.drag",null),Qr(w.view,l),Ft(w),o.mouse("end",w)}function v(w,m){if(e.call(this,w,m)){var A=w.changedTouches,S=n.call(this,w,m),T=A.length,z,P;for(z=0;z=0&&e._call.call(void 0,n),e=e._next;--Lt}function Bn(){Dt=(Ce=se.now())+De,Lt=Qt=0;try{os()}finally{Lt=0,ss(),Dt=0}}function as(){var e=se.now(),n=e-Ce;n>Jr&&(De-=n,Ce=e)}function ss(){for(var e,n=Ae,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:Ae=r);Jt=e,an(i)}function an(e){if(!Lt){Qt&&(Qt=clearTimeout(Qt));var n=e-Dt;n>24?(e<1/0&&(Qt=setTimeout(Bn,e-se.now()-De)),Ht&&(Ht=clearInterval(Ht))):(Ht||(Ce=se.now(),Ht=setInterval(as,Jr)),Lt=1,ti(Bn))}}function Xn(e,n,r){var i=new Se;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var us=fe("start","end","cancel","interrupt"),ls=[],ei=0,Yn=1,sn=2,ve=3,Zn=4,un=5,me=6;function je(e,n,r,i,o,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;fs(e,r,{name:n,index:i,group:o,on:us,tween:ls,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ei})}function kn(e,n){var r=dt(e,n);if(r.state>ei)throw new Error("too late; already scheduled");return r}function vt(e,n){var r=dt(e,n);if(r.state>ve)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 fs(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=wn(a,0,r.time);function a(l){r.state=Yn,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var d,c,h,g;if(r.state!==Yn)return f();for(d in i)if(g=i[d],g.name===r.name){if(g.state===ve)return Xn(s);g.state===Zn?(g.state=me,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete i[d]):+dsn&&i.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function Us(e,n,r){var i,o,a=Fs(n)?kn:vt;return function(){var s=a(this,e),u=s.on;u!==i&&(o=(i=u).copy()).on(n,r),s.on=o}}function Ls(e,n){var r=this._id;return arguments.length<2?dt(this.node(),r).on.on(e):this.each(Us(r,e,n))}function qs(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function Hs(){return this.on("end.remove",qs(this._id))}function Gs(e){var n=this._name,r=this._id;typeof e!="function"&&(e=mn(e));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s()=>e;function gu(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 St(e,n,r){this.k=e,this.x=n,this.y=r}St.prototype={constructor:St,scale:function(e){return e===1?this:new St(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new St(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 Cn=new St(1,0,0);pt.prototype=St.prototype;function pt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Cn;return e.__zoom}function Ge(e){e.stopImmediatePropagation()}function Gt(e){e.preventDefault(),e.stopImmediatePropagation()}function yu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _u(){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 Kn(){return this.__zoom||Cn}function vu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mu(){return navigator.maxTouchPoints||"ontouchstart"in this}function bu(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 xu(){var e=yu,n=_u,r=bu,i=vu,o=mu,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],u=250,f=no,l=fe("start","zoom","end"),d,c,h,g=500,y=150,x=0,v=10;function p(C){C.property("__zoom",Kn).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(C,E,M,R){var D=C.selection?C.selection():C;D.property("__zoom",Kn),C!==D?m(C,E,M,R):D.interrupt().each(function(){A(this,arguments).event(R).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},p.scaleBy=function(C,E,M,R){p.scaleTo(C,function(){var D=this.__zoom.k,$=typeof E=="function"?E.apply(this,arguments):E;return D*$},M,R)},p.scaleTo=function(C,E,M,R){p.transform(C,function(){var D=n.apply(this,arguments),$=this.__zoom,F=M==null?w(D):typeof M=="function"?M.apply(this,arguments):M,L=$.invert(F),q=typeof E=="function"?E.apply(this,arguments):E;return r(k(_($,q),F,L),D,s)},M,R)},p.translateBy=function(C,E,M,R){p.transform(C,function(){return r(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof M=="function"?M.apply(this,arguments):M),n.apply(this,arguments),s)},null,R)},p.translateTo=function(C,E,M,R,D){p.transform(C,function(){var $=n.apply(this,arguments),F=this.__zoom,L=R==null?w($):typeof R=="function"?R.apply(this,arguments):R;return r(Cn.translate(L[0],L[1]).scale(F.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof M=="function"?-M.apply(this,arguments):-M),$,s)},R,D)};function _(C,E){return E=Math.max(a[0],Math.min(a[1],E)),E===C.k?C:new St(E,C.x,C.y)}function k(C,E,M){var R=E[0]-M[0]*C.k,D=E[1]-M[1]*C.k;return R===C.x&&D===C.y?C:new St(C.k,R,D)}function w(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function m(C,E,M,R){C.on("start.zoom",function(){A(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(R).end()}).tween("zoom",function(){var D=this,$=arguments,F=A(D,$).event(R),L=n.apply(D,$),q=M==null?w(L):typeof M=="function"?M.apply(D,$):M,K=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),Z=D.__zoom,lt=typeof E=="function"?E.apply(D,$):E,mt=f(Z.invert(q).concat(K/Z.k),lt.invert(q).concat(K/lt.k));return function(ft){if(ft===1)ft=lt;else{var bt=mt(ft),qe=K/bt[2];ft=new St(qe,q[0]-bt[0]*qe,q[1]-bt[1]*qe)}F.zoom(null,ft)}})}function A(C,E,M){return!M&&C.__zooming||new S(C,E)}function S(C,E){this.that=C,this.args=E,this.active=0,this.sourceEvent=null,this.extent=n.apply(C,E),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,E){return this.mouse&&C!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var E=st(this.that).datum();l.call(C,this.that,new gu(C,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),E)}};function T(C,...E){if(!e.apply(this,arguments))return;var M=A(this,E).event(C),R=this.__zoom,D=Math.max(a[0],Math.min(a[1],R.k*Math.pow(2,i.apply(this,arguments)))),$=gt(C);if(M.wheel)(M.mouse[0][0]!==$[0]||M.mouse[0][1]!==$[1])&&(M.mouse[1]=R.invert(M.mouse[0]=$)),clearTimeout(M.wheel);else{if(R.k===D)return;M.mouse=[$,R.invert($)],be(this),M.start()}Gt(C),M.wheel=setTimeout(F,y),M.zoom("mouse",r(k(_(R,D),M.mouse[0],M.mouse[1]),M.extent,s));function F(){M.wheel=null,M.end()}}function z(C,...E){if(h||!e.apply(this,arguments))return;var M=C.currentTarget,R=A(this,E,!0).event(C),D=st(C.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",K,!0),$=gt(C,M),F=C.clientX,L=C.clientY;Kr(C.view),Ge(C),R.mouse=[$,this.__zoom.invert($)],be(this),R.start();function q(Z){if(Gt(Z),!R.moved){var lt=Z.clientX-F,mt=Z.clientY-L;R.moved=lt*lt+mt*mt>x}R.event(Z).zoom("mouse",r(k(R.that.__zoom,R.mouse[0]=gt(Z,M),R.mouse[1]),R.extent,s))}function K(Z){D.on("mousemove.zoom mouseup.zoom",null),Qr(Z.view,R.moved),Gt(Z),R.event(Z).end()}}function P(C,...E){if(e.apply(this,arguments)){var M=this.__zoom,R=gt(C.changedTouches?C.changedTouches[0]:C,this),D=M.invert(R),$=M.k*(C.shiftKey?.5:2),F=r(k(_(M,$),R,D),n.apply(this,E),s);Gt(C),u>0?st(this).transition().duration(u).call(m,F,R,C):st(this).call(p.transform,F,R,C)}}function N(C,...E){if(e.apply(this,arguments)){var M=C.touches,R=M.length,D=A(this,E,C.changedTouches.length===R).event(C),$,F,L,q;for(Ge(C),F=0;F=n||S<0||c&&T>=a}function p(){var A=Ve();if(v(A))return _(A);u=setTimeout(p,x(A))}function _(A){return u=void 0,h&&i?g(A):(i=o=void 0,s)}function k(){u!==void 0&&clearTimeout(u),l=0,i=f=o=u=void 0}function w(){return u===void 0?s:_(Ve())}function m(){var A=Ve(),S=v(A);if(i=arguments,o=this,f=A,S){if(u===void 0)return y(f);if(c)return clearTimeout(u),u=setTimeout(p,n),g(f)}return u===void 0&&(u=setTimeout(p,n)),s}return m.cancel=k,m.flush=w,m}var Bu="Expected a function";function Xu(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(Bu);return Me(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),si(e,n,{leading:i,maxWait:n,trailing:o})}var It=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-It.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?It.Bounce.In(e*2)*.5:It.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}}}}),te=function(){return performance.now()},ui=(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=te()),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}}},li=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),fn=new ui,er=(function(){function e(n,r){r===void 0&&(r=fn),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=It.Linear.None,this._interpolationFunction=ln.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=li.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=te()),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,d=!f&&Array.isArray(i[s]);if(!(l==="undefined"||l==="function")){if(d){var c=i[s];if(c.length===0)continue;for(var h=[u],g=0,y=c.length;g"u"||a)&&(r[s]=u),f||(r[s]*=1),d?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=te()),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=te()),!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 v=Math.trunc(u/f),p=u-v*f,_=Math.min(p/i._duration,1);return _===0&&u===i._duration?1:_},c=d(),h=this._easingFunction(c);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,h),this._onUpdateCallback&&this._onUpdateCallback(this._object,c),this._duration===0||u>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((u-this._duration)/f)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);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*g,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 j(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(dl,arguments)},brighten:function(){return this._applyModification(pl,arguments)},darken:function(){return this._applyModification(gl,arguments)},desaturate:function(){return this._applyModification(fl,arguments)},saturate:function(){return this._applyModification(cl,arguments)},greyscale:function(){return this._applyModification(hl,arguments)},spin:function(){return this._applyModification(yl,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(ml,arguments)},complement:function(){return this._applyCombination(_l,arguments)},monochromatic:function(){return this._applyCombination(bl,arguments)},splitcomplement:function(){return this._applyCombination(vl,arguments)},triad:function(){return this._applyCombination(sr,[3])},tetrad:function(){return this._applyCombination(sr,[4])}};j.fromRatio=function(e,n){if(Pe(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=ee(e[i]));e=r}return j(e,n)};function ol(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=Cl(e)),Pe(e)=="object"&&(wt(e.r)&&wt(e.g)&&wt(e.b)?(n=al(e.r,e.g,e.b),s=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):wt(e.h)&&wt(e.s)&&wt(e.v)?(i=ee(e.s),o=ee(e.v),n=ul(e.h,i,o),s=!0,u="hsv"):wt(e.h)&&wt(e.s)&&wt(e.l)&&(i=ee(e.s),a=ee(e.l),n=sl(e.h,i,a),s=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=fi(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 al(e,n,r){return{r:B(e,255)*255,g:B(n,255)*255,b:B(r,255)*255}}function rr(e,n,r){e=B(e,255),n=B(n,255),r=B(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&&(c-=1),c<1/6?l+(d-l)*6*c:c<1/2?d:c<2/3?l+(d-l)*(2/3-c)*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 ir(e,n,r){e=B(e,255),n=B(n,255),r=B(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(j(i));return a}function bl(e,n){n=n||6;for(var r=j(e).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/n;n--;)s.push(j({h:i,s:o,v:a})),a=(a+u)%1;return s}j.mix=function(e,n,r){r=r===0?0:r||50;var i=j(e).toRgb(),o=j(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 j(s)};j.readability=function(e,n){var r=j(e),i=j(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};j.isReadable=function(e,n,r){var i=j.readability(e,n),o,a;switch(a=!1,o=Sl(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};j.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=j(n[l]));return j.isReadable(e,i,{level:u,size:f})||!s?i:(r.includeFallbackColors=!1,j.mostReadable(e,["#fff","#000"],r))};var cn=j.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"},xl=j.hexNames=wl(cn);function wl(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function fi(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function B(e,n){kl(e)&&(e="100%");var r=Al(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 $e(e){return Math.min(1,Math.max(0,e))}function rt(e){return parseInt(e,16)}function kl(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Al(e){return typeof e=="string"&&e.indexOf("%")!=-1}function ht(e){return e.length==1?"0"+e:""+e}function ee(e){return e<=1&&(e=e*100+"%"),e}function ci(e){return Math.round(parseFloat(e)*255).toString(16)}function ur(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 wt(e){return!!ct.CSS_UNIT.exec(e)}function Cl(e){e=e.replace(rl,"").replace(il,"").toLowerCase();var n=!1;if(cn[e])e=cn[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:ur(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:ur(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 Sl(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 hn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r0&&arguments[0]!==void 0?arguments[0]:6;Pl(this,e),lr(this,Rt,void 0),lr(this,kt,void 0),fr(kt,this,n),this.reset()}return El(e,[{key:"reset",value:function(){fr(Rt,this,["__reserved for background__"])}},{key:"register",value:function(r){if(ot(Rt,this).length>=Math.pow(2,24-ot(kt,this)))return null;var i=ot(Rt,this).length,o=cr(i,ot(kt,this)),a=Fl(i+(o<<24-ot(kt,this)));return ot(Rt,this).push(r),a}},{key:"lookup",value:function(r){if(!r)return null;var i=typeof r=="string"?Ul(r):di.apply(void 0,Nl(r));if(!i)return null;var o=i&Math.pow(2,24-ot(kt,this))-1,a=i>>24-ot(kt,this)&Math.pow(2,ot(kt,this))-1;return cr(o,ot(kt,this))!==a||o>=ot(Rt,this).length?null:ot(Rt,this)[o]}}])})(),ce,X,pi,gi,zt,hr,yi,_i,We,xe,ne,vi,Tn,dn,pn,Oe={},Ee=[],ql=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fe=Array.isArray;function yt(e,n){for(var r in n)e[r]=n[r];return e}function Mn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Hl(e,n,r){var i,o,a,s={};for(a in n)a=="key"?i=n[a]:a=="ref"?o=n[a]:s[a]=n[a];if(arguments.length>2&&(s.children=arguments.length>3?ce.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return re(e,s,i,o,null)}function re(e,n,r,i,o){var a={type:e,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++pi,__i:-1,__u:0};return o==null&&X.vnode!=null&&X.vnode(a),a}function Ue(e){return e.children}function we(e,n){this.props=e,this.context=n}function qt(e,n){if(n==null)return e.__?qt(e.__,e.__i+1):null;for(var r;nn&&zt.sort(_i),e=zt.shift(),n=zt.length,Gl(e)}finally{zt.length=ze.__r=0}}function bi(e,n,r,i,o,a,s,u,f,l,d){var c,h,g,y,x,v,p,_=i&&i.__k||Ee,k=n.length;for(f=Vl(r,n,_,f,k),c=0;c0?s=e.__k[a]=re(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,f=a+h,s.__=e,s.__b=e.__b+1,u=null,(l=s.__i=Wl(s,r,f,c))!=-1&&(c--,(u=r[l])&&(u.__u|=2)),u==null||u.__v==null?(l==-1&&(o>d?h--:of?h--:h++,s.__u|=4))):e.__k[a]=null;if(c)for(a=0;a(d?1:0)){for(o=r-1,a=r+1;o>=0||a=0?o--:a++])!=null&&(2&l.__u)==0&&u==l.key&&f==l.type)return s}return-1}function pr(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||ql.test(n)?r:r+"px"}function ge(e,n,r,i,o){var a,s;t:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)r&&n in r||pr(e.style,n,"");if(r)for(n in r)i&&r[n]==i[n]||pr(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(vi,"$1")),s=n.toLowerCase(),n=s in e||n=="onFocusOut"||n=="onFocusIn"?s.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=r,r?i?r[ne]=i[ne]:(r[ne]=Tn,e.addEventListener(n,a?pn:dn,a)):e.removeEventListener(n,a?pn:dn,a);else{if(o=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function gr(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[xe]==null)n[xe]=Tn++;else if(n[xe]0?e:Fe(e)?e.map(Ai):e.constructor!==void 0?null:yt({},e)}function Bl(e,n,r,i,o,a,s,u,f){var l,d,c,h,g,y,x,v=r.props||Oe,p=n.props,_=n.type;if(_=="svg"?o="http://www.w3.org/2000/svg":_=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(l=0;l2&&(u.children=arguments.length>3?ce.call(arguments,2):r),re(e.type,u,i||e.key,o||e.ref,null)}ce=Ee.slice,X={__e:function(e,n,r,i){for(var o,a,s;n=n.__;)if((o=n.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),s=o.__d),s)return o.__E=o}catch(u){e=u}throw e}},pi=0,gi=function(e){return e!=null&&e.constructor===void 0},we.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=yt({},this.state),typeof e=="function"&&(e=e(yt({},r),this.props)),e&&yt(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),dr(this))},we.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),dr(this))},we.prototype.render=Ue,zt=[],yi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_i=function(e,n){return e.__v.__b-n.__v.__b},ze.__r=0,We=Math.random().toString(8),xe="__d"+We,ne="__a"+We,vi=/(PointerCapture)$|Capture$/i,Tn=0,dn=gr(!1),pn=gr(!0);function yr(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var lf=`.float-tooltip-kap { - position: absolute; - width: max-content; /* prevent shrinking near right edge */ - max-width: max(50%, 150px); - padding: 3px 5px; - border-radius: 3px; - font: 12px sans-serif; - color: #eee; - background: rgba(0,0,0,0.6); - pointer-events: none; -} -`;uf(lf);var ff=Sn({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.style,a=o===void 0?{}:o,s=!!n&&Re(n)==="object"&&!!n.node&&typeof n.node=="function",u=st(s?n.node():n);u.style("position")==="static"&&u.style("position","relative"),r.tooltipEl=u.append("div").attr("class","float-tooltip-kap"),Object.entries(a).forEach(function(l){var d=ef(l,2),c=d[0],h=d[1];return r.tooltipEl.style(c,h)}),r.tooltipEl.style("left","-10000px").style("display","none");var f="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,u.on("mousemove.".concat(f),function(l){r.mouseInside=!0;var d=gt(l),c=u.node(),h=c.offsetWidth,g=c.offsetHeight,y=[r.offsetX===null||r.offsetX===void 0?"-".concat(d[0]/h*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?g>130&&g-d[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",d[0]+"px").style("top",d[1]+"px").style("transform","translate(".concat(y.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseover.".concat(f),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),u.on("mouseout.".concat(f),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):af(n.content)?(n.tooltipEl.text(""),sf(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function cf(e,n,r){var i,o=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function a(){var s,u=i.length,f,l=0,d=0,c=0;for(s=0;s=(f=(s+u)/2))?s=f:u=f,i=o,!(o=o[c=+d]))return i[c]=a,e;if(l=+e._x.call(null,o.data),n===l)return a.next=o,i?i[c]=a:e._root=a,e;do i=i?i[c]=new Array(2):e._root=new Array(2),(d=n>=(f=(s+u)/2))?s=f:u=f;while((c=+d)==(h=+(l>=f)));return i[h]=o,i[c]=a,e}function df(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let i=1/0,o=-1/0;for(let a=0,s;ao&&(o=s));if(i>o)return this;this.cover(i).cover(o);for(let a=0;ae||e>=r;)switch(s=+(es||(a=l.x1)=c))&&(l=u[u.length-1],u[u.length-1]=u[u.length-1-d],u[u.length-1-d]=l)}else{var h=Math.abs(e-+this._x.call(null,f.data));h=(l=(s+u)/2))?s=l:u=l,n=r,!(r=r[c=+d]))return this;if(!r.length)break;n[c+1&1]&&(i=n,h=c)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,o?(a?o.next=a:delete o.next,this):n?(a?n[c]=a:delete n[c],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(i?i[h]=r:this._root=r),this):(this._root=a,this)}function mf(e){for(var n=0,r=e.length;n=(c=(u+l)/2))?u=c:l=c,(v=r>=(h=(f+d)/2))?f=h:d=h,o=a,!(a=a[p=v<<1|x]))return o[p]=s,e;if(g=+e._x.call(null,a.data),y=+e._y.call(null,a.data),n===g&&r===y)return s.next=a,o?o[p]=s:e._root=s,e;do o=o?o[p]=new Array(4):e._root=new Array(4),(x=n>=(c=(u+l)/2))?u=c:l=c,(v=r>=(h=(f+d)/2))?f=h:d=h;while((p=v<<1|x)===(_=(y>=h)<<1|g>=c));return o[_]=a,o[p]=s,e}function Tf(e){var n,r,i=e.length,o,a,s=new Array(i),u=new Array(i),f=1/0,l=1/0,d=-1/0,c=-1/0;for(r=0;rd&&(d=o),ac&&(c=a));if(f>d||l>c)return this;for(this.cover(f,l).cover(d,c),r=0;re||e>=o||i>n||n>=a;)switch(l=(nd||(u=y.y0)>c||(f=y.x1)=p)<<1|e>=v)&&(y=h[h.length-1],h[h.length-1]=h[h.length-1-x],h[h.length-1-x]=y)}else{var _=e-+this._x.call(null,g.data),k=n-+this._y.call(null,g.data),w=_*_+k*k;if(w=(h=(s+f)/2))?s=h:f=h,(x=c>=(g=(u+l)/2))?u=g:l=g,n=r,!(r=r[v=x<<1|y]))return this;if(!r.length)break;(n[v+1&3]||n[v+2&3]||n[v+3&3])&&(i=n,p=v)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,o?(a?o.next=a:delete o.next,this):n?(a?n[v]=a:delete n[v],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[p]=r:this._root=r),this):(this._root=a,this)}function Rf(e){for(var n=0,r=e.length;n=(y=(f+c)/2))?f=y:c=y,(m=r>=(x=(l+h)/2))?l=x:h=x,(A=i>=(v=(d+g)/2))?d=v:g=v,a=s,!(s=s[S=A<<2|m<<1|w]))return a[S]=u,e;if(p=+e._x.call(null,s.data),_=+e._y.call(null,s.data),k=+e._z.call(null,s.data),n===p&&r===_&&i===k)return u.next=s,a?a[S]=u:e._root=u,e;do a=a?a[S]=new Array(8):e._root=new Array(8),(w=n>=(y=(f+c)/2))?f=y:c=y,(m=r>=(x=(l+h)/2))?l=x:h=x,(A=i>=(v=(d+g)/2))?d=v:g=v;while((S=A<<2|m<<1|w)===(T=(k>=v)<<2|(_>=x)<<1|p>=y));return a[T]=s,a[S]=u,e}function Hf(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),i=new Float64Array(n),o=new Float64Array(n);let a=1/0,s=1/0,u=1/0,f=-1/0,l=-1/0,d=-1/0;for(let c=0,h,g,y,x;cf&&(f=g),yl&&(l=y),xd&&(d=x));if(a>f||s>l||u>d)return this;this.cover(a,s,u).cover(f,l,d);for(let c=0;ce||e>=s||o>n||n>=u||a>r||r>=f;)switch(h=(ry||(l=k.y0)>x||(d=k.z0)>v||(c=k.x1)=S)<<2|(n>=A)<<1|e>=m)&&(k=p[p.length-1],p[p.length-1]=p[p.length-1-w],p[p.length-1-w]=k)}else{var T=e-+this._x.call(null,_.data),z=n-+this._y.call(null,_.data),P=r-+this._z.call(null,_.data),N=T*T+z*z+P*P;if(NMath.sqrt((e-i)**2+(n-o)**2+(r-a)**2);function Yf(e,n,r,i){const o=[],a=e-i,s=n-i,u=r-i,f=e+i,l=n+i,d=r+i;return this.visit((c,h,g,y,x,v,p)=>{if(!c.length)do{const _=c.data;Xf(e,n,r,this._x(_),this._y(_),this._z(_))<=i&&o.push(_)}while(c=c.next);return h>f||g>l||y>d||x=(x=(s+l)/2))?s=x:l=x,(k=g>=(v=(u+d)/2))?u=v:d=v,(w=y>=(p=(f+c)/2))?f=p:c=p,n=r,!(r=r[m=w<<2|k<<1|_]))return this;if(!r.length)break;(n[m+1&7]||n[m+2&7]||n[m+3&7]||n[m+4&7]||n[m+5&7]||n[m+6&7]||n[m+7&7])&&(i=n,A=m)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,o?(a?o.next=a:delete o.next,this):n?(a?n[m]=a:delete n[m],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[A]=r:this._root=r),this):(this._root=a,this)}function Kf(e){for(var n=0,r=e.length;n1&&(z=S.y+S.vy-A.y-A.vy||Ct(d)),u>2&&(P=S.z+S.vz-A.z-A.vz||Ct(d)),N=Math.sqrt(T*T+z*z+P*P),N=(N-a[w])/N*p*i[w],T*=N,z*=N,P*=N,S.vx-=T*(I=l[w]),u>1&&(S.vy-=z*I),u>2&&(S.vz-=P*I),A.vx+=T*(I=1-I),u>1&&(A.vy+=z*I),u>2&&(A.vz+=P*I)}function y(){if(s){var p,_=s.length,k=e.length,w=new Map(s.map((A,S)=>[n(A,S,s),A])),m;for(p=0,f=new Array(_);ptypeof k=="function")||Math.random,u=_.find(k=>[1,2,3].includes(k))||2,y()},g.links=function(p){return arguments.length?(e=p,y(),g):e},g.id=function(p){return arguments.length?(n=p,g):n},g.iterations=function(p){return arguments.length?(c=+p,g):c},g.strength=function(p){return arguments.length?(r=typeof p=="function"?p:Tt(+p),x(),g):r},g.distance=function(p){return arguments.length?(o=typeof p=="function"?p:Tt(+p),v(),g):o},g}const fc=1664525,cc=1013904223,wr=4294967296;function hc(){let e=1;return()=>(e=(fc*e+cc)%wr)/wr}var kr=3;function Be(e){return e.x}function Ar(e){return e.y}function dc(e){return e.z}var pc=10,gc=Math.PI*(3-Math.sqrt(5)),yc=Math.PI*20/(9+Math.sqrt(221));function _c(e,n){n=n||2;var r=Math.min(kr,Math.max(1,Math.round(n))),i,o=1,a=.001,s=1-Math.pow(a,1/300),u=0,f=.6,l=new Map,d=wn(g),c=fe("tick","end"),h=hc();e==null&&(e=[]);function g(){y(),c.call("tick",i),o1&&(w.fy==null?w.y+=w.vy*=f:(w.y=w.fy,w.vy=0)),r>2&&(w.fz==null?w.z+=w.vz*=f:(w.z=w.fz,w.vz=0));return i}function x(){for(var p=0,_=e.length,k;p<_;++p){if(k=e[p],k.index=p,k.fx!=null&&(k.x=k.fx),k.fy!=null&&(k.y=k.fy),k.fz!=null&&(k.z=k.fz),isNaN(k.x)||r>1&&isNaN(k.y)||r>2&&isNaN(k.z)){var w=pc*(r>2?Math.cbrt(.5+p):r>1?Math.sqrt(.5+p):p),m=p*gc,A=p*yc;r===1?k.x=w:r===2?(k.x=w*Math.cos(m),k.y=w*Math.sin(m)):(k.x=w*Math.sin(m)*Math.cos(A),k.y=w*Math.cos(m),k.z=w*Math.sin(m)*Math.sin(A))}(isNaN(k.vx)||r>1&&isNaN(k.vy)||r>2&&isNaN(k.vz))&&(k.vx=0,r>1&&(k.vy=0),r>2&&(k.vz=0))}}function v(p){return p.initialize&&p.initialize(e,h,r),p}return x(),i={tick:y,restart:function(){return d.restart(g),i},stop:function(){return d.stop(),i},numDimensions:function(p){return arguments.length?(r=Math.min(kr,Math.max(1,Math.round(p))),l.forEach(v),i):r},nodes:function(p){return arguments.length?(e=p,x(),l.forEach(v),i):e},alpha:function(p){return arguments.length?(o=+p,i):o},alphaMin:function(p){return arguments.length?(a=+p,i):a},alphaDecay:function(p){return arguments.length?(s=+p,i):+s},alphaTarget:function(p){return arguments.length?(u=+p,i):u},velocityDecay:function(p){return arguments.length?(f=1-p,i):1-f},randomSource:function(p){return arguments.length?(h=p,l.forEach(v),i):h},force:function(p,_){return arguments.length>1?(_==null?l.delete(p):l.set(p,v(_)),i):l.get(p)},find:function(){var p=Array.prototype.slice.call(arguments),_=p.shift()||0,k=(r>1?p.shift():null)||0,w=(r>2?p.shift():null)||0,m=p.shift()||1/0,A=0,S=e.length,T,z,P,N,I,U;for(m*=m,A=0;A1?(c.on(p,_),i):c.on(p)}}}function vc(){var e,n,r,i,o,a=Tt(-30),s,u=1,f=1/0,l=.81;function d(y){var x,v=e.length,p=(n===1?Mi(e,Be):n===2?Oi(e,Be,Ar):n===3?zi(e,Be,Ar,dc):null).visitAfter(h);for(o=y,x=0;x1&&(y.y=w/_),n>2&&(y.z=m/_)}else{v=y,v.x=v.data.x,n>1&&(v.y=v.data.y),n>2&&(v.z=v.data.z);do x+=s[v.data.index];while(v=v.next)}y.value=x}function g(y,x,v,p,_){if(!y.value)return!0;var k=[v,p,_][n-1],w=y.x-r.x,m=n>1?y.y-r.y:0,A=n>2?y.z-r.z:0,S=k-x,T=w*w+m*m+A*A;if(S*S/l1&&m===0&&(m=Ct(i),T+=m*m),n>2&&A===0&&(A=Ct(i),T+=A*A),T1&&(r.vy+=m*y.value*o/T),n>2&&(r.vz+=A*y.value*o/T)),!0;if(y.length||T>=f)return;(y.data!==r||y.next)&&(w===0&&(w=Ct(i),T+=w*w),n>1&&m===0&&(m=Ct(i),T+=m*m),n>2&&A===0&&(A=Ct(i),T+=A*A),T1&&(r.vy+=m*S),n>2&&(r.vz+=A*S));while(y=y.next)}return d.initialize=function(y,...x){e=y,i=x.find(v=>typeof v=="function")||Math.random,n=x.find(v=>[1,2,3].includes(v))||2,c()},d.strength=function(y){return arguments.length?(a=typeof y=="function"?y:Tt(+y),c(),d):a},d.distanceMin=function(y){return arguments.length?(u=y*y,d):Math.sqrt(u)},d.distanceMax=function(y){return arguments.length?(f=y*y,d):Math.sqrt(f)},d.theta=function(y){return arguments.length?(l=y*y,d):Math.sqrt(l)},d}function mc(e,n,r,i){var o,a,s=Tt(.1),u,f;typeof e!="function"&&(e=Tt(+e)),n==null&&(n=0),r==null&&(r=0),i==null&&(i=0);function l(c){for(var h=0,g=o.length;h1&&(y.vy+=v*k),a>2&&(y.vz+=p*k)}}function d(){if(o){var c,h=o.length;for(u=new Array(h),f=new Array(h),c=0;c[1,2,3].includes(g))||2,d()},l.strength=function(c){return arguments.length?(s=typeof c=="function"?c:Tt(+c),d(),l):s},l.radius=function(c){return arguments.length?(e=typeof c=="function"?c:Tt(+c),d(),l):e},l.x=function(c){return arguments.length?(n=+c,l):n},l.y=function(c){return arguments.length?(r=+c,l):r},l.z=function(c){return arguments.length?(i=+c,l):i},l}const{abs:Wt,cos:At,sin:jt,acos:bc,atan2:Bt,sqrt:Ot,pow:at}=Math;function Xt(e){return e<0?-at(-e,1/3):at(e,1/3)}const Ri=Math.PI,ye=2*Ri,Et=Ri/2,xc=1e-6,Xe=Number.MAX_SAFE_INTEGER||9007199254740991,Ye=Number.MIN_SAFE_INTEGER||-9007199254740991,wc={x:0,y:0,z:0},O={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let i=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(i+=r.z*r.z),Ot(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const i=n.length-1;if(e===1)return n[i].t=1,n[i];const o=1-e;let a=n;if(i===0)return n[0].t=e,n[0];if(i===1){const u={x:o*a[0].x+e*a[1].x,y:o*a[0].y+e*a[1].y,t:e};return r&&(u.z=o*a[0].z+e*a[1].z),u}if(i<4){let u=o*o,f=e*e,l,d,c,h=0;i===2?(a=[a[0],a[1],a[2],wc],l=u,d=o*e*2,c=f):i===3&&(l=u*o,d=u*e*3,c=o*f*3,h=e*f);const g={x:l*a[0].x+d*a[1].x+c*a[2].x+h*a[3].x,y:l*a[0].y+d*a[1].y+c*a[2].y+h*a[3].y,t:e};return r&&(g.z=l*a[0].z+d*a[1].z+c*a[2].z+h*a[3].z),g}const s=JSON.parse(JSON.stringify(n));for(;s.length>1;){for(let u=0;u1;o--,a--){const s=[];for(let u=0,f;u"u")e=.5;else if(e===0||e===1)return e;const r=at(e,n)+at(1-e,n),i=r-1;return Wt(i/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=at(1-e,n),i=at(e,n)+r;return r/i},lli8:function(e,n,r,i,o,a,s,u){const f=(e*i-n*r)*(o-s)-(e-r)*(o*u-a*s),l=(e*i-n*r)*(a-u)-(n-i)*(o*u-a*s),d=(e-r)*(a-u)-(n-i)*(o-s);return d==0?!1:{x:f/d,y:l/d}},lli4:function(e,n,r,i){const o=e.x,a=e.y,s=n.x,u=n.y,f=r.x,l=r.y,d=i.x,c=i.y;return O.lli8(o,a,s,u,f,l,d,c)},lli:function(e,n){return O.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new W(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=Xe,r=Xe,i=Ye,o=Ye;return e.forEach(function(a){const s=a.bbox();n>s.x.min&&(n=s.x.min),r>s.y.min&&(r=s.y.min),i0&&(d.c1=f,d.c2=l,d.s1=e,d.s2=r,a.push(d))})}),a},makeshape:function(e,n,r){const i=n.points.length,o=e.points.length,a=O.makeline(n.points[i-1],e.points[0]),s=O.makeline(e.points[o-1],n.points[0]),u={startcap:a,forward:e,back:n,endcap:s,bbox:O.findbbox([a,e,n,s])};return u.intersections=function(f){return O.shapeintersections(u,u.bbox,f,f.bbox,r)},u},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=Xe,o=Ye,a,s;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let u=0,f=r.length;uo&&(o=s[n]);return{min:i,mid:(i+o)/2,max:o,size:o-i}},align:function(e,n){const r=n.p1.x,i=n.p1.y,o=-Bt(n.p2.y-i,n.p2.x-r),a=function(s){return{x:(s.x-r)*At(o)-(s.y-i)*jt(o),y:(s.x-r)*jt(o)+(s.y-i)*At(o)}};return e.map(a)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,i=O.align(e,n),o=function(S){return 0<=S&&S<=1};if(r===2){const S=i[0].y,T=i[1].y,z=i[2].y,P=S-2*T+z;if(P!==0){const N=-Ot(T*T-S*z),I=-S+T,U=-(N+I)/P,C=-(-N+I)/P;return[U,C].filter(o)}else if(T!==z&&P===0)return[(2*T-z)/(2*T-2*z)].filter(o);return[]}const a=i[0].y,s=i[1].y,u=i[2].y,f=i[3].y;let l=-a+3*s-3*u+f,d=3*a-6*s+3*u,c=-3*a+3*s,h=a;if(O.approximately(l,0)){if(O.approximately(d,0))return O.approximately(c,0)?[]:[-h/c].filter(o);const S=Ot(c*c-4*d*h),T=2*d;return[(S-c)/T,(-c-S)/T].filter(o)}d/=l,c/=l,h/=l;const g=(3*c-d*d)/3,y=g/3,x=(2*d*d*d-9*d*c+27*h)/27,v=x/2,p=v*v+y*y*y;let _,k,w,m,A;if(p<0){const S=-g/3,T=S*S*S,z=Ot(T),P=-x/(2*z),N=P<-1?-1:P>1?1:P,I=bc(N),U=Xt(z),C=2*U;return w=C*At(I/3)-d/3,m=C*At((I+ye)/3)-d/3,A=C*At((I+2*ye)/3)-d/3,[w,m,A].filter(o)}else{if(p===0)return _=v<0?Xt(-v):-Xt(v),w=2*_-d/3,m=-_-d/3,[w,m].filter(o);{const S=Ot(p);return _=Xt(-v+S),k=Xt(v+S),[_-k-d/3].filter(o)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],i=e[2],o=n-2*r+i;if(o!==0){const a=-Ot(r*r-n*i),s=-n+r,u=-(a+s)/o,f=-(-a+s)/o;return[u,f]}else if(r!==i&&o===0)return[(2*r-i)/(2*(r-i))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,i,o){let a,s,u,f,l=0,d=0;const c=O.compute(e,n),h=O.compute(e,r),g=c.x*c.x+c.y*c.y;if(i?(a=Ot(at(c.y*h.z-h.y*c.z,2)+at(c.z*h.x-h.z*c.x,2)+at(c.x*h.y-h.x*c.y,2)),s=at(g+c.z*c.z,3/2)):(a=c.x*h.y-c.y*h.x,s=at(g,3/2)),a===0||s===0)return{k:0,r:0};if(l=a/s,d=s/a,!o){const y=O.curvature(e-.001,n,r,i,!0).k,x=O.curvature(e+.001,n,r,i,!0).k;f=(x-l+(l-y))/2,u=(Wt(x-l)+Wt(l-y))/2}return{k:l,r:d,dk:f,adk:u}},inflections:function(e){if(e.length<4)return[];const n=O.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,o=n[1].x*n[2].y,a=n[3].x*n[2].y,s=18*(-3*r+2*i+3*o-a),u=18*(3*r-i-3*o),f=18*(o-r);if(O.approximately(s,0)){if(!O.approximately(u,0)){let h=-f/u;if(0<=h&&h<=1)return[h]}return[]}const l=2*s;if(O.approximately(l,0))return[];const d=u*u-4*s*f;if(d<0)return[];const c=Math.sqrt(d);return[(c-u)/l,-(u+c)/l].filter(function(h){return 0<=h&&h<=1})},bboxoverlap:function(e,n){const r=["x","y"],i=r.length;for(let o=0,a,s,u,f;o=f)return!1;return!0},expandbox:function(e,n){n.x.mine.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const i=e.bbox(),o=n.bbox(),a=1e5,s=r||.5;if(i.x.size+i.y.sizeA||A>S)&&(m+=ye),m>S&&(T=S,S=m,m=T)):S4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");o=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const s=this._3d=!o&&(a===9||a===12)||n&&n[0]&&typeof n[0].z<"u",u=this.points=[];for(let g=0,y=s?3:2;gg+Yt(y.y),0)"u"&&(o=.5),o===0)return new W(r,r,i);if(o===1)return new W(n,r,r);const a=W.getABC(2,n,r,i,o);return new W(n,a.A,i)}static cubicFromPoints(n,r,i,o,a){typeof o>"u"&&(o=.5);const s=W.getABC(3,n,r,i,o);typeof a>"u"&&(a=O.dist(r,s.C));const u=a*(1-o)/o,f=O.dist(n,i),l=(i.x-n.x)/f,d=(i.y-n.y)/f,c=a*l,h=a*d,g=u*l,y=u*d,x={x:r.x-c,y:r.y-h},v={x:r.x+g,y:r.y+y},p=s.A,_={x:p.x+(x.x-p.x)/(1-o),y:p.y+(x.y-p.y)/(1-o)},k={x:p.x+(v.x-p.x)/o,y:p.y+(v.y-p.y)/o},w={x:n.x+(_.x-n.x)/o,y:n.y+(_.y-n.y)/o},m={x:i.x+(k.x-i.x)/(1-o),y:i.y+(k.y-i.y)/(1-o)};return new W(n,w,m,i)}static getUtils(){return O}getUtils(){return W.getUtils()}static get PolyBezier(){return ie}valueOf(){return this.toString()}toString(){return O.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,i=n[0].y,o=["M",r,i,this.order===2?"Q":"C"];for(let a=1,s=n.length;a0}length(){return O.length(this.derivative.bind(this))}static getABC(n=2,r,i,o,a=.5){const s=O.projectionratio(a,n),u=1-s,f={x:s*r.x+u*o.x,y:s*r.y+u*o.y},l=O.abcratio(a,n);return{A:{x:i.x+(i.x-f.x)/l,y:i.y+(i.y-f.y)/l},B:i,C:f,S:r,E:o}}getABC(n,r){r=r||this.get(n);let i=this.points[0],o=this.points[this.order];return W.getABC(this.order,i,r,o,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,i,o;r1?1:c,h=this.compute(c),h.t=c,h.d=l,h}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?O.computeWithRatios(n,this.points,this.ratios,this._3d):O.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],i=n.length;for(let o=1,a,s;o1;){i=[];for(let s=0,u,f=r.length-1;s=0&&s<=1}),r=r.concat(n[i].sort(O.numberSort))}).bind(this)),n.values=r.sort(O.numberSort).filter(function(i,o){return r.indexOf(i)===o}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(i){r[i]=O.getminmax(this,i,n[i])}).bind(this)),r}overlaps(n){const r=this.bbox(),i=n.bbox();return O.bboxoverlap(r,i)}offset(n,r){if(typeof r<"u"){const i=this.get(n),o=this.normal(n),a={c:i,n:o,x:i.x+o.x*r,y:i.y+o.y*r};return this._3d&&(a.z=i.z+o.z*r),a}if(this._linear){const i=this.normal(0),o=this.points.map(function(a){const s={x:a.x+n*i.x,y:a.y+n*i.y};return a.z&&i.z&&(s.z=a.z+n*i.z),s});return[new W(o)]}return this.reduce().map(function(i){return i._linear?i.offset(n)[0]:i.scale(n)})}simple(){if(this.order===3){const o=O.angle(this.points[0],this.points[3],this.points[1]),a=O.angle(this.points[0],this.points[3],this.points[2]);if(o>0&&a<0||o<0&&a>0)return!1}const n=this.normal(0),r=this.normal(1);let i=n.x*r.x+n.y*r.y;return this._3d&&(i+=n.z*r.z),Yt(Cc(i))(1-u/o)*r+u/o*i);return new W(this.points.map((s,u)=>({x:s.x+n.x*a[u],y:s.y+n.y*a[u]})))}scale(n){const r=this.order;let i=!1;if(typeof n=="function"&&(i=n),i&&r===2)return this.raise().scale(i);const o=this.clockwise,a=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);const s=i?i(0):n,u=i?i(1):n,f=[this.offset(0,10),this.offset(1,10)],l=[],d=O.lli4(f[0],f[0].c,f[1],f[1].c);if(!d)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(c){const h=l[c*r]=O.copy(a[c*r]);h.x+=(c?u:s)*f[c].n.x,h.y+=(c?u:s)*f[c].n.y}),i?([0,1].forEach(function(c){if(!(r===2&&c)){var h=a[c+1],g={x:h.x-d.x,y:h.y-d.y},y=i?i((c+1)/r):n;i&&!o&&(y=-y);var x=Zt(g.x*g.x+g.y*g.y);g.x/=x,g.y/=x,l[c+1]={x:h.x+y*g.x,y:h.y+y*g.y}}}),new W(l)):([0,1].forEach(c=>{if(r===2&&c)return;const h=l[c*r],g=this.derivative(c),y={x:h.x+g.x,y:h.y+g.y};l[c+1]=O.lli4(h,y,d,a[c+1])}),new W(l))}outline(n,r,i,o){if(r=r===void 0?n:r,this._linear){const m=this.normal(0),A=this.points[0],S=this.points[this.points.length-1];let T,z,P;i===void 0&&(i=n,o=r),T={x:A.x+m.x*n,y:A.y+m.y*n},P={x:S.x+m.x*i,y:S.y+m.y*i},z={x:(T.x+P.x)/2,y:(T.y+P.y)/2};const N=[T,z,P];T={x:A.x-m.x*r,y:A.y-m.y*r},P={x:S.x-m.x*o,y:S.y-m.y*o},z={x:(T.x+P.x)/2,y:(T.y+P.y)/2};const I=[P,z,T],U=O.makeline(I[2],N[0]),C=O.makeline(N[2],I[0]),E=[U,new W(N),C,new W(I)];return new ie(E)}const a=this.reduce(),s=a.length,u=[];let f=[],l,d=0,c=this.length();const h=typeof i<"u"&&typeof o<"u";function g(m,A,S,T,z){return function(P){const N=T/S,I=(T+z)/S,U=A-m;return O.map(P,0,1,m+N*U,m+I*U)}}a.forEach(function(m){const A=m.length();h?(u.push(m.scale(g(n,i,c,d,A))),f.push(m.scale(g(-r,-o,c,d,A)))):(u.push(m.scale(n)),f.push(m.scale(-r))),d+=A}),f=f.map(function(m){return l=m.points,l[3]?m.points=[l[3],l[2],l[1],l[0]]:m.points=[l[2],l[1],l[0]],m}).reverse();const y=u[0].points[0],x=u[s-1].points[u[s-1].points.length-1],v=f[s-1].points[f[s-1].points.length-1],p=f[0].points[0],_=O.makeline(v,y),k=O.makeline(x,p),w=[_].concat(u).concat([k]).concat(f);return new ie(w)}outlineshapes(n,r,i){r=r||n;const o=this.outline(n,r).curves,a=[];for(let s=1,u=o.length;s1,f.endcap.virtual=s{var u=this.get(s);return O.between(u.x,r,o)&&O.between(u.y,i,a)})}selfintersects(n){const r=this.reduce(),i=r.length-2,o=[];for(let a=0,s,u,f;a0&&(a=a.concat(u))}),a}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,i,o){const a=(o-i)/4,s=this.get(i+a),u=this.get(o-a),f=O.dist(n,r),l=O.dist(n,s),d=O.dist(n,u);return Yt(l-f)+Yt(d-f)}_iterate(n,r){let i=0,o=1,a;do{a=0,o=1;let s=this.get(i),u,f,l,d,c=!1,h=!1,g,y=o,x=1;do if(h=c,d=l,y=(i+o)/2,u=this.get(y),f=this.get(o),l=O.getccenter(s,u,f),l.interval={start:i,end:o},c=this._error(l,s,i,o)<=n,g=h&&!c,g||(x=o),c){if(o>=1){if(l.interval.end=x=1,d=l,o>1){let p={x:l.x+l.r*kc(l.e),y:l.y+l.r*Ac(l.e)};l.e+=O.angle({x:l.x,y:l.y},p,this.get(1))}break}o=o+(o-i)/2}else o=y;while(!g&&a++<100);if(a>=100)break;d=d||l,r.push(d),i=x}while(o<1);return r}}function yn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(u){return{keyAccessor:u,isProp:!(u instanceof Function)}}),a=e.reduce(function(u,f){var l=u,d=f;return o.forEach(function(c,h){var g=c.keyAccessor,y=c.isProp,x;if(y){var v=d,p=v[g],_=Rc(v,[g].map($c));x=p,d=_}else x=g(d,h);h+11&&arguments[1]!==void 0?arguments[1]:1;l===o.length?Object.keys(f).forEach(function(d){return f[d]=r(f[d])}):Object.values(f).forEach(function(d){return u(d,l+1)})})(a);var s=a;return i&&(s=[],(function u(f){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];l.length===o.length?s.push({keys:l,vals:f}):Object.entries(f).forEach(function(d){var c=Ic(d,2),h=c[0],g=c[1];return u(g,[].concat(Dc(l),[h]))})})(a),n instanceof Array&&n.length===0&&s.length===1&&(s[0].keys=[])),s});function Uc(e){for(var n=e.length/6|0,r=new Array(n),i=0;i"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var Hc=`.force-graph-container canvas { - display: block; - user-select: none; - outline: none; - -webkit-tap-highlight-color: transparent; -} - -.force-graph-container .clickable { - cursor: pointer; -} - -.force-graph-container .grabbable { - cursor: move; - cursor: grab; - cursor: -moz-grab; - cursor: -webkit-grab; -} - -.force-graph-container .grabbable:active { - cursor: grabbing; - cursor: -moz-grabbing; - cursor: -webkit-grabbing; -} -`;qc(Hc);function _n(e,n){(n==null||n>e.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(g){throw"Invalid DAG structure! Found cycle in node path: ".concat(g.join(" -> "),".")}:u,l={};r.forEach(function(g){return l[n(g)]={data:g,out:[],depth:-1,skip:!s(g)}}),i.forEach(function(g){var y=g.source,x=g.target,v=w(y),p=w(x);if(!l.hasOwnProperty(v))throw"Missing source node with id: ".concat(v);if(!l.hasOwnProperty(p))throw"Missing target node with id: ".concat(p);var _=l[v],k=l[p];_.out.push(k);function w(m){return vn(m)==="object"?n(m):m}});var d=[];h(Object.values(l));var c=Object.assign.apply(Object,[{}].concat(ut(Object.entries(l).filter(function(g){var y=oe(g,2),x=y[1];return!x.skip}).map(function(g){var y=oe(g,2),x=y[0],v=y[1];return ue({},x,v.depth)}))));return c;function h(g){for(var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,v=function(){var w=g[p];if(y.indexOf(w)!==-1){var m=[].concat(ut(y.slice(y.indexOf(w))),[w]).map(function(A){return n(A.data)});return d.some(function(A){return A.length===m.length&&A.every(function(S,T){return S===m[T]})})||(d.push(m),f(m)),1}x>w.depth&&(w.depth=x,h(w.out,[].concat(ut(y),[w]),x+(w.skip?0:1)))},p=0,_=g.length;p<_;p++)v()}}var th=2,J=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},Or=function(n,r){if(!r.isShadow){var i=G(r.linkDirectionalParticles);r.graphData.links.forEach(function(o){var a=Math.round(Math.abs(i(o)));a?o.__photons=ut(Array(a)).map(function(){return{}}):delete o.__photons})}},Ne=Sn({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,Or(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:J},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:J},nodeColor:{default:"color",triggerUpdate:!1,onChange:J},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:J},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:J},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:J},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:J},linkColor:{default:"color",triggerUpdate:!1,onChange:J},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:J},linkWidth:{default:1,triggerUpdate:!1,onChange:J},linkCurvature:{default:0,triggerUpdate:!1,onChange:J},linkCanvasObject:{triggerUpdate:!1,onChange:J},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:J},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:J},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:J},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:J},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:Or},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,i){return i===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,i),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),o(),!n.isShadow&&a(),!n.isShadow&&s(),i(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()0){var I=Math.atan2(P.y-z.y,P.x-z.x),U=N*T,C={x:(z.x+P.x)/2+U*Math.cos(I-Math.PI/2),y:(z.y+P.y)/2+U*Math.sin(I-Math.PI/2)};S.__controlPoints=[C.x,C.y]}else{var E=T*70;S.__controlPoints=[P.x,P.y-E,P.x+E,P.y]}}}}function a(){var u=1.6,f=.2,l=G(n.linkDirectionalArrowLength),d=G(n.linkDirectionalArrowRelPos),c=G(n.linkVisibility),h=G(n.linkDirectionalArrowColor||n.linkColor),g=G(n.nodeVal),y=n.ctx;y.save(),n.graphData.links.filter(c).forEach(function(x){var v=l(x);if(!(!v||v<0)){var p=x.source,_=x.target;if(!(!p||!_||!p.hasOwnProperty("x")||!_.hasOwnProperty("x"))){var k=Math.sqrt(Math.max(0,g(p)||1))*n.nodeRelSize,w=Math.sqrt(Math.max(0,g(_)||1))*n.nodeRelSize,m=Math.min(1,Math.max(0,d(x))),A=h(x)||"rgba(0,0,0,0.28)",S=v/u/2,T=x.__controlPoints&&Tr(W,[p.x,p.y].concat(ut(x.__controlPoints),[_.x,_.y])),z=T?function(M){return T.get(M)}:function(M){return{x:p.x+(_.x-p.x)*M||0,y:p.y+(_.y-p.y)*M||0}},P=T?T.length():Math.sqrt(Math.pow(_.x-p.x,2)+Math.pow(_.y-p.y,2)),N=k+v+(P-k-w-v)*m,I=z(N/P),U=z((N-v)/P),C=z((N-v*(1-f))/P),E=Math.atan2(I.y-U.y,I.x-U.x)-Math.PI/2;y.beginPath(),y.moveTo(I.x,I.y),y.lineTo(U.x+S*Math.cos(E),U.y+S*Math.sin(E)),y.lineTo(C.x,C.y),y.lineTo(U.x-S*Math.cos(E),U.y-S*Math.sin(E)),y.fillStyle=A,y.fill()}}}),y.restore()}function s(){var u=G(n.linkDirectionalParticles),f=G(n.linkDirectionalParticleSpeed),l=G(n.linkDirectionalParticleOffset),d=G(n.linkDirectionalParticleWidth),c=G(n.linkVisibility),h=G(n.linkDirectionalParticleColor||n.linkColor),g=n.ctx;g.save(),n.graphData.links.filter(c).forEach(function(y){var x=u(y);if(!(!y.hasOwnProperty("__photons")||!y.__photons.length)){var v=y.source,p=y.target;if(!(!v||!p||!v.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var _=f(y),k=Math.abs(l(y)),w=y.__photons||[],m=Math.max(0,d(y)/2)/Math.sqrt(n.globalScale),A=h(y)||"rgba(0,0,0,0.28)";g.fillStyle=A;var S=y.__controlPoints?Tr(W,[v.x,v.y].concat(ut(y.__controlPoints),[p.x,p.y])):null,T=0,z=!1;w.forEach(function(P){var N=!!P.__singleHop;if(P.hasOwnProperty("__progressRatio")||(P.__progressRatio=N?_<0?1:0:(T+k)/x),!N&&T++,P.__progressRatio+=_,P.__progressRatio>=1||P.__progressRatio<0)if(!N)P.__progressRatio=P.__progressRatio%1,P.__progressRatio<0&&P.__progressRatio++;else{z=!0;return}var I=P.__progressRatio,U=S?S.get(I):{x:v.x+(p.x-v.x)*I||0,y:v.y+(p.y-v.y)*I||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(U.x,U.y,y,g,n.globalScale):(g.beginPath(),g.arc(U.x,U.y,m,0,2*Math.PI,!1),g.fill())}),z&&(y.__photons=y.__photons.filter(function(P){return!P.__singleHop||P.__progressRatio<=1&&P.__progressRatio>=0}))}}}),g.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:_c().force("link",lc()).force("charge",vc()).force("center",cf()).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&&Pr(n.graphData.nodes,G(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Pr(n.graphData.links,G(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(h){h.source=h[n.linkSource],h.target=h[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(h){return h[n.nodeId]}).links(n.graphData.links);var o=n.dagMode&&Jc(n.graphData,function(h){return h[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)*th*(["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(h){return delete h[u]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var f=["rl","bu"].includes(n.dagMode),l=function(g){return(o[g[n.nodeId]]-a/2)*s*(f?-1:1)},d=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(h){return h[d]=l(h)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?mc(function(h){var g=o[h[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-g:g)*s}).strength(function(h){return n.dagNodeFilter(h)?1:0}):null);for(var c=0;c0&&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=G(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:[$n(a,function(s){return s.x-s.r}),Fn(a,function(s){return s.x+s.r})],y:[$n(a,function(s){return s.y-s.r}),Fn(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:[]})}},ah),stateInit:function(){return{lastSetZoom:1,zoom:xu(),forceGraph:new Ne,shadowGraph:new Ne().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new Ll,tweenGroup:new ui}},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 c=null,h=window.devicePixelRatio,g=u.x>0&&u.y>0?s.getImageData(u.x*h,u.y*h,1,1):null;return g&&(c=r.colorTracker.lookup(g.data)),c};st(r.canvas).call(rs().subject(function(){if(!r.enableNodeDrag)return null;var d=f();return d&&d.type==="Node"?d.d:null}).on("start",function(d){var c=d.subject;c.__initialDragPos={x:c.x,y:c.y,fx:c.fx,fy:c.fy},d.active||(c.fx=c.x,c.fy=c.y),r.canvas.classList.add("grabbable")}).on("drag",function(d){var c=d.subject,h=c.__initialDragPos,g=d,y=pt(r.canvas).k,x={x:h.x+(g.x-h.x)/y-c.x,y:h.y+(g.y-h.y)/y-c.y};["x","y"].forEach(function(v){return c["f".concat(v)]=c[v]=h[v]+(g[v]-h[v])/y}),!(!c.__dragged&&rh>=Math.sqrt(Xi(["x","y"].map(function(v){return Math.pow(d[v]-h[v],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,c.__dragged=!0,r.onNodeDrag(c,x))}).on("end",function(d){var c=d.subject,h=c.__initialDragPos,g={x:c.x-h.x,y:c.y-h.y};h.fx===void 0&&(c.fx=void 0),h.fy===void 0&&(c.fy=void 0),delete c.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,c.__dragged&&(delete c.__dragged,r.onNodeDragEnd(c,g))})),r.zoom(r.zoom.__baseElem=st(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(d){return!d.button&&r.enableZoomPanInteraction&&(d.type!=="wheel"||G(r.enableZoomInteraction)(d))&&(d.type==="wheel"||G(r.enablePanInteraction)(d))}).on("zoom",function(d){var c=d.transform;[a,s].forEach(function(h){Fi(h),h.translate(c.x,c.y),h.scale(c.k,c.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom($t($t({},c),i.centerAt())),r.needsRedraw=!0}).on("end",function(d){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd($t($t({},d.transform),i.centerAt()))}),Ze(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=nh/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new ff(o),["pointermove","pointerdown"].forEach(function(d){return o.addEventListener(d,function(c){d==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=c),!r.isPointerDragging&&c.type==="pointermove"&&r.onBackgroundClick&&(c.pressure>0||r.isPointerPressed)&&(c.pointerType==="mouse"||c.movementX===void 0||[c.movementX,c.movementY].some(function(y){return Math.abs(y)>1}))&&(r.isPointerDragging=!0);var h=g(o);u.x=c.pageX-h.left,u.y=c.pageY-h.top;function g(y){var x=y.getBoundingClientRect(),v=window.pageXOffset||document.documentElement.scrollLeft,p=window.pageYOffset||document.documentElement.scrollTop;return{top:x.top+p,left:x.left+v}}},{passive:!0})}),o.addEventListener("pointerup",function(d){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var c=[d,r.pointerDownEvent];requestAnimationFrame(function(){if(d.button===0)if(r.hoverObj){var h=r["on".concat(r.hoverObj.type,"Click")];h&&h.apply(void 0,[r.hoverObj.d].concat(c))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,c);if(d.button===2)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"RightClick")];g&&g.apply(void 0,[r.hoverObj.d].concat(c))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,c)})}},{passive:!0}),o.addEventListener("contextmenu",function(d){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(d.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(s);var l=Xu(function(){Er(s,r.width,r.height),r.shadowGraph.linkWidth(function(c){return G(r.linkWidth)(c)+r.linkHoverPrecision});var d=pt(r.canvas);r.shadowGraph.globalScale(d.k).tickFrame()},eh);r.flushShadowCanvas=l.flush,(this._animationCycle=function d(){var c=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(k){return k.__photons&&k.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var h=r.isPointerDragging?null:f();if(h!==r.hoverObj){var g=r.hoverObj,y=g?g.type:null,x=h?h.type:null;if(y&&y!==x){var v=r["on".concat(y,"Hover")];v&&v(null,g.d)}if(x){var p=r["on".concat(x,"Hover")];p&&p(h.d,y===x?g.d:null)}r.tooltip.content(h&&G(r["".concat(h.type.toLowerCase(),"Label")])(h.d)||null),r.canvas.classList[(h&&r["on".concat(x,"Click")]||!h&&r.onBackgroundClick)&&G(r.showPointerCursor)(h==null?void 0:h.d)?"add":"remove"]("clickable"),r.hoverObj=h}c&&l()}if(c){Er(a,r.width,r.height);var _=pt(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,_),r.forceGraph.globalScale(_).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,_)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(d)})()},update:function(n){}}),Ke={exports:{}},Qe,zr;function uh(){if(zr)return Qe;zr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Qe=e,Qe}var Je,Rr;function lh(){if(Rr)return Je;Rr=1;var e=uh();function n(){}function r(){}return r.resetWarningCache=n,Je=function(){function i(s,u,f,l,d,c){if(c!==e){var h=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 h.name="Invariant Violation",h}}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},Je}var Nr;function fh(){return Nr||(Nr=1,Ke.exports=lh()()),Ke.exports}var ch=fh();const b=Gi(ch),Le={width:b.number,height:b.number,graphData:b.shape({nodes:b.arrayOf(b.object).isRequired,links:b.arrayOf(b.object).isRequired}),backgroundColor:b.string,nodeRelSize:b.number,nodeId:b.string,nodeLabel:b.oneOfType([b.string,b.func]),nodeVal:b.oneOfType([b.number,b.string,b.func]),nodeVisibility:b.oneOfType([b.bool,b.string,b.func]),nodeColor:b.oneOfType([b.string,b.func]),nodeAutoColorBy:b.oneOfType([b.string,b.func]),onNodeHover:b.func,onNodeClick:b.func,linkSource:b.string,linkTarget:b.string,linkLabel:b.oneOfType([b.string,b.func]),linkVisibility:b.oneOfType([b.bool,b.string,b.func]),linkColor:b.oneOfType([b.string,b.func]),linkAutoColorBy:b.oneOfType([b.string,b.func]),linkWidth:b.oneOfType([b.number,b.string,b.func]),linkCurvature:b.oneOfType([b.number,b.string,b.func]),linkDirectionalArrowLength:b.oneOfType([b.number,b.string,b.func]),linkDirectionalArrowColor:b.oneOfType([b.string,b.func]),linkDirectionalArrowRelPos:b.oneOfType([b.number,b.string,b.func]),linkDirectionalParticles:b.oneOfType([b.number,b.string,b.func]),linkDirectionalParticleSpeed:b.oneOfType([b.number,b.string,b.func]),linkDirectionalParticleOffset:b.oneOfType([b.number,b.string,b.func]),linkDirectionalParticleWidth:b.oneOfType([b.number,b.string,b.func]),linkDirectionalParticleColor:b.oneOfType([b.string,b.func]),onLinkHover:b.func,onLinkClick:b.func,dagMode:b.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:b.number,dagNodeFilter:b.func,onDagError:b.func,d3AlphaMin:b.number,d3AlphaDecay:b.number,d3VelocityDecay:b.number,warmupTicks:b.number,cooldownTicks:b.number,cooldownTime:b.number,onEngineTick:b.func,onEngineStop:b.func,getGraphBbox:b.func},Ui={zoomToFit:b.func,onNodeRightClick:b.func,onNodeDrag:b.func,onNodeDragEnd:b.func,onLinkRightClick:b.func,linkHoverPrecision:b.number,onBackgroundClick:b.func,onBackgroundRightClick:b.func,showPointerCursor:b.oneOfType([b.bool,b.func]),enablePointerInteraction:b.bool,enableNodeDrag:b.bool},Nn={showNavInfo:b.bool,nodeOpacity:b.number,nodeResolution:b.number,nodeThreeObject:b.oneOfType([b.object,b.string,b.func]),nodeThreeObjectExtend:b.oneOfType([b.bool,b.string,b.func]),nodePositionUpdate:b.func,linkOpacity:b.number,linkResolution:b.number,linkCurveRotation:b.oneOfType([b.number,b.string,b.func]),linkMaterial:b.oneOfType([b.object,b.string,b.func]),linkThreeObject:b.oneOfType([b.object,b.string,b.func]),linkThreeObjectExtend:b.oneOfType([b.bool,b.string,b.func]),linkPositionUpdate:b.func,linkDirectionalArrowResolution:b.number,linkDirectionalParticleResolution:b.number,linkDirectionalParticleThreeObject:b.oneOfType([b.object,b.string,b.func]),forceEngine:b.oneOf(["d3","ngraph"]),ngraphPhysics:b.object,numDimensions:b.oneOf([1,2,3])},hh=Object.assign({},Le,Ui,{linkLineDash:b.oneOfType([b.arrayOf(b.number),b.string,b.func]),nodeCanvasObjectMode:b.oneOfType([b.string,b.func]),nodeCanvasObject:b.func,nodePointerAreaPaint:b.func,linkCanvasObjectMode:b.oneOfType([b.string,b.func]),linkCanvasObject:b.func,linkPointerAreaPaint:b.func,linkDirectionalParticleCanvasObject:b.func,autoPauseRedraw:b.bool,minZoom:b.number,maxZoom:b.number,enableZoomInteraction:b.oneOfType([b.bool,b.func]),enablePanInteraction:b.oneOfType([b.bool,b.func]),onZoom:b.func,onZoomEnd:b.func,onRenderFramePre:b.func,onRenderFramePost:b.func});Object.assign({},Le,Ui,Nn,{enableNavigationControls:b.bool,controlType:b.oneOf(["trackball","orbit","fly"]),rendererConfig:b.object,extraRenderers:b.arrayOf(b.shape({render:b.func.isRequired}))});Object.assign({},Le,Nn,{nodeDesc:b.oneOfType([b.string,b.func]),linkDesc:b.oneOfType([b.string,b.func])});Object.assign({},Le,Nn,{markerAttrs:b.object,yOffset:b.number,glScale:b.number});const In=go(sh,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});In.displayName="ForceGraph2D";In.propTypes=hh;const Kt={identity:"#00f5ff",knowledge:"#3b82f6",rules:"#d946ef",events:"#fbbf24"},Ir={identity:"Identität",knowledge:"Wissen",rules:"Regeln",events:"Ereignisse"},tn=new Set(["auto","agent","hermes"]),dh="rgba(15, 23, 42, 0.01)",ph="rgba(255, 255, 255, 0.05)",gh="rgba(99, 102, 241, 0.85)";function _h({data:e,onDelete:n}){const[r,i]=Y.useState(null),[o,a]=Y.useState(null),s=Y.useRef(null),u=Y.useRef(null),[f,l]=Y.useState({width:500,height:560});Y.useEffect(()=>{if(!s.current)return;const p=new ResizeObserver(_=>{for(let k of _)k.contentRect.width>0&&k.contentRect.height>0&&l({width:Math.floor(k.contentRect.width),height:Math.floor(k.contentRect.height)})});return p.observe(s.current),()=>p.disconnect()},[]);const d=Y.useMemo(()=>({nodes:e.nodes.map(p=>({...p})),links:e.edges.map(p=>({source:p.source,target:p.target,weight:p.weight||0}))}),[e]),c=Y.useMemo(()=>{const p={};return e.edges.forEach(_=>{p[_.source]=(p[_.source]||0)+1,p[_.target]=(p[_.target]||0)+1}),p},[e]);Y.useEffect(()=>{const p=u.current;if(!p)return;const _=p.d3Force("charge");_&&_.strength(-140);const k=p.d3Force("link");k&&k.distance(60)},[d]);const h=o||r,g=()=>{u.current&&u.current.zoomToFit(400,40)},y=r?e.nodes.find(p=>p.id===r)??null:null,x=Y.useMemo(()=>{if(!r)return[];const p=new Set;return e.edges.forEach(_=>{_.source===r&&p.add(_.target),_.target===r&&p.add(_.source)}),e.nodes.filter(_=>p.has(_.id))},[r,e]),v=Y.useMemo(()=>{if(!h)return new Set;const p=new Set;return e.edges.forEach(_=>{_.source===h&&p.add(_.target),_.target===h&&p.add(_.source)}),p},[h,e]);return e.nodes.length?H.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-3",children:[H.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:[H.jsx(In,{ref:u,width:f.width,height:f.height,graphData:d,backgroundColor:"rgba(0,0,0,0)",nodeRelSize:4,cooldownTicks:100,onNodeClick:p=>i(p.id),onBackgroundClick:()=>i(null),onNodeHover:p=>{a(p?p.id:null),s.current&&(s.current.style.cursor=p?"pointer":"default")},linkColor:p=>{const _=typeof p.source=="object"?p.source.id:p.source,k=typeof p.target=="object"?p.target.id:p.target;return h===_||h===k?gh:h?dh:ph},linkWidth:p=>{const _=typeof p.source=="object"?p.source.id:p.source,k=typeof p.target=="object"?p.target.id:p.target;return h===_||h===k?2.2:.8},linkDirectionalParticles:p=>{const _=typeof p.source=="object"?p.source.id:p.source,k=typeof p.target=="object"?p.target.id:p.target;return h===_||h===k?4:0},linkDirectionalParticleWidth:2.2,linkDirectionalParticleSpeed:.006,nodeCanvasObject:(p,_,k)=>{const w=p.x??0,m=p.y??0,A=5.5+Math.min(c[p.id]||0,12)*.9,S=Kt[p.category]||"#64748b",T=p.id===o,z=p.id===r,P=h&&p.id!==h&&!v.has(p.id),N=P?"#1e293b":S;P||(_.shadowColor=S,_.shadowBlur=T||z?12:6),_.beginPath(),_.arc(w,m,A,0,2*Math.PI,!1),_.fillStyle=N,_.fill(),_.shadowBlur=0,(T||z)&&(_.beginPath(),_.arc(w,m,A+2,0,2*Math.PI,!1),_.strokeStyle=z?"#ffffff":"rgba(255, 255, 255, 0.7)",_.lineWidth=1.5,_.stroke());const I=p.content.length>30?p.content.slice(0,29)+"…":p.content,C=(T||z?10:9)/Math.max(.6,k);_.font=`${T||z?"bold":"500"} ${C}px "Space Grotesk", sans-serif`;const E=_.measureText(I).width,M=4/Math.max(.6,k);_.fillStyle=P?"rgba(10, 15, 25, 0.45)":"rgba(8, 12, 20, 0.85)",_.beginPath();const R=w-E/2-M,D=m+A+5/Math.max(.6,k),$=E+M*2,F=C+M*1.5,L=4/Math.max(.6,k);_.beginPath(),_.moveTo(R+L,D),_.lineTo(R+$-L,D),_.quadraticCurveTo(R+$,D,R+$,D+L),_.lineTo(R+$,D+F-L),_.quadraticCurveTo(R+$,D+F,R+$-L,D+F),_.lineTo(R+L,D+F),_.quadraticCurveTo(R,D+F,R,D+F-L),_.lineTo(R,D+L),_.quadraticCurveTo(R,D,R+L,D),_.closePath(),_.fill(),_.strokeStyle=T||z?"rgba(255, 255, 255, 0.15)":"rgba(255, 255, 255, 0.05)",_.lineWidth=.5/Math.max(.6,k),_.stroke(),_.textAlign="center",_.textBaseline="top",_.fillStyle=P?"#475569":T||z?"#ffffff":"#cbd5e1",_.fillText(I,w,m+A+6/Math.max(.6,k))}}),H.jsxs("button",{onClick:g,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:[H.jsx(Vi,{className:"h-3.5 w-3.5"})," Zentrieren"]}),H.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(Ir).map(([p,_])=>H.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[H.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:Kt[p]}}),_]},p))})]}),H.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:y?H.jsxs(H.Fragment,{children:[H.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[H.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Kt[y.category],boxShadow:`0 0 0 2px ${tn.has(y.source)?"#34d399":"#475569"}`}}),H.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:Kt[y.category]},children:Ir[y.category]||y.category}),H.jsxs("span",{className:`ml-auto text-[10px] font-mono flex items-center gap-1 ${tn.has(y.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[tn.has(y.source)&&H.jsx(Wi,{className:"h-2.5 w-2.5"}),y.source]})]}),H.jsx("div",{className:"text-sm text-foreground leading-relaxed mb-4 break-words",children:y.content}),H.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70 mb-2 flex items-center gap-1",children:[H.jsx(Un,{className:"h-3 w-3"})," verwandte Fakten"]}),H.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:x.length?x.map(p=>H.jsxs("button",{onClick:()=>i(p.id),className:"flex items-center gap-2 text-[11px] text-muted-foreground hover:text-foreground text-left transition-colors cursor-pointer",children:[H.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Kt[p.category]}}),H.jsx("span",{className:"truncate",children:p.content})]},p.id)):H.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"—"})}),H.jsxs("button",{onClick:()=>{n(y.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:[H.jsx(Bi,{className:"h-3.5 w-3.5"})," vergessen"]})]}):H.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center text-muted-foreground/70 gap-2 pt-24",children:[H.jsx(Un,{className:"h-6 w-6"}),H.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."})]})})]}):H.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{_h as GraphView}; diff --git a/frontend/dist/assets/index-BrDDv3Dl.js b/frontend/dist/assets/index-BcsTzr2v.js similarity index 99% rename from frontend/dist/assets/index-BrDDv3Dl.js rename to frontend/dist/assets/index-BcsTzr2v.js index b64b3ea..ff9283f 100644 --- a/frontend/dist/assets/index-BrDDv3Dl.js +++ b/frontend/dist/assets/index-BcsTzr2v.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-DAjHGBm0.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-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: 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 f135933..3d4d35e 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/package-lock.json b/frontend/package-lock.json index aed3de8..1ce74ea 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -14,6 +14,7 @@ "@tanstack/react-query": "^5.101.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", + "d3-force": "^3.0.0", "graphology": "^0.26.0", "graphology-layout-forceatlas2": "^0.10.1", "lucide-react": "^0.460.0", @@ -27,6 +28,7 @@ }, "devDependencies": { "@tailwindcss/vite": "^4.0.0", + "@types/d3-force": "^3.0.10", "@types/node": "^22.10.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", @@ -2345,6 +2347,13 @@ "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", "license": "MIT" }, + "node_modules/@types/d3-force": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.10.tgz", + "integrity": "sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/d3-interpolate": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", @@ -2838,6 +2847,20 @@ "node": ">=12" } }, + "node_modules/d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/d3-force-3d": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/d3-force-3d/-/d3-force-3d-3.0.6.tgz", diff --git a/frontend/package.json b/frontend/package.json index 45a1bbf..5e8a8f8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,6 +15,7 @@ "@tanstack/react-query": "^5.101.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", + "d3-force": "^3.0.0", "graphology": "^0.26.0", "graphology-layout-forceatlas2": "^0.10.1", "lucide-react": "^0.460.0", @@ -28,6 +29,7 @@ }, "devDependencies": { "@tailwindcss/vite": "^4.0.0", + "@types/d3-force": "^3.0.10", "@types/node": "^22.10.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", diff --git a/frontend/src/views/GraphView.tsx b/frontend/src/views/GraphView.tsx index ca69a0e..e2181ce 100644 --- a/frontend/src/views/GraphView.tsx +++ b/frontend/src/views/GraphView.tsx @@ -1,5 +1,6 @@ import { useEffect, useMemo, useRef, useState } from "react" import ForceGraph2D from "react-force-graph-2d" +import { forceCollide, forceX, forceY } from "d3-force" import { Trash2, Sparkles, Share2, RefreshCw } from "lucide-react" import { type MemoryGraph } from "@/lib/api" @@ -10,9 +11,16 @@ const CAT_LABEL: Record = { identity: "Identität", knowledge: "Wissen", rules: "Regeln", events: "Ereignisse", } const AUTO = new Set(["auto", "agent", "hermes"]) -const DIM_EDGE = "rgba(15, 23, 42, 0.01)" -const EDGE = "rgba(255, 255, 255, 0.05)" const EDGE_HI = "rgba(99, 102, 241, 0.85)" +const DIM_EDGE = "rgba(255, 255, 255, 0.02)" + +// Hilfsfunktion zur Konvertierung von Hex in RGBA für farbkodierte Verbindungen +function hexToRgba(hex: string, alpha: number): string { + const r = parseInt(hex.slice(1, 3), 16) + const g = parseInt(hex.slice(3, 5), 16) + const b = parseInt(hex.slice(5, 7), 16) + return `rgba(${r}, ${g}, ${b}, ${alpha})` +} export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id: string) => void }) { const [selected, setSelected] = useState(null) @@ -60,17 +68,51 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id return d }, [data]) - // D3 Force Engine tunen (Luftige Struktur, kein Überlappen) + // Quadranten-Fokuskoordinaten für sauberes Clustering + const getClusterX = (category: string) => { + return { + identity: -160, + knowledge: 160, + rules: -160, + events: 160, + }[category] || 0 + } + + const getClusterY = (category: string) => { + return { + identity: -160, + knowledge: -160, + rules: 160, + events: 160, + }[category] || 0 + } + + // D3 Force Engine tunen (Luftige Struktur, kein Überlappen, Clustering) useEffect(() => { const fg = fgRef.current if (!fg) return - // Sicherstellen, dass D3-Kräfte existieren, bevor wir aufgerufen werden - const charge = fg.d3Force("charge") - if (charge) charge.strength(-140) + // 1. Clustering-Kräfte (Knoten zu ihren jeweiligen Sektions-Foci ziehen) + fg.d3Force("x", forceX().x((node: any) => getClusterX(node.category)).strength(0.14)) + fg.d3Force("y", forceY().y((node: any) => getClusterY(node.category)).strength(0.14)) + // 2. Kollisionskraft (Verhindert, dass Knoten und Textlabels ineinandergeschoben werden) + fg.d3Force("collide", forceCollide().radius((node: any) => { + const nodeDegree = degree[node.id] || 0 + // Radius = Knotengröße + großzügiger Textpuffer + return 28 + Math.min(nodeDegree, 12) * 1.5 + }).iterations(2)) + + // 3. Abstoßung (Charge) moderat, da collide und foci die Hauptarbeit leisten + const charge = fg.d3Force("charge") + if (charge) charge.strength(-60) + + // 4. Federn (Links) const link = fg.d3Force("link") - if (link) link.distance(60) + if (link) link.distance(50) + + // Simulation neu anschubsen bei neuen Daten + fg.alpha(0.8).restart() }, [graphData]) const activeNode = hovered || selected @@ -126,7 +168,7 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id graphData={graphData} backgroundColor="rgba(0,0,0,0)" nodeRelSize={4} - cooldownTicks={100} + cooldownTicks={120} // Hover- und Klick-Logik onNodeClick={(node: any) => setSelected(node.id)} @@ -142,13 +184,22 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id linkColor={(link: any) => { const sId = typeof link.source === "object" ? link.source.id : link.source const tId = typeof link.target === "object" ? link.target.id : link.target + + // Highlight-Kanten leuchten in Indigo auf if (activeNode === sId || activeNode === tId) return EDGE_HI - return activeNode ? DIM_EDGE : EDGE + + // Wenn ein anderer Knoten aktiv ist, blenden wir diese Kante fast komplett aus + if (activeNode) return DIM_EDGE + + // Standard-Zustand: Kante leuchtet dezent in der Farbe der Kategorie des Quell-Knotens + const sourceNode = graphData.nodes.find(n => n.id === sId) + const catColor = sourceNode ? CAT_COLOR[sourceNode.category] : "#64748b" + return hexToRgba(catColor, 0.16) }} linkWidth={(link: any) => { const sId = typeof link.source === "object" ? link.source.id : link.source const tId = typeof link.target === "object" ? link.target.id : link.target - return (activeNode === sId || activeNode === tId) ? 2.2 : 0.8 + return (activeNode === sId || activeNode === tId) ? 2.5 : 1.2 }} // Daten-Partikel fließen auf den aktiven Verbindungen