var lp=s=>{throw TypeError(s)};var mu=(s,o,i)=>o.has(s)||lp("Cannot "+i);var S=(s,o,i)=>(mu(s,o,"read from private field"),i?i.call(s):o.get(s)),ye=(s,o,i)=>o.has(s)?lp("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(s):o.set(s,i),se=(s,o,i,u)=>(mu(s,o,"write to private field"),u?u.call(s,i):o.set(s,i),i),Ce=(s,o,i)=>(mu(s,o,"access private method"),i);var ei=(s,o,i,u)=>({set _(d){se(s,o,d,i)},get _(){return S(s,o,u)}});function hx(s,o){for(var i=0;iu[d]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();function uh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var gu={exports:{}},No={},xu={exports:{}},Se={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ip;function mx(){if(ip)return Se;ip=1;var s=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),j=Symbol.iterator;function M(P){return P===null||typeof P!="object"?null:(P=j&&P[j]||P["@@iterator"],typeof P=="function"?P:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I=Object.assign,w={};function C(P,N,G){this.props=P,this.context=N,this.refs=w,this.updater=G||D}C.prototype.isReactComponent={},C.prototype.setState=function(P,N){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,N,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function _(){}_.prototype=C.prototype;function $(P,N,G){this.props=P,this.context=N,this.refs=w,this.updater=G||D}var H=$.prototype=new _;H.constructor=$,I(H,C.prototype),H.isPureReactComponent=!0;var z=Array.isArray,R=Object.prototype.hasOwnProperty,F={current:null},K={key:!0,ref:!0,__self:!0,__source:!0};function ne(P,N,G){var X,Y={},ie=null,pe=null;if(N!=null)for(X in N.ref!==void 0&&(pe=N.ref),N.key!==void 0&&(ie=""+N.key),N)R.call(N,X)&&!K.hasOwnProperty(X)&&(Y[X]=N[X]);var we=arguments.length-2;if(we===1)Y.children=G;else if(1>>1,N=Q[P];if(0>>1;Pd(Y,Z))ied(pe,Y)?(Q[P]=pe,Q[ie]=Z,P=ie):(Q[P]=Y,Q[X]=Z,P=X);else if(ied(pe,Z))Q[P]=pe,Q[ie]=Z,P=ie;else break e}}return ce}function d(Q,ce){var Z=Q.sortIndex-ce.sortIndex;return Z!==0?Z:Q.id-ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;s.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();s.unstable_now=function(){return m.now()-h}}var v=[],x=[],b=1,j=null,M=3,D=!1,I=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function H(Q){for(var ce=i(x);ce!==null;){if(ce.callback===null)u(x);else if(ce.startTime<=Q)u(x),ce.sortIndex=ce.expirationTime,o(v,ce);else break;ce=i(x)}}function z(Q){if(w=!1,H(Q),!I)if(i(v)!==null)I=!0,Te(R);else{var ce=i(x);ce!==null&&Me(z,ce.startTime-Q)}}function R(Q,ce){I=!1,w&&(w=!1,_(ne),ne=-1),D=!0;var Z=M;try{for(H(ce),j=i(v);j!==null&&(!(j.expirationTime>ce)||Q&&!ke());){var P=j.callback;if(typeof P=="function"){j.callback=null,M=j.priorityLevel;var N=P(j.expirationTime<=ce);ce=s.unstable_now(),typeof N=="function"?j.callback=N:j===i(v)&&u(v),H(ce)}else u(v);j=i(v)}if(j!==null)var G=!0;else{var X=i(x);X!==null&&Me(z,X.startTime-ce),G=!1}return G}finally{j=null,M=Z,D=!1}}var F=!1,K=null,ne=-1,ee=5,J=-1;function ke(){return!(s.unstable_now()-JQ||125P?(Q.sortIndex=Z,o(x,Q),i(v)===null&&Q===i(x)&&(w?(_(ne),ne=-1):w=!0,Me(z,Z-P))):(Q.sortIndex=N,o(v,Q),I||D||(I=!0,Te(R))),Q},s.unstable_shouldYield=ke,s.unstable_wrapCallback=function(Q){var ce=M;return function(){var Z=M;M=ce;try{return Q.apply(this,arguments)}finally{M=Z}}}})(bu)),bu}var fp;function vx(){return fp||(fp=1,vu.exports=yx()),vu.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var pp;function bx(){if(pp)return wt;pp=1;var s=lc(),o=vx();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,x=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,b={},j={};function M(e){return v.call(j,e)?!0:v.call(b,e)?!1:x.test(e)?j[e]=!0:(b[e]=!0,!1)}function D(e,t,r,l){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function I(e,t,r,l){if(t===null||typeof t>"u"||D(e,t,r,l))return!0;if(l)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function w(e,t,r,l,a,c,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=p}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new w(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new w(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new w(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new w(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new w(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new w(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new w(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new w(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new w(e,5,!1,e.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function $(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!0,!0)});function H(e,t,r,l){var a=C.hasOwnProperty(t)?C[t]:null;(a!==null?a.type!==0:l||!(2y||a[p]!==c[y]){var k=` `+a[p].replace(" at new "," at ");return e.displayName&&k.includes("")&&(k=k.replace("",e.displayName)),k}while(1<=p&&0<=y);break}}}finally{G=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?N(e):""}function Y(e){switch(e.tag){case 5:return N(e.type);case 16:return N("Lazy");case 13:return N("Suspense");case 19:return N("SuspenseList");case 0:case 2:case 15:return e=X(e.type,!1),e;case 11:return e=X(e.type.render,!1),e;case 1:return e=X(e.type,!0),e;default:return""}}function ie(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case F:return"Portal";case ee:return"Profiler";case ne:return"StrictMode";case Le:return"Suspense";case _e:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ke:return(e.displayName||"Context")+".Consumer";case J:return(e._context.displayName||"Context")+".Provider";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Oe:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Te:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function we(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function U(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function me(e){var t=U(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,c=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(p){l=""+p,c.call(this,p)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return l},setValue:function(p){l=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function St(e){e._valueTracker||(e._valueTracker=me(e))}function Go(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),l="";return e&&(l=U(e)?e.checked?"true":"false":e.value),e=l,e!==r?(t.setValue(e),!0):!1}function kr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ln(e,t){var r=t.checked;return Z({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Is(e,t){var r=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;r=we(t.value!=null?t.value:r),e._wrapperState={initialChecked:l,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Fs(e,t){t=t.checked,t!=null&&H(e,"checked",t,!1)}function Fn(e,t){Fs(e,t);var r=we(t.value),l=t.type;if(r!=null)l==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Un(e,t.type,r):t.hasOwnProperty("defaultValue")&&Un(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Nr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Un(e,t,r){(t!=="number"||kr(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Sr=Array.isArray;function ir(e,t,r,l){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Ie.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ar(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ur={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ci=["Webkit","ms","Moz","O"];Object.keys(ur).forEach(function(e){Ci.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ur[t]=ur[e]})});function bc(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ur.hasOwnProperty(e)&&ur[e]?(""+t).trim():t+"px"}function wc(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var l=r.indexOf("--")===0,a=bc(r,t[r],l);r==="float"&&(r="cssFloat"),l?e.setProperty(r,a):e[r]=a}}var vm=Z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ei(e,t){if(t){if(vm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function Pi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _i=null;function Mi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ri=null,Bn=null,Hn=null;function jc(e){if(e=ao(e)){if(typeof Ri!="function")throw Error(i(280));var t=e.stateNode;t&&(t=ml(t),Ri(e.stateNode,e.type,t))}}function kc(e){Bn?Hn?Hn.push(e):Hn=[e]:Bn=e}function Nc(){if(Bn){var e=Bn,t=Hn;if(Hn=Bn=null,jc(e),t)for(e=0;e>>=0,e===0?32:31-(Mm(e)/Rm|0)|0}var Yo=64,Jo=4194304;function Ws(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Xo(e,t){var r=e.pendingLanes;if(r===0)return 0;var l=0,a=e.suspendedLanes,c=e.pingedLanes,p=r&268435455;if(p!==0){var y=p&~a;y!==0?l=Ws(y):(c&=p,c!==0&&(l=Ws(c)))}else p=r&~a,p!==0?l=Ws(p):c!==0&&(l=Ws(c));if(l===0)return 0;if(t!==0&&t!==l&&(t&a)===0&&(a=l&-l,c=t&-t,a>=c||a===16&&(c&4194240)!==0))return t;if((l&4)!==0&&(l|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0r;r++)t.push(e);return t}function Vs(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$t(t),e[t]=r}function Am(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0=Xs),Jc=" ",Xc=!1;function ed(e,t){switch(e){case"keyup":return ug.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function td(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gn=!1;function dg(e,t){switch(e){case"compositionend":return td(t);case"keypress":return t.which!==32?null:(Xc=!0,Jc);case"textInput":return e=t.data,e===Jc&&Xc?null:e;default:return null}}function fg(e,t){if(Gn)return e==="compositionend"||!qi&&ed(e,t)?(e=Gc(),sl=Hi=Mr=null,Gn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ad(r)}}function cd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dd(){for(var e=window,t=kr();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=kr(e.document)}return t}function Ji(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function wg(e){var t=dd(),r=e.focusedElem,l=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&cd(r.ownerDocument.documentElement,r)){if(l!==null&&Ji(r)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,c=Math.min(l.start,a);l=l.end===void 0?c:Math.min(l.end,a),!e.extend&&c>l&&(a=l,l=c,c=a),a=ud(r,c);var p=ud(r,l);a&&p&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),c>l?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Kn=null,Xi=null,no=null,ea=!1;function fd(e,t,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ea||Kn==null||Kn!==kr(l)||(l=Kn,"selectionStart"in l&&Ji(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),no&&ro(no,l)||(no=l,l=fl(Xi,"onSelect"),0Jn||(e.current=fa[Jn],fa[Jn]=null,Jn--)}function Fe(e,t){Jn++,fa[Jn]=e.current,e.current=t}var Tr={},it=Dr(Tr),gt=Dr(!1),cn=Tr;function Xn(e,t){var r=e.type.contextTypes;if(!r)return Tr;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var a={},c;for(c in r)a[c]=t[c];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function xt(e){return e=e.childContextTypes,e!=null}function gl(){$e(gt),$e(it)}function Ed(e,t,r){if(it.current!==Tr)throw Error(i(168));Fe(it,t),Fe(gt,r)}function Pd(e,t,r){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return r;l=l.getChildContext();for(var a in l)if(!(a in t))throw Error(i(108,pe(e)||"Unknown",a));return Z({},r,l)}function xl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Tr,cn=it.current,Fe(it,e),Fe(gt,gt.current),!0}function _d(e,t,r){var l=e.stateNode;if(!l)throw Error(i(169));r?(e=Pd(e,t,cn),l.__reactInternalMemoizedMergedChildContext=e,$e(gt),$e(it),Fe(it,e)):$e(gt),Fe(gt,r)}var dr=null,yl=!1,pa=!1;function Md(e){dr===null?dr=[e]:dr.push(e)}function Dg(e){yl=!0,Md(e)}function Ar(){if(!pa&&dr!==null){pa=!0;var e=0,t=ze;try{var r=dr;for(ze=1;e>=p,a-=p,fr=1<<32-$t(t)+a|r<je?(tt=xe,xe=null):tt=xe.sibling;var De=B(O,xe,T[je],q);if(De===null){xe===null&&(xe=tt);break}e&&xe&&De.alternate===null&&t(O,xe),E=c(De,E,je),ge===null?fe=De:ge.sibling=De,ge=De,xe=tt}if(je===T.length)return r(O,xe),He&&fn(O,je),fe;if(xe===null){for(;jeje?(tt=xe,xe=null):tt=xe.sibling;var Wr=B(O,xe,De.value,q);if(Wr===null){xe===null&&(xe=tt);break}e&&xe&&Wr.alternate===null&&t(O,xe),E=c(Wr,E,je),ge===null?fe=Wr:ge.sibling=Wr,ge=Wr,xe=tt}if(De.done)return r(O,xe),He&&fn(O,je),fe;if(xe===null){for(;!De.done;je++,De=T.next())De=V(O,De.value,q),De!==null&&(E=c(De,E,je),ge===null?fe=De:ge.sibling=De,ge=De);return He&&fn(O,je),fe}for(xe=l(O,xe);!De.done;je++,De=T.next())De=re(xe,O,je,De.value,q),De!==null&&(e&&De.alternate!==null&&xe.delete(De.key===null?je:De.key),E=c(De,E,je),ge===null?fe=De:ge.sibling=De,ge=De);return e&&xe.forEach(function(px){return t(O,px)}),He&&fn(O,je),fe}function qe(O,E,T,q){if(typeof T=="object"&&T!==null&&T.type===K&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case R:e:{for(var fe=T.key,ge=E;ge!==null;){if(ge.key===fe){if(fe=T.type,fe===K){if(ge.tag===7){r(O,ge.sibling),E=a(ge,T.props.children),E.return=O,O=E;break e}}else if(ge.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Te&&zd(fe)===ge.type){r(O,ge.sibling),E=a(ge,T.props),E.ref=uo(O,ge,T),E.return=O,O=E;break e}r(O,ge);break}else t(O,ge);ge=ge.sibling}T.type===K?(E=bn(T.props.children,O.mode,q,T.key),E.return=O,O=E):(q=Gl(T.type,T.key,T.props,null,O.mode,q),q.ref=uo(O,E,T),q.return=O,O=q)}return p(O);case F:e:{for(ge=T.key;E!==null;){if(E.key===ge)if(E.tag===4&&E.stateNode.containerInfo===T.containerInfo&&E.stateNode.implementation===T.implementation){r(O,E.sibling),E=a(E,T.children||[]),E.return=O,O=E;break e}else{r(O,E);break}else t(O,E);E=E.sibling}E=cu(T,O.mode,q),E.return=O,O=E}return p(O);case Te:return ge=T._init,qe(O,E,ge(T._payload),q)}if(Sr(T))return ae(O,E,T,q);if(ce(T))return de(O,E,T,q);jl(O,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,E!==null&&E.tag===6?(r(O,E.sibling),E=a(E,T),E.return=O,O=E):(r(O,E),E=uu(T,O.mode,q),E.return=O,O=E),p(O)):r(O,E)}return qe}var ns=Ld(!0),Id=Ld(!1),kl=Dr(null),Nl=null,ss=null,va=null;function ba(){va=ss=Nl=null}function wa(e){var t=kl.current;$e(kl),e._currentValue=t}function ja(e,t,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===r)break;e=e.return}}function os(e,t){Nl=e,va=ss=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(yt=!0),e.firstContext=null)}function At(e){var t=e._currentValue;if(va!==e)if(e={context:e,memoizedValue:t,next:null},ss===null){if(Nl===null)throw Error(i(308));ss=e,Nl.dependencies={lanes:0,firstContext:e}}else ss=ss.next=e;return t}var pn=null;function ka(e){pn===null?pn=[e]:pn.push(e)}function Fd(e,t,r,l){var a=t.interleaved;return a===null?(r.next=r,ka(t)):(r.next=a.next,a.next=r),t.interleaved=r,hr(e,l)}function hr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var zr=!1;function Na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ud(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function mr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Lr(e,t,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Re&2)!==0){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,hr(e,r)}return a=l.interleaved,a===null?(t.next=t,ka(l)):(t.next=a.next,a.next=t),l.interleaved=t,hr(e,r)}function Sl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,Ii(e,r)}}function $d(e,t){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var a=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var p={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};c===null?a=c=p:c=c.next=p,r=r.next}while(r!==null);c===null?a=c=t:c=c.next=t}else a=c=t;r={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:c,shared:l.shared,effects:l.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Cl(e,t,r,l){var a=e.updateQueue;zr=!1;var c=a.firstBaseUpdate,p=a.lastBaseUpdate,y=a.shared.pending;if(y!==null){a.shared.pending=null;var k=y,L=k.next;k.next=null,p===null?c=L:p.next=L,p=k;var W=e.alternate;W!==null&&(W=W.updateQueue,y=W.lastBaseUpdate,y!==p&&(y===null?W.firstBaseUpdate=L:y.next=L,W.lastBaseUpdate=k))}if(c!==null){var V=a.baseState;p=0,W=L=k=null,y=c;do{var B=y.lane,re=y.eventTime;if((l&B)===B){W!==null&&(W=W.next={eventTime:re,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var ae=e,de=y;switch(B=t,re=r,de.tag){case 1:if(ae=de.payload,typeof ae=="function"){V=ae.call(re,V,B);break e}V=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=de.payload,B=typeof ae=="function"?ae.call(re,V,B):ae,B==null)break e;V=Z({},V,B);break e;case 2:zr=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,B=a.effects,B===null?a.effects=[y]:B.push(y))}else re={eventTime:re,lane:B,tag:y.tag,payload:y.payload,callback:y.callback,next:null},W===null?(L=W=re,k=V):W=W.next=re,p|=B;if(y=y.next,y===null){if(y=a.shared.pending,y===null)break;B=y,y=B.next,B.next=null,a.lastBaseUpdate=B,a.shared.pending=null}}while(!0);if(W===null&&(k=V),a.baseState=k,a.firstBaseUpdate=L,a.lastBaseUpdate=W,t=a.shared.interleaved,t!==null){a=t;do p|=a.lane,a=a.next;while(a!==t)}else c===null&&(a.shared.lanes=0);gn|=p,e.lanes=p,e.memoizedState=V}}function Bd(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var l=_a.transition;_a.transition={};try{e(!1),t()}finally{ze=r,_a.transition=l}}function af(){return zt().memoizedState}function Lg(e,t,r){var l=$r(e);if(r={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null},uf(e))cf(t,r);else if(r=Fd(e,t,r,l),r!==null){var a=pt();Kt(r,e,l,a),df(r,t,l)}}function Ig(e,t,r){var l=$r(e),a={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null};if(uf(e))cf(t,a);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var p=t.lastRenderedState,y=c(p,r);if(a.hasEagerState=!0,a.eagerState=y,Bt(y,p)){var k=t.interleaved;k===null?(a.next=a,ka(t)):(a.next=k.next,k.next=a),t.interleaved=a;return}}catch{}finally{}r=Fd(e,t,a,l),r!==null&&(a=pt(),Kt(r,e,l,a),df(r,t,l))}}function uf(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function cf(e,t){ho=_l=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function df(e,t,r){if((r&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,Ii(e,r)}}var Ol={readContext:At,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useInsertionEffect:at,useLayoutEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useMutableSource:at,useSyncExternalStore:at,useId:at,unstable_isNewReconciler:!1},Fg={readContext:At,useCallback:function(e,t){return Xt().memoizedState=[e,t===void 0?null:t],e},useContext:At,useEffect:Xd,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Ml(4194308,4,rf.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Ml(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ml(4,2,e,t)},useMemo:function(e,t){var r=Xt();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var l=Xt();return t=r!==void 0?r(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=Lg.bind(null,Ve,e),[l.memoizedState,e]},useRef:function(e){var t=Xt();return e={current:e},t.memoizedState=e},useState:Yd,useDebugValue:za,useDeferredValue:function(e){return Xt().memoizedState=e},useTransition:function(){var e=Yd(!1),t=e[0];return e=zg.bind(null,e[1]),Xt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var l=Ve,a=Xt();if(He){if(r===void 0)throw Error(i(407));r=r()}else{if(r=t(),et===null)throw Error(i(349));(mn&30)!==0||Gd(l,t,r)}a.memoizedState=r;var c={value:r,getSnapshot:t};return a.queue=c,Xd(Qd.bind(null,l,c,e),[e]),l.flags|=2048,xo(9,Kd.bind(null,l,c,r,t),void 0,null),r},useId:function(){var e=Xt(),t=et.identifierPrefix;if(He){var r=pr,l=fr;r=(l&~(1<<32-$t(l)-1)).toString(32)+r,t=":"+t+"R"+r,r=mo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=p.createElement(r,{is:l.is}):(e=p.createElement(r),r==="select"&&(p=e,l.multiple?p.multiple=!0:l.size&&(p.size=l.size))):e=p.createElementNS(e,r),e[Yt]=t,e[io]=l,Rf(e,t,!1,!1),t.stateNode=e;e:{switch(p=Pi(r,l),r){case"dialog":Ue("cancel",e),Ue("close",e),a=l;break;case"iframe":case"object":case"embed":Ue("load",e),a=l;break;case"video":case"audio":for(a=0;acs&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304)}else{if(!l)if(e=El(p),e!==null){if(t.flags|=128,l=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),yo(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!He)return ut(t),null}else 2*Qe()-c.renderingStartTime>cs&&r!==1073741824&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304);c.isBackwards?(p.sibling=t.child,t.child=p):(r=c.last,r!==null?r.sibling=p:t.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Qe(),t.sibling=null,r=We.current,Fe(We,l?r&1|2:r&1),t):(ut(t),null);case 22:case 23:return lu(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(_t&1073741824)!==0&&(ut(t),t.subtreeFlags&6&&(t.flags|=8192)):ut(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Kg(e,t){switch(ma(t),t.tag){case 1:return xt(t.type)&&gl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ls(),$e(gt),$e(it),Pa(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ca(t),null;case 13:if($e(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));rs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(We),null;case 4:return ls(),null;case 10:return wa(t.type._context),null;case 22:case 23:return lu(),null;case 24:return null;default:return null}}var zl=!1,ct=!1,Qg=typeof WeakSet=="function"?WeakSet:Set,le=null;function as(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(l){Ge(e,t,l)}else r.current=null}function Qa(e,t,r){try{r()}catch(l){Ge(e,t,l)}}var Tf=!1;function qg(e,t){if(la=rl,e=dd(),Ji(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var a=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{r.nodeType,c.nodeType}catch{r=null;break e}var p=0,y=-1,k=-1,L=0,W=0,V=e,B=null;t:for(;;){for(var re;V!==r||a!==0&&V.nodeType!==3||(y=p+a),V!==c||l!==0&&V.nodeType!==3||(k=p+l),V.nodeType===3&&(p+=V.nodeValue.length),(re=V.firstChild)!==null;)B=V,V=re;for(;;){if(V===e)break t;if(B===r&&++L===a&&(y=p),B===c&&++W===l&&(k=p),(re=V.nextSibling)!==null)break;V=B,B=V.parentNode}V=re}r=y===-1||k===-1?null:{start:y,end:k}}else r=null}r=r||{start:0,end:0}}else r=null;for(ia={focusedElem:e,selectionRange:r},rl=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ae=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ae!==null){var de=ae.memoizedProps,qe=ae.memoizedState,O=t.stateNode,E=O.getSnapshotBeforeUpdate(t.elementType===t.type?de:Wt(t.type,de),qe);O.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var T=t.stateNode.containerInfo;T.nodeType===1?T.textContent="":T.nodeType===9&&T.documentElement&&T.removeChild(T.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(q){Ge(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ae=Tf,Tf=!1,ae}function vo(e,t,r){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var a=l=l.next;do{if((a.tag&e)===e){var c=a.destroy;a.destroy=void 0,c!==void 0&&Qa(t,r,c)}a=a.next}while(a!==l)}}function Ll(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var l=r.create;r.destroy=l()}r=r.next}while(r!==t)}}function qa(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Af(e){var t=e.alternate;t!==null&&(e.alternate=null,Af(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Yt],delete t[io],delete t[da],delete t[Rg],delete t[Og])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function zf(e){return e.tag===5||e.tag===3||e.tag===4}function Lf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Za(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=hl));else if(l!==4&&(e=e.child,e!==null))for(Za(e,t,r),e=e.sibling;e!==null;)Za(e,t,r),e=e.sibling}function Ya(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(Ya(e,t,r),e=e.sibling;e!==null;)Ya(e,t,r),e=e.sibling}var nt=null,Vt=!1;function Ir(e,t,r){for(r=r.child;r!==null;)If(e,t,r),r=r.sibling}function If(e,t,r){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(Zo,r)}catch{}switch(r.tag){case 5:ct||as(r,t);case 6:var l=nt,a=Vt;nt=null,Ir(e,t,r),nt=l,Vt=a,nt!==null&&(Vt?(e=nt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):nt.removeChild(r.stateNode));break;case 18:nt!==null&&(Vt?(e=nt,r=r.stateNode,e.nodeType===8?ca(e.parentNode,r):e.nodeType===1&&ca(e,r),Zs(e)):ca(nt,r.stateNode));break;case 4:l=nt,a=Vt,nt=r.stateNode.containerInfo,Vt=!0,Ir(e,t,r),nt=l,Vt=a;break;case 0:case 11:case 14:case 15:if(!ct&&(l=r.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){a=l=l.next;do{var c=a,p=c.destroy;c=c.tag,p!==void 0&&((c&2)!==0||(c&4)!==0)&&Qa(r,t,p),a=a.next}while(a!==l)}Ir(e,t,r);break;case 1:if(!ct&&(as(r,t),l=r.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=r.memoizedProps,l.state=r.memoizedState,l.componentWillUnmount()}catch(y){Ge(r,t,y)}Ir(e,t,r);break;case 21:Ir(e,t,r);break;case 22:r.mode&1?(ct=(l=ct)||r.memoizedState!==null,Ir(e,t,r),ct=l):Ir(e,t,r);break;default:Ir(e,t,r)}}function Ff(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Qg),t.forEach(function(l){var a=sx.bind(null,e,l);r.has(l)||(r.add(l),l.then(a,a))})}}function Gt(e,t){var r=t.deletions;if(r!==null)for(var l=0;la&&(a=p),l&=~c}if(l=a,l=Qe()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Yg(l/1960))-l,10e?16:e,Ur===null)var l=!1;else{if(e=Ur,Ur=null,Bl=0,(Re&6)!==0)throw Error(i(331));var a=Re;for(Re|=4,le=e.current;le!==null;){var c=le,p=c.child;if((le.flags&16)!==0){var y=c.deletions;if(y!==null){for(var k=0;kQe()-eu?yn(e,0):Xa|=r),bt(e,t)}function Jf(e,t){t===0&&((e.mode&1)===0?t=1:(t=Jo,Jo<<=1,(Jo&130023424)===0&&(Jo=4194304)));var r=pt();e=hr(e,t),e!==null&&(Vs(e,t,r),bt(e,r))}function nx(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Jf(e,r)}function sx(e,t){var r=0;switch(e.tag){case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(i(314))}l!==null&&l.delete(t),Jf(e,r)}var Xf;Xf=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||gt.current)yt=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return yt=!1,Vg(e,t,r);yt=(e.flags&131072)!==0}else yt=!1,He&&(t.flags&1048576)!==0&&Rd(t,bl,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Al(e,t),e=t.pendingProps;var a=Xn(t,it.current);os(t,r),a=Ra(null,t,l,e,a,r);var c=Oa();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xt(l)?(c=!0,xl(t)):c=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Na(t),a.updater=Dl,t.stateNode=a,a._reactInternals=t,Ia(t,l,e,r),t=Ba(null,t,l,!0,c,r)):(t.tag=0,He&&c&&ha(t),ft(null,t,a,r),t=t.child),t;case 16:l=t.elementType;e:{switch(Al(e,t),e=t.pendingProps,a=l._init,l=a(l._payload),t.type=l,a=t.tag=lx(l),e=Wt(l,e),a){case 0:t=$a(null,t,l,e,r);break e;case 1:t=Sf(null,t,l,e,r);break e;case 11:t=bf(null,t,l,e,r);break e;case 14:t=wf(null,t,l,Wt(l.type,e),r);break e}throw Error(i(306,l,""))}return t;case 0:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),$a(e,t,l,a,r);case 1:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),Sf(e,t,l,a,r);case 3:e:{if(Cf(t),e===null)throw Error(i(387));l=t.pendingProps,c=t.memoizedState,a=c.element,Ud(e,t),Cl(t,l,null,r);var p=t.memoizedState;if(l=p.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){a=is(Error(i(423)),t),t=Ef(e,t,l,r,a);break e}else if(l!==a){a=is(Error(i(424)),t),t=Ef(e,t,l,r,a);break e}else for(Pt=Or(t.stateNode.containerInfo.firstChild),Et=t,He=!0,Ht=null,r=Id(t,null,l,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(rs(),l===a){t=gr(e,t,r);break e}ft(e,t,l,r)}t=t.child}return t;case 5:return Hd(t),e===null&&xa(t),l=t.type,a=t.pendingProps,c=e!==null?e.memoizedProps:null,p=a.children,aa(l,a)?p=null:c!==null&&aa(l,c)&&(t.flags|=32),Nf(e,t),ft(e,t,p,r),t.child;case 6:return e===null&&xa(t),null;case 13:return Pf(e,t,r);case 4:return Sa(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ns(t,null,l,r):ft(e,t,l,r),t.child;case 11:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),bf(e,t,l,a,r);case 7:return ft(e,t,t.pendingProps,r),t.child;case 8:return ft(e,t,t.pendingProps.children,r),t.child;case 12:return ft(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(l=t.type._context,a=t.pendingProps,c=t.memoizedProps,p=a.value,Fe(kl,l._currentValue),l._currentValue=p,c!==null)if(Bt(c.value,p)){if(c.children===a.children&&!gt.current){t=gr(e,t,r);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var y=c.dependencies;if(y!==null){p=c.child;for(var k=y.firstContext;k!==null;){if(k.context===l){if(c.tag===1){k=mr(-1,r&-r),k.tag=2;var L=c.updateQueue;if(L!==null){L=L.shared;var W=L.pending;W===null?k.next=k:(k.next=W.next,W.next=k),L.pending=k}}c.lanes|=r,k=c.alternate,k!==null&&(k.lanes|=r),ja(c.return,r,t),y.lanes|=r;break}k=k.next}}else if(c.tag===10)p=c.type===t.type?null:c.child;else if(c.tag===18){if(p=c.return,p===null)throw Error(i(341));p.lanes|=r,y=p.alternate,y!==null&&(y.lanes|=r),ja(p,r,t),p=c.sibling}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===t){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}ft(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,l=t.pendingProps.children,os(t,r),a=At(a),l=l(a),t.flags|=1,ft(e,t,l,r),t.child;case 14:return l=t.type,a=Wt(l,t.pendingProps),a=Wt(l.type,a),wf(e,t,l,a,r);case 15:return jf(e,t,t.type,t.pendingProps,r);case 17:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Wt(l,a),Al(e,t),t.tag=1,xt(l)?(e=!0,xl(t)):e=!1,os(t,r),pf(t,l,a),Ia(t,l,a,r),Ba(null,t,l,!0,e,r);case 19:return Mf(e,t,r);case 22:return kf(e,t,r)}throw Error(i(156,t.tag))};function ep(e,t){return Oc(e,t)}function ox(e,t,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function It(e,t,r,l){return new ox(e,t,r,l)}function au(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lx(e){if(typeof e=="function")return au(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===Oe)return 14}return 2}function Hr(e,t){var r=e.alternate;return r===null?(r=It(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Gl(e,t,r,l,a,c){var p=2;if(l=e,typeof e=="function")au(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case K:return bn(r.children,a,c,t);case ne:p=8,a|=8;break;case ee:return e=It(12,r,t,a|2),e.elementType=ee,e.lanes=c,e;case Le:return e=It(13,r,t,a),e.elementType=Le,e.lanes=c,e;case _e:return e=It(19,r,t,a),e.elementType=_e,e.lanes=c,e;case Me:return Kl(r,a,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J:p=10;break e;case ke:p=9;break e;case ue:p=11;break e;case Oe:p=14;break e;case Te:p=16,l=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=It(p,r,t,a),t.elementType=e,t.type=l,t.lanes=c,t}function bn(e,t,r,l){return e=It(7,e,l,t),e.lanes=r,e}function Kl(e,t,r,l){return e=It(22,e,l,t),e.elementType=Me,e.lanes=r,e.stateNode={isHidden:!1},e}function uu(e,t,r){return e=It(6,e,null,t),e.lanes=r,e}function cu(e,t,r){return t=It(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ix(e,t,r,l,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Li(0),this.expirationTimes=Li(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Li(0),this.identifierPrefix=l,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function du(e,t,r,l,a,c,p,y,k){return e=new ix(e,t,r,y,k),t===1?(t=1,c===!0&&(t|=8)):t=0,c=It(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:l,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Na(c),e}function ax(e,t,r){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),yu.exports=bx(),yu.exports}var mp;function wx(){if(mp)return ti;mp=1;var s=dh();return ti.createRoot=s.createRoot,ti.hydrateRoot=s.hydrateRoot,ti}var jx=wx();const kx=uh(jx);var Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Nn,qr,bs,Xp,Nx=(Xp=class extends Ho{constructor(){super();ye(this,Nn);ye(this,qr);ye(this,bs);se(this,bs,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){S(this,qr)||this.setEventListener(S(this,bs))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,qr))==null||o.call(this),se(this,qr,void 0))}setEventListener(o){var i;se(this,bs,o),(i=S(this,qr))==null||i.call(this),se(this,qr,o(u=>{typeof u=="boolean"?this.setFocused(u):this.onFocus()}))}setFocused(o){S(this,Nn)!==o&&(se(this,Nn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(i=>{i(o)})}isFocused(){var o;return typeof S(this,Nn)=="boolean"?S(this,Nn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},Nn=new WeakMap,qr=new WeakMap,bs=new WeakMap,Xp),ac=new Nx,Sx={setTimeout:(s,o)=>setTimeout(s,o),clearTimeout:s=>clearTimeout(s),setInterval:(s,o)=>setInterval(s,o),clearInterval:s=>clearInterval(s)},Zr,oc,eh,Cx=(eh=class{constructor(){ye(this,Zr,Sx);ye(this,oc,!1)}setTimeoutProvider(s){se(this,Zr,s)}setTimeout(s,o){return S(this,Zr).setTimeout(s,o)}clearTimeout(s){S(this,Zr).clearTimeout(s)}setInterval(s,o){return S(this,Zr).setInterval(s,o)}clearInterval(s){S(this,Zr).clearInterval(s)}},Zr=new WeakMap,oc=new WeakMap,eh),kn=new Cx;function Ex(s){setTimeout(s,0)}var Px=typeof window>"u"||"Deno"in globalThis;function kt(){}function _x(s,o){return typeof s=="function"?s(o):s}function Du(s){return typeof s=="number"&&s>=0&&s!==1/0}function fh(s,o){return Math.max(s+(o||0)-Date.now(),0)}function nn(s,o){return typeof s=="function"?s(o):s}function Rt(s,o){return typeof s=="function"?s(o):s}function gp(s,o){const{type:i="all",exact:u,fetchStatus:d,predicate:f,queryKey:m,stale:h}=s;if(m){if(u){if(o.queryHash!==uc(m,o.options))return!1}else if(!Mo(o.queryKey,m))return!1}if(i!=="all"){const v=o.isActive();if(i==="active"&&!v||i==="inactive"&&v)return!1}return!(typeof h=="boolean"&&o.isStale()!==h||d&&d!==o.state.fetchStatus||f&&!f(o))}function xp(s,o){const{exact:i,status:u,predicate:d,mutationKey:f}=s;if(f){if(!o.options.mutationKey)return!1;if(i){if(_o(o.options.mutationKey)!==_o(f))return!1}else if(!Mo(o.options.mutationKey,f))return!1}return!(u&&o.state.status!==u||d&&!d(o))}function uc(s,o){return((o==null?void 0:o.queryKeyHashFn)||_o)(s)}function _o(s){return JSON.stringify(s,(o,i)=>Au(i)?Object.keys(i).sort().reduce((u,d)=>(u[d]=i[d],u),{}):i)}function Mo(s,o){return s===o?!0:typeof s!=typeof o?!1:s&&o&&typeof s=="object"&&typeof o=="object"?Object.keys(o).every(i=>Mo(s[i],o[i])):!1}var Mx=Object.prototype.hasOwnProperty;function ph(s,o,i=0){if(s===o)return s;if(i>500)return o;const u=yp(s)&&yp(o);if(!u&&!(Au(s)&&Au(o)))return o;const f=(u?s:Object.keys(s)).length,m=u?o:Object.keys(o),h=m.length,v=u?new Array(h):{};let x=0;for(let b=0;b{kn.setTimeout(o,s)})}function zu(s,o,i){return typeof i.structuralSharing=="function"?i.structuralSharing(s,o):i.structuralSharing!==!1?ph(s,o):o}function Ox(s,o,i=0){const u=[...s,o];return i&&u.length>i?u.slice(1):u}function Dx(s,o,i=0){const u=[o,...s];return i&&u.length>i?u.slice(0,-1):u}var cc=Symbol();function hh(s,o){return!s.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!s.queryFn||s.queryFn===cc?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function mh(s,o){return typeof s=="function"?s(...o):!!s}function Tx(s,o,i){let u=!1,d;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(d??(d=o()),u||(u=!0,d.aborted?i():d.addEventListener("abort",i,{once:!0})),d)}),s}var Ro=(()=>{let s=()=>Px;return{isServer(){return s()},setIsServer(o){s=o}}})();function Lu(){let s,o;const i=new Promise((d,f)=>{s=d,o=f});i.status="pending",i.catch(()=>{});function u(d){Object.assign(i,d),delete i.resolve,delete i.reject}return i.resolve=d=>{u({status:"fulfilled",value:d}),s(d)},i.reject=d=>{u({status:"rejected",reason:d}),o(d)},i}var Ax=Ex;function zx(){let s=[],o=0,i=h=>{h()},u=h=>{h()},d=Ax;const f=h=>{o?s.push(h):d(()=>{i(h)})},m=()=>{const h=s;s=[],h.length&&d(()=>{u(()=>{h.forEach(v=>{i(v)})})})};return{batch:h=>{let v;o++;try{v=h()}finally{o--,o||m()}return v},batchCalls:h=>(...v)=>{f(()=>{h(...v)})},schedule:f,setNotifyFunction:h=>{i=h},setBatchNotifyFunction:h=>{u=h},setScheduler:h=>{d=h}}}var ot=zx(),ws,Yr,js,th,Lx=(th=class extends Ho{constructor(){super();ye(this,ws,!0);ye(this,Yr);ye(this,js);se(this,js,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o(!0),u=()=>o(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",u,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",u)}}})}onSubscribe(){S(this,Yr)||this.setEventListener(S(this,js))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,Yr))==null||o.call(this),se(this,Yr,void 0))}setEventListener(o){var i;se(this,js,o),(i=S(this,Yr))==null||i.call(this),se(this,Yr,o(this.setOnline.bind(this)))}setOnline(o){S(this,ws)!==o&&(se(this,ws,o),this.listeners.forEach(u=>{u(o)}))}isOnline(){return S(this,ws)}},ws=new WeakMap,Yr=new WeakMap,js=new WeakMap,th),mi=new Lx;function Ix(s){return Math.min(1e3*2**s,3e4)}function gh(s){return(s??"online")==="online"?mi.isOnline():!0}var Iu=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function xh(s){let o=!1,i=0,u;const d=Lu(),f=()=>d.status!=="pending",m=w=>{var C;if(!f()){const _=new Iu(w);M(_),(C=s.onCancel)==null||C.call(s,_)}},h=()=>{o=!0},v=()=>{o=!1},x=()=>ac.isFocused()&&(s.networkMode==="always"||mi.isOnline())&&s.canRun(),b=()=>gh(s.networkMode)&&s.canRun(),j=w=>{f()||(u==null||u(),d.resolve(w))},M=w=>{f()||(u==null||u(),d.reject(w))},D=()=>new Promise(w=>{var C;u=_=>{(f()||x())&&w(_)},(C=s.onPause)==null||C.call(s)}).then(()=>{var w;u=void 0,f()||(w=s.onContinue)==null||w.call(s)}),I=()=>{if(f())return;let w;const C=i===0?s.initialPromise:void 0;try{w=C??s.fn()}catch(_){w=Promise.reject(_)}Promise.resolve(w).then(j).catch(_=>{var F;if(f())return;const $=s.retry??(Ro.isServer()?0:3),H=s.retryDelay??Ix,z=typeof H=="function"?H(i,_):H,R=$===!0||typeof $=="number"&&i<$||typeof $=="function"&&$(i,_);if(o||!R){M(_);return}i++,(F=s.onFail)==null||F.call(s,i,_),Rx(z).then(()=>x()?void 0:D()).then(()=>{o?M(_):I()})})};return{promise:d,status:()=>d.status,cancel:m,continue:()=>(u==null||u(),d),cancelRetry:h,continueRetry:v,canStart:b,start:()=>(b()?I():D().then(I),d)}}var Sn,rh,yh=(rh=class{constructor(){ye(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Du(this.gcTime)&&se(this,Sn,kn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Ro.isServer()?1/0:300*1e3))}clearGcTimeout(){S(this,Sn)!==void 0&&(kn.clearTimeout(S(this,Sn)),se(this,Sn,void 0))}},Sn=new WeakMap,rh);function Fx(s){return{onFetch:(o,i)=>{var b,j,M,D,I;const u=o.options,d=(M=(j=(b=o.fetchOptions)==null?void 0:b.meta)==null?void 0:j.fetchMore)==null?void 0:M.direction,f=((D=o.state.data)==null?void 0:D.pages)||[],m=((I=o.state.data)==null?void 0:I.pageParams)||[];let h={pages:[],pageParams:[]},v=0;const x=async()=>{let w=!1;const C=H=>{Tx(H,()=>o.signal,()=>w=!0)},_=hh(o.options,o.fetchOptions),$=async(H,z,R)=>{if(w)return Promise.reject(o.signal.reason);if(z==null&&H.pages.length)return Promise.resolve(H);const K=(()=>{const ke={client:o.client,queryKey:o.queryKey,pageParam:z,direction:R?"backward":"forward",meta:o.options.meta};return C(ke),ke})(),ne=await _(K),{maxPages:ee}=o.options,J=R?Dx:Ox;return{pages:J(H.pages,ne,ee),pageParams:J(H.pageParams,z,ee)}};if(d&&f.length){const H=d==="backward",z=H?Ux:bp,R={pages:f,pageParams:m},F=z(u,R);h=await $(R,F,H)}else{const H=s??f.length;do{const z=v===0?m[0]??u.initialPageParam:bp(u,h);if(v>0&&z==null)break;h=await $(h,z),v++}while(v{var w,C;return(C=(w=o.options).persister)==null?void 0:C.call(w,x,{client:o.client,queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},i)}:o.fetchFn=x}}}function bp(s,{pages:o,pageParams:i}){const u=o.length-1;return o.length>0?s.getNextPageParam(o[u],o,i[u],i):void 0}function Ux(s,{pages:o,pageParams:i}){var u;return o.length>0?(u=s.getPreviousPageParam)==null?void 0:u.call(s,o[0],o,i[0],i):void 0}var ks,Cn,Ns,Ft,En,rt,Io,Pn,Mt,vh,vr,nh,$x=(nh=class extends yh{constructor(o){super();ye(this,Mt);ye(this,ks);ye(this,Cn);ye(this,Ns);ye(this,Ft);ye(this,En);ye(this,rt);ye(this,Io);ye(this,Pn);se(this,Pn,!1),se(this,Io,o.defaultOptions),this.setOptions(o.options),this.observers=[],se(this,En,o.client),se(this,Ft,S(this,En).getQueryCache()),this.queryKey=o.queryKey,this.queryHash=o.queryHash,se(this,Cn,jp(this.options)),this.state=o.state??S(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return S(this,ks)}get promise(){var o;return(o=S(this,rt))==null?void 0:o.promise}setOptions(o){if(this.options={...S(this,Io),...o},o!=null&&o._type&&se(this,ks,o._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=jp(this.options);i.data!==void 0&&(this.setState(wp(i.data,i.dataUpdatedAt)),se(this,Cn,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,Ft).remove(this)}setData(o,i){const u=zu(this.state.data,o,this.options);return Ce(this,Mt,vr).call(this,{data:u,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),u}setState(o){Ce(this,Mt,vr).call(this,{type:"setState",state:o})}cancel(o){var u,d;const i=(u=S(this,rt))==null?void 0:u.promise;return(d=S(this,rt))==null||d.cancel(o),i?i.then(kt).catch(kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return S(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(o=>Rt(o.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cc||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(o=>nn(o.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(o=>o.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(o=0){return this.state.data===void 0?!0:o==="static"?!1:this.state.isInvalidated?!0:!fh(this.state.dataUpdatedAt,o)}onFocus(){var i;const o=this.observers.find(u=>u.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,rt))==null||i.continue()}onOnline(){var i;const o=this.observers.find(u=>u.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,rt))==null||i.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),S(this,Ft).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(i=>i!==o),this.observers.length||(S(this,rt)&&(S(this,Pn)||Ce(this,Mt,vh).call(this)?S(this,rt).cancel({revert:!0}):S(this,rt).cancelRetry()),this.scheduleGc()),S(this,Ft).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ce(this,Mt,vr).call(this,{type:"invalidate"})}async fetch(o,i){var x,b,j,M,D,I,w,C,_,$,H;if(this.state.fetchStatus!=="idle"&&((x=S(this,rt))==null?void 0:x.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(S(this,rt))return S(this,rt).continueRetry(),S(this,rt).promise}if(o&&this.setOptions(o),!this.options.queryFn){const z=this.observers.find(R=>R.options.queryFn);z&&this.setOptions(z.options)}const u=new AbortController,d=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(se(this,Pn,!0),u.signal)})},f=()=>{const z=hh(this.options,i),F=(()=>{const K={client:S(this,En),queryKey:this.queryKey,meta:this.meta};return d(K),K})();return se(this,Pn,!1),this.options.persister?this.options.persister(z,F,this):z(F)},h=(()=>{const z={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:S(this,En),state:this.state,fetchFn:f};return d(z),z})(),v=S(this,ks)==="infinite"?Fx(this.options.pages):this.options.behavior;v==null||v.onFetch(h,this),se(this,Ns,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=h.fetchOptions)==null?void 0:b.meta))&&Ce(this,Mt,vr).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta}),se(this,rt,xh({initialPromise:i==null?void 0:i.initialPromise,fn:h.fetchFn,onCancel:z=>{z instanceof Iu&&z.revert&&this.setState({...S(this,Ns),fetchStatus:"idle"}),u.abort()},onFail:(z,R)=>{Ce(this,Mt,vr).call(this,{type:"failed",failureCount:z,error:R})},onPause:()=>{Ce(this,Mt,vr).call(this,{type:"pause"})},onContinue:()=>{Ce(this,Mt,vr).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const z=await S(this,rt).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(D=(M=S(this,Ft).config).onSuccess)==null||D.call(M,z,this),(w=(I=S(this,Ft).config).onSettled)==null||w.call(I,z,this.state.error,this),z}catch(z){if(z instanceof Iu){if(z.silent)return S(this,rt).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw Ce(this,Mt,vr).call(this,{type:"error",error:z}),(_=(C=S(this,Ft).config).onError)==null||_.call(C,z,this),(H=($=S(this,Ft).config).onSettled)==null||H.call($,this.state.data,z,this),z}finally{this.scheduleGc()}}},ks=new WeakMap,Cn=new WeakMap,Ns=new WeakMap,Ft=new WeakMap,En=new WeakMap,rt=new WeakMap,Io=new WeakMap,Pn=new WeakMap,Mt=new WeakSet,vh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},vr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...u,fetchStatus:"paused"};case"continue":return{...u,fetchStatus:"fetching"};case"fetch":return{...u,...bh(u.data,this.options),fetchMeta:o.meta??null};case"success":const d={...u,...wp(o.data,o.dataUpdatedAt),dataUpdateCount:u.dataUpdateCount+1,...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return se(this,Ns,o.manual?d:void 0),d;case"error":const f=o.error;return{...u,error:f,errorUpdateCount:u.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:u.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...u,isInvalidated:!0};case"setState":return{...u,...o.state}}};this.state=i(this.state),ot.batch(()=>{this.observers.forEach(u=>{u.onQueryUpdate()}),S(this,Ft).notify({query:this,type:"updated",action:o})})},nh);function bh(s,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gh(o.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function wp(s,o){return{data:s,dataUpdatedAt:o??Date.now(),error:null,isInvalidated:!1,status:"success"}}function jp(s){const o=typeof s.initialData=="function"?s.initialData():s.initialData,i=o!==void 0,u=i?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:i?u??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var jt,Pe,Fo,ht,_n,Ss,br,Jr,Uo,Cs,Es,Mn,Rn,Xr,Ps,Ae,Po,Fu,Uu,$u,Bu,Hu,Wu,Vu,wh,sh,Bx=(sh=class extends Ho{constructor(o,i){super();ye(this,Ae);ye(this,jt);ye(this,Pe);ye(this,Fo);ye(this,ht);ye(this,_n);ye(this,Ss);ye(this,br);ye(this,Jr);ye(this,Uo);ye(this,Cs);ye(this,Es);ye(this,Mn);ye(this,Rn);ye(this,Xr);ye(this,Ps,new Set);this.options=i,se(this,jt,o),se(this,Jr,null),se(this,br,Lu()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(S(this,Pe).addObserver(this),kp(S(this,Pe),this.options)?Ce(this,Ae,Po).call(this):this.updateResult(),Ce(this,Ae,Bu).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gu(S(this,Pe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gu(S(this,Pe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ce(this,Ae,Hu).call(this),Ce(this,Ae,Wu).call(this),S(this,Pe).removeObserver(this)}setOptions(o){const i=this.options,u=S(this,Pe);if(this.options=S(this,jt).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,S(this,Pe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ce(this,Ae,Vu).call(this),S(this,Pe).setOptions(this.options),i._defaulted&&!Tu(this.options,i)&&S(this,jt).getQueryCache().notify({type:"observerOptionsUpdated",query:S(this,Pe),observer:this});const d=this.hasListeners();d&&Np(S(this,Pe),u,this.options,i)&&Ce(this,Ae,Po).call(this),this.updateResult(),d&&(S(this,Pe)!==u||Rt(this.options.enabled,S(this,Pe))!==Rt(i.enabled,S(this,Pe))||nn(this.options.staleTime,S(this,Pe))!==nn(i.staleTime,S(this,Pe)))&&Ce(this,Ae,Fu).call(this);const f=Ce(this,Ae,Uu).call(this);d&&(S(this,Pe)!==u||Rt(this.options.enabled,S(this,Pe))!==Rt(i.enabled,S(this,Pe))||f!==S(this,Xr))&&Ce(this,Ae,$u).call(this,f)}getOptimisticResult(o){const i=S(this,jt).getQueryCache().build(S(this,jt),o),u=this.createResult(i,o);return Wx(this,u)&&(se(this,ht,u),se(this,Ss,this.options),se(this,_n,S(this,Pe).state)),u}getCurrentResult(){return S(this,ht)}trackResult(o,i){return new Proxy(o,{get:(u,d)=>(this.trackProp(d),i==null||i(d),d==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&S(this,br).status==="pending"&&S(this,br).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(u,d))})}trackProp(o){S(this,Ps).add(o)}getCurrentQuery(){return S(this,Pe)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const i=S(this,jt).defaultQueryOptions(o),u=S(this,jt).getQueryCache().build(S(this,jt),i);return u.fetch().then(()=>this.createResult(u,i))}fetch(o){return Ce(this,Ae,Po).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),S(this,ht)))}createResult(o,i){var ee;const u=S(this,Pe),d=this.options,f=S(this,ht),m=S(this,_n),h=S(this,Ss),x=o!==u?o.state:S(this,Fo),{state:b}=o;let j={...b},M=!1,D;if(i._optimisticResults){const J=this.hasListeners(),ke=!J&&kp(o,i),ue=J&&Np(o,u,i,d);(ke||ue)&&(j={...j,...bh(b.data,o.options)}),i._optimisticResults==="isRestoring"&&(j.fetchStatus="idle")}let{error:I,errorUpdatedAt:w,status:C}=j;D=j.data;let _=!1;if(i.placeholderData!==void 0&&D===void 0&&C==="pending"){let J;f!=null&&f.isPlaceholderData&&i.placeholderData===(h==null?void 0:h.placeholderData)?(J=f.data,_=!0):J=typeof i.placeholderData=="function"?i.placeholderData((ee=S(this,Es))==null?void 0:ee.state.data,S(this,Es)):i.placeholderData,J!==void 0&&(C="success",D=zu(f==null?void 0:f.data,J,i),M=!0)}if(i.select&&D!==void 0&&!_)if(f&&D===(m==null?void 0:m.data)&&i.select===S(this,Uo))D=S(this,Cs);else try{se(this,Uo,i.select),D=i.select(D),D=zu(f==null?void 0:f.data,D,i),se(this,Cs,D),se(this,Jr,null)}catch(J){se(this,Jr,J)}S(this,Jr)&&(I=S(this,Jr),D=S(this,Cs),w=Date.now(),C="error");const $=j.fetchStatus==="fetching",H=C==="pending",z=C==="error",R=H&&$,F=D!==void 0,ne={status:C,fetchStatus:j.fetchStatus,isPending:H,isSuccess:C==="success",isError:z,isInitialLoading:R,isLoading:R,data:D,dataUpdatedAt:j.dataUpdatedAt,error:I,errorUpdatedAt:w,failureCount:j.fetchFailureCount,failureReason:j.fetchFailureReason,errorUpdateCount:j.errorUpdateCount,isFetched:o.isFetched(),isFetchedAfterMount:j.dataUpdateCount>x.dataUpdateCount||j.errorUpdateCount>x.errorUpdateCount,isFetching:$,isRefetching:$&&!H,isLoadingError:z&&!F,isPaused:j.fetchStatus==="paused",isPlaceholderData:M,isRefetchError:z&&F,isStale:dc(o,i),refetch:this.refetch,promise:S(this,br),isEnabled:Rt(i.enabled,o)!==!1};if(this.options.experimental_prefetchInRender){const J=ne.data!==void 0,ke=ne.status==="error"&&!J,ue=Oe=>{ke?Oe.reject(ne.error):J&&Oe.resolve(ne.data)},Le=()=>{const Oe=se(this,br,ne.promise=Lu());ue(Oe)},_e=S(this,br);switch(_e.status){case"pending":o.queryHash===u.queryHash&&ue(_e);break;case"fulfilled":(ke||ne.data!==_e.value)&&Le();break;case"rejected":(!ke||ne.error!==_e.reason)&&Le();break}}return ne}updateResult(){const o=S(this,ht),i=this.createResult(S(this,Pe),this.options);if(se(this,_n,S(this,Pe).state),se(this,Ss,this.options),S(this,_n).data!==void 0&&se(this,Es,S(this,Pe)),Tu(i,o))return;se(this,ht,i);const u=()=>{if(!o)return!0;const{notifyOnChangeProps:d}=this.options,f=typeof d=="function"?d():d;if(f==="all"||!f&&!S(this,Ps).size)return!0;const m=new Set(f??S(this,Ps));return this.options.throwOnError&&m.add("error"),Object.keys(S(this,ht)).some(h=>{const v=h;return S(this,ht)[v]!==o[v]&&m.has(v)})};Ce(this,Ae,wh).call(this,{listeners:u()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ce(this,Ae,Bu).call(this)}},jt=new WeakMap,Pe=new WeakMap,Fo=new WeakMap,ht=new WeakMap,_n=new WeakMap,Ss=new WeakMap,br=new WeakMap,Jr=new WeakMap,Uo=new WeakMap,Cs=new WeakMap,Es=new WeakMap,Mn=new WeakMap,Rn=new WeakMap,Xr=new WeakMap,Ps=new WeakMap,Ae=new WeakSet,Po=function(o){Ce(this,Ae,Vu).call(this);let i=S(this,Pe).fetch(this.options,o);return o!=null&&o.throwOnError||(i=i.catch(kt)),i},Fu=function(){Ce(this,Ae,Hu).call(this);const o=nn(this.options.staleTime,S(this,Pe));if(Ro.isServer()||S(this,ht).isStale||!Du(o))return;const u=fh(S(this,ht).dataUpdatedAt,o)+1;se(this,Mn,kn.setTimeout(()=>{S(this,ht).isStale||this.updateResult()},u))},Uu=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(S(this,Pe)):this.options.refetchInterval)??!1},$u=function(o){Ce(this,Ae,Wu).call(this),se(this,Xr,o),!(Ro.isServer()||Rt(this.options.enabled,S(this,Pe))===!1||!Du(S(this,Xr))||S(this,Xr)===0)&&se(this,Rn,kn.setInterval(()=>{(this.options.refetchIntervalInBackground||ac.isFocused())&&Ce(this,Ae,Po).call(this)},S(this,Xr)))},Bu=function(){Ce(this,Ae,Fu).call(this),Ce(this,Ae,$u).call(this,Ce(this,Ae,Uu).call(this))},Hu=function(){S(this,Mn)!==void 0&&(kn.clearTimeout(S(this,Mn)),se(this,Mn,void 0))},Wu=function(){S(this,Rn)!==void 0&&(kn.clearInterval(S(this,Rn)),se(this,Rn,void 0))},Vu=function(){const o=S(this,jt).getQueryCache().build(S(this,jt),this.options);if(o===S(this,Pe))return;const i=S(this,Pe);se(this,Pe,o),se(this,Fo,o.state),this.hasListeners()&&(i==null||i.removeObserver(this),o.addObserver(this))},wh=function(o){ot.batch(()=>{o.listeners&&this.listeners.forEach(i=>{i(S(this,ht))}),S(this,jt).getQueryCache().notify({query:S(this,Pe),type:"observerResultsUpdated"})})},sh);function Hx(s,o){return Rt(o.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&Rt(o.retryOnMount,s)===!1)}function kp(s,o){return Hx(s,o)||s.state.data!==void 0&&Gu(s,o,o.refetchOnMount)}function Gu(s,o,i){if(Rt(o.enabled,s)!==!1&&nn(o.staleTime,s)!=="static"){const u=typeof i=="function"?i(s):i;return u==="always"||u!==!1&&dc(s,o)}return!1}function Np(s,o,i,u){return(s!==o||Rt(u.enabled,s)===!1)&&(!i.suspense||s.state.status!=="error")&&dc(s,i)}function dc(s,o){return Rt(o.enabled,s)!==!1&&s.isStaleByTime(nn(o.staleTime,s))}function Wx(s,o){return!Tu(s.getCurrentResult(),o)}var $o,rr,dt,On,nr,Kr,oh,Vx=(oh=class extends yh{constructor(o){super();ye(this,nr);ye(this,$o);ye(this,rr);ye(this,dt);ye(this,On);se(this,$o,o.client),this.mutationId=o.mutationId,se(this,dt,o.mutationCache),se(this,rr,[]),this.state=o.state||Gx(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){S(this,rr).includes(o)||(S(this,rr).push(o),this.clearGcTimeout(),S(this,dt).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){se(this,rr,S(this,rr).filter(i=>i!==o)),this.scheduleGc(),S(this,dt).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){S(this,rr).length||(this.state.status==="pending"?this.scheduleGc():S(this,dt).remove(this))}continue(){var o;return((o=S(this,On))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var m,h,v,x,b,j,M,D,I,w,C,_,$,H,z,R,F,K;const i=()=>{Ce(this,nr,Kr).call(this,{type:"continue"})},u={client:S(this,$o),meta:this.options.meta,mutationKey:this.options.mutationKey};se(this,On,xh({fn:()=>this.options.mutationFn?this.options.mutationFn(o,u):Promise.reject(new Error("No mutationFn found")),onFail:(ne,ee)=>{Ce(this,nr,Kr).call(this,{type:"failed",failureCount:ne,error:ee})},onPause:()=>{Ce(this,nr,Kr).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,dt).canRun(this)}));const d=this.state.status==="pending",f=!S(this,On).canStart();try{if(d)i();else{Ce(this,nr,Kr).call(this,{type:"pending",variables:o,isPaused:f}),S(this,dt).config.onMutate&&await S(this,dt).config.onMutate(o,this,u);const ee=await((h=(m=this.options).onMutate)==null?void 0:h.call(m,o,u));ee!==this.state.context&&Ce(this,nr,Kr).call(this,{type:"pending",context:ee,variables:o,isPaused:f})}const ne=await S(this,On).start();return await((x=(v=S(this,dt).config).onSuccess)==null?void 0:x.call(v,ne,o,this.state.context,this,u)),await((j=(b=this.options).onSuccess)==null?void 0:j.call(b,ne,o,this.state.context,u)),await((D=(M=S(this,dt).config).onSettled)==null?void 0:D.call(M,ne,null,this.state.variables,this.state.context,this,u)),await((w=(I=this.options).onSettled)==null?void 0:w.call(I,ne,null,o,this.state.context,u)),Ce(this,nr,Kr).call(this,{type:"success",data:ne}),ne}catch(ne){try{await((_=(C=S(this,dt).config).onError)==null?void 0:_.call(C,ne,o,this.state.context,this,u))}catch(ee){Promise.reject(ee)}try{await((H=($=this.options).onError)==null?void 0:H.call($,ne,o,this.state.context,u))}catch(ee){Promise.reject(ee)}try{await((R=(z=S(this,dt).config).onSettled)==null?void 0:R.call(z,void 0,ne,this.state.variables,this.state.context,this,u))}catch(ee){Promise.reject(ee)}try{await((K=(F=this.options).onSettled)==null?void 0:K.call(F,void 0,ne,o,this.state.context,u))}catch(ee){Promise.reject(ee)}throw Ce(this,nr,Kr).call(this,{type:"error",error:ne}),ne}finally{S(this,dt).runNext(this)}}},$o=new WeakMap,rr=new WeakMap,dt=new WeakMap,On=new WeakMap,nr=new WeakSet,Kr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...u,isPaused:!0};case"continue":return{...u,isPaused:!1};case"pending":return{...u,context:o.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:o.isPaused,status:"pending",variables:o.variables,submittedAt:Date.now()};case"success":return{...u,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...u,data:void 0,error:o.error,failureCount:u.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=i(this.state),ot.batch(()=>{S(this,rr).forEach(u=>{u.onMutationUpdate(o)}),S(this,dt).notify({mutation:this,type:"updated",action:o})})},oh);function Gx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wr,Qt,Bo,lh,Kx=(lh=class extends Ho{constructor(o={}){super();ye(this,wr);ye(this,Qt);ye(this,Bo);this.config=o,se(this,wr,new Set),se(this,Qt,new Map),se(this,Bo,0)}build(o,i,u){const d=new Vx({client:o,mutationCache:this,mutationId:++ei(this,Bo)._,options:o.defaultMutationOptions(i),state:u});return this.add(d),d}add(o){S(this,wr).add(o);const i=ri(o);if(typeof i=="string"){const u=S(this,Qt).get(i);u?u.push(o):S(this,Qt).set(i,[o])}this.notify({type:"added",mutation:o})}remove(o){if(S(this,wr).delete(o)){const i=ri(o);if(typeof i=="string"){const u=S(this,Qt).get(i);if(u)if(u.length>1){const d=u.indexOf(o);d!==-1&&u.splice(d,1)}else u[0]===o&&S(this,Qt).delete(i)}}this.notify({type:"removed",mutation:o})}canRun(o){const i=ri(o);if(typeof i=="string"){const u=S(this,Qt).get(i),d=u==null?void 0:u.find(f=>f.state.status==="pending");return!d||d===o}else return!0}runNext(o){var u;const i=ri(o);if(typeof i=="string"){const d=(u=S(this,Qt).get(i))==null?void 0:u.find(f=>f!==o&&f.state.isPaused);return(d==null?void 0:d.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ot.batch(()=>{S(this,wr).forEach(o=>{this.notify({type:"removed",mutation:o})}),S(this,wr).clear(),S(this,Qt).clear()})}getAll(){return Array.from(S(this,wr))}find(o){const i={exact:!0,...o};return this.getAll().find(u=>xp(i,u))}findAll(o={}){return this.getAll().filter(i=>xp(o,i))}notify(o){ot.batch(()=>{this.listeners.forEach(i=>{i(o)})})}resumePausedMutations(){const o=this.getAll().filter(i=>i.state.isPaused);return ot.batch(()=>Promise.all(o.map(i=>i.continue().catch(kt))))}},wr=new WeakMap,Qt=new WeakMap,Bo=new WeakMap,lh);function ri(s){var o;return(o=s.options.scope)==null?void 0:o.id}var sr,ih,Qx=(ih=class extends Ho{constructor(o={}){super();ye(this,sr);this.config=o,se(this,sr,new Map)}build(o,i,u){const d=i.queryKey,f=i.queryHash??uc(d,i);let m=this.get(f);return m||(m=new $x({client:o,queryKey:d,queryHash:f,options:o.defaultQueryOptions(i),state:u,defaultOptions:o.getQueryDefaults(d)}),this.add(m)),m}add(o){S(this,sr).has(o.queryHash)||(S(this,sr).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const i=S(this,sr).get(o.queryHash);i&&(o.destroy(),i===o&&S(this,sr).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){ot.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return S(this,sr).get(o)}getAll(){return[...S(this,sr).values()]}find(o){const i={exact:!0,...o};return this.getAll().find(u=>gp(i,u))}findAll(o={}){const i=this.getAll();return Object.keys(o).length>0?i.filter(u=>gp(o,u)):i}notify(o){ot.batch(()=>{this.listeners.forEach(i=>{i(o)})})}onFocus(){ot.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){ot.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},sr=new WeakMap,ih),Ke,en,tn,_s,Ms,rn,Rs,Os,ah,qx=(ah=class{constructor(s={}){ye(this,Ke);ye(this,en);ye(this,tn);ye(this,_s);ye(this,Ms);ye(this,rn);ye(this,Rs);ye(this,Os);se(this,Ke,s.queryCache||new Qx),se(this,en,s.mutationCache||new Kx),se(this,tn,s.defaultOptions||{}),se(this,_s,new Map),se(this,Ms,new Map),se(this,rn,0)}mount(){ei(this,rn)._++,S(this,rn)===1&&(se(this,Rs,ac.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Ke).onFocus())})),se(this,Os,mi.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Ke).onOnline())})))}unmount(){var s,o;ei(this,rn)._--,S(this,rn)===0&&((s=S(this,Rs))==null||s.call(this),se(this,Rs,void 0),(o=S(this,Os))==null||o.call(this),se(this,Os,void 0))}isFetching(s){return S(this,Ke).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return S(this,en).findAll({...s,status:"pending"}).length}getQueryData(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Ke).get(o.queryHash))==null?void 0:i.state.data}ensureQueryData(s){const o=this.defaultQueryOptions(s),i=S(this,Ke).build(this,o),u=i.state.data;return u===void 0?this.fetchQuery(s):(s.revalidateIfStale&&i.isStaleByTime(nn(o.staleTime,i))&&this.prefetchQuery(o),Promise.resolve(u))}getQueriesData(s){return S(this,Ke).findAll(s).map(({queryKey:o,state:i})=>{const u=i.data;return[o,u]})}setQueryData(s,o,i){const u=this.defaultQueryOptions({queryKey:s}),d=S(this,Ke).get(u.queryHash),f=d==null?void 0:d.state.data,m=_x(o,f);if(m!==void 0)return S(this,Ke).build(this,u).setData(m,{...i,manual:!0})}setQueriesData(s,o,i){return ot.batch(()=>S(this,Ke).findAll(s).map(({queryKey:u})=>[u,this.setQueryData(u,o,i)]))}getQueryState(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Ke).get(o.queryHash))==null?void 0:i.state}removeQueries(s){const o=S(this,Ke);ot.batch(()=>{o.findAll(s).forEach(i=>{o.remove(i)})})}resetQueries(s,o){const i=S(this,Ke);return ot.batch(()=>(i.findAll(s).forEach(u=>{u.reset()}),this.refetchQueries({type:"active",...s},o)))}cancelQueries(s,o={}){const i={revert:!0,...o},u=ot.batch(()=>S(this,Ke).findAll(s).map(d=>d.cancel(i)));return Promise.all(u).then(kt).catch(kt)}invalidateQueries(s,o={}){return ot.batch(()=>(S(this,Ke).findAll(s).forEach(i=>{i.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},o)))}refetchQueries(s,o={}){const i={...o,cancelRefetch:o.cancelRefetch??!0},u=ot.batch(()=>S(this,Ke).findAll(s).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let f=d.fetch(void 0,i);return i.throwOnError||(f=f.catch(kt)),d.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(u).then(kt)}fetchQuery(s){const o=this.defaultQueryOptions(s);o.retry===void 0&&(o.retry=!1);const i=S(this,Ke).build(this,o);return i.isStaleByTime(nn(o.staleTime,i))?i.fetch(o):Promise.resolve(i.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(kt).catch(kt)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(kt).catch(kt)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return mi.isOnline()?S(this,en).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,Ke)}getMutationCache(){return S(this,en)}getDefaultOptions(){return S(this,tn)}setDefaultOptions(s){se(this,tn,s)}setQueryDefaults(s,o){S(this,_s).set(_o(s),{queryKey:s,defaultOptions:o})}getQueryDefaults(s){const o=[...S(this,_s).values()],i={};return o.forEach(u=>{Mo(s,u.queryKey)&&Object.assign(i,u.defaultOptions)}),i}setMutationDefaults(s,o){S(this,Ms).set(_o(s),{mutationKey:s,defaultOptions:o})}getMutationDefaults(s){const o=[...S(this,Ms).values()],i={};return o.forEach(u=>{Mo(s,u.mutationKey)&&Object.assign(i,u.defaultOptions)}),i}defaultQueryOptions(s){if(s._defaulted)return s;const o={...S(this,tn).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return o.queryHash||(o.queryHash=uc(o.queryKey,o)),o.refetchOnReconnect===void 0&&(o.refetchOnReconnect=o.networkMode!=="always"),o.throwOnError===void 0&&(o.throwOnError=!!o.suspense),!o.networkMode&&o.persister&&(o.networkMode="offlineFirst"),o.queryFn===cc&&(o.enabled=!1),o}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...S(this,tn).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){S(this,Ke).clear(),S(this,en).clear()}},Ke=new WeakMap,en=new WeakMap,tn=new WeakMap,_s=new WeakMap,Ms=new WeakMap,rn=new WeakMap,Rs=new WeakMap,Os=new WeakMap,ah),jh=g.createContext(void 0),zs=s=>{const o=g.useContext(jh);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},Zx=({client:s,children:o})=>(g.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),n.jsx(jh.Provider,{value:s,children:o})),kh=g.createContext(!1),Yx=()=>g.useContext(kh);kh.Provider;function Jx(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Xx=g.createContext(Jx()),e0=()=>g.useContext(Xx),t0=(s,o,i)=>{const u=i!=null&&i.state.error&&typeof s.throwOnError=="function"?mh(s.throwOnError,[i.state.error,i]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||u)&&(o.isReset()||(s.retryOnMount=!1))},r0=s=>{g.useEffect(()=>{s.clearReset()},[s])},n0=({result:s,errorResetBoundary:o,throwOnError:i,query:u,suspense:d})=>s.isError&&!o.isReset()&&!s.isFetching&&u&&(d&&s.data===void 0||mh(i,[s.error,u])),s0=s=>{if(s.suspense){const i=d=>d==="static"?d:Math.max(d??1e3,1e3),u=s.staleTime;s.staleTime=typeof u=="function"?(...d)=>i(u(...d)):i(u),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},o0=(s,o)=>s.isLoading&&s.isFetching&&!o,l0=(s,o)=>(s==null?void 0:s.suspense)&&o.isPending,Sp=(s,o,i)=>o.fetchOptimistic(s).catch(()=>{i.clearReset()});function i0(s,o,i){var D,I,w,C;const u=Yx(),d=e0(),f=zs(),m=f.defaultQueryOptions(s);(I=(D=f.getDefaultOptions().queries)==null?void 0:D._experimental_beforeQuery)==null||I.call(D,m);const h=f.getQueryCache().get(m.queryHash),v=s.subscribed!==!1;m._optimisticResults=u?"isRestoring":v?"optimistic":void 0,s0(m),t0(m,d,h),r0(d);const x=!f.getQueryCache().get(m.queryHash),[b]=g.useState(()=>new o(f,m)),j=b.getOptimisticResult(m),M=!u&&v;if(g.useSyncExternalStore(g.useCallback(_=>{const $=M?b.subscribe(ot.batchCalls(_)):kt;return b.updateResult(),$},[b,M]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),g.useEffect(()=>{b.setOptions(m)},[m,b]),l0(m,j))throw Sp(m,b,d);if(n0({result:j,errorResetBoundary:d,throwOnError:m.throwOnError,query:h,suspense:m.suspense}))throw j.error;if((C=(w=f.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||C.call(w,m,j),m.experimental_prefetchInRender&&!Ro.isServer()&&o0(j,u)){const _=x?Sp(m,b,d):h==null?void 0:h.promise;_==null||_.catch(kt).finally(()=>{b.updateResult()})}return m.notifyOnChangeProps?j:b.trackResult(j)}function lr(s,o){return i0(s,Bx)}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a0=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nh=(...s)=>s.filter((o,i,u)=>!!o&&o.trim()!==""&&u.indexOf(o)===i).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var u0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c0=g.forwardRef(({color:s="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:m,...h},v)=>g.createElement("svg",{ref:v,...u0,width:o,height:o,stroke:s,strokeWidth:u?Number(i)*24/Number(o):i,className:Nh("lucide",d),...h},[...m.map(([x,b])=>g.createElement(x,b)),...Array.isArray(f)?f:[f]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ve=(s,o)=>{const i=g.forwardRef(({className:u,...d},f)=>g.createElement(c0,{ref:f,iconNode:o,className:Nh(`lucide-${a0(s)}`,u),...d}));return i.displayName=`${s}`,i};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gi=ve("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cp=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sh=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oo=ve("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d0=ve("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Do=ve("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ds=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f0=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p0=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h0=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m0=ve("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g0=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x0=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ku=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y0=ve("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v0=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qu=ve("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b0=ve("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ch=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ot=ve("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tn=ve("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xi=ve("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ep=ve("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qu=ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w0=ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j0=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zu=ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k0=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N0=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const To=ve("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S0=ve("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C0=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E0=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eh=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ph=ve("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dn=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P0=ve("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _0=ve("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fc=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M0=ve("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R0=ve("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const An=ve("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O0=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _h=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D0=ve("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yi=ve("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yu=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T0=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A0=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vi=ve("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zn=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ju=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:S0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:d0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:Ot},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Do},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:E0},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Oo},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:g0}];var Pp=1,z0=.9,L0=.8,I0=.17,wu=.1,ju=.999,F0=.9999,U0=.99,$0=/[\\\/_+.#"@\[\(\{&]/,B0=/[\\\/_+.#"@\[\(\{&]/g,H0=/[\s-]/,Mh=/[\s-]/g;function Xu(s,o,i,u,d,f,m){if(f===o.length)return d===s.length?Pp:U0;var h=`${d},${f}`;if(m[h]!==void 0)return m[h];for(var v=u.charAt(f),x=i.indexOf(v,d),b=0,j,M,D,I;x>=0;)j=Xu(s,o,i,u,x+1,f+1,m),j>b&&(x===d?j*=Pp:$0.test(s.charAt(x-1))?(j*=L0,D=s.slice(d,x-1).match(B0),D&&d>0&&(j*=Math.pow(ju,D.length))):H0.test(s.charAt(x-1))?(j*=z0,I=s.slice(d,x-1).match(Mh),I&&d>0&&(j*=Math.pow(ju,I.length))):(j*=I0,d>0&&(j*=Math.pow(ju,x-d))),s.charAt(x)!==o.charAt(f)&&(j*=F0)),(jj&&(j=M*wu)),j>b&&(b=j),x=i.indexOf(v,x+1);return m[h]=b,b}function _p(s){return s.toLowerCase().replace(Mh," ")}function W0(s,o,i){return s=i&&i.length>0?`${s+" "+i.join(" ")}`:s,Xu(s,o,_p(s),_p(o),0,0,{})}function sn(s,o,{checkForDefaultPrevented:i=!0}={}){return function(d){if(s==null||s(d),i===!1||!d.defaultPrevented)return o==null?void 0:o(d)}}function Mp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Ts(...s){return o=>{let i=!1;const u=s.map(d=>{const f=Mp(d,o);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let d=0;d{var _;const{scope:M,children:D,...I}=j,w=((_=M==null?void 0:M[s])==null?void 0:_[v])||h,C=g.useMemo(()=>I,Object.values(I));return n.jsx(w.Provider,{value:C,children:D})};x.displayName=f+"Provider";function b(j,M){var w;const D=((w=M==null?void 0:M[s])==null?void 0:w[v])||h,I=g.useContext(D);if(I)return I;if(m!==void 0)return m;throw new Error(`\`${j}\` must be used within \`${f}\``)}return[x,b]}const d=()=>{const f=i.map(m=>g.createContext(m));return function(h){const v=(h==null?void 0:h[s])||f;return g.useMemo(()=>({[`__scope${s}`]:{...h,[s]:v}}),[h,v])}};return d.scopeName=s,[u,G0(d,...o)]}function G0(...s){const o=s[0];if(s.length===1)return o;const i=()=>{const u=s.map(d=>({useScope:d(),scopeName:d.scopeName}));return function(f){const m=u.reduce((h,{useScope:v,scopeName:x})=>{const j=v(f)[`__scope${x}`];return{...h,...j}},{});return g.useMemo(()=>({[`__scope${o.scopeName}`]:m}),[m])}};return i.scopeName=o.scopeName,i}var Ao=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},K0=ic[" useId ".trim().toString()]||(()=>{}),Q0=0;function jr(s){const[o,i]=g.useState(K0());return Ao(()=>{i(u=>u??String(Q0++))},[s]),o?`radix-${o}`:""}var q0=ic[" useInsertionEffect ".trim().toString()]||Ao;function Z0({prop:s,defaultProp:o,onChange:i=()=>{},caller:u}){const[d,f,m]=Y0({defaultProp:o,onChange:i}),h=s!==void 0,v=h?s:d;{const b=g.useRef(s!==void 0);g.useEffect(()=>{const j=b.current;j!==h&&console.warn(`${u} is changing from ${j?"controlled":"uncontrolled"} to ${h?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=h},[h,u])}const x=g.useCallback(b=>{var j;if(h){const M=J0(b)?b(s):b;M!==s&&((j=m.current)==null||j.call(m,M))}else f(b)},[h,s,f,m]);return[v,x]}function Y0({defaultProp:s,onChange:o}){const[i,u]=g.useState(s),d=g.useRef(i),f=g.useRef(o);return q0(()=>{f.current=o},[o]),g.useEffect(()=>{var m;d.current!==i&&((m=f.current)==null||m.call(f,i),d.current=i)},[i,d]),[i,u,f]}function J0(s){return typeof s=="function"}var Rh=dh();function Oh(s){const o=g.forwardRef((i,u)=>{let{children:d,...f}=i,m=null,h=!1;const v=[];Rp(d)&&typeof ni=="function"&&(d=ni(d._payload)),g.Children.forEach(d,M=>{var D;if(ny(M)){h=!0;const I=M;let w="child"in I.props?I.props.child:I.props.children;Rp(w)&&typeof ni=="function"&&(w=ni(w._payload)),m=ey(I,w),v.push((D=m==null?void 0:m.props)==null?void 0:D.children)}else v.push(M)}),m?m=g.cloneElement(m,void 0,v):!h&&g.Children.count(d)===1&&g.isValidElement(d)&&(m=d);const x=m?ry(m):void 0,b=In(u,x);if(!m){if(d||d===0)throw new Error(h?iy(s):ly(s));return d}const j=ty(f,m.props??{});return m.type!==g.Fragment&&(j.ref=u?b:x),g.cloneElement(m,j)});return o.displayName=`${s}.Slot`,o}var X0=Symbol.for("radix.slottable"),ey=(s,o)=>{if("child"in s.props){const i=s.props.child;return g.isValidElement(i)?g.cloneElement(i,void 0,s.props.children(i.props.children)):null}return g.isValidElement(o)?o:null};function ty(s,o){const i={...o};for(const u in o){const d=s[u],f=o[u];/^on[A-Z]/.test(u)?d&&f?i[u]=(...h)=>{const v=f(...h);return d(...h),v}:d&&(i[u]=d):u==="style"?i[u]={...d,...f}:u==="className"&&(i[u]=[d,f].filter(Boolean).join(" "))}return{...s,...i}}function ry(s){var u,d;let o=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,i=o&&"isReactWarning"in o&&o.isReactWarning;return i?s.ref:(o=(d=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:d.get,i=o&&"isReactWarning"in o&&o.isReactWarning,i?s.props.ref:s.props.ref||s.ref)}function ny(s){return g.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===X0}var sy=Symbol.for("react.lazy");function Rp(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===sy&&"_payload"in s&&oy(s._payload)}function oy(s){return typeof s=="object"&&s!==null&&"then"in s}var ly=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,iy=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ni=ic[" use ".trim().toString()],ay=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=ay.reduce((s,o)=>{const i=Oh(`Primitive.${o}`),u=g.forwardRef((d,f)=>{const{asChild:m,...h}=d,v=m?i:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(v,{...h,ref:f})});return u.displayName=`Primitive.${o}`,{...s,[o]:u}},{});function uy(s,o){s&&Rh.flushSync(()=>s.dispatchEvent(o))}function zo(s){const o=g.useRef(s);return g.useEffect(()=>{o.current=s}),g.useMemo(()=>((...i)=>{var u;return(u=o.current)==null?void 0:u.call(o,...i)}),[])}function cy(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s);g.useEffect(()=>{const u=d=>{d.key==="Escape"&&i(d)};return o.addEventListener("keydown",u,{capture:!0}),()=>o.removeEventListener("keydown",u,{capture:!0})},[i,o])}var dy="DismissableLayer",ec="dismissableLayer.update",fy="dismissableLayer.pointerDownOutside",py="dismissableLayer.focusOutside",Op,pc=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Dh=g.forwardRef((s,o)=>{const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:u=!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:v,...x}=s,b=g.useContext(pc),[j,M]=g.useState(null),D=(j==null?void 0:j.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,I]=g.useState({}),w=In(o,ee=>M(ee)),C=Array.from(b.layers),[_]=[...b.layersWithOutsidePointerEventsDisabled].slice(-1),$=C.indexOf(_),H=j?C.indexOf(j):-1,z=b.layersWithOutsidePointerEventsDisabled.size>0,R=H>=$,F=g.useRef(!1),K=xy(ee=>{const J=ee.target;if(!(J instanceof Node))return;const ke=[...b.branches].some(ue=>ue.contains(J));!R||ke||(f==null||f(ee),h==null||h(ee),ee.defaultPrevented||v==null||v())},{ownerDocument:D,deferPointerDownOutside:u,isDeferredPointerDownOutsideRef:F,dismissableSurfaces:b.dismissableSurfaces}),ne=yy(ee=>{if(u&&F.current)return;const J=ee.target;[...b.branches].some(ue=>ue.contains(J))||(m==null||m(ee),h==null||h(ee),ee.defaultPrevented||v==null||v())},D);return cy(ee=>{H===b.layers.size-1&&(d==null||d(ee),!ee.defaultPrevented&&v&&(ee.preventDefault(),v()))},D),g.useEffect(()=>{if(j)return i&&(b.layersWithOutsidePointerEventsDisabled.size===0&&(Op=D.body.style.pointerEvents,D.body.style.pointerEvents="none"),b.layersWithOutsidePointerEventsDisabled.add(j)),b.layers.add(j),Dp(),()=>{i&&(b.layersWithOutsidePointerEventsDisabled.delete(j),b.layersWithOutsidePointerEventsDisabled.size===0&&(D.body.style.pointerEvents=Op))}},[j,D,i,b]),g.useEffect(()=>()=>{j&&(b.layers.delete(j),b.layersWithOutsidePointerEventsDisabled.delete(j),Dp())},[j,b]),g.useEffect(()=>{const ee=()=>I({});return document.addEventListener(ec,ee),()=>document.removeEventListener(ec,ee)},[]),n.jsx(lt.div,{...x,ref:w,style:{pointerEvents:z?R?"auto":"none":void 0,...s.style},onFocusCapture:sn(s.onFocusCapture,ne.onFocusCapture),onBlurCapture:sn(s.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:sn(s.onPointerDownCapture,K.onPointerDownCapture)})});Dh.displayName=dy;var hy="DismissableLayerBranch",my=g.forwardRef((s,o)=>{const i=g.useContext(pc),u=g.useRef(null),d=In(o,u);return g.useEffect(()=>{const f=u.current;if(f)return i.branches.add(f),()=>{i.branches.delete(f)}},[i.branches]),n.jsx(lt.div,{...s,ref:d})});my.displayName=hy;function gy(){const s=g.useContext(pc),[o,i]=g.useState(null);return g.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),i}function xy(s,o){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:u=!1,isDeferredPointerDownOutsideRef:d,dismissableSurfaces:f}=o,m=zo(s),h=g.useRef(!1),v=g.useRef(!1),x=g.useRef(new Map),b=g.useRef(()=>{});return g.useEffect(()=>{function j(){v.current=!1,d.current=!1,x.current.clear()}function M(){return Array.from(x.current.values()).some(Boolean)}function D($){if(!v.current)return;const H=$.target;H instanceof Node&&[...f].some(R=>R.contains(H))||x.current.set($.type,!0),$.type==="click"&&window.setTimeout(()=>{v.current&&b.current()},0)}function I($){v.current&&x.current.set($.type,!1)}const w=$=>{if($.target&&!h.current){let H=function(){i.removeEventListener("click",b.current);const R=M();j(),R||Th(fy,m,z,{discrete:!0})};const z={originalEvent:$};v.current=!0,d.current=u&&$.button===0,x.current.clear(),!u||$.button!==0?H():(i.removeEventListener("click",b.current),b.current=H,i.addEventListener("click",b.current,{once:!0}))}else i.removeEventListener("click",b.current),j();h.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const $ of C)i.addEventListener($,D,!0),i.addEventListener($,I);const _=window.setTimeout(()=>{i.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(_),i.removeEventListener("pointerdown",w),i.removeEventListener("click",b.current);for(const $ of C)i.removeEventListener($,D,!0),i.removeEventListener($,I)}},[i,m,u,d,f]),{onPointerDownCapture:()=>h.current=!0}}function yy(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s),u=g.useRef(!1);return g.useEffect(()=>{const d=f=>{f.target&&!u.current&&Th(py,i,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",d),()=>o.removeEventListener("focusin",d)},[o,i]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function Dp(){const s=new CustomEvent(ec);document.dispatchEvent(s)}function Th(s,o,i,{discrete:u}){const d=i.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:i});o&&d.addEventListener(s,o,{once:!0}),u?uy(d,f):d.dispatchEvent(f)}var ku="focusScope.autoFocusOnMount",Nu="focusScope.autoFocusOnUnmount",Tp={bubbles:!1,cancelable:!0},vy="FocusScope",Ah=g.forwardRef((s,o)=>{const{loop:i=!1,trapped:u=!1,onMountAutoFocus:d,onUnmountAutoFocus:f,...m}=s,[h,v]=g.useState(null),x=zo(d),b=zo(f),j=g.useRef(null),M=In(o,w=>v(w)),D=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(u){let w=function(H){if(D.paused||!h)return;const z=H.target;h.contains(z)?j.current=z:Qr(j.current,{select:!0})},C=function(H){if(D.paused||!h)return;const z=H.relatedTarget;z!==null&&(h.contains(z)||Qr(j.current,{select:!0}))},_=function(H){if(document.activeElement===document.body)for(const R of H)R.removedNodes.length>0&&Qr(h)};document.addEventListener("focusin",w),document.addEventListener("focusout",C);const $=new MutationObserver(_);return h&&$.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",C),$.disconnect()}}},[u,h,D.paused]),g.useEffect(()=>{if(h){zp.add(D);const w=document.activeElement;if(!h.contains(w)){const _=new CustomEvent(ku,Tp);h.addEventListener(ku,x),h.dispatchEvent(_),_.defaultPrevented||(by(Sy(zh(h)),{select:!0}),document.activeElement===w&&Qr(h))}return()=>{h.removeEventListener(ku,x),setTimeout(()=>{const _=new CustomEvent(Nu,Tp);h.addEventListener(Nu,b),h.dispatchEvent(_),_.defaultPrevented||Qr(w??document.body,{select:!0}),h.removeEventListener(Nu,b),zp.remove(D)},0)}}},[h,x,b,D]);const I=g.useCallback(w=>{if(!i&&!u||D.paused)return;const C=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,_=document.activeElement;if(C&&_){const $=w.currentTarget,[H,z]=wy($);H&&z?!w.shiftKey&&_===z?(w.preventDefault(),i&&Qr(H,{select:!0})):w.shiftKey&&_===H&&(w.preventDefault(),i&&Qr(z,{select:!0})):_===$&&w.preventDefault()}},[i,u,D.paused]);return n.jsx(lt.div,{tabIndex:-1,...m,ref:M,onKeyDown:I})});Ah.displayName=vy;function by(s,{select:o=!1}={}){const i=document.activeElement;for(const u of s)if(Qr(u,{select:o}),document.activeElement!==i)return}function wy(s){const o=zh(s),i=Ap(o,s),u=Ap(o.reverse(),s);return[i,u]}function zh(s){const o=[],i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:u=>{const d=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||d?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)o.push(i.currentNode);return o}function Ap(s,o){for(const i of s)if(!jy(i,{upTo:o}))return i}function jy(s,{upTo:o}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(o!==void 0&&s===o)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function ky(s){return s instanceof HTMLInputElement&&"select"in s}function Qr(s,{select:o=!1}={}){if(s&&s.focus){const i=document.activeElement;s.focus({preventScroll:!0}),s!==i&&ky(s)&&o&&s.select()}}var zp=Ny();function Ny(){let s=[];return{add(o){const i=s[0];o!==i&&(i==null||i.pause()),s=Lp(s,o),s.unshift(o)},remove(o){var i;s=Lp(s,o),(i=s[0])==null||i.resume()}}}function Lp(s,o){const i=[...s],u=i.indexOf(o);return u!==-1&&i.splice(u,1),i}function Sy(s){return s.filter(o=>o.tagName!=="A")}var Cy="Portal",Lh=g.forwardRef((s,o)=>{var h;const{container:i,...u}=s,[d,f]=g.useState(!1);Ao(()=>f(!0),[]);const m=i||d&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return m?Rh.createPortal(n.jsx(lt.div,{...u,ref:o}),m):null});Lh.displayName=Cy;function Ey(s,o){return g.useReducer((i,u)=>o[i][u]??i,s)}var wi=s=>{const{present:o,children:i}=s,u=Py(o),d=typeof i=="function"?i({present:u.isPresent}):g.Children.only(i),f=_y(u.ref,My(d));return typeof i=="function"||u.isPresent?g.cloneElement(d,{ref:f}):null};wi.displayName="Presence";function Py(s){const[o,i]=g.useState(),u=g.useRef(null),d=g.useRef(s),f=g.useRef("none"),m=s?"mounted":"unmounted",[h,v]=Ey(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const x=si(u.current);f.current=h==="mounted"?x:"none"},[h]),Ao(()=>{const x=u.current,b=d.current;if(b!==s){const M=f.current,D=si(x);s?v("MOUNT"):D==="none"||(x==null?void 0:x.display)==="none"?v("UNMOUNT"):v(b&&M!==D?"ANIMATION_OUT":"UNMOUNT"),d.current=s}},[s,v]),Ao(()=>{if(o){let x;const b=o.ownerDocument.defaultView??window,j=D=>{const w=si(u.current).includes(CSS.escape(D.animationName));if(D.target===o&&w&&(v("ANIMATION_END"),!d.current)){const C=o.style.animationFillMode;o.style.animationFillMode="forwards",x=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=C)})}},M=D=>{D.target===o&&(f.current=si(u.current))};return o.addEventListener("animationstart",M),o.addEventListener("animationcancel",j),o.addEventListener("animationend",j),()=>{b.clearTimeout(x),o.removeEventListener("animationstart",M),o.removeEventListener("animationcancel",j),o.removeEventListener("animationend",j)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:g.useCallback(x=>{u.current=x?getComputedStyle(x):null,i(x)},[])}}function Ip(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function _y(...s){const o=g.useRef(s);return o.current=s,g.useCallback(i=>{const u=o.current;let d=!1;const f=u.map(m=>{const h=Ip(m,i);return!d&&typeof h=="function"&&(d=!0),h});if(d)return()=>{for(let m=0;m{tr||(tr={start:Fp(),end:Fp()});const{start:s,end:o}=tr;return document.body.firstElementChild!==s&&document.body.insertAdjacentElement("afterbegin",s),document.body.lastElementChild!==o&&document.body.insertAdjacentElement("beforeend",o),oi++,()=>{oi===1&&(tr==null||tr.start.remove(),tr==null||tr.end.remove(),tr=null),oi=Math.max(0,oi-1)}},[])}function Fp(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var or=function(){return or=Object.assign||function(o){for(var i,u=1,d=arguments.length;u"u")return Qy;var o=qy(s),i=document.documentElement.clientWidth,u=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,u-i+o[2]-o[0])}},Yy=$h(),ys="data-scroll-locked",Jy=function(s,o,i,u){var d=s.left,f=s.top,m=s.right,h=s.gap;return i===void 0&&(i="margin"),` .`.concat(Dy,` { overflow: hidden `).concat(u,`; padding-right: `).concat(h,"px ").concat(u,`; } body[`).concat(ys,`] { overflow: hidden `).concat(u,`; overscroll-behavior: contain; `).concat([o&&"position: relative ".concat(u,";"),i==="margin"&&` padding-left: `.concat(d,`px; padding-top: `).concat(f,`px; padding-right: `).concat(m,`px; margin-left:0; margin-top:0; margin-right: `).concat(h,"px ").concat(u,`; `),i==="padding"&&"padding-right: ".concat(h,"px ").concat(u,";")].filter(Boolean).join(""),` } .`).concat(pi,` { right: `).concat(h,"px ").concat(u,`; } .`).concat(hi,` { margin-right: `).concat(h,"px ").concat(u,`; } .`).concat(pi," .").concat(pi,` { right: 0 `).concat(u,`; } .`).concat(hi," .").concat(hi,` { margin-right: 0 `).concat(u,`; } body[`).concat(ys,`] { `).concat(Ty,": ").concat(h,`px; } `)},$p=function(){var s=parseInt(document.body.getAttribute(ys)||"0",10);return isFinite(s)?s:0},Xy=function(){g.useEffect(function(){return document.body.setAttribute(ys,($p()+1).toString()),function(){var s=$p()-1;s<=0?document.body.removeAttribute(ys):document.body.setAttribute(ys,s.toString())}},[])},ev=function(s){var o=s.noRelative,i=s.noImportant,u=s.gapMode,d=u===void 0?"margin":u;Xy();var f=g.useMemo(function(){return Zy(d)},[d]);return g.createElement(Yy,{styles:Jy(f,!o,d,i?"":"!important")})},tc=!1;if(typeof window<"u")try{var li=Object.defineProperty({},"passive",{get:function(){return tc=!0,!0}});window.addEventListener("test",li,li),window.removeEventListener("test",li,li)}catch{tc=!1}var fs=tc?{passive:!1}:!1,tv=function(s){return s.tagName==="TEXTAREA"},Bh=function(s,o){if(!(s instanceof Element))return!1;var i=window.getComputedStyle(s);return i[o]!=="hidden"&&!(i.overflowY===i.overflowX&&!tv(s)&&i[o]==="visible")},rv=function(s){return Bh(s,"overflowY")},nv=function(s){return Bh(s,"overflowX")},Bp=function(s,o){var i=o.ownerDocument,u=o;do{typeof ShadowRoot<"u"&&u instanceof ShadowRoot&&(u=u.host);var d=Hh(s,u);if(d){var f=Wh(s,u),m=f[1],h=f[2];if(m>h)return!0}u=u.parentNode}while(u&&u!==i.body);return!1},sv=function(s){var o=s.scrollTop,i=s.scrollHeight,u=s.clientHeight;return[o,i,u]},ov=function(s){var o=s.scrollLeft,i=s.scrollWidth,u=s.clientWidth;return[o,i,u]},Hh=function(s,o){return s==="v"?rv(o):nv(o)},Wh=function(s,o){return s==="v"?sv(o):ov(o)},lv=function(s,o){return s==="h"&&o==="rtl"?-1:1},iv=function(s,o,i,u,d){var f=lv(s,window.getComputedStyle(o).direction),m=f*u,h=i.target,v=o.contains(h),x=!1,b=m>0,j=0,M=0;do{if(!h)break;var D=Wh(s,h),I=D[0],w=D[1],C=D[2],_=w-C-f*I;(I||_)&&Hh(s,h)&&(j+=_,M+=I);var $=h.parentNode;h=$&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE?$.host:$}while(!v&&h!==document.body||v&&(o.contains(h)||o===h));return(b&&Math.abs(j)<1||!b&&Math.abs(M)<1)&&(x=!0),x},ii=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},Hp=function(s){return[s.deltaX,s.deltaY]},Wp=function(s){return s&&"current"in s?s.current:s},av=function(s,o){return s[0]===o[0]&&s[1]===o[1]},uv=function(s){return` .block-interactivity-`.concat(s,` {pointer-events: none;} .allow-interactivity-`).concat(s,` {pointer-events: all;} `)},cv=0,ps=[];function dv(s){var o=g.useRef([]),i=g.useRef([0,0]),u=g.useRef(),d=g.useState(cv++)[0],f=g.useState($h)[0],m=g.useRef(s);g.useEffect(function(){m.current=s},[s]),g.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(d));var w=Oy([s.lockRef.current],(s.shards||[]).map(Wp),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(d))}),function(){document.body.classList.remove("block-interactivity-".concat(d)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(d))})}}},[s.inert,s.lockRef.current,s.shards]);var h=g.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!m.current.allowPinchZoom;var _=ii(w),$=i.current,H="deltaX"in w?w.deltaX:$[0]-_[0],z="deltaY"in w?w.deltaY:$[1]-_[1],R,F=w.target,K=Math.abs(H)>Math.abs(z)?"h":"v";if("touches"in w&&K==="h"&&F.type==="range")return!1;var ne=window.getSelection(),ee=ne&&ne.anchorNode,J=ee?ee===F||ee.contains(F):!1;if(J)return!1;var ke=Bp(K,F);if(!ke)return!0;if(ke?R=K:(R=K==="v"?"h":"v",ke=Bp(K,F)),!ke)return!1;if(!u.current&&"changedTouches"in w&&(H||z)&&(u.current=R),!R)return!0;var ue=u.current||R;return iv(ue,C,w,ue==="h"?H:z)},[]),v=g.useCallback(function(w){var C=w;if(!(!ps.length||ps[ps.length-1]!==f)){var _="deltaY"in C?Hp(C):ii(C),$=o.current.filter(function(R){return R.name===C.type&&(R.target===C.target||C.target===R.shadowParent)&&av(R.delta,_)})[0];if($&&$.should){C.cancelable&&C.preventDefault();return}if(!$){var H=(m.current.shards||[]).map(Wp).filter(Boolean).filter(function(R){return R.contains(C.target)}),z=H.length>0?h(C,H[0]):!m.current.noIsolation;z&&C.cancelable&&C.preventDefault()}}},[]),x=g.useCallback(function(w,C,_,$){var H={name:w,delta:C,target:_,should:$,shadowParent:fv(_)};o.current.push(H),setTimeout(function(){o.current=o.current.filter(function(z){return z!==H})},1)},[]),b=g.useCallback(function(w){i.current=ii(w),u.current=void 0},[]),j=g.useCallback(function(w){x(w.type,Hp(w),w.target,h(w,s.lockRef.current))},[]),M=g.useCallback(function(w){x(w.type,ii(w),w.target,h(w,s.lockRef.current))},[]);g.useEffect(function(){return ps.push(f),s.setCallbacks({onScrollCapture:j,onWheelCapture:j,onTouchMoveCapture:M}),document.addEventListener("wheel",v,fs),document.addEventListener("touchmove",v,fs),document.addEventListener("touchstart",b,fs),function(){ps=ps.filter(function(w){return w!==f}),document.removeEventListener("wheel",v,fs),document.removeEventListener("touchmove",v,fs),document.removeEventListener("touchstart",b,fs)}},[]);var D=s.removeScrollBar,I=s.inert;return g.createElement(g.Fragment,null,I?g.createElement(f,{styles:uv(d)}):null,D?g.createElement(ev,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function fv(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const pv=$y(Uh,dv);var Vh=g.forwardRef(function(s,o){return g.createElement(ji,or({},s,{ref:o,sideCar:pv}))});Vh.classNames=ji.classNames;var hv=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},hs=new WeakMap,ai=new WeakMap,ui={},Pu=0,Gh=function(s){return s&&(s.host||Gh(s.parentNode))},mv=function(s,o){return o.map(function(i){if(s.contains(i))return i;var u=Gh(i);return u&&s.contains(u)?u:(console.error("aria-hidden",i,"in not contained inside",s,". Doing nothing"),null)}).filter(function(i){return!!i})},gv=function(s,o,i,u){var d=mv(o,Array.isArray(s)?s:[s]);ui[i]||(ui[i]=new WeakMap);var f=ui[i],m=[],h=new Set,v=new Set(d),x=function(j){!j||h.has(j)||(h.add(j),x(j.parentNode))};d.forEach(x);var b=function(j){!j||v.has(j)||Array.prototype.forEach.call(j.children,function(M){if(h.has(M))b(M);else try{var D=M.getAttribute(u),I=D!==null&&D!=="false",w=(hs.get(M)||0)+1,C=(f.get(M)||0)+1;hs.set(M,w),f.set(M,C),m.push(M),w===1&&I&&ai.set(M,!0),C===1&&M.setAttribute(i,"true"),I||M.setAttribute(u,"true")}catch(_){console.error("aria-hidden: cannot operate on ",M,_)}})};return b(o),h.clear(),Pu++,function(){m.forEach(function(j){var M=hs.get(j)-1,D=f.get(j)-1;hs.set(j,M),f.set(j,D),M||(ai.has(j)||j.removeAttribute(u),ai.delete(j)),D||j.removeAttribute(i)}),Pu--,Pu||(hs=new WeakMap,hs=new WeakMap,ai=new WeakMap,ui={})}},xv=function(s,o,i){i===void 0&&(i="data-aria-hidden");var u=Array.from(Array.isArray(s)?s:[s]),d=hv(s);return d?(u.push.apply(u,Array.from(d.querySelectorAll("[aria-live], script"))),gv(u,d,i,"aria-hidden")):function(){return null}},ki="Dialog",[Kh]=V0(ki),[yv,qt]=Kh(ki),Qh=s=>{const{__scopeDialog:o,children:i,open:u,defaultOpen:d,onOpenChange:f,modal:m=!0}=s,h=g.useRef(null),v=g.useRef(null),[x,b]=Z0({prop:u,defaultProp:d??!1,onChange:f,caller:ki});return n.jsx(yv,{scope:o,triggerRef:h,contentRef:v,contentId:jr(),titleId:jr(),descriptionId:jr(),open:x,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(j=>!j),[b]),modal:m,children:i})};Qh.displayName=ki;var qh="DialogTrigger",vv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(qh,i),f=In(o,d.triggerRef);return n.jsx(lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":mc(d.open),...u,ref:f,onClick:sn(s.onClick,d.onOpenToggle)})});vv.displayName=qh;var hc="DialogPortal",[bv,Zh]=Kh(hc,{forceMount:void 0}),Yh=s=>{const{__scopeDialog:o,forceMount:i,children:u,container:d}=s,f=qt(hc,o);return n.jsx(bv,{scope:o,forceMount:i,children:g.Children.map(u,m=>n.jsx(wi,{present:i||f.open,children:n.jsx(Lh,{asChild:!0,container:d,children:m})}))})};Yh.displayName=hc;var bi="DialogOverlay",Jh=g.forwardRef((s,o)=>{const i=Zh(bi,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=qt(bi,s.__scopeDialog);return f.modal?n.jsx(wi,{present:u||f.open,children:n.jsx(jv,{...d,ref:o})}):null});Jh.displayName=bi;var wv=Oh("DialogOverlay.RemoveScroll"),jv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(bi,i),f=gy(),m=In(o,f);return n.jsx(Vh,{as:wv,allowPinchZoom:!0,shards:[d.contentRef],children:n.jsx(lt.div,{"data-state":mc(d.open),...u,ref:m,style:{pointerEvents:"auto",...u.style}})})}),As="DialogContent",Xh=g.forwardRef((s,o)=>{const i=Zh(As,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=qt(As,s.__scopeDialog);return n.jsx(wi,{present:u||f.open,children:f.modal?n.jsx(kv,{...d,ref:o}):n.jsx(Nv,{...d,ref:o})})});Xh.displayName=As;var kv=g.forwardRef((s,o)=>{const i=qt(As,s.__scopeDialog),u=g.useRef(null),d=In(o,i.contentRef,u);return g.useEffect(()=>{const f=u.current;if(f)return xv(f)},[]),n.jsx(em,{...s,ref:d,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:sn(s.onCloseAutoFocus,f=>{var m;f.preventDefault(),(m=i.triggerRef.current)==null||m.focus()}),onPointerDownOutside:sn(s.onPointerDownOutside,f=>{const m=f.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0;(m.button===2||h)&&f.preventDefault()}),onFocusOutside:sn(s.onFocusOutside,f=>f.preventDefault())})}),Nv=g.forwardRef((s,o)=>{const i=qt(As,s.__scopeDialog),u=g.useRef(!1),d=g.useRef(!1);return n.jsx(em,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var m,h;(m=s.onCloseAutoFocus)==null||m.call(s,f),f.defaultPrevented||(u.current||(h=i.triggerRef.current)==null||h.focus(),f.preventDefault()),u.current=!1,d.current=!1},onInteractOutside:f=>{var v,x;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(u.current=!0,f.detail.originalEvent.type==="pointerdown"&&(d.current=!0));const m=f.target;((x=i.triggerRef.current)==null?void 0:x.contains(m))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&d.current&&f.preventDefault()}})}),em=g.forwardRef((s,o)=>{const{__scopeDialog:i,trapFocus:u,onOpenAutoFocus:d,onCloseAutoFocus:f,...m}=s,h=qt(As,i);return Ry(),n.jsx(n.Fragment,{children:n.jsx(Ah,{asChild:!0,loop:!0,trapped:u,onMountAutoFocus:d,onUnmountAutoFocus:f,children:n.jsx(Dh,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":mc(h.open),...m,ref:o,deferPointerDownOutside:!0,onDismiss:()=>h.onOpenChange(!1)})})})}),tm="DialogTitle",Sv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(tm,i);return n.jsx(lt.h2,{id:d.titleId,...u,ref:o})});Sv.displayName=tm;var rm="DialogDescription",Cv=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(rm,i);return n.jsx(lt.p,{id:d.descriptionId,...u,ref:o})});Cv.displayName=rm;var nm="DialogClose",Ev=g.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=qt(nm,i);return n.jsx(lt.button,{type:"button",...u,ref:o,onClick:sn(s.onClick,()=>d.onOpenChange(!1))})});Ev.displayName=nm;function mc(s){return s?"open":"closed"}var So='[cmdk-group=""]',_u='[cmdk-group-items=""]',Pv='[cmdk-group-heading=""]',sm='[cmdk-item=""]',Vp=`${sm}:not([aria-disabled="true"])`,rc="cmdk-item-select",gs="data-value",_v=(s,o,i)=>W0(s,o,i),om=g.createContext(void 0),Wo=()=>g.useContext(om),lm=g.createContext(void 0),gc=()=>g.useContext(lm),im=g.createContext(void 0),am=g.forwardRef((s,o)=>{let i=xs(()=>{var N,G;return{search:"",value:(G=(N=s.value)!=null?N:s.defaultValue)!=null?G:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=xs(()=>new Set),d=xs(()=>new Map),f=xs(()=>new Map),m=xs(()=>new Set),h=um(s),{label:v,children:x,value:b,onValueChange:j,filter:M,shouldFilter:D,loop:I,disablePointerSelection:w=!1,vimBindings:C=!0,..._}=s,$=jr(),H=jr(),z=jr(),R=g.useRef(null),F=Uv();Ln(()=>{if(b!==void 0){let N=b.trim();i.current.value=N,K.emit()}},[b]),Ln(()=>{F(6,Le)},[]);let K=g.useMemo(()=>({subscribe:N=>(m.current.add(N),()=>m.current.delete(N)),snapshot:()=>i.current,setState:(N,G,X)=>{var Y,ie,pe,we;if(!Object.is(i.current[N],G)){if(i.current[N]=G,N==="search")ue(),J(),F(1,ke);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(z);U?U.focus():(Y=document.getElementById($))==null||Y.focus()}if(F(7,()=>{var U;i.current.selectedItemId=(U=_e())==null?void 0:U.id,K.emit()}),X||F(5,Le),((ie=h.current)==null?void 0:ie.value)!==void 0){let U=G??"";(we=(pe=h.current).onValueChange)==null||we.call(pe,U);return}}K.emit()}},emit:()=>{m.current.forEach(N=>N())}}),[]),ne=g.useMemo(()=>({value:(N,G,X)=>{var Y;G!==((Y=f.current.get(N))==null?void 0:Y.value)&&(f.current.set(N,{value:G,keywords:X}),i.current.filtered.items.set(N,ee(G,X)),F(2,()=>{J(),K.emit()}))},item:(N,G)=>(u.current.add(N),G&&(d.current.has(G)?d.current.get(G).add(N):d.current.set(G,new Set([N]))),F(3,()=>{ue(),J(),i.current.value||ke(),K.emit()}),()=>{f.current.delete(N),u.current.delete(N),i.current.filtered.items.delete(N);let X=_e();F(4,()=>{ue(),(X==null?void 0:X.getAttribute("id"))===N&&ke(),K.emit()})}),group:N=>(d.current.has(N)||d.current.set(N,new Set),()=>{f.current.delete(N),d.current.delete(N)}),filter:()=>h.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:$,inputId:z,labelId:H,listInnerRef:R}),[]);function ee(N,G){var X,Y;let ie=(Y=(X=h.current)==null?void 0:X.filter)!=null?Y:_v;return N?ie(N,i.current.search,G):0}function J(){if(!i.current.search||h.current.shouldFilter===!1)return;let N=i.current.filtered.items,G=[];i.current.filtered.groups.forEach(Y=>{let ie=d.current.get(Y),pe=0;ie.forEach(we=>{let U=N.get(we);pe=Math.max(U,pe)}),G.push([Y,pe])});let X=R.current;Oe().sort((Y,ie)=>{var pe,we;let U=Y.getAttribute("id"),me=ie.getAttribute("id");return((pe=N.get(me))!=null?pe:0)-((we=N.get(U))!=null?we:0)}).forEach(Y=>{let ie=Y.closest(_u);ie?ie.appendChild(Y.parentElement===ie?Y:Y.closest(`${_u} > *`)):X.appendChild(Y.parentElement===X?Y:Y.closest(`${_u} > *`))}),G.sort((Y,ie)=>ie[1]-Y[1]).forEach(Y=>{var ie;let pe=(ie=R.current)==null?void 0:ie.querySelector(`${So}[${gs}="${encodeURIComponent(Y[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function ke(){let N=Oe().find(X=>X.getAttribute("aria-disabled")!=="true"),G=N==null?void 0:N.getAttribute(gs);K.setState("value",G||void 0)}function ue(){var N,G,X,Y;if(!i.current.search||h.current.shouldFilter===!1){i.current.filtered.count=u.current.size;return}i.current.filtered.groups=new Set;let ie=0;for(let pe of u.current){let we=(G=(N=f.current.get(pe))==null?void 0:N.value)!=null?G:"",U=(Y=(X=f.current.get(pe))==null?void 0:X.keywords)!=null?Y:[],me=ee(we,U);i.current.filtered.items.set(pe,me),me>0&&ie++}for(let[pe,we]of d.current)for(let U of we)if(i.current.filtered.items.get(U)>0){i.current.filtered.groups.add(pe);break}i.current.filtered.count=ie}function Le(){var N,G,X;let Y=_e();Y&&(((N=Y.parentElement)==null?void 0:N.firstChild)===Y&&((X=(G=Y.closest(So))==null?void 0:G.querySelector(Pv))==null||X.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function _e(){var N;return(N=R.current)==null?void 0:N.querySelector(`${sm}[aria-selected="true"]`)}function Oe(){var N;return Array.from(((N=R.current)==null?void 0:N.querySelectorAll(Vp))||[])}function Te(N){let G=Oe()[N];G&&K.setState("value",G.getAttribute(gs))}function Me(N){var G;let X=_e(),Y=Oe(),ie=Y.findIndex(we=>we===X),pe=Y[ie+N];(G=h.current)!=null&&G.loop&&(pe=ie+N<0?Y[Y.length-1]:ie+N===Y.length?Y[0]:Y[ie+N]),pe&&K.setState("value",pe.getAttribute(gs))}function Q(N){let G=_e(),X=G==null?void 0:G.closest(So),Y;for(;X&&!Y;)X=N>0?Iv(X,So):Fv(X,So),Y=X==null?void 0:X.querySelector(Vp);Y?K.setState("value",Y.getAttribute(gs)):Me(N)}let ce=()=>Te(Oe().length-1),Z=N=>{N.preventDefault(),N.metaKey?ce():N.altKey?Q(1):Me(1)},P=N=>{N.preventDefault(),N.metaKey?Te(0):N.altKey?Q(-1):Me(-1)};return g.createElement(lt.div,{ref:o,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:N=>{var G;(G=_.onKeyDown)==null||G.call(_,N);let X=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||X))switch(N.key){case"n":case"j":{C&&N.ctrlKey&&Z(N);break}case"ArrowDown":{Z(N);break}case"p":case"k":{C&&N.ctrlKey&&P(N);break}case"ArrowUp":{P(N);break}case"Home":{N.preventDefault(),Te(0);break}case"End":{N.preventDefault(),ce();break}case"Enter":{N.preventDefault();let Y=_e();if(Y){let ie=new Event(rc);Y.dispatchEvent(ie)}}}}},g.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Bv},v),Ni(s,N=>g.createElement(lm.Provider,{value:K},g.createElement(om.Provider,{value:ne},N))))}),Mv=g.forwardRef((s,o)=>{var i,u;let d=jr(),f=g.useRef(null),m=g.useContext(im),h=Wo(),v=um(s),x=(u=(i=v.current)==null?void 0:i.forceMount)!=null?u:m==null?void 0:m.forceMount;Ln(()=>{if(!x)return h.item(d,m==null?void 0:m.id)},[x]);let b=cm(d,f,[s.value,s.children,f],s.keywords),j=gc(),M=on(F=>F.value&&F.value===b.current),D=on(F=>x||h.filter()===!1?!0:F.search?F.filtered.items.get(d)>0:!0);g.useEffect(()=>{let F=f.current;if(!(!F||s.disabled))return F.addEventListener(rc,I),()=>F.removeEventListener(rc,I)},[D,s.onSelect,s.disabled]);function I(){var F,K;w(),(K=(F=v.current).onSelect)==null||K.call(F,b.current)}function w(){j.setState("value",b.current,!0)}if(!D)return null;let{disabled:C,value:_,onSelect:$,forceMount:H,keywords:z,...R}=s;return g.createElement(lt.div,{ref:Ts(f,o),...R,id:d,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!M,"data-disabled":!!C,"data-selected":!!M,onPointerMove:C||h.getDisablePointerSelection()?void 0:w,onClick:C?void 0:I},s.children)}),Rv=g.forwardRef((s,o)=>{let{heading:i,children:u,forceMount:d,...f}=s,m=jr(),h=g.useRef(null),v=g.useRef(null),x=jr(),b=Wo(),j=on(D=>d||b.filter()===!1?!0:D.search?D.filtered.groups.has(m):!0);Ln(()=>b.group(m),[]),cm(m,h,[s.value,s.heading,v]);let M=g.useMemo(()=>({id:m,forceMount:d}),[d]);return g.createElement(lt.div,{ref:Ts(h,o),...f,"cmdk-group":"",role:"presentation",hidden:j?void 0:!0},i&&g.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:x},i),Ni(s,D=>g.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?x:void 0},g.createElement(im.Provider,{value:M},D))))}),Ov=g.forwardRef((s,o)=>{let{alwaysRender:i,...u}=s,d=g.useRef(null),f=on(m=>!m.search);return!i&&!f?null:g.createElement(lt.div,{ref:Ts(d,o),...u,"cmdk-separator":"",role:"separator"})}),Dv=g.forwardRef((s,o)=>{let{onValueChange:i,...u}=s,d=s.value!=null,f=gc(),m=on(x=>x.search),h=on(x=>x.selectedItemId),v=Wo();return g.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),g.createElement(lt.input,{ref:o,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":v.listId,"aria-labelledby":v.labelId,"aria-activedescendant":h,id:v.inputId,type:"text",value:d?s.value:m,onChange:x=>{d||f.setState("search",x.target.value),i==null||i(x.target.value)}})}),Tv=g.forwardRef((s,o)=>{let{children:i,label:u="Suggestions",...d}=s,f=g.useRef(null),m=g.useRef(null),h=on(x=>x.selectedItemId),v=Wo();return g.useEffect(()=>{if(m.current&&f.current){let x=m.current,b=f.current,j,M=new ResizeObserver(()=>{j=requestAnimationFrame(()=>{let D=x.offsetHeight;b.style.setProperty("--cmdk-list-height",D.toFixed(1)+"px")})});return M.observe(x),()=>{cancelAnimationFrame(j),M.unobserve(x)}}},[]),g.createElement(lt.div,{ref:Ts(f,o),...d,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":u,id:v.listId},Ni(s,x=>g.createElement("div",{ref:Ts(m,v.listInnerRef),"cmdk-list-sizer":""},x)))}),Av=g.forwardRef((s,o)=>{let{open:i,onOpenChange:u,overlayClassName:d,contentClassName:f,container:m,...h}=s;return g.createElement(Qh,{open:i,onOpenChange:u},g.createElement(Yh,{container:m},g.createElement(Jh,{"cmdk-overlay":"",className:d}),g.createElement(Xh,{"aria-label":s.label,"cmdk-dialog":"",className:f},g.createElement(am,{ref:o,...h}))))}),zv=g.forwardRef((s,o)=>on(i=>i.filtered.count===0)?g.createElement(lt.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Lv=g.forwardRef((s,o)=>{let{progress:i,children:u,label:d="Loading...",...f}=s;return g.createElement(lt.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":d},Ni(s,m=>g.createElement("div",{"aria-hidden":!0},m)))}),ms=Object.assign(am,{List:Tv,Item:Mv,Input:Dv,Group:Rv,Separator:Ov,Dialog:Av,Empty:zv,Loading:Lv});function Iv(s,o){let i=s.nextElementSibling;for(;i;){if(i.matches(o))return i;i=i.nextElementSibling}}function Fv(s,o){let i=s.previousElementSibling;for(;i;){if(i.matches(o))return i;i=i.previousElementSibling}}function um(s){let o=g.useRef(s);return Ln(()=>{o.current=s}),o}var Ln=typeof window>"u"?g.useEffect:g.useLayoutEffect;function xs(s){let o=g.useRef();return o.current===void 0&&(o.current=s()),o}function on(s){let o=gc(),i=()=>s(o.snapshot());return g.useSyncExternalStore(o.subscribe,i,i)}function cm(s,o,i,u=[]){let d=g.useRef(),f=Wo();return Ln(()=>{var m;let h=(()=>{var x;for(let b of i){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(x=b.current.textContent)==null?void 0:x.trim():d.current}})(),v=u.map(x=>x.trim());f.value(s,h,v),(m=o.current)==null||m.setAttribute(gs,h),d.current=h}),d}var Uv=()=>{let[s,o]=g.useState(),i=xs(()=>new Map);return Ln(()=>{i.current.forEach(u=>u()),i.current=new Map},[s]),(u,d)=>{i.current.set(u,d),o({})}};function $v(s){let o=s.type;return typeof o=="function"?o(s.props):"render"in o?o.render(s.props):s}function Ni({asChild:s,children:o},i){return s&&g.isValidElement(o)?g.cloneElement($v(o),{ref:o.ref},i(o.props.children)):i(o)}var Bv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Hv({onNavigate:s}){const[o,i]=g.useState(!1);return g.useEffect(()=>{const u=d=>{(d.metaKey||d.ctrlKey)&&d.key.toLowerCase()==="k"&&(d.preventDefault(),i(f=>!f))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[]),n.jsx(ms.Dialog,{open:o,onOpenChange:i,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>i(!1),children:n.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:u=>u.stopPropagation(),children:[n.jsx(ms.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),n.jsxs(ms.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(ms.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(ms.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Ju.map(u=>n.jsxs(ms.Item,{value:`${u.label} ${u.hint}`,onSelect:()=>{s(u.id),i(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[n.jsx(u.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:u.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:u.hint})]},u.id))})]})]})})}async function he(s,o){var v;const i={"Content-Type":"application/json",...o==null?void 0:o.headers},u=localStorage.getItem("mc_sudo_password"),d=localStorage.getItem("mc_hf_token");u&&(i["X-Sudo-Password"]=u);let f=o==null?void 0:o.body;if((((v=o==null?void 0:o.method)==null?void 0:v.toUpperCase())||"GET")==="POST"){if(typeof f=="string")try{const x=JSON.parse(f);let b=!1;u&&!("sudo_password"in x)&&(x.sudo_password=u,b=!0),d&&!("hf_token"in x)&&(x.hf_token=d,b=!0),b&&(f=JSON.stringify(x))}catch{}else if(!f){const x={};u&&(x.sudo_password=u),d&&(x.hf_token=d),Object.keys(x).length>0&&(f=JSON.stringify(x))}}const h=await fetch(s,{...o,headers:i,body:f});if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return h.json()}const mt={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],updates:["updates"],discover:["discover"],connect:s=>["connect",s??""],memory:(s,o)=>["memory",s??"",o??""]},Wv=()=>lr({queryKey:mt.health,queryFn:()=>he("/api/health"),refetchInterval:1e4}),xc=(s=5e3)=>lr({queryKey:mt.systemStatus,queryFn:()=>he("/api/system/status"),refetchInterval:s}),Vv=(s=3e3)=>lr({queryKey:mt.services,queryFn:()=>he("/api/system/services"),refetchInterval:s}),yc=(s=4e3)=>lr({queryKey:mt.models,queryFn:()=>he("/api/models"),refetchInterval:s}),Gv=(s=2e3)=>lr({queryKey:mt.jobs,queryFn:()=>he("/api/jobs"),refetchInterval:s,select:o=>o.jobs??[]}),Kv=(s=3e3)=>lr({queryKey:mt.tokenStats,queryFn:()=>he("/api/system/token-stats"),refetchInterval:s}),dm=(s=5e3)=>lr({queryKey:mt.agentStatus,queryFn:()=>he("/api/agent/status"),refetchInterval:s}),Qv=s=>lr({queryKey:mt.updates,queryFn:()=>he("/api/maintenance/updates"),refetchInterval:s}),qv=s=>lr({queryKey:mt.connect(s),queryFn:()=>he(s?`/api/connect?${s}`:"/api/connect")}),fm=s=>lr({queryKey:mt.memory(s==null?void 0:s.q,s==null?void 0:s.category),queryFn:()=>{const o=new URLSearchParams;return s!=null&&s.q&&o.set("q",s.q),s!=null&&s.category&&o.set("category",s.category),he(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function Nt(s){return(s/1024**3).toFixed(1)}function nc(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function wn(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function Zv(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Gp(s){return s?`${Math.round(s/1024)}k`:"—"}function pm(s){var o,i,u="";if(typeof s=="string"||typeof s=="number")u+=s;else if(typeof s=="object")if(Array.isArray(s)){var d=s.length;for(o=0;o{const o=eb(s),{conflictingClassGroups:i,conflictingClassGroupModifiers:u}=s;return{getClassGroupId:m=>{const h=m.split(vc);return h[0]===""&&h.length!==1&&h.shift(),hm(h,o)||Xv(m)},getConflictingClassGroupIds:(m,h)=>{const v=i[m]||[];return h&&u[m]?[...v,...u[m]]:v}}},hm=(s,o)=>{var m;if(s.length===0)return o.classGroupId;const i=s[0],u=o.nextPart.get(i),d=u?hm(s.slice(1),u):void 0;if(d)return d;if(o.validators.length===0)return;const f=s.join(vc);return(m=o.validators.find(({validator:h})=>h(f)))==null?void 0:m.classGroupId},Kp=/^\[(.+)\]$/,Xv=s=>{if(Kp.test(s)){const o=Kp.exec(s)[1],i=o==null?void 0:o.substring(0,o.indexOf(":"));if(i)return"arbitrary.."+i}},eb=s=>{const{theme:o,prefix:i}=s,u={nextPart:new Map,validators:[]};return rb(Object.entries(s.classGroups),i).forEach(([f,m])=>{sc(m,u,f,o)}),u},sc=(s,o,i,u)=>{s.forEach(d=>{if(typeof d=="string"){const f=d===""?o:Qp(o,d);f.classGroupId=i;return}if(typeof d=="function"){if(tb(d)){sc(d(u),o,i,u);return}o.validators.push({validator:d,classGroupId:i});return}Object.entries(d).forEach(([f,m])=>{sc(m,Qp(o,f),i,u)})})},Qp=(s,o)=>{let i=s;return o.split(vc).forEach(u=>{i.nextPart.has(u)||i.nextPart.set(u,{nextPart:new Map,validators:[]}),i=i.nextPart.get(u)}),i},tb=s=>s.isThemeGetter,rb=(s,o)=>o?s.map(([i,u])=>{const d=u.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([m,h])=>[o+m,h])):f);return[i,d]}):s,nb=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,i=new Map,u=new Map;const d=(f,m)=>{i.set(f,m),o++,o>s&&(o=0,u=i,i=new Map)};return{get(f){let m=i.get(f);if(m!==void 0)return m;if((m=u.get(f))!==void 0)return d(f,m),m},set(f,m){i.has(f)?i.set(f,m):d(f,m)}}},mm="!",sb=s=>{const{separator:o,experimentalParseClassName:i}=s,u=o.length===1,d=o[0],f=o.length,m=h=>{const v=[];let x=0,b=0,j;for(let C=0;Cb?j-b:void 0;return{modifiers:v,hasImportantModifier:D,baseClassName:I,maybePostfixModifierPosition:w}};return i?h=>i({className:h,parseClassName:m}):m},ob=s=>{if(s.length<=1)return s;const o=[];let i=[];return s.forEach(u=>{u[0]==="["?(o.push(...i.sort(),u),i=[]):i.push(u)}),o.push(...i.sort()),o},lb=s=>({cache:nb(s.cacheSize),parseClassName:sb(s),...Jv(s)}),ib=/\s+/,ab=(s,o)=>{const{parseClassName:i,getClassGroupId:u,getConflictingClassGroupIds:d}=o,f=[],m=s.trim().split(ib);let h="";for(let v=m.length-1;v>=0;v-=1){const x=m[v],{modifiers:b,hasImportantModifier:j,baseClassName:M,maybePostfixModifierPosition:D}=i(x);let I=!!D,w=u(I?M.substring(0,D):M);if(!w){if(!I){h=x+(h.length>0?" "+h:h);continue}if(w=u(M),!w){h=x+(h.length>0?" "+h:h);continue}I=!1}const C=ob(b).join(":"),_=j?C+mm:C,$=_+w;if(f.includes($))continue;f.push($);const H=d(w,I);for(let z=0;z0?" "+h:h)}return h};function ub(){let s=0,o,i,u="";for(;s{if(typeof s=="string")return s;let o,i="";for(let u=0;uj(b),s());return i=lb(x),u=i.cache.get,d=i.cache.set,f=h,h(v)}function h(v){const x=u(v);if(x)return x;const b=ab(v,i);return d(v,b),b}return function(){return f(ub.apply(null,arguments))}}const Be=s=>{const o=i=>i[s]||[];return o.isThemeGetter=!0,o},xm=/^\[(?:([a-z-]+):)?(.+)\]$/i,db=/^\d+\/\d+$/,fb=new Set(["px","full","screen"]),pb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,mb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,yr=s=>vs(s)||fb.has(s)||db.test(s),Vr=s=>Ls(s,"length",Sb),vs=s=>!!s&&!Number.isNaN(Number(s)),Mu=s=>Ls(s,"number",vs),Co=s=>!!s&&Number.isInteger(Number(s)),yb=s=>s.endsWith("%")&&vs(s.slice(0,-1)),Ne=s=>xm.test(s),Gr=s=>pb.test(s),vb=new Set(["length","size","percentage"]),bb=s=>Ls(s,vb,ym),wb=s=>Ls(s,"position",ym),jb=new Set(["image","url"]),kb=s=>Ls(s,jb,Eb),Nb=s=>Ls(s,"",Cb),Eo=()=>!0,Ls=(s,o,i)=>{const u=xm.exec(s);return u?u[1]?typeof o=="string"?u[1]===o:o.has(u[1]):i(u[2]):!1},Sb=s=>hb.test(s)&&!mb.test(s),ym=()=>!1,Cb=s=>gb.test(s),Eb=s=>xb.test(s),Pb=()=>{const s=Be("colors"),o=Be("spacing"),i=Be("blur"),u=Be("brightness"),d=Be("borderColor"),f=Be("borderRadius"),m=Be("borderSpacing"),h=Be("borderWidth"),v=Be("contrast"),x=Be("grayscale"),b=Be("hueRotate"),j=Be("invert"),M=Be("gap"),D=Be("gradientColorStops"),I=Be("gradientColorStopPositions"),w=Be("inset"),C=Be("margin"),_=Be("opacity"),$=Be("padding"),H=Be("saturate"),z=Be("scale"),R=Be("sepia"),F=Be("skew"),K=Be("space"),ne=Be("translate"),ee=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],ke=()=>["auto",Ne,o],ue=()=>[Ne,o],Le=()=>["",yr,Vr],_e=()=>["auto",vs,Ne],Oe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Te=()=>["solid","dashed","dotted","double","none"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",Ne],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[vs,Ne];return{cacheSize:500,separator:":",theme:{colors:[Eo],spacing:[yr,Vr],blur:["none","",Gr,Ne],brightness:P(),borderColor:[s],borderRadius:["none","","full",Gr,Ne],borderSpacing:ue(),borderWidth:Le(),contrast:P(),grayscale:ce(),hueRotate:P(),invert:ce(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[yb,Vr],inset:ke(),margin:ke(),opacity:P(),padding:ue(),saturate:P(),scale:P(),sepia:ce(),skew:P(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[Gr]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Oe(),Ne]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Co,Ne]}],basis:[{basis:ke()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ne]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",Co,Ne]}],"grid-cols":[{"grid-cols":[Eo]}],"col-start-end":[{col:["auto",{span:["full",Co,Ne]},Ne]}],"col-start":[{"col-start":_e()}],"col-end":[{"col-end":_e()}],"grid-rows":[{"grid-rows":[Eo]}],"row-start-end":[{row:["auto",{span:[Co,Ne]},Ne]}],"row-start":[{"row-start":_e()}],"row-end":[{"row-end":_e()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ne]}],gap:[{gap:[M]}],"gap-x":[{"gap-x":[M]}],"gap-y":[{"gap-y":[M]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[$]}],px:[{px:[$]}],py:[{py:[$]}],ps:[{ps:[$]}],pe:[{pe:[$]}],pt:[{pt:[$]}],pr:[{pr:[$]}],pb:[{pb:[$]}],pl:[{pl:[$]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[K]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[K]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ne,o]}],"min-w":[{"min-w":[Ne,o,"min","max","fit"]}],"max-w":[{"max-w":[Ne,o,"none","full","min","max","fit","prose",{screen:[Gr]},Gr]}],h:[{h:[Ne,o,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ne,o,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ne,o,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ne,o,"auto","min","max","fit"]}],"font-size":[{text:["base",Gr,Vr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mu]}],"font-family":[{font:[Eo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ne]}],"line-clamp":[{"line-clamp":["none",vs,Mu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",yr,Ne]}],"list-image":[{"list-image":["none",Ne]}],"list-style-type":[{list:["none","disc","decimal",Ne]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[s]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Te(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",yr,Vr]}],"underline-offset":[{"underline-offset":["auto",yr,Ne]}],"text-decoration-color":[{decoration:[s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ue()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Oe(),wb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",bb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kb]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[I]}],"gradient-via-pos":[{via:[I]}],"gradient-to-pos":[{to:[I]}],"gradient-from":[{from:[D]}],"gradient-via":[{via:[D]}],"gradient-to":[{to:[D]}],rounded:[{rounded:[f]}],"rounded-s":[{"rounded-s":[f]}],"rounded-e":[{"rounded-e":[f]}],"rounded-t":[{"rounded-t":[f]}],"rounded-r":[{"rounded-r":[f]}],"rounded-b":[{"rounded-b":[f]}],"rounded-l":[{"rounded-l":[f]}],"rounded-ss":[{"rounded-ss":[f]}],"rounded-se":[{"rounded-se":[f]}],"rounded-ee":[{"rounded-ee":[f]}],"rounded-es":[{"rounded-es":[f]}],"rounded-tl":[{"rounded-tl":[f]}],"rounded-tr":[{"rounded-tr":[f]}],"rounded-br":[{"rounded-br":[f]}],"rounded-bl":[{"rounded-bl":[f]}],"border-w":[{border:[h]}],"border-w-x":[{"border-x":[h]}],"border-w-y":[{"border-y":[h]}],"border-w-s":[{"border-s":[h]}],"border-w-e":[{"border-e":[h]}],"border-w-t":[{"border-t":[h]}],"border-w-r":[{"border-r":[h]}],"border-w-b":[{"border-b":[h]}],"border-w-l":[{"border-l":[h]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...Te(),"hidden"]}],"divide-x":[{"divide-x":[h]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[h]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:Te()}],"border-color":[{border:[d]}],"border-color-x":[{"border-x":[d]}],"border-color-y":[{"border-y":[d]}],"border-color-s":[{"border-s":[d]}],"border-color-e":[{"border-e":[d]}],"border-color-t":[{"border-t":[d]}],"border-color-r":[{"border-r":[d]}],"border-color-b":[{"border-b":[d]}],"border-color-l":[{"border-l":[d]}],"divide-color":[{divide:[d]}],"outline-style":[{outline:["",...Te()]}],"outline-offset":[{"outline-offset":[yr,Ne]}],"outline-w":[{outline:[yr,Vr]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:Le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[yr,Vr]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",Gr,Nb]}],"shadow-color":[{shadow:[Eo]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...Me(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Me()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[u]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",Gr,Ne]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[j]}],saturate:[{saturate:[H]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[u]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[j]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[m]}],"border-spacing-x":[{"border-spacing-x":[m]}],"border-spacing-y":[{"border-spacing-y":[m]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ne]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",Ne]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ne]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[Co,Ne]}],"translate-x":[{"translate-x":[ne]}],"translate-y":[{"translate-y":[ne]}],"skew-x":[{"skew-x":[F]}],"skew-y":[{"skew-y":[F]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ne]}],accent:[{accent:["auto",s]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ne]}],"caret-color":[{caret:[s]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ue()}],"scroll-mx":[{"scroll-mx":ue()}],"scroll-my":[{"scroll-my":ue()}],"scroll-ms":[{"scroll-ms":ue()}],"scroll-me":[{"scroll-me":ue()}],"scroll-mt":[{"scroll-mt":ue()}],"scroll-mr":[{"scroll-mr":ue()}],"scroll-mb":[{"scroll-mb":ue()}],"scroll-ml":[{"scroll-ml":ue()}],"scroll-p":[{"scroll-p":ue()}],"scroll-px":[{"scroll-px":ue()}],"scroll-py":[{"scroll-py":ue()}],"scroll-ps":[{"scroll-ps":ue()}],"scroll-pe":[{"scroll-pe":ue()}],"scroll-pt":[{"scroll-pt":ue()}],"scroll-pr":[{"scroll-pr":ue()}],"scroll-pb":[{"scroll-pb":ue()}],"scroll-pl":[{"scroll-pl":ue()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ne]}],fill:[{fill:[s,"none"]}],"stroke-w":[{stroke:[yr,Vr,Mu]}],stroke:[{stroke:[s,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},_b=cb(Pb);function te(...s){return _b(Yv(s))}function Lo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function ci({value:s,label:o,detail:i}){const d=2*Math.PI*24,f=d-Math.min(s,100)/100*d,m=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:te("fill-none transition-all duration-700 ease-out",m),strokeWidth:"4.5",strokeDasharray:d,strokeDashoffset:f,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),i&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Mb(){const{data:s}=xc(3e3);return n.jsxs("div",{className:"md:col-span-2 flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(ci,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),n.jsx(ci,{value:s.ram.percent,label:"RAM",detail:`${Nt(s.ram.used)} / ${Nt(s.ram.total)} GB`}),s.gpu&&s.gpu.busy_percent!=null&&s.gpu.gtt_used!=null&&s.gpu.gtt_total!=null&&n.jsx(ci,{value:s.gpu.busy_percent,label:"GPU",detail:`${Nt(s.gpu.gtt_used)} / ${Nt(s.gpu.gtt_total)} GB`}),s.disk&&n.jsx(ci,{value:s.disk.percent,label:"Disk",detail:`${Nt(s.disk.used)} / ${Nt(s.disk.total)} GB`})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(s==null?void 0:s.temp)&&(s.temp.cpu||s.temp.gpu)&&n.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[s.temp.cpu!=null&&n.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]})}function Si({type:s,title:o,message:i,defaultValue:u,onConfirm:d,onCancel:f}){const m=g.useRef(null);return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),n.jsx("button",{onClick:f||(()=>d()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:i}),s==="prompt"&&n.jsx("input",{ref:m,type:"text",defaultValue:u,className:"w-full h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:h=>{var v;h.key==="Enter"&&d((v=m.current)==null?void 0:v.value)}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&n.jsx("button",{onClick:f,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),n.jsx("button",{onClick:()=>{var v;const h=s==="prompt"?(v=m.current)==null?void 0:v.value:void 0;d(h)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:s==="confirm"?"Ja, fortfahren":s==="prompt"?"Übernehmen":"OK"})]})]})})}function Vo(){const[s,o]=g.useState(null),i=g.useCallback(()=>o(null),[]),u=g.useCallback((h,v,x)=>{o({type:"alert",title:h,message:v,onConfirm:()=>{o(null),x==null||x()}})},[]),d=g.useCallback((h,v,x,b)=>{o({type:"confirm",title:h,message:v,onConfirm:()=>{o(null),x()},onCancel:()=>{o(null),b==null||b()}})},[]),f=g.useCallback((h,v,x,b,j)=>{o({type:"prompt",title:h,message:v,defaultValue:x,onConfirm:M=>{o(null),b(M)},onCancel:()=>{o(null),j==null||j()}})},[]),m=s?n.jsx(Si,{...s}):null;return{showAlert:u,showConfirm:d,showPrompt:f,close:i,dialogElement:m}}function Rb(){const s=zs(),{data:o}=Qv(3e3),{data:i=[]}=Gv(3e3),{showConfirm:u,dialogElement:d}=Vo(),[f,m]=g.useState(""),[h,v]=g.useState(!1),[x,b]=g.useState(""),[j,M]=g.useState(!1),[D,I]=g.useState({open:!1,actionPath:"",actionLabel:""}),w=()=>{s.invalidateQueries({queryKey:mt.updates}),s.invalidateQueries({queryKey:mt.jobs}),s.invalidateQueries({queryKey:mt.models})};async function C(R,F,K,ne){m(`${F} wird ausgeführt...`),v(!0);try{const ee={...K},J=await he(R,{method:"POST",body:JSON.stringify(ee)});if(J.status==="password_required"||J.status==="incorrect_password"){I({open:!0,actionPath:R,actionLabel:F,payload:K,error:J.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),m("");return}J.job_id?m(`${F} gestartet (Job-ID: ${J.job_id})`):J.ok?m(`${F} erfolgreich ausgeführt.`):m(`Fehler: ${J.err||"Unbekannter Fehler"}`),w()}catch(ee){m(`Fehler bei ${F}: ${ee.message}`)}finally{v(!1)}}async function _(){M(!0);try{const R={...D.payload,sudo_password:x},F=await he(D.actionPath,{method:"POST",body:JSON.stringify(R)});if(F.status==="password_required"||F.status==="incorrect_password"){I(K=>({...K,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}F.job_id?m(`${D.actionLabel} gestartet (Job-ID: ${F.job_id})`):F.ok?m(`${D.actionLabel} erfolgreich ausgeführt.`):m(`Fehler: ${F.err||"Unbekannter Fehler"}`),I({open:!1,actionPath:"",actionLabel:""}),b(""),w()}catch(R){m(`Fehler: ${R.message}`),I({open:!1,actionPath:"",actionLabel:""}),b("")}finally{M(!1)}}async function $(R,F){m(`Upgrade für ${R} wird gestartet...`);try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:R,role:F,quant:"Q4_K_M",jinja:!0})}),m("Upgrade-Download gestartet."),w()}catch(K){m(`Upgrade fehlgeschlagen: ${K.message}`)}}const H=i.find(R=>R.label.includes("OS-Update")&&(R.state==="running"||R.state==="queued")),z=i.find(R=>R.label.includes("Engine-Update")&&(R.state==="running"||R.state==="queued"));return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[D.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/60 bg-card/90 backdrop-blur-xl p-5 shadow-2xl space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{I({open:!1,actionPath:"",actionLabel:""}),b("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:D.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:x,onChange:R=>b(R.target.value),placeholder:"Sudo-Passwort eingeben...",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground",onKeyDown:R=>R.key==="Enter"&&_(),autoFocus:!0}),D.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:D.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{I({open:!1,actionPath:"",actionLabel:""}),b("")},className:"h-8 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent transition-all cursor-pointer",children:"Abbrechen"}),n.jsx("button",{onClick:_,disabled:!x||j,className:"h-8 px-4 rounded-lg bg-primary text-primary-foreground text-[10px] font-bold uppercase hover:opacity-90 transition-all disabled:opacity-50 cursor-pointer flex items-center justify-center gap-1.5",children:j?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(R0,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(o==null?void 0:o.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(o.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),o?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:te("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.os>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:o.os>0?`${o.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:te("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.engine>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:o.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:te("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:o.models>0?`${o.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>C("/api/maintenance/os-update","OS-Update"),disabled:h||!!H,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:H?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",H.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>C("/api/maintenance/engine-update","Engine-Update"),disabled:h||!!z,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:z?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",z.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{u("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>C("/api/maintenance/reboot","Reboot"))},disabled:h,className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 text-red-400 text-[10px] font-bold uppercase hover:bg-red-500/10 transition-all cursor-pointer disabled:opacity-50",children:[n.jsx(Ph,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),o.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:o.model_list.map(R=>n.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-background/25 border border-border/30 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${R.role}: ${R.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:R.role}),": ",R.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>$(R.repo,R.role),className:"px-2 py-0.5 text-[8px] font-bold uppercase rounded bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer flex items-center gap-0.5",children:[n.jsx(Tn,{className:"h-2.5 w-2.5"})," Laden"]})]},R.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),f&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:f}),n.jsxs("div",{className:"text-[9px] text-muted-foreground/60 leading-normal border-t border-border/10 pt-2.5 flex items-start gap-1",children:[n.jsx(An,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer")),className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer shadow-md shadow-primary/10",children:"System-Zentrale öffnen"})}),d]})}function Ob(){const s=zs(),{data:o}=dm(3e3),{data:i}=yc(),{showAlert:u,dialogElement:d}=Vo(),[f,m]=g.useState(!1),h=(i==null?void 0:i.models)??[];async function v(x){try{await he("/api/agent/brain",{method:"POST",body:JSON.stringify({model:x})}),u("Erfolgreich",`Hermes-Gehirn wurde auf '${x}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:mt.agentStatus}),m(!1)}catch(b){u("Fehler",`Fehler beim Wechseln des Gehirns: ${b.message}`)}}return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Oo,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(o==null?void 0:o.webui_url)&&n.jsxs("a",{href:Lo(o.webui_url),target:"_blank",rel:"noopener",className:te("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(xi,{className:"h-3 w-3"})," Hermes öffnen"]})]}),o?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full",o.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:o.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full",o.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:o.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>m(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(Ot,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(To,{className:"h-3.5 w-3.5"}),o.brain_model?`model: ${o.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."}),o&&f&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(Ot,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>m(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...h.map(x=>{var b;return((b=x.name.split("/").pop())==null?void 0:b.replace(".gguf",""))||x.name})].map(x=>{const b=["auto","fast","heavy"].includes(x);return n.jsxs("button",{onClick:()=>v(x),className:te("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",o.brain_model===x||!o.brain_model&&x==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:x}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:b?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===x||!o.brain_model&&x==="auto")&&n.jsx(Ds,{className:"h-4 w-4 shrink-0 text-primary"})]},x)})})]})}),d]})}const Db=["fast","heavy","coder","reasoning","vision","scout"];function Tb(){const{data:s}=yc(3e3),o=(s==null?void 0:s.models)??[],i=(s==null?void 0:s.running)??[];return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:Db.map(u=>{var m;const d=o.find(h=>h.role===u),f=d?i.includes(d.name):!1;return n.jsxs("div",{className:te("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",f?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":d?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:te("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",u==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":u==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":u==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":u==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":u==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:u}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:d?(m=d.name.split("/").pop())==null?void 0:m.replace(/\.gguf$/i,""):"nicht zugewiesen"}),d&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[d.prompt_cache&&n.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),d.spec_draft_model&&n.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${d.spec_draft_model})`,children:"SPEC"}),d.parallel_slots>1&&n.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${d.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",d.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:d?f?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},u)})})]}),n.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Ab(){const s=zs(),{data:o=[]}=fm({limit:3}),[i,u]=g.useState(""),[d,f]=g.useState("stable"),[m,h]=g.useState(!1);async function v(){if(!(!i.trim()||m)){h(!0);try{await he("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:d,source:"dashboard"})}),u(""),s.invalidateQueries({queryKey:["memory"]})}catch(x){console.error(x)}finally{h(!1)}}}return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Do,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:i,onChange:x=>u(x.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:d,onChange:x=>f(x.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:v,disabled:!i.trim()||m,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[n.jsx(Eh,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:o.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):o.map(x=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:x.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:x.content,children:x.content})]},x.id))})]})]}),n.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}function zb(){var o;const{data:s}=Kv(3e3);return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(y0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),s?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[s.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",s.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:s.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[s.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[s.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(o=s==null?void 0:s.pricing)!=null&&o.heavy?` (Ø ${s.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${s.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})}function Lb(){return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.jsx(Mb,{}),n.jsx(Rb,{})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.jsx(Ob,{}),n.jsx(Tb,{}),n.jsx(Ab,{}),n.jsx(zb,{})]})]})}function jn({children:s,tone:o="muted"}){const i={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${i[o]}`,children:s})}function qp({caps:s}){return s?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&n.jsx(jn,{children:"💻 Code"}),s.vision&&n.jsx(jn,{children:"👁 Bild"}),s.reasoning&&n.jsx(jn,{children:"🧠 Reason"}),s.moe&&n.jsxs(jn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&n.jsx(jn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&n.jsx(jn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&n.jsx(jn,{children:"🔢 Embed"})]}):null}function Ib({onError:s}){const[o,i]=g.useState([]),[u,d]=g.useState(null);function f(){he("/api/jobs").then(x=>i(x.jobs||[])).catch(()=>{})}g.useEffect(()=>{f();const x=setInterval(f,2e3);return()=>clearInterval(x)},[]);async function m(x){try{await he(`/api/jobs/${x}/cancel`,{method:"POST"}),f()}catch(b){s?s(b.message):d(b.message)}}const h=o.filter(x=>x.state==="running"||x.state==="queued"),v=o.filter(x=>x.state!=="running"&&x.state!=="queued").slice(-3);return h.length===0&&v.length===0?null:n.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),h.map(x=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:x.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[x.progress??0,"% • ",nc(x.done_bytes),"/",nc(x.total_bytes),x.eta_s?` • ETA ${Zv(x.eta_s)}`:""]}),n.jsx("button",{onClick:()=>m(x.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${x.progress??0}%`}})})]},x.id)),v.map(x=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:x.label}),n.jsx("span",{className:te("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",x.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:x.state})]},x.id)),u&&n.jsx(Si,{type:"alert",title:"Fehler",message:u,onConfirm:()=>d(null)})]})}function Fb({fit:s}){const o={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[s.level];return n.jsxs("span",{className:te("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}const Ub=["fast","heavy","coder","reasoning","agent","vision","scout"];function Zp(s){const o=s.toLowerCase();return o.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:o.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:o.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:o.includes("mistral")||o.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:o.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:o.includes("hermes")||o.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:o.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function $b(){var Un,Sr,ir,$n,Us;const[s,o]=g.useState([]),[i,u]=g.useState([]),[d,f]=g.useState(null),[m,h]=g.useState(null),[v,x]=g.useState(null),[b,j]=g.useState(!0),[M,D]=g.useState(""),[I,w]=g.useState(null),[C,_]=g.useState(null),[$,H]=g.useState(!1),[z,R]=g.useState(null),[F,K]=g.useState("grid"),[ne,ee]=g.useState("all"),[J,ke]=g.useState(null);function ue(A,oe,be){ke({type:"alert",title:A,message:oe,onConfirm:()=>{ke(null)}})}function Le(A,oe,be,Ee){ke({type:"confirm",title:A,message:oe,onConfirm:()=>{ke(null),be()},onCancel:()=>{ke(null)}})}function _e(A,oe,be,Ee,Ie){ke({type:"prompt",title:A,message:oe,defaultValue:be,onConfirm:Ut=>{ke(null),Ee(Ut)},onCancel:()=>{ke(null)}})}const Oe=s.filter(A=>ne==="in_use"?!!A.role||i.includes(A.name):!0),[Te,Me]=g.useState({width:800,height:360}),Q=g.useRef(null),ce=g.useCallback(A=>{if(Q.current&&(Q.current.disconnect(),Q.current=null),A){const oe=new ResizeObserver(be=>{if(!be||be.length===0)return;const Ee=be[0].contentRect;Me({width:Ee.width,height:Ee.height})});oe.observe(A),Q.current=oe}},[]),Z=Te.width,P=Te.height,N=A=>{const oe=Z*.1,be=P*A,Ee=Z*.5,Ie=P*.5,Ut=Z*.3,ar=be,ur=Z*.3;return`M ${oe} ${be} C ${Ut} ${ar}, ${ur} ${Ie}, ${Ee} ${Ie}`},G=A=>{const oe=Z*.5,be=P*.5,Ee=Z*.9,Ie=P*A,Ut=Z*.7,ar=be,ur=Z*.7;return`M ${oe} ${be} C ${Ut} ${ar}, ${ur} ${Ie}, ${Ee} ${Ie}`};function X(){Promise.all([he("/api/models"),he("/api/routing"),he("/api/connect"),he("/api/maintenance/updates")]).then(([A,oe,be,Ee])=>{o(A.models||[]),u(A.running||[]),f(oe),h(be),x(Ee)}).catch(A=>D(String(A))).finally(()=>j(!1))}g.useEffect(()=>{X();const A=setInterval(X,4e3);return()=>clearInterval(A)},[]);async function Y(A){try{await he(`/api/models/${encodeURIComponent(A)}/load`,{method:"POST"}),X()}catch(oe){ue("Fehler",`Fehler beim Laden des Modells: ${oe.message}`)}}async function ie(A){try{await he(`/api/models/${encodeURIComponent(A)}/unload`,{method:"POST"}),X()}catch(oe){ue("Fehler",`Fehler beim Entladen des Modells: ${oe.message}`)}}async function pe(){try{await he("/api/models/unload",{method:"POST"}),X()}catch(A){ue("Fehler",`Fehler beim Entladen aller Modelle: ${A.message}`)}}async function we(A,oe){try{await he(`/api/models/${encodeURIComponent(oe)}/role`,{method:"POST",body:JSON.stringify({role:A||null})}),X()}catch(be){ue("Fehler",`Fehler beim Zuweisen der Rolle: ${be.message||be}`)}}async function U(A,oe){_e("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(oe||32768),async be=>{if(be)try{await he(`/api/models/${encodeURIComponent(A)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(be,10)})}),X()}catch(Ee){ue("Fehler",`Fehler beim Setzen des Kontexts: ${Ee.message||Ee}`)}})}async function me(A){Le("Modell löschen?",`Modell '${A}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await he(`/api/models/${encodeURIComponent(A)}`,{method:"DELETE"}),X()}catch(oe){ue("Fehler",`Fehler beim Löschen: ${oe.message||oe}`)}})}async function St(A,oe,be,Ee){try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:A,role:oe,quant:be,jinja:Ee})}),ue("Herunterladen gestartet",`Download für '${A}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Ie){ue("Fehler",`Fehler beim Starten des Upgrades: ${Ie.message||Ie}`)}}async function Go(A){A&&(await navigator.clipboard.writeText(A),H(!0),setTimeout(()=>H(!1),1500))}if(b)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(M)return n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",M,")."]});const kr=s.filter(A=>i.includes(A.name)),ln=kr.reduce((A,oe)=>A+(oe.size_bytes||0),0),Is=16*1024**3,Fs=ln>Is?ln*1.2:Is,Fn=A=>s.find(oe=>oe.role===A),Nr=A=>{const oe=Fn(A);return oe?i.includes(oe.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; } } .svg-flow-path { stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } `}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Zu,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",wn(ln)," / ",wn(Fs)," geladen"]}),i.length>0&&n.jsx("button",{onClick:pe,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),n.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:kr.length===0?n.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):kr.map((A,oe)=>{var Ie;const be=(A.size_bytes||0)/Fs*100,Ee=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][oe%4];return n.jsxs("div",{style:{width:`${be}%`},className:te("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",Ee),title:`${A.name} (${wn(A.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[A.role?`[${A.role}] `:"",(Ie=A.name.split("/").pop())==null?void 0:Ie.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:wn(A.size_bytes)})]},A.name)})})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),n.jsxs("div",{ref:ce,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:N(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="roocode"||I==="roocode")&&n.jsx("path",{d:N(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="cursor"||I==="cursor")&&n.jsx("path",{d:N(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="opencode"||I==="opencode")&&n.jsx("path",{d:N(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="zed"||I==="zed")&&n.jsx("path",{d:N(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:N(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="continue"||I==="continue")&&n.jsx("path",{d:N(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("fast")&&n.jsx("path",{d:G(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("heavy")&&n.jsx("path",{d:G(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("coder")&&n.jsx("path",{d:G(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("vision")&&n.jsx("path",{d:G(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Nr("scout")&&n.jsx("path",{d:G(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>R("roocode"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>R("cursor"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>R("opencode"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>R("zed"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>R("continue"),onMouseLeave:()=>R(null),onClick:()=>w(A=>A==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",d!=null&&d.heavy_threshold_chars?d.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),Ub.map(A=>{var Ut;const oe=["12%","31%","50%","69%","88%"],be=Fn(A),Ee=be?i.includes(be.name):!1;if(A==="reasoning"||A==="agent")return null;const Ie={fast:0,heavy:1,coder:2,vision:3,scout:4}[A];return n.jsxs("div",{className:te("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",Ee?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":be?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:oe[Ie]},onClick:()=>_(A),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:A}),Ee&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:be?(Ut=be.name.split("/").pop())==null?void 0:Ut.replace(".gguf",""):"Keine Zuweisung"})]},A)}),I&&m&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[I==="roocode"&&"Roo Code Setup",I==="cursor"&&"Cursor Setup",I==="opencode"&&"OpenCode Setup",I==="zed"&&"Zed Setup",I==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>w(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[I==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),I==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),I==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),I==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),I==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),m.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var A,oe,be,Ee,Ie;return Go(I==="roocode"?(A=m.tools.cline)==null?void 0:A.snippet:I==="cursor"?(oe=m.tools.cursor)==null?void 0:oe.snippet:I==="opencode"?(be=m.tools.opencode)==null?void 0:be.snippet:I==="zed"?(Ee=m.tools.zed)==null?void 0:Ee.snippet:(Ie=m.tools.continue)==null?void 0:Ie.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[$?n.jsx(Ds,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Ch,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:$?"Kopiert":"Kopieren"})]})]}),n.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:n.jsxs("code",{children:[I==="roocode"&&((Un=m.tools.cline)==null?void 0:Un.snippet),I==="cursor"&&((Sr=m.tools.cursor)==null?void 0:Sr.snippet),I==="opencode"&&((ir=m.tools.opencode)==null?void 0:ir.snippet),I==="zed"&&(($n=m.tools.zed)==null?void 0:$n.snippet),I==="continue"&&((Us=m.tools.continue)==null?void 0:Us.snippet)]})})]}),n.jsx("button",{onClick:()=>w(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(A=>{var Ee;const oe=s.find(Ie=>Ie.role===A),be=oe?i.includes(oe.name):!1;return n.jsxs("div",{onClick:()=>_(A),className:te("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",be?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":oe?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:te("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",A==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":A==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":A==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":A==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":A==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:A}),be&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:oe==null?void 0:oe.name,children:oe?(Ee=oe.name.split("/").pop())==null?void 0:Ee.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},A)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Oe.length," von ",s.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>ee("all"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>ee("in_use"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>K("grid"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",F==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>K("list"),className:te("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",F==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),F==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Oe.length===0?n.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Oe.map(A=>{const oe=i.includes(A.name),be=v==null?void 0:v.model_list.find(Ie=>Ie.role===A.role),Ee=Zp(A.name);return n.jsxs("div",{className:te("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",oe?"border-primary/45 shadow-primary/5":A.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:te("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ee.color),title:Ee.name,children:Ee.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:A.name,children:A.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:A.quant||"GGUF"}),oe&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(gi,{className:"h-3 w-3 animate-pulse"})," Warm"]}),A.role&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:A.role}),A.prompt_cache&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),A.spec_draft_model&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${A.spec_draft_model})`,children:"SPEC"}),A.parallel_slots>1&&n.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${A.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",A.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(qp,{caps:A.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(Zu,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:wn(A.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(C0,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:Gp(A.ctx)})]})]})]}),be&&n.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",be.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>St(be.repo,A.role,A.quant||"Q4_K_M",A.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[n.jsx(Tn,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>oe?ie(A.name):Y(A.name),className:te("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",oe?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:oe?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(A.name,A.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),n.jsx("button",{onClick:()=>me(A.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:n.jsx(Yu,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})}):n.jsx("div",{className:"space-y-2",children:Oe.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Oe.map(A=>{const oe=i.includes(A.name),be=Zp(A.name);return n.jsxs("div",{className:te("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",oe?"border-primary/45":A.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:te("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",be.color),title:be.name,children:be.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:A.name,children:A.name.split("/").pop()}),A.role&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:A.role}),A.prompt_cache&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),A.spec_draft_model&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${A.spec_draft_model})`,children:"SPEC"}),A.parallel_slots>1&&n.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${A.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",A.parallel_slots]}),oe&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",wn(A.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",Gp(A.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:A.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(qp,{caps:A.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>oe?ie(A.name):Y(A.name),className:te("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",oe?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:oe?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(A.name,A.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),n.jsx("button",{onClick:()=>me(A.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:n.jsx(Yu,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",C,"' konfigurieren"]}),n.jsx("button",{onClick:()=>_(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:C}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{we(C,""),_(null)},className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:n.jsx("span",{children:"Zuweisung entfernen"})}),s.map(A=>{var oe;return n.jsxs("button",{onClick:()=>{we(C,A.name),_(null)},className:te("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",A.role===C?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(oe=A.name.split("/").pop())==null?void 0:oe.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[wn(A.size_bytes)," · ",A.quant]})]}),A.role===C&&n.jsx(Ds,{className:"h-4 w-4 shrink-0 text-primary"})]},A.name)})]})]})}),J&&n.jsx(Si,{type:J.type,title:J.title,message:J.message,defaultValue:J.defaultValue,onConfirm:J.onConfirm,onCancel:J.onCancel})]})}function Bb(){const[s,o]=g.useState(""),[i,u]=g.useState([]),[d,f]=g.useState("Q4_K_M"),[m,h]=g.useState(""),[v,x]=g.useState(""),[b,j]=g.useState([]);async function M(w){const C=w??s;if(C.trim()){h("Analysiere HuggingFace Repository...");try{const _=await he(`/api/hf/quants?repo=${encodeURIComponent(C)}`);o(_.repo),u(_.quants),_.quants.length&&f(_.quants.includes("Q4_K_M")?"Q4_K_M":_.quants[0]),h(_.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(_){h(`Fehler: ${_}`)}}}async function D(){if(v.trim()){h("Durchsuche HuggingFace...");try{const w=await he(`/api/hf/search?q=${encodeURIComponent(v)}`);j(w.results),h(w.results.length?"":"Keine Ergebnisse gefunden.")}catch(w){h(`Suche fehlgeschlagen: ${w}`)}}}async function I(){if(s.trim()){h("Download-Job wird initiiert...");try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:d,jinja:!0})}),h(`Download gestartet: ${s} (${d}). Fortschritt wird oben angezeigt.`)}catch(w){h(`Download-Fehler: ${w}`)}}}return n.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:s,onChange:w=>o(w.target.value),placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>M(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),i.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:d,onChange:w=>f(w.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:i.map(w=>n.jsx("option",{value:w,className:"bg-popover text-foreground",children:w},w))}),n.jsxs("button",{onClick:I,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[n.jsx(Tn,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:v,onChange:w=>x(w.target.value),onKeyDown:w=>w.key==="Enter"&&D(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsx(fc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:D,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),b.length>0&&n.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:b.map(w=>n.jsxs("button",{onClick:()=>{o(w.repo),j([]),x(""),M(w.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[n.jsx("span",{className:"font-semibold truncate",children:w.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(Tn,{className:"h-3 w-3"})," ",w.downloads.toLocaleString()]})]},w.repo))}),m&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:m})]})}const Hb={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:qu},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Ku},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Do},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Oo},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:Qu}};function Wb(){const[s,o]=g.useState(null),[i,u]=g.useState([]),[d,f]=g.useState(null),[m,h]=g.useState(""),[v,x]=g.useState(!0),[b,j]=g.useState({}),[M,D]=g.useState({}),[I,w]=g.useState(!1);g.useEffect(()=>{Promise.all([he("/api/discover"),he("/api/models"),he("/api/maintenance/updates").catch(()=>null)]).then(([_,$,H])=>{o(_),u($.models||[]),H&&f(H)}).catch(_=>h(String(_))).finally(()=>x(!1))},[]);async function C(_,$,H,z){j(R=>({...R,[_]:"Starte..."}));try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:_,role:$,quant:H,jinja:z})}),j(R=>({...R,[_]:"Download läuft"}))}catch{j(F=>({...F,[_]:"Fehler"}))}}return v?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):m||!s?n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",m,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(_h,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(_=>{const $=Hb[_.role]||{title:_.title||_.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:To},H=$.icon,z=i.find(J=>J.role===_.role),R=d==null?void 0:d.model_list.find(J=>J.role===_.role),F=_.models.find(J=>J.repo===_.recommended)||_.models[0];if(!F)return null;const K=b[F.repo],ne=_.models.filter(J=>J.repo!==_.recommended),ee=!!M[_.role];return n.jsxs("div",{className:te("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",z?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:n.jsx(H,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:$.title}),n.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",_.role]})]})]}),z?n.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:z?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:z.name,children:z.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",nc(z.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",z.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:F.name,children:F.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",F.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",F.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(Fb,{fit:F.fit})})]})}),n.jsx("div",{className:"pt-1",children:z?R?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",R.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>C(R.repo,_.role,F.quant||"Q4_K_M",F.caps.tools!=="no"),disabled:!!b[R.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[n.jsx(Tn,{className:"h-3.5 w-3.5"}),b[R.repo]||"Auf neue Version aktualisieren"]})]}):n.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[n.jsx(Ds,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>C(F.repo,_.role,F.quant||"Q4_K_M",F.caps.tools!=="no"),disabled:!!K,className:te("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",K?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(Tn,{className:"h-3.5 w-3.5"}),K||"Optimales Modell einsetzen"]})})]}),ne.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>D(J=>({...J,[_.role]:!ee})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[ee?n.jsx(m0,{className:"h-3 w-3"}):n.jsx(f0,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",ne.length,")"]})]}),ee&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:ne.map(J=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:J.name,children:J.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",J.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:J.fit.text})]})]}),n.jsx("button",{onClick:()=>C(J.repo,_.role,J.quant||"Q4_K_M",J.caps.tools!=="no"),disabled:!!b[J.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:b[J.repo]||"Installieren"})]},J.repo))})]})]},_.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>w(!I),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(fc,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:I?"Ausblenden ▲":"Anzeigen ▼"})]}),I&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(Bb,{})})]})]})}function Vb(){const[s,o]=g.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(i=>n.jsx("button",{onClick:()=>o(i),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",s===i?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:i==="cockpit"?"Cockpit":"Modelle finden"},i))})]}),n.jsx(Ib,{}),n.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?n.jsx($b,{}):n.jsx(Wb,{})})]})}function di({label:s,percent:o,detail:i,icon:u}){const d=o>90?"bg-red-500 shadow-md shadow-red-500/20":o>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/30 transition-all duration-300",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(u,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:te("h-full transition-all duration-700 ease-out",d),style:{width:`${Math.min(o,100)}%`}})}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Gb(){const{data:s,error:o}=xc(3e3),{data:i}=Vv(3e3),{showAlert:u,dialogElement:d}=Vo(),f=o?String(o):"",[m,h]=g.useState(""),[v,x]=g.useState({});async function b(){h("Backup snapshotted...");try{const M=await he("/api/system/backup",{method:"POST"});h(M.ok?`Snapshot erzeugt: ${M.snapshot} (${M.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(M){h(`Fehler: ${M.message}`)}}async function j(M){x(D=>({...D,[M]:!0}));try{const D=await he("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:M})});D.ok?u("Erfolgreich",`Dienst ${M} wurde erfolgreich neu gestartet.`):u("Fehler beim Neustart",`Fehler beim Neustart: ${D.err||"Unbekannter Fehler"}`)}catch(D){u("Fehler",`Fehler: ${D.message}`)}finally{x(D=>({...D,[M]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"System-Diagnose & Status"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["System-Status nicht lesbar (",f,")."]}),s&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(di,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:Ot}),n.jsx(di,{label:"RAM",percent:s.ram.percent,detail:`${Nt(s.ram.used)} / ${Nt(s.ram.total)} GB`,icon:gi}),s.gpu&&s.gpu.busy_percent!=null&&n.jsx(di,{label:"GPU",percent:s.gpu.busy_percent,detail:s.gpu.gtt_used!=null&&s.gpu.gtt_total?`${Nt(s.gpu.gtt_used)} / ${Nt(s.gpu.gtt_total)} GB (GTT/unified)`:s.gpu.vram_used!=null&&s.gpu.vram_total?`${Nt(s.gpu.vram_used)} / ${Nt(s.gpu.vram_total)} GB VRAM`:void 0,icon:Ot}),s.disk&&n.jsx(di,{label:"Disk",percent:s.disk.percent,detail:`${Nt(s.disk.used)} / ${Nt(s.disk.total)} GB`,icon:Zu})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&n.jsxs("div",{className:"flex gap-3 text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-2.5 rounded-xl self-start w-fit",children:[s.temp.cpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&n.jsx("span",{children:"|"}),s.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),i&&n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"h-7 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",children:"System-Logs anzeigen"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:i.services.map(M=>n.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-xl bg-background/20 border border-border/30 hover:border-primary/20 transition-all group",children:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:te("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",M.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:M.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:M.url})]})]}),n.jsx("button",{onClick:()=>j(M.name),disabled:v[M.name],className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-primary hover:bg-primary/5 flex items-center justify-center transition-all opacity-0 group-hover:opacity-100",title:"Dienst neu starten",children:n.jsx(Dn,{className:te("h-3.5 w-3.5",v[M.name]&&"animate-spin")})})]},M.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Lo(i.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[n.jsx(xi,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Lo(i.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[n.jsx(xi,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.jsxs("button",{onClick:b,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[n.jsx(P0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),m&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:m}),d]})}function Kb(){const[s,o]=g.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[i,u]=g.useState(localStorage.getItem("mc_mcp_path")||""),[d,f]=g.useState("cline"),[m,h]=g.useState(!1),v=new URLSearchParams({host:s});i&&v.set("mcp_path",i);const{data:x,error:b}=qv(v.toString()),j=b?String(b):"";function M(C){o(C),C&&localStorage.setItem("mc_host",C)}function D(C){u(C),localStorage.setItem("mc_mcp_path",C)}const I=x==null?void 0:x.tools[d];async function w(){I&&(await navigator.clipboard.writeText(I.snippet),h(!0),setTimeout(()=>h(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Kopiere vorgefertigte Konfigurationsdateien für deinen lokalen PC (IDEs, Cline, Roo Code, Cursor), um direkt auf das geteilte Gedächtnis und den Auto-Swap-Gateway der Box zuzugreifen."})]}),n.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(j0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:s,onChange:C=>M(C.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(w0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:i,onChange:C=>D(C.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]})]}),j&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",j]}),x&&n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex flex-wrap gap-1 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:Object.entries(x.tools).map(([C,_])=>n.jsx("button",{onClick:()=>f(C),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",d===C?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:_.label},C))}),I&&n.jsxs("div",{className:"space-y-3",children:[I.note&&n.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-xs text-muted-foreground leading-relaxed",children:[n.jsx(k0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:I.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:[n.jsx(yi,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:d==="cline"||d==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:w,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[m?n.jsx(Ds,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Ch,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:m?"Kopiert":"Kopieren"})]})]}),n.jsx("pre",{className:"p-5 overflow-x-auto text-xs font-mono text-cyan-200/90 whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",children:n.jsx("code",{children:I.snippet})})]})]})]})]})}const Yp=["user","instruction","stable","versioned","ephemeral"],Ru={user:{label:"User",icon:A0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:_0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:An,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:D0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:x0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Jp={label:"Gedächtnis",icon:Sh,bg:"bg-muted/10",text:"text-muted-foreground"},Qb={user:"border-l-cyan-500/80",instruction:"border-l-violet-500/80",stable:"border-l-indigo-500/80",versioned:"border-l-amber-500/80",ephemeral:"border-l-pink-500/80"};function qb(){const[s,o]=g.useState(""),[i,u]=g.useState(""),[d,f]=g.useState(""),[m,h]=g.useState("stable"),[v,x]=g.useState(!1),b=zs(),{showAlert:j,showConfirm:M,dialogElement:D}=Vo(),{data:I=[],error:w}=fm({q:i,category:s}),C=w?String(w):"",_=()=>b.invalidateQueries({queryKey:["memory"]});async function $(){d.trim()&&(await he("/api/memory",{method:"POST",body:JSON.stringify({content:d,category:m,source:"ui"})}),f(""),_())}async function H(R){await he(`/api/memory/${R}`,{method:"DELETE"}),_()}async function z(){x(!0);try{const R=await he("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(R.duplicate_count===0){j("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${R.duplicate_count} Dublette(n) in ${R.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await he("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),_()}catch(F){j("Fehler",`Fehler beim Löschen: ${F.message}`)}})}catch(R){j("Fehler",`Fehler bei der Deduplizierung: ${R.message}`)}finally{x(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool (Memory)"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Die geteilte Konstitution des Systems. Alle Instanzen (Hermes, IDEs, Gateway) lesen und schreiben hierauf per MCP-Protokoll."})]}),n.jsxs("button",{onClick:z,disabled:v,className:"flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50 shrink-0 self-start",children:[n.jsx(O0,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:d,onChange:R=>f(R.target.value),placeholder:"Füge eine neue Regel, eine Vorliebe oder einen stabilen Fakt über das Projekt oder dich hinzu...",rows:3,className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3.5 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground transition-all leading-relaxed"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:m,onChange:R=>h(R.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 py-1 text-xs outline-none font-semibold text-foreground cursor-pointer",children:Yp.map(R=>{var F;return n.jsx("option",{value:R,className:"bg-popover text-foreground",children:((F=Ru[R])==null?void 0:F.label)||R},R)})})]}),n.jsxs("button",{onClick:$,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[n.jsx(Eh,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:i,onChange:R=>u(R.target.value),placeholder:"Gedächtnis durchsuchen...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsx(fc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl overflow-x-auto max-w-full",children:[n.jsx("button",{onClick:()=>o(""),className:te("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",s?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Yp.map(R=>{const F=Ru[R]||Jp,K=F.icon;return n.jsxs("button",{onClick:()=>o(R),className:te("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 whitespace-nowrap",s===R?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(K,{className:"h-3 w-3"}),n.jsx("span",{children:F.label})]},R)})]})]}),C&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Laden des Gedächtnisses: ",C]}),n.jsx("div",{className:"space-y-3",children:I.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):I.map(R=>{const F=Ru[R.category]||Jp,K=F.icon;return n.jsxs("div",{className:te("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",Qb[R.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:te("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",F.bg,F.text),children:[n.jsx(K,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:F.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:R.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.jsx("span",{className:"text-[9px] font-mono text-muted-foreground/60 bg-background/20 px-1.5 py-0.5 rounded uppercase tracking-wider",children:R.source}),n.jsx("button",{onClick:()=>H(R.id),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",title:"Eintrag löschen",children:n.jsx(Yu,{className:"h-3.5 w-3.5"})})]})]},R.id)})}),D]})}function fi({label:s,ok:o,detail:i,icon:u,onClick:d}){return n.jsxs("div",{onClick:d,className:te("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",o?"border-border/60":"border-amber-500/30",d&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),n.jsx(u,{className:te("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:i,children:i})]}),d&&n.jsxs("button",{onClick:f=>{f.stopPropagation(),d()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[n.jsx(Ot,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function Zb(){const{data:s,error:o}=dm(5e3),{data:i}=yc(),{showAlert:u,dialogElement:d}=Vo(),f=zs(),m=o?String(o):"",h=g.useMemo(()=>["auto","fast","heavy",...((i==null?void 0:i.models)??[]).map(R=>{var F;return((F=R.name.split("/").pop())==null?void 0:F.replace(".gguf",""))||R.name})],[i]),[v,x]=g.useState(null),[b,j]=g.useState(!1),[M,D]=g.useState({width:800,height:360}),I=g.useRef(null),w=g.useCallback(z=>{if(I.current&&(I.current.disconnect(),I.current=null),z){const R=new ResizeObserver(F=>{if(!F||F.length===0)return;const K=F[0].contentRect;D({width:K.width,height:K.height})});R.observe(z),I.current=R}},[]),C=M.width,_=M.height,$=(z,R,F,K)=>{const ne=(z+F)/2;return`M ${z} ${R} C ${ne} ${R}, ${ne} ${K}, ${F} ${K}`};async function H(z){try{await he("/api/agent/brain",{method:"POST",body:JSON.stringify({model:z})}),u("Erfolgreich",`Hermes-Gehirn wurde auf '${z}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:mt.agentStatus}),j(!1)}catch(R){u("Fehler",`Fehler beim Wechseln des Gehirns: ${R.message}`)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; } } .svg-flow-path { stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(s==null?void 0:s.webui_url)&&n.jsxs("a",{href:Lo(s.webui_url),target:"_blank",rel:"noopener",className:te("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",s.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[n.jsx(xi,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),m&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",m,")."]}),s&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(fi,{label:"Agent Gateway",ok:s.gateway_reachable,detail:"Port :8642 (REST API)",icon:Oo}),n.jsx(fi,{label:"Agent WebUI",ok:s.webui_reachable,detail:"Port :8787 (Chat UI)",icon:gi}),n.jsx(fi,{label:"Aktives Gehirn",ok:s.gateway_reachable,detail:s.brain_model?`Model: ${s.brain_model}`:"Model: auto",icon:Ot,onClick:()=>j(!0)}),n.jsx(fi,{label:"Verdrahtung",ok:s.has_config,detail:`Config: ${s.has_config?"✓":"—"} · Skills: ${s.has_skills?"✓":"—"} · Memory: ${s.has_memories?"✓":"—"}`,icon:vi})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:w,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="webui"||s.webui_reachable)&&n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="brain"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="wiring"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>x("webui"),onMouseLeave:()=>x(null),onClick:()=>s.webui_reachable&&window.open(Lo(s.webui_url),"_blank"),title:s.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(gi,{className:te("h-3.5 w-3.5",s.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:te("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",s.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>x("gateway"),onMouseLeave:()=>x(null),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Oo,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:te("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",s.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:s.gateway_reachable?"Online":"Offline"})]}),n.jsxs("div",{className:te("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",s.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>x("brain"),onMouseLeave:()=>x(null),onClick:()=>j(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(Ot,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),s.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:s.brain_model,children:s.brain_model||"auto"})]}),n.jsxs("div",{className:te("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",s.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>x("wiring"),onMouseLeave:()=>x(null),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(vi,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),s.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",s.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",s.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",s.has_memories?"✓":"—"]})]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(An,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!s.gateway_reachable&&n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(An,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),s&&b&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(Ot,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>j(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:h.map(z=>{const R=["auto","fast","heavy"].includes(z);return n.jsxs("button",{onClick:()=>H(z),className:te("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",s.brain_model===z||!s.brain_model&&z==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:z}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:R?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(s.brain_model===z||!s.brain_model&&z==="auto")&&n.jsx(Ds,{className:"h-4 w-4 shrink-0 text-primary"})]},z)})})]})}),d]})}function Yb(){const[s,o]=g.useState("connect"),[i,u]=g.useState("roocode"),[d,f]=g.useState(null),m="192.168.178.151",[h,v]=g.useState(!1),[x,b]=g.useState(null);function j(){v(!0),he("/api/health").then(M=>{f(M),b(M.engine_reachable?"success":"partial")}).catch(()=>{f(null),b("fail")}).finally(()=>v(!1))}return g.useEffect(()=>{j()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Stack-Anleitung & Vibe-Coding-Guide"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Einsteigerfreundliche Erklärungen zu deinem Stack und Schritt-für-Schritt-Anleitungen zur Anbindung deiner Editoren."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>o("connect"),className:te("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),n.jsx("button",{onClick:()=>o("concepts"),className:te("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),s==="connect"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:te("h-3 w-3 rounded-full ring-2 ring-black/40",x==="success"&&"bg-emerald-500 animate-pulse",x==="partial"&&"bg-amber-500",x==="fail"&&"bg-red-500",!x&&"bg-muted")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[x==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(d==null?void 0:d.version)||""}).`,x==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",x==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!x&&"Verbindung wird geprüft..."]})]})]}),n.jsxs("button",{onClick:j,disabled:h,className:"h-8 px-3 flex items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50 cursor-pointer self-start sm:self-auto shrink-0",children:[n.jsx(Dn,{className:te("h-3.5 w-3.5",h&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(Sh,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Ot,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein Dashboard. Hier siehst du die CPU-/RAM- und GPU-Last der Box und siehst sofort, ob Updates anstehen."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(To,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Do,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein geteiltes Langzeitgedächtnis (Memory-Pool). Hier merkt sich dein Agent Regeln, Projekt-Details und Vorlieben."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(Ku,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>u("roocode"),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer flex items-center gap-1.5",i==="roocode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:[n.jsx(_h,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>u("cursor"),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="cursor"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"Cursor IDE"}),n.jsx("button",{onClick:()=>u("opencode"),className:te("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="opencode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"OpenCode Desktop"})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[i==="roocode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.jsx("p",{children:"Roo Code ist die beliebteste und flexibelste Vibe-Coding-Erweiterung für VS Code im Jahr 2026. Sie ermöglicht vollen Zugriff auf das Terminal und das MCP-Gedächtnis."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Roo Code installieren"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"API-Anbindung konfigurieren"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"MCP Gedächtnis verknüpfen (Optional, aber empfohlen)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),i==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Einstellungen öffnen"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"OpenAI API überschreiben"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",m,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Modell hinzufügen"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.jsx("strong",{children:"auto"})," ein und wähle es als aktives Modell aus. Cursor leitet ab jetzt alle deine Anfragen an die Box weiter."]})]})]})]}),i==="opencode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.jsx("p",{children:"OpenCode ist eine standalone Desktop-App für ein ablenkungsfreies Coden über natürliche Sprache. Es trennt den KI-Prozess von deinem Editor."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"OpenCode Desktop herunterladen"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"Endpunkt auf Box-Gateway setzen"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Erster Vibe-Coding Test"]}),n.jsx("p",{className:"pl-6",children:'Starte eine neue Session und teste die Verbindung mit einem einfachen Prompt, z. B. *"Erstelle ein einfaches Skript, das die Fibonaccizahlen berechnet"*. Das Box-Gateway tauscht das Modell im Hintergrund vollautomatisch aus.'})]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 space-y-3 shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(yi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Keine Verbindung?"})," Überprüfe im Live-Verbindungsprüfer oben, ob die Box-IP erreichbar ist. Stelle sicher, dass dein lokaler PC im selben WLAN/LAN-Netzwerk wie die Box eingeloggt ist."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex items-start gap-4",children:[n.jsx(Qu,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.jsx("p",{className:"text-xs text-muted-foreground leading-normal",children:"Willkommen im Wissenszentrum für dein Mission Control 2 Setup. Hier erfährst du, wie die verschiedenen Technologien (MoE, MCP, Skills, Hermes) zusammenarbeiten und wie du das Maximum aus deinen AI-Prozessabläufen herausholst."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(To,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Bei traditionellen LLMs wird für jedes Wort das gesamte neuronale Netz aktiviert. Bei MoE besteht das Modell aus mehreren spezialisierten Teilnetzwerken (den ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Warum in MC2?"})," So können extrem leistungsstarke Modelle (wie DeepSeek-V3, Mixtral oder Command R+) mit wesentlich geringeren Hardwarekosten ausgeführt werden. Es wird nur ein Bruchteil der Parameter geladen und aktiv berechnet, was Speicherplatz spart und die Inferenz beschleunigt."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Qu,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," MCP ist ein offenes Protokoll (initiiert von Anthropic), das festlegt, wie ein KI-Client (z.B. Roo Code auf deinem PC) mit externen Datenquellen und Tools kommuniziert. Es funktioniert wie ein USB-Standard für KI."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Warum in MC2?"})," MCP trennt den AI-Kern von der Umgebung. Statt für jeden Editor eigene Tools zu schreiben, binden deine Agenten (Roo Code, Hermes) einfach MCP-Server an. Diese Server können Dateien lesen, Websuchen durchführen, Git bedienen oder mit deiner App interagieren."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("a",{href:"https://smithery.ai/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Smithery Registry"})," — Ein Portal zum Suchen und automatischen Installieren von MCP Servern."]}),n.jsxs("li",{children:[n.jsx("a",{href:"https://glama.ai/mcp/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Glama MCP Registry"})," — Eine kuratierte, umfangreiche Community-Datenbank von MCP Servern."]}),n.jsxs("li",{children:[n.jsx("a",{href:"https://github.com/modelcontextprotocol/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Offizielles Anthropic Repo"})," — Das offizielle Repository mit Standards wie filesystem, postgres, sqlite, brave-search und puppeteer."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Do,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Ein Skill ist ein Verzeichnis mit standardisierten Anweisungen, Scripten und Beispielen, das deine Agenten für spezifische Aufgaben trainiert (z.B. Test-Driven Development, Code-Vereinfachung, API-Design)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- name: tdd-pro description: Drive development with strict TDD practices --- # Instructions ...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.jsx("a",{href:"https://skills.sh/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"skills.sh"}),"). Du kannst Skills direkt über das Terminal suchen und in deinem Projekt installieren:",n.jsxs("div",{className:"mt-1 font-mono text-[9px] bg-background/40 p-2 rounded border border-border/30 text-cyan-300",children:["# Nach Skills suchen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.jsx("code",{className:"text-foreground select-all",children:"C:\\Users\\TobisPC\\.gemini\\config\\plugins\\agent-skills\\skills\\"}),". Hier sind deine vorinstallierten, global verfügbaren Skills (wie ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.jsx("code",{className:"text-foreground select-all",children:".agents/skills/"}),". Lege diesen Ordner im Root eines beliebigen Projekts an. Dein lokaler Editor-Agent (z.B. Roo Code) liest ihn beim Starten automatisch ein."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Ot,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Hermes ist der auf der Box installierte, autonome Hintergrund-Agent. Er verwaltet das Dateisystem und kann über REST (Port 8642) oder eine interaktive ChatUI (Port 8787) gesteuert werden."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(vi,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(yi,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(Ku,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(vi,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.jsx("p",{className:"text-[11px]",children:"Koppele deine Debug-Dienste mit dem Chrome-DevTools-Plugin. So kann der Agent Fehler in der Konsole live analysieren und das DOM verifizieren, anstatt blind zu raten."})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(An,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Cp,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Cp,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.jsx("strong",{children:"Fazit:"})," Der Stack erledigt die Kärrnerarbeit (Modelle tauschen, API-Adapter bereitstellen, Sandbox-Verbindungen herstellen) komplett im Hintergrund. Er agiert als dein persönlicher, treuer Copilot, ohne jemals ungefragt schädliche Operationen auf deinem Hauptsystem auszuführen."]})]})]})]})]})]})}function Jb({title:s,hint:o}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:s}),n.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[n.jsx(b0,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Xb=[{id:"llama-swap",label:"Llama Swap",type:"system"},{id:"mission-control-2",label:"Mission Control 2",type:"user"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user"},{id:"hermes-dashboard",label:"Hermes Dashboard",type:"user"},{id:"hermes-webui",label:"Hermes WebUI",type:"user"}];function Ou(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function e1({open:s,onClose:o,defaultTab:i="maintenance"}){const[u,d]=g.useState(null),[f,m]=g.useState([]),[h,v]=g.useState("llama-swap"),[x,b]=g.useState(""),[j,M]=g.useState(!1),[D,I]=g.useState(null),[w,C]=g.useState({}),[_,$]=g.useState("maintenance"),[H,z]=g.useState(!1),[R,F]=g.useState(null);function K(U,me,St){F({type:"alert",title:U,message:me,onConfirm:()=>{F(null),St&&St()}})}function ne(U,me,St){F({type:"confirm",title:U,message:me,onConfirm:()=>{F(null),St()},onCancel:()=>F(null)})}function ee(U){return U?new Date(U*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[J,ke]=g.useState(""),[ue,Le]=g.useState(""),[_e,Oe]=g.useState(!1),[Te,Me]=g.useState(!1);g.useEffect(()=>{s&&(ke(localStorage.getItem("mc_sudo_password")||""),Le(localStorage.getItem("mc_hf_token")||""))},[s]),g.useEffect(()=>{s&&i&&$(i)},[s,i]);const Q=g.useRef(null);function ce(){he("/api/maintenance/updates").then(d).catch(U=>console.error("Error loading updates",U))}function Z(){he("/api/jobs").then(U=>m(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function P(U){M(!0),I(null),he(`/api/maintenance/logs?service=${U}&lines=150`).then(me=>{me.ok?b(me.text):(b(`Fehler beim Laden der Logs: ${me.err||"Unbekannter Fehler"}`),(me.status==="incorrect_password"||me.status==="password_required")&&I(me.status))}).catch(me=>b(`Fehler: ${me.message}`)).finally(()=>{M(!1),setTimeout(()=>{Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},50)})}g.useEffect(()=>{if(!s)return;ce(),Z();const U=setInterval(()=>{Z(),ce()},3e3);return()=>clearInterval(U)},[s]),g.useEffect(()=>{!s||_!=="logs"||P(h)},[s,_,h]);async function N(){try{await he("/api/maintenance/os-update",{method:"POST"}),Z(),$("maintenance")}catch(U){K("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function G(){try{await he("/api/maintenance/engine-update",{method:"POST"}),Z(),$("maintenance")}catch(U){K("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function X(){z(!0);try{await he("/api/maintenance/check-updates",{method:"POST"}),Z(),$("maintenance")}catch(U){K("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{z(!1)}}async function Y(U,me){try{await he("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:me})}),K("Gestartet",`Modell-Upgrade für '${me}' (${U}) gestartet.`),Z(),$("maintenance")}catch(St){K("Fehler",`Fehler beim Starten des Modell-Upgrades: ${St.message}`)}}async function ie(){ne("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await he("/api/maintenance/reboot",{method:"POST"}),K("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){K("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function pe(U){C(me=>({...me,[U]:!0}));try{const me=await he("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});me.ok?K("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&h===U&&P(U)}):K("Fehler",`Fehler beim Neustart: ${me.err||"Unbekannter Fehler"}`)}catch(me){K("Fehler",`Fehler beim Neustart: ${me.message}`)}finally{C(me=>({...me,[U]:!1}))}}async function we(U){try{await he(`/api/jobs/${U}/cancel`,{method:"POST"}),Z()}catch(me){K("Fehler",`Fehler beim Abbrechen: ${me.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:te("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",s?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:o}),n.jsxs("div",{className:te("fixed inset-y-0 right-0 w-full sm:w-[500px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",s?"translate-x-0":"translate-x-full"),children:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.jsx("button",{onClick:o,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:n.jsx(zn,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>$("maintenance"),className:te("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>$("logs"),className:te("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>$("settings"),className:te("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",ee(u.last_check)]}),n.jsxs("button",{onClick:X,disabled:H,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Dn,{className:te("h-3 w-3",H&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:N,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[n.jsx(An,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.os?`${u.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:G,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[n.jsx(M0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:ie,className:"flex w-full items-center gap-3 p-3 rounded-xl border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[n.jsx(Ph,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(u==null?void 0:u.model_list)&&u.model_list.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",ee(u.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:u.model_list.map(U=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:U.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),n.jsxs("button",{onClick:()=>Y(U.repo,U.role),className:"flex items-center gap-1.5 text-[10px] font-semibold text-emerald-400 hover:text-emerald-300 border border-emerald-500/20 bg-emerald-500/5 hover:bg-emerald-500/10 px-2 py-1 rounded-lg transition-colors shrink-0",children:[n.jsx(Tn,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[f.filter(U=>U.state==="running"||U.state==="queued").length," Aktiv"]})]}),n.jsx("div",{className:"space-y-3",children:f.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):f.map(U=>{const me=U.state==="running"||U.state==="queued";return n.jsxs("div",{className:te("p-3 rounded-xl border transition-all duration-300",me?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[me&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",U.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:te(U.state==="done"&&"text-emerald-400",U.state==="failed"&&"text-red-400",U.state==="running"&&"text-primary",U.state==="queued"&&"text-amber-400",U.state==="canceled"&&"text-muted-foreground"),children:U.state})]})]}),me&&n.jsx("button",{onClick:()=>we(U.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),U.state==="running"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&n.jsxs("span",{children:[Ou(U.done_bytes)," / ",Ou(U.total_bytes),U.rate_bps!=null&&` (${Ou(U.rate_bps)}/s)`]}),U.eta_s!=null&&n.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),_==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:h,onChange:U=>v(U.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:Xb.map(U=>n.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),n.jsxs("button",{onClick:()=>pe(h),disabled:w[h],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[n.jsx(Dn,{className:te("h-3.5 w-3.5",w[h]&&"animate-spin")}),"Restart"]})]}),n.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(yi,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",h]})]}),n.jsx("button",{onClick:()=>P(h),disabled:j,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Dn,{className:te("h-3 w-3",j&&"animate-spin")})})]}),n.jsx("pre",{ref:Q,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:D==="password_required"||D==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(T0,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:D==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",h," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>$("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):j&&!x?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):x||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(An,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:_e?"text":"password",value:J,onChange:U=>ke(U.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),n.jsx("button",{type:"button",onClick:()=>Oe(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:_e?n.jsx(Ep,{className:"h-4 w-4"}):n.jsx(qu,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(N0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Te?"text":"password",value:ue,onChange:U=>Le(U.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),n.jsx("button",{type:"button",onClick:()=>Me(!Te),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Te?n.jsx(Ep,{className:"h-4 w-4"}):n.jsx(qu,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",J),localStorage.setItem("mc_hf_token",ue),K("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),n.jsx("button",{onClick:()=>{ke(""),Le(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),K("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),R&&n.jsx(Si,{type:R.type,title:R.title,message:R.message,onConfirm:R.onConfirm,onCancel:R.onCancel})]})}function t1(){var j,M,D,I,w;const[s,o]=g.useState("dashboard"),[i,u]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[d,f]=g.useState(!1),[m,h]=g.useState("maintenance"),{data:v}=Wv(),{data:x}=xc(2e4);g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const C=_=>{var H;h(((H=_.detail)==null?void 0:H.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",C),()=>window.removeEventListener("open-system-drawer",C)},[]);const b=Ju.find(C=>C.id===s);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Hv,{onNavigate:o}),n.jsx(e1,{open:d,onClose:()=>f(!1),defaultTab:m}),n.jsxs("aside",{className:te("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",i?"w-16":"w-60"),children:[n.jsxs("div",{className:te("flex items-center py-4 border-b border-border/40 shrink-0",i?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!i&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{u(C=>{const _=!C;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:i?"Maximieren":"Minimieren",children:i?n.jsx(h0,{className:"h-4 w-4"}):n.jsx(p0,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Ju.map(C=>n.jsxs("button",{onClick:()=>o(C.id),className:te("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",i?"justify-center p-2.5":"gap-3 px-3 py-2",s===C.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:i?C.label:void 0,children:[n.jsx(C.icon,{className:"h-4.5 w-4.5 shrink-0"}),!i&&n.jsx("span",{className:"truncate",children:C.label})]},C.id))}),n.jsx("div",{className:te("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",i?"px-2 text-center":"px-5"),children:i?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:te("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",v?v.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:v?`Engine ${v.engine_reachable?"online":"offline"}`:"Backend offline"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[v?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:te("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(x==null?void 0:x.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.jsxs("div",{className:"truncate",title:x.versions.mc2?`${x.versions.mc2.branch}-${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""} (${x.versions.mc2.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"MC2:"})," ",x.versions.mc2?`${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((j=x.versions.engine)==null?void 0:j.type)==="git"?`${x.versions.engine.branch}-${x.versions.engine.hash}${x.versions.engine.dirty?"*":""} (${x.versions.engine.date})`:((M=x.versions.engine)==null?void 0:M.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((D=x.versions.engine)==null?void 0:D.type)==="git"?`${x.versions.engine.hash}${x.versions.engine.dirty?"*":""}`:((w=(I=x.versions.engine)==null?void 0:I.version_text)==null?void 0:w.split(" ").pop())||"—"]}),n.jsxs("div",{className:"truncate",title:x.versions.hermes_ui?`${x.versions.hermes_ui.branch}-${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""} (${x.versions.hermes_ui.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes UI:"})," ",x.versions.hermes_ui?`${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:x.versions.hermes_agent?`${x.versions.hermes_agent.branch}-${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""} (${x.versions.hermes_agent.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes Agent:"})," ",x.versions.hermes_agent?`${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),n.jsxs("button",{onClick:()=>{const C=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(C)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[n.jsx(v0,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&n.jsx(Lb,{}),s==="models"&&n.jsx(Vb,{}),s==="system"&&n.jsx(Gb,{}),s==="connect"&&n.jsx(Kb,{}),s==="memory"&&n.jsx(qb,{}),s==="agent"&&n.jsx(Zb,{}),s==="guide"&&n.jsx(Yb,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&n.jsx(Jb,{title:b.label,hint:b.hint})]})]})]})}const r1=new qx({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});kx.createRoot(document.getElementById("root")).render(n.jsx(ch.StrictMode,{children:n.jsx(Zx,{client:r1,children:n.jsx(t1,{})})}));