diff --git a/frontend/dist/assets/GraphView-D7Eqj5xl.js b/frontend/dist/assets/GraphView-D1QoTnmX.js similarity index 99% rename from frontend/dist/assets/GraphView-D7Eqj5xl.js rename to frontend/dist/assets/GraphView-D1QoTnmX.js index 5a558ad..470d198 100644 --- a/frontend/dist/assets/GraphView-D7Eqj5xl.js +++ b/frontend/dist/assets/GraphView-D1QoTnmX.js @@ -1,4 +1,4 @@ -import{R as Fh,B as Ww,a as Xw,V as _n,F as qw,r as Iy,g as ki,b as q,c as go,d as Yw,e as jw,_ as Tc,u as $w,j as Zw,f as Kw,h as Se,l as Jw,S as Qw,i as Cg,T as eS}from"./index-Sr8SESP7.js";const tS=r=>typeof r=="object"&&typeof r.then=="function",Zc=[];function nS(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Zc.indexOf(i);s!==-1&&Zc.splice(s,1)},promise:(tS(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Zc.push(i),!t)throw i.promise}const rS=(r,e,t)=>iS(r,e,!1,t);function sS(r,e,t){return Math.max(e,Math.min(r,t))}const Tt={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function Rg(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Pg(r,e,t,n=.15){return n===0?sS(r,e,t):rt?+Rg(r-t,t-e,n)+t:r}function oS(r,[e,t],[n,i]){const[[s,o],[a,c]]=r;return[Pg(e,s,o,n),Pg(t,a,c,i)]}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function cS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function $t(r,e,t){return e=cS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lg(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ut(r){for(var e=1;e{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function gS(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Ny(r){return Du(r)?gS(r)[0]:r}function Pd(r,e){try{const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,s=(e.clientY+r.clientY)/2,o=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:o,origin:[i,s]}}catch{}return null}function vS(r){return mS(r).map(e=>e.identifier)}function Ig(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return Pd(t,n)}function kh(r){const e=Ny(r);return Du(r)?e.identifier:e.pointerId}function To(r){const e=Ny(r);return[e.clientX,e.clientY]}const Ug=40,Og=800;function Fy(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=Ug,t*=Ug):n===2&&(e*=Og,t*=Og),[e,t]}function _S(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:s,scrollTop:o}=r.currentTarget;return[(e=n??s)!==null&&e!==void 0?e:0,(t=i??o)!==null&&t!==void 0?t:0]}function yS(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function gu(r,...e){return typeof r=="function"?r(...e):r}function xS(){}function bS(...r){return r.length===0?xS:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ng(r,e){return Object.assign({},e,r||{})}const wS=32;class ky{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?gu(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,yS(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);Tt.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[c,l]=n.threshold,{_step:u,values:h}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=c&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=l&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=c&&Math.sign(o)*c),u[1]===!1&&(u[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const f=[0,0];if(n.hasCustomTransform){const[w,S]=h;f[0]=u[0]!==!1?w-u[0]:0,f[1]=u[1]!==!1?S-u[1]:0}else f[0]=u[0]!==!1?o-u[0]:0,f[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const d=t.offset,m=t._active&&!t._blocked||t.active;m&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=gu(n.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,g]=t.offset,[[p,_],[y,x]]=t._bounds;t.overflow=[v_?1:0,gx?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const b=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=oS(t._bounds,t.offset,b),t.delta=Tt.sub(t.offset,d),this.computeMovement(),m&&(!t.last||s>wS)){t.delta=Tt.sub(t.offset,d);const w=t.delta.map(Math.abs);Tt.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[w[0]/s,w[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ut(Ut(Ut({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function SS([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class Ac extends ky{constructor(...e){super(...e),$t(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Tt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Tt.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Oy(e)]:n.axisThreshold;t.axis=SS(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ES=r=>r,Fg=.15,zy={enabled(r=!0){return r},eventOptions(r,e,t){return Ut(Ut({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Fg,Fg];case!1:return[0,0];default:return Tt.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return Tt.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||ES},threshold(r){return Tt.toVector(r,0)}},MS=0,Es=Ut(Ut({},zy),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=MS){return r},bounds(r={}){if(typeof r=="function")return s=>Es.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),kg={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class TS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=Es.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=kh(e),n._pointerActive=!0,this.computeValues(To(e)),this.computeInitial(),t.preventScrollAxis&&Oy(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=To(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Tt.sub(s,t._values),this.computeValues(s)),Tt.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=n.tapsThreshold&&o<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[a,c]=t._delta,[l,u]=t._movement,[h,f]=n.swipe.velocity,[d,m]=n.swipe.distance,v=n.swipe.duration;if(t.elapsedTimeh&&Math.abs(l)>d&&(t.swipe[0]=Math.sign(a)),p>f&&Math.abs(u)>m&&(t.swipe[1]=Math.sign(c))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,AS(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=kg[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,Tt.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in kg&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function AS(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const Cc=typeof window<"u"&&window.document&&window.document.createElement;function By(){return Cc&&"ontouchstart"in window}function CS(){return By()||Cc&&window.navigator.maxTouchPoints>1}function RS(){return Cc&&"onpointerdown"in window}function PS(){return Cc&&"exitPointerLock"in window.document}function LS(){try{return"constructor"in GestureEvent}catch{return!1}}const Qn={isBrowser:Cc,gesture:LS(),touch:By(),touchscreen:CS(),pointer:RS(),pointerLock:PS()},DS=250,IS=180,US=.5,OS=50,NS=250,FS=10,zg={mouse:0,touch:0,pen:8},kS=Ut(Ut({},Es),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Qn.pointerLock,Qn.touch&&t?"touch":this.pointerLock?"mouse":Qn.pointer&&!i?"pointer":Qn.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?DS:void 0,!(!Qn.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=Tt.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=US,distance:e=OS,duration:t=NS}={}){return{velocity:this.transform(Tt.toVector(r)),distance:this.transform(Tt.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return IS;case!1:return 0;default:return r}},axisThreshold(r){return r?Ut(Ut({},zg),r):zg},keyboardDisplacement(r=FS){return r}});function Gy(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,o]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&o<0||t>0&&i<0&&o>0)&&(r._movement[1]=r._movementBound[1])}const zS=30,BS=100;class GS extends ky{constructor(...e){super(...e),$t(this,"ingKey","pinching"),$t(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=Tt.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*zS-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>n.has(s))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=Ig(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(o=>i.has(o))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=Pd(...Array.from(n.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=Ig(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=Pd(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],s=t.angle-i;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),n.origin=t.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=Tt.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(n=>e[n]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Fy(e)[1]/BS*n.offset[0],0],Tt.addTo(n._movement,n._delta),Gy(n),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const VS=Ut(Ut({},zy),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!Qn.touch&&Qn.gesture)return"gesture";if(Qn.touch&&n)return"touch";if(Qn.touchscreen){if(Qn.pointer)return"pointer";if(Qn.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=o=>{const a=Ng(gu(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=Ng(gu(n,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",Tt.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});class HS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(To(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=To(e),n=this.state;n._delta=Tt.sub(t,n._values),Tt.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const WS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r});class XS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=_S(e);t._delta=Tt.sub(n,t._values),Tt.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const qS=Es;class YS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Fy(e),Tt.addTo(t._movement,t._delta),Gy(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const jS=Es;class $S extends Ac{constructor(...e){super(...e),$t(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(To(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=To(e);t._movement=t._delta=Tt.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const ZS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r}),Gp=new Map,Ld=new Map;function KS(r){Gp.set(r.key,r.engine),Ld.set(r.key,r.resolver)}const JS={key:"drag",engine:TS,resolver:kS},QS={key:"hover",engine:$S,resolver:ZS},eE={key:"move",engine:HS,resolver:WS},tE={key:"pinch",engine:GS,resolver:VS},nE={key:"scroll",engine:XS,resolver:qS},iE={key:"wheel",engine:YS,resolver:jS};function rE(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}function sE(r,e){if(r==null)return{};var t=rE(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const oE={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=Qn.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},aE=["target","eventOptions","window","enabled","transform"];function nu(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=nu(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function cE(r,e,t={}){const n=r,{target:i,eventOptions:s,window:o,enabled:a,transform:c}=n,l=sE(n,aE);if(t.shared=nu({target:i,eventOptions:s,window:o,enabled:a,transform:c},oE),e){const u=Ld.get(e);t[e]=nu(Ut({shared:t.shared},l),u)}else for(const u in l){const h=Ld.get(u);h&&(t[u]=nu(Ut({shared:t.shared},l[u]),h))}return t}class Vy{constructor(e,t){$t(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const o=this._listeners,a=pS(t,n),c=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},l=Ut(Ut({},c),s);e.addEventListener(a,i,l);const u=()=>{e.removeEventListener(a,i,l),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class lE{constructor(){$t(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}let uE=class{constructor(e){$t(this,"gestures",new Set),$t(this,"_targetEventStore",new Vy(this)),$t(this,"gestureEventStores",{}),$t(this,"gestureTimeoutStores",{}),$t(this,"handlers",{}),$t(this,"config",{}),$t(this,"pointerIds",new Set),$t(this,"touchIds",new Set),$t(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),hE(this,e)}setEventIds(e){if(Du(e))return this.touchIds=new Set(vS(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=cE(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],c=Bg(n,a.eventOptions,!!i);if(a.enabled){const l=Gp.get(o);new l(this,e,o).bind(c)}}const s=Bg(n,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Ut(Ut({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in n)n[s]=bS(...n[s]);if(!i)return n;for(const s in n){const{device:o,capture:a,passive:c}=dS(s);this._targetEventStore.add(i,o,"",n[s],{capture:a,passive:c})}}}};function Ds(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Vy(r,e),r.gestureTimeoutStores[e]=new lE}function hE(r,e){e.drag&&Ds(r,"drag"),e.wheel&&Ds(r,"wheel"),e.scroll&&Ds(r,"scroll"),e.move&&Ds(r,"move"),e.pinch&&Ds(r,"pinch"),e.hover&&Ds(r,"hover")}const Bg=(r,e,t)=>(n,i,s,o={},a=!1)=>{var c,l;const u=(c=o.capture)!==null&&c!==void 0?c:e.capture,h=(l=o.passive)!==null&&l!==void 0?l:e.passive;let f=a?n:hS(n,i,u);t&&h&&(f+="Passive"),r[f]=r[f]||[],r[f].push(s)},fE=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function dE(r){const e={},t={},n=new Set;for(let i in r)fE.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function Is(r,e,t,n,i,s){if(!r.has(t)||!Gp.has(n))return;const o=t+"Start",a=t+"End",c=l=>{let u;return l.first&&o in e&&e[o](l),t in e&&(u=e[t](l)),l.last&&a in e&&e[a](l),u};i[n]=c,s[n]=s[n]||{}}function pE(r,e){const[t,n,i]=dE(r),s={};return Is(i,t,"onDrag","drag",s,e),Is(i,t,"onWheel","wheel",s,e),Is(i,t,"onScroll","scroll",s,e),Is(i,t,"onPinch","pinch",s,e),Is(i,t,"onMove","move",s,e),Is(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function mE(r,e={},t,n){const i=Fh.useMemo(()=>new uE(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Fh.useEffect(i.effect.bind(i)),Fh.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function gE(r){return r.forEach(KS),function(t,n){const{handlers:i,nativeHandlers:s,config:o}=pE(t,n||{});return mE(i,o,void 0,s)}}function vE(r,e){return gE([JS,tE,nE,iE,eE,QS])(r,e||{})}const Kc=(r,e)=>{const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,c=new Ww;let l=0;if(r.forEach((u,h)=>{let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(u.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(u.userData),e){let d;if(u.index)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,d,h),l+=d}}),t){let u=0;const h=[];r.forEach(f=>{const d=f.index;for(let m=0;m{let e,t,n,i=0;if(r.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}),e&&t){const s=new e(i);let o=0;return r.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new Xw(s,t,n)}},zh=new qw,Bh=new _n,Us=new _n,ci=new _n,Gi=new _n,Ti=new _n,Vi=new _n,Hi=new _n,Jo=new _n,Qo=new _n,ea=new _n,Jc=new _n,ta=new _n,na=new _n,ia=new _n;class Vg{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new _n,this.endPoint=new _n,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(zh,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Us.copy(e),Us.x=Math.min(e.x,t.x),Us.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ci.setFromMatrixPosition(this.camera.matrixWorld),Gi.copy(Us),Ti.set(t.x,Us.y,0),Vi.copy(t),Hi.set(Us.x,t.y,0),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),ta.copy(Gi).sub(ci),na.copy(Ti).sub(ci),ia.copy(Vi).sub(ci),ta.normalize(),na.normalize(),ia.normalize(),ta.multiplyScalar(this.deep),na.multiplyScalar(this.deep),ia.multiplyScalar(this.deep),ta.add(ci),na.add(ci),ia.add(ci);var n=zh.planes;n[0].setFromCoplanarPoints(ci,Gi,Ti),n[1].setFromCoplanarPoints(ci,Ti,Vi),n[2].setFromCoplanarPoints(Vi,Hi,ci),n[3].setFromCoplanarPoints(Hi,Gi,ci),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ia,na,ta),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);Gi.set(i,s,-1),Ti.set(o,s,-1),Vi.set(o,a,-1),Hi.set(i,a,-1),Jo.set(i,s,1),Qo.set(o,s,1),ea.set(o,a,1),Jc.set(i,a,1),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),Jo.unproject(this.camera),Qo.unproject(this.camera),ea.unproject(this.camera),Jc.unproject(this.camera);var n=zh.planes;n[0].setFromCoplanarPoints(Gi,Jo,Qo),n[1].setFromCoplanarPoints(Ti,Qo,ea),n[2].setFromCoplanarPoints(ea,Jc,Hi),n[3].setFromCoplanarPoints(Jc,Jo,Gi),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ea,Qo,Jo),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),Bh.copy(t.geometry.boundingSphere.center),Bh.applyMatrix4(t.matrixWorld),e.containsPoint(Bh)&&this.collection.push(t)),t.children.length>0)for(let n=0;n0;)de[pe]=arguments[pe+2];var Me=xe[he]||(xe[he]=R.getUniformLocation(ce,he));R["uniform"+$].apply(R,[Me].concat(de))},setAttribute:function($,he,de,pe,Me){var we=fe[$];we||(we=fe[$]={buf:R.createBuffer(),loc:R.getAttribLocation(ce,$),data:null}),R.bindBuffer(R.ARRAY_BUFFER,we.buf),R.vertexAttribPointer(we.loc,he,R.FLOAT,!1,0,0),R.enableVertexAttribArray(we.loc),H?R.vertexAttribDivisor(we.loc,pe):ge("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(we.loc,pe),Me!==we.data&&(R.bufferData(R.ARRAY_BUFFER,Me,de),we.data=Me)}})}}}J[K].transaction(re)},D=function(K,W){ne++;try{R.activeTexture(R.TEXTURE0+ne);var ye=ie[K];ye||(ye=ie[K]=R.createTexture(),R.bindTexture(R.TEXTURE_2D,ye),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.NEAREST),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.NEAREST)),R.bindTexture(R.TEXTURE_2D,ye),W(ye,ne)}finally{ne--}},Q=function(K,W,ye){var re=R.createFramebuffer();ee.push(re),R.bindFramebuffer(R.FRAMEBUFFER,re),R.activeTexture(R.TEXTURE0+W),R.bindTexture(R.TEXTURE_2D,K),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,K,0);try{ye(re)}finally{R.deleteFramebuffer(re),R.bindFramebuffer(R.FRAMEBUFFER,ee[--ee.length-1]||null)}},j=function(){Y={},J={},ie={},ne=-1,ee.length=0};var H=typeof WebGL2RenderingContext<"u"&&R instanceof WebGL2RenderingContext,Y={},J={},ie={},ne=-1,ee=[];R.canvas.addEventListener("webglcontextlost",function(K){j(),K.preventDefault()},!1),c.set(R,F={gl:R,isWebGL2:H,getExtension:ge,withProgram:te,withTexture:D,withTextureFramebuffer:Q,handleContextLoss:j})}U(F)}function h(k,U,R,F,H,Y,J,ie){J===void 0&&(J=15),ie===void 0&&(ie=null),u(k,function(ne){var ee=ne.gl,ge=ne.withProgram,me=ne.withTexture;me("copy",function(te,D){ee.texImage2D(ee.TEXTURE_2D,0,ee.RGBA,H,Y,0,ee.RGBA,ee.UNSIGNED_BYTE,U),ge("copy",o,a,function(Q){var j=Q.setUniform,K=Q.setAttribute;K("aUV",2,ee.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),j("1i","image",D),ee.bindFramebuffer(ee.FRAMEBUFFER,ie||null),ee.disable(ee.BLEND),ee.colorMask(J&8,J&4,J&2,J&1),ee.viewport(R,F,H,Y),ee.scissor(R,F,H,Y),ee.drawArrays(ee.TRIANGLES,0,3)})})})}function f(k,U,R){var F=k.width,H=k.height;u(k,function(Y){var J=Y.gl,ie=new Uint8Array(F*H*4);J.readPixels(0,0,F,H,J.RGBA,J.UNSIGNED_BYTE,ie),k.width=U,k.height=R,h(J,ie,0,0,F,H)})}var d=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(k,U,R,F,H,Y){Y===void 0&&(Y=1);var J=new Uint8Array(k*U),ie=F[2]-F[0],ne=F[3]-F[1],ee=[];s(R,function(K,W,ye,re){ee.push({x1:K,y1:W,x2:ye,y2:re,minX:Math.min(K,ye),minY:Math.min(W,re),maxX:Math.max(K,ye),maxY:Math.max(W,re)})}),ee.sort(function(K,W){return K.maxX-W.maxX});for(var ge=0;gexe.minX&&W-rexe.minY){var ce=p(K,W,xe.x1,xe.y1,xe.x2,xe.y2);ceW!=fe.y2>W&&K<(fe.x2-fe.x1)*(W-fe.y1)/(fe.y2-fe.y1)+fe.x1;xe&&(ye+=fe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function v(re,fe){var xe=36,ce=0,Pe=new Map,B=fe&&new Map,I;return re.split(",").forEach(function $(he){if(he.indexOf("+")!==-1)for(var de=+he;de--;)$(I);else{I=he;var pe=he.split(">"),Me=pe[0],we=pe[1];Me=String.fromCodePoint(ce+=parseInt(Me,xe)),we=String.fromCodePoint(ce+=parseInt(we,xe)),Pe.set(Me,we),fe&&B.set(we,Me)}}),{map:Pe,reverseMap:B}}var g,p,_;function y(){if(!g){var re=v(m.pairs,!0),fe=re.map,xe=re.reverseMap;g=fe,p=xe,_=v(m.canonical,!1).map}}function x(re){return y(),g.get(re)||null}function b(re){return y(),p.get(re)||null}function w(re){return y(),_.get(re)||null}var S=n.L,M=n.R,E=n.EN,T=n.ES,L=n.ET,P=n.AN,A=n.CS,z=n.B,V=n.S,N=n.ON,C=n.BN,O=n.NSM,k=n.AL,U=n.LRO,R=n.RLO,F=n.LRE,H=n.RLE,Y=n.PDF,J=n.LRI,ie=n.RLI,ne=n.FSI,ee=n.PDI;function ge(re,fe){for(var xe=125,ce=new Uint32Array(re.length),Pe=0;Pe0)De--;else if(je>0){for(Ve=0;!Le[Le.length-1]._isolate;)Le.pop();var tt=Le[Le.length-1]._isolInitIndex;tt!=null&&(he.set(tt,Z),he.set(Z,tt)),Le.pop(),je--}Ee=Le[Le.length-1],$[Z]=Ee._level,Ee._override&&I(Z,Ee._override)}else Ae&Y?(De===0&&(Ve>0?Ve--:!Ee._isolate&&Le.length>1&&(Le.pop(),Ee=Le[Le.length-1])),$[Z]=Ee._level):Ae&z&&($[Z]=pe.level);else $[Z]=Ee._level,Ee._override&&Ae!==C&&I(Z,Ee._override)}for(var lt=[],ft=null,ut=pe.start;ut<=pe.end;ut++){var xt=ce[ut];if(!(xt&c)){var dt=$[ut],ct=xt&s,Mn=xt===ee;ft&&dt===ft._level?(ft._end=ut,ft._endsWithIsolInit=ct):lt.push(ft={_start:ut,_end:ut,_level:dt,_startsWithPDI:Mn,_endsWithIsolInit:ct})}}for(var fn=[],yt=0;yt=0;se--)if(!(ce[se]&c)){ve=$[se];break}var _e=sn[sn.length-1],Ge=$[_e],We=pe.level;if(!(ce[_e]&s)){for(var qe=_e+1;qe<=pe.end;qe++)if(!(ce[qe]&c)){We=$[qe];break}}fn.push({_seqIndices:sn,_sosType:Math.max(ve,ae)%2?M:S,_eosType:Math.max(We,Ge)%2?M:S})}}for(var Ye=0;Ye=0;at--)if(!(ce[Te[at]]&c)){Ct=ce[Te[at]];break}I(Xn,Ct&(s|ee)?N:Ct)}}if(B.get(E))for(var fr=0;fr=-1;qn--){var Vo=qn===-1?Ze:ce[Te[qn]];if(Vo&o){Vo===k&&I(Wt,P);break}}}if(B.get(k))for(var Bi=0;Bi=0&&(Mi=ce[Te[zr]],!!(Mi&c));zr--);for(var Ho=Xt+1;Ho=0&&ce[Te[Hc]]&(L|c);Hc--)I(Te[Hc],E);for(On++;On=0&&ce[Te[Wc]]&c;Wc--)I(Te[Wc],N);for(var Xc=Wo+1;Xc=0;Yo--){var Rh=Ps[Yo].char;if(Rh===vg||Rh===b(w(qo))||x(w(Rh))===qo){qc.push([Ps[Yo].seqIndex,Ls]),Ps.length=Yo;break}}}qc.sort(function(Tn,ai){return Tn[0]-ai[0]})}for(var Ph=0;Ph=0;Ih--){var wg=Te[Ih];if(ce[wg]&gg){var Sg=ce[wg]&Xo?M:S;Sg!==bt?oi=Sg:oi=bt;break}}}if(oi){if(ce[Te[Yc]]=ce[Te[Lh]]=oi,oi!==bt){for(var jo=Yc+1;jo=0;Zo--)if(ce[Te[Zo]]&c)Eg=Zo;else{Oh=ce[Te[Zo]]&Xo?M:S;break}for(var Mg=At,Ko=dr+1;Ko=0&&f(re[$c])&l;$c--)$[$c]=pe.level}}return{levels:$,paragraphs:de};function Tg(Tn,ai){for(var An=Tn;An=$&&f(re[pe])&l;pe--)de[pe]=I.level;for(var Me=I.level,we=1/0,ue=0;ueMe&&(Me=Ce),Ce=we;ze--)for(var Le=0;Le=ze){for(var Ee=Le;Le+1=ze;)Le++;Le>Ee&&B.push([Ee+$,Le+$])}}}),B}function W(re,fe,xe,ce){var Pe=ye(re,fe,xe,ce),B=[].concat(re);return Pe.forEach(function(I,$){B[$]=(fe.levels[I]&1?Q(re[I]):null)||re[I]}),B.join("")}function ye(re,fe,xe,ce){for(var Pe=K(re,fe,xe,ce),B=[],I=0;Itypeof r=="object"&&typeof r.then=="function",Zc=[];function nS(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Zc.indexOf(i);s!==-1&&Zc.splice(s,1)},promise:(tS(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Zc.push(i),!t)throw i.promise}const rS=(r,e,t)=>iS(r,e,!1,t);function sS(r,e,t){return Math.max(e,Math.min(r,t))}const Tt={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function Rg(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Pg(r,e,t,n=.15){return n===0?sS(r,e,t):rt?+Rg(r-t,t-e,n)+t:r}function oS(r,[e,t],[n,i]){const[[s,o],[a,c]]=r;return[Pg(e,s,o,n),Pg(t,a,c,i)]}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function cS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function $t(r,e,t){return e=cS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lg(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ut(r){for(var e=1;e{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function gS(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Ny(r){return Du(r)?gS(r)[0]:r}function Pd(r,e){try{const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,s=(e.clientY+r.clientY)/2,o=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:o,origin:[i,s]}}catch{}return null}function vS(r){return mS(r).map(e=>e.identifier)}function Ig(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return Pd(t,n)}function kh(r){const e=Ny(r);return Du(r)?e.identifier:e.pointerId}function To(r){const e=Ny(r);return[e.clientX,e.clientY]}const Ug=40,Og=800;function Fy(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=Ug,t*=Ug):n===2&&(e*=Og,t*=Og),[e,t]}function _S(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:s,scrollTop:o}=r.currentTarget;return[(e=n??s)!==null&&e!==void 0?e:0,(t=i??o)!==null&&t!==void 0?t:0]}function yS(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function gu(r,...e){return typeof r=="function"?r(...e):r}function xS(){}function bS(...r){return r.length===0?xS:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ng(r,e){return Object.assign({},e,r||{})}const wS=32;class ky{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?gu(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,yS(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);Tt.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[c,l]=n.threshold,{_step:u,values:h}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=c&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=l&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=c&&Math.sign(o)*c),u[1]===!1&&(u[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const f=[0,0];if(n.hasCustomTransform){const[w,S]=h;f[0]=u[0]!==!1?w-u[0]:0,f[1]=u[1]!==!1?S-u[1]:0}else f[0]=u[0]!==!1?o-u[0]:0,f[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const d=t.offset,m=t._active&&!t._blocked||t.active;m&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=gu(n.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,g]=t.offset,[[p,_],[y,x]]=t._bounds;t.overflow=[v_?1:0,gx?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const b=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=oS(t._bounds,t.offset,b),t.delta=Tt.sub(t.offset,d),this.computeMovement(),m&&(!t.last||s>wS)){t.delta=Tt.sub(t.offset,d);const w=t.delta.map(Math.abs);Tt.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[w[0]/s,w[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ut(Ut(Ut({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function SS([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class Ac extends ky{constructor(...e){super(...e),$t(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Tt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Tt.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Oy(e)]:n.axisThreshold;t.axis=SS(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ES=r=>r,Fg=.15,zy={enabled(r=!0){return r},eventOptions(r,e,t){return Ut(Ut({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Fg,Fg];case!1:return[0,0];default:return Tt.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return Tt.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||ES},threshold(r){return Tt.toVector(r,0)}},MS=0,Es=Ut(Ut({},zy),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=MS){return r},bounds(r={}){if(typeof r=="function")return s=>Es.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),kg={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class TS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=Es.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=kh(e),n._pointerActive=!0,this.computeValues(To(e)),this.computeInitial(),t.preventScrollAxis&&Oy(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=To(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Tt.sub(s,t._values),this.computeValues(s)),Tt.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=n.tapsThreshold&&o<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[a,c]=t._delta,[l,u]=t._movement,[h,f]=n.swipe.velocity,[d,m]=n.swipe.distance,v=n.swipe.duration;if(t.elapsedTimeh&&Math.abs(l)>d&&(t.swipe[0]=Math.sign(a)),p>f&&Math.abs(u)>m&&(t.swipe[1]=Math.sign(c))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,AS(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=kg[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,Tt.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in kg&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function AS(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const Cc=typeof window<"u"&&window.document&&window.document.createElement;function By(){return Cc&&"ontouchstart"in window}function CS(){return By()||Cc&&window.navigator.maxTouchPoints>1}function RS(){return Cc&&"onpointerdown"in window}function PS(){return Cc&&"exitPointerLock"in window.document}function LS(){try{return"constructor"in GestureEvent}catch{return!1}}const Qn={isBrowser:Cc,gesture:LS(),touch:By(),touchscreen:CS(),pointer:RS(),pointerLock:PS()},DS=250,IS=180,US=.5,OS=50,NS=250,FS=10,zg={mouse:0,touch:0,pen:8},kS=Ut(Ut({},Es),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Qn.pointerLock,Qn.touch&&t?"touch":this.pointerLock?"mouse":Qn.pointer&&!i?"pointer":Qn.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?DS:void 0,!(!Qn.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=Tt.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=US,distance:e=OS,duration:t=NS}={}){return{velocity:this.transform(Tt.toVector(r)),distance:this.transform(Tt.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return IS;case!1:return 0;default:return r}},axisThreshold(r){return r?Ut(Ut({},zg),r):zg},keyboardDisplacement(r=FS){return r}});function Gy(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,o]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&o<0||t>0&&i<0&&o>0)&&(r._movement[1]=r._movementBound[1])}const zS=30,BS=100;class GS extends ky{constructor(...e){super(...e),$t(this,"ingKey","pinching"),$t(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=Tt.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*zS-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>n.has(s))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=Ig(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(o=>i.has(o))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=Pd(...Array.from(n.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=Ig(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=Pd(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],s=t.angle-i;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),n.origin=t.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=Tt.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(n=>e[n]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Fy(e)[1]/BS*n.offset[0],0],Tt.addTo(n._movement,n._delta),Gy(n),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const VS=Ut(Ut({},zy),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!Qn.touch&&Qn.gesture)return"gesture";if(Qn.touch&&n)return"touch";if(Qn.touchscreen){if(Qn.pointer)return"pointer";if(Qn.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=o=>{const a=Ng(gu(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=Ng(gu(n,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",Tt.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});class HS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(To(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=To(e),n=this.state;n._delta=Tt.sub(t,n._values),Tt.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const WS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r});class XS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=_S(e);t._delta=Tt.sub(n,t._values),Tt.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const qS=Es;class YS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Fy(e),Tt.addTo(t._movement,t._delta),Gy(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const jS=Es;class $S extends Ac{constructor(...e){super(...e),$t(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(To(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=To(e);t._movement=t._delta=Tt.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const ZS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r}),Gp=new Map,Ld=new Map;function KS(r){Gp.set(r.key,r.engine),Ld.set(r.key,r.resolver)}const JS={key:"drag",engine:TS,resolver:kS},QS={key:"hover",engine:$S,resolver:ZS},eE={key:"move",engine:HS,resolver:WS},tE={key:"pinch",engine:GS,resolver:VS},nE={key:"scroll",engine:XS,resolver:qS},iE={key:"wheel",engine:YS,resolver:jS};function rE(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}function sE(r,e){if(r==null)return{};var t=rE(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const oE={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=Qn.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},aE=["target","eventOptions","window","enabled","transform"];function nu(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=nu(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function cE(r,e,t={}){const n=r,{target:i,eventOptions:s,window:o,enabled:a,transform:c}=n,l=sE(n,aE);if(t.shared=nu({target:i,eventOptions:s,window:o,enabled:a,transform:c},oE),e){const u=Ld.get(e);t[e]=nu(Ut({shared:t.shared},l),u)}else for(const u in l){const h=Ld.get(u);h&&(t[u]=nu(Ut({shared:t.shared},l[u]),h))}return t}class Vy{constructor(e,t){$t(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const o=this._listeners,a=pS(t,n),c=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},l=Ut(Ut({},c),s);e.addEventListener(a,i,l);const u=()=>{e.removeEventListener(a,i,l),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class lE{constructor(){$t(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}let uE=class{constructor(e){$t(this,"gestures",new Set),$t(this,"_targetEventStore",new Vy(this)),$t(this,"gestureEventStores",{}),$t(this,"gestureTimeoutStores",{}),$t(this,"handlers",{}),$t(this,"config",{}),$t(this,"pointerIds",new Set),$t(this,"touchIds",new Set),$t(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),hE(this,e)}setEventIds(e){if(Du(e))return this.touchIds=new Set(vS(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=cE(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],c=Bg(n,a.eventOptions,!!i);if(a.enabled){const l=Gp.get(o);new l(this,e,o).bind(c)}}const s=Bg(n,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Ut(Ut({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in n)n[s]=bS(...n[s]);if(!i)return n;for(const s in n){const{device:o,capture:a,passive:c}=dS(s);this._targetEventStore.add(i,o,"",n[s],{capture:a,passive:c})}}}};function Ds(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Vy(r,e),r.gestureTimeoutStores[e]=new lE}function hE(r,e){e.drag&&Ds(r,"drag"),e.wheel&&Ds(r,"wheel"),e.scroll&&Ds(r,"scroll"),e.move&&Ds(r,"move"),e.pinch&&Ds(r,"pinch"),e.hover&&Ds(r,"hover")}const Bg=(r,e,t)=>(n,i,s,o={},a=!1)=>{var c,l;const u=(c=o.capture)!==null&&c!==void 0?c:e.capture,h=(l=o.passive)!==null&&l!==void 0?l:e.passive;let f=a?n:hS(n,i,u);t&&h&&(f+="Passive"),r[f]=r[f]||[],r[f].push(s)},fE=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function dE(r){const e={},t={},n=new Set;for(let i in r)fE.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function Is(r,e,t,n,i,s){if(!r.has(t)||!Gp.has(n))return;const o=t+"Start",a=t+"End",c=l=>{let u;return l.first&&o in e&&e[o](l),t in e&&(u=e[t](l)),l.last&&a in e&&e[a](l),u};i[n]=c,s[n]=s[n]||{}}function pE(r,e){const[t,n,i]=dE(r),s={};return Is(i,t,"onDrag","drag",s,e),Is(i,t,"onWheel","wheel",s,e),Is(i,t,"onScroll","scroll",s,e),Is(i,t,"onPinch","pinch",s,e),Is(i,t,"onMove","move",s,e),Is(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function mE(r,e={},t,n){const i=Fh.useMemo(()=>new uE(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Fh.useEffect(i.effect.bind(i)),Fh.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function gE(r){return r.forEach(KS),function(t,n){const{handlers:i,nativeHandlers:s,config:o}=pE(t,n||{});return mE(i,o,void 0,s)}}function vE(r,e){return gE([JS,tE,nE,iE,eE,QS])(r,e||{})}const Kc=(r,e)=>{const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,c=new Ww;let l=0;if(r.forEach((u,h)=>{let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(u.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(u.userData),e){let d;if(u.index)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,d,h),l+=d}}),t){let u=0;const h=[];r.forEach(f=>{const d=f.index;for(let m=0;m{let e,t,n,i=0;if(r.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}),e&&t){const s=new e(i);let o=0;return r.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new Xw(s,t,n)}},zh=new qw,Bh=new _n,Us=new _n,ci=new _n,Gi=new _n,Ti=new _n,Vi=new _n,Hi=new _n,Jo=new _n,Qo=new _n,ea=new _n,Jc=new _n,ta=new _n,na=new _n,ia=new _n;class Vg{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new _n,this.endPoint=new _n,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(zh,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Us.copy(e),Us.x=Math.min(e.x,t.x),Us.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ci.setFromMatrixPosition(this.camera.matrixWorld),Gi.copy(Us),Ti.set(t.x,Us.y,0),Vi.copy(t),Hi.set(Us.x,t.y,0),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),ta.copy(Gi).sub(ci),na.copy(Ti).sub(ci),ia.copy(Vi).sub(ci),ta.normalize(),na.normalize(),ia.normalize(),ta.multiplyScalar(this.deep),na.multiplyScalar(this.deep),ia.multiplyScalar(this.deep),ta.add(ci),na.add(ci),ia.add(ci);var n=zh.planes;n[0].setFromCoplanarPoints(ci,Gi,Ti),n[1].setFromCoplanarPoints(ci,Ti,Vi),n[2].setFromCoplanarPoints(Vi,Hi,ci),n[3].setFromCoplanarPoints(Hi,Gi,ci),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ia,na,ta),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);Gi.set(i,s,-1),Ti.set(o,s,-1),Vi.set(o,a,-1),Hi.set(i,a,-1),Jo.set(i,s,1),Qo.set(o,s,1),ea.set(o,a,1),Jc.set(i,a,1),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),Jo.unproject(this.camera),Qo.unproject(this.camera),ea.unproject(this.camera),Jc.unproject(this.camera);var n=zh.planes;n[0].setFromCoplanarPoints(Gi,Jo,Qo),n[1].setFromCoplanarPoints(Ti,Qo,ea),n[2].setFromCoplanarPoints(ea,Jc,Hi),n[3].setFromCoplanarPoints(Jc,Jo,Gi),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ea,Qo,Jo),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),Bh.copy(t.geometry.boundingSphere.center),Bh.applyMatrix4(t.matrixWorld),e.containsPoint(Bh)&&this.collection.push(t)),t.children.length>0)for(let n=0;n0;)de[pe]=arguments[pe+2];var Me=xe[he]||(xe[he]=R.getUniformLocation(ce,he));R["uniform"+$].apply(R,[Me].concat(de))},setAttribute:function($,he,de,pe,Me){var we=fe[$];we||(we=fe[$]={buf:R.createBuffer(),loc:R.getAttribLocation(ce,$),data:null}),R.bindBuffer(R.ARRAY_BUFFER,we.buf),R.vertexAttribPointer(we.loc,he,R.FLOAT,!1,0,0),R.enableVertexAttribArray(we.loc),H?R.vertexAttribDivisor(we.loc,pe):ge("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(we.loc,pe),Me!==we.data&&(R.bufferData(R.ARRAY_BUFFER,Me,de),we.data=Me)}})}}}J[K].transaction(re)},D=function(K,W){ne++;try{R.activeTexture(R.TEXTURE0+ne);var ye=ie[K];ye||(ye=ie[K]=R.createTexture(),R.bindTexture(R.TEXTURE_2D,ye),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.NEAREST),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.NEAREST)),R.bindTexture(R.TEXTURE_2D,ye),W(ye,ne)}finally{ne--}},Q=function(K,W,ye){var re=R.createFramebuffer();ee.push(re),R.bindFramebuffer(R.FRAMEBUFFER,re),R.activeTexture(R.TEXTURE0+W),R.bindTexture(R.TEXTURE_2D,K),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,K,0);try{ye(re)}finally{R.deleteFramebuffer(re),R.bindFramebuffer(R.FRAMEBUFFER,ee[--ee.length-1]||null)}},j=function(){Y={},J={},ie={},ne=-1,ee.length=0};var H=typeof WebGL2RenderingContext<"u"&&R instanceof WebGL2RenderingContext,Y={},J={},ie={},ne=-1,ee=[];R.canvas.addEventListener("webglcontextlost",function(K){j(),K.preventDefault()},!1),c.set(R,F={gl:R,isWebGL2:H,getExtension:ge,withProgram:te,withTexture:D,withTextureFramebuffer:Q,handleContextLoss:j})}U(F)}function h(k,U,R,F,H,Y,J,ie){J===void 0&&(J=15),ie===void 0&&(ie=null),u(k,function(ne){var ee=ne.gl,ge=ne.withProgram,me=ne.withTexture;me("copy",function(te,D){ee.texImage2D(ee.TEXTURE_2D,0,ee.RGBA,H,Y,0,ee.RGBA,ee.UNSIGNED_BYTE,U),ge("copy",o,a,function(Q){var j=Q.setUniform,K=Q.setAttribute;K("aUV",2,ee.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),j("1i","image",D),ee.bindFramebuffer(ee.FRAMEBUFFER,ie||null),ee.disable(ee.BLEND),ee.colorMask(J&8,J&4,J&2,J&1),ee.viewport(R,F,H,Y),ee.scissor(R,F,H,Y),ee.drawArrays(ee.TRIANGLES,0,3)})})})}function f(k,U,R){var F=k.width,H=k.height;u(k,function(Y){var J=Y.gl,ie=new Uint8Array(F*H*4);J.readPixels(0,0,F,H,J.RGBA,J.UNSIGNED_BYTE,ie),k.width=U,k.height=R,h(J,ie,0,0,F,H)})}var d=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(k,U,R,F,H,Y){Y===void 0&&(Y=1);var J=new Uint8Array(k*U),ie=F[2]-F[0],ne=F[3]-F[1],ee=[];s(R,function(K,W,ye,re){ee.push({x1:K,y1:W,x2:ye,y2:re,minX:Math.min(K,ye),minY:Math.min(W,re),maxX:Math.max(K,ye),maxY:Math.max(W,re)})}),ee.sort(function(K,W){return K.maxX-W.maxX});for(var ge=0;gexe.minX&&W-rexe.minY){var ce=p(K,W,xe.x1,xe.y1,xe.x2,xe.y2);ceW!=fe.y2>W&&K<(fe.x2-fe.x1)*(W-fe.y1)/(fe.y2-fe.y1)+fe.x1;xe&&(ye+=fe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function v(re,fe){var xe=36,ce=0,Pe=new Map,B=fe&&new Map,I;return re.split(",").forEach(function $(he){if(he.indexOf("+")!==-1)for(var de=+he;de--;)$(I);else{I=he;var pe=he.split(">"),Me=pe[0],we=pe[1];Me=String.fromCodePoint(ce+=parseInt(Me,xe)),we=String.fromCodePoint(ce+=parseInt(we,xe)),Pe.set(Me,we),fe&&B.set(we,Me)}}),{map:Pe,reverseMap:B}}var g,p,_;function y(){if(!g){var re=v(m.pairs,!0),fe=re.map,xe=re.reverseMap;g=fe,p=xe,_=v(m.canonical,!1).map}}function x(re){return y(),g.get(re)||null}function b(re){return y(),p.get(re)||null}function w(re){return y(),_.get(re)||null}var S=n.L,M=n.R,E=n.EN,T=n.ES,L=n.ET,P=n.AN,A=n.CS,z=n.B,V=n.S,N=n.ON,C=n.BN,O=n.NSM,k=n.AL,U=n.LRO,R=n.RLO,F=n.LRE,H=n.RLE,Y=n.PDF,J=n.LRI,ie=n.RLI,ne=n.FSI,ee=n.PDI;function ge(re,fe){for(var xe=125,ce=new Uint32Array(re.length),Pe=0;Pe0)De--;else if(je>0){for(Ve=0;!Le[Le.length-1]._isolate;)Le.pop();var tt=Le[Le.length-1]._isolInitIndex;tt!=null&&(he.set(tt,Z),he.set(Z,tt)),Le.pop(),je--}Ee=Le[Le.length-1],$[Z]=Ee._level,Ee._override&&I(Z,Ee._override)}else Ae&Y?(De===0&&(Ve>0?Ve--:!Ee._isolate&&Le.length>1&&(Le.pop(),Ee=Le[Le.length-1])),$[Z]=Ee._level):Ae&z&&($[Z]=pe.level);else $[Z]=Ee._level,Ee._override&&Ae!==C&&I(Z,Ee._override)}for(var lt=[],ft=null,ut=pe.start;ut<=pe.end;ut++){var xt=ce[ut];if(!(xt&c)){var dt=$[ut],ct=xt&s,Mn=xt===ee;ft&&dt===ft._level?(ft._end=ut,ft._endsWithIsolInit=ct):lt.push(ft={_start:ut,_end:ut,_level:dt,_startsWithPDI:Mn,_endsWithIsolInit:ct})}}for(var fn=[],yt=0;yt=0;se--)if(!(ce[se]&c)){ve=$[se];break}var _e=sn[sn.length-1],Ge=$[_e],We=pe.level;if(!(ce[_e]&s)){for(var qe=_e+1;qe<=pe.end;qe++)if(!(ce[qe]&c)){We=$[qe];break}}fn.push({_seqIndices:sn,_sosType:Math.max(ve,ae)%2?M:S,_eosType:Math.max(We,Ge)%2?M:S})}}for(var Ye=0;Ye=0;at--)if(!(ce[Te[at]]&c)){Ct=ce[Te[at]];break}I(Xn,Ct&(s|ee)?N:Ct)}}if(B.get(E))for(var fr=0;fr=-1;qn--){var Vo=qn===-1?Ze:ce[Te[qn]];if(Vo&o){Vo===k&&I(Wt,P);break}}}if(B.get(k))for(var Bi=0;Bi=0&&(Mi=ce[Te[zr]],!!(Mi&c));zr--);for(var Ho=Xt+1;Ho=0&&ce[Te[Hc]]&(L|c);Hc--)I(Te[Hc],E);for(On++;On=0&&ce[Te[Wc]]&c;Wc--)I(Te[Wc],N);for(var Xc=Wo+1;Xc=0;Yo--){var Rh=Ps[Yo].char;if(Rh===vg||Rh===b(w(qo))||x(w(Rh))===qo){qc.push([Ps[Yo].seqIndex,Ls]),Ps.length=Yo;break}}}qc.sort(function(Tn,ai){return Tn[0]-ai[0]})}for(var Ph=0;Ph=0;Ih--){var wg=Te[Ih];if(ce[wg]&gg){var Sg=ce[wg]&Xo?M:S;Sg!==bt?oi=Sg:oi=bt;break}}}if(oi){if(ce[Te[Yc]]=ce[Te[Lh]]=oi,oi!==bt){for(var jo=Yc+1;jo=0;Zo--)if(ce[Te[Zo]]&c)Eg=Zo;else{Oh=ce[Te[Zo]]&Xo?M:S;break}for(var Mg=At,Ko=dr+1;Ko=0&&f(re[$c])&l;$c--)$[$c]=pe.level}}return{levels:$,paragraphs:de};function Tg(Tn,ai){for(var An=Tn;An=$&&f(re[pe])&l;pe--)de[pe]=I.level;for(var Me=I.level,we=1/0,ue=0;ueMe&&(Me=Ce),Ce=we;ze--)for(var Le=0;Le=ze){for(var Ee=Le;Le+1=ze;)Le++;Le>Ee&&B.push([Ee+$,Le+$])}}}),B}function W(re,fe,xe,ce){var Pe=ye(re,fe,xe,ce),B=[].concat(re);return Pe.forEach(function(I,$){B[$]=(fe.levels[I]&1?Q(re[I]):null)||re[I]}),B.join("")}function ye(re,fe,xe,ce){for(var Pe=K(re,fe,xe,ce),B=[],I=0;I0?` · ${Bo(Ee)} real belegt (inkl. KV)`:""," / ",Bo(le)]}),x.length>0&&v.jsx("button",{onClick:He,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),v.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:at.length===0?v.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):at.map((de,J)=>{var Fe;const Ae=(de.size_bytes||0)/le*100,re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][J%4];return v.jsxs("div",{style:{width:`${Ae}%`},className:et("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",re),title:`${de.name} (${Bo(de.size_bytes)})`,children:[v.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[de.role?`[${de.role}] `:"",(Fe=de.name.split("/").pop())==null?void 0:Fe.replace(".gguf","")]}),v.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Bo(de.size_bytes)})]},de.name)})})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),v.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),v.jsxs("div",{ref:ge,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[v.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),v.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),v.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),v.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),v.jsx("path",{d:_e(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="roocode"||_==="roocode")&&v.jsx("path",{d:_e(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="cursor"||_==="cursor")&&v.jsx("path",{d:_e(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="opencode"||_==="opencode")&&v.jsx("path",{d:_e(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="zed"||_==="zed")&&v.jsx("path",{d:_e(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="continue"||_==="continue")&&v.jsx("path",{d:_e(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("fast")&&v.jsx("path",{d:Se(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("heavy")&&v.jsx("path",{d:Se(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("coder")&&v.jsx("path",{d:Se(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("vision")&&v.jsx("path",{d:Se(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("scout")&&v.jsx("path",{d:Se(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>te("roocode"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="roocode"?null:"roocode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Roo Code"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>te("cursor"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="cursor"?null:"cursor"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Cursor IDE"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>te("opencode"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="opencode"?null:"opencode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"OpenCode"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>te("zed"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="zed"?null:"zed"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Zed"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>te("continue"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="continue"?null:"continue"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Continue"})]}),v.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[v.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",i!=null&&i.heavy_threshold_chars?i.heavy_threshold_chars/1e3:"4","k Zeichen"]}),v.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),ZF.map(de=>{var Te;const J=["12%","31%","50%","69%","88%"],Ae=Ce(de),re=Ae?x.includes(Ae.name):!1;if(de==="agent")return null;const Fe={fast:0,heavy:1,coder:2,vision:3,scout:4}[de];return v.jsxs("div",{className:et("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",re?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Ae?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:J[Fe]},onClick:()=>ue(de),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:de}),re&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Ae?(Te=Ae.name.split("/").pop())==null?void 0:Te.replace(".gguf",""):"Keine Zuweisung"})]},de)}),_&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[_==="roocode"&&"Roo Code Setup",_==="cursor"&&"Cursor Setup",_==="opencode"&&"OpenCode Setup",_==="zed"&&"Zed Setup",_==="continue"&&"Continue Setup"]}),v.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[_==="roocode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",v.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),v.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",v.jsx("strong",{children:"OpenAI Compatible"}),"."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",v.jsx("code",{children:"settings.json"})," ein."]})]}),_==="cursor"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne Cursor Settings ➔ ",v.jsx("strong",{children:"Models"}),"."]}),v.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",v.jsx("strong",{children:"OpenAI API"})," auf."]}),v.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",v.jsx("strong",{children:"auto"}),"."]})]}),_==="opencode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die ",v.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),v.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",v.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),_==="zed"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die Zed Settings (",v.jsx("code",{children:"ctrl+,"}),")."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",v.jsx("code",{children:"language_models"})," ein."]})]}),_==="continue"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),v.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",v.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&v.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[v.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[v.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),v.jsxs("button",{onClick:()=>{var de,J,Ae,re,Fe;return xt(_==="roocode"?(de=s.tools.cline)==null?void 0:de.snippet:_==="cursor"?(J=s.tools.cursor)==null?void 0:J.snippet:_==="opencode"?(Ae=s.tools.opencode)==null?void 0:Ae.snippet:_==="zed"?(re=s.tools.zed)==null?void 0:re.snippet:(Fe=s.tools.continue)==null?void 0:Fe.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[j?v.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(J_,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:j?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:v.jsxs("code",{children:[_==="roocode"&&((qe=s.tools.cline)==null?void 0:qe.snippet),_==="cursor"&&((dt=s.tools.cursor)==null?void 0:dt.snippet),_==="opencode"&&((Dt=s.tools.opencode)==null?void 0:Dt.snippet),_==="zed"&&((Ut=s.tools.zed)==null?void 0:Ut.snippet),_==="continue"&&((pt=s.tools.continue)==null?void 0:pt.snippet)]})})]}),v.jsx("button",{onClick:()=>E(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),v.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),v.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),v.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),v.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),v.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(de=>{var re;const J=y.find(Fe=>Fe.role===de),Ae=J?x.includes(J.name):!1;return v.jsxs("div",{onClick:()=>ue(de),className:et("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",Ae?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":J?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:et("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",PP(de)),children:de}),Ae&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:J==null?void 0:J.name,children:J?(re=J.name.split("/").pop())==null?void 0:re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),v.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},de)})})]}),(a==null?void 0:a.current)&&v.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(qc,{className:"h-4.5 w-4.5 text-indigo-400"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&v.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),v.jsx("button",{onClick:()=>k(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:a.current.quant||"GGUF"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:Bo(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?v.jsxs("button",{onClick:()=>We(a.recommended.repo),className:et("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):v.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[v.jsx(Go,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&v.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",v.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&v.jsxs("div",{className:et("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[v.jsx(tE,{className:"h-3 w-3 shrink-0 mt-0.5"}),v.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[v.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",K.length," von ",y.length,")"]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>B("all"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ce==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),v.jsx("button",{onClick:()=>B("in_use"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ce==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>oe("grid"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),v.jsx("button",{onClick:()=>oe("list"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),pe==="grid"?v.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:K.length===0?v.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ce==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(de=>{const J=x.includes(de.name),Ae=o==null?void 0:o.model_list.find(Fe=>Fe.role===de.role),re=PI(de.name);return v.jsxs("div",{className:et("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",J?"border-primary/45 shadow-primary/5":de.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"flex items-start justify-between gap-3",children:v.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[v.jsx("div",{className:et("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",re.color),title:re.name,children:re.initial}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:de.name,children:de.name.split("/").pop()}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[v.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:de.quant||"GGUF"}),J&&v.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[v.jsx(ry,{className:"h-3 w-3 animate-pulse"})," Warm"]}),de.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:de.role}),de.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,de.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),v.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:v.jsx(k3,{caps:de.capabilities})})]}),v.jsxs("div",{className:"space-y-3 pt-1",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(tE,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),v.jsx("div",{className:"text-foreground font-semibold",children:Bo(de.size_bytes)})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx($8,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),v.jsx("div",{className:"text-foreground font-semibold",children:AI(de.ctx)})]})]})]}),Ae&&v.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),v.jsxs("span",{children:["Upgrade verfügbar: ",Ae.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>Ue(Ae.repo,de.role,de.quant||"Q4_K_M",de.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[v.jsx(vg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[v.jsx("button",{onClick:()=>J?Me(de.name):$e(de.name),disabled:de.incomplete&&!J,className:et("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:J?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(de.name,de.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(de),className:et("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:v.jsx(IT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})}):v.jsx("div",{className:"space-y-2",children:K.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ce==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(de=>{const J=x.includes(de.name),Ae=PI(de.name);return v.jsxs("div",{className:et("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",J?"border-primary/45":de.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[v.jsx("div",{className:et("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ae.color),title:Ae.name,children:Ae.initial}),v.jsxs("div",{className:"min-w-0 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:de.name,children:de.name.split("/").pop()}),de.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:de.role}),de.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,de.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),J&&v.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsxs("span",{children:["Größe: ",Bo(de.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",AI(de.ctx)]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:"font-mono text-[9px]",children:de.quant||"GGUF"})]})]})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[v.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:v.jsx(k3,{caps:de.capabilities})}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:()=>J?Me(de.name):$e(de.name),disabled:de.incomplete&&!J,className:et("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:J?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(de.name,de.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(de),className:et("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:v.jsx(IT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})})]}),T&&(()=>{var Fe,Te;const de=O&&O.role===T?O:null,J={};de==null||de.models.forEach(Le=>{J[Le.name]=Le});const Ae=de?de.models.map(Le=>y.find(Ke=>Ke.name===Le.name)).filter(Boolean):y,re=Le=>{Xe(T,Le),C(null)};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",T,"' konfigurieren"]}),v.jsx("button",{onClick:()=>C(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",v.jsx("strong",{className:"text-foreground",children:T}),":"]}),(de==null?void 0:de.recommended)&&v.jsxs("button",{onClick:()=>re(de.recommended),title:(Fe=J[de.recommended])==null?void 0:Fe.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[v.jsx(xh,{className:"h-3 w-3"})," Auto: ",(Te=de.recommended.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,"")]})]}),v.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[v.jsx("button",{onClick:()=>re(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:v.jsx("span",{children:"Zuweisung entfernen"})}),Ae.map(Le=>{var Cn;const Ke=J[Le.name],ut=Le.role===T,Kt=!!(Ke!=null&&Ke.recommended),un=!!Ke&&!Ke.suitable;return v.jsxs("button",{onClick:()=>re(Le.name),className:et("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",Kt?"border-primary/50 bg-primary/10":ut?"text-primary font-bold bg-primary/5 border-primary/30":un?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[v.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[v.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(Cn=Le.name.split("/").pop())==null?void 0:Cn.replace(/\.gguf$/i,""),Kt&&v.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ke?`${Ke.params_b}B · ${Le.quant} · ${Ke.reason}`:`${Bo(Le.size_bytes)} · ${Le.quant}`})]}),ut&&v.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},Le.name)})]})]})})})(),D&&v.jsx(Rfe,{model:D,onClose:()=>F(null),onChanged:w}),V&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),v.jsx("button",{onClick:()=>k(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",v.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",v.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),v.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:y.map(de=>{var Ae;const J=de.role==="hermes";return v.jsxs("button",{onClick:()=>!J&&Qe(de.name),disabled:J||de.incomplete,className:et("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",J?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":de.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Ae=de.name.split("/").pop())==null?void 0:Ae.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[de.capabilities.params_b?`${de.capabilities.params_b}B`:"?"," · ",Bo(de.size_bytes),de.role&&` · Rolle: ${de.role}`,de.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),J?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[v.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},de.name)})}),v.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[v.jsx("span",{children:"💡"}),v.jsxs("span",{children:["Für einen ",v.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),m]})}function Ife(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[m,y]=R.useState([]),[x,S]=R.useState(null),[w,_]=R.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:T}=qh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ne,te){if(_(!1),!H.trim()){S(null);return}try{const pe=await jt(`/api/fit?params_b=0&quant=${encodeURIComponent(ne)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(te)}`);S(pe)}catch{S(null)}}async function N(H){const ne=H??t;if(ne.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const te=await jt(`/api/hf/quants?repo=${encodeURIComponent(ne)}`);e(te.repo),r(te.quants);const pe=te.quants.length?te.quants.includes("Q4_K_M")?"Q4_K_M":te.quants[0]:i;te.quants.length&&s(pe),a(te.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),te.quants.length&&O(te.repo,pe,l)}catch(te){a(`Fehler: ${te}`)}}}function D(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function V(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await jt(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!w){_(!0);return}a("Download-Job wird initiiert...");try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),_(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const j=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return v.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),v.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[v.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),_(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("select",{value:i,onChange:H=>D(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),v.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[v.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),v.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${w?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:w?v.jsxs(v.Fragment,{children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):v.jsxs(v.Fragment,{children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&v.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${j}`,children:[v.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),v.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&v.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&v.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&v.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] font-medium text-amber-400",children:[v.jsx(yg,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),v.jsxs("span",{children:["Rolle ",v.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",v.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),v.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[v.jsxs("div",{className:"relative flex-1",children:[v.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&V(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(xP,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsx("button",{onClick:V,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),m.length>0&&v.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:m.map(H=>v.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[v.jsx("span",{className:"font-semibold truncate",children:H.repo}),v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[v.jsx(vg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&v.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const kfe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:xh},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:H1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:oF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:PT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:CT}};function Ofe(){const{data:t,isLoading:e,error:n}=g7(),{data:r}=qh(),{data:i}=TP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,m]=R.useState(!1);async function y(x,S,w,_){l(E=>({...E,[x]:"Starte..."}));try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:_})}),l(E=>({...E,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?v.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 (",o,")."]}):v.jsxs("div",{className:"space-y-8",children:[v.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:[v.jsxs("div",{children:["Modell-Registry geladen für ",v.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(e9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),v.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),v.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=kfe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:V1},w=S.icon,_=s.find(D=>D.role===x.role),E=i==null?void 0:i.model_list.find(D=>D.role===x.role),T=x.models.find(D=>D.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return v.jsxs("div",{className:et("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",_?"border-border/60":"border-primary/20 shadow-primary/5"),children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.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:v.jsx(w,{className:"h-5.5 w-5.5"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),v.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: ",x.role]})]})]}),_?v.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:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):v.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"})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),v.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:_?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:_.name,children:_.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[v.jsxs("span",{children:["Größe: ",zT(_.size_bytes||0)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",_.quant||"GGUF"]})]})]}):v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[v.jsxs("span",{children:["Ersteller: ",T.author]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",T.quant]})]}),v.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:v.jsx(J7,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:_?E?v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),v.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[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:[v.jsx(vg,{className:"h-3.5 w-3.5"}),a[E.repo]||"Auf neue Version aktualisieren"]})]}):v.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:[v.jsx(Go,{className:"h-4 w-4"})," Auf neuestem Stand"]}):v.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:et("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&v.jsxs("div",{className:"border-t border-border/20 pt-3",children:[v.jsxs("button",{onClick:()=>d(D=>({...D,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?v.jsx(S8,{className:"h-3 w-3"}):v.jsx(_8,{className:"h-3 w-3"}),v.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&v.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>v.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),v.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[v.jsxs("span",{children:["Quant: ",D.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:D.fit.text})]})]}),v.jsx("button",{onClick:()=>y(D.repo,x.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!a[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:a[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})}),v.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[v.jsxs("button",{onClick:()=>m(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(xP,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),v.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&v.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:v.jsx(Ife,{})})]})]})}function Lfe(){const[t,e]=R.useState("cockpit");return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),v.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>v.jsx("button",{onClick:()=>e(n),className:et("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),v.jsx(Pfe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Nfe,{}):v.jsx(Ofe,{})})]})}const Dfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function O3({line:t,loading:e}){return e||!t?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[v.jsx(yP,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[v.jsx(M8,{className:"h-3 w-3"})," ",t.detail]}):v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[v.jsx(A8,{className:"h-3 w-3"})," ",t.detail]})}function L3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return v.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[v.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),v.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:v.jsx("span",{children:e})}),v.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:[r?v.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(J_,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:et("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:v.jsx("code",{children:t.snippet})})]})}function Ufe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=GF(l.toString()),{data:f,isLoading:m}=y7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const w=c==null?void 0:c.tools[i];async function _(E,T){T&&(await navigator.clipboard.writeText(T),a(E),setTimeout(()=>a(null),1500))}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",v.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),v.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[v.jsx(D8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),v.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),v.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),v.jsxs("div",{className:"flex flex-col gap-2.5",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(sI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[v.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),v.jsx(O3,{line:f==null?void 0:f.gateway,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(sI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[v.jsx(H1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(O3,{line:f==null?void 0:f.memory,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),v.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",v.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",v.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),v.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:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(O8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:E=>x(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(I8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",v.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),v.jsx("input",{value:n,onChange:E=>S(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&v.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: ",y]}),c&&v.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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"]}),v.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([E,T])=>v.jsx("button",{onClick:()=>s(E),className:et("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),w&&v.jsxs(v.Fragment,{children:[w.note&&v.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:[v.jsx(aI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:w.note})]}),v.jsx(L3,{tool:w,fileName:Dfe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>_("model",w.snippet)})]})]}),v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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",v.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",v.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),v.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:[v.jsx(aI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(L3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>_("memory",c.memory.snippet)})]})]})]})}const jfe="modulepreload",Ffe=function(t){return"/"+t},D3={},zfe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=Ffe(c),c in D3)return;D3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":jfe,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class Bfe extends R.Component{constructor(){super(...arguments);Gs(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?v.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:[v.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),v.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const Hfe=R.lazy(()=>zfe(()=>import("./GraphView-D7Eqj5xl.js"),[]).then(t=>({default:t.GraphView}))),U3=["identity","knowledge","rules","events"],j3=new Set(["auto","agent","hermes"]),WE={identity:{label:"Identität",icon:t9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:sy,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:Y8,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:T8,bg:"bg-amber-500/10",text:"text-amber-400"}},F3={label:"Gedächtnis",icon:AT,bg:"bg-muted/10",text:"text-muted-foreground"},Vfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},z3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: + `}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(tE,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Bo(ee)," Gewichte",Ee>0?` · ${Bo(Ee)} real belegt (inkl. KV)`:""," / ",Bo(le)]}),x.length>0&&v.jsx("button",{onClick:He,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),v.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:at.length===0?v.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):at.map((de,J)=>{var Fe;const Ae=(de.size_bytes||0)/le*100,re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][J%4];return v.jsxs("div",{style:{width:`${Ae}%`},className:et("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",re),title:`${de.name} (${Bo(de.size_bytes)})`,children:[v.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[de.role?`[${de.role}] `:"",(Fe=de.name.split("/").pop())==null?void 0:Fe.replace(".gguf","")]}),v.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Bo(de.size_bytes)})]},de.name)})})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),v.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),v.jsxs("div",{ref:ge,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[v.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),v.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),v.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),v.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),v.jsx("path",{d:_e(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="roocode"||_==="roocode")&&v.jsx("path",{d:_e(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="cursor"||_==="cursor")&&v.jsx("path",{d:_e(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="opencode"||_==="opencode")&&v.jsx("path",{d:_e(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="zed"||_==="zed")&&v.jsx("path",{d:_e(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="continue"||_==="continue")&&v.jsx("path",{d:_e(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("fast")&&v.jsx("path",{d:Se(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("heavy")&&v.jsx("path",{d:Se(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("coder")&&v.jsx("path",{d:Se(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("vision")&&v.jsx("path",{d:Se(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("scout")&&v.jsx("path",{d:Se(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>te("roocode"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="roocode"?null:"roocode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Roo Code"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>te("cursor"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="cursor"?null:"cursor"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Cursor IDE"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>te("opencode"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="opencode"?null:"opencode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"OpenCode"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>te("zed"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="zed"?null:"zed"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Zed"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>te("continue"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="continue"?null:"continue"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Continue"})]}),v.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[v.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",i!=null&&i.heavy_threshold_chars?i.heavy_threshold_chars/1e3:"4","k Zeichen"]}),v.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),ZF.map(de=>{var Te;const J=["12%","31%","50%","69%","88%"],Ae=Ce(de),re=Ae?x.includes(Ae.name):!1;if(de==="agent")return null;const Fe={fast:0,heavy:1,coder:2,vision:3,scout:4}[de];return v.jsxs("div",{className:et("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",re?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Ae?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:J[Fe]},onClick:()=>ue(de),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:de}),re&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Ae?(Te=Ae.name.split("/").pop())==null?void 0:Te.replace(".gguf",""):"Keine Zuweisung"})]},de)}),_&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[_==="roocode"&&"Roo Code Setup",_==="cursor"&&"Cursor Setup",_==="opencode"&&"OpenCode Setup",_==="zed"&&"Zed Setup",_==="continue"&&"Continue Setup"]}),v.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[_==="roocode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",v.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),v.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",v.jsx("strong",{children:"OpenAI Compatible"}),"."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",v.jsx("code",{children:"settings.json"})," ein."]})]}),_==="cursor"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne Cursor Settings ➔ ",v.jsx("strong",{children:"Models"}),"."]}),v.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",v.jsx("strong",{children:"OpenAI API"})," auf."]}),v.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",v.jsx("strong",{children:"auto"}),"."]})]}),_==="opencode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die ",v.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),v.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",v.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),_==="zed"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die Zed Settings (",v.jsx("code",{children:"ctrl+,"}),")."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",v.jsx("code",{children:"language_models"})," ein."]})]}),_==="continue"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),v.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",v.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&v.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[v.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[v.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),v.jsxs("button",{onClick:()=>{var de,J,Ae,re,Fe;return xt(_==="roocode"?(de=s.tools.cline)==null?void 0:de.snippet:_==="cursor"?(J=s.tools.cursor)==null?void 0:J.snippet:_==="opencode"?(Ae=s.tools.opencode)==null?void 0:Ae.snippet:_==="zed"?(re=s.tools.zed)==null?void 0:re.snippet:(Fe=s.tools.continue)==null?void 0:Fe.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[j?v.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(J_,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:j?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:v.jsxs("code",{children:[_==="roocode"&&((qe=s.tools.cline)==null?void 0:qe.snippet),_==="cursor"&&((dt=s.tools.cursor)==null?void 0:dt.snippet),_==="opencode"&&((Dt=s.tools.opencode)==null?void 0:Dt.snippet),_==="zed"&&((Ut=s.tools.zed)==null?void 0:Ut.snippet),_==="continue"&&((pt=s.tools.continue)==null?void 0:pt.snippet)]})})]}),v.jsx("button",{onClick:()=>E(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),v.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),v.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),v.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),v.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),v.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(de=>{var re;const J=y.find(Fe=>Fe.role===de),Ae=J?x.includes(J.name):!1;return v.jsxs("div",{onClick:()=>ue(de),className:et("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",Ae?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":J?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:et("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",PP(de)),children:de}),Ae&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:J==null?void 0:J.name,children:J?(re=J.name.split("/").pop())==null?void 0:re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),v.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},de)})})]}),(a==null?void 0:a.current)&&v.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(qc,{className:"h-4.5 w-4.5 text-indigo-400"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&v.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),v.jsx("button",{onClick:()=>k(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:a.current.quant||"GGUF"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:Bo(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?v.jsxs("button",{onClick:()=>We(a.recommended.repo),className:et("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):v.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[v.jsx(Go,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&v.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",v.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&v.jsxs("div",{className:et("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[v.jsx(tE,{className:"h-3 w-3 shrink-0 mt-0.5"}),v.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[v.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",K.length," von ",y.length,")"]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>B("all"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ce==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),v.jsx("button",{onClick:()=>B("in_use"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ce==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>oe("grid"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),v.jsx("button",{onClick:()=>oe("list"),className:et("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),pe==="grid"?v.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:K.length===0?v.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ce==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(de=>{const J=x.includes(de.name),Ae=o==null?void 0:o.model_list.find(Fe=>Fe.role===de.role),re=PI(de.name);return v.jsxs("div",{className:et("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",J?"border-primary/45 shadow-primary/5":de.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"flex items-start justify-between gap-3",children:v.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[v.jsx("div",{className:et("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",re.color),title:re.name,children:re.initial}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:de.name,children:de.name.split("/").pop()}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[v.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:de.quant||"GGUF"}),J&&v.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[v.jsx(ry,{className:"h-3 w-3 animate-pulse"})," Warm"]}),de.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:de.role}),de.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,de.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),v.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:v.jsx(k3,{caps:de.capabilities})})]}),v.jsxs("div",{className:"space-y-3 pt-1",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(tE,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),v.jsx("div",{className:"text-foreground font-semibold",children:Bo(de.size_bytes)})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx($8,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),v.jsx("div",{className:"text-foreground font-semibold",children:AI(de.ctx)})]})]})]}),Ae&&v.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),v.jsxs("span",{children:["Upgrade verfügbar: ",Ae.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>Ue(Ae.repo,de.role,de.quant||"Q4_K_M",de.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[v.jsx(vg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[v.jsx("button",{onClick:()=>J?Me(de.name):$e(de.name),disabled:de.incomplete&&!J,className:et("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:J?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(de.name,de.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(de),className:et("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:v.jsx(IT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})}):v.jsx("div",{className:"space-y-2",children:K.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ce==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(de=>{const J=x.includes(de.name),Ae=PI(de.name);return v.jsxs("div",{className:et("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",J?"border-primary/45":de.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[v.jsx("div",{className:et("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ae.color),title:Ae.name,children:Ae.initial}),v.jsxs("div",{className:"min-w-0 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:de.name,children:de.name.split("/").pop()}),de.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:de.role}),de.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,de.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),J&&v.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsxs("span",{children:["Größe: ",Bo(de.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",AI(de.ctx)]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:"font-mono text-[9px]",children:de.quant||"GGUF"})]})]})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[v.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:v.jsx(k3,{caps:de.capabilities})}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:()=>J?Me(de.name):$e(de.name),disabled:de.incomplete&&!J,className:et("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:J?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(de.name,de.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(de),className:et("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:v.jsx(IT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})})]}),T&&(()=>{var Fe,Te;const de=O&&O.role===T?O:null,J={};de==null||de.models.forEach(Le=>{J[Le.name]=Le});const Ae=de?de.models.map(Le=>y.find(Ke=>Ke.name===Le.name)).filter(Boolean):y,re=Le=>{Xe(T,Le),C(null)};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",T,"' konfigurieren"]}),v.jsx("button",{onClick:()=>C(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",v.jsx("strong",{className:"text-foreground",children:T}),":"]}),(de==null?void 0:de.recommended)&&v.jsxs("button",{onClick:()=>re(de.recommended),title:(Fe=J[de.recommended])==null?void 0:Fe.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[v.jsx(xh,{className:"h-3 w-3"})," Auto: ",(Te=de.recommended.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,"")]})]}),v.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[v.jsx("button",{onClick:()=>re(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:v.jsx("span",{children:"Zuweisung entfernen"})}),Ae.map(Le=>{var Cn;const Ke=J[Le.name],ut=Le.role===T,Kt=!!(Ke!=null&&Ke.recommended),un=!!Ke&&!Ke.suitable;return v.jsxs("button",{onClick:()=>re(Le.name),className:et("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",Kt?"border-primary/50 bg-primary/10":ut?"text-primary font-bold bg-primary/5 border-primary/30":un?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[v.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[v.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(Cn=Le.name.split("/").pop())==null?void 0:Cn.replace(/\.gguf$/i,""),Kt&&v.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ke?`${Ke.params_b}B · ${Le.quant} · ${Ke.reason}`:`${Bo(Le.size_bytes)} · ${Le.quant}`})]}),ut&&v.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},Le.name)})]})]})})})(),D&&v.jsx(Rfe,{model:D,onClose:()=>F(null),onChanged:w}),V&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),v.jsx("button",{onClick:()=>k(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",v.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",v.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),v.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:y.map(de=>{var Ae;const J=de.role==="hermes";return v.jsxs("button",{onClick:()=>!J&&Qe(de.name),disabled:J||de.incomplete,className:et("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",J?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":de.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Ae=de.name.split("/").pop())==null?void 0:Ae.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[de.capabilities.params_b?`${de.capabilities.params_b}B`:"?"," · ",Bo(de.size_bytes),de.role&&` · Rolle: ${de.role}`,de.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),J?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[v.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},de.name)})}),v.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[v.jsx("span",{children:"💡"}),v.jsxs("span",{children:["Für einen ",v.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),m]})}function Ife(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[m,y]=R.useState([]),[x,S]=R.useState(null),[w,_]=R.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:T}=qh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ne,te){if(_(!1),!H.trim()){S(null);return}try{const pe=await jt(`/api/fit?params_b=0&quant=${encodeURIComponent(ne)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(te)}`);S(pe)}catch{S(null)}}async function N(H){const ne=H??t;if(ne.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const te=await jt(`/api/hf/quants?repo=${encodeURIComponent(ne)}`);e(te.repo),r(te.quants);const pe=te.quants.length?te.quants.includes("Q4_K_M")?"Q4_K_M":te.quants[0]:i;te.quants.length&&s(pe),a(te.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),te.quants.length&&O(te.repo,pe,l)}catch(te){a(`Fehler: ${te}`)}}}function D(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function V(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await jt(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!w){_(!0);return}a("Download-Job wird initiiert...");try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),_(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const j=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return v.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),v.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[v.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),_(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("select",{value:i,onChange:H=>D(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),v.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[v.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),v.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${w?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:w?v.jsxs(v.Fragment,{children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):v.jsxs(v.Fragment,{children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&v.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${j}`,children:[v.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),v.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&v.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&v.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&v.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] font-medium text-amber-400",children:[v.jsx(yg,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),v.jsxs("span",{children:["Rolle ",v.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",v.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),v.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[v.jsxs("div",{className:"relative flex-1",children:[v.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&V(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(xP,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsx("button",{onClick:V,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),m.length>0&&v.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:m.map(H=>v.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[v.jsx("span",{className:"font-semibold truncate",children:H.repo}),v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[v.jsx(vg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&v.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const kfe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:xh},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:H1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:oF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:PT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:CT}};function Ofe(){const{data:t,isLoading:e,error:n}=g7(),{data:r}=qh(),{data:i}=TP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,m]=R.useState(!1);async function y(x,S,w,_){l(E=>({...E,[x]:"Starte..."}));try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:_})}),l(E=>({...E,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?v.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 (",o,")."]}):v.jsxs("div",{className:"space-y-8",children:[v.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:[v.jsxs("div",{children:["Modell-Registry geladen für ",v.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(e9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),v.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),v.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=kfe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:V1},w=S.icon,_=s.find(D=>D.role===x.role),E=i==null?void 0:i.model_list.find(D=>D.role===x.role),T=x.models.find(D=>D.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return v.jsxs("div",{className:et("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",_?"border-border/60":"border-primary/20 shadow-primary/5"),children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.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:v.jsx(w,{className:"h-5.5 w-5.5"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),v.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: ",x.role]})]})]}),_?v.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:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):v.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"})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),v.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:_?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:_.name,children:_.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[v.jsxs("span",{children:["Größe: ",zT(_.size_bytes||0)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",_.quant||"GGUF"]})]})]}):v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[v.jsxs("span",{children:["Ersteller: ",T.author]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",T.quant]})]}),v.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:v.jsx(J7,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:_?E?v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),v.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[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:[v.jsx(vg,{className:"h-3.5 w-3.5"}),a[E.repo]||"Auf neue Version aktualisieren"]})]}):v.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:[v.jsx(Go,{className:"h-4 w-4"})," Auf neuestem Stand"]}):v.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:et("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&v.jsxs("div",{className:"border-t border-border/20 pt-3",children:[v.jsxs("button",{onClick:()=>d(D=>({...D,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?v.jsx(S8,{className:"h-3 w-3"}):v.jsx(_8,{className:"h-3 w-3"}),v.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&v.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>v.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),v.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[v.jsxs("span",{children:["Quant: ",D.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:D.fit.text})]})]}),v.jsx("button",{onClick:()=>y(D.repo,x.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!a[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:a[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})}),v.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[v.jsxs("button",{onClick:()=>m(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(xP,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),v.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&v.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:v.jsx(Ife,{})})]})]})}function Lfe(){const[t,e]=R.useState("cockpit");return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),v.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>v.jsx("button",{onClick:()=>e(n),className:et("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),v.jsx(Pfe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Nfe,{}):v.jsx(Ofe,{})})]})}const Dfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function O3({line:t,loading:e}){return e||!t?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[v.jsx(yP,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[v.jsx(M8,{className:"h-3 w-3"})," ",t.detail]}):v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[v.jsx(A8,{className:"h-3 w-3"})," ",t.detail]})}function L3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return v.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[v.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),v.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:v.jsx("span",{children:e})}),v.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:[r?v.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(J_,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:et("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:v.jsx("code",{children:t.snippet})})]})}function Ufe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=GF(l.toString()),{data:f,isLoading:m}=y7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const w=c==null?void 0:c.tools[i];async function _(E,T){T&&(await navigator.clipboard.writeText(T),a(E),setTimeout(()=>a(null),1500))}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",v.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),v.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[v.jsx(D8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),v.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),v.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),v.jsxs("div",{className:"flex flex-col gap-2.5",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(sI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[v.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),v.jsx(O3,{line:f==null?void 0:f.gateway,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(sI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[v.jsx(H1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(O3,{line:f==null?void 0:f.memory,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),v.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",v.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",v.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),v.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:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(O8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:E=>x(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(I8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",v.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),v.jsx("input",{value:n,onChange:E=>S(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&v.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: ",y]}),c&&v.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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"]}),v.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([E,T])=>v.jsx("button",{onClick:()=>s(E),className:et("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),w&&v.jsxs(v.Fragment,{children:[w.note&&v.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:[v.jsx(aI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:w.note})]}),v.jsx(L3,{tool:w,fileName:Dfe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>_("model",w.snippet)})]})]}),v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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",v.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",v.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),v.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:[v.jsx(aI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(L3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>_("memory",c.memory.snippet)})]})]})]})}const jfe="modulepreload",Ffe=function(t){return"/"+t},D3={},zfe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=Ffe(c),c in D3)return;D3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":jfe,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class Bfe extends R.Component{constructor(){super(...arguments);Gs(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?v.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:[v.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),v.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const Hfe=R.lazy(()=>zfe(()=>import("./GraphView-D1QoTnmX.js"),[]).then(t=>({default:t.GraphView}))),U3=["identity","knowledge","rules","events"],j3=new Set(["auto","agent","hermes"]),WE={identity:{label:"Identität",icon:t9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:sy,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:Y8,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:T8,bg:"bg-amber-500/10",text:"text-amber-400"}},F3={label:"Gedächtnis",icon:AT,bg:"bg-muted/10",text:"text-muted-foreground"},Vfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},z3=`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, @@ -5433,12 +5433,12 @@ void main() { * Copyright (c) 2019-2026 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */const V1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function Ia(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function G1e(t){var e;for(const[n,r]of Object.entries(V1e))Ia(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function W1e(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;Ia(t,"hips",0,l*.045,l*.03),Ia(t,"spine",o*.025+s*.07,a*.022,-l*.03),Ia(t,"chest",o*.02+s*.02,a*.018,0),Ia(t,"upperChest",o*.015,0,0),Ia(t,"neck",i*.4+d*.5,r*.4,0),Ia(t,"head",i*.6+d*.5+Math.sin(e*.6)*.015,r*.6+Math.sin(e*.27)*.025,Math.sin(e*.5)*.02);const f=Math.sin(e*.8)*.035;Ia(t,"leftUpperArm",0,0,1.18+f+l*.04),Ia(t,"rightUpperArm",0,0,-1.18-f+l*.04),Ia(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),Ia(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const $1e=["happy","angry","sad","surprised","relaxed"],X1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function q1e({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0}),l=R.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return R.useEffect(()=>{let c=!1,d=null;const f=new Zbe;return f.register(m=>new x1e(m)),f.load(t,m=>{var x;if(c)return;const y=m.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}Xc.removeUnnecessaryVertices(m.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&Xc.rotateVRM0(y),y.scene.rotation.y=Math.PI,G1e(y),d=y,s(y)},void 0,m=>{console.error("VRM-Load-Fehler:",m),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&Xc.deepDispose(d.scene),s(null)}},[t,r]),xG((c,d)=>{var x;if(!i)return;const f=((x=e.current)==null?void 0:x.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const m=l.current;m.t+=d,m.t>m.next&&(m.tYaw=(Math.random()-.5)*.5,m.tPitch=(Math.random()-.5)*.24,m.t=0,m.next=2.5+Math.random()*3.5),m.yaw+=(m.tYaw-m.yaw)*Math.min(1,d*1.5),m.pitch+=(m.tPitch-m.pitch)*Math.min(1,d*1.5),m.lean+=(Math.min(1,f*1.6)-m.lean)*Math.min(1,d*3),W1e(i,c.clock.elapsedTime,f,m.yaw,m.pitch,m.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const w=X1e[n.current];for(const T of $1e){const C=w===T?.75:0,O=o.current[T]??0,N=O+(C-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const _=a.current;_.t+=d,_.active<=0&&_.t>_.next&&(_.active=.16,_.t=0,_.next=3+Math.random()*4);let E=0;if(_.active>0){_.active-=d;const T=1-_.active/.16;E=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,E))}i.update(d)}),i?v.jsx("primitive",{object:i.scene}):null}function K1e({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return v.jsxs("div",{className:"relative h-full w-full",children:[v.jsxs(Bbe,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[v.jsx("ambientLight",{intensity:.85}),v.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),v.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),v.jsx(q1e,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(Ybe,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&v.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const Y1e=["elevenlabs","edge"],Z1e={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function Q1e(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=R.useState(!1),[l,c]=R.useState(()=>{const _=localStorage.getItem("mc_voice_volume");if(_===null||_==="")return .6;const E=Number(_);return Number.isNaN(E)?.6:E}),d=R.useRef(null),f=_=>{c(_),localStorage.setItem("mc_voice_volume",String(_)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:_}))},m=(_,E)=>{r(_),s(E),localStorage.setItem("mc_voice_engine",_),localStorage.setItem("mc_voice_voice",E)};R.useEffect(()=>{fetch("/api/voice/voices").then(_=>_.ok?_.json():Promise.reject()).then(_=>{const E=_.voices||[];if(e(E),!i){const T=E.find(C=>C.engine===n);T&&m(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var _;if(!o){a(!0);try{const E=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!E.ok)throw new Error(`TTS ${E.status}`);const T=URL.createObjectURL(await E.blob());(_=d.current)==null||_.pause();const C=new Audio(T);C.volume=Math.min(1,l),d.current=C,C.onended=()=>URL.revokeObjectURL(T),await C.play()}catch(E){console.error("Probe fehlgeschlagen:",E)}finally{a(!1)}}},x=_=>{const E=t.find(T=>T.engine===_);m(_,(E==null?void 0:E.id)||"")},S=t.filter(_=>_.engine===n),w=n==="elevenlabs"&&S.length===0;return v.jsxs("div",{className:"text-sm",children:[v.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[v.jsx(Vm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?v.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Y1e.map(_=>v.jsx("button",{onClick:()=>x(_),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===_?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:Z1e[_]},_))}),v.jsx("select",{value:i,onChange:_=>m(n,_.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:S.map(_=>v.jsx("option",{value:_.id,children:_.label},_.id))}),v.jsxs("button",{onClick:y,disabled:o||w,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?v.jsx(yP,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(kT,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),v.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[v.jsx(kT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),v.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:_=>f(Number(_.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),v.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function J1e(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var m;const f=new Blob(i.current,{type:c});(m=s.current)==null||m.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class aN{constructor(){Gs(this,"ctx");Gs(this,"analyser");Gs(this,"gain");Gs(this,"queue",[]);Gs(this,"playing",!1);Gs(this,"raf",0);Gs(this,"freq");Gs(this,"level",{current:0});Gs(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.gain=this.ctx.createGain(),this.gain.gain.value=aN.readVolume(),this.analyser.connect(this.gain),this.gain.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount)),window.addEventListener("mc-voice-volume",n=>{const r=Number(n.detail);Number.isNaN(r)||(this.gain.gain.value=Math.max(0,Math.min(1.5,r)))})}static readVolume(){const e=localStorage.getItem("mc_voice_volume");if(e===null||e==="")return .6;const n=Number(e);return Number.isNaN(n)?.6:Math.max(0,Math.min(1.5,n))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s~|`]+/g," ").replace(/^\s*[-•·]\s+/gm," ").replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu,"").replace(/\s+/g," ").trim()}function Nj(){let t=localStorage.getItem("mc_voice_session");return t||(t="voice-"+Math.random().toString(36).slice(2)+Date.now().toString(36),localStorage.setItem("mc_voice_session",t)),t}function iSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function sSe(t){const e=[],n=/[^.!?…]+[.!?…]+(\s|$)/g;let r=0,i;for(;i=n.exec(t);)e.push(i[0].trim()),r=n.lastIndex;return{sentences:e,rest:t.slice(r)}}function oSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),o=R.useRef({current:0}),a=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(Nj()),d=R.useCallback(()=>{if(!l.current){const E=new aN;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ne,te,pe,oe;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const ce=new FormData;ce.append("audio",E,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:ce});if(!B.ok)throw new Error(`STT ${B.status}`);C=((ne=(await B.json()).text)==null?void 0:ne.trim())||""}catch(ce){e("error"),s(`Spracherkennung fehlgeschlagen: ${ce.message}`);return}if(!C){e("idle");return}r(ce=>[...ce,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=iSe();let D="",F="";r(ce=>[...ce,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,j=!1;const H=ce=>{const B=rSe(ce);B&&(V=V.then(async()=>{try{const K=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!K.ok)throw new Error(`TTS ${K.status}`);await T.enqueue(await K.arrayBuffer()),k=!0}catch(K){j=!0,console.error("TTS-Fehler:",K)}}))};try{const ce=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:nSe})});if(!ce.ok||!ce.body)throw new Error(`Agent ${ce.status}`);const B=ce.body.getReader(),K=new TextDecoder;let q="";for(;;){const{done:$,value:Z}=await B.read();if($)break;q+=K.decode(Z,{stream:!0});const ge=q.split(` + */const V1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function Ia(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function G1e(t){var e;for(const[n,r]of Object.entries(V1e))Ia(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function W1e(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;Ia(t,"hips",0,l*.045,l*.03),Ia(t,"spine",o*.025+s*.07,a*.022,-l*.03),Ia(t,"chest",o*.02+s*.02,a*.018,0),Ia(t,"upperChest",o*.015,0,0),Ia(t,"neck",i*.4+d*.5,r*.4,0),Ia(t,"head",i*.6+d*.5+Math.sin(e*.6)*.015,r*.6+Math.sin(e*.27)*.025,Math.sin(e*.5)*.02);const f=Math.sin(e*.8)*.035;Ia(t,"leftUpperArm",0,0,1.18+f+l*.04),Ia(t,"rightUpperArm",0,0,-1.18-f+l*.04),Ia(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),Ia(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const $1e=["happy","angry","sad","surprised","relaxed"],X1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function q1e({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0}),l=R.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return R.useEffect(()=>{let c=!1,d=null;const f=new Zbe;return f.register(m=>new x1e(m)),f.load(t,m=>{var x;if(c)return;const y=m.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}Xc.removeUnnecessaryVertices(m.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&Xc.rotateVRM0(y),y.scene.rotation.y=Math.PI,G1e(y),d=y,s(y)},void 0,m=>{console.error("VRM-Load-Fehler:",m),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&Xc.deepDispose(d.scene),s(null)}},[t,r]),xG((c,d)=>{var x;if(!i)return;const f=((x=e.current)==null?void 0:x.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const m=l.current;m.t+=d,m.t>m.next&&(m.tYaw=(Math.random()-.5)*.5,m.tPitch=(Math.random()-.5)*.24,m.t=0,m.next=2.5+Math.random()*3.5),m.yaw+=(m.tYaw-m.yaw)*Math.min(1,d*1.5),m.pitch+=(m.tPitch-m.pitch)*Math.min(1,d*1.5),m.lean+=(Math.min(1,f*1.6)-m.lean)*Math.min(1,d*3),W1e(i,c.clock.elapsedTime,f,m.yaw,m.pitch,m.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const w=X1e[n.current];for(const T of $1e){const C=w===T?.75:0,O=o.current[T]??0,N=O+(C-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const _=a.current;_.t+=d,_.active<=0&&_.t>_.next&&(_.active=.16,_.t=0,_.next=3+Math.random()*4);let E=0;if(_.active>0){_.active-=d;const T=1-_.active/.16;E=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,E))}i.update(d)}),i?v.jsx("primitive",{object:i.scene}):null}function K1e({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return v.jsxs("div",{className:"relative h-full w-full",children:[v.jsxs(Bbe,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[v.jsx("ambientLight",{intensity:.85}),v.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),v.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),v.jsx(q1e,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(Ybe,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&v.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const Y1e=["elevenlabs","edge"],Z1e={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function Q1e(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=R.useState(!1),[l,c]=R.useState(()=>{const _=localStorage.getItem("mc_voice_volume");if(_===null||_==="")return .6;const E=Number(_);return Number.isNaN(E)?.6:E}),d=R.useRef(null),f=_=>{c(_),localStorage.setItem("mc_voice_volume",String(_)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:_}))},m=(_,E)=>{r(_),s(E),localStorage.setItem("mc_voice_engine",_),localStorage.setItem("mc_voice_voice",E)};R.useEffect(()=>{fetch("/api/voice/voices").then(_=>_.ok?_.json():Promise.reject()).then(_=>{const E=_.voices||[];if(e(E),!i){const T=E.find(C=>C.engine===n);T&&m(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var _;if(!o){a(!0);try{const E=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!E.ok)throw new Error(`TTS ${E.status}`);const T=URL.createObjectURL(await E.blob());(_=d.current)==null||_.pause();const C=new Audio(T);C.volume=Math.min(1,l),d.current=C,C.onended=()=>URL.revokeObjectURL(T),await C.play()}catch(E){console.error("Probe fehlgeschlagen:",E)}finally{a(!1)}}},x=_=>{const E=t.find(T=>T.engine===_);m(_,(E==null?void 0:E.id)||"")},S=t.filter(_=>_.engine===n),w=n==="elevenlabs"&&S.length===0;return v.jsxs("div",{className:"text-sm",children:[v.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[v.jsx(Vm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?v.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Y1e.map(_=>v.jsx("button",{onClick:()=>x(_),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===_?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:Z1e[_]},_))}),v.jsx("select",{value:i,onChange:_=>m(n,_.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:S.map(_=>v.jsx("option",{value:_.id,children:_.label},_.id))}),v.jsxs("button",{onClick:y,disabled:o||w,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?v.jsx(yP,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(kT,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),v.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[v.jsx(kT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),v.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:_=>f(Number(_.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),v.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function J1e(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var m;const f=new Blob(i.current,{type:c});(m=s.current)==null||m.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class aN{constructor(){Gs(this,"ctx");Gs(this,"analyser");Gs(this,"gain");Gs(this,"queue",[]);Gs(this,"playing",!1);Gs(this,"raf",0);Gs(this,"freq");Gs(this,"level",{current:0});Gs(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.gain=this.ctx.createGain(),this.gain.gain.value=aN.readVolume(),this.analyser.connect(this.gain),this.gain.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount)),window.addEventListener("mc-voice-volume",n=>{const r=Number(n.detail);Number.isNaN(r)||(this.gain.gain.value=Math.max(0,Math.min(1.5,r)))})}static readVolume(){const e=localStorage.getItem("mc_voice_volume");if(e===null||e==="")return .6;const n=Number(e);return Number.isNaN(n)?.6:Math.max(0,Math.min(1.5,n))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s~|`]+/g," ").replace(/^\s*[-•·]\s+/gm," ").replace(/\s*&\s*/g," und ").replace(/(\d)\s*%/g,"$1 Prozent").replace(/%/g," Prozent ").replace(/(\d)\s*°\s*C?/g,"$1 Grad").replace(/°/g," Grad ").replace(/\s*=\s*/g," gleich ").replace(/\s*\/\s*/g," ").replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu,"").replace(/\s+/g," ").trim()}function Nj(){let t=localStorage.getItem("mc_voice_session");return t||(t="voice-"+Math.random().toString(36).slice(2)+Date.now().toString(36),localStorage.setItem("mc_voice_session",t)),t}function iSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function sSe(t){const e=[],n=/[^.!?…]+[.!?…]+(\s|$)/g;let r=0,i;for(;i=n.exec(t);)e.push(i[0].trim()),r=n.lastIndex;return{sentences:e,rest:t.slice(r)}}function oSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),o=R.useRef({current:0}),a=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(Nj()),d=R.useCallback(()=>{if(!l.current){const E=new aN;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ne,te,pe,oe;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const ce=new FormData;ce.append("audio",E,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:ce});if(!B.ok)throw new Error(`STT ${B.status}`);C=((ne=(await B.json()).text)==null?void 0:ne.trim())||""}catch(ce){e("error"),s(`Spracherkennung fehlgeschlagen: ${ce.message}`);return}if(!C){e("idle");return}r(ce=>[...ce,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=iSe();let D="",F="";r(ce=>[...ce,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,j=!1;const H=ce=>{const B=rSe(ce);B&&(V=V.then(async()=>{try{const K=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!K.ok)throw new Error(`TTS ${K.status}`);await T.enqueue(await K.arrayBuffer()),k=!0}catch(K){j=!0,console.error("TTS-Fehler:",K)}}))};try{const ce=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:nSe})});if(!ce.ok||!ce.body)throw new Error(`Agent ${ce.status}`);const B=ce.body.getReader(),K=new TextDecoder;let q="";for(;;){const{done:$,value:Z}=await B.read();if($)break;q+=K.decode(Z,{stream:!0});const ge=q.split(` `);q=ge.pop()||"";for(const ae of ge){const fe=ae.split(` -`).find(Xe=>Xe.startsWith("data:"));if(!fe)continue;const _e=fe.slice(5).trim();if(_e==="[DONE]")continue;let Se;try{Se=JSON.parse(_e)}catch{continue}if(Se.error)throw new Error(Se.error);const $e=((oe=(pe=(te=Se.choices)==null?void 0:te[0])==null?void 0:pe.delta)==null?void 0:oe.content)||"";if(!$e)continue;D+=$e,F+=$e,a.current=tSe(D),r(Xe=>{const ue=Xe.slice();return ue[ue.length-1]={role:"assistant",text:D},ue});const{sentences:Me,rest:He}=sSe(F);F=He,Me.forEach(H)}}if(F.trim()&&H(F),await V,!D.trim()){e("idle");return}k||(e("error"),s(j?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(ce){e("error"),s(`Agent-Antwort fehlgeschlagen: ${ce.message}`)}},[d]),{recording:m,start:y,stop:x}=J1e(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{x()},[x]),_=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=Nj()},[]);return R.useEffect(()=>{!m&&t==="listening"&&e("transcribing")},[m,t]),{status:t,messages:n,error:i,recording:m,audioLevel:o,emotion:a,pressStart:S,pressEnd:w,reset:_}}const aSe="/avatar.vrm";function lSe(){return v.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>v.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const cSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function uSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=oSe(),c=R.useRef(!1),d=R.useRef(null);R.useEffect(()=>{var y;(y=d.current)==null||y.scrollIntoView({behavior:"smooth",block:"end"})},[e]),R.useEffect(()=>{const y=w=>w instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(w.tagName),x=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,o())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[o,a]);const f=t==="speaking",m=t==="transcribing"||t==="thinking";return v.jsxs("div",{className:"flex h-full gap-5",children:[v.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[v.jsx("div",{className:"flex-1 min-h-0",children:v.jsx(K1e,{url:aSe,audioLevel:i,emotion:s})}),v.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[v.jsxs("div",{className:et("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[m&&v.jsx(yP,{className:"h-4 w-4 animate-spin"}),f&&v.jsx(kT,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:n||cSe[t]})]}),v.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:et("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:v.jsx(aF,{className:et("h-8 w-8",r?"text-red-400":"text-primary")})}),v.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",v.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),v.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[v.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:v.jsx(Q1e,{})}),v.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[v.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),v.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(K8,{className:"h-3.5 w-3.5"})})]}),v.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&v.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((y,x)=>v.jsxs("div",{className:et("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[v.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),v.jsx("div",{className:et("max-w-[88%] whitespace-pre-wrap break-words rounded-2xl px-3 py-2 text-sm leading-relaxed",y.role==="user"?"rounded-br-sm bg-primary/15 text-foreground":"rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90"),children:y.text||v.jsx(lSe,{})})]},x)),v.jsx("div",{ref:d})]})]})]})]})}const Ij=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function dSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function mo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return v.jsxs("section",{id:t,className:et("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(e,{className:et("h-5 w-5 shrink-0",n)}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&v.jsx("span",{className:et("text-[9px] font-mono",n),children:i})]})]}),v.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Vf({children:t}){return v.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[v.jsx(Vm,{className:"h-3 w-3"})," Bei dir konkret"]}),v.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function pn({children:t}){return v.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Or({href:t,name:e,note:n}){return v.jsxs("li",{className:"leading-relaxed",children:[v.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,v.jsx(y8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function fSe(){const[t,e]=R.useState(!1);return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[v.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:v.jsx(AT,{className:"h-6 w-6 text-primary"})}),v.jsxs("div",{className:"space-y-1",children:[v.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:"Die AI-Bibel"}),v.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",v.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",v.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),v.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:v.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:v.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v.jsx(CT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?Ij:Ij.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>dSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),v.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),v.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[v.jsxs(mo,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[v.jsxs("p",{children:["Ein LLM ist im Kern ein ",v.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),v.jsxs("li",{children:[v.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",v.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),v.jsxs(mo,{id:"moe",icon:V1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",v.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",v.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(pn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),v.jsxs(Vf,{children:["VRAM/RAM ist die harte Grenze — ",v.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",v.jsx(pn,{children:"Q4_K_M"}),"/",v.jsx(pn,{children:"Q6_K"}),"."]})]}),v.jsxs(mo,{id:"lokal",icon:bP,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"llama-swap"})," — Proxy, der ",v.jsx("em",{children:"mehrere"})," Modelle hinter ",v.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(pn,{children:"CUDA"})," NVIDIA · ",v.jsx(pn,{children:"ROCm"})," AMD · ",v.jsx(pn,{children:"Vulkan"})," herstellerübergreifend · ",v.jsx(pn,{children:"Metal"})," Apple"]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",v.jsx(pn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",v.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),v.jsxs(Vf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",v.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",v.jsx(pn,{children:"Vulkan/RADV"})," das offizielle ",v.jsx(pn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",v.jsx(pn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",v.jsx(pn,{children:"coder"})," nutzt Spec-Decoding."]})]}),v.jsxs(mo,{id:"modelle",icon:TT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Llama"})," (Meta), ",v.jsx("strong",{children:"Gemma"})," (Google), ",v.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"DeepSeek"}),", ",v.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Frontier (Cloud-API):"})}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx("strong",{children:"Claude"})," (Anthropic), ",v.jsx("strong",{children:"GPT"})," (OpenAI), ",v.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),v.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),v.jsxs(Vf,{children:["Dein Line-up via llama-swap: ",v.jsx(pn,{children:"fast"})," (Alltag/Vision/MoE) · ",v.jsx(pn,{children:"heavy"})," (schwere Logik) ·",v.jsx(pn,{children:"coder"})," · ",v.jsx(pn,{children:"scout"})," · ",v.jsx(pn,{children:"vision"})," · ",v.jsx(pn,{children:"embed"})," (fürs Gedächtnis) ·",v.jsx(pn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",v.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),v.jsxs(mo,{id:"gateway",icon:W8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[v.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",v.jsx("strong",{children:"OpenAI-Format"})," (",v.jsx(pn,{children:"/v1/chat/completions"}),"). Ein",v.jsx("strong",{children:" Gateway"})," davor gibt dir ",v.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",v.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),v.jsxs("p",{children:["Die ",v.jsx(pn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),v.jsxs(Vf,{children:["Dein Gateway: ",v.jsx(pn,{children:"http://192.168.178.151:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",v.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),v.jsxs(mo,{id:"mcp",icon:RT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[v.jsxs("p",{children:["Das ",v.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",v.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),v.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),v.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[v.jsx(B8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),v.jsxs("span",{children:[v.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),v.jsxs(mo,{id:"skills",icon:q8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",v.jsx(pn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),v.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- +`).find(Xe=>Xe.startsWith("data:"));if(!fe)continue;const _e=fe.slice(5).trim();if(_e==="[DONE]")continue;let Se;try{Se=JSON.parse(_e)}catch{continue}if(Se.error)throw new Error(Se.error);const $e=((oe=(pe=(te=Se.choices)==null?void 0:te[0])==null?void 0:pe.delta)==null?void 0:oe.content)||"";if(!$e)continue;D+=$e,F+=$e,a.current=tSe(D),r(Xe=>{const ue=Xe.slice();return ue[ue.length-1]={role:"assistant",text:D},ue});const{sentences:Me,rest:He}=sSe(F);F=He,Me.forEach(H)}}if(F.trim()&&H(F),await V,!D.trim()){e("idle");return}k||(e("error"),s(j?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(ce){e("error"),s(`Agent-Antwort fehlgeschlagen: ${ce.message}`)}},[d]),{recording:m,start:y,stop:x}=J1e(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{x()},[x]),_=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=Nj()},[]);return R.useEffect(()=>{!m&&t==="listening"&&e("transcribing")},[m,t]),{status:t,messages:n,error:i,recording:m,audioLevel:o,emotion:a,pressStart:S,pressEnd:w,reset:_}}const aSe="/avatar.vrm";function lSe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?v.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):v.jsx("span",{children:e},n)})}function cSe(){return v.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>v.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const uSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function dSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=oSe(),c=R.useRef(!1),d=R.useRef(null);R.useEffect(()=>{var y;(y=d.current)==null||y.scrollIntoView({behavior:"smooth",block:"end"})},[e]),R.useEffect(()=>{const y=w=>w instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(w.tagName),x=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,o())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[o,a]);const f=t==="speaking",m=t==="transcribing"||t==="thinking";return v.jsxs("div",{className:"flex h-full gap-5",children:[v.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[v.jsx("div",{className:"flex-1 min-h-0",children:v.jsx(K1e,{url:aSe,audioLevel:i,emotion:s})}),v.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[v.jsxs("div",{className:et("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[m&&v.jsx(yP,{className:"h-4 w-4 animate-spin"}),f&&v.jsx(kT,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:n||uSe[t]})]}),v.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:et("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:v.jsx(aF,{className:et("h-8 w-8",r?"text-red-400":"text-primary")})}),v.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",v.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),v.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[v.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:v.jsx(Q1e,{})}),v.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[v.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),v.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(K8,{className:"h-3.5 w-3.5"})})]}),v.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&v.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((y,x)=>v.jsxs("div",{className:et("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[v.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),v.jsx("div",{className:et("max-w-[88%] whitespace-pre-wrap break-words rounded-2xl px-3 py-2 text-sm leading-relaxed",y.role==="user"?"rounded-br-sm bg-primary/15 text-foreground":"rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90"),children:y.text?lSe(y.text):v.jsx(cSe,{})})]},x)),v.jsx("div",{ref:d})]})]})]})]})}const Ij=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function fSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function mo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return v.jsxs("section",{id:t,className:et("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(e,{className:et("h-5 w-5 shrink-0",n)}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&v.jsx("span",{className:et("text-[9px] font-mono",n),children:i})]})]}),v.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Vf({children:t}){return v.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[v.jsx(Vm,{className:"h-3 w-3"})," Bei dir konkret"]}),v.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function pn({children:t}){return v.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Or({href:t,name:e,note:n}){return v.jsxs("li",{className:"leading-relaxed",children:[v.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,v.jsx(y8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function hSe(){const[t,e]=R.useState(!1);return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[v.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:v.jsx(AT,{className:"h-6 w-6 text-primary"})}),v.jsxs("div",{className:"space-y-1",children:[v.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:"Die AI-Bibel"}),v.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",v.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",v.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),v.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:v.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:v.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v.jsx(CT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?Ij:Ij.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>fSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),v.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),v.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[v.jsxs(mo,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[v.jsxs("p",{children:["Ein LLM ist im Kern ein ",v.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),v.jsxs("li",{children:[v.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",v.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),v.jsxs(mo,{id:"moe",icon:V1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",v.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",v.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(pn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),v.jsxs(Vf,{children:["VRAM/RAM ist die harte Grenze — ",v.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",v.jsx(pn,{children:"Q4_K_M"}),"/",v.jsx(pn,{children:"Q6_K"}),"."]})]}),v.jsxs(mo,{id:"lokal",icon:bP,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"llama-swap"})," — Proxy, der ",v.jsx("em",{children:"mehrere"})," Modelle hinter ",v.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(pn,{children:"CUDA"})," NVIDIA · ",v.jsx(pn,{children:"ROCm"})," AMD · ",v.jsx(pn,{children:"Vulkan"})," herstellerübergreifend · ",v.jsx(pn,{children:"Metal"})," Apple"]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",v.jsx(pn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",v.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),v.jsxs(Vf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",v.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",v.jsx(pn,{children:"Vulkan/RADV"})," das offizielle ",v.jsx(pn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",v.jsx(pn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",v.jsx(pn,{children:"coder"})," nutzt Spec-Decoding."]})]}),v.jsxs(mo,{id:"modelle",icon:TT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Llama"})," (Meta), ",v.jsx("strong",{children:"Gemma"})," (Google), ",v.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"DeepSeek"}),", ",v.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Frontier (Cloud-API):"})}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx("strong",{children:"Claude"})," (Anthropic), ",v.jsx("strong",{children:"GPT"})," (OpenAI), ",v.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),v.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),v.jsxs(Vf,{children:["Dein Line-up via llama-swap: ",v.jsx(pn,{children:"fast"})," (Alltag/Vision/MoE) · ",v.jsx(pn,{children:"heavy"})," (schwere Logik) ·",v.jsx(pn,{children:"coder"})," · ",v.jsx(pn,{children:"scout"})," · ",v.jsx(pn,{children:"vision"})," · ",v.jsx(pn,{children:"embed"})," (fürs Gedächtnis) ·",v.jsx(pn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",v.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),v.jsxs(mo,{id:"gateway",icon:W8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[v.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",v.jsx("strong",{children:"OpenAI-Format"})," (",v.jsx(pn,{children:"/v1/chat/completions"}),"). Ein",v.jsx("strong",{children:" Gateway"})," davor gibt dir ",v.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",v.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),v.jsxs("p",{children:["Die ",v.jsx(pn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),v.jsxs(Vf,{children:["Dein Gateway: ",v.jsx(pn,{children:"http://192.168.178.151:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",v.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),v.jsxs(mo,{id:"mcp",icon:RT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[v.jsxs("p",{children:["Das ",v.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",v.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),v.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),v.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[v.jsx(B8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),v.jsxs("span",{children:[v.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),v.jsxs(mo,{id:"skills",icon:q8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",v.jsx(pn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),v.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- name: tdd-pro description: Treibt Entwicklung mit strikter TDD-Praxis --- # Instructions -...`}),v.jsxs("p",{children:["Suchen & installieren über die ",v.jsx("strong",{children:"skills.sh"}),"-Registry: ",v.jsx(pn,{children:"npx skills find"})," /",v.jsx(pn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),v.jsxs(mo,{id:"memory",icon:R8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["LLMs sind ",v.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",v.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:["extrahiert Fakten ",v.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),v.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),v.jsxs("li",{children:[v.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",v.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),v.jsxs(Vf,{children:["Dein Gedächtnis (Tab ",v.jsx("strong",{children:"Gedächtnis"}),") ist ",v.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",v.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",v.jsx(pn,{children:"Identität"})," · ",v.jsx(pn,{children:"Wissen"})," · ",v.jsx(pn,{children:"Regeln"})," · ",v.jsx(pn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",v.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",v.jsx("br",{}),v.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),v.jsxs(mo,{id:"agents",icon:qc,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",v.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",v.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),v.jsxs(Vf,{children:[v.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",v.jsx(pn,{children:"fast"}),"). Reden tust du mit ihm im",v.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",v.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",v.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",v.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),v.jsxs(mo,{id:"ide",icon:oF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[v.jsxs("p",{children:["Jede ",v.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Cline"})," & ",v.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Continue"}),", ",v.jsx("strong",{children:"aider"})," (CLI), ",v.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),v.jsxs(Vf,{children:["Tipp den Kram nicht ab: der ",v.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",v.jsx(pn,{children:"…:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", Key beliebig."]})]}),v.jsx(mo,{id:"tricks",icon:F8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:v.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>v.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[v.jsx(xh,{className:"h-3 w-3 text-amber-400"})," ",n]}),v.jsx("p",{className:"text-[11px]",children:r})]},n))})}),v.jsx(mo,{id:"wartung",icon:sy,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(k8,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(ew,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",v.jsx(pn,{children:"restore.sh"})," (Doku in ",v.jsx(pn,{children:"docs/BACKUP.md"}),")."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",v.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",v.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),v.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),v.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(CT,{className:"h-5 w-5 text-primary"}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),v.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),v.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(TT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),v.jsx(Or,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),v.jsx(Or,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),v.jsx(Or,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),v.jsx(Or,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),v.jsx(Or,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(RT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),v.jsx(Or,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),v.jsx(Or,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),v.jsx(Or,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),v.jsx(Or,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),v.jsx(Or,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),v.jsx(Or,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),v.jsx(Or,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),v.jsx(Or,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(AT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),v.jsx(Or,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),v.jsx(Or,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),v.jsx(Or,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),v.jsx(Or,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),v.jsx(mo,{id:"troubleshooting",icon:j8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:v.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",v.jsx(pn,{children:":9001"}),")? Backend-Status in der ",v.jsx("strong",{children:"Zentrale"})," prüfen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",v.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",v.jsx(pn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",v.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",v.jsx(pn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),v.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function hSe({title:t,hint:e}){return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-xl font-semibold",children:t}),v.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),v.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[v.jsx(P8,{className:"h-8 w-8 text-muted-foreground"}),v.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const kj=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function L_({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return v.jsxs("div",{className:et("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[v.jsx(t,{className:et("h-4 w-4 shrink-0",e)}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:n}),v.jsx("div",{className:et("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),v.jsx("button",{onClick:a,disabled:!i||s,className:et("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function pSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return v.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[v.jsx("span",{className:et("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),v.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&v.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),v.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:v.jsx(B0,{className:et("h-3.5 w-3.5",r&&"animate-spin")})}),v.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:v.jsx(N8,{className:"h-3.5 w-3.5"})})]})}function dT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function mSe({open:t,onClose:e,defaultTab:n="maintenance"}){var Be;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,m]=R.useState(!1),[y,x]=R.useState(null),[S,w]=R.useState({}),[_,E]=R.useState("maintenance"),[T,C]=R.useState(!1),[O,N]=R.useState(""),[D,F]=R.useState(!1),[V,k]=R.useState(null),[j,H]=R.useState([]),[ne,te]=R.useState(!1),[pe,oe]=R.useState(null);function ce(le,Ce,lt){oe({type:"alert",title:le,message:Ce,onConfirm:()=>{oe(null),lt&<()}})}function B(le,Ce,lt){oe({type:"confirm",title:le,message:Ce,onConfirm:()=>{oe(null),lt()},onCancel:()=>oe(null)})}function K(le){return le?new Date(le*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,$]=R.useState(""),[Z,ge]=R.useState(""),[ae,fe]=R.useState(!1),[_e,Se]=R.useState(!1);R.useEffect(()=>{t&&($(localStorage.getItem("mc_sudo_password")||""),ge(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&E(n)},[t,n]);const $e=R.useRef(null);function Me(){jt("/api/maintenance/updates").then(i).catch(le=>console.error("Error loading updates",le))}function He(){jt("/api/jobs").then(le=>o(le.jobs||[])).catch(le=>console.error("Error loading jobs",le))}function Xe(){jt("/api/system/services").then(k).catch(()=>{})}function ue(){jt("/api/system/backups").then(le=>H(le.backups||[])).catch(()=>{})}function Q(le){m(!0),x(null),jt(`/api/maintenance/logs?service=${le}&lines=150`).then(Ce=>{Ce.ok?d(Ce.text):(d(`Fehler beim Laden der Logs: ${Ce.err||"Unbekannter Fehler"}`),(Ce.status==="incorrect_password"||Ce.status==="password_required")&&x(Ce.status))}).catch(Ce=>d(`Fehler: ${Ce.message}`)).finally(()=>{m(!1),setTimeout(()=>{$e.current&&($e.current.scrollTop=$e.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;Me(),He(),Xe(),ue();const le=setInterval(()=>{He(),Me(),Xe()},3e3);return()=>clearInterval(le)},[t]),R.useEffect(()=>{!t||_!=="logs"||Q(a)},[t,_,a]);async function Ge(){try{await jt("/api/maintenance/os-update",{method:"POST"}),He(),E("maintenance")}catch(le){ce("Fehler",`Fehler beim Starten des OS-Updates: ${le.message}`)}}async function Ue(){try{await jt("/api/maintenance/engine-update",{method:"POST"}),He(),E("maintenance")}catch(le){ce("Fehler",`Fehler beim Engine-Update: ${le.message}`)}}function We(){B("Hermes-Agent aktualisieren","Zieht die neuesten Änderungen aus git, installiert Abhängigkeiten neu und startet den Hermes-Gateway neu (vorher automatisches Backup). Fortschritt unter Hintergrund-Aufgaben.",async()=>{te(!0);try{await jt("/api/maintenance/hermes-update",{method:"POST"}),He()}catch(le){ce("Fehler",`Hermes-Update fehlgeschlagen: ${le.message}`)}finally{te(!1)}})}async function Qe(){C(!0);try{await jt("/api/maintenance/check-updates",{method:"POST"}),He(),E("maintenance")}catch(le){ce("Fehler",`Fehler bei der Update-Suche: ${le.message}`)}finally{C(!1)}}async function xt(le,Ce){try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:le,role:Ce})}),ce("Gestartet",`Modell-Upgrade für '${Ce}' (${le}) gestartet.`),He(),E("maintenance")}catch(lt){ce("Fehler",`Fehler beim Starten des Modell-Upgrades: ${lt.message}`)}}async function at(){B("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await jt("/api/maintenance/reboot",{method:"POST"}),ce("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(le){ce("Fehler",`Fehler beim Reboot: ${le.message}`)}})}async function ee(){F(!0),N("Snapshot wird erzeugt...");try{const le=await jt("/api/system/backup",{method:"POST"});N(le.ok?`Snapshot erzeugt: ${le.snapshot} (${le.files.length} Komponenten)`:"Backup fehlgeschlagen."),ue()}catch(le){N(`Fehler: ${le.message}`)}finally{F(!1)}}async function W(le){w(Ce=>({...Ce,[le]:!0}));try{const Ce=await jt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:le})});Ce.ok?ce("Dienst neu gestartet",`Dienst ${le} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&a===le&&Q(le)}):ce("Fehler",`Fehler beim Neustart: ${Ce.err||"Unbekannter Fehler"}`)}catch(Ce){ce("Fehler",`Fehler beim Neustart: ${Ce.message}`)}finally{w(Ce=>({...Ce,[le]:!1}))}}async function Ee(le){try{await jt(`/api/jobs/${le}/cancel`,{method:"POST"}),He()}catch(Ce){ce("Fehler",`Fehler beim Abbrechen: ${Ce.message}`)}}return v.jsxs(v.Fragment,{children:[v.jsx("div",{className:et("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),v.jsxs("div",{className:et("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[v.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),v.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[v.jsx("button",{onClick:()=>E("maintenance"),className:et("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),v.jsx("button",{onClick:()=>E("logs"),className:et("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),v.jsx("button",{onClick:()=>E("settings"),className:et("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),v.jsxs("button",{onClick:Qe,disabled:T,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[v.jsx(B0,{className:et("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&v.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",K(r.last_check)]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(L_,{icon:sy,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Aktualisieren",onAction:Ge}),v.jsx(L_,{icon:bP,iconClass:"text-violet-400",name:"Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Aktualisieren",onAction:Ue}),(()=>{var Ce;const le=(Ce=r==null?void 0:r.components)==null?void 0:Ce.find(lt=>lt.key==="hermes_agent");return v.jsx(L_,{icon:qc,iconClass:"text-amber-400",name:"Hermes-Agent",available:(le==null?void 0:le.update)===!0,busy:ne,status:(le==null?void 0:le.update)===!0?`Update: ${le.latest}`:(le==null?void 0:le.reachable)===!1?"offline":"aktuell",actionLabel:"Aktualisieren",onAction:We})})(),(Be=r==null?void 0:r.model_list)==null?void 0:Be.map(le=>v.jsx(L_,{icon:x8,iconClass:"text-emerald-400",name:`Modell · ${le.role}`,available:!0,status:le.title,actionLabel:"Upgrade",onAction:()=>xt(le.repo,le.role)},le.role))]})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),v.jsx("div",{className:"space-y-1.5",children:kj.map(le=>{var Ce;return v.jsx(pSe,{label:le.label,system:le.type==="system",ok:(Ce=V==null?void 0:V.services.find(lt=>lt.name.toLowerCase().includes(le.reach)))==null?void 0:Ce.ok,busy:S[le.id],onRestart:()=>W(le.id),onLogs:()=>{l(le.id),E("logs")}},le.id)})})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),v.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:j[0]?`Letztes: ${j[0].snapshot}`:"Noch kein Backup"}),v.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[j.length," Snapshots · Restore per CLI (restore.sh)"]})]}),v.jsxs("button",{onClick:ee,disabled:D,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[v.jsx(b8,{className:et("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&v.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),v.jsxs("button",{onClick:at,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[v.jsx(X8,{className:"h-4.5 w-4.5"}),v.jsxs("div",{children:[v.jsx("div",{children:"Host-System neu starten"}),v.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),v.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(le=>le.state==="running"||le.state==="queued").length," Aktiv"]})]}),v.jsx("div",{className:"space-y-3",children:s.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(le=>{const Ce=le.state==="running"||le.state==="queued";return v.jsxs("div",{className:et("p-3 rounded-xl border transition-all duration-300",Ce?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Ce&&v.jsxs("span",{className:"flex h-2 w-2 relative",children:[v.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),v.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),le.label]}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[v.jsxs("span",{children:["ID: ",le.id]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:et(le.state==="done"&&"text-emerald-400",le.state==="failed"&&"text-red-400",le.state==="running"&&"text-primary",le.state==="queued"&&"text-amber-400",le.state==="canceled"&&"text-muted-foreground"),children:le.state})]})]}),Ce&&v.jsx("button",{onClick:()=>Ee(le.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),le.state==="running"&&v.jsxs("div",{className:"mt-3 space-y-1",children:[v.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:v.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${le.progress??0}%`}})}),v.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[v.jsxs("span",{children:[le.progress??0,"%"]}),le.done_bytes!=null&&le.total_bytes!=null&&v.jsxs("span",{children:[dT(le.done_bytes)," / ",dT(le.total_bytes),le.rate_bps!=null&&` (${dT(le.rate_bps)}/s)`]}),le.eta_s!=null&&v.jsxs("span",{children:["ETA: ",le.eta_s,"s"]})]})]})]},le.id)})})]})]}),_==="logs"&&v.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("select",{value:a,onChange:le=>l(le.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:kj.map(le=>v.jsxs("option",{value:le.id,children:[le.label," (",le.type==="system"?"systemd-root":"user",")"]},le.id))}),v.jsxs("button",{onClick:()=>W(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[v.jsx(B0,{className:et("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),v.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[v.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[v.jsx(cF,{className:"h-3 w-3 text-primary"}),v.jsxs("span",{children:["stdout/stderr - ",a]})]}),v.jsx("button",{onClick:()=>Q(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:v.jsx(B0,{className:et("h-3 w-3",f&&"animate-spin")})})]}),v.jsx("pre",{ref:$e,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?v.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[v.jsx(yg,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),v.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),v.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),v.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?v.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||v.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),v.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(sy,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:ae?"text":"password",value:q,onChange:le=>$(le.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>fe(!ae),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:ae?v.jsx(oI,{className:"h-4 w-4"}):v.jsx(PT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(L8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:_e?"text":"password",value:Z,onChange:le=>ge(le.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>Se(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:_e?v.jsx(oI,{className:"h-4 w-4"}):v.jsx(PT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),v.jsxs("div",{className:"flex gap-3 pt-2",children:[v.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",Z),ce("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),v.jsx("button",{onClick:()=>{$(""),ge(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),ce("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),pe&&v.jsx(dV,{type:pe.type,title:pe.title,message:pe.message,onConfirm:pe.onConfirm,onCancel:pe.onCancel})]})}function gSe(){var f,m,y,x,S;sX();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=d7(),{data:c}=K1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const w=_=>{var T;a(((T=_.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",w),()=>window.removeEventListener("open-system-drawer",w)},[]),R.useEffect(()=>{const w=_=>{var T;const E=(T=_.detail)==null?void 0:T.view;E&&e(E)};return window.addEventListener("mc-navigate",w),()=>window.removeEventListener("mc-navigate",w)},[]);const d=OT.find(w=>w.id===t);return v.jsxs("div",{className:"flex h-full relative",children:[v.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[v.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),v.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),v.jsx(c7,{onNavigate:e}),v.jsx(mSe,{open:i,onClose:()=>s(!1),defaultTab:o}),v.jsxs("aside",{className:et("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[v.jsxs("div",{className:et("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[v.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[v.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&v.jsxs("div",{className:"leading-tight",children:[v.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),v.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),v.jsx("button",{onClick:()=>{r(w=>{const _=!w;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?v.jsx(sF,{className:"h-4 w-4"}):v.jsx(w8,{className:"h-4 w-4"})})]}),v.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:OT.map(w=>v.jsxs("button",{onClick:()=>e(w.id),className:et("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===w.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?w.label:void 0,children:[v.jsx(w.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&v.jsx("span",{className:"truncate",children:w.label})]},w.id))}),v.jsx("div",{className:et("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?v.jsx("div",{className:"flex justify-center",children:v.jsx("span",{className:et("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?`Engine ${l.engine_reachable?"online":"offline"}`:"Backend offline"})}):v.jsxs("div",{className:"space-y-2 text-left",children:[l?v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:et("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),v.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}):v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",v.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&v.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[v.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((m=c.versions.engine)==null?void 0:m.version_text)||"unbekannt",children:[v.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),v.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[v.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[v.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),v.jsxs("button",{onClick:()=>{const w=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(w)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[v.jsx(C8,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Suchen"}),v.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&v.jsx(Cfe,{}),t==="models"&&v.jsx(Lfe,{}),t==="connect"&&v.jsx(Ufe,{}),t==="memory"&&v.jsx(Gfe,{}),t==="agent"&&v.jsx(Wfe,{}),t==="terminal"&&v.jsx($fe,{}),t==="voice"&&v.jsx(uSe,{}),t==="guide"&&v.jsx(fSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&v.jsx(hSe,{title:d.label,hint:d.hint})]})]})]})}const vSe=new n8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});RW.createRoot(document.getElementById("root")).render(v.jsx(Gj.StrictMode,{children:v.jsx(r8,{client:vSe,children:v.jsx(gSe,{})})}));export{Zt as B,dx as F,Gj as R,Vm as S,IT as T,X as V,iP as _,Qt as a,R as b,Km as c,rbe as d,MG as e,PW as f,z1 as g,v as h,Q8 as i,Abe as j,gz as l,Wh as r,Fbe as u}; +...`}),v.jsxs("p",{children:["Suchen & installieren über die ",v.jsx("strong",{children:"skills.sh"}),"-Registry: ",v.jsx(pn,{children:"npx skills find"})," /",v.jsx(pn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),v.jsxs(mo,{id:"memory",icon:R8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["LLMs sind ",v.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",v.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:["extrahiert Fakten ",v.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),v.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),v.jsxs("li",{children:[v.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",v.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),v.jsxs(Vf,{children:["Dein Gedächtnis (Tab ",v.jsx("strong",{children:"Gedächtnis"}),") ist ",v.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",v.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",v.jsx(pn,{children:"Identität"})," · ",v.jsx(pn,{children:"Wissen"})," · ",v.jsx(pn,{children:"Regeln"})," · ",v.jsx(pn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",v.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",v.jsx("br",{}),v.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),v.jsxs(mo,{id:"agents",icon:qc,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",v.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",v.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),v.jsxs(Vf,{children:[v.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",v.jsx(pn,{children:"fast"}),"). Reden tust du mit ihm im",v.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",v.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",v.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",v.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),v.jsxs(mo,{id:"ide",icon:oF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[v.jsxs("p",{children:["Jede ",v.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Cline"})," & ",v.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Continue"}),", ",v.jsx("strong",{children:"aider"})," (CLI), ",v.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),v.jsxs(Vf,{children:["Tipp den Kram nicht ab: der ",v.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",v.jsx(pn,{children:"…:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", Key beliebig."]})]}),v.jsx(mo,{id:"tricks",icon:F8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:v.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>v.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[v.jsx(xh,{className:"h-3 w-3 text-amber-400"})," ",n]}),v.jsx("p",{className:"text-[11px]",children:r})]},n))})}),v.jsx(mo,{id:"wartung",icon:sy,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(k8,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(ew,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",v.jsx(pn,{children:"restore.sh"})," (Doku in ",v.jsx(pn,{children:"docs/BACKUP.md"}),")."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",v.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",v.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),v.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),v.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(CT,{className:"h-5 w-5 text-primary"}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),v.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),v.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(TT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),v.jsx(Or,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),v.jsx(Or,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),v.jsx(Or,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),v.jsx(Or,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),v.jsx(Or,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(RT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),v.jsx(Or,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),v.jsx(Or,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),v.jsx(Or,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),v.jsx(Or,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),v.jsx(Or,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),v.jsx(Or,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),v.jsx(Or,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),v.jsx(Or,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(AT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),v.jsx(Or,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),v.jsx(Or,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),v.jsx(Or,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),v.jsx(Or,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),v.jsx(mo,{id:"troubleshooting",icon:j8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:v.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",v.jsx(pn,{children:":9001"}),")? Backend-Status in der ",v.jsx("strong",{children:"Zentrale"})," prüfen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",v.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",v.jsx(pn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",v.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",v.jsx(pn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),v.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function pSe({title:t,hint:e}){return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-xl font-semibold",children:t}),v.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),v.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[v.jsx(P8,{className:"h-8 w-8 text-muted-foreground"}),v.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const kj=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function L_({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return v.jsxs("div",{className:et("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[v.jsx(t,{className:et("h-4 w-4 shrink-0",e)}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:n}),v.jsx("div",{className:et("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),v.jsx("button",{onClick:a,disabled:!i||s,className:et("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function mSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return v.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[v.jsx("span",{className:et("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),v.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&v.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),v.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:v.jsx(B0,{className:et("h-3.5 w-3.5",r&&"animate-spin")})}),v.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:v.jsx(N8,{className:"h-3.5 w-3.5"})})]})}function dT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function gSe({open:t,onClose:e,defaultTab:n="maintenance"}){var Be;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,m]=R.useState(!1),[y,x]=R.useState(null),[S,w]=R.useState({}),[_,E]=R.useState("maintenance"),[T,C]=R.useState(!1),[O,N]=R.useState(""),[D,F]=R.useState(!1),[V,k]=R.useState(null),[j,H]=R.useState([]),[ne,te]=R.useState(!1),[pe,oe]=R.useState(null);function ce(le,Ce,lt){oe({type:"alert",title:le,message:Ce,onConfirm:()=>{oe(null),lt&<()}})}function B(le,Ce,lt){oe({type:"confirm",title:le,message:Ce,onConfirm:()=>{oe(null),lt()},onCancel:()=>oe(null)})}function K(le){return le?new Date(le*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,$]=R.useState(""),[Z,ge]=R.useState(""),[ae,fe]=R.useState(!1),[_e,Se]=R.useState(!1);R.useEffect(()=>{t&&($(localStorage.getItem("mc_sudo_password")||""),ge(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&E(n)},[t,n]);const $e=R.useRef(null);function Me(){jt("/api/maintenance/updates").then(i).catch(le=>console.error("Error loading updates",le))}function He(){jt("/api/jobs").then(le=>o(le.jobs||[])).catch(le=>console.error("Error loading jobs",le))}function Xe(){jt("/api/system/services").then(k).catch(()=>{})}function ue(){jt("/api/system/backups").then(le=>H(le.backups||[])).catch(()=>{})}function Q(le){m(!0),x(null),jt(`/api/maintenance/logs?service=${le}&lines=150`).then(Ce=>{Ce.ok?d(Ce.text):(d(`Fehler beim Laden der Logs: ${Ce.err||"Unbekannter Fehler"}`),(Ce.status==="incorrect_password"||Ce.status==="password_required")&&x(Ce.status))}).catch(Ce=>d(`Fehler: ${Ce.message}`)).finally(()=>{m(!1),setTimeout(()=>{$e.current&&($e.current.scrollTop=$e.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;Me(),He(),Xe(),ue();const le=setInterval(()=>{He(),Me(),Xe()},3e3);return()=>clearInterval(le)},[t]),R.useEffect(()=>{!t||_!=="logs"||Q(a)},[t,_,a]);async function Ge(){try{await jt("/api/maintenance/os-update",{method:"POST"}),He(),E("maintenance")}catch(le){ce("Fehler",`Fehler beim Starten des OS-Updates: ${le.message}`)}}async function Ue(){try{await jt("/api/maintenance/engine-update",{method:"POST"}),He(),E("maintenance")}catch(le){ce("Fehler",`Fehler beim Engine-Update: ${le.message}`)}}function We(){B("Hermes-Agent aktualisieren","Zieht die neuesten Änderungen aus git, installiert Abhängigkeiten neu und startet den Hermes-Gateway neu (vorher automatisches Backup). Fortschritt unter Hintergrund-Aufgaben.",async()=>{te(!0);try{await jt("/api/maintenance/hermes-update",{method:"POST"}),He()}catch(le){ce("Fehler",`Hermes-Update fehlgeschlagen: ${le.message}`)}finally{te(!1)}})}async function Qe(){C(!0);try{await jt("/api/maintenance/check-updates",{method:"POST"}),He(),E("maintenance")}catch(le){ce("Fehler",`Fehler bei der Update-Suche: ${le.message}`)}finally{C(!1)}}async function xt(le,Ce){try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:le,role:Ce})}),ce("Gestartet",`Modell-Upgrade für '${Ce}' (${le}) gestartet.`),He(),E("maintenance")}catch(lt){ce("Fehler",`Fehler beim Starten des Modell-Upgrades: ${lt.message}`)}}async function at(){B("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await jt("/api/maintenance/reboot",{method:"POST"}),ce("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(le){ce("Fehler",`Fehler beim Reboot: ${le.message}`)}})}async function ee(){F(!0),N("Snapshot wird erzeugt...");try{const le=await jt("/api/system/backup",{method:"POST"});N(le.ok?`Snapshot erzeugt: ${le.snapshot} (${le.files.length} Komponenten)`:"Backup fehlgeschlagen."),ue()}catch(le){N(`Fehler: ${le.message}`)}finally{F(!1)}}async function W(le){w(Ce=>({...Ce,[le]:!0}));try{const Ce=await jt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:le})});Ce.ok?ce("Dienst neu gestartet",`Dienst ${le} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&a===le&&Q(le)}):ce("Fehler",`Fehler beim Neustart: ${Ce.err||"Unbekannter Fehler"}`)}catch(Ce){ce("Fehler",`Fehler beim Neustart: ${Ce.message}`)}finally{w(Ce=>({...Ce,[le]:!1}))}}async function Ee(le){try{await jt(`/api/jobs/${le}/cancel`,{method:"POST"}),He()}catch(Ce){ce("Fehler",`Fehler beim Abbrechen: ${Ce.message}`)}}return v.jsxs(v.Fragment,{children:[v.jsx("div",{className:et("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),v.jsxs("div",{className:et("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[v.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),v.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[v.jsx("button",{onClick:()=>E("maintenance"),className:et("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),v.jsx("button",{onClick:()=>E("logs"),className:et("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),v.jsx("button",{onClick:()=>E("settings"),className:et("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),v.jsxs("button",{onClick:Qe,disabled:T,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[v.jsx(B0,{className:et("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&v.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",K(r.last_check)]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(L_,{icon:sy,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Aktualisieren",onAction:Ge}),v.jsx(L_,{icon:bP,iconClass:"text-violet-400",name:"Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Aktualisieren",onAction:Ue}),(()=>{var Ce;const le=(Ce=r==null?void 0:r.components)==null?void 0:Ce.find(lt=>lt.key==="hermes_agent");return v.jsx(L_,{icon:qc,iconClass:"text-amber-400",name:"Hermes-Agent",available:(le==null?void 0:le.update)===!0,busy:ne,status:(le==null?void 0:le.update)===!0?`Update: ${le.latest}`:(le==null?void 0:le.reachable)===!1?"offline":"aktuell",actionLabel:"Aktualisieren",onAction:We})})(),(Be=r==null?void 0:r.model_list)==null?void 0:Be.map(le=>v.jsx(L_,{icon:x8,iconClass:"text-emerald-400",name:`Modell · ${le.role}`,available:!0,status:le.title,actionLabel:"Upgrade",onAction:()=>xt(le.repo,le.role)},le.role))]})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),v.jsx("div",{className:"space-y-1.5",children:kj.map(le=>{var Ce;return v.jsx(mSe,{label:le.label,system:le.type==="system",ok:(Ce=V==null?void 0:V.services.find(lt=>lt.name.toLowerCase().includes(le.reach)))==null?void 0:Ce.ok,busy:S[le.id],onRestart:()=>W(le.id),onLogs:()=>{l(le.id),E("logs")}},le.id)})})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),v.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:j[0]?`Letztes: ${j[0].snapshot}`:"Noch kein Backup"}),v.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[j.length," Snapshots · Restore per CLI (restore.sh)"]})]}),v.jsxs("button",{onClick:ee,disabled:D,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[v.jsx(b8,{className:et("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&v.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),v.jsxs("button",{onClick:at,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[v.jsx(X8,{className:"h-4.5 w-4.5"}),v.jsxs("div",{children:[v.jsx("div",{children:"Host-System neu starten"}),v.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),v.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(le=>le.state==="running"||le.state==="queued").length," Aktiv"]})]}),v.jsx("div",{className:"space-y-3",children:s.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(le=>{const Ce=le.state==="running"||le.state==="queued";return v.jsxs("div",{className:et("p-3 rounded-xl border transition-all duration-300",Ce?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Ce&&v.jsxs("span",{className:"flex h-2 w-2 relative",children:[v.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),v.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),le.label]}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[v.jsxs("span",{children:["ID: ",le.id]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:et(le.state==="done"&&"text-emerald-400",le.state==="failed"&&"text-red-400",le.state==="running"&&"text-primary",le.state==="queued"&&"text-amber-400",le.state==="canceled"&&"text-muted-foreground"),children:le.state})]})]}),Ce&&v.jsx("button",{onClick:()=>Ee(le.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),le.state==="running"&&v.jsxs("div",{className:"mt-3 space-y-1",children:[v.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:v.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${le.progress??0}%`}})}),v.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[v.jsxs("span",{children:[le.progress??0,"%"]}),le.done_bytes!=null&&le.total_bytes!=null&&v.jsxs("span",{children:[dT(le.done_bytes)," / ",dT(le.total_bytes),le.rate_bps!=null&&` (${dT(le.rate_bps)}/s)`]}),le.eta_s!=null&&v.jsxs("span",{children:["ETA: ",le.eta_s,"s"]})]})]})]},le.id)})})]})]}),_==="logs"&&v.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("select",{value:a,onChange:le=>l(le.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:kj.map(le=>v.jsxs("option",{value:le.id,children:[le.label," (",le.type==="system"?"systemd-root":"user",")"]},le.id))}),v.jsxs("button",{onClick:()=>W(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[v.jsx(B0,{className:et("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),v.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[v.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[v.jsx(cF,{className:"h-3 w-3 text-primary"}),v.jsxs("span",{children:["stdout/stderr - ",a]})]}),v.jsx("button",{onClick:()=>Q(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:v.jsx(B0,{className:et("h-3 w-3",f&&"animate-spin")})})]}),v.jsx("pre",{ref:$e,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?v.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[v.jsx(yg,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),v.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),v.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),v.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?v.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||v.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),v.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(sy,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:ae?"text":"password",value:q,onChange:le=>$(le.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>fe(!ae),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:ae?v.jsx(oI,{className:"h-4 w-4"}):v.jsx(PT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(L8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:_e?"text":"password",value:Z,onChange:le=>ge(le.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>Se(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:_e?v.jsx(oI,{className:"h-4 w-4"}):v.jsx(PT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),v.jsxs("div",{className:"flex gap-3 pt-2",children:[v.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",Z),ce("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),v.jsx("button",{onClick:()=>{$(""),ge(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),ce("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),pe&&v.jsx(dV,{type:pe.type,title:pe.title,message:pe.message,onConfirm:pe.onConfirm,onCancel:pe.onCancel})]})}function vSe(){var f,m,y,x,S;sX();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=d7(),{data:c}=K1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const w=_=>{var T;a(((T=_.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",w),()=>window.removeEventListener("open-system-drawer",w)},[]),R.useEffect(()=>{const w=_=>{var T;const E=(T=_.detail)==null?void 0:T.view;E&&e(E)};return window.addEventListener("mc-navigate",w),()=>window.removeEventListener("mc-navigate",w)},[]);const d=OT.find(w=>w.id===t);return v.jsxs("div",{className:"flex h-full relative",children:[v.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[v.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),v.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),v.jsx(c7,{onNavigate:e}),v.jsx(gSe,{open:i,onClose:()=>s(!1),defaultTab:o}),v.jsxs("aside",{className:et("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[v.jsxs("div",{className:et("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[v.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[v.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&v.jsxs("div",{className:"leading-tight",children:[v.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),v.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),v.jsx("button",{onClick:()=>{r(w=>{const _=!w;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?v.jsx(sF,{className:"h-4 w-4"}):v.jsx(w8,{className:"h-4 w-4"})})]}),v.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:OT.map(w=>v.jsxs("button",{onClick:()=>e(w.id),className:et("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===w.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?w.label:void 0,children:[v.jsx(w.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&v.jsx("span",{className:"truncate",children:w.label})]},w.id))}),v.jsx("div",{className:et("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?v.jsx("div",{className:"flex justify-center",children:v.jsx("span",{className:et("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?`Engine ${l.engine_reachable?"online":"offline"}`:"Backend offline"})}):v.jsxs("div",{className:"space-y-2 text-left",children:[l?v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:et("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),v.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}):v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",v.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&v.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[v.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((m=c.versions.engine)==null?void 0:m.version_text)||"unbekannt",children:[v.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),v.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[v.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[v.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),v.jsxs("button",{onClick:()=>{const w=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(w)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[v.jsx(C8,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Suchen"}),v.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&v.jsx(Cfe,{}),t==="models"&&v.jsx(Lfe,{}),t==="connect"&&v.jsx(Ufe,{}),t==="memory"&&v.jsx(Gfe,{}),t==="agent"&&v.jsx(Wfe,{}),t==="terminal"&&v.jsx($fe,{}),t==="voice"&&v.jsx(dSe,{}),t==="guide"&&v.jsx(hSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&v.jsx(pSe,{title:d.label,hint:d.hint})]})]})]})}const ySe=new n8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});RW.createRoot(document.getElementById("root")).render(v.jsx(Gj.StrictMode,{children:v.jsx(r8,{client:ySe,children:v.jsx(vSe,{})})}));export{Zt as B,dx as F,Gj as R,Vm as S,IT as T,X as V,iP as _,Qt as a,R as b,Km as c,rbe as d,MG as e,PW as f,z1 as g,v as h,Q8 as i,Abe as j,gz as l,Wh as r,Fbe as u}; diff --git a/frontend/dist/index.html b/frontend/dist/index.html index e1b31d0..c2bfbee 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/lib/voice/useVoiceAgent.ts b/frontend/src/lib/voice/useVoiceAgent.ts index f357914..a4f3ae9 100644 --- a/frontend/src/lib/voice/useVoiceAgent.ts +++ b/frontend/src/lib/voice/useVoiceAgent.ts @@ -33,6 +33,12 @@ function cleanForTTS(s: string): string { .replace(/\b\S+@\S+\.\S+\b/g, " ") // E-Mails .replace(/[*_#>~|`]+/g, " ") // Markdown-Zeichen .replace(/^\s*[-•·]\s+/gm, " ") // Listen-Bullets + // Sonderzeichen aussprechbar machen (sonst liest die Stimme sie wörtlich/komisch): + .replace(/\s*&\s*/g, " und ") + .replace(/(\d)\s*%/g, "$1 Prozent").replace(/%/g, " Prozent ") + .replace(/(\d)\s*°\s*C?/g, "$1 Grad").replace(/°/g, " Grad ") + .replace(/\s*=\s*/g, " gleich ") + .replace(/\s*\/\s*/g, " ") // Schrägstriche → Pause statt „Schrägstrich" .replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu, "") // Emojis/Symbole .replace(/\s+/g, " ") .trim() diff --git a/frontend/src/views/VoiceView.tsx b/frontend/src/views/VoiceView.tsx index 8426558..7d4e5e2 100644 --- a/frontend/src/views/VoiceView.tsx +++ b/frontend/src/views/VoiceView.tsx @@ -8,6 +8,14 @@ import { cn } from "@/lib/utils" // Fester Avatar (das eine, gewählte VRM). Liegt unter frontend/public/avatar.vrm → /avatar.vrm. const FIXED_AVATAR = "/avatar.vrm" +// **fett** als echte Fettschrift rendern (Rest als Text; Zeilenumbrüche via whitespace-pre-wrap). +function renderRich(text: string) { + return text.split(/(\*\*[^*\n]+\*\*)/g).map((p, i) => { + const m = p.match(/^\*\*([^*]+)\*\*$/) + return m ? {m[1]} : {p} + }) +} + // Kleiner Tipp-Indikator („Hermes schreibt …"). function Dots() { return ( @@ -134,7 +142,7 @@ export function VoiceView() { ? "rounded-br-sm bg-primary/15 text-foreground" : "rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90", )}> - {m.text || } + {m.text ? renderRich(m.text) : } ))}