diff --git a/backend/services/llamaswap.py b/backend/services/llamaswap.py index 0782ced..c231036 100644 --- a/backend/services/llamaswap.py +++ b/backend/services/llamaswap.py @@ -18,7 +18,7 @@ from config import CMD_TEMPLATE, CONFIG_PATH, DEFAULT_TTL, LLAMA_SWAP_URL, SPEC_ log = logging.getLogger(__name__) # Kanonische Rollen (vereinheitlicht ggü. v1: kein manager/reviewer mehr). -ROLE_IDS = {"vision", "coder", "reasoning", "agent", "scout"} +ROLE_IDS = {"vision", "coder", "agent", "scout"} _CTX_RE = re.compile(r"-(?:c|-ctx-size)\s+(\d+)") _PATH_RE = re.compile(r"-(?:m|-model)\s+([^\s]+)") diff --git a/backend/services/maintenance.py b/backend/services/maintenance.py index dc33457..23fe528 100644 --- a/backend/services/maintenance.py +++ b/backend/services/maintenance.py @@ -72,7 +72,6 @@ def model_upgrades() -> list[dict]: out = [] ROLE_MAP = { - "reasoning": "heavy", "agent": "fast", "scout": "fast", "coder": "coder", diff --git a/backend/services/sources.py b/backend/services/sources.py index 5c2274c..05d4945 100644 --- a/backend/services/sources.py +++ b/backend/services/sources.py @@ -1,7 +1,7 @@ """ Vertrauenswürdige Quellen + Kategorien für die automatische Modell-Entdeckung. Portiert aus Mission Control v1 (sources.py). Rollen sind die EINE Quelle der -Wahrheit (vereinheitlicht): vision · coder · reasoning · agent · scout. +Wahrheit (vereinheitlicht): vision · coder · agent · scout. """ # HF-Orgs, die zuverlässig aktuelle, hochwertige GGUF-Quants veröffentlichen. @@ -15,8 +15,6 @@ CATEGORIES = [ "kw": ["-vl-", "-vl", "vision", "llava", "multimodal", "-mm-", "pixtral"]}, {"role": "coder", "title": "Coden & Programmieren", "icon": "code", "kw": ["coder", "-code-", "code-", "codestral", "starcoder"]}, - {"role": "reasoning", "title": "Nachdenken & Logik", "icon": "pulse", - "kw": ["-r1", "deepseek-r1", "reasoning", "qwq", "magistral", "-think", "thinking", "-o1"]}, {"role": "agent", "title": "Agenten & Tool-Use", "icon": "layers", "kw": ["hermes", "-tool", "command-r", "watt", "-fc-", "function"]}, {"role": "scout", "title": "Allrounder & Chat", "icon": "compass", diff --git a/frontend/dist/assets/index-BRFJuGKC.js b/frontend/dist/assets/index-D4mBflTE.js similarity index 81% rename from frontend/dist/assets/index-BRFJuGKC.js rename to frontend/dist/assets/index-D4mBflTE.js index 8fa1166..dee3ef5 100644 --- a/frontend/dist/assets/index-BRFJuGKC.js +++ b/frontend/dist/assets/index-D4mBflTE.js @@ -6,7 +6,7 @@ var op=s=>{throw TypeError(s)};var pc=(s,o,i)=>o.has(s)||op("Cannot "+i);var N=( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var lp;function vg(){if(lp)return Se;lp=1;var s=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),w=Symbol.iterator;function _(P){return P===null||typeof P!="object"?null:(P=w&&P[w]||P["@@iterator"],typeof P=="function"?P:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,b={};function S(P,C,Z){this.props=P,this.context=C,this.refs=b,this.updater=Z||M}S.prototype.isReactComponent={},S.prototype.setState=function(P,C){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,C,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function O(){}O.prototype=S.prototype;function I(P,C,Z){this.props=P,this.context=C,this.refs=b,this.updater=Z||M}var B=I.prototype=new O;B.constructor=I,L(B,S.prototype),B.isPureReactComponent=!0;var F=Array.isArray,D=Object.prototype.hasOwnProperty,$={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function ae(P,C,Z){var X,q={},le=null,pe=null;if(C!=null)for(X in C.ref!==void 0&&(pe=C.ref),C.key!==void 0&&(le=""+C.key),C)D.call(C,X)&&!H.hasOwnProperty(X)&&(q[X]=C[X]);var ve=arguments.length-2;if(ve===1)q.children=Z;else if(1{throw TypeError(s)};var pc=(s,o,i)=>o.has(s)||op("Cannot "+i);var N=( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var dp;function jg(){return dp||(dp=1,(function(s){function o(K,ee){var Y=K.length;K.push(ee);e:for(;0>>1,C=K[P];if(0>>1;Pu(q,Y))leu(pe,q)?(K[P]=pe,K[le]=Y,P=le):(K[P]=q,K[X]=Y,P=X);else if(leu(pe,Y))K[P]=pe,K[le]=Y,P=le;else break e}}return ee}function u(K,ee){var Y=K.sortIndex-ee.sortIndex;return Y!==0?Y:K.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;s.unstable_now=function(){return f.now()}}else{var m=Date,p=m.now();s.unstable_now=function(){return m.now()-p}}var v=[],g=[],j=1,w=null,_=3,M=!1,L=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(K){for(var ee=i(g);ee!==null;){if(ee.callback===null)c(g);else if(ee.startTime<=K)c(g),ee.sortIndex=ee.expirationTime,o(v,ee);else break;ee=i(g)}}function F(K){if(b=!1,B(K),!L)if(i(v)!==null)L=!0,Ee(D);else{var ee=i(g);ee!==null&&Pe(F,ee.startTime-K)}}function D(K,ee){L=!1,b&&(b=!1,O(ae),ae=-1),M=!0;var Y=_;try{for(B(ee),w=i(v);w!==null&&(!(w.expirationTime>ee)||K&&!ke());){var P=w.callback;if(typeof P=="function"){w.callback=null,_=w.priorityLevel;var C=P(w.expirationTime<=ee);ee=s.unstable_now(),typeof C=="function"?w.callback=C:w===i(v)&&c(v),B(ee)}else c(v);w=i(v)}if(w!==null)var Z=!0;else{var X=i(g);X!==null&&Pe(F,X.startTime-ee),Z=!1}return Z}finally{w=null,_=Y,M=!1}}var $=!1,H=null,ae=-1,te=5,fe=-1;function ke(){return!(s.unstable_now()-feK||125P?(K.sortIndex=Y,o(g,K),i(v)===null&&K===i(g)&&(b?(O(ae),ae=-1):b=!0,Pe(F,Y-P))):(K.sortIndex=C,o(v,K),L||M||(L=!0,Ee(D))),K},s.unstable_shouldYield=ke,s.unstable_wrapCallback=function(K){var ee=_;return function(){var Y=_;_=ee;try{return K.apply(this,arguments)}finally{_=Y}}}})(yc)),yc}var up;function kg(){return up||(up=1,gc.exports=jg()),gc.exports}/** + */var dp;function jg(){return dp||(dp=1,(function(s){function o(K,ee){var Y=K.length;K.push(ee);e:for(;0>>1,C=K[P];if(0>>1;Pu(q,Y))leu(pe,q)?(K[P]=pe,K[le]=Y,P=le):(K[P]=q,K[X]=Y,P=X);else if(leu(pe,Y))K[P]=pe,K[le]=Y,P=le;else break e}}return ee}function u(K,ee){var Y=K.sortIndex-ee.sortIndex;return Y!==0?Y:K.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;s.unstable_now=function(){return f.now()}}else{var m=Date,p=m.now();s.unstable_now=function(){return m.now()-p}}var v=[],g=[],j=1,w=null,_=3,M=!1,z=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(K){for(var ee=i(g);ee!==null;){if(ee.callback===null)c(g);else if(ee.startTime<=K)c(g),ee.sortIndex=ee.expirationTime,o(v,ee);else break;ee=i(g)}}function F(K){if(b=!1,B(K),!z)if(i(v)!==null)z=!0,Ee(D);else{var ee=i(g);ee!==null&&Pe(F,ee.startTime-K)}}function D(K,ee){z=!1,b&&(b=!1,O(ae),ae=-1),M=!0;var Y=_;try{for(B(ee),w=i(v);w!==null&&(!(w.expirationTime>ee)||K&&!ke());){var P=w.callback;if(typeof P=="function"){w.callback=null,_=w.priorityLevel;var C=P(w.expirationTime<=ee);ee=s.unstable_now(),typeof C=="function"?w.callback=C:w===i(v)&&c(v),B(ee)}else c(v);w=i(v)}if(w!==null)var Z=!0;else{var X=i(g);X!==null&&Pe(F,X.startTime-ee),Z=!1}return Z}finally{w=null,_=Y,M=!1}}var $=!1,H=null,ae=-1,te=5,fe=-1;function ke(){return!(s.unstable_now()-feK||125P?(K.sortIndex=Y,o(g,K),i(v)===null&&K===i(g)&&(b?(O(ae),ae=-1):b=!0,Pe(F,Y-P))):(K.sortIndex=C,o(v,K),z||M||(z=!0,Ee(D))),K},s.unstable_shouldYield=ke,s.unstable_wrapCallback=function(K){var ee=_;return function(){var Y=_;_=ee;try{return K.apply(this,arguments)}finally{_=Y}}}})(yc)),yc}var up;function kg(){return up||(up=1,gc.exports=jg()),gc.exports}/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var op=s=>{throw TypeError(s)};var pc=(s,o,i)=>o.has(s)||op("Cannot "+i);var N=( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var fp;function Ng(){if(fp)return jt;fp=1;var s=sd(),o=kg();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,g=/^[: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]*$/,j={},w={};function _(e){return v.call(w,e)?!0:v.call(j,e)?!1:g.test(e)?w[e]=!0:(j[e]=!0,!1)}function M(e,t,n,l){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function L(e,t,n,l){if(t===null||typeof t>"u"||M(e,t,n,l))return!0;if(l)return!1;if(n!==null)switch(n.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 b(e,t,n,l,a,d,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=d,this.removeEmptyString=h}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new b(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];S[t]=new b(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new b(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new b(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){S[e]=new b(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new b(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new b(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new b(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new b(e,5,!1,e.toLowerCase(),null,!1,!1)});var O=/[\-:]([a-z])/g;function I(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(O,I);S[t]=new b(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(O,I);S[t]=new b(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(O,I);S[t]=new b(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new b(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new b(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,t,n,l){var a=S.hasOwnProperty(t)?S[t]:null;(a!==null?a.type!==0:l||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,g=/^[: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]*$/,j={},w={};function _(e){return v.call(w,e)?!0:v.call(j,e)?!1:g.test(e)?w[e]=!0:(j[e]=!0,!1)}function M(e,t,n,l){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function z(e,t,n,l){if(t===null||typeof t>"u"||M(e,t,n,l))return!0;if(l)return!1;if(n!==null)switch(n.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 b(e,t,n,l,a,d,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=d,this.removeEmptyString=h}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new b(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];S[t]=new b(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new b(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new b(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){S[e]=new b(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new b(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new b(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new b(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new b(e,5,!1,e.toLowerCase(),null,!1,!1)});var O=/[\-:]([a-z])/g;function I(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(O,I);S[t]=new b(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(O,I);S[t]=new b(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(O,I);S[t]=new b(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new b(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new b(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,t,n,l){var a=S.hasOwnProperty(t)?S[t]:null;(a!==null?a.type!==0:l||!(2y||a[h]!==d[y]){var k=` -`+a[h].replace(" at new "," at ");return e.displayName&&k.includes("")&&(k=k.replace("",e.displayName)),k}while(1<=h&&0<=y);break}}}finally{Z=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?C(e):""}function q(e){switch(e.tag){case 5:return C(e.type);case 16:return C("Lazy");case 13:return C("Suspense");case 19:return C("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 le(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 H:return"Fragment";case $:return"Portal";case te:return"Profiler";case ae:return"StrictMode";case ze:return"Suspense";case Ce:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ke:return(e.displayName||"Context")+".Consumer";case fe: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 Le:return t=e.displayName||null,t!==null?t:le(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return le(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 le(t);case 8:return t===ae?"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 ve(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",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,d=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(h){l=""+h,d.call(this,h)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(h){l=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xt(e){e._valueTracker||(e._valueTracker=me(e))}function As(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=U(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Zt(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 Tn(e,t){var n=t.checked;return Y({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function zs(e,t){var n=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;n=ve(t.value!=null?t.value:n),e._wrapperState={initialChecked:l,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ls(e,t){t=t.checked,t!=null&&B(e,"checked",t,!1)}function An(e,t){Ls(e,t);var n=ve(t.value),l=t.type;if(n!=null)l==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?A(e,t.type,n):t.hasOwnProperty("defaultValue")&&A(e,t.type,ve(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Fs(e,t,n){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,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function A(e,t,n){(t!=="number"||Zt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var se=Array.isArray;function je(e,t,n,l){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Qo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Us(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $s={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},jm=["Webkit","ms","Moz","O"];Object.keys($s).forEach(function(e){jm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),$s[t]=$s[e]})});function vd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||$s.hasOwnProperty(e)&&$s[e]?(""+t).trim():t+"px"}function bd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var l=n.indexOf("--")===0,a=vd(n,t[n],l);n==="float"&&(n="cssFloat"),l?e.setProperty(n,a):e[n]=a}}var km=Y({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 Si(e,t){if(t){if(km[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 Ci(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 Ei=null;function Pi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _i=null,Fn=null,In=null;function wd(e){if(e=co(e)){if(typeof _i!="function")throw Error(i(280));var t=e.stateNode;t&&(t=gl(t),_i(e.stateNode,e.type,t))}}function jd(e){Fn?In?In.push(e):In=[e]:Fn=e}function kd(){if(Fn){var e=Fn,t=In;if(In=Fn=null,wd(e),t)for(e=0;e>>=0,e===0?32:31-(Tm(e)/Am|0)|0}var Xo=64,el=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 tl(e,t){var n=e.pendingLanes;if(n===0)return 0;var l=0,a=e.suspendedLanes,d=e.pingedLanes,h=n&268435455;if(h!==0){var y=h&~a;y!==0?l=Ws(y):(d&=h,d!==0&&(l=Ws(d)))}else h=n&~a,h!==0?l=Ws(h):d!==0&&(l=Ws(d));if(l===0)return 0;if(t!==0&&t!==l&&(t&a)===0&&(a=l&-l,d=t&-t,a>=d||a===16&&(d&4194240)!==0))return t;if((l&4)!==0&&(l|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0n;n++)t.push(e);return t}function Gs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$t(t),e[t]=n}function Im(e,t){var n=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=eo),Yd=" ",Jd=!1;function Xd(e,t){switch(e){case"keyup":return px.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bn=!1;function mx(e,t){switch(e){case"compositionend":return eu(t);case"keypress":return t.which!==32?null:(Jd=!0,Yd);case"textInput":return e=t.data,e===Yd&&Jd?null:e;default:return null}}function xx(e,t){if(Bn)return e==="compositionend"||!Ki&&Xd(e,t)?(e=Wd(),ll=$i=Sr=null,Bn=!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:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=iu(n)}}function cu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function du(){for(var e=window,t=Zt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Zt(e.document)}return t}function Zi(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 Sx(e){var t=du(),n=e.focusedElem,l=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&cu(n.ownerDocument.documentElement,n)){if(l!==null&&Zi(n)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,d=Math.min(l.start,a);l=l.end===void 0?d:Math.min(l.end,a),!e.extend&&d>l&&(a=l,l=d,d=a),a=au(n,d);var h=au(n,l);a&&h&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),d>l?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Hn=null,Yi=null,so=null,Ji=!1;function uu(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ji||Hn==null||Hn!==Zt(l)||(l=Hn,"selectionStart"in l&&Zi(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}),so&&no(so,l)||(so=l,l=hl(Yi,"onSelect"),0Qn||(e.current=da[Qn],da[Qn]=null,Qn--)}function Fe(e,t){Qn++,da[Qn]=e.current,e.current=t}var _r={},at=Pr(_r),gt=Pr(!1),on=_r;function qn(e,t){var n=e.type.contextTypes;if(!n)return _r;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var a={},d;for(d in n)a[d]=t[d];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function yt(e){return e=e.childContextTypes,e!=null}function yl(){Ue(gt),Ue(at)}function Cu(e,t,n){if(at.current!==_r)throw Error(i(168));Fe(at,t),Fe(gt,n)}function Eu(e,t,n){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return n;l=l.getChildContext();for(var a in l)if(!(a in t))throw Error(i(108,pe(e)||"Unknown",a));return Y({},n,l)}function vl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_r,on=at.current,Fe(at,e),Fe(gt,gt.current),!0}function Pu(e,t,n){var l=e.stateNode;if(!l)throw Error(i(169));n?(e=Eu(e,t,on),l.__reactInternalMemoizedMergedChildContext=e,Ue(gt),Ue(at),Fe(at,e)):Ue(gt),Fe(gt,n)}var cr=null,bl=!1,ua=!1;function _u(e){cr===null?cr=[e]:cr.push(e)}function Lx(e){bl=!0,_u(e)}function Mr(){if(!ua&&cr!==null){ua=!0;var e=0,t=Ae;try{var n=cr;for(Ae=1;e>=h,a-=h,dr=1<<32-$t(t)+a|n<be?(rt=ge,ge=null):rt=ge.sibling;var Oe=V(R,ge,T[be],Q);if(Oe===null){ge===null&&(ge=rt);break}e&&ge&&Oe.alternate===null&&t(R,ge),E=d(Oe,E,be),xe===null?de=Oe:xe.sibling=Oe,xe=Oe,ge=rt}if(be===T.length)return n(R,ge),Be&&an(R,be),de;if(ge===null){for(;bebe?(rt=ge,ge=null):rt=ge.sibling;var Ir=V(R,ge,Oe.value,Q);if(Ir===null){ge===null&&(ge=rt);break}e&&ge&&Ir.alternate===null&&t(R,ge),E=d(Ir,E,be),xe===null?de=Ir:xe.sibling=Ir,xe=Ir,ge=rt}if(Oe.done)return n(R,ge),Be&&an(R,be),de;if(ge===null){for(;!Oe.done;be++,Oe=T.next())Oe=G(R,Oe.value,Q),Oe!==null&&(E=d(Oe,E,be),xe===null?de=Oe:xe.sibling=Oe,xe=Oe);return Be&&an(R,be),de}for(ge=l(R,ge);!Oe.done;be++,Oe=T.next())Oe=re(ge,R,be,Oe.value,Q),Oe!==null&&(e&&Oe.alternate!==null&&ge.delete(Oe.key===null?be:Oe.key),E=d(Oe,E,be),xe===null?de=Oe:xe.sibling=Oe,xe=Oe);return e&&ge.forEach(function(gg){return t(R,gg)}),Be&&an(R,be),de}function qe(R,E,T,Q){if(typeof T=="object"&&T!==null&&T.type===H&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case D:e:{for(var de=T.key,xe=E;xe!==null;){if(xe.key===de){if(de=T.type,de===H){if(xe.tag===7){n(R,xe.sibling),E=a(xe,T.props.children),E.return=R,R=E;break e}}else if(xe.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===Ee&&Au(de)===xe.type){n(R,xe.sibling),E=a(xe,T.props),E.ref=uo(R,xe,T),E.return=R,R=E;break e}n(R,xe);break}else t(R,xe);xe=xe.sibling}T.type===H?(E=xn(T.props.children,R.mode,Q,T.key),E.return=R,R=E):(Q=Ql(T.type,T.key,T.props,null,R.mode,Q),Q.ref=uo(R,E,T),Q.return=R,R=Q)}return h(R);case $:e:{for(xe=T.key;E!==null;){if(E.key===xe)if(E.tag===4&&E.stateNode.containerInfo===T.containerInfo&&E.stateNode.implementation===T.implementation){n(R,E.sibling),E=a(E,T.children||[]),E.return=R,R=E;break e}else{n(R,E);break}else t(R,E);E=E.sibling}E=ac(T,R.mode,Q),E.return=R,R=E}return h(R);case Ee:return xe=T._init,qe(R,E,xe(T._payload),Q)}if(se(T))return ie(R,E,T,Q);if(ee(T))return ce(R,E,T,Q);Nl(R,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,E!==null&&E.tag===6?(n(R,E.sibling),E=a(E,T),E.return=R,R=E):(n(R,E),E=ic(T,R.mode,Q),E.return=R,R=E),h(R)):n(R,E)}return qe}var Xn=zu(!0),Lu=zu(!1),Sl=Pr(null),Cl=null,es=null,ga=null;function ya(){ga=es=Cl=null}function va(e){var t=Sl.current;Ue(Sl),e._currentValue=t}function ba(e,t,n){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===n)break;e=e.return}}function ts(e,t){Cl=e,ga=es=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(vt=!0),e.firstContext=null)}function At(e){var t=e._currentValue;if(ga!==e)if(e={context:e,memoizedValue:t,next:null},es===null){if(Cl===null)throw Error(i(308));es=e,Cl.dependencies={lanes:0,firstContext:e}}else es=es.next=e;return t}var cn=null;function wa(e){cn===null?cn=[e]:cn.push(e)}function Fu(e,t,n,l){var a=t.interleaved;return a===null?(n.next=n,wa(t)):(n.next=a.next,a.next=n),t.interleaved=n,fr(e,l)}function fr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Rr=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Iu(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 pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Or(e,t,n){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,fr(e,n)}return a=l.interleaved,a===null?(t.next=t,wa(l)):(t.next=a.next,a.next=t),l.interleaved=t,fr(e,n)}function El(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,zi(e,n)}}function Uu(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var a=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var h={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};d===null?a=d=h:d=d.next=h,n=n.next}while(n!==null);d===null?a=d=t:d=d.next=t}else a=d=t;n={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:d,shared:l.shared,effects:l.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Pl(e,t,n,l){var a=e.updateQueue;Rr=!1;var d=a.firstBaseUpdate,h=a.lastBaseUpdate,y=a.shared.pending;if(y!==null){a.shared.pending=null;var k=y,z=k.next;k.next=null,h===null?d=z:h.next=z,h=k;var W=e.alternate;W!==null&&(W=W.updateQueue,y=W.lastBaseUpdate,y!==h&&(y===null?W.firstBaseUpdate=z:y.next=z,W.lastBaseUpdate=k))}if(d!==null){var G=a.baseState;h=0,W=z=k=null,y=d;do{var V=y.lane,re=y.eventTime;if((l&V)===V){W!==null&&(W=W.next={eventTime:re,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var ie=e,ce=y;switch(V=t,re=n,ce.tag){case 1:if(ie=ce.payload,typeof ie=="function"){G=ie.call(re,G,V);break e}G=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=ce.payload,V=typeof ie=="function"?ie.call(re,G,V):ie,V==null)break e;G=Y({},G,V);break e;case 2:Rr=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,V=a.effects,V===null?a.effects=[y]:V.push(y))}else re={eventTime:re,lane:V,tag:y.tag,payload:y.payload,callback:y.callback,next:null},W===null?(z=W=re,k=G):W=W.next=re,h|=V;if(y=y.next,y===null){if(y=a.shared.pending,y===null)break;V=y,y=V.next,V.next=null,a.lastBaseUpdate=V,a.shared.pending=null}}while(!0);if(W===null&&(k=G),a.baseState=k,a.firstBaseUpdate=z,a.lastBaseUpdate=W,t=a.shared.interleaved,t!==null){a=t;do h|=a.lane,a=a.next;while(a!==t)}else d===null&&(a.shared.lanes=0);fn|=h,e.lanes=h,e.memoizedState=G}}function $u(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var l=Ea.transition;Ea.transition={};try{e(!1),t()}finally{Ae=n,Ea.transition=l}}function lf(){return zt().memoizedState}function $x(e,t,n){var l=zr(e);if(n={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null},af(e))cf(t,n);else if(n=Fu(e,t,n,l),n!==null){var a=ht();Kt(n,e,l,a),df(n,t,l)}}function Bx(e,t,n){var l=zr(e),a={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null};if(af(e))cf(t,a);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var h=t.lastRenderedState,y=d(h,n);if(a.hasEagerState=!0,a.eagerState=y,Bt(y,h)){var k=t.interleaved;k===null?(a.next=a,wa(t)):(a.next=k.next,k.next=a),t.interleaved=a;return}}catch{}finally{}n=Fu(e,t,a,l),n!==null&&(a=ht(),Kt(n,e,l,a),df(n,t,l))}}function af(e){var t=e.alternate;return e===We||t!==null&&t===We}function cf(e,t){mo=Rl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function df(e,t,n){if((n&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,zi(e,n)}}var Tl={readContext:At,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},Hx={readContext:At,useCallback:function(e,t){return er().memoizedState=[e,t===void 0?null:t],e},useContext:At,useEffect:Ju,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ol(4194308,4,tf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ol(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ol(4,2,e,t)},useMemo:function(e,t){var n=er();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var l=er();return t=n!==void 0?n(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=$x.bind(null,We,e),[l.memoizedState,e]},useRef:function(e){var t=er();return e={current:e},t.memoizedState=e},useState:Zu,useDebugValue:Ta,useDeferredValue:function(e){return er().memoizedState=e},useTransition:function(){var e=Zu(!1),t=e[0];return e=Ux.bind(null,e[1]),er().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var l=We,a=er();if(Be){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),tt===null)throw Error(i(349));(un&30)!==0||Wu(l,t,n)}a.memoizedState=n;var d={value:n,getSnapshot:t};return a.queue=d,Ju(Ku.bind(null,l,d,e),[e]),l.flags|=2048,yo(9,Gu.bind(null,l,d,n,t),void 0,null),n},useId:function(){var e=er(),t=tt.identifierPrefix;if(Be){var n=ur,l=dr;n=(l&~(1<<32-$t(l)-1)).toString(32)+n,t=":"+t+"R"+n,n=xo++,0")&&(k=k.replace("",e.displayName)),k}while(1<=h&&0<=y);break}}}finally{Z=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?C(e):""}function q(e){switch(e.tag){case 5:return C(e.type);case 16:return C("Lazy");case 13:return C("Suspense");case 19:return C("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 le(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 H:return"Fragment";case $:return"Portal";case te:return"Profiler";case ae:return"StrictMode";case ze:return"Suspense";case Ce:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ke:return(e.displayName||"Context")+".Consumer";case fe: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 Le:return t=e.displayName||null,t!==null?t:le(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return le(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 le(t);case 8:return t===ae?"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 ve(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",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,d=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(h){l=""+h,d.call(this,h)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(h){l=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xt(e){e._valueTracker||(e._valueTracker=me(e))}function As(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=U(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Zt(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 Tn(e,t){var n=t.checked;return Y({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function zs(e,t){var n=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;n=ve(t.value!=null?t.value:n),e._wrapperState={initialChecked:l,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ls(e,t){t=t.checked,t!=null&&B(e,"checked",t,!1)}function An(e,t){Ls(e,t);var n=ve(t.value),l=t.type;if(n!=null)l==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?L(e,t.type,n):t.hasOwnProperty("defaultValue")&&L(e,t.type,ve(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Fs(e,t,n){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,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function L(e,t,n){(t!=="number"||Zt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var se=Array.isArray;function je(e,t,n,l){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Qo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Us(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $s={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},jm=["Webkit","ms","Moz","O"];Object.keys($s).forEach(function(e){jm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),$s[t]=$s[e]})});function vd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||$s.hasOwnProperty(e)&&$s[e]?(""+t).trim():t+"px"}function bd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var l=n.indexOf("--")===0,a=vd(n,t[n],l);n==="float"&&(n="cssFloat"),l?e.setProperty(n,a):e[n]=a}}var km=Y({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 Si(e,t){if(t){if(km[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 Ci(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 Ei=null;function Pi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _i=null,Fn=null,In=null;function wd(e){if(e=co(e)){if(typeof _i!="function")throw Error(i(280));var t=e.stateNode;t&&(t=gl(t),_i(e.stateNode,e.type,t))}}function jd(e){Fn?In?In.push(e):In=[e]:Fn=e}function kd(){if(Fn){var e=Fn,t=In;if(In=Fn=null,wd(e),t)for(e=0;e>>=0,e===0?32:31-(Tm(e)/Am|0)|0}var Xo=64,el=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 tl(e,t){var n=e.pendingLanes;if(n===0)return 0;var l=0,a=e.suspendedLanes,d=e.pingedLanes,h=n&268435455;if(h!==0){var y=h&~a;y!==0?l=Ws(y):(d&=h,d!==0&&(l=Ws(d)))}else h=n&~a,h!==0?l=Ws(h):d!==0&&(l=Ws(d));if(l===0)return 0;if(t!==0&&t!==l&&(t&a)===0&&(a=l&-l,d=t&-t,a>=d||a===16&&(d&4194240)!==0))return t;if((l&4)!==0&&(l|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0n;n++)t.push(e);return t}function Gs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$t(t),e[t]=n}function Im(e,t){var n=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=eo),Yd=" ",Jd=!1;function Xd(e,t){switch(e){case"keyup":return px.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bn=!1;function mx(e,t){switch(e){case"compositionend":return eu(t);case"keypress":return t.which!==32?null:(Jd=!0,Yd);case"textInput":return e=t.data,e===Yd&&Jd?null:e;default:return null}}function xx(e,t){if(Bn)return e==="compositionend"||!Ki&&Xd(e,t)?(e=Wd(),ll=$i=Sr=null,Bn=!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:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=iu(n)}}function cu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function du(){for(var e=window,t=Zt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Zt(e.document)}return t}function Zi(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 Sx(e){var t=du(),n=e.focusedElem,l=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&cu(n.ownerDocument.documentElement,n)){if(l!==null&&Zi(n)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,d=Math.min(l.start,a);l=l.end===void 0?d:Math.min(l.end,a),!e.extend&&d>l&&(a=l,l=d,d=a),a=au(n,d);var h=au(n,l);a&&h&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),d>l?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Hn=null,Yi=null,so=null,Ji=!1;function uu(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ji||Hn==null||Hn!==Zt(l)||(l=Hn,"selectionStart"in l&&Zi(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}),so&&no(so,l)||(so=l,l=hl(Yi,"onSelect"),0Qn||(e.current=da[Qn],da[Qn]=null,Qn--)}function Fe(e,t){Qn++,da[Qn]=e.current,e.current=t}var _r={},at=Pr(_r),gt=Pr(!1),on=_r;function qn(e,t){var n=e.type.contextTypes;if(!n)return _r;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var a={},d;for(d in n)a[d]=t[d];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function yt(e){return e=e.childContextTypes,e!=null}function yl(){Ue(gt),Ue(at)}function Cu(e,t,n){if(at.current!==_r)throw Error(i(168));Fe(at,t),Fe(gt,n)}function Eu(e,t,n){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return n;l=l.getChildContext();for(var a in l)if(!(a in t))throw Error(i(108,pe(e)||"Unknown",a));return Y({},n,l)}function vl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_r,on=at.current,Fe(at,e),Fe(gt,gt.current),!0}function Pu(e,t,n){var l=e.stateNode;if(!l)throw Error(i(169));n?(e=Eu(e,t,on),l.__reactInternalMemoizedMergedChildContext=e,Ue(gt),Ue(at),Fe(at,e)):Ue(gt),Fe(gt,n)}var cr=null,bl=!1,ua=!1;function _u(e){cr===null?cr=[e]:cr.push(e)}function Lx(e){bl=!0,_u(e)}function Mr(){if(!ua&&cr!==null){ua=!0;var e=0,t=Ae;try{var n=cr;for(Ae=1;e>=h,a-=h,dr=1<<32-$t(t)+a|n<be?(rt=ge,ge=null):rt=ge.sibling;var Oe=V(R,ge,T[be],Q);if(Oe===null){ge===null&&(ge=rt);break}e&&ge&&Oe.alternate===null&&t(R,ge),E=d(Oe,E,be),xe===null?de=Oe:xe.sibling=Oe,xe=Oe,ge=rt}if(be===T.length)return n(R,ge),Be&&an(R,be),de;if(ge===null){for(;bebe?(rt=ge,ge=null):rt=ge.sibling;var Ir=V(R,ge,Oe.value,Q);if(Ir===null){ge===null&&(ge=rt);break}e&&ge&&Ir.alternate===null&&t(R,ge),E=d(Ir,E,be),xe===null?de=Ir:xe.sibling=Ir,xe=Ir,ge=rt}if(Oe.done)return n(R,ge),Be&&an(R,be),de;if(ge===null){for(;!Oe.done;be++,Oe=T.next())Oe=G(R,Oe.value,Q),Oe!==null&&(E=d(Oe,E,be),xe===null?de=Oe:xe.sibling=Oe,xe=Oe);return Be&&an(R,be),de}for(ge=l(R,ge);!Oe.done;be++,Oe=T.next())Oe=re(ge,R,be,Oe.value,Q),Oe!==null&&(e&&Oe.alternate!==null&&ge.delete(Oe.key===null?be:Oe.key),E=d(Oe,E,be),xe===null?de=Oe:xe.sibling=Oe,xe=Oe);return e&&ge.forEach(function(gg){return t(R,gg)}),Be&&an(R,be),de}function qe(R,E,T,Q){if(typeof T=="object"&&T!==null&&T.type===H&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case D:e:{for(var de=T.key,xe=E;xe!==null;){if(xe.key===de){if(de=T.type,de===H){if(xe.tag===7){n(R,xe.sibling),E=a(xe,T.props.children),E.return=R,R=E;break e}}else if(xe.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===Ee&&Au(de)===xe.type){n(R,xe.sibling),E=a(xe,T.props),E.ref=uo(R,xe,T),E.return=R,R=E;break e}n(R,xe);break}else t(R,xe);xe=xe.sibling}T.type===H?(E=xn(T.props.children,R.mode,Q,T.key),E.return=R,R=E):(Q=Ql(T.type,T.key,T.props,null,R.mode,Q),Q.ref=uo(R,E,T),Q.return=R,R=Q)}return h(R);case $:e:{for(xe=T.key;E!==null;){if(E.key===xe)if(E.tag===4&&E.stateNode.containerInfo===T.containerInfo&&E.stateNode.implementation===T.implementation){n(R,E.sibling),E=a(E,T.children||[]),E.return=R,R=E;break e}else{n(R,E);break}else t(R,E);E=E.sibling}E=ac(T,R.mode,Q),E.return=R,R=E}return h(R);case Ee:return xe=T._init,qe(R,E,xe(T._payload),Q)}if(se(T))return ie(R,E,T,Q);if(ee(T))return ce(R,E,T,Q);Nl(R,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,E!==null&&E.tag===6?(n(R,E.sibling),E=a(E,T),E.return=R,R=E):(n(R,E),E=ic(T,R.mode,Q),E.return=R,R=E),h(R)):n(R,E)}return qe}var Xn=zu(!0),Lu=zu(!1),Sl=Pr(null),Cl=null,es=null,ga=null;function ya(){ga=es=Cl=null}function va(e){var t=Sl.current;Ue(Sl),e._currentValue=t}function ba(e,t,n){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===n)break;e=e.return}}function ts(e,t){Cl=e,ga=es=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(vt=!0),e.firstContext=null)}function At(e){var t=e._currentValue;if(ga!==e)if(e={context:e,memoizedValue:t,next:null},es===null){if(Cl===null)throw Error(i(308));es=e,Cl.dependencies={lanes:0,firstContext:e}}else es=es.next=e;return t}var cn=null;function wa(e){cn===null?cn=[e]:cn.push(e)}function Fu(e,t,n,l){var a=t.interleaved;return a===null?(n.next=n,wa(t)):(n.next=a.next,a.next=n),t.interleaved=n,fr(e,l)}function fr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Rr=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Iu(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 pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Or(e,t,n){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,fr(e,n)}return a=l.interleaved,a===null?(t.next=t,wa(l)):(t.next=a.next,a.next=t),l.interleaved=t,fr(e,n)}function El(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,zi(e,n)}}function Uu(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var a=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var h={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};d===null?a=d=h:d=d.next=h,n=n.next}while(n!==null);d===null?a=d=t:d=d.next=t}else a=d=t;n={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:d,shared:l.shared,effects:l.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Pl(e,t,n,l){var a=e.updateQueue;Rr=!1;var d=a.firstBaseUpdate,h=a.lastBaseUpdate,y=a.shared.pending;if(y!==null){a.shared.pending=null;var k=y,A=k.next;k.next=null,h===null?d=A:h.next=A,h=k;var W=e.alternate;W!==null&&(W=W.updateQueue,y=W.lastBaseUpdate,y!==h&&(y===null?W.firstBaseUpdate=A:y.next=A,W.lastBaseUpdate=k))}if(d!==null){var G=a.baseState;h=0,W=A=k=null,y=d;do{var V=y.lane,re=y.eventTime;if((l&V)===V){W!==null&&(W=W.next={eventTime:re,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var ie=e,ce=y;switch(V=t,re=n,ce.tag){case 1:if(ie=ce.payload,typeof ie=="function"){G=ie.call(re,G,V);break e}G=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=ce.payload,V=typeof ie=="function"?ie.call(re,G,V):ie,V==null)break e;G=Y({},G,V);break e;case 2:Rr=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,V=a.effects,V===null?a.effects=[y]:V.push(y))}else re={eventTime:re,lane:V,tag:y.tag,payload:y.payload,callback:y.callback,next:null},W===null?(A=W=re,k=G):W=W.next=re,h|=V;if(y=y.next,y===null){if(y=a.shared.pending,y===null)break;V=y,y=V.next,V.next=null,a.lastBaseUpdate=V,a.shared.pending=null}}while(!0);if(W===null&&(k=G),a.baseState=k,a.firstBaseUpdate=A,a.lastBaseUpdate=W,t=a.shared.interleaved,t!==null){a=t;do h|=a.lane,a=a.next;while(a!==t)}else d===null&&(a.shared.lanes=0);fn|=h,e.lanes=h,e.memoizedState=G}}function $u(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var l=Ea.transition;Ea.transition={};try{e(!1),t()}finally{Ae=n,Ea.transition=l}}function lf(){return zt().memoizedState}function $x(e,t,n){var l=zr(e);if(n={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null},af(e))cf(t,n);else if(n=Fu(e,t,n,l),n!==null){var a=ht();Kt(n,e,l,a),df(n,t,l)}}function Bx(e,t,n){var l=zr(e),a={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null};if(af(e))cf(t,a);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var h=t.lastRenderedState,y=d(h,n);if(a.hasEagerState=!0,a.eagerState=y,Bt(y,h)){var k=t.interleaved;k===null?(a.next=a,wa(t)):(a.next=k.next,k.next=a),t.interleaved=a;return}}catch{}finally{}n=Fu(e,t,a,l),n!==null&&(a=ht(),Kt(n,e,l,a),df(n,t,l))}}function af(e){var t=e.alternate;return e===We||t!==null&&t===We}function cf(e,t){mo=Rl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function df(e,t,n){if((n&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,zi(e,n)}}var Tl={readContext:At,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},Hx={readContext:At,useCallback:function(e,t){return er().memoizedState=[e,t===void 0?null:t],e},useContext:At,useEffect:Ju,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ol(4194308,4,tf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ol(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ol(4,2,e,t)},useMemo:function(e,t){var n=er();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var l=er();return t=n!==void 0?n(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=$x.bind(null,We,e),[l.memoizedState,e]},useRef:function(e){var t=er();return e={current:e},t.memoizedState=e},useState:Zu,useDebugValue:Ta,useDeferredValue:function(e){return er().memoizedState=e},useTransition:function(){var e=Zu(!1),t=e[0];return e=Ux.bind(null,e[1]),er().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var l=We,a=er();if(Be){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),tt===null)throw Error(i(349));(un&30)!==0||Wu(l,t,n)}a.memoizedState=n;var d={value:n,getSnapshot:t};return a.queue=d,Ju(Ku.bind(null,l,d,e),[e]),l.flags|=2048,yo(9,Gu.bind(null,l,d,n,t),void 0,null),n},useId:function(){var e=er(),t=tt.identifierPrefix;if(Be){var n=ur,l=dr;n=(l&~(1<<32-$t(l)-1)).toString(32)+n,t=":"+t+"R"+n,n=xo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=h.createElement(n,{is:l.is}):(e=h.createElement(n),n==="select"&&(h=e,l.multiple?h.multiple=!0:l.size&&(h.size=l.size))):e=h.createElementNS(e,n),e[Jt]=t,e[ao]=l,Mf(e,t,!1,!1),t.stateNode=e;e:{switch(h=Ci(n,l),n){case"dialog":Ie("cancel",e),Ie("close",e),a=l;break;case"iframe":case"object":case"embed":Ie("load",e),a=l;break;case"video":case"audio":for(a=0;als&&(t.flags|=128,l=!0,vo(d,!1),t.lanes=4194304)}else{if(!l)if(e=_l(h),e!==null){if(t.flags|=128,l=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),vo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!h.alternate&&!Be)return dt(t),null}else 2*Qe()-d.renderingStartTime>ls&&n!==1073741824&&(t.flags|=128,l=!0,vo(d,!1),t.lanes=4194304);d.isBackwards?(h.sibling=t.child,t.child=h):(n=d.last,n!==null?n.sibling=h:t.child=h,d.last=h)}return d.tail!==null?(t=d.tail,d.rendering=t,d.tail=t.sibling,d.renderingStartTime=Qe(),t.sibling=null,n=Ve.current,Fe(Ve,l?n&1|2:n&1),t):(dt(t),null);case 22:case 23:return sc(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(_t&1073741824)!==0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Yx(e,t){switch(pa(t),t.tag){case 1:return yt(t.type)&&yl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rs(),Ue(gt),Ue(at),Ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Na(t),null;case 13:if(Ue(Ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Jn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Ve),null;case 4:return rs(),null;case 10:return va(t.type._context),null;case 22:case 23:return sc(),null;case 24:return null;default:return null}}var Fl=!1,ut=!1,Jx=typeof WeakSet=="function"?WeakSet:Set,oe=null;function ss(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(l){Ge(e,t,l)}else n.current=null}function Ga(e,t,n){try{n()}catch(l){Ge(e,t,l)}}var Df=!1;function Xx(e,t){if(sa=sl,e=du(),Zi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var a=l.anchorOffset,d=l.focusNode;l=l.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var h=0,y=-1,k=-1,z=0,W=0,G=e,V=null;t:for(;;){for(var re;G!==n||a!==0&&G.nodeType!==3||(y=h+a),G!==d||l!==0&&G.nodeType!==3||(k=h+l),G.nodeType===3&&(h+=G.nodeValue.length),(re=G.firstChild)!==null;)V=G,G=re;for(;;){if(G===e)break t;if(V===n&&++z===a&&(y=h),V===d&&++W===l&&(k=h),(re=G.nextSibling)!==null)break;G=V,V=G.parentNode}G=re}n=y===-1||k===-1?null:{start:y,end:k}}else n=null}n=n||{start:0,end:0}}else n=null;for(oa={focusedElem:e,selectionRange:n},sl=!1,oe=t;oe!==null;)if(t=oe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oe=e;else for(;oe!==null;){t=oe;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var ce=ie.memoizedProps,qe=ie.memoizedState,R=t.stateNode,E=R.getSnapshotBeforeUpdate(t.elementType===t.type?ce:Vt(t.type,ce),qe);R.__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,oe=e;break}oe=t.return}return ie=Df,Df=!1,ie}function bo(e,t,n){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 d=a.destroy;a.destroy=void 0,d!==void 0&&Ga(t,n,d)}a=a.next}while(a!==l)}}function Il(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var l=n.create;n.destroy=l()}n=n.next}while(n!==t)}}function Ka(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Tf(e){var t=e.alternate;t!==null&&(e.alternate=null,Tf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Jt],delete t[ao],delete t[ca],delete t[Ax],delete t[zx])),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 Af(e){return e.tag===5||e.tag===3||e.tag===4}function zf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Af(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 Qa(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=xl));else if(l!==4&&(e=e.child,e!==null))for(Qa(e,t,n),e=e.sibling;e!==null;)Qa(e,t,n),e=e.sibling}function qa(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(qa(e,t,n),e=e.sibling;e!==null;)qa(e,t,n),e=e.sibling}var st=null,Wt=!1;function Dr(e,t,n){for(n=n.child;n!==null;)Lf(e,t,n),n=n.sibling}function Lf(e,t,n){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(Jo,n)}catch{}switch(n.tag){case 5:ut||ss(n,t);case 6:var l=st,a=Wt;st=null,Dr(e,t,n),st=l,Wt=a,st!==null&&(Wt?(e=st,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):st.removeChild(n.stateNode));break;case 18:st!==null&&(Wt?(e=st,n=n.stateNode,e.nodeType===8?aa(e.parentNode,n):e.nodeType===1&&aa(e,n),Ys(e)):aa(st,n.stateNode));break;case 4:l=st,a=Wt,st=n.stateNode.containerInfo,Wt=!0,Dr(e,t,n),st=l,Wt=a;break;case 0:case 11:case 14:case 15:if(!ut&&(l=n.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){a=l=l.next;do{var d=a,h=d.destroy;d=d.tag,h!==void 0&&((d&2)!==0||(d&4)!==0)&&Ga(n,t,h),a=a.next}while(a!==l)}Dr(e,t,n);break;case 1:if(!ut&&(ss(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=n.memoizedProps,l.state=n.memoizedState,l.componentWillUnmount()}catch(y){Ge(n,t,y)}Dr(e,t,n);break;case 21:Dr(e,t,n);break;case 22:n.mode&1?(ut=(l=ut)||n.memoizedState!==null,Dr(e,t,n),ut=l):Dr(e,t,n);break;default:Dr(e,t,n)}}function Ff(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Jx),t.forEach(function(l){var a=ag.bind(null,e,l);n.has(l)||(n.add(l),l.then(a,a))})}}function Gt(e,t){var n=t.deletions;if(n!==null)for(var l=0;la&&(a=h),l&=~d}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*tg(l/1960))-l,10e?16:e,Ar===null)var l=!1;else{if(e=Ar,Ar=null,Vl=0,(Re&6)!==0)throw Error(i(331));var a=Re;for(Re|=4,oe=e.current;oe!==null;){var d=oe,h=d.child;if((oe.flags&16)!==0){var y=d.deletions;if(y!==null){for(var k=0;kQe()-Ja?hn(e,0):Ya|=n),wt(e,t)}function Yf(e,t){t===0&&((e.mode&1)===0?t=1:(t=el,el<<=1,(el&130023424)===0&&(el=4194304)));var n=ht();e=fr(e,t),e!==null&&(Gs(e,t,n),wt(e,n))}function ig(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yf(e,n)}function ag(e,t){var n=0;switch(e.tag){case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(i(314))}l!==null&&l.delete(t),Yf(e,n)}var Jf;Jf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||gt.current)vt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return vt=!1,qx(e,t,n);vt=(e.flags&131072)!==0}else vt=!1,Be&&(t.flags&1048576)!==0&&Mu(t,jl,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Ll(e,t),e=t.pendingProps;var a=qn(t,at.current);ts(t,n),a=_a(null,t,l,e,a,n);var d=Ma();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,yt(l)?(d=!0,vl(t)):d=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ja(t),a.updater=Al,t.stateNode=a,a._reactInternals=t,za(t,l,e,n),t=Ua(null,t,l,!0,d,n)):(t.tag=0,Be&&d&&fa(t),pt(null,t,a,n),t=t.child),t;case 16:l=t.elementType;e:{switch(Ll(e,t),e=t.pendingProps,a=l._init,l=a(l._payload),t.type=l,a=t.tag=dg(l),e=Vt(l,e),a){case 0:t=Ia(null,t,l,e,n);break e;case 1:t=Nf(null,t,l,e,n);break e;case 11:t=vf(null,t,l,e,n);break e;case 14:t=bf(null,t,l,Vt(l.type,e),n);break e}throw Error(i(306,l,""))}return t;case 0:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),Ia(e,t,l,a,n);case 1:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),Nf(e,t,l,a,n);case 3:e:{if(Sf(t),e===null)throw Error(i(387));l=t.pendingProps,d=t.memoizedState,a=d.element,Iu(e,t),Pl(t,l,null,n);var h=t.memoizedState;if(l=h.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){a=ns(Error(i(423)),t),t=Cf(e,t,l,n,a);break e}else if(l!==a){a=ns(Error(i(424)),t),t=Cf(e,t,l,n,a);break e}else for(Pt=Er(t.stateNode.containerInfo.firstChild),Et=t,Be=!0,Ht=null,n=Lu(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Jn(),l===a){t=hr(e,t,n);break e}pt(e,t,l,n)}t=t.child}return t;case 5:return Bu(t),e===null&&ma(t),l=t.type,a=t.pendingProps,d=e!==null?e.memoizedProps:null,h=a.children,la(l,a)?h=null:d!==null&&la(l,d)&&(t.flags|=32),kf(e,t),pt(e,t,h,n),t.child;case 6:return e===null&&ma(t),null;case 13:return Ef(e,t,n);case 4:return ka(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Xn(t,null,l,n):pt(e,t,l,n),t.child;case 11:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),vf(e,t,l,a,n);case 7:return pt(e,t,t.pendingProps,n),t.child;case 8:return pt(e,t,t.pendingProps.children,n),t.child;case 12:return pt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(l=t.type._context,a=t.pendingProps,d=t.memoizedProps,h=a.value,Fe(Sl,l._currentValue),l._currentValue=h,d!==null)if(Bt(d.value,h)){if(d.children===a.children&&!gt.current){t=hr(e,t,n);break e}}else for(d=t.child,d!==null&&(d.return=t);d!==null;){var y=d.dependencies;if(y!==null){h=d.child;for(var k=y.firstContext;k!==null;){if(k.context===l){if(d.tag===1){k=pr(-1,n&-n),k.tag=2;var z=d.updateQueue;if(z!==null){z=z.shared;var W=z.pending;W===null?k.next=k:(k.next=W.next,W.next=k),z.pending=k}}d.lanes|=n,k=d.alternate,k!==null&&(k.lanes|=n),ba(d.return,n,t),y.lanes|=n;break}k=k.next}}else if(d.tag===10)h=d.type===t.type?null:d.child;else if(d.tag===18){if(h=d.return,h===null)throw Error(i(341));h.lanes|=n,y=h.alternate,y!==null&&(y.lanes|=n),ba(h,n,t),h=d.sibling}else h=d.child;if(h!==null)h.return=d;else for(h=d;h!==null;){if(h===t){h=null;break}if(d=h.sibling,d!==null){d.return=h.return,h=d;break}h=h.return}d=h}pt(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,l=t.pendingProps.children,ts(t,n),a=At(a),l=l(a),t.flags|=1,pt(e,t,l,n),t.child;case 14:return l=t.type,a=Vt(l,t.pendingProps),a=Vt(l.type,a),bf(e,t,l,a,n);case 15:return wf(e,t,t.type,t.pendingProps,n);case 17:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),Ll(e,t),t.tag=1,yt(l)?(e=!0,vl(t)):e=!1,ts(t,n),ff(t,l,a),za(t,l,a,n),Ua(null,t,l,!0,e,n);case 19:return _f(e,t,n);case 22:return jf(e,t,n)}throw Error(i(156,t.tag))};function Xf(e,t){return Rd(e,t)}function cg(e,t,n,l){this.tag=e,this.key=n,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 Ft(e,t,n,l){return new cg(e,t,n,l)}function lc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dg(e){if(typeof e=="function")return lc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===Le)return 14}return 2}function Fr(e,t){var n=e.alternate;return n===null?(n=Ft(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ql(e,t,n,l,a,d){var h=2;if(l=e,typeof e=="function")lc(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case H:return xn(n.children,a,d,t);case ae:h=8,a|=8;break;case te:return e=Ft(12,n,t,a|2),e.elementType=te,e.lanes=d,e;case ze:return e=Ft(13,n,t,a),e.elementType=ze,e.lanes=d,e;case Ce:return e=Ft(19,n,t,a),e.elementType=Ce,e.lanes=d,e;case Pe:return ql(n,a,d,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fe:h=10;break e;case ke:h=9;break e;case ue:h=11;break e;case Le:h=14;break e;case Ee:h=16,l=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=Ft(h,n,t,a),t.elementType=e,t.type=l,t.lanes=d,t}function xn(e,t,n,l){return e=Ft(7,e,l,t),e.lanes=n,e}function ql(e,t,n,l){return e=Ft(22,e,l,t),e.elementType=Pe,e.lanes=n,e.stateNode={isHidden:!1},e}function ic(e,t,n){return e=Ft(6,e,null,t),e.lanes=n,e}function ac(e,t,n){return t=Ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ug(e,t,n,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=Ai(0),this.expirationTimes=Ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ai(0),this.identifierPrefix=l,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function cc(e,t,n,l,a,d,h,y,k){return e=new ug(e,t,n,y,k),t===1?(t=1,d===!0&&(t|=8)):t=0,d=Ft(3,null,null,t),e.current=d,d.stateNode=e,d.memoizedState={element:l,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ja(d),e}function fg(e,t,n){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(),xc.exports=Ng(),xc.exports}var hp;function Sg(){if(hp)return ni;hp=1;var s=dh();return ni.createRoot=s.createRoot,ni.hydrateRoot=s.hydrateRoot,ni}var Cg=Sg();const Eg=ah(Cg);var Go=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(){}},vn,Wr,xs,Jp,Pg=(Jp=class extends Go{constructor(){super();ye(this,vn);ye(this,Wr);ye(this,xs);ne(this,xs,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){N(this,Wr)||this.setEventListener(N(this,xs))}onUnsubscribe(){var o;this.hasListeners()||((o=N(this,Wr))==null||o.call(this),ne(this,Wr,void 0))}setEventListener(o){var i;ne(this,xs,o),(i=N(this,Wr))==null||i.call(this),ne(this,Wr,o(c=>{typeof c=="boolean"?this.setFocused(c):this.onFocus()}))}setFocused(o){N(this,vn)!==o&&(ne(this,vn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(i=>{i(o)})}isFocused(){var o;return typeof N(this,vn)=="boolean"?N(this,vn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},vn=new WeakMap,Wr=new WeakMap,xs=new WeakMap,Jp),ld=new Pg,_g={setTimeout:(s,o)=>setTimeout(s,o),clearTimeout:s=>clearTimeout(s),setInterval:(s,o)=>setInterval(s,o),clearInterval:s=>clearInterval(s)},Gr,nd,Xp,Mg=(Xp=class{constructor(){ye(this,Gr,_g);ye(this,nd,!1)}setTimeoutProvider(s){ne(this,Gr,s)}setTimeout(s,o){return N(this,Gr).setTimeout(s,o)}clearTimeout(s){N(this,Gr).clearTimeout(s)}setInterval(s,o){return N(this,Gr).setInterval(s,o)}clearInterval(s){N(this,Gr).clearInterval(s)}},Gr=new WeakMap,nd=new WeakMap,Xp),yn=new Mg;function Rg(s){setTimeout(s,0)}var Og=typeof window>"u"||"Deno"in globalThis;function Nt(){}function Dg(s,o){return typeof s=="function"?s(o):s}function Rc(s){return typeof s=="number"&&s>=0&&s!==1/0}function uh(s,o){return Math.max(s+(o||0)-Date.now(),0)}function Xr(s,o){return typeof s=="function"?s(o):s}function Rt(s,o){return typeof s=="function"?s(o):s}function mp(s,o){const{type:i="all",exact:c,fetchStatus:u,predicate:f,queryKey:m,stale:p}=s;if(m){if(c){if(o.queryHash!==id(m,o.options))return!1}else if(!Ro(o.queryKey,m))return!1}if(i!=="all"){const v=o.isActive();if(i==="active"&&!v||i==="inactive"&&v)return!1}return!(typeof p=="boolean"&&o.isStale()!==p||u&&u!==o.state.fetchStatus||f&&!f(o))}function xp(s,o){const{exact:i,status:c,predicate:u,mutationKey:f}=s;if(f){if(!o.options.mutationKey)return!1;if(i){if(Mo(o.options.mutationKey)!==Mo(f))return!1}else if(!Ro(o.options.mutationKey,f))return!1}return!(c&&o.state.status!==c||u&&!u(o))}function id(s,o){return((o==null?void 0:o.queryKeyHashFn)||Mo)(s)}function Mo(s){return JSON.stringify(s,(o,i)=>Dc(i)?Object.keys(i).sort().reduce((c,u)=>(c[u]=i[u],c),{}):i)}function Ro(s,o){return s===o?!0:typeof s!=typeof o?!1:s&&o&&typeof s=="object"&&typeof o=="object"?Object.keys(o).every(i=>Ro(s[i],o[i])):!1}var Tg=Object.prototype.hasOwnProperty;function fh(s,o,i=0){if(s===o)return s;if(i>500)return o;const c=gp(s)&&gp(o);if(!c&&!(Dc(s)&&Dc(o)))return o;const f=(c?s:Object.keys(s)).length,m=c?o:Object.keys(o),p=m.length,v=c?new Array(p):{};let g=0;for(let j=0;j{yn.setTimeout(o,s)})}function Tc(s,o,i){return typeof i.structuralSharing=="function"?i.structuralSharing(s,o):i.structuralSharing!==!1?fh(s,o):o}function zg(s,o,i=0){const c=[...s,o];return i&&c.length>i?c.slice(1):c}function Lg(s,o,i=0){const c=[o,...s];return i&&c.length>i?c.slice(0,-1):c}var ad=Symbol();function ph(s,o){return!s.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!s.queryFn||s.queryFn===ad?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function hh(s,o){return typeof s=="function"?s(...o):!!s}function Fg(s,o,i){let c=!1,u;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(u??(u=o()),c||(c=!0,u.aborted?i():u.addEventListener("abort",i,{once:!0})),u)}),s}var Oo=(()=>{let s=()=>Og;return{isServer(){return s()},setIsServer(o){s=o}}})();function Ac(){let s,o;const i=new Promise((u,f)=>{s=u,o=f});i.status="pending",i.catch(()=>{});function c(u){Object.assign(i,u),delete i.resolve,delete i.reject}return i.resolve=u=>{c({status:"fulfilled",value:u}),s(u)},i.reject=u=>{c({status:"rejected",reason:u}),o(u)},i}var Ig=Rg;function Ug(){let s=[],o=0,i=p=>{p()},c=p=>{p()},u=Ig;const f=p=>{o?s.push(p):u(()=>{i(p)})},m=()=>{const p=s;s=[],p.length&&u(()=>{c(()=>{p.forEach(v=>{i(v)})})})};return{batch:p=>{let v;o++;try{v=p()}finally{o--,o||m()}return v},batchCalls:p=>(...v)=>{f(()=>{p(...v)})},schedule:f,setNotifyFunction:p=>{i=p},setBatchNotifyFunction:p=>{c=p},setScheduler:p=>{u=p}}}var lt=Ug(),gs,Kr,ys,eh,$g=(eh=class extends Go{constructor(){super();ye(this,gs,!0);ye(this,Kr);ye(this,ys);ne(this,ys,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o(!0),c=()=>o(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",c,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",c)}}})}onSubscribe(){N(this,Kr)||this.setEventListener(N(this,ys))}onUnsubscribe(){var o;this.hasListeners()||((o=N(this,Kr))==null||o.call(this),ne(this,Kr,void 0))}setEventListener(o){var i;ne(this,ys,o),(i=N(this,Kr))==null||i.call(this),ne(this,Kr,o(this.setOnline.bind(this)))}setOnline(o){N(this,gs)!==o&&(ne(this,gs,o),this.listeners.forEach(c=>{c(o)}))}isOnline(){return N(this,gs)}},gs=new WeakMap,Kr=new WeakMap,ys=new WeakMap,eh),gi=new $g;function Bg(s){return Math.min(1e3*2**s,3e4)}function mh(s){return(s??"online")==="online"?gi.isOnline():!0}var zc=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,c;const u=Ac(),f=()=>u.status!=="pending",m=b=>{var S;if(!f()){const O=new zc(b);_(O),(S=s.onCancel)==null||S.call(s,O)}},p=()=>{o=!0},v=()=>{o=!1},g=()=>ld.isFocused()&&(s.networkMode==="always"||gi.isOnline())&&s.canRun(),j=()=>mh(s.networkMode)&&s.canRun(),w=b=>{f()||(c==null||c(),u.resolve(b))},_=b=>{f()||(c==null||c(),u.reject(b))},M=()=>new Promise(b=>{var S;c=O=>{(f()||g())&&b(O)},(S=s.onPause)==null||S.call(s)}).then(()=>{var b;c=void 0,f()||(b=s.onContinue)==null||b.call(s)}),L=()=>{if(f())return;let b;const S=i===0?s.initialPromise:void 0;try{b=S??s.fn()}catch(O){b=Promise.reject(O)}Promise.resolve(b).then(w).catch(O=>{var $;if(f())return;const I=s.retry??(Oo.isServer()?0:3),B=s.retryDelay??Bg,F=typeof B=="function"?B(i,O):B,D=I===!0||typeof I=="number"&&ig()?void 0:M()).then(()=>{o?_(O):L()})})};return{promise:u,status:()=>u.status,cancel:m,continue:()=>(c==null||c(),u),cancelRetry:p,continueRetry:v,canStart:j,start:()=>(j()?L():M().then(L),u)}}var bn,th,gh=(th=class{constructor(){ye(this,bn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Rc(this.gcTime)&&ne(this,bn,yn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Oo.isServer()?1/0:300*1e3))}clearGcTimeout(){N(this,bn)!==void 0&&(yn.clearTimeout(N(this,bn)),ne(this,bn,void 0))}},bn=new WeakMap,th);function Hg(s){return{onFetch:(o,i)=>{var j,w,_,M,L;const c=o.options,u=(_=(w=(j=o.fetchOptions)==null?void 0:j.meta)==null?void 0:w.fetchMore)==null?void 0:_.direction,f=((M=o.state.data)==null?void 0:M.pages)||[],m=((L=o.state.data)==null?void 0:L.pageParams)||[];let p={pages:[],pageParams:[]},v=0;const g=async()=>{let b=!1;const S=B=>{Fg(B,()=>o.signal,()=>b=!0)},O=ph(o.options,o.fetchOptions),I=async(B,F,D)=>{if(b)return Promise.reject(o.signal.reason);if(F==null&&B.pages.length)return Promise.resolve(B);const H=(()=>{const ke={client:o.client,queryKey:o.queryKey,pageParam:F,direction:D?"backward":"forward",meta:o.options.meta};return S(ke),ke})(),ae=await O(H),{maxPages:te}=o.options,fe=D?Lg:zg;return{pages:fe(B.pages,ae,te),pageParams:fe(B.pageParams,F,te)}};if(u&&f.length){const B=u==="backward",F=B?Vg:vp,D={pages:f,pageParams:m},$=F(c,D);p=await I(D,$,B)}else{const B=s??f.length;do{const F=v===0?m[0]??c.initialPageParam:vp(c,p);if(v>0&&F==null)break;p=await I(p,F),v++}while(v{var b,S;return(S=(b=o.options).persister)==null?void 0:S.call(b,g,{client:o.client,queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},i)}:o.fetchFn=g}}}function vp(s,{pages:o,pageParams:i}){const c=o.length-1;return o.length>0?s.getNextPageParam(o[c],o,i[c],i):void 0}function Vg(s,{pages:o,pageParams:i}){var c;return o.length>0?(c=s.getPreviousPageParam)==null?void 0:c.call(s,o[0],o,i[0],i):void 0}var vs,wn,bs,It,jn,nt,$o,kn,Mt,yh,gr,rh,Wg=(rh=class extends gh{constructor(o){super();ye(this,Mt);ye(this,vs);ye(this,wn);ye(this,bs);ye(this,It);ye(this,jn);ye(this,nt);ye(this,$o);ye(this,kn);ne(this,kn,!1),ne(this,$o,o.defaultOptions),this.setOptions(o.options),this.observers=[],ne(this,jn,o.client),ne(this,It,N(this,jn).getQueryCache()),this.queryKey=o.queryKey,this.queryHash=o.queryHash,ne(this,wn,wp(this.options)),this.state=o.state??N(this,wn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return N(this,vs)}get promise(){var o;return(o=N(this,nt))==null?void 0:o.promise}setOptions(o){if(this.options={...N(this,$o),...o},o!=null&&o._type&&ne(this,vs,o._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=wp(this.options);i.data!==void 0&&(this.setState(bp(i.data,i.dataUpdatedAt)),ne(this,wn,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,It).remove(this)}setData(o,i){const c=Tc(this.state.data,o,this.options);return _e(this,Mt,gr).call(this,{data:c,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),c}setState(o){_e(this,Mt,gr).call(this,{type:"setState",state:o})}cancel(o){var c,u;const i=(c=N(this,nt))==null?void 0:c.promise;return(u=N(this,nt))==null||u.cancel(o),i?i.then(Nt).catch(Nt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return N(this,wn)}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===ad||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(o=>Xr(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:!uh(this.state.dataUpdatedAt,o)}onFocus(){var i;const o=this.observers.find(c=>c.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(i=N(this,nt))==null||i.continue()}onOnline(){var i;const o=this.observers.find(c=>c.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(i=N(this,nt))==null||i.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),N(this,It).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(i=>i!==o),this.observers.length||(N(this,nt)&&(N(this,kn)||_e(this,Mt,yh).call(this)?N(this,nt).cancel({revert:!0}):N(this,nt).cancelRetry()),this.scheduleGc()),N(this,It).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Mt,gr).call(this,{type:"invalidate"})}async fetch(o,i){var g,j,w,_,M,L,b,S,O,I,B;if(this.state.fetchStatus!=="idle"&&((g=N(this,nt))==null?void 0:g.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(N(this,nt))return N(this,nt).continueRetry(),N(this,nt).promise}if(o&&this.setOptions(o),!this.options.queryFn){const F=this.observers.find(D=>D.options.queryFn);F&&this.setOptions(F.options)}const c=new AbortController,u=F=>{Object.defineProperty(F,"signal",{enumerable:!0,get:()=>(ne(this,kn,!0),c.signal)})},f=()=>{const F=ph(this.options,i),$=(()=>{const H={client:N(this,jn),queryKey:this.queryKey,meta:this.meta};return u(H),H})();return ne(this,kn,!1),this.options.persister?this.options.persister(F,$,this):F($)},p=(()=>{const F={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:N(this,jn),state:this.state,fetchFn:f};return u(F),F})(),v=N(this,vs)==="infinite"?Hg(this.options.pages):this.options.behavior;v==null||v.onFetch(p,this),ne(this,bs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((j=p.fetchOptions)==null?void 0:j.meta))&&_e(this,Mt,gr).call(this,{type:"fetch",meta:(w=p.fetchOptions)==null?void 0:w.meta}),ne(this,nt,xh({initialPromise:i==null?void 0:i.initialPromise,fn:p.fetchFn,onCancel:F=>{F instanceof zc&&F.revert&&this.setState({...N(this,bs),fetchStatus:"idle"}),c.abort()},onFail:(F,D)=>{_e(this,Mt,gr).call(this,{type:"failed",failureCount:F,error:D})},onPause:()=>{_e(this,Mt,gr).call(this,{type:"pause"})},onContinue:()=>{_e(this,Mt,gr).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{const F=await N(this,nt).start();if(F===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(F),(M=(_=N(this,It).config).onSuccess)==null||M.call(_,F,this),(b=(L=N(this,It).config).onSettled)==null||b.call(L,F,this.state.error,this),F}catch(F){if(F instanceof zc){if(F.silent)return N(this,nt).promise;if(F.revert){if(this.state.data===void 0)throw F;return this.state.data}}throw _e(this,Mt,gr).call(this,{type:"error",error:F}),(O=(S=N(this,It).config).onError)==null||O.call(S,F,this),(B=(I=N(this,It).config).onSettled)==null||B.call(I,this.state.data,F,this),F}finally{this.scheduleGc()}}},vs=new WeakMap,wn=new WeakMap,bs=new WeakMap,It=new WeakMap,jn=new WeakMap,nt=new WeakMap,$o=new WeakMap,kn=new WeakMap,Mt=new WeakSet,yh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},gr=function(o){const i=c=>{switch(o.type){case"failed":return{...c,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...c,fetchStatus:"paused"};case"continue":return{...c,fetchStatus:"fetching"};case"fetch":return{...c,...vh(c.data,this.options),fetchMeta:o.meta??null};case"success":const u={...c,...bp(o.data,o.dataUpdatedAt),dataUpdateCount:c.dataUpdateCount+1,...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,bs,o.manual?u:void 0),u;case"error":const f=o.error;return{...c,error:f,errorUpdateCount:c.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:c.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...c,isInvalidated:!0};case"setState":return{...c,...o.state}}};this.state=i(this.state),lt.batch(()=>{this.observers.forEach(c=>{c.onQueryUpdate()}),N(this,It).notify({query:this,type:"updated",action:o})})},rh);function vh(s,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:mh(o.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function bp(s,o){return{data:s,dataUpdatedAt:o??Date.now(),error:null,isInvalidated:!1,status:"success"}}function wp(s){const o=typeof s.initialData=="function"?s.initialData():s.initialData,i=o!==void 0,c=i?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:i?c??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var kt,Me,Bo,mt,Nn,ws,yr,Qr,Ho,js,ks,Sn,Cn,qr,Ns,Te,_o,Lc,Fc,Ic,Uc,$c,Bc,Hc,bh,nh,Gg=(nh=class extends Go{constructor(o,i){super();ye(this,Te);ye(this,kt);ye(this,Me);ye(this,Bo);ye(this,mt);ye(this,Nn);ye(this,ws);ye(this,yr);ye(this,Qr);ye(this,Ho);ye(this,js);ye(this,ks);ye(this,Sn);ye(this,Cn);ye(this,qr);ye(this,Ns,new Set);this.options=i,ne(this,kt,o),ne(this,Qr,null),ne(this,yr,Ac()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,Me).addObserver(this),jp(N(this,Me),this.options)?_e(this,Te,_o).call(this):this.updateResult(),_e(this,Te,Uc).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vc(N(this,Me),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vc(N(this,Me),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Te,$c).call(this),_e(this,Te,Bc).call(this),N(this,Me).removeObserver(this)}setOptions(o){const i=this.options,c=N(this,Me);if(this.options=N(this,kt).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,N(this,Me))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Te,Hc).call(this),N(this,Me).setOptions(this.options),i._defaulted&&!Oc(this.options,i)&&N(this,kt).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,Me),observer:this});const u=this.hasListeners();u&&kp(N(this,Me),c,this.options,i)&&_e(this,Te,_o).call(this),this.updateResult(),u&&(N(this,Me)!==c||Rt(this.options.enabled,N(this,Me))!==Rt(i.enabled,N(this,Me))||Xr(this.options.staleTime,N(this,Me))!==Xr(i.staleTime,N(this,Me)))&&_e(this,Te,Lc).call(this);const f=_e(this,Te,Fc).call(this);u&&(N(this,Me)!==c||Rt(this.options.enabled,N(this,Me))!==Rt(i.enabled,N(this,Me))||f!==N(this,qr))&&_e(this,Te,Ic).call(this,f)}getOptimisticResult(o){const i=N(this,kt).getQueryCache().build(N(this,kt),o),c=this.createResult(i,o);return Qg(this,c)&&(ne(this,mt,c),ne(this,ws,this.options),ne(this,Nn,N(this,Me).state)),c}getCurrentResult(){return N(this,mt)}trackResult(o,i){return new Proxy(o,{get:(c,u)=>(this.trackProp(u),i==null||i(u),u==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,yr).status==="pending"&&N(this,yr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(c,u))})}trackProp(o){N(this,Ns).add(o)}getCurrentQuery(){return N(this,Me)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const i=N(this,kt).defaultQueryOptions(o),c=N(this,kt).getQueryCache().build(N(this,kt),i);return c.fetch().then(()=>this.createResult(c,i))}fetch(o){return _e(this,Te,_o).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,mt)))}createResult(o,i){var te;const c=N(this,Me),u=this.options,f=N(this,mt),m=N(this,Nn),p=N(this,ws),g=o!==c?o.state:N(this,Bo),{state:j}=o;let w={...j},_=!1,M;if(i._optimisticResults){const fe=this.hasListeners(),ke=!fe&&jp(o,i),ue=fe&&kp(o,c,i,u);(ke||ue)&&(w={...w,...vh(j.data,o.options)}),i._optimisticResults==="isRestoring"&&(w.fetchStatus="idle")}let{error:L,errorUpdatedAt:b,status:S}=w;M=w.data;let O=!1;if(i.placeholderData!==void 0&&M===void 0&&S==="pending"){let fe;f!=null&&f.isPlaceholderData&&i.placeholderData===(p==null?void 0:p.placeholderData)?(fe=f.data,O=!0):fe=typeof i.placeholderData=="function"?i.placeholderData((te=N(this,ks))==null?void 0:te.state.data,N(this,ks)):i.placeholderData,fe!==void 0&&(S="success",M=Tc(f==null?void 0:f.data,fe,i),_=!0)}if(i.select&&M!==void 0&&!O)if(f&&M===(m==null?void 0:m.data)&&i.select===N(this,Ho))M=N(this,js);else try{ne(this,Ho,i.select),M=i.select(M),M=Tc(f==null?void 0:f.data,M,i),ne(this,js,M),ne(this,Qr,null)}catch(fe){ne(this,Qr,fe)}N(this,Qr)&&(L=N(this,Qr),M=N(this,js),b=Date.now(),S="error");const I=w.fetchStatus==="fetching",B=S==="pending",F=S==="error",D=B&&I,$=M!==void 0,ae={status:S,fetchStatus:w.fetchStatus,isPending:B,isSuccess:S==="success",isError:F,isInitialLoading:D,isLoading:D,data:M,dataUpdatedAt:w.dataUpdatedAt,error:L,errorUpdatedAt:b,failureCount:w.fetchFailureCount,failureReason:w.fetchFailureReason,errorUpdateCount:w.errorUpdateCount,isFetched:o.isFetched(),isFetchedAfterMount:w.dataUpdateCount>g.dataUpdateCount||w.errorUpdateCount>g.errorUpdateCount,isFetching:I,isRefetching:I&&!B,isLoadingError:F&&!$,isPaused:w.fetchStatus==="paused",isPlaceholderData:_,isRefetchError:F&&$,isStale:cd(o,i),refetch:this.refetch,promise:N(this,yr),isEnabled:Rt(i.enabled,o)!==!1};if(this.options.experimental_prefetchInRender){const fe=ae.data!==void 0,ke=ae.status==="error"&&!fe,ue=Le=>{ke?Le.reject(ae.error):fe&&Le.resolve(ae.data)},ze=()=>{const Le=ne(this,yr,ae.promise=Ac());ue(Le)},Ce=N(this,yr);switch(Ce.status){case"pending":o.queryHash===c.queryHash&&ue(Ce);break;case"fulfilled":(ke||ae.data!==Ce.value)&&ze();break;case"rejected":(!ke||ae.error!==Ce.reason)&&ze();break}}return ae}updateResult(){const o=N(this,mt),i=this.createResult(N(this,Me),this.options);if(ne(this,Nn,N(this,Me).state),ne(this,ws,this.options),N(this,Nn).data!==void 0&&ne(this,ks,N(this,Me)),Oc(i,o))return;ne(this,mt,i);const c=()=>{if(!o)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!N(this,Ns).size)return!0;const m=new Set(f??N(this,Ns));return this.options.throwOnError&&m.add("error"),Object.keys(N(this,mt)).some(p=>{const v=p;return N(this,mt)[v]!==o[v]&&m.has(v)})};_e(this,Te,bh).call(this,{listeners:c()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Te,Uc).call(this)}},kt=new WeakMap,Me=new WeakMap,Bo=new WeakMap,mt=new WeakMap,Nn=new WeakMap,ws=new WeakMap,yr=new WeakMap,Qr=new WeakMap,Ho=new WeakMap,js=new WeakMap,ks=new WeakMap,Sn=new WeakMap,Cn=new WeakMap,qr=new WeakMap,Ns=new WeakMap,Te=new WeakSet,_o=function(o){_e(this,Te,Hc).call(this);let i=N(this,Me).fetch(this.options,o);return o!=null&&o.throwOnError||(i=i.catch(Nt)),i},Lc=function(){_e(this,Te,$c).call(this);const o=Xr(this.options.staleTime,N(this,Me));if(Oo.isServer()||N(this,mt).isStale||!Rc(o))return;const c=uh(N(this,mt).dataUpdatedAt,o)+1;ne(this,Sn,yn.setTimeout(()=>{N(this,mt).isStale||this.updateResult()},c))},Fc=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,Me)):this.options.refetchInterval)??!1},Ic=function(o){_e(this,Te,Bc).call(this),ne(this,qr,o),!(Oo.isServer()||Rt(this.options.enabled,N(this,Me))===!1||!Rc(N(this,qr))||N(this,qr)===0)&&ne(this,Cn,yn.setInterval(()=>{(this.options.refetchIntervalInBackground||ld.isFocused())&&_e(this,Te,_o).call(this)},N(this,qr)))},Uc=function(){_e(this,Te,Lc).call(this),_e(this,Te,Ic).call(this,_e(this,Te,Fc).call(this))},$c=function(){N(this,Sn)!==void 0&&(yn.clearTimeout(N(this,Sn)),ne(this,Sn,void 0))},Bc=function(){N(this,Cn)!==void 0&&(yn.clearInterval(N(this,Cn)),ne(this,Cn,void 0))},Hc=function(){const o=N(this,kt).getQueryCache().build(N(this,kt),this.options);if(o===N(this,Me))return;const i=N(this,Me);ne(this,Me,o),ne(this,Bo,o.state),this.hasListeners()&&(i==null||i.removeObserver(this),o.addObserver(this))},bh=function(o){lt.batch(()=>{o.listeners&&this.listeners.forEach(i=>{i(N(this,mt))}),N(this,kt).getQueryCache().notify({query:N(this,Me),type:"observerResultsUpdated"})})},nh);function Kg(s,o){return Rt(o.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&Rt(o.retryOnMount,s)===!1)}function jp(s,o){return Kg(s,o)||s.state.data!==void 0&&Vc(s,o,o.refetchOnMount)}function Vc(s,o,i){if(Rt(o.enabled,s)!==!1&&Xr(o.staleTime,s)!=="static"){const c=typeof i=="function"?i(s):i;return c==="always"||c!==!1&&cd(s,o)}return!1}function kp(s,o,i,c){return(s!==o||Rt(c.enabled,s)===!1)&&(!i.suspense||s.state.status!=="error")&&cd(s,i)}function cd(s,o){return Rt(o.enabled,s)!==!1&&s.isStaleByTime(Xr(o.staleTime,s))}function Qg(s,o){return!Oc(s.getCurrentResult(),o)}var Vo,nr,ft,En,sr,Br,sh,qg=(sh=class extends gh{constructor(o){super();ye(this,sr);ye(this,Vo);ye(this,nr);ye(this,ft);ye(this,En);ne(this,Vo,o.client),this.mutationId=o.mutationId,ne(this,ft,o.mutationCache),ne(this,nr,[]),this.state=o.state||Zg(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){N(this,nr).includes(o)||(N(this,nr).push(o),this.clearGcTimeout(),N(this,ft).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){ne(this,nr,N(this,nr).filter(i=>i!==o)),this.scheduleGc(),N(this,ft).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){N(this,nr).length||(this.state.status==="pending"?this.scheduleGc():N(this,ft).remove(this))}continue(){var o;return((o=N(this,En))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var m,p,v,g,j,w,_,M,L,b,S,O,I,B,F,D,$,H;const i=()=>{_e(this,sr,Br).call(this,{type:"continue"})},c={client:N(this,Vo),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,En,xh({fn:()=>this.options.mutationFn?this.options.mutationFn(o,c):Promise.reject(new Error("No mutationFn found")),onFail:(ae,te)=>{_e(this,sr,Br).call(this,{type:"failed",failureCount:ae,error:te})},onPause:()=>{_e(this,sr,Br).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,ft).canRun(this)}));const u=this.state.status==="pending",f=!N(this,En).canStart();try{if(u)i();else{_e(this,sr,Br).call(this,{type:"pending",variables:o,isPaused:f}),N(this,ft).config.onMutate&&await N(this,ft).config.onMutate(o,this,c);const te=await((p=(m=this.options).onMutate)==null?void 0:p.call(m,o,c));te!==this.state.context&&_e(this,sr,Br).call(this,{type:"pending",context:te,variables:o,isPaused:f})}const ae=await N(this,En).start();return await((g=(v=N(this,ft).config).onSuccess)==null?void 0:g.call(v,ae,o,this.state.context,this,c)),await((w=(j=this.options).onSuccess)==null?void 0:w.call(j,ae,o,this.state.context,c)),await((M=(_=N(this,ft).config).onSettled)==null?void 0:M.call(_,ae,null,this.state.variables,this.state.context,this,c)),await((b=(L=this.options).onSettled)==null?void 0:b.call(L,ae,null,o,this.state.context,c)),_e(this,sr,Br).call(this,{type:"success",data:ae}),ae}catch(ae){try{await((O=(S=N(this,ft).config).onError)==null?void 0:O.call(S,ae,o,this.state.context,this,c))}catch(te){Promise.reject(te)}try{await((B=(I=this.options).onError)==null?void 0:B.call(I,ae,o,this.state.context,c))}catch(te){Promise.reject(te)}try{await((D=(F=N(this,ft).config).onSettled)==null?void 0:D.call(F,void 0,ae,this.state.variables,this.state.context,this,c))}catch(te){Promise.reject(te)}try{await((H=($=this.options).onSettled)==null?void 0:H.call($,void 0,ae,o,this.state.context,c))}catch(te){Promise.reject(te)}throw _e(this,sr,Br).call(this,{type:"error",error:ae}),ae}finally{N(this,ft).runNext(this)}}},Vo=new WeakMap,nr=new WeakMap,ft=new WeakMap,En=new WeakMap,sr=new WeakSet,Br=function(o){const i=c=>{switch(o.type){case"failed":return{...c,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...c,isPaused:!0};case"continue":return{...c,isPaused:!1};case"pending":return{...c,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{...c,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...c,data:void 0,error:o.error,failureCount:c.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=i(this.state),lt.batch(()=>{N(this,nr).forEach(c=>{c.onMutationUpdate(o)}),N(this,ft).notify({mutation:this,type:"updated",action:o})})},sh);function Zg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vr,Qt,Wo,oh,Yg=(oh=class extends Go{constructor(o={}){super();ye(this,vr);ye(this,Qt);ye(this,Wo);this.config=o,ne(this,vr,new Set),ne(this,Qt,new Map),ne(this,Wo,0)}build(o,i,c){const u=new qg({client:o,mutationCache:this,mutationId:++ri(this,Wo)._,options:o.defaultMutationOptions(i),state:c});return this.add(u),u}add(o){N(this,vr).add(o);const i=si(o);if(typeof i=="string"){const c=N(this,Qt).get(i);c?c.push(o):N(this,Qt).set(i,[o])}this.notify({type:"added",mutation:o})}remove(o){if(N(this,vr).delete(o)){const i=si(o);if(typeof i=="string"){const c=N(this,Qt).get(i);if(c)if(c.length>1){const u=c.indexOf(o);u!==-1&&c.splice(u,1)}else c[0]===o&&N(this,Qt).delete(i)}}this.notify({type:"removed",mutation:o})}canRun(o){const i=si(o);if(typeof i=="string"){const c=N(this,Qt).get(i),u=c==null?void 0:c.find(f=>f.state.status==="pending");return!u||u===o}else return!0}runNext(o){var c;const i=si(o);if(typeof i=="string"){const u=(c=N(this,Qt).get(i))==null?void 0:c.find(f=>f!==o&&f.state.isPaused);return(u==null?void 0:u.continue())??Promise.resolve()}else return Promise.resolve()}clear(){lt.batch(()=>{N(this,vr).forEach(o=>{this.notify({type:"removed",mutation:o})}),N(this,vr).clear(),N(this,Qt).clear()})}getAll(){return Array.from(N(this,vr))}find(o){const i={exact:!0,...o};return this.getAll().find(c=>xp(i,c))}findAll(o={}){return this.getAll().filter(i=>xp(o,i))}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}resumePausedMutations(){const o=this.getAll().filter(i=>i.state.isPaused);return lt.batch(()=>Promise.all(o.map(i=>i.continue().catch(Nt))))}},vr=new WeakMap,Qt=new WeakMap,Wo=new WeakMap,oh);function si(s){var o;return(o=s.options.scope)==null?void 0:o.id}var or,lh,Jg=(lh=class extends Go{constructor(o={}){super();ye(this,or);this.config=o,ne(this,or,new Map)}build(o,i,c){const u=i.queryKey,f=i.queryHash??id(u,i);let m=this.get(f);return m||(m=new Wg({client:o,queryKey:u,queryHash:f,options:o.defaultQueryOptions(i),state:c,defaultOptions:o.getQueryDefaults(u)}),this.add(m)),m}add(o){N(this,or).has(o.queryHash)||(N(this,or).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const i=N(this,or).get(o.queryHash);i&&(o.destroy(),i===o&&N(this,or).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){lt.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return N(this,or).get(o)}getAll(){return[...N(this,or).values()]}find(o){const i={exact:!0,...o};return this.getAll().find(c=>mp(i,c))}findAll(o={}){const i=this.getAll();return Object.keys(o).length>0?i.filter(c=>mp(o,c)):i}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}onFocus(){lt.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){lt.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},or=new WeakMap,lh),Ke,Zr,Yr,Ss,Cs,Jr,Es,Ps,ih,Xg=(ih=class{constructor(s={}){ye(this,Ke);ye(this,Zr);ye(this,Yr);ye(this,Ss);ye(this,Cs);ye(this,Jr);ye(this,Es);ye(this,Ps);ne(this,Ke,s.queryCache||new Jg),ne(this,Zr,s.mutationCache||new Yg),ne(this,Yr,s.defaultOptions||{}),ne(this,Ss,new Map),ne(this,Cs,new Map),ne(this,Jr,0)}mount(){ri(this,Jr)._++,N(this,Jr)===1&&(ne(this,Es,ld.subscribe(async s=>{s&&(await this.resumePausedMutations(),N(this,Ke).onFocus())})),ne(this,Ps,gi.subscribe(async s=>{s&&(await this.resumePausedMutations(),N(this,Ke).onOnline())})))}unmount(){var s,o;ri(this,Jr)._--,N(this,Jr)===0&&((s=N(this,Es))==null||s.call(this),ne(this,Es,void 0),(o=N(this,Ps))==null||o.call(this),ne(this,Ps,void 0))}isFetching(s){return N(this,Ke).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return N(this,Zr).findAll({...s,status:"pending"}).length}getQueryData(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=N(this,Ke).get(o.queryHash))==null?void 0:i.state.data}ensureQueryData(s){const o=this.defaultQueryOptions(s),i=N(this,Ke).build(this,o),c=i.state.data;return c===void 0?this.fetchQuery(s):(s.revalidateIfStale&&i.isStaleByTime(Xr(o.staleTime,i))&&this.prefetchQuery(o),Promise.resolve(c))}getQueriesData(s){return N(this,Ke).findAll(s).map(({queryKey:o,state:i})=>{const c=i.data;return[o,c]})}setQueryData(s,o,i){const c=this.defaultQueryOptions({queryKey:s}),u=N(this,Ke).get(c.queryHash),f=u==null?void 0:u.state.data,m=Dg(o,f);if(m!==void 0)return N(this,Ke).build(this,c).setData(m,{...i,manual:!0})}setQueriesData(s,o,i){return lt.batch(()=>N(this,Ke).findAll(s).map(({queryKey:c})=>[c,this.setQueryData(c,o,i)]))}getQueryState(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=N(this,Ke).get(o.queryHash))==null?void 0:i.state}removeQueries(s){const o=N(this,Ke);lt.batch(()=>{o.findAll(s).forEach(i=>{o.remove(i)})})}resetQueries(s,o){const i=N(this,Ke);return lt.batch(()=>(i.findAll(s).forEach(c=>{c.reset()}),this.refetchQueries({type:"active",...s},o)))}cancelQueries(s,o={}){const i={revert:!0,...o},c=lt.batch(()=>N(this,Ke).findAll(s).map(u=>u.cancel(i)));return Promise.all(c).then(Nt).catch(Nt)}invalidateQueries(s,o={}){return lt.batch(()=>(N(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},c=lt.batch(()=>N(this,Ke).findAll(s).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,i);return i.throwOnError||(f=f.catch(Nt)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(c).then(Nt)}fetchQuery(s){const o=this.defaultQueryOptions(s);o.retry===void 0&&(o.retry=!1);const i=N(this,Ke).build(this,o);return i.isStaleByTime(Xr(o.staleTime,i))?i.fetch(o):Promise.resolve(i.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(Nt).catch(Nt)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(Nt).catch(Nt)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return gi.isOnline()?N(this,Zr).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,Ke)}getMutationCache(){return N(this,Zr)}getDefaultOptions(){return N(this,Yr)}setDefaultOptions(s){ne(this,Yr,s)}setQueryDefaults(s,o){N(this,Ss).set(Mo(s),{queryKey:s,defaultOptions:o})}getQueryDefaults(s){const o=[...N(this,Ss).values()],i={};return o.forEach(c=>{Ro(s,c.queryKey)&&Object.assign(i,c.defaultOptions)}),i}setMutationDefaults(s,o){N(this,Cs).set(Mo(s),{mutationKey:s,defaultOptions:o})}getMutationDefaults(s){const o=[...N(this,Cs).values()],i={};return o.forEach(c=>{Ro(s,c.mutationKey)&&Object.assign(i,c.defaultOptions)}),i}defaultQueryOptions(s){if(s._defaulted)return s;const o={...N(this,Yr).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return o.queryHash||(o.queryHash=id(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===ad&&(o.enabled=!1),o}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...N(this,Yr).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){N(this,Ke).clear(),N(this,Zr).clear()}},Ke=new WeakMap,Zr=new WeakMap,Yr=new WeakMap,Ss=new WeakMap,Cs=new WeakMap,Jr=new WeakMap,Es=new WeakMap,Ps=new WeakMap,ih),wh=x.createContext(void 0),rn=s=>{const o=x.useContext(wh);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},e0=({client:s,children:o})=>(x.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),r.jsx(wh.Provider,{value:s,children:o})),jh=x.createContext(!1),t0=()=>x.useContext(jh);jh.Provider;function r0(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var n0=x.createContext(r0()),s0=()=>x.useContext(n0),o0=(s,o,i)=>{const c=i!=null&&i.state.error&&typeof s.throwOnError=="function"?hh(s.throwOnError,[i.state.error,i]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||c)&&(o.isReset()||(s.retryOnMount=!1))},l0=s=>{x.useEffect(()=>{s.clearReset()},[s])},i0=({result:s,errorResetBoundary:o,throwOnError:i,query:c,suspense:u})=>s.isError&&!o.isReset()&&!s.isFetching&&c&&(u&&s.data===void 0||hh(i,[s.error,c])),a0=s=>{if(s.suspense){const i=u=>u==="static"?u:Math.max(u??1e3,1e3),c=s.staleTime;s.staleTime=typeof c=="function"?(...u)=>i(c(...u)):i(c),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},c0=(s,o)=>s.isLoading&&s.isFetching&&!o,d0=(s,o)=>(s==null?void 0:s.suspense)&&o.isPending,Np=(s,o,i)=>o.fetchOptimistic(s).catch(()=>{i.clearReset()});function u0(s,o,i){var M,L,b,S;const c=t0(),u=s0(),f=rn(),m=f.defaultQueryOptions(s);(L=(M=f.getDefaultOptions().queries)==null?void 0:M._experimental_beforeQuery)==null||L.call(M,m);const p=f.getQueryCache().get(m.queryHash),v=s.subscribed!==!1;m._optimisticResults=c?"isRestoring":v?"optimistic":void 0,a0(m),o0(m,u,p),l0(u);const g=!f.getQueryCache().get(m.queryHash),[j]=x.useState(()=>new o(f,m)),w=j.getOptimisticResult(m),_=!c&&v;if(x.useSyncExternalStore(x.useCallback(O=>{const I=_?j.subscribe(lt.batchCalls(O)):Nt;return j.updateResult(),I},[j,_]),()=>j.getCurrentResult(),()=>j.getCurrentResult()),x.useEffect(()=>{j.setOptions(m)},[m,j]),d0(m,w))throw Np(m,j,u);if(i0({result:w,errorResetBoundary:u,throwOnError:m.throwOnError,query:p,suspense:m.suspense}))throw w.error;if((S=(b=f.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||S.call(b,m,w),m.experimental_prefetchInRender&&!Oo.isServer()&&c0(w,c)){const O=g?Np(m,j,u):p==null?void 0:p.promise;O==null||O.catch(Nt).finally(()=>{j.updateResult()})}return m.notifyOnChangeProps?w:j.trackResult(w)}function Ut(s,o){return u0(s,Gg)}/** +`+d.stack}return{value:e,source:t,stack:a,digest:null}}function La(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Fa(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Gx=typeof WeakMap=="function"?WeakMap:Map;function hf(e,t,n){n=pr(-1,n),n.tag=3,n.payload={element:null};var l=t.value;return n.callback=function(){Bl||(Bl=!0,Xa=l),Fa(e,t)},n}function mf(e,t,n){n=pr(-1,n),n.tag=3;var l=e.type.getDerivedStateFromError;if(typeof l=="function"){var a=t.value;n.payload=function(){return l(a)},n.callback=function(){Fa(e,t)}}var d=e.stateNode;return d!==null&&typeof d.componentDidCatch=="function"&&(n.callback=function(){Fa(e,t),typeof l!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var h=t.stack;this.componentDidCatch(t.value,{componentStack:h!==null?h:""})}),n}function xf(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new Gx;var a=new Set;l.set(t,a)}else a=l.get(t),a===void 0&&(a=new Set,l.set(t,a));a.has(n)||(a.add(n),e=lg.bind(null,e,t,n),t.then(e,e))}function gf(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function yf(e,t,n,l,a){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=pr(-1,1),t.tag=2,Or(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=a,e)}var Kx=F.ReactCurrentOwner,vt=!1;function pt(e,t,n,l){t.child=e===null?Lu(t,null,n,l):Xn(t,e.child,n,l)}function vf(e,t,n,l,a){n=n.render;var d=t.ref;return ts(t,a),l=_a(e,t,n,l,d,a),n=Ma(),e!==null&&!vt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,hr(e,t,a)):(Be&&n&&fa(t),t.flags|=1,pt(e,t,l,a),t.child)}function bf(e,t,n,l,a){if(e===null){var d=n.type;return typeof d=="function"&&!lc(d)&&d.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=d,wf(e,t,d,l,a)):(e=Ql(n.type,null,l,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,(e.lanes&a)===0){var h=d.memoizedProps;if(n=n.compare,n=n!==null?n:no,n(h,l)&&e.ref===t.ref)return hr(e,t,a)}return t.flags|=1,e=Fr(d,l),e.ref=t.ref,e.return=t,t.child=e}function wf(e,t,n,l,a){if(e!==null){var d=e.memoizedProps;if(no(d,l)&&e.ref===t.ref)if(vt=!1,t.pendingProps=l=d,(e.lanes&a)!==0)(e.flags&131072)!==0&&(vt=!0);else return t.lanes=e.lanes,hr(e,t,a)}return Ia(e,t,n,l,a)}function jf(e,t,n){var l=t.pendingProps,a=l.children,d=e!==null?e.memoizedState:null;if(l.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Fe(os,_t),_t|=n;else{if((n&1073741824)===0)return e=d!==null?d.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Fe(os,_t),_t|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=d!==null?d.baseLanes:n,Fe(os,_t),_t|=l}else d!==null?(l=d.baseLanes|n,t.memoizedState=null):l=n,Fe(os,_t),_t|=l;return pt(e,t,a,n),t.child}function kf(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ia(e,t,n,l,a){var d=yt(n)?on:at.current;return d=qn(t,d),ts(t,a),n=_a(e,t,n,l,d,a),l=Ma(),e!==null&&!vt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,hr(e,t,a)):(Be&&l&&fa(t),t.flags|=1,pt(e,t,n,a),t.child)}function Nf(e,t,n,l,a){if(yt(n)){var d=!0;vl(t)}else d=!1;if(ts(t,a),t.stateNode===null)Ll(e,t),ff(t,n,l),za(t,n,l,a),l=!0;else if(e===null){var h=t.stateNode,y=t.memoizedProps;h.props=y;var k=h.context,A=n.contextType;typeof A=="object"&&A!==null?A=At(A):(A=yt(n)?on:at.current,A=qn(t,A));var W=n.getDerivedStateFromProps,G=typeof W=="function"||typeof h.getSnapshotBeforeUpdate=="function";G||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==l||k!==A)&&pf(t,h,l,A),Rr=!1;var V=t.memoizedState;h.state=V,Pl(t,l,h,a),k=t.memoizedState,y!==l||V!==k||gt.current||Rr?(typeof W=="function"&&(Aa(t,n,W,l),k=t.memoizedState),(y=Rr||uf(t,n,y,l,V,k,A))?(G||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=k),h.props=l,h.state=k,h.context=A,l=y):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{h=t.stateNode,Iu(e,t),y=t.memoizedProps,A=t.type===t.elementType?y:Vt(t.type,y),h.props=A,G=t.pendingProps,V=h.context,k=n.contextType,typeof k=="object"&&k!==null?k=At(k):(k=yt(n)?on:at.current,k=qn(t,k));var re=n.getDerivedStateFromProps;(W=typeof re=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==G||V!==k)&&pf(t,h,l,k),Rr=!1,V=t.memoizedState,h.state=V,Pl(t,l,h,a);var ie=t.memoizedState;y!==G||V!==ie||gt.current||Rr?(typeof re=="function"&&(Aa(t,n,re,l),ie=t.memoizedState),(A=Rr||uf(t,n,A,l,V,ie,k)||!1)?(W||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,ie,k),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,ie,k)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||y===e.memoizedProps&&V===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&V===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=ie),h.props=l,h.state=ie,h.context=k,l=A):(typeof h.componentDidUpdate!="function"||y===e.memoizedProps&&V===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&V===e.memoizedState||(t.flags|=1024),l=!1)}return Ua(e,t,n,l,d,a)}function Ua(e,t,n,l,a,d){kf(e,t);var h=(t.flags&128)!==0;if(!l&&!h)return a&&Pu(t,n,!1),hr(e,t,d);l=t.stateNode,Kx.current=t;var y=h&&typeof n.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&h?(t.child=Xn(t,e.child,null,d),t.child=Xn(t,null,y,d)):pt(e,t,y,d),t.memoizedState=l.state,a&&Pu(t,n,!0),t.child}function Sf(e){var t=e.stateNode;t.pendingContext?Cu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Cu(e,t.context,!1),ka(e,t.containerInfo)}function Cf(e,t,n,l,a){return Jn(),xa(a),t.flags|=256,pt(e,t,n,l),t.child}var $a={dehydrated:null,treeContext:null,retryLane:0};function Ba(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ef(e,t,n){var l=t.pendingProps,a=Ve.current,d=!1,h=(t.flags&128)!==0,y;if((y=h)||(y=e!==null&&e.memoizedState===null?!1:(a&2)!==0),y?(d=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),Fe(Ve,a&1),e===null)return ma(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(h=l.children,e=l.fallback,d?(l=t.mode,d=t.child,h={mode:"hidden",children:h},(l&1)===0&&d!==null?(d.childLanes=0,d.pendingProps=h):d=ql(h,l,0,null),e=xn(e,l,n,null),d.return=t,e.return=t,d.sibling=e,t.child=d,t.child.memoizedState=Ba(n),t.memoizedState=$a,e):Ha(t,h));if(a=e.memoizedState,a!==null&&(y=a.dehydrated,y!==null))return Qx(e,t,h,l,y,a,n);if(d){d=l.fallback,h=t.mode,a=e.child,y=a.sibling;var k={mode:"hidden",children:l.children};return(h&1)===0&&t.child!==a?(l=t.child,l.childLanes=0,l.pendingProps=k,t.deletions=null):(l=Fr(a,k),l.subtreeFlags=a.subtreeFlags&14680064),y!==null?d=Fr(y,d):(d=xn(d,h,n,null),d.flags|=2),d.return=t,l.return=t,l.sibling=d,t.child=l,l=d,d=t.child,h=e.child.memoizedState,h=h===null?Ba(n):{baseLanes:h.baseLanes|n,cachePool:null,transitions:h.transitions},d.memoizedState=h,d.childLanes=e.childLanes&~n,t.memoizedState=$a,l}return d=e.child,e=d.sibling,l=Fr(d,{mode:"visible",children:l.children}),(t.mode&1)===0&&(l.lanes=n),l.return=t,l.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=l,t.memoizedState=null,l}function Ha(e,t){return t=ql({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function zl(e,t,n,l){return l!==null&&xa(l),Xn(t,e.child,null,n),e=Ha(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qx(e,t,n,l,a,d,h){if(n)return t.flags&256?(t.flags&=-257,l=La(Error(i(422))),zl(e,t,h,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(d=l.fallback,a=t.mode,l=ql({mode:"visible",children:l.children},a,0,null),d=xn(d,a,h,null),d.flags|=2,l.return=t,d.return=t,l.sibling=d,t.child=l,(t.mode&1)!==0&&Xn(t,e.child,null,h),t.child.memoizedState=Ba(h),t.memoizedState=$a,d);if((t.mode&1)===0)return zl(e,t,h,null);if(a.data==="$!"){if(l=a.nextSibling&&a.nextSibling.dataset,l)var y=l.dgst;return l=y,d=Error(i(419)),l=La(d,l,void 0),zl(e,t,h,l)}if(y=(h&e.childLanes)!==0,vt||y){if(l=tt,l!==null){switch(h&-h){case 4:a=2;break;case 16:a=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(l.suspendedLanes|h))!==0?0:a,a!==0&&a!==d.retryLane&&(d.retryLane=a,fr(e,a),Kt(l,e,a,-1))}return oc(),l=La(Error(i(421))),zl(e,t,h,l)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=ig.bind(null,e),a._reactRetry=t,null):(e=d.treeContext,Pt=Er(a.nextSibling),Et=t,Be=!0,Ht=null,e!==null&&(Dt[Tt++]=dr,Dt[Tt++]=ur,Dt[Tt++]=ln,dr=e.id,ur=e.overflow,ln=t),t=Ha(t,l.children),t.flags|=4096,t)}function Pf(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ba(e.return,t,n)}function Va(e,t,n,l,a){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:a}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=l,d.tail=n,d.tailMode=a)}function _f(e,t,n){var l=t.pendingProps,a=l.revealOrder,d=l.tail;if(pt(e,t,l.children,n),l=Ve.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Pf(e,n,t);else if(e.tag===19)Pf(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}if(Fe(Ve,l),(t.mode&1)===0)t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&_l(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Va(t,!1,a,n,d);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&_l(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Va(t,!0,n,null,d);break;case"together":Va(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ll(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function hr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),fn|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Fr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Fr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function qx(e,t,n){switch(t.tag){case 3:Sf(t),Jn();break;case 5:Bu(t);break;case 1:yt(t.type)&&vl(t);break;case 4:ka(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,a=t.memoizedProps.value;Fe(Sl,l._currentValue),l._currentValue=a;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?(Fe(Ve,Ve.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?Ef(e,t,n):(Fe(Ve,Ve.current&1),e=hr(e,t,n),e!==null?e.sibling:null);Fe(Ve,Ve.current&1);break;case 19:if(l=(n&t.childLanes)!==0,(e.flags&128)!==0){if(l)return _f(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Fe(Ve,Ve.current),l)break;return null;case 22:case 23:return t.lanes=0,jf(e,t,n)}return hr(e,t,n)}var Mf,Wa,Rf,Of;Mf=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Wa=function(){},Rf=function(e,t,n,l){var a=e.memoizedProps;if(a!==l){e=t.stateNode,dn(Xt.current);var d=null;switch(n){case"input":a=Tn(e,a),l=Tn(e,l),d=[];break;case"select":a=Y({},a,{value:void 0}),l=Y({},l,{value:void 0}),d=[];break;case"textarea":a=De(e,a),l=De(e,l),d=[];break;default:typeof a.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=xl)}Si(n,l);var h;n=null;for(A in a)if(!l.hasOwnProperty(A)&&a.hasOwnProperty(A)&&a[A]!=null)if(A==="style"){var y=a[A];for(h in y)y.hasOwnProperty(h)&&(n||(n={}),n[h]="")}else A!=="dangerouslySetInnerHTML"&&A!=="children"&&A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(u.hasOwnProperty(A)?d||(d=[]):(d=d||[]).push(A,null));for(A in l){var k=l[A];if(y=a!=null?a[A]:void 0,l.hasOwnProperty(A)&&k!==y&&(k!=null||y!=null))if(A==="style")if(y){for(h in y)!y.hasOwnProperty(h)||k&&k.hasOwnProperty(h)||(n||(n={}),n[h]="");for(h in k)k.hasOwnProperty(h)&&y[h]!==k[h]&&(n||(n={}),n[h]=k[h])}else n||(d||(d=[]),d.push(A,n)),n=k;else A==="dangerouslySetInnerHTML"?(k=k?k.__html:void 0,y=y?y.__html:void 0,k!=null&&y!==k&&(d=d||[]).push(A,k)):A==="children"?typeof k!="string"&&typeof k!="number"||(d=d||[]).push(A,""+k):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&(u.hasOwnProperty(A)?(k!=null&&A==="onScroll"&&Ie("scroll",e),d||y===k||(d=[])):(d=d||[]).push(A,k))}n&&(d=d||[]).push("style",n);var A=d;(t.updateQueue=A)&&(t.flags|=4)}},Of=function(e,t,n,l){n!==l&&(t.flags|=4)};function vo(e,t){if(!Be)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags&14680064,l|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags,l|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function Zx(e,t,n){var l=t.pendingProps;switch(pa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(t),null;case 1:return yt(t.type)&&yl(),dt(t),null;case 3:return l=t.stateNode,rs(),Ue(gt),Ue(at),Ca(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(kl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ht!==null&&(rc(Ht),Ht=null))),Wa(e,t),dt(t),null;case 5:Na(t);var a=dn(ho.current);if(n=t.type,e!==null&&t.stateNode!=null)Rf(e,t,n,l,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!l){if(t.stateNode===null)throw Error(i(166));return dt(t),null}if(e=dn(Xt.current),kl(t)){l=t.stateNode,n=t.type;var d=t.memoizedProps;switch(l[Jt]=t,l[ao]=d,e=(t.mode&1)!==0,n){case"dialog":Ie("cancel",l),Ie("close",l);break;case"iframe":case"object":case"embed":Ie("load",l);break;case"video":case"audio":for(a=0;a<\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=h.createElement(n,{is:l.is}):(e=h.createElement(n),n==="select"&&(h=e,l.multiple?h.multiple=!0:l.size&&(h.size=l.size))):e=h.createElementNS(e,n),e[Jt]=t,e[ao]=l,Mf(e,t,!1,!1),t.stateNode=e;e:{switch(h=Ci(n,l),n){case"dialog":Ie("cancel",e),Ie("close",e),a=l;break;case"iframe":case"object":case"embed":Ie("load",e),a=l;break;case"video":case"audio":for(a=0;als&&(t.flags|=128,l=!0,vo(d,!1),t.lanes=4194304)}else{if(!l)if(e=_l(h),e!==null){if(t.flags|=128,l=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),vo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!h.alternate&&!Be)return dt(t),null}else 2*Qe()-d.renderingStartTime>ls&&n!==1073741824&&(t.flags|=128,l=!0,vo(d,!1),t.lanes=4194304);d.isBackwards?(h.sibling=t.child,t.child=h):(n=d.last,n!==null?n.sibling=h:t.child=h,d.last=h)}return d.tail!==null?(t=d.tail,d.rendering=t,d.tail=t.sibling,d.renderingStartTime=Qe(),t.sibling=null,n=Ve.current,Fe(Ve,l?n&1|2:n&1),t):(dt(t),null);case 22:case 23:return sc(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(_t&1073741824)!==0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Yx(e,t){switch(pa(t),t.tag){case 1:return yt(t.type)&&yl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rs(),Ue(gt),Ue(at),Ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Na(t),null;case 13:if(Ue(Ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Jn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Ve),null;case 4:return rs(),null;case 10:return va(t.type._context),null;case 22:case 23:return sc(),null;case 24:return null;default:return null}}var Fl=!1,ut=!1,Jx=typeof WeakSet=="function"?WeakSet:Set,oe=null;function ss(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(l){Ge(e,t,l)}else n.current=null}function Ga(e,t,n){try{n()}catch(l){Ge(e,t,l)}}var Df=!1;function Xx(e,t){if(sa=sl,e=du(),Zi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var a=l.anchorOffset,d=l.focusNode;l=l.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var h=0,y=-1,k=-1,A=0,W=0,G=e,V=null;t:for(;;){for(var re;G!==n||a!==0&&G.nodeType!==3||(y=h+a),G!==d||l!==0&&G.nodeType!==3||(k=h+l),G.nodeType===3&&(h+=G.nodeValue.length),(re=G.firstChild)!==null;)V=G,G=re;for(;;){if(G===e)break t;if(V===n&&++A===a&&(y=h),V===d&&++W===l&&(k=h),(re=G.nextSibling)!==null)break;G=V,V=G.parentNode}G=re}n=y===-1||k===-1?null:{start:y,end:k}}else n=null}n=n||{start:0,end:0}}else n=null;for(oa={focusedElem:e,selectionRange:n},sl=!1,oe=t;oe!==null;)if(t=oe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oe=e;else for(;oe!==null;){t=oe;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var ce=ie.memoizedProps,qe=ie.memoizedState,R=t.stateNode,E=R.getSnapshotBeforeUpdate(t.elementType===t.type?ce:Vt(t.type,ce),qe);R.__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,oe=e;break}oe=t.return}return ie=Df,Df=!1,ie}function bo(e,t,n){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 d=a.destroy;a.destroy=void 0,d!==void 0&&Ga(t,n,d)}a=a.next}while(a!==l)}}function Il(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var l=n.create;n.destroy=l()}n=n.next}while(n!==t)}}function Ka(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Tf(e){var t=e.alternate;t!==null&&(e.alternate=null,Tf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Jt],delete t[ao],delete t[ca],delete t[Ax],delete t[zx])),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 Af(e){return e.tag===5||e.tag===3||e.tag===4}function zf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Af(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 Qa(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=xl));else if(l!==4&&(e=e.child,e!==null))for(Qa(e,t,n),e=e.sibling;e!==null;)Qa(e,t,n),e=e.sibling}function qa(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(qa(e,t,n),e=e.sibling;e!==null;)qa(e,t,n),e=e.sibling}var st=null,Wt=!1;function Dr(e,t,n){for(n=n.child;n!==null;)Lf(e,t,n),n=n.sibling}function Lf(e,t,n){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(Jo,n)}catch{}switch(n.tag){case 5:ut||ss(n,t);case 6:var l=st,a=Wt;st=null,Dr(e,t,n),st=l,Wt=a,st!==null&&(Wt?(e=st,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):st.removeChild(n.stateNode));break;case 18:st!==null&&(Wt?(e=st,n=n.stateNode,e.nodeType===8?aa(e.parentNode,n):e.nodeType===1&&aa(e,n),Ys(e)):aa(st,n.stateNode));break;case 4:l=st,a=Wt,st=n.stateNode.containerInfo,Wt=!0,Dr(e,t,n),st=l,Wt=a;break;case 0:case 11:case 14:case 15:if(!ut&&(l=n.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){a=l=l.next;do{var d=a,h=d.destroy;d=d.tag,h!==void 0&&((d&2)!==0||(d&4)!==0)&&Ga(n,t,h),a=a.next}while(a!==l)}Dr(e,t,n);break;case 1:if(!ut&&(ss(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=n.memoizedProps,l.state=n.memoizedState,l.componentWillUnmount()}catch(y){Ge(n,t,y)}Dr(e,t,n);break;case 21:Dr(e,t,n);break;case 22:n.mode&1?(ut=(l=ut)||n.memoizedState!==null,Dr(e,t,n),ut=l):Dr(e,t,n);break;default:Dr(e,t,n)}}function Ff(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Jx),t.forEach(function(l){var a=ag.bind(null,e,l);n.has(l)||(n.add(l),l.then(a,a))})}}function Gt(e,t){var n=t.deletions;if(n!==null)for(var l=0;la&&(a=h),l&=~d}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*tg(l/1960))-l,10e?16:e,Ar===null)var l=!1;else{if(e=Ar,Ar=null,Vl=0,(Re&6)!==0)throw Error(i(331));var a=Re;for(Re|=4,oe=e.current;oe!==null;){var d=oe,h=d.child;if((oe.flags&16)!==0){var y=d.deletions;if(y!==null){for(var k=0;kQe()-Ja?hn(e,0):Ya|=n),wt(e,t)}function Yf(e,t){t===0&&((e.mode&1)===0?t=1:(t=el,el<<=1,(el&130023424)===0&&(el=4194304)));var n=ht();e=fr(e,t),e!==null&&(Gs(e,t,n),wt(e,n))}function ig(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yf(e,n)}function ag(e,t){var n=0;switch(e.tag){case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(i(314))}l!==null&&l.delete(t),Yf(e,n)}var Jf;Jf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||gt.current)vt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return vt=!1,qx(e,t,n);vt=(e.flags&131072)!==0}else vt=!1,Be&&(t.flags&1048576)!==0&&Mu(t,jl,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Ll(e,t),e=t.pendingProps;var a=qn(t,at.current);ts(t,n),a=_a(null,t,l,e,a,n);var d=Ma();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,yt(l)?(d=!0,vl(t)):d=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ja(t),a.updater=Al,t.stateNode=a,a._reactInternals=t,za(t,l,e,n),t=Ua(null,t,l,!0,d,n)):(t.tag=0,Be&&d&&fa(t),pt(null,t,a,n),t=t.child),t;case 16:l=t.elementType;e:{switch(Ll(e,t),e=t.pendingProps,a=l._init,l=a(l._payload),t.type=l,a=t.tag=dg(l),e=Vt(l,e),a){case 0:t=Ia(null,t,l,e,n);break e;case 1:t=Nf(null,t,l,e,n);break e;case 11:t=vf(null,t,l,e,n);break e;case 14:t=bf(null,t,l,Vt(l.type,e),n);break e}throw Error(i(306,l,""))}return t;case 0:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),Ia(e,t,l,a,n);case 1:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),Nf(e,t,l,a,n);case 3:e:{if(Sf(t),e===null)throw Error(i(387));l=t.pendingProps,d=t.memoizedState,a=d.element,Iu(e,t),Pl(t,l,null,n);var h=t.memoizedState;if(l=h.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){a=ns(Error(i(423)),t),t=Cf(e,t,l,n,a);break e}else if(l!==a){a=ns(Error(i(424)),t),t=Cf(e,t,l,n,a);break e}else for(Pt=Er(t.stateNode.containerInfo.firstChild),Et=t,Be=!0,Ht=null,n=Lu(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Jn(),l===a){t=hr(e,t,n);break e}pt(e,t,l,n)}t=t.child}return t;case 5:return Bu(t),e===null&&ma(t),l=t.type,a=t.pendingProps,d=e!==null?e.memoizedProps:null,h=a.children,la(l,a)?h=null:d!==null&&la(l,d)&&(t.flags|=32),kf(e,t),pt(e,t,h,n),t.child;case 6:return e===null&&ma(t),null;case 13:return Ef(e,t,n);case 4:return ka(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Xn(t,null,l,n):pt(e,t,l,n),t.child;case 11:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),vf(e,t,l,a,n);case 7:return pt(e,t,t.pendingProps,n),t.child;case 8:return pt(e,t,t.pendingProps.children,n),t.child;case 12:return pt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(l=t.type._context,a=t.pendingProps,d=t.memoizedProps,h=a.value,Fe(Sl,l._currentValue),l._currentValue=h,d!==null)if(Bt(d.value,h)){if(d.children===a.children&&!gt.current){t=hr(e,t,n);break e}}else for(d=t.child,d!==null&&(d.return=t);d!==null;){var y=d.dependencies;if(y!==null){h=d.child;for(var k=y.firstContext;k!==null;){if(k.context===l){if(d.tag===1){k=pr(-1,n&-n),k.tag=2;var A=d.updateQueue;if(A!==null){A=A.shared;var W=A.pending;W===null?k.next=k:(k.next=W.next,W.next=k),A.pending=k}}d.lanes|=n,k=d.alternate,k!==null&&(k.lanes|=n),ba(d.return,n,t),y.lanes|=n;break}k=k.next}}else if(d.tag===10)h=d.type===t.type?null:d.child;else if(d.tag===18){if(h=d.return,h===null)throw Error(i(341));h.lanes|=n,y=h.alternate,y!==null&&(y.lanes|=n),ba(h,n,t),h=d.sibling}else h=d.child;if(h!==null)h.return=d;else for(h=d;h!==null;){if(h===t){h=null;break}if(d=h.sibling,d!==null){d.return=h.return,h=d;break}h=h.return}d=h}pt(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,l=t.pendingProps.children,ts(t,n),a=At(a),l=l(a),t.flags|=1,pt(e,t,l,n),t.child;case 14:return l=t.type,a=Vt(l,t.pendingProps),a=Vt(l.type,a),bf(e,t,l,a,n);case 15:return wf(e,t,t.type,t.pendingProps,n);case 17:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Vt(l,a),Ll(e,t),t.tag=1,yt(l)?(e=!0,vl(t)):e=!1,ts(t,n),ff(t,l,a),za(t,l,a,n),Ua(null,t,l,!0,e,n);case 19:return _f(e,t,n);case 22:return jf(e,t,n)}throw Error(i(156,t.tag))};function Xf(e,t){return Rd(e,t)}function cg(e,t,n,l){this.tag=e,this.key=n,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 Ft(e,t,n,l){return new cg(e,t,n,l)}function lc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dg(e){if(typeof e=="function")return lc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===Le)return 14}return 2}function Fr(e,t){var n=e.alternate;return n===null?(n=Ft(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ql(e,t,n,l,a,d){var h=2;if(l=e,typeof e=="function")lc(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case H:return xn(n.children,a,d,t);case ae:h=8,a|=8;break;case te:return e=Ft(12,n,t,a|2),e.elementType=te,e.lanes=d,e;case ze:return e=Ft(13,n,t,a),e.elementType=ze,e.lanes=d,e;case Ce:return e=Ft(19,n,t,a),e.elementType=Ce,e.lanes=d,e;case Pe:return ql(n,a,d,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fe:h=10;break e;case ke:h=9;break e;case ue:h=11;break e;case Le:h=14;break e;case Ee:h=16,l=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=Ft(h,n,t,a),t.elementType=e,t.type=l,t.lanes=d,t}function xn(e,t,n,l){return e=Ft(7,e,l,t),e.lanes=n,e}function ql(e,t,n,l){return e=Ft(22,e,l,t),e.elementType=Pe,e.lanes=n,e.stateNode={isHidden:!1},e}function ic(e,t,n){return e=Ft(6,e,null,t),e.lanes=n,e}function ac(e,t,n){return t=Ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ug(e,t,n,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=Ai(0),this.expirationTimes=Ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ai(0),this.identifierPrefix=l,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function cc(e,t,n,l,a,d,h,y,k){return e=new ug(e,t,n,y,k),t===1?(t=1,d===!0&&(t|=8)):t=0,d=Ft(3,null,null,t),e.current=d,d.stateNode=e,d.memoizedState={element:l,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ja(d),e}function fg(e,t,n){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(),xc.exports=Ng(),xc.exports}var hp;function Sg(){if(hp)return ni;hp=1;var s=dh();return ni.createRoot=s.createRoot,ni.hydrateRoot=s.hydrateRoot,ni}var Cg=Sg();const Eg=ah(Cg);var Go=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(){}},vn,Wr,xs,Jp,Pg=(Jp=class extends Go{constructor(){super();ye(this,vn);ye(this,Wr);ye(this,xs);ne(this,xs,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){N(this,Wr)||this.setEventListener(N(this,xs))}onUnsubscribe(){var o;this.hasListeners()||((o=N(this,Wr))==null||o.call(this),ne(this,Wr,void 0))}setEventListener(o){var i;ne(this,xs,o),(i=N(this,Wr))==null||i.call(this),ne(this,Wr,o(c=>{typeof c=="boolean"?this.setFocused(c):this.onFocus()}))}setFocused(o){N(this,vn)!==o&&(ne(this,vn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(i=>{i(o)})}isFocused(){var o;return typeof N(this,vn)=="boolean"?N(this,vn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},vn=new WeakMap,Wr=new WeakMap,xs=new WeakMap,Jp),ld=new Pg,_g={setTimeout:(s,o)=>setTimeout(s,o),clearTimeout:s=>clearTimeout(s),setInterval:(s,o)=>setInterval(s,o),clearInterval:s=>clearInterval(s)},Gr,nd,Xp,Mg=(Xp=class{constructor(){ye(this,Gr,_g);ye(this,nd,!1)}setTimeoutProvider(s){ne(this,Gr,s)}setTimeout(s,o){return N(this,Gr).setTimeout(s,o)}clearTimeout(s){N(this,Gr).clearTimeout(s)}setInterval(s,o){return N(this,Gr).setInterval(s,o)}clearInterval(s){N(this,Gr).clearInterval(s)}},Gr=new WeakMap,nd=new WeakMap,Xp),yn=new Mg;function Rg(s){setTimeout(s,0)}var Og=typeof window>"u"||"Deno"in globalThis;function Nt(){}function Dg(s,o){return typeof s=="function"?s(o):s}function Rc(s){return typeof s=="number"&&s>=0&&s!==1/0}function uh(s,o){return Math.max(s+(o||0)-Date.now(),0)}function Xr(s,o){return typeof s=="function"?s(o):s}function Rt(s,o){return typeof s=="function"?s(o):s}function mp(s,o){const{type:i="all",exact:c,fetchStatus:u,predicate:f,queryKey:m,stale:p}=s;if(m){if(c){if(o.queryHash!==id(m,o.options))return!1}else if(!Ro(o.queryKey,m))return!1}if(i!=="all"){const v=o.isActive();if(i==="active"&&!v||i==="inactive"&&v)return!1}return!(typeof p=="boolean"&&o.isStale()!==p||u&&u!==o.state.fetchStatus||f&&!f(o))}function xp(s,o){const{exact:i,status:c,predicate:u,mutationKey:f}=s;if(f){if(!o.options.mutationKey)return!1;if(i){if(Mo(o.options.mutationKey)!==Mo(f))return!1}else if(!Ro(o.options.mutationKey,f))return!1}return!(c&&o.state.status!==c||u&&!u(o))}function id(s,o){return((o==null?void 0:o.queryKeyHashFn)||Mo)(s)}function Mo(s){return JSON.stringify(s,(o,i)=>Dc(i)?Object.keys(i).sort().reduce((c,u)=>(c[u]=i[u],c),{}):i)}function Ro(s,o){return s===o?!0:typeof s!=typeof o?!1:s&&o&&typeof s=="object"&&typeof o=="object"?Object.keys(o).every(i=>Ro(s[i],o[i])):!1}var Tg=Object.prototype.hasOwnProperty;function fh(s,o,i=0){if(s===o)return s;if(i>500)return o;const c=gp(s)&&gp(o);if(!c&&!(Dc(s)&&Dc(o)))return o;const f=(c?s:Object.keys(s)).length,m=c?o:Object.keys(o),p=m.length,v=c?new Array(p):{};let g=0;for(let j=0;j{yn.setTimeout(o,s)})}function Tc(s,o,i){return typeof i.structuralSharing=="function"?i.structuralSharing(s,o):i.structuralSharing!==!1?fh(s,o):o}function zg(s,o,i=0){const c=[...s,o];return i&&c.length>i?c.slice(1):c}function Lg(s,o,i=0){const c=[o,...s];return i&&c.length>i?c.slice(0,-1):c}var ad=Symbol();function ph(s,o){return!s.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!s.queryFn||s.queryFn===ad?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function hh(s,o){return typeof s=="function"?s(...o):!!s}function Fg(s,o,i){let c=!1,u;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(u??(u=o()),c||(c=!0,u.aborted?i():u.addEventListener("abort",i,{once:!0})),u)}),s}var Oo=(()=>{let s=()=>Og;return{isServer(){return s()},setIsServer(o){s=o}}})();function Ac(){let s,o;const i=new Promise((u,f)=>{s=u,o=f});i.status="pending",i.catch(()=>{});function c(u){Object.assign(i,u),delete i.resolve,delete i.reject}return i.resolve=u=>{c({status:"fulfilled",value:u}),s(u)},i.reject=u=>{c({status:"rejected",reason:u}),o(u)},i}var Ig=Rg;function Ug(){let s=[],o=0,i=p=>{p()},c=p=>{p()},u=Ig;const f=p=>{o?s.push(p):u(()=>{i(p)})},m=()=>{const p=s;s=[],p.length&&u(()=>{c(()=>{p.forEach(v=>{i(v)})})})};return{batch:p=>{let v;o++;try{v=p()}finally{o--,o||m()}return v},batchCalls:p=>(...v)=>{f(()=>{p(...v)})},schedule:f,setNotifyFunction:p=>{i=p},setBatchNotifyFunction:p=>{c=p},setScheduler:p=>{u=p}}}var lt=Ug(),gs,Kr,ys,eh,$g=(eh=class extends Go{constructor(){super();ye(this,gs,!0);ye(this,Kr);ye(this,ys);ne(this,ys,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o(!0),c=()=>o(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",c,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",c)}}})}onSubscribe(){N(this,Kr)||this.setEventListener(N(this,ys))}onUnsubscribe(){var o;this.hasListeners()||((o=N(this,Kr))==null||o.call(this),ne(this,Kr,void 0))}setEventListener(o){var i;ne(this,ys,o),(i=N(this,Kr))==null||i.call(this),ne(this,Kr,o(this.setOnline.bind(this)))}setOnline(o){N(this,gs)!==o&&(ne(this,gs,o),this.listeners.forEach(c=>{c(o)}))}isOnline(){return N(this,gs)}},gs=new WeakMap,Kr=new WeakMap,ys=new WeakMap,eh),gi=new $g;function Bg(s){return Math.min(1e3*2**s,3e4)}function mh(s){return(s??"online")==="online"?gi.isOnline():!0}var zc=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,c;const u=Ac(),f=()=>u.status!=="pending",m=b=>{var S;if(!f()){const O=new zc(b);_(O),(S=s.onCancel)==null||S.call(s,O)}},p=()=>{o=!0},v=()=>{o=!1},g=()=>ld.isFocused()&&(s.networkMode==="always"||gi.isOnline())&&s.canRun(),j=()=>mh(s.networkMode)&&s.canRun(),w=b=>{f()||(c==null||c(),u.resolve(b))},_=b=>{f()||(c==null||c(),u.reject(b))},M=()=>new Promise(b=>{var S;c=O=>{(f()||g())&&b(O)},(S=s.onPause)==null||S.call(s)}).then(()=>{var b;c=void 0,f()||(b=s.onContinue)==null||b.call(s)}),z=()=>{if(f())return;let b;const S=i===0?s.initialPromise:void 0;try{b=S??s.fn()}catch(O){b=Promise.reject(O)}Promise.resolve(b).then(w).catch(O=>{var $;if(f())return;const I=s.retry??(Oo.isServer()?0:3),B=s.retryDelay??Bg,F=typeof B=="function"?B(i,O):B,D=I===!0||typeof I=="number"&&ig()?void 0:M()).then(()=>{o?_(O):z()})})};return{promise:u,status:()=>u.status,cancel:m,continue:()=>(c==null||c(),u),cancelRetry:p,continueRetry:v,canStart:j,start:()=>(j()?z():M().then(z),u)}}var bn,th,gh=(th=class{constructor(){ye(this,bn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Rc(this.gcTime)&&ne(this,bn,yn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Oo.isServer()?1/0:300*1e3))}clearGcTimeout(){N(this,bn)!==void 0&&(yn.clearTimeout(N(this,bn)),ne(this,bn,void 0))}},bn=new WeakMap,th);function Hg(s){return{onFetch:(o,i)=>{var j,w,_,M,z;const c=o.options,u=(_=(w=(j=o.fetchOptions)==null?void 0:j.meta)==null?void 0:w.fetchMore)==null?void 0:_.direction,f=((M=o.state.data)==null?void 0:M.pages)||[],m=((z=o.state.data)==null?void 0:z.pageParams)||[];let p={pages:[],pageParams:[]},v=0;const g=async()=>{let b=!1;const S=B=>{Fg(B,()=>o.signal,()=>b=!0)},O=ph(o.options,o.fetchOptions),I=async(B,F,D)=>{if(b)return Promise.reject(o.signal.reason);if(F==null&&B.pages.length)return Promise.resolve(B);const H=(()=>{const ke={client:o.client,queryKey:o.queryKey,pageParam:F,direction:D?"backward":"forward",meta:o.options.meta};return S(ke),ke})(),ae=await O(H),{maxPages:te}=o.options,fe=D?Lg:zg;return{pages:fe(B.pages,ae,te),pageParams:fe(B.pageParams,F,te)}};if(u&&f.length){const B=u==="backward",F=B?Vg:vp,D={pages:f,pageParams:m},$=F(c,D);p=await I(D,$,B)}else{const B=s??f.length;do{const F=v===0?m[0]??c.initialPageParam:vp(c,p);if(v>0&&F==null)break;p=await I(p,F),v++}while(v{var b,S;return(S=(b=o.options).persister)==null?void 0:S.call(b,g,{client:o.client,queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},i)}:o.fetchFn=g}}}function vp(s,{pages:o,pageParams:i}){const c=o.length-1;return o.length>0?s.getNextPageParam(o[c],o,i[c],i):void 0}function Vg(s,{pages:o,pageParams:i}){var c;return o.length>0?(c=s.getPreviousPageParam)==null?void 0:c.call(s,o[0],o,i[0],i):void 0}var vs,wn,bs,It,jn,nt,$o,kn,Mt,yh,gr,rh,Wg=(rh=class extends gh{constructor(o){super();ye(this,Mt);ye(this,vs);ye(this,wn);ye(this,bs);ye(this,It);ye(this,jn);ye(this,nt);ye(this,$o);ye(this,kn);ne(this,kn,!1),ne(this,$o,o.defaultOptions),this.setOptions(o.options),this.observers=[],ne(this,jn,o.client),ne(this,It,N(this,jn).getQueryCache()),this.queryKey=o.queryKey,this.queryHash=o.queryHash,ne(this,wn,wp(this.options)),this.state=o.state??N(this,wn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return N(this,vs)}get promise(){var o;return(o=N(this,nt))==null?void 0:o.promise}setOptions(o){if(this.options={...N(this,$o),...o},o!=null&&o._type&&ne(this,vs,o._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=wp(this.options);i.data!==void 0&&(this.setState(bp(i.data,i.dataUpdatedAt)),ne(this,wn,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,It).remove(this)}setData(o,i){const c=Tc(this.state.data,o,this.options);return _e(this,Mt,gr).call(this,{data:c,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),c}setState(o){_e(this,Mt,gr).call(this,{type:"setState",state:o})}cancel(o){var c,u;const i=(c=N(this,nt))==null?void 0:c.promise;return(u=N(this,nt))==null||u.cancel(o),i?i.then(Nt).catch(Nt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return N(this,wn)}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===ad||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(o=>Xr(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:!uh(this.state.dataUpdatedAt,o)}onFocus(){var i;const o=this.observers.find(c=>c.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(i=N(this,nt))==null||i.continue()}onOnline(){var i;const o=this.observers.find(c=>c.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(i=N(this,nt))==null||i.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),N(this,It).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(i=>i!==o),this.observers.length||(N(this,nt)&&(N(this,kn)||_e(this,Mt,yh).call(this)?N(this,nt).cancel({revert:!0}):N(this,nt).cancelRetry()),this.scheduleGc()),N(this,It).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Mt,gr).call(this,{type:"invalidate"})}async fetch(o,i){var g,j,w,_,M,z,b,S,O,I,B;if(this.state.fetchStatus!=="idle"&&((g=N(this,nt))==null?void 0:g.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(N(this,nt))return N(this,nt).continueRetry(),N(this,nt).promise}if(o&&this.setOptions(o),!this.options.queryFn){const F=this.observers.find(D=>D.options.queryFn);F&&this.setOptions(F.options)}const c=new AbortController,u=F=>{Object.defineProperty(F,"signal",{enumerable:!0,get:()=>(ne(this,kn,!0),c.signal)})},f=()=>{const F=ph(this.options,i),$=(()=>{const H={client:N(this,jn),queryKey:this.queryKey,meta:this.meta};return u(H),H})();return ne(this,kn,!1),this.options.persister?this.options.persister(F,$,this):F($)},p=(()=>{const F={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:N(this,jn),state:this.state,fetchFn:f};return u(F),F})(),v=N(this,vs)==="infinite"?Hg(this.options.pages):this.options.behavior;v==null||v.onFetch(p,this),ne(this,bs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((j=p.fetchOptions)==null?void 0:j.meta))&&_e(this,Mt,gr).call(this,{type:"fetch",meta:(w=p.fetchOptions)==null?void 0:w.meta}),ne(this,nt,xh({initialPromise:i==null?void 0:i.initialPromise,fn:p.fetchFn,onCancel:F=>{F instanceof zc&&F.revert&&this.setState({...N(this,bs),fetchStatus:"idle"}),c.abort()},onFail:(F,D)=>{_e(this,Mt,gr).call(this,{type:"failed",failureCount:F,error:D})},onPause:()=>{_e(this,Mt,gr).call(this,{type:"pause"})},onContinue:()=>{_e(this,Mt,gr).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{const F=await N(this,nt).start();if(F===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(F),(M=(_=N(this,It).config).onSuccess)==null||M.call(_,F,this),(b=(z=N(this,It).config).onSettled)==null||b.call(z,F,this.state.error,this),F}catch(F){if(F instanceof zc){if(F.silent)return N(this,nt).promise;if(F.revert){if(this.state.data===void 0)throw F;return this.state.data}}throw _e(this,Mt,gr).call(this,{type:"error",error:F}),(O=(S=N(this,It).config).onError)==null||O.call(S,F,this),(B=(I=N(this,It).config).onSettled)==null||B.call(I,this.state.data,F,this),F}finally{this.scheduleGc()}}},vs=new WeakMap,wn=new WeakMap,bs=new WeakMap,It=new WeakMap,jn=new WeakMap,nt=new WeakMap,$o=new WeakMap,kn=new WeakMap,Mt=new WeakSet,yh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},gr=function(o){const i=c=>{switch(o.type){case"failed":return{...c,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...c,fetchStatus:"paused"};case"continue":return{...c,fetchStatus:"fetching"};case"fetch":return{...c,...vh(c.data,this.options),fetchMeta:o.meta??null};case"success":const u={...c,...bp(o.data,o.dataUpdatedAt),dataUpdateCount:c.dataUpdateCount+1,...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,bs,o.manual?u:void 0),u;case"error":const f=o.error;return{...c,error:f,errorUpdateCount:c.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:c.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...c,isInvalidated:!0};case"setState":return{...c,...o.state}}};this.state=i(this.state),lt.batch(()=>{this.observers.forEach(c=>{c.onQueryUpdate()}),N(this,It).notify({query:this,type:"updated",action:o})})},rh);function vh(s,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:mh(o.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function bp(s,o){return{data:s,dataUpdatedAt:o??Date.now(),error:null,isInvalidated:!1,status:"success"}}function wp(s){const o=typeof s.initialData=="function"?s.initialData():s.initialData,i=o!==void 0,c=i?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:i?c??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var kt,Me,Bo,mt,Nn,ws,yr,Qr,Ho,js,ks,Sn,Cn,qr,Ns,Te,_o,Lc,Fc,Ic,Uc,$c,Bc,Hc,bh,nh,Gg=(nh=class extends Go{constructor(o,i){super();ye(this,Te);ye(this,kt);ye(this,Me);ye(this,Bo);ye(this,mt);ye(this,Nn);ye(this,ws);ye(this,yr);ye(this,Qr);ye(this,Ho);ye(this,js);ye(this,ks);ye(this,Sn);ye(this,Cn);ye(this,qr);ye(this,Ns,new Set);this.options=i,ne(this,kt,o),ne(this,Qr,null),ne(this,yr,Ac()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,Me).addObserver(this),jp(N(this,Me),this.options)?_e(this,Te,_o).call(this):this.updateResult(),_e(this,Te,Uc).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vc(N(this,Me),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vc(N(this,Me),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Te,$c).call(this),_e(this,Te,Bc).call(this),N(this,Me).removeObserver(this)}setOptions(o){const i=this.options,c=N(this,Me);if(this.options=N(this,kt).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,N(this,Me))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Te,Hc).call(this),N(this,Me).setOptions(this.options),i._defaulted&&!Oc(this.options,i)&&N(this,kt).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,Me),observer:this});const u=this.hasListeners();u&&kp(N(this,Me),c,this.options,i)&&_e(this,Te,_o).call(this),this.updateResult(),u&&(N(this,Me)!==c||Rt(this.options.enabled,N(this,Me))!==Rt(i.enabled,N(this,Me))||Xr(this.options.staleTime,N(this,Me))!==Xr(i.staleTime,N(this,Me)))&&_e(this,Te,Lc).call(this);const f=_e(this,Te,Fc).call(this);u&&(N(this,Me)!==c||Rt(this.options.enabled,N(this,Me))!==Rt(i.enabled,N(this,Me))||f!==N(this,qr))&&_e(this,Te,Ic).call(this,f)}getOptimisticResult(o){const i=N(this,kt).getQueryCache().build(N(this,kt),o),c=this.createResult(i,o);return Qg(this,c)&&(ne(this,mt,c),ne(this,ws,this.options),ne(this,Nn,N(this,Me).state)),c}getCurrentResult(){return N(this,mt)}trackResult(o,i){return new Proxy(o,{get:(c,u)=>(this.trackProp(u),i==null||i(u),u==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,yr).status==="pending"&&N(this,yr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(c,u))})}trackProp(o){N(this,Ns).add(o)}getCurrentQuery(){return N(this,Me)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const i=N(this,kt).defaultQueryOptions(o),c=N(this,kt).getQueryCache().build(N(this,kt),i);return c.fetch().then(()=>this.createResult(c,i))}fetch(o){return _e(this,Te,_o).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,mt)))}createResult(o,i){var te;const c=N(this,Me),u=this.options,f=N(this,mt),m=N(this,Nn),p=N(this,ws),g=o!==c?o.state:N(this,Bo),{state:j}=o;let w={...j},_=!1,M;if(i._optimisticResults){const fe=this.hasListeners(),ke=!fe&&jp(o,i),ue=fe&&kp(o,c,i,u);(ke||ue)&&(w={...w,...vh(j.data,o.options)}),i._optimisticResults==="isRestoring"&&(w.fetchStatus="idle")}let{error:z,errorUpdatedAt:b,status:S}=w;M=w.data;let O=!1;if(i.placeholderData!==void 0&&M===void 0&&S==="pending"){let fe;f!=null&&f.isPlaceholderData&&i.placeholderData===(p==null?void 0:p.placeholderData)?(fe=f.data,O=!0):fe=typeof i.placeholderData=="function"?i.placeholderData((te=N(this,ks))==null?void 0:te.state.data,N(this,ks)):i.placeholderData,fe!==void 0&&(S="success",M=Tc(f==null?void 0:f.data,fe,i),_=!0)}if(i.select&&M!==void 0&&!O)if(f&&M===(m==null?void 0:m.data)&&i.select===N(this,Ho))M=N(this,js);else try{ne(this,Ho,i.select),M=i.select(M),M=Tc(f==null?void 0:f.data,M,i),ne(this,js,M),ne(this,Qr,null)}catch(fe){ne(this,Qr,fe)}N(this,Qr)&&(z=N(this,Qr),M=N(this,js),b=Date.now(),S="error");const I=w.fetchStatus==="fetching",B=S==="pending",F=S==="error",D=B&&I,$=M!==void 0,ae={status:S,fetchStatus:w.fetchStatus,isPending:B,isSuccess:S==="success",isError:F,isInitialLoading:D,isLoading:D,data:M,dataUpdatedAt:w.dataUpdatedAt,error:z,errorUpdatedAt:b,failureCount:w.fetchFailureCount,failureReason:w.fetchFailureReason,errorUpdateCount:w.errorUpdateCount,isFetched:o.isFetched(),isFetchedAfterMount:w.dataUpdateCount>g.dataUpdateCount||w.errorUpdateCount>g.errorUpdateCount,isFetching:I,isRefetching:I&&!B,isLoadingError:F&&!$,isPaused:w.fetchStatus==="paused",isPlaceholderData:_,isRefetchError:F&&$,isStale:cd(o,i),refetch:this.refetch,promise:N(this,yr),isEnabled:Rt(i.enabled,o)!==!1};if(this.options.experimental_prefetchInRender){const fe=ae.data!==void 0,ke=ae.status==="error"&&!fe,ue=Le=>{ke?Le.reject(ae.error):fe&&Le.resolve(ae.data)},ze=()=>{const Le=ne(this,yr,ae.promise=Ac());ue(Le)},Ce=N(this,yr);switch(Ce.status){case"pending":o.queryHash===c.queryHash&&ue(Ce);break;case"fulfilled":(ke||ae.data!==Ce.value)&&ze();break;case"rejected":(!ke||ae.error!==Ce.reason)&&ze();break}}return ae}updateResult(){const o=N(this,mt),i=this.createResult(N(this,Me),this.options);if(ne(this,Nn,N(this,Me).state),ne(this,ws,this.options),N(this,Nn).data!==void 0&&ne(this,ks,N(this,Me)),Oc(i,o))return;ne(this,mt,i);const c=()=>{if(!o)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!N(this,Ns).size)return!0;const m=new Set(f??N(this,Ns));return this.options.throwOnError&&m.add("error"),Object.keys(N(this,mt)).some(p=>{const v=p;return N(this,mt)[v]!==o[v]&&m.has(v)})};_e(this,Te,bh).call(this,{listeners:c()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Te,Uc).call(this)}},kt=new WeakMap,Me=new WeakMap,Bo=new WeakMap,mt=new WeakMap,Nn=new WeakMap,ws=new WeakMap,yr=new WeakMap,Qr=new WeakMap,Ho=new WeakMap,js=new WeakMap,ks=new WeakMap,Sn=new WeakMap,Cn=new WeakMap,qr=new WeakMap,Ns=new WeakMap,Te=new WeakSet,_o=function(o){_e(this,Te,Hc).call(this);let i=N(this,Me).fetch(this.options,o);return o!=null&&o.throwOnError||(i=i.catch(Nt)),i},Lc=function(){_e(this,Te,$c).call(this);const o=Xr(this.options.staleTime,N(this,Me));if(Oo.isServer()||N(this,mt).isStale||!Rc(o))return;const c=uh(N(this,mt).dataUpdatedAt,o)+1;ne(this,Sn,yn.setTimeout(()=>{N(this,mt).isStale||this.updateResult()},c))},Fc=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,Me)):this.options.refetchInterval)??!1},Ic=function(o){_e(this,Te,Bc).call(this),ne(this,qr,o),!(Oo.isServer()||Rt(this.options.enabled,N(this,Me))===!1||!Rc(N(this,qr))||N(this,qr)===0)&&ne(this,Cn,yn.setInterval(()=>{(this.options.refetchIntervalInBackground||ld.isFocused())&&_e(this,Te,_o).call(this)},N(this,qr)))},Uc=function(){_e(this,Te,Lc).call(this),_e(this,Te,Ic).call(this,_e(this,Te,Fc).call(this))},$c=function(){N(this,Sn)!==void 0&&(yn.clearTimeout(N(this,Sn)),ne(this,Sn,void 0))},Bc=function(){N(this,Cn)!==void 0&&(yn.clearInterval(N(this,Cn)),ne(this,Cn,void 0))},Hc=function(){const o=N(this,kt).getQueryCache().build(N(this,kt),this.options);if(o===N(this,Me))return;const i=N(this,Me);ne(this,Me,o),ne(this,Bo,o.state),this.hasListeners()&&(i==null||i.removeObserver(this),o.addObserver(this))},bh=function(o){lt.batch(()=>{o.listeners&&this.listeners.forEach(i=>{i(N(this,mt))}),N(this,kt).getQueryCache().notify({query:N(this,Me),type:"observerResultsUpdated"})})},nh);function Kg(s,o){return Rt(o.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&Rt(o.retryOnMount,s)===!1)}function jp(s,o){return Kg(s,o)||s.state.data!==void 0&&Vc(s,o,o.refetchOnMount)}function Vc(s,o,i){if(Rt(o.enabled,s)!==!1&&Xr(o.staleTime,s)!=="static"){const c=typeof i=="function"?i(s):i;return c==="always"||c!==!1&&cd(s,o)}return!1}function kp(s,o,i,c){return(s!==o||Rt(c.enabled,s)===!1)&&(!i.suspense||s.state.status!=="error")&&cd(s,i)}function cd(s,o){return Rt(o.enabled,s)!==!1&&s.isStaleByTime(Xr(o.staleTime,s))}function Qg(s,o){return!Oc(s.getCurrentResult(),o)}var Vo,nr,ft,En,sr,Br,sh,qg=(sh=class extends gh{constructor(o){super();ye(this,sr);ye(this,Vo);ye(this,nr);ye(this,ft);ye(this,En);ne(this,Vo,o.client),this.mutationId=o.mutationId,ne(this,ft,o.mutationCache),ne(this,nr,[]),this.state=o.state||Zg(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){N(this,nr).includes(o)||(N(this,nr).push(o),this.clearGcTimeout(),N(this,ft).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){ne(this,nr,N(this,nr).filter(i=>i!==o)),this.scheduleGc(),N(this,ft).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){N(this,nr).length||(this.state.status==="pending"?this.scheduleGc():N(this,ft).remove(this))}continue(){var o;return((o=N(this,En))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var m,p,v,g,j,w,_,M,z,b,S,O,I,B,F,D,$,H;const i=()=>{_e(this,sr,Br).call(this,{type:"continue"})},c={client:N(this,Vo),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,En,xh({fn:()=>this.options.mutationFn?this.options.mutationFn(o,c):Promise.reject(new Error("No mutationFn found")),onFail:(ae,te)=>{_e(this,sr,Br).call(this,{type:"failed",failureCount:ae,error:te})},onPause:()=>{_e(this,sr,Br).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,ft).canRun(this)}));const u=this.state.status==="pending",f=!N(this,En).canStart();try{if(u)i();else{_e(this,sr,Br).call(this,{type:"pending",variables:o,isPaused:f}),N(this,ft).config.onMutate&&await N(this,ft).config.onMutate(o,this,c);const te=await((p=(m=this.options).onMutate)==null?void 0:p.call(m,o,c));te!==this.state.context&&_e(this,sr,Br).call(this,{type:"pending",context:te,variables:o,isPaused:f})}const ae=await N(this,En).start();return await((g=(v=N(this,ft).config).onSuccess)==null?void 0:g.call(v,ae,o,this.state.context,this,c)),await((w=(j=this.options).onSuccess)==null?void 0:w.call(j,ae,o,this.state.context,c)),await((M=(_=N(this,ft).config).onSettled)==null?void 0:M.call(_,ae,null,this.state.variables,this.state.context,this,c)),await((b=(z=this.options).onSettled)==null?void 0:b.call(z,ae,null,o,this.state.context,c)),_e(this,sr,Br).call(this,{type:"success",data:ae}),ae}catch(ae){try{await((O=(S=N(this,ft).config).onError)==null?void 0:O.call(S,ae,o,this.state.context,this,c))}catch(te){Promise.reject(te)}try{await((B=(I=this.options).onError)==null?void 0:B.call(I,ae,o,this.state.context,c))}catch(te){Promise.reject(te)}try{await((D=(F=N(this,ft).config).onSettled)==null?void 0:D.call(F,void 0,ae,this.state.variables,this.state.context,this,c))}catch(te){Promise.reject(te)}try{await((H=($=this.options).onSettled)==null?void 0:H.call($,void 0,ae,o,this.state.context,c))}catch(te){Promise.reject(te)}throw _e(this,sr,Br).call(this,{type:"error",error:ae}),ae}finally{N(this,ft).runNext(this)}}},Vo=new WeakMap,nr=new WeakMap,ft=new WeakMap,En=new WeakMap,sr=new WeakSet,Br=function(o){const i=c=>{switch(o.type){case"failed":return{...c,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...c,isPaused:!0};case"continue":return{...c,isPaused:!1};case"pending":return{...c,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{...c,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...c,data:void 0,error:o.error,failureCount:c.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=i(this.state),lt.batch(()=>{N(this,nr).forEach(c=>{c.onMutationUpdate(o)}),N(this,ft).notify({mutation:this,type:"updated",action:o})})},sh);function Zg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vr,Qt,Wo,oh,Yg=(oh=class extends Go{constructor(o={}){super();ye(this,vr);ye(this,Qt);ye(this,Wo);this.config=o,ne(this,vr,new Set),ne(this,Qt,new Map),ne(this,Wo,0)}build(o,i,c){const u=new qg({client:o,mutationCache:this,mutationId:++ri(this,Wo)._,options:o.defaultMutationOptions(i),state:c});return this.add(u),u}add(o){N(this,vr).add(o);const i=si(o);if(typeof i=="string"){const c=N(this,Qt).get(i);c?c.push(o):N(this,Qt).set(i,[o])}this.notify({type:"added",mutation:o})}remove(o){if(N(this,vr).delete(o)){const i=si(o);if(typeof i=="string"){const c=N(this,Qt).get(i);if(c)if(c.length>1){const u=c.indexOf(o);u!==-1&&c.splice(u,1)}else c[0]===o&&N(this,Qt).delete(i)}}this.notify({type:"removed",mutation:o})}canRun(o){const i=si(o);if(typeof i=="string"){const c=N(this,Qt).get(i),u=c==null?void 0:c.find(f=>f.state.status==="pending");return!u||u===o}else return!0}runNext(o){var c;const i=si(o);if(typeof i=="string"){const u=(c=N(this,Qt).get(i))==null?void 0:c.find(f=>f!==o&&f.state.isPaused);return(u==null?void 0:u.continue())??Promise.resolve()}else return Promise.resolve()}clear(){lt.batch(()=>{N(this,vr).forEach(o=>{this.notify({type:"removed",mutation:o})}),N(this,vr).clear(),N(this,Qt).clear()})}getAll(){return Array.from(N(this,vr))}find(o){const i={exact:!0,...o};return this.getAll().find(c=>xp(i,c))}findAll(o={}){return this.getAll().filter(i=>xp(o,i))}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}resumePausedMutations(){const o=this.getAll().filter(i=>i.state.isPaused);return lt.batch(()=>Promise.all(o.map(i=>i.continue().catch(Nt))))}},vr=new WeakMap,Qt=new WeakMap,Wo=new WeakMap,oh);function si(s){var o;return(o=s.options.scope)==null?void 0:o.id}var or,lh,Jg=(lh=class extends Go{constructor(o={}){super();ye(this,or);this.config=o,ne(this,or,new Map)}build(o,i,c){const u=i.queryKey,f=i.queryHash??id(u,i);let m=this.get(f);return m||(m=new Wg({client:o,queryKey:u,queryHash:f,options:o.defaultQueryOptions(i),state:c,defaultOptions:o.getQueryDefaults(u)}),this.add(m)),m}add(o){N(this,or).has(o.queryHash)||(N(this,or).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const i=N(this,or).get(o.queryHash);i&&(o.destroy(),i===o&&N(this,or).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){lt.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return N(this,or).get(o)}getAll(){return[...N(this,or).values()]}find(o){const i={exact:!0,...o};return this.getAll().find(c=>mp(i,c))}findAll(o={}){const i=this.getAll();return Object.keys(o).length>0?i.filter(c=>mp(o,c)):i}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}onFocus(){lt.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){lt.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},or=new WeakMap,lh),Ke,Zr,Yr,Ss,Cs,Jr,Es,Ps,ih,Xg=(ih=class{constructor(s={}){ye(this,Ke);ye(this,Zr);ye(this,Yr);ye(this,Ss);ye(this,Cs);ye(this,Jr);ye(this,Es);ye(this,Ps);ne(this,Ke,s.queryCache||new Jg),ne(this,Zr,s.mutationCache||new Yg),ne(this,Yr,s.defaultOptions||{}),ne(this,Ss,new Map),ne(this,Cs,new Map),ne(this,Jr,0)}mount(){ri(this,Jr)._++,N(this,Jr)===1&&(ne(this,Es,ld.subscribe(async s=>{s&&(await this.resumePausedMutations(),N(this,Ke).onFocus())})),ne(this,Ps,gi.subscribe(async s=>{s&&(await this.resumePausedMutations(),N(this,Ke).onOnline())})))}unmount(){var s,o;ri(this,Jr)._--,N(this,Jr)===0&&((s=N(this,Es))==null||s.call(this),ne(this,Es,void 0),(o=N(this,Ps))==null||o.call(this),ne(this,Ps,void 0))}isFetching(s){return N(this,Ke).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return N(this,Zr).findAll({...s,status:"pending"}).length}getQueryData(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=N(this,Ke).get(o.queryHash))==null?void 0:i.state.data}ensureQueryData(s){const o=this.defaultQueryOptions(s),i=N(this,Ke).build(this,o),c=i.state.data;return c===void 0?this.fetchQuery(s):(s.revalidateIfStale&&i.isStaleByTime(Xr(o.staleTime,i))&&this.prefetchQuery(o),Promise.resolve(c))}getQueriesData(s){return N(this,Ke).findAll(s).map(({queryKey:o,state:i})=>{const c=i.data;return[o,c]})}setQueryData(s,o,i){const c=this.defaultQueryOptions({queryKey:s}),u=N(this,Ke).get(c.queryHash),f=u==null?void 0:u.state.data,m=Dg(o,f);if(m!==void 0)return N(this,Ke).build(this,c).setData(m,{...i,manual:!0})}setQueriesData(s,o,i){return lt.batch(()=>N(this,Ke).findAll(s).map(({queryKey:c})=>[c,this.setQueryData(c,o,i)]))}getQueryState(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=N(this,Ke).get(o.queryHash))==null?void 0:i.state}removeQueries(s){const o=N(this,Ke);lt.batch(()=>{o.findAll(s).forEach(i=>{o.remove(i)})})}resetQueries(s,o){const i=N(this,Ke);return lt.batch(()=>(i.findAll(s).forEach(c=>{c.reset()}),this.refetchQueries({type:"active",...s},o)))}cancelQueries(s,o={}){const i={revert:!0,...o},c=lt.batch(()=>N(this,Ke).findAll(s).map(u=>u.cancel(i)));return Promise.all(c).then(Nt).catch(Nt)}invalidateQueries(s,o={}){return lt.batch(()=>(N(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},c=lt.batch(()=>N(this,Ke).findAll(s).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,i);return i.throwOnError||(f=f.catch(Nt)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(c).then(Nt)}fetchQuery(s){const o=this.defaultQueryOptions(s);o.retry===void 0&&(o.retry=!1);const i=N(this,Ke).build(this,o);return i.isStaleByTime(Xr(o.staleTime,i))?i.fetch(o):Promise.resolve(i.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(Nt).catch(Nt)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(Nt).catch(Nt)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return gi.isOnline()?N(this,Zr).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,Ke)}getMutationCache(){return N(this,Zr)}getDefaultOptions(){return N(this,Yr)}setDefaultOptions(s){ne(this,Yr,s)}setQueryDefaults(s,o){N(this,Ss).set(Mo(s),{queryKey:s,defaultOptions:o})}getQueryDefaults(s){const o=[...N(this,Ss).values()],i={};return o.forEach(c=>{Ro(s,c.queryKey)&&Object.assign(i,c.defaultOptions)}),i}setMutationDefaults(s,o){N(this,Cs).set(Mo(s),{mutationKey:s,defaultOptions:o})}getMutationDefaults(s){const o=[...N(this,Cs).values()],i={};return o.forEach(c=>{Ro(s,c.mutationKey)&&Object.assign(i,c.defaultOptions)}),i}defaultQueryOptions(s){if(s._defaulted)return s;const o={...N(this,Yr).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return o.queryHash||(o.queryHash=id(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===ad&&(o.enabled=!1),o}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...N(this,Yr).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){N(this,Ke).clear(),N(this,Zr).clear()}},Ke=new WeakMap,Zr=new WeakMap,Yr=new WeakMap,Ss=new WeakMap,Cs=new WeakMap,Jr=new WeakMap,Es=new WeakMap,Ps=new WeakMap,ih),wh=x.createContext(void 0),rn=s=>{const o=x.useContext(wh);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},e0=({client:s,children:o})=>(x.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),r.jsx(wh.Provider,{value:s,children:o})),jh=x.createContext(!1),t0=()=>x.useContext(jh);jh.Provider;function r0(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var n0=x.createContext(r0()),s0=()=>x.useContext(n0),o0=(s,o,i)=>{const c=i!=null&&i.state.error&&typeof s.throwOnError=="function"?hh(s.throwOnError,[i.state.error,i]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||c)&&(o.isReset()||(s.retryOnMount=!1))},l0=s=>{x.useEffect(()=>{s.clearReset()},[s])},i0=({result:s,errorResetBoundary:o,throwOnError:i,query:c,suspense:u})=>s.isError&&!o.isReset()&&!s.isFetching&&c&&(u&&s.data===void 0||hh(i,[s.error,c])),a0=s=>{if(s.suspense){const i=u=>u==="static"?u:Math.max(u??1e3,1e3),c=s.staleTime;s.staleTime=typeof c=="function"?(...u)=>i(c(...u)):i(c),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},c0=(s,o)=>s.isLoading&&s.isFetching&&!o,d0=(s,o)=>(s==null?void 0:s.suspense)&&o.isPending,Np=(s,o,i)=>o.fetchOptimistic(s).catch(()=>{i.clearReset()});function u0(s,o,i){var M,z,b,S;const c=t0(),u=s0(),f=rn(),m=f.defaultQueryOptions(s);(z=(M=f.getDefaultOptions().queries)==null?void 0:M._experimental_beforeQuery)==null||z.call(M,m);const p=f.getQueryCache().get(m.queryHash),v=s.subscribed!==!1;m._optimisticResults=c?"isRestoring":v?"optimistic":void 0,a0(m),o0(m,u,p),l0(u);const g=!f.getQueryCache().get(m.queryHash),[j]=x.useState(()=>new o(f,m)),w=j.getOptimisticResult(m),_=!c&&v;if(x.useSyncExternalStore(x.useCallback(O=>{const I=_?j.subscribe(lt.batchCalls(O)):Nt;return j.updateResult(),I},[j,_]),()=>j.getCurrentResult(),()=>j.getCurrentResult()),x.useEffect(()=>{j.setOptions(m)},[m,j]),d0(m,w))throw Np(m,j,u);if(i0({result:w,errorResetBoundary:u,throwOnError:m.throwOnError,query:p,suspense:m.suspense}))throw w.error;if((S=(b=f.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||S.call(b,m,w),m.experimental_prefetchInRender&&!Oo.isServer()&&c0(w,c)){const O=g?Np(m,j,u):p==null?void 0:p.promise;O==null||O.catch(Nt).finally(()=>{j.updateResult()})}return m.notifyOnChangeProps?w:j.trackResult(w)}function Ut(s,o){return u0(s,Gg)}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -327,7 +327,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const B0=he("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Zc=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:_0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:m0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:Ot},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Ao},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:D0},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:To},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:b0}];var Ep=1,H0=.9,V0=.8,W0=.17,vc=.1,bc=.999,G0=.9999,K0=.99,Q0=/[\\\/_+.#"@\[\(\{&]/,q0=/[\\\/_+.#"@\[\(\{&]/g,Z0=/[\s-]/,_h=/[\s-]/g;function Yc(s,o,i,c,u,f,m){if(f===o.length)return u===s.length?Ep:K0;var p=`${u},${f}`;if(m[p]!==void 0)return m[p];for(var v=c.charAt(f),g=i.indexOf(v,u),j=0,w,_,M,L;g>=0;)w=Yc(s,o,i,c,g+1,f+1,m),w>j&&(g===u?w*=Ep:Q0.test(s.charAt(g-1))?(w*=V0,M=s.slice(u,g-1).match(q0),M&&u>0&&(w*=Math.pow(bc,M.length))):Z0.test(s.charAt(g-1))?(w*=H0,L=s.slice(u,g-1).match(_h),L&&u>0&&(w*=Math.pow(bc,L.length))):(w*=W0,u>0&&(w*=Math.pow(bc,g-u))),s.charAt(g)!==o.charAt(f)&&(w*=G0)),(ww&&(w=_*vc)),w>j&&(j=w),g=i.indexOf(v,g+1);return m[p]=j,j}function Pp(s){return s.toLowerCase().replace(_h," ")}function Y0(s,o,i){return s=i&&i.length>0?`${s+" "+i.join(" ")}`:s,Yc(s,o,Pp(s),Pp(o),0,0,{})}function en(s,o,{checkForDefaultPrevented:i=!0}={}){return function(u){if(s==null||s(u),i===!1||!u.defaultPrevented)return o==null?void 0:o(u)}}function _p(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Rs(...s){return o=>{let i=!1;const c=s.map(u=>{const f=_p(u,o);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let u=0;u{var O;const{scope:_,children:M,...L}=w,b=((O=_==null?void 0:_[s])==null?void 0:O[v])||p,S=x.useMemo(()=>L,Object.values(L));return r.jsx(b.Provider,{value:S,children:M})};g.displayName=f+"Provider";function j(w,_){var b;const M=((b=_==null?void 0:_[s])==null?void 0:b[v])||p,L=x.useContext(M);if(L)return L;if(m!==void 0)return m;throw new Error(`\`${w}\` must be used within \`${f}\``)}return[g,j]}const u=()=>{const f=i.map(m=>x.createContext(m));return function(p){const v=(p==null?void 0:p[s])||f;return x.useMemo(()=>({[`__scope${s}`]:{...p,[s]:v}}),[p,v])}};return u.scopeName=s,[c,X0(u,...o)]}function X0(...s){const o=s[0];if(s.length===1)return o;const i=()=>{const c=s.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(f){const m=c.reduce((p,{useScope:v,scopeName:g})=>{const w=v(f)[`__scope${g}`];return{...p,...w}},{});return x.useMemo(()=>({[`__scope${o.scopeName}`]:m}),[m])}};return i.scopeName=o.scopeName,i}var Fo=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},ey=od[" useId ".trim().toString()]||(()=>{}),ty=0;function br(s){const[o,i]=x.useState(ey());return Fo(()=>{i(c=>c??String(ty++))},[s]),o?`radix-${o}`:""}var ry=od[" useInsertionEffect ".trim().toString()]||Fo;function ny({prop:s,defaultProp:o,onChange:i=()=>{},caller:c}){const[u,f,m]=sy({defaultProp:o,onChange:i}),p=s!==void 0,v=p?s:u;{const j=x.useRef(s!==void 0);x.useEffect(()=>{const w=j.current;w!==p&&console.warn(`${c} is changing from ${w?"controlled":"uncontrolled"} to ${p?"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.`),j.current=p},[p,c])}const g=x.useCallback(j=>{var w;if(p){const _=oy(j)?j(s):j;_!==s&&((w=m.current)==null||w.call(m,_))}else f(j)},[p,s,f,m]);return[v,g]}function sy({defaultProp:s,onChange:o}){const[i,c]=x.useState(s),u=x.useRef(i),f=x.useRef(o);return ry(()=>{f.current=o},[o]),x.useEffect(()=>{var m;u.current!==i&&((m=f.current)==null||m.call(f,i),u.current=i)},[i,u]),[i,c,f]}function oy(s){return typeof s=="function"}var Mh=dh();function Rh(s){const o=x.forwardRef((i,c)=>{let{children:u,...f}=i,m=null,p=!1;const v=[];Mp(u)&&typeof oi=="function"&&(u=oi(u._payload)),x.Children.forEach(u,_=>{var M;if(dy(_)){p=!0;const L=_;let b="child"in L.props?L.props.child:L.props.children;Mp(b)&&typeof oi=="function"&&(b=oi(b._payload)),m=iy(L,b),v.push((M=m==null?void 0:m.props)==null?void 0:M.children)}else v.push(_)}),m?m=x.cloneElement(m,void 0,v):!p&&x.Children.count(u)===1&&x.isValidElement(u)&&(m=u);const g=m?cy(m):void 0,j=On(c,g);if(!m){if(u||u===0)throw new Error(p?hy(s):py(s));return u}const w=ay(f,m.props??{});return m.type!==x.Fragment&&(w.ref=c?j:g),x.cloneElement(m,w)});return o.displayName=`${s}.Slot`,o}var ly=Symbol.for("radix.slottable"),iy=(s,o)=>{if("child"in s.props){const i=s.props.child;return x.isValidElement(i)?x.cloneElement(i,void 0,s.props.children(i.props.children)):null}return x.isValidElement(o)?o:null};function ay(s,o){const i={...o};for(const c in o){const u=s[c],f=o[c];/^on[A-Z]/.test(c)?u&&f?i[c]=(...p)=>{const v=f(...p);return u(...p),v}:u&&(i[c]=u):c==="style"?i[c]={...u,...f}:c==="className"&&(i[c]=[u,f].filter(Boolean).join(" "))}return{...s,...i}}function cy(s){var c,u;let o=(c=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:c.get,i=o&&"isReactWarning"in o&&o.isReactWarning;return i?s.ref:(o=(u=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:u.get,i=o&&"isReactWarning"in o&&o.isReactWarning,i?s.props.ref:s.props.ref||s.ref)}function dy(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===ly}var uy=Symbol.for("react.lazy");function Mp(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===uy&&"_payload"in s&&fy(s._payload)}function fy(s){return typeof s=="object"&&s!==null&&"then"in s}var py=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,hy=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,oi=od[" use ".trim().toString()],my=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],it=my.reduce((s,o)=>{const i=Rh(`Primitive.${o}`),c=x.forwardRef((u,f)=>{const{asChild:m,...p}=u,v=m?i:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(v,{...p,ref:f})});return c.displayName=`Primitive.${o}`,{...s,[o]:c}},{});function xy(s,o){s&&Mh.flushSync(()=>s.dispatchEvent(o))}function Io(s){const o=x.useRef(s);return x.useEffect(()=>{o.current=s}),x.useMemo(()=>((...i)=>{var c;return(c=o.current)==null?void 0:c.call(o,...i)}),[])}function gy(s,o=globalThis==null?void 0:globalThis.document){const i=Io(s);x.useEffect(()=>{const c=u=>{u.key==="Escape"&&i(u)};return o.addEventListener("keydown",c,{capture:!0}),()=>o.removeEventListener("keydown",c,{capture:!0})},[i,o])}var yy="DismissableLayer",Jc="dismissableLayer.update",vy="dismissableLayer.pointerDownOutside",by="dismissableLayer.focusOutside",Rp,ud=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Oh=x.forwardRef((s,o)=>{const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:v,...g}=s,j=x.useContext(ud),[w,_]=x.useState(null),M=(w==null?void 0:w.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,L]=x.useState({}),b=On(o,te=>_(te)),S=Array.from(j.layers),[O]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),I=S.indexOf(O),B=w?S.indexOf(w):-1,F=j.layersWithOutsidePointerEventsDisabled.size>0,D=B>=I,$=x.useRef(!1),H=Ny(te=>{const fe=te.target;if(!(fe instanceof Node))return;const ke=[...j.branches].some(ue=>ue.contains(fe));!D||ke||(f==null||f(te),p==null||p(te),te.defaultPrevented||v==null||v())},{ownerDocument:M,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:$,dismissableSurfaces:j.dismissableSurfaces}),ae=Sy(te=>{if(c&&$.current)return;const fe=te.target;[...j.branches].some(ue=>ue.contains(fe))||(m==null||m(te),p==null||p(te),te.defaultPrevented||v==null||v())},M);return gy(te=>{B===j.layers.size-1&&(u==null||u(te),!te.defaultPrevented&&v&&(te.preventDefault(),v()))},M),x.useEffect(()=>{if(w)return i&&(j.layersWithOutsidePointerEventsDisabled.size===0&&(Rp=M.body.style.pointerEvents,M.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(w)),j.layers.add(w),Op(),()=>{i&&(j.layersWithOutsidePointerEventsDisabled.delete(w),j.layersWithOutsidePointerEventsDisabled.size===0&&(M.body.style.pointerEvents=Rp))}},[w,M,i,j]),x.useEffect(()=>()=>{w&&(j.layers.delete(w),j.layersWithOutsidePointerEventsDisabled.delete(w),Op())},[w,j]),x.useEffect(()=>{const te=()=>L({});return document.addEventListener(Jc,te),()=>document.removeEventListener(Jc,te)},[]),r.jsx(it.div,{...g,ref:b,style:{pointerEvents:F?D?"auto":"none":void 0,...s.style},onFocusCapture:en(s.onFocusCapture,ae.onFocusCapture),onBlurCapture:en(s.onBlurCapture,ae.onBlurCapture),onPointerDownCapture:en(s.onPointerDownCapture,H.onPointerDownCapture)})});Oh.displayName=yy;var wy="DismissableLayerBranch",jy=x.forwardRef((s,o)=>{const i=x.useContext(ud),c=x.useRef(null),u=On(o,c);return x.useEffect(()=>{const f=c.current;if(f)return i.branches.add(f),()=>{i.branches.delete(f)}},[i.branches]),r.jsx(it.div,{...s,ref:u})});jy.displayName=wy;function ky(){const s=x.useContext(ud),[o,i]=x.useState(null);return x.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),i}function Ny(s,o){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:u,dismissableSurfaces:f}=o,m=Io(s),p=x.useRef(!1),v=x.useRef(!1),g=x.useRef(new Map),j=x.useRef(()=>{});return x.useEffect(()=>{function w(){v.current=!1,u.current=!1,g.current.clear()}function _(){return Array.from(g.current.values()).some(Boolean)}function M(I){if(!v.current)return;const B=I.target;B instanceof Node&&[...f].some(D=>D.contains(B))||g.current.set(I.type,!0),I.type==="click"&&window.setTimeout(()=>{v.current&&j.current()},0)}function L(I){v.current&&g.current.set(I.type,!1)}const b=I=>{if(I.target&&!p.current){let B=function(){i.removeEventListener("click",j.current);const D=_();w(),D||Dh(vy,m,F,{discrete:!0})};const F={originalEvent:I};v.current=!0,u.current=c&&I.button===0,g.current.clear(),!c||I.button!==0?B():(i.removeEventListener("click",j.current),j.current=B,i.addEventListener("click",j.current,{once:!0}))}else i.removeEventListener("click",j.current),w();p.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const I of S)i.addEventListener(I,M,!0),i.addEventListener(I,L);const O=window.setTimeout(()=>{i.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(O),i.removeEventListener("pointerdown",b),i.removeEventListener("click",j.current);for(const I of S)i.removeEventListener(I,M,!0),i.removeEventListener(I,L)}},[i,m,c,u,f]),{onPointerDownCapture:()=>p.current=!0}}function Sy(s,o=globalThis==null?void 0:globalThis.document){const i=Io(s),c=x.useRef(!1);return x.useEffect(()=>{const u=f=>{f.target&&!c.current&&Dh(by,i,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",u),()=>o.removeEventListener("focusin",u)},[o,i]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Op(){const s=new CustomEvent(Jc);document.dispatchEvent(s)}function Dh(s,o,i,{discrete:c}){const u=i.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:i});o&&u.addEventListener(s,o,{once:!0}),c?xy(u,f):u.dispatchEvent(f)}var wc="focusScope.autoFocusOnMount",jc="focusScope.autoFocusOnUnmount",Dp={bubbles:!1,cancelable:!0},Cy="FocusScope",Th=x.forwardRef((s,o)=>{const{loop:i=!1,trapped:c=!1,onMountAutoFocus:u,onUnmountAutoFocus:f,...m}=s,[p,v]=x.useState(null),g=Io(u),j=Io(f),w=x.useRef(null),_=On(o,b=>v(b)),M=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(c){let b=function(B){if(M.paused||!p)return;const F=B.target;p.contains(F)?w.current=F:Hr(w.current,{select:!0})},S=function(B){if(M.paused||!p)return;const F=B.relatedTarget;F!==null&&(p.contains(F)||Hr(w.current,{select:!0}))},O=function(B){if(document.activeElement===document.body)for(const D of B)D.removedNodes.length>0&&Hr(p)};document.addEventListener("focusin",b),document.addEventListener("focusout",S);const I=new MutationObserver(O);return p&&I.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",S),I.disconnect()}}},[c,p,M.paused]),x.useEffect(()=>{if(p){Ap.add(M);const b=document.activeElement;if(!p.contains(b)){const O=new CustomEvent(wc,Dp);p.addEventListener(wc,g),p.dispatchEvent(O),O.defaultPrevented||(Ey(Oy(Ah(p)),{select:!0}),document.activeElement===b&&Hr(p))}return()=>{p.removeEventListener(wc,g),setTimeout(()=>{const O=new CustomEvent(jc,Dp);p.addEventListener(jc,j),p.dispatchEvent(O),O.defaultPrevented||Hr(b??document.body,{select:!0}),p.removeEventListener(jc,j),Ap.remove(M)},0)}}},[p,g,j,M]);const L=x.useCallback(b=>{if(!i&&!c||M.paused)return;const S=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,O=document.activeElement;if(S&&O){const I=b.currentTarget,[B,F]=Py(I);B&&F?!b.shiftKey&&O===F?(b.preventDefault(),i&&Hr(B,{select:!0})):b.shiftKey&&O===B&&(b.preventDefault(),i&&Hr(F,{select:!0})):O===I&&b.preventDefault()}},[i,c,M.paused]);return r.jsx(it.div,{tabIndex:-1,...m,ref:_,onKeyDown:L})});Th.displayName=Cy;function Ey(s,{select:o=!1}={}){const i=document.activeElement;for(const c of s)if(Hr(c,{select:o}),document.activeElement!==i)return}function Py(s){const o=Ah(s),i=Tp(o,s),c=Tp(o.reverse(),s);return[i,c]}function Ah(s){const o=[],i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const u=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||u?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)o.push(i.currentNode);return o}function Tp(s,o){for(const i of s)if(!_y(i,{upTo:o}))return i}function _y(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 My(s){return s instanceof HTMLInputElement&&"select"in s}function Hr(s,{select:o=!1}={}){if(s&&s.focus){const i=document.activeElement;s.focus({preventScroll:!0}),s!==i&&My(s)&&o&&s.select()}}var Ap=Ry();function Ry(){let s=[];return{add(o){const i=s[0];o!==i&&(i==null||i.pause()),s=zp(s,o),s.unshift(o)},remove(o){var i;s=zp(s,o),(i=s[0])==null||i.resume()}}}function zp(s,o){const i=[...s],c=i.indexOf(o);return c!==-1&&i.splice(c,1),i}function Oy(s){return s.filter(o=>o.tagName!=="A")}var Dy="Portal",zh=x.forwardRef((s,o)=>{var p;const{container:i,...c}=s,[u,f]=x.useState(!1);Fo(()=>f(!0),[]);const m=i||u&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return m?Mh.createPortal(r.jsx(it.div,{...c,ref:o}),m):null});zh.displayName=Dy;function Ty(s,o){return x.useReducer((i,c)=>o[i][c]??i,s)}var wi=s=>{const{present:o,children:i}=s,c=Ay(o),u=typeof i=="function"?i({present:c.isPresent}):x.Children.only(i),f=zy(c.ref,Ly(u));return typeof i=="function"||c.isPresent?x.cloneElement(u,{ref:f}):null};wi.displayName="Presence";function Ay(s){const[o,i]=x.useState(),c=x.useRef(null),u=x.useRef(s),f=x.useRef("none"),m=s?"mounted":"unmounted",[p,v]=Ty(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const g=li(c.current);f.current=p==="mounted"?g:"none"},[p]),Fo(()=>{const g=c.current,j=u.current;if(j!==s){const _=f.current,M=li(g);s?v("MOUNT"):M==="none"||(g==null?void 0:g.display)==="none"?v("UNMOUNT"):v(j&&_!==M?"ANIMATION_OUT":"UNMOUNT"),u.current=s}},[s,v]),Fo(()=>{if(o){let g;const j=o.ownerDocument.defaultView??window,w=M=>{const b=li(c.current).includes(CSS.escape(M.animationName));if(M.target===o&&b&&(v("ANIMATION_END"),!u.current)){const S=o.style.animationFillMode;o.style.animationFillMode="forwards",g=j.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=S)})}},_=M=>{M.target===o&&(f.current=li(c.current))};return o.addEventListener("animationstart",_),o.addEventListener("animationcancel",w),o.addEventListener("animationend",w),()=>{j.clearTimeout(g),o.removeEventListener("animationstart",_),o.removeEventListener("animationcancel",w),o.removeEventListener("animationend",w)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:x.useCallback(g=>{c.current=g?getComputedStyle(g):null,i(g)},[])}}function Lp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function zy(...s){const o=x.useRef(s);return o.current=s,x.useCallback(i=>{const c=o.current;let u=!1;const f=c.map(m=>{const p=Lp(m,i);return!u&&typeof p=="function"&&(u=!0),p});if(u)return()=>{for(let m=0;m{rr||(rr={start:Fp(),end:Fp()});const{start:s,end:o}=rr;return document.body.firstElementChild!==s&&document.body.insertAdjacentElement("afterbegin",s),document.body.lastElementChild!==o&&document.body.insertAdjacentElement("beforeend",o),ii++,()=>{ii===1&&(rr==null||rr.start.remove(),rr==null||rr.end.remove(),rr=null),ii=Math.max(0,ii-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 lr=function(){return lr=Object.assign||function(o){for(var i,c=1,u=arguments.length;c"u")return tv;var o=rv(s),i=document.documentElement.clientWidth,c=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,c-i+o[2]-o[0])}},sv=Uh(),hs="data-scroll-locked",ov=function(s,o,i,c){var u=s.left,f=s.top,m=s.right,p=s.gap;return i===void 0&&(i="margin"),` + */const B0=he("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Zc=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:_0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:m0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:Ot},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Ao},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:D0},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:To},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:b0}];var Ep=1,H0=.9,V0=.8,W0=.17,vc=.1,bc=.999,G0=.9999,K0=.99,Q0=/[\\\/_+.#"@\[\(\{&]/,q0=/[\\\/_+.#"@\[\(\{&]/g,Z0=/[\s-]/,_h=/[\s-]/g;function Yc(s,o,i,c,u,f,m){if(f===o.length)return u===s.length?Ep:K0;var p=`${u},${f}`;if(m[p]!==void 0)return m[p];for(var v=c.charAt(f),g=i.indexOf(v,u),j=0,w,_,M,z;g>=0;)w=Yc(s,o,i,c,g+1,f+1,m),w>j&&(g===u?w*=Ep:Q0.test(s.charAt(g-1))?(w*=V0,M=s.slice(u,g-1).match(q0),M&&u>0&&(w*=Math.pow(bc,M.length))):Z0.test(s.charAt(g-1))?(w*=H0,z=s.slice(u,g-1).match(_h),z&&u>0&&(w*=Math.pow(bc,z.length))):(w*=W0,u>0&&(w*=Math.pow(bc,g-u))),s.charAt(g)!==o.charAt(f)&&(w*=G0)),(ww&&(w=_*vc)),w>j&&(j=w),g=i.indexOf(v,g+1);return m[p]=j,j}function Pp(s){return s.toLowerCase().replace(_h," ")}function Y0(s,o,i){return s=i&&i.length>0?`${s+" "+i.join(" ")}`:s,Yc(s,o,Pp(s),Pp(o),0,0,{})}function en(s,o,{checkForDefaultPrevented:i=!0}={}){return function(u){if(s==null||s(u),i===!1||!u.defaultPrevented)return o==null?void 0:o(u)}}function _p(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Rs(...s){return o=>{let i=!1;const c=s.map(u=>{const f=_p(u,o);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let u=0;u{var O;const{scope:_,children:M,...z}=w,b=((O=_==null?void 0:_[s])==null?void 0:O[v])||p,S=x.useMemo(()=>z,Object.values(z));return r.jsx(b.Provider,{value:S,children:M})};g.displayName=f+"Provider";function j(w,_){var b;const M=((b=_==null?void 0:_[s])==null?void 0:b[v])||p,z=x.useContext(M);if(z)return z;if(m!==void 0)return m;throw new Error(`\`${w}\` must be used within \`${f}\``)}return[g,j]}const u=()=>{const f=i.map(m=>x.createContext(m));return function(p){const v=(p==null?void 0:p[s])||f;return x.useMemo(()=>({[`__scope${s}`]:{...p,[s]:v}}),[p,v])}};return u.scopeName=s,[c,X0(u,...o)]}function X0(...s){const o=s[0];if(s.length===1)return o;const i=()=>{const c=s.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(f){const m=c.reduce((p,{useScope:v,scopeName:g})=>{const w=v(f)[`__scope${g}`];return{...p,...w}},{});return x.useMemo(()=>({[`__scope${o.scopeName}`]:m}),[m])}};return i.scopeName=o.scopeName,i}var Fo=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},ey=od[" useId ".trim().toString()]||(()=>{}),ty=0;function br(s){const[o,i]=x.useState(ey());return Fo(()=>{i(c=>c??String(ty++))},[s]),o?`radix-${o}`:""}var ry=od[" useInsertionEffect ".trim().toString()]||Fo;function ny({prop:s,defaultProp:o,onChange:i=()=>{},caller:c}){const[u,f,m]=sy({defaultProp:o,onChange:i}),p=s!==void 0,v=p?s:u;{const j=x.useRef(s!==void 0);x.useEffect(()=>{const w=j.current;w!==p&&console.warn(`${c} is changing from ${w?"controlled":"uncontrolled"} to ${p?"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.`),j.current=p},[p,c])}const g=x.useCallback(j=>{var w;if(p){const _=oy(j)?j(s):j;_!==s&&((w=m.current)==null||w.call(m,_))}else f(j)},[p,s,f,m]);return[v,g]}function sy({defaultProp:s,onChange:o}){const[i,c]=x.useState(s),u=x.useRef(i),f=x.useRef(o);return ry(()=>{f.current=o},[o]),x.useEffect(()=>{var m;u.current!==i&&((m=f.current)==null||m.call(f,i),u.current=i)},[i,u]),[i,c,f]}function oy(s){return typeof s=="function"}var Mh=dh();function Rh(s){const o=x.forwardRef((i,c)=>{let{children:u,...f}=i,m=null,p=!1;const v=[];Mp(u)&&typeof oi=="function"&&(u=oi(u._payload)),x.Children.forEach(u,_=>{var M;if(dy(_)){p=!0;const z=_;let b="child"in z.props?z.props.child:z.props.children;Mp(b)&&typeof oi=="function"&&(b=oi(b._payload)),m=iy(z,b),v.push((M=m==null?void 0:m.props)==null?void 0:M.children)}else v.push(_)}),m?m=x.cloneElement(m,void 0,v):!p&&x.Children.count(u)===1&&x.isValidElement(u)&&(m=u);const g=m?cy(m):void 0,j=On(c,g);if(!m){if(u||u===0)throw new Error(p?hy(s):py(s));return u}const w=ay(f,m.props??{});return m.type!==x.Fragment&&(w.ref=c?j:g),x.cloneElement(m,w)});return o.displayName=`${s}.Slot`,o}var ly=Symbol.for("radix.slottable"),iy=(s,o)=>{if("child"in s.props){const i=s.props.child;return x.isValidElement(i)?x.cloneElement(i,void 0,s.props.children(i.props.children)):null}return x.isValidElement(o)?o:null};function ay(s,o){const i={...o};for(const c in o){const u=s[c],f=o[c];/^on[A-Z]/.test(c)?u&&f?i[c]=(...p)=>{const v=f(...p);return u(...p),v}:u&&(i[c]=u):c==="style"?i[c]={...u,...f}:c==="className"&&(i[c]=[u,f].filter(Boolean).join(" "))}return{...s,...i}}function cy(s){var c,u;let o=(c=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:c.get,i=o&&"isReactWarning"in o&&o.isReactWarning;return i?s.ref:(o=(u=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:u.get,i=o&&"isReactWarning"in o&&o.isReactWarning,i?s.props.ref:s.props.ref||s.ref)}function dy(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===ly}var uy=Symbol.for("react.lazy");function Mp(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===uy&&"_payload"in s&&fy(s._payload)}function fy(s){return typeof s=="object"&&s!==null&&"then"in s}var py=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,hy=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,oi=od[" use ".trim().toString()],my=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],it=my.reduce((s,o)=>{const i=Rh(`Primitive.${o}`),c=x.forwardRef((u,f)=>{const{asChild:m,...p}=u,v=m?i:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(v,{...p,ref:f})});return c.displayName=`Primitive.${o}`,{...s,[o]:c}},{});function xy(s,o){s&&Mh.flushSync(()=>s.dispatchEvent(o))}function Io(s){const o=x.useRef(s);return x.useEffect(()=>{o.current=s}),x.useMemo(()=>((...i)=>{var c;return(c=o.current)==null?void 0:c.call(o,...i)}),[])}function gy(s,o=globalThis==null?void 0:globalThis.document){const i=Io(s);x.useEffect(()=>{const c=u=>{u.key==="Escape"&&i(u)};return o.addEventListener("keydown",c,{capture:!0}),()=>o.removeEventListener("keydown",c,{capture:!0})},[i,o])}var yy="DismissableLayer",Jc="dismissableLayer.update",vy="dismissableLayer.pointerDownOutside",by="dismissableLayer.focusOutside",Rp,ud=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Oh=x.forwardRef((s,o)=>{const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:v,...g}=s,j=x.useContext(ud),[w,_]=x.useState(null),M=(w==null?void 0:w.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,z]=x.useState({}),b=On(o,te=>_(te)),S=Array.from(j.layers),[O]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),I=S.indexOf(O),B=w?S.indexOf(w):-1,F=j.layersWithOutsidePointerEventsDisabled.size>0,D=B>=I,$=x.useRef(!1),H=Ny(te=>{const fe=te.target;if(!(fe instanceof Node))return;const ke=[...j.branches].some(ue=>ue.contains(fe));!D||ke||(f==null||f(te),p==null||p(te),te.defaultPrevented||v==null||v())},{ownerDocument:M,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:$,dismissableSurfaces:j.dismissableSurfaces}),ae=Sy(te=>{if(c&&$.current)return;const fe=te.target;[...j.branches].some(ue=>ue.contains(fe))||(m==null||m(te),p==null||p(te),te.defaultPrevented||v==null||v())},M);return gy(te=>{B===j.layers.size-1&&(u==null||u(te),!te.defaultPrevented&&v&&(te.preventDefault(),v()))},M),x.useEffect(()=>{if(w)return i&&(j.layersWithOutsidePointerEventsDisabled.size===0&&(Rp=M.body.style.pointerEvents,M.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(w)),j.layers.add(w),Op(),()=>{i&&(j.layersWithOutsidePointerEventsDisabled.delete(w),j.layersWithOutsidePointerEventsDisabled.size===0&&(M.body.style.pointerEvents=Rp))}},[w,M,i,j]),x.useEffect(()=>()=>{w&&(j.layers.delete(w),j.layersWithOutsidePointerEventsDisabled.delete(w),Op())},[w,j]),x.useEffect(()=>{const te=()=>z({});return document.addEventListener(Jc,te),()=>document.removeEventListener(Jc,te)},[]),r.jsx(it.div,{...g,ref:b,style:{pointerEvents:F?D?"auto":"none":void 0,...s.style},onFocusCapture:en(s.onFocusCapture,ae.onFocusCapture),onBlurCapture:en(s.onBlurCapture,ae.onBlurCapture),onPointerDownCapture:en(s.onPointerDownCapture,H.onPointerDownCapture)})});Oh.displayName=yy;var wy="DismissableLayerBranch",jy=x.forwardRef((s,o)=>{const i=x.useContext(ud),c=x.useRef(null),u=On(o,c);return x.useEffect(()=>{const f=c.current;if(f)return i.branches.add(f),()=>{i.branches.delete(f)}},[i.branches]),r.jsx(it.div,{...s,ref:u})});jy.displayName=wy;function ky(){const s=x.useContext(ud),[o,i]=x.useState(null);return x.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),i}function Ny(s,o){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:u,dismissableSurfaces:f}=o,m=Io(s),p=x.useRef(!1),v=x.useRef(!1),g=x.useRef(new Map),j=x.useRef(()=>{});return x.useEffect(()=>{function w(){v.current=!1,u.current=!1,g.current.clear()}function _(){return Array.from(g.current.values()).some(Boolean)}function M(I){if(!v.current)return;const B=I.target;B instanceof Node&&[...f].some(D=>D.contains(B))||g.current.set(I.type,!0),I.type==="click"&&window.setTimeout(()=>{v.current&&j.current()},0)}function z(I){v.current&&g.current.set(I.type,!1)}const b=I=>{if(I.target&&!p.current){let B=function(){i.removeEventListener("click",j.current);const D=_();w(),D||Dh(vy,m,F,{discrete:!0})};const F={originalEvent:I};v.current=!0,u.current=c&&I.button===0,g.current.clear(),!c||I.button!==0?B():(i.removeEventListener("click",j.current),j.current=B,i.addEventListener("click",j.current,{once:!0}))}else i.removeEventListener("click",j.current),w();p.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const I of S)i.addEventListener(I,M,!0),i.addEventListener(I,z);const O=window.setTimeout(()=>{i.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(O),i.removeEventListener("pointerdown",b),i.removeEventListener("click",j.current);for(const I of S)i.removeEventListener(I,M,!0),i.removeEventListener(I,z)}},[i,m,c,u,f]),{onPointerDownCapture:()=>p.current=!0}}function Sy(s,o=globalThis==null?void 0:globalThis.document){const i=Io(s),c=x.useRef(!1);return x.useEffect(()=>{const u=f=>{f.target&&!c.current&&Dh(by,i,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",u),()=>o.removeEventListener("focusin",u)},[o,i]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Op(){const s=new CustomEvent(Jc);document.dispatchEvent(s)}function Dh(s,o,i,{discrete:c}){const u=i.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:i});o&&u.addEventListener(s,o,{once:!0}),c?xy(u,f):u.dispatchEvent(f)}var wc="focusScope.autoFocusOnMount",jc="focusScope.autoFocusOnUnmount",Dp={bubbles:!1,cancelable:!0},Cy="FocusScope",Th=x.forwardRef((s,o)=>{const{loop:i=!1,trapped:c=!1,onMountAutoFocus:u,onUnmountAutoFocus:f,...m}=s,[p,v]=x.useState(null),g=Io(u),j=Io(f),w=x.useRef(null),_=On(o,b=>v(b)),M=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(c){let b=function(B){if(M.paused||!p)return;const F=B.target;p.contains(F)?w.current=F:Hr(w.current,{select:!0})},S=function(B){if(M.paused||!p)return;const F=B.relatedTarget;F!==null&&(p.contains(F)||Hr(w.current,{select:!0}))},O=function(B){if(document.activeElement===document.body)for(const D of B)D.removedNodes.length>0&&Hr(p)};document.addEventListener("focusin",b),document.addEventListener("focusout",S);const I=new MutationObserver(O);return p&&I.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",S),I.disconnect()}}},[c,p,M.paused]),x.useEffect(()=>{if(p){Ap.add(M);const b=document.activeElement;if(!p.contains(b)){const O=new CustomEvent(wc,Dp);p.addEventListener(wc,g),p.dispatchEvent(O),O.defaultPrevented||(Ey(Oy(Ah(p)),{select:!0}),document.activeElement===b&&Hr(p))}return()=>{p.removeEventListener(wc,g),setTimeout(()=>{const O=new CustomEvent(jc,Dp);p.addEventListener(jc,j),p.dispatchEvent(O),O.defaultPrevented||Hr(b??document.body,{select:!0}),p.removeEventListener(jc,j),Ap.remove(M)},0)}}},[p,g,j,M]);const z=x.useCallback(b=>{if(!i&&!c||M.paused)return;const S=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,O=document.activeElement;if(S&&O){const I=b.currentTarget,[B,F]=Py(I);B&&F?!b.shiftKey&&O===F?(b.preventDefault(),i&&Hr(B,{select:!0})):b.shiftKey&&O===B&&(b.preventDefault(),i&&Hr(F,{select:!0})):O===I&&b.preventDefault()}},[i,c,M.paused]);return r.jsx(it.div,{tabIndex:-1,...m,ref:_,onKeyDown:z})});Th.displayName=Cy;function Ey(s,{select:o=!1}={}){const i=document.activeElement;for(const c of s)if(Hr(c,{select:o}),document.activeElement!==i)return}function Py(s){const o=Ah(s),i=Tp(o,s),c=Tp(o.reverse(),s);return[i,c]}function Ah(s){const o=[],i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const u=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||u?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)o.push(i.currentNode);return o}function Tp(s,o){for(const i of s)if(!_y(i,{upTo:o}))return i}function _y(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 My(s){return s instanceof HTMLInputElement&&"select"in s}function Hr(s,{select:o=!1}={}){if(s&&s.focus){const i=document.activeElement;s.focus({preventScroll:!0}),s!==i&&My(s)&&o&&s.select()}}var Ap=Ry();function Ry(){let s=[];return{add(o){const i=s[0];o!==i&&(i==null||i.pause()),s=zp(s,o),s.unshift(o)},remove(o){var i;s=zp(s,o),(i=s[0])==null||i.resume()}}}function zp(s,o){const i=[...s],c=i.indexOf(o);return c!==-1&&i.splice(c,1),i}function Oy(s){return s.filter(o=>o.tagName!=="A")}var Dy="Portal",zh=x.forwardRef((s,o)=>{var p;const{container:i,...c}=s,[u,f]=x.useState(!1);Fo(()=>f(!0),[]);const m=i||u&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return m?Mh.createPortal(r.jsx(it.div,{...c,ref:o}),m):null});zh.displayName=Dy;function Ty(s,o){return x.useReducer((i,c)=>o[i][c]??i,s)}var wi=s=>{const{present:o,children:i}=s,c=Ay(o),u=typeof i=="function"?i({present:c.isPresent}):x.Children.only(i),f=zy(c.ref,Ly(u));return typeof i=="function"||c.isPresent?x.cloneElement(u,{ref:f}):null};wi.displayName="Presence";function Ay(s){const[o,i]=x.useState(),c=x.useRef(null),u=x.useRef(s),f=x.useRef("none"),m=s?"mounted":"unmounted",[p,v]=Ty(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const g=li(c.current);f.current=p==="mounted"?g:"none"},[p]),Fo(()=>{const g=c.current,j=u.current;if(j!==s){const _=f.current,M=li(g);s?v("MOUNT"):M==="none"||(g==null?void 0:g.display)==="none"?v("UNMOUNT"):v(j&&_!==M?"ANIMATION_OUT":"UNMOUNT"),u.current=s}},[s,v]),Fo(()=>{if(o){let g;const j=o.ownerDocument.defaultView??window,w=M=>{const b=li(c.current).includes(CSS.escape(M.animationName));if(M.target===o&&b&&(v("ANIMATION_END"),!u.current)){const S=o.style.animationFillMode;o.style.animationFillMode="forwards",g=j.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=S)})}},_=M=>{M.target===o&&(f.current=li(c.current))};return o.addEventListener("animationstart",_),o.addEventListener("animationcancel",w),o.addEventListener("animationend",w),()=>{j.clearTimeout(g),o.removeEventListener("animationstart",_),o.removeEventListener("animationcancel",w),o.removeEventListener("animationend",w)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:x.useCallback(g=>{c.current=g?getComputedStyle(g):null,i(g)},[])}}function Lp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function zy(...s){const o=x.useRef(s);return o.current=s,x.useCallback(i=>{const c=o.current;let u=!1;const f=c.map(m=>{const p=Lp(m,i);return!u&&typeof p=="function"&&(u=!0),p});if(u)return()=>{for(let m=0;m{rr||(rr={start:Fp(),end:Fp()});const{start:s,end:o}=rr;return document.body.firstElementChild!==s&&document.body.insertAdjacentElement("afterbegin",s),document.body.lastElementChild!==o&&document.body.insertAdjacentElement("beforeend",o),ii++,()=>{ii===1&&(rr==null||rr.start.remove(),rr==null||rr.end.remove(),rr=null),ii=Math.max(0,ii-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 lr=function(){return lr=Object.assign||function(o){for(var i,c=1,u=arguments.length;c"u")return tv;var o=rv(s),i=document.documentElement.clientWidth,c=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,c-i+o[2]-o[0])}},sv=Uh(),hs="data-scroll-locked",ov=function(s,o,i,c){var u=s.left,f=s.top,m=s.right,p=s.gap;return i===void 0&&(i="margin"),` .`.concat(Uy,` { overflow: hidden `).concat(c,`; padding-right: `).concat(p,"px ").concat(c,`; @@ -364,10 +364,10 @@ Error generating stack: `+d.message+` body[`).concat(hs,`] { `).concat($y,": ").concat(p,`px; } -`)},Up=function(){var s=parseInt(document.body.getAttribute(hs)||"0",10);return isFinite(s)?s:0},lv=function(){x.useEffect(function(){return document.body.setAttribute(hs,(Up()+1).toString()),function(){var s=Up()-1;s<=0?document.body.removeAttribute(hs):document.body.setAttribute(hs,s.toString())}},[])},iv=function(s){var o=s.noRelative,i=s.noImportant,c=s.gapMode,u=c===void 0?"margin":c;lv();var f=x.useMemo(function(){return nv(u)},[u]);return x.createElement(sv,{styles:ov(f,!o,u,i?"":"!important")})},Xc=!1;if(typeof window<"u")try{var ai=Object.defineProperty({},"passive",{get:function(){return Xc=!0,!0}});window.addEventListener("test",ai,ai),window.removeEventListener("test",ai,ai)}catch{Xc=!1}var as=Xc?{passive:!1}:!1,av=function(s){return s.tagName==="TEXTAREA"},$h=function(s,o){if(!(s instanceof Element))return!1;var i=window.getComputedStyle(s);return i[o]!=="hidden"&&!(i.overflowY===i.overflowX&&!av(s)&&i[o]==="visible")},cv=function(s){return $h(s,"overflowY")},dv=function(s){return $h(s,"overflowX")},$p=function(s,o){var i=o.ownerDocument,c=o;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var u=Bh(s,c);if(u){var f=Hh(s,c),m=f[1],p=f[2];if(m>p)return!0}c=c.parentNode}while(c&&c!==i.body);return!1},uv=function(s){var o=s.scrollTop,i=s.scrollHeight,c=s.clientHeight;return[o,i,c]},fv=function(s){var o=s.scrollLeft,i=s.scrollWidth,c=s.clientWidth;return[o,i,c]},Bh=function(s,o){return s==="v"?cv(o):dv(o)},Hh=function(s,o){return s==="v"?uv(o):fv(o)},pv=function(s,o){return s==="h"&&o==="rtl"?-1:1},hv=function(s,o,i,c,u){var f=pv(s,window.getComputedStyle(o).direction),m=f*c,p=i.target,v=o.contains(p),g=!1,j=m>0,w=0,_=0;do{if(!p)break;var M=Hh(s,p),L=M[0],b=M[1],S=M[2],O=b-S-f*L;(L||O)&&Bh(s,p)&&(w+=O,_+=L);var I=p.parentNode;p=I&&I.nodeType===Node.DOCUMENT_FRAGMENT_NODE?I.host:I}while(!v&&p!==document.body||v&&(o.contains(p)||o===p));return(j&&Math.abs(w)<1||!j&&Math.abs(_)<1)&&(g=!0),g},ci=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},Bp=function(s){return[s.deltaX,s.deltaY]},Hp=function(s){return s&&"current"in s?s.current:s},mv=function(s,o){return s[0]===o[0]&&s[1]===o[1]},xv=function(s){return` +`)},Up=function(){var s=parseInt(document.body.getAttribute(hs)||"0",10);return isFinite(s)?s:0},lv=function(){x.useEffect(function(){return document.body.setAttribute(hs,(Up()+1).toString()),function(){var s=Up()-1;s<=0?document.body.removeAttribute(hs):document.body.setAttribute(hs,s.toString())}},[])},iv=function(s){var o=s.noRelative,i=s.noImportant,c=s.gapMode,u=c===void 0?"margin":c;lv();var f=x.useMemo(function(){return nv(u)},[u]);return x.createElement(sv,{styles:ov(f,!o,u,i?"":"!important")})},Xc=!1;if(typeof window<"u")try{var ai=Object.defineProperty({},"passive",{get:function(){return Xc=!0,!0}});window.addEventListener("test",ai,ai),window.removeEventListener("test",ai,ai)}catch{Xc=!1}var as=Xc?{passive:!1}:!1,av=function(s){return s.tagName==="TEXTAREA"},$h=function(s,o){if(!(s instanceof Element))return!1;var i=window.getComputedStyle(s);return i[o]!=="hidden"&&!(i.overflowY===i.overflowX&&!av(s)&&i[o]==="visible")},cv=function(s){return $h(s,"overflowY")},dv=function(s){return $h(s,"overflowX")},$p=function(s,o){var i=o.ownerDocument,c=o;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var u=Bh(s,c);if(u){var f=Hh(s,c),m=f[1],p=f[2];if(m>p)return!0}c=c.parentNode}while(c&&c!==i.body);return!1},uv=function(s){var o=s.scrollTop,i=s.scrollHeight,c=s.clientHeight;return[o,i,c]},fv=function(s){var o=s.scrollLeft,i=s.scrollWidth,c=s.clientWidth;return[o,i,c]},Bh=function(s,o){return s==="v"?cv(o):dv(o)},Hh=function(s,o){return s==="v"?uv(o):fv(o)},pv=function(s,o){return s==="h"&&o==="rtl"?-1:1},hv=function(s,o,i,c,u){var f=pv(s,window.getComputedStyle(o).direction),m=f*c,p=i.target,v=o.contains(p),g=!1,j=m>0,w=0,_=0;do{if(!p)break;var M=Hh(s,p),z=M[0],b=M[1],S=M[2],O=b-S-f*z;(z||O)&&Bh(s,p)&&(w+=O,_+=z);var I=p.parentNode;p=I&&I.nodeType===Node.DOCUMENT_FRAGMENT_NODE?I.host:I}while(!v&&p!==document.body||v&&(o.contains(p)||o===p));return(j&&Math.abs(w)<1||!j&&Math.abs(_)<1)&&(g=!0),g},ci=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},Bp=function(s){return[s.deltaX,s.deltaY]},Hp=function(s){return s&&"current"in s?s.current:s},mv=function(s,o){return s[0]===o[0]&&s[1]===o[1]},xv=function(s){return` .block-interactivity-`.concat(s,` {pointer-events: none;} .allow-interactivity-`).concat(s,` {pointer-events: all;} -`)},gv=0,cs=[];function yv(s){var o=x.useRef([]),i=x.useRef([0,0]),c=x.useRef(),u=x.useState(gv++)[0],f=x.useState(Uh)[0],m=x.useRef(s);x.useEffect(function(){m.current=s},[s]),x.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(u));var b=Iy([s.lockRef.current],(s.shards||[]).map(Hp),!0).filter(Boolean);return b.forEach(function(S){return S.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),b.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(u))})}}},[s.inert,s.lockRef.current,s.shards]);var p=x.useCallback(function(b,S){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!m.current.allowPinchZoom;var O=ci(b),I=i.current,B="deltaX"in b?b.deltaX:I[0]-O[0],F="deltaY"in b?b.deltaY:I[1]-O[1],D,$=b.target,H=Math.abs(B)>Math.abs(F)?"h":"v";if("touches"in b&&H==="h"&&$.type==="range")return!1;var ae=window.getSelection(),te=ae&&ae.anchorNode,fe=te?te===$||te.contains($):!1;if(fe)return!1;var ke=$p(H,$);if(!ke)return!0;if(ke?D=H:(D=H==="v"?"h":"v",ke=$p(H,$)),!ke)return!1;if(!c.current&&"changedTouches"in b&&(B||F)&&(c.current=D),!D)return!0;var ue=c.current||D;return hv(ue,S,b,ue==="h"?B:F)},[]),v=x.useCallback(function(b){var S=b;if(!(!cs.length||cs[cs.length-1]!==f)){var O="deltaY"in S?Bp(S):ci(S),I=o.current.filter(function(D){return D.name===S.type&&(D.target===S.target||S.target===D.shadowParent)&&mv(D.delta,O)})[0];if(I&&I.should){S.cancelable&&S.preventDefault();return}if(!I){var B=(m.current.shards||[]).map(Hp).filter(Boolean).filter(function(D){return D.contains(S.target)}),F=B.length>0?p(S,B[0]):!m.current.noIsolation;F&&S.cancelable&&S.preventDefault()}}},[]),g=x.useCallback(function(b,S,O,I){var B={name:b,delta:S,target:O,should:I,shadowParent:vv(O)};o.current.push(B),setTimeout(function(){o.current=o.current.filter(function(F){return F!==B})},1)},[]),j=x.useCallback(function(b){i.current=ci(b),c.current=void 0},[]),w=x.useCallback(function(b){g(b.type,Bp(b),b.target,p(b,s.lockRef.current))},[]),_=x.useCallback(function(b){g(b.type,ci(b),b.target,p(b,s.lockRef.current))},[]);x.useEffect(function(){return cs.push(f),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:_}),document.addEventListener("wheel",v,as),document.addEventListener("touchmove",v,as),document.addEventListener("touchstart",j,as),function(){cs=cs.filter(function(b){return b!==f}),document.removeEventListener("wheel",v,as),document.removeEventListener("touchmove",v,as),document.removeEventListener("touchstart",j,as)}},[]);var M=s.removeScrollBar,L=s.inert;return x.createElement(x.Fragment,null,L?x.createElement(f,{styles:xv(u)}):null,M?x.createElement(iv,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function vv(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const bv=Qy(Ih,yv);var Vh=x.forwardRef(function(s,o){return x.createElement(ji,lr({},s,{ref:o,sideCar:bv}))});Vh.classNames=ji.classNames;var wv=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},ds=new WeakMap,di=new WeakMap,ui={},Cc=0,Wh=function(s){return s&&(s.host||Wh(s.parentNode))},jv=function(s,o){return o.map(function(i){if(s.contains(i))return i;var c=Wh(i);return c&&s.contains(c)?c:(console.error("aria-hidden",i,"in not contained inside",s,". Doing nothing"),null)}).filter(function(i){return!!i})},kv=function(s,o,i,c){var u=jv(o,Array.isArray(s)?s:[s]);ui[i]||(ui[i]=new WeakMap);var f=ui[i],m=[],p=new Set,v=new Set(u),g=function(w){!w||p.has(w)||(p.add(w),g(w.parentNode))};u.forEach(g);var j=function(w){!w||v.has(w)||Array.prototype.forEach.call(w.children,function(_){if(p.has(_))j(_);else try{var M=_.getAttribute(c),L=M!==null&&M!=="false",b=(ds.get(_)||0)+1,S=(f.get(_)||0)+1;ds.set(_,b),f.set(_,S),m.push(_),b===1&&L&&di.set(_,!0),S===1&&_.setAttribute(i,"true"),L||_.setAttribute(c,"true")}catch(O){console.error("aria-hidden: cannot operate on ",_,O)}})};return j(o),p.clear(),Cc++,function(){m.forEach(function(w){var _=ds.get(w)-1,M=f.get(w)-1;ds.set(w,_),f.set(w,M),_||(di.has(w)||w.removeAttribute(c),di.delete(w)),M||w.removeAttribute(i)}),Cc--,Cc||(ds=new WeakMap,ds=new WeakMap,di=new WeakMap,ui={})}},Nv=function(s,o,i){i===void 0&&(i="data-aria-hidden");var c=Array.from(Array.isArray(s)?s:[s]),u=wv(s);return u?(c.push.apply(c,Array.from(u.querySelectorAll("[aria-live], script"))),kv(c,u,i,"aria-hidden")):function(){return null}},ki="Dialog",[Gh]=J0(ki),[Sv,qt]=Gh(ki),Kh=s=>{const{__scopeDialog:o,children:i,open:c,defaultOpen:u,onOpenChange:f,modal:m=!0}=s,p=x.useRef(null),v=x.useRef(null),[g,j]=ny({prop:c,defaultProp:u??!1,onChange:f,caller:ki});return r.jsx(Sv,{scope:o,triggerRef:p,contentRef:v,contentId:br(),titleId:br(),descriptionId:br(),open:g,onOpenChange:j,onOpenToggle:x.useCallback(()=>j(w=>!w),[j]),modal:m,children:i})};Kh.displayName=ki;var Qh="DialogTrigger",Cv=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(Qh,i),f=On(o,u.triggerRef);return r.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":pd(u.open),...c,ref:f,onClick:en(s.onClick,u.onOpenToggle)})});Cv.displayName=Qh;var fd="DialogPortal",[Ev,qh]=Gh(fd,{forceMount:void 0}),Zh=s=>{const{__scopeDialog:o,forceMount:i,children:c,container:u}=s,f=qt(fd,o);return r.jsx(Ev,{scope:o,forceMount:i,children:x.Children.map(c,m=>r.jsx(wi,{present:i||f.open,children:r.jsx(zh,{asChild:!0,container:u,children:m})}))})};Zh.displayName=fd;var bi="DialogOverlay",Yh=x.forwardRef((s,o)=>{const i=qh(bi,s.__scopeDialog),{forceMount:c=i.forceMount,...u}=s,f=qt(bi,s.__scopeDialog);return f.modal?r.jsx(wi,{present:c||f.open,children:r.jsx(_v,{...u,ref:o})}):null});Yh.displayName=bi;var Pv=Rh("DialogOverlay.RemoveScroll"),_v=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(bi,i),f=ky(),m=On(o,f);return r.jsx(Vh,{as:Pv,allowPinchZoom:!0,shards:[u.contentRef],children:r.jsx(it.div,{"data-state":pd(u.open),...c,ref:m,style:{pointerEvents:"auto",...c.style}})})}),Os="DialogContent",Jh=x.forwardRef((s,o)=>{const i=qh(Os,s.__scopeDialog),{forceMount:c=i.forceMount,...u}=s,f=qt(Os,s.__scopeDialog);return r.jsx(wi,{present:c||f.open,children:f.modal?r.jsx(Mv,{...u,ref:o}):r.jsx(Rv,{...u,ref:o})})});Jh.displayName=Os;var Mv=x.forwardRef((s,o)=>{const i=qt(Os,s.__scopeDialog),c=x.useRef(null),u=On(o,i.contentRef,c);return x.useEffect(()=>{const f=c.current;if(f)return Nv(f)},[]),r.jsx(Xh,{...s,ref:u,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:en(s.onCloseAutoFocus,f=>{var m;f.preventDefault(),(m=i.triggerRef.current)==null||m.focus()}),onPointerDownOutside:en(s.onPointerDownOutside,f=>{const m=f.detail.originalEvent,p=m.button===0&&m.ctrlKey===!0;(m.button===2||p)&&f.preventDefault()}),onFocusOutside:en(s.onFocusOutside,f=>f.preventDefault())})}),Rv=x.forwardRef((s,o)=>{const i=qt(Os,s.__scopeDialog),c=x.useRef(!1),u=x.useRef(!1);return r.jsx(Xh,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var m,p;(m=s.onCloseAutoFocus)==null||m.call(s,f),f.defaultPrevented||(c.current||(p=i.triggerRef.current)==null||p.focus(),f.preventDefault()),c.current=!1,u.current=!1},onInteractOutside:f=>{var v,g;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(c.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const m=f.target;((g=i.triggerRef.current)==null?void 0:g.contains(m))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})}),Xh=x.forwardRef((s,o)=>{const{__scopeDialog:i,trapFocus:c,onOpenAutoFocus:u,onCloseAutoFocus:f,...m}=s,p=qt(Os,i);return Fy(),r.jsx(r.Fragment,{children:r.jsx(Th,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:u,onUnmountAutoFocus:f,children:r.jsx(Oh,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":pd(p.open),...m,ref:o,deferPointerDownOutside:!0,onDismiss:()=>p.onOpenChange(!1)})})})}),em="DialogTitle",Ov=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(em,i);return r.jsx(it.h2,{id:u.titleId,...c,ref:o})});Ov.displayName=em;var tm="DialogDescription",Dv=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(tm,i);return r.jsx(it.p,{id:u.descriptionId,...c,ref:o})});Dv.displayName=tm;var rm="DialogClose",Tv=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(rm,i);return r.jsx(it.button,{type:"button",...c,ref:o,onClick:en(s.onClick,()=>u.onOpenChange(!1))})});Tv.displayName=rm;function pd(s){return s?"open":"closed"}var Co='[cmdk-group=""]',Ec='[cmdk-group-items=""]',Av='[cmdk-group-heading=""]',nm='[cmdk-item=""]',Vp=`${nm}:not([aria-disabled="true"])`,ed="cmdk-item-select",fs="data-value",zv=(s,o,i)=>Y0(s,o,i),sm=x.createContext(void 0),Ko=()=>x.useContext(sm),om=x.createContext(void 0),hd=()=>x.useContext(om),lm=x.createContext(void 0),im=x.forwardRef((s,o)=>{let i=ps(()=>{var C,Z;return{search:"",value:(Z=(C=s.value)!=null?C:s.defaultValue)!=null?Z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=ps(()=>new Set),u=ps(()=>new Map),f=ps(()=>new Map),m=ps(()=>new Set),p=am(s),{label:v,children:g,value:j,onValueChange:w,filter:_,shouldFilter:M,loop:L,disablePointerSelection:b=!1,vimBindings:S=!0,...O}=s,I=br(),B=br(),F=br(),D=x.useRef(null),$=Kv();Rn(()=>{if(j!==void 0){let C=j.trim();i.current.value=C,H.emit()}},[j]),Rn(()=>{$(6,ze)},[]);let H=x.useMemo(()=>({subscribe:C=>(m.current.add(C),()=>m.current.delete(C)),snapshot:()=>i.current,setState:(C,Z,X)=>{var q,le,pe,ve;if(!Object.is(i.current[C],Z)){if(i.current[C]=Z,C==="search")ue(),fe(),$(1,ke);else if(C==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(F);U?U.focus():(q=document.getElementById(I))==null||q.focus()}if($(7,()=>{var U;i.current.selectedItemId=(U=Ce())==null?void 0:U.id,H.emit()}),X||$(5,ze),((le=p.current)==null?void 0:le.value)!==void 0){let U=Z??"";(ve=(pe=p.current).onValueChange)==null||ve.call(pe,U);return}}H.emit()}},emit:()=>{m.current.forEach(C=>C())}}),[]),ae=x.useMemo(()=>({value:(C,Z,X)=>{var q;Z!==((q=f.current.get(C))==null?void 0:q.value)&&(f.current.set(C,{value:Z,keywords:X}),i.current.filtered.items.set(C,te(Z,X)),$(2,()=>{fe(),H.emit()}))},item:(C,Z)=>(c.current.add(C),Z&&(u.current.has(Z)?u.current.get(Z).add(C):u.current.set(Z,new Set([C]))),$(3,()=>{ue(),fe(),i.current.value||ke(),H.emit()}),()=>{f.current.delete(C),c.current.delete(C),i.current.filtered.items.delete(C);let X=Ce();$(4,()=>{ue(),(X==null?void 0:X.getAttribute("id"))===C&&ke(),H.emit()})}),group:C=>(u.current.has(C)||u.current.set(C,new Set),()=>{f.current.delete(C),u.current.delete(C)}),filter:()=>p.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:I,inputId:F,labelId:B,listInnerRef:D}),[]);function te(C,Z){var X,q;let le=(q=(X=p.current)==null?void 0:X.filter)!=null?q:zv;return C?le(C,i.current.search,Z):0}function fe(){if(!i.current.search||p.current.shouldFilter===!1)return;let C=i.current.filtered.items,Z=[];i.current.filtered.groups.forEach(q=>{let le=u.current.get(q),pe=0;le.forEach(ve=>{let U=C.get(ve);pe=Math.max(U,pe)}),Z.push([q,pe])});let X=D.current;Le().sort((q,le)=>{var pe,ve;let U=q.getAttribute("id"),me=le.getAttribute("id");return((pe=C.get(me))!=null?pe:0)-((ve=C.get(U))!=null?ve:0)}).forEach(q=>{let le=q.closest(Ec);le?le.appendChild(q.parentElement===le?q:q.closest(`${Ec} > *`)):X.appendChild(q.parentElement===X?q:q.closest(`${Ec} > *`))}),Z.sort((q,le)=>le[1]-q[1]).forEach(q=>{var le;let pe=(le=D.current)==null?void 0:le.querySelector(`${Co}[${fs}="${encodeURIComponent(q[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function ke(){let C=Le().find(X=>X.getAttribute("aria-disabled")!=="true"),Z=C==null?void 0:C.getAttribute(fs);H.setState("value",Z||void 0)}function ue(){var C,Z,X,q;if(!i.current.search||p.current.shouldFilter===!1){i.current.filtered.count=c.current.size;return}i.current.filtered.groups=new Set;let le=0;for(let pe of c.current){let ve=(Z=(C=f.current.get(pe))==null?void 0:C.value)!=null?Z:"",U=(q=(X=f.current.get(pe))==null?void 0:X.keywords)!=null?q:[],me=te(ve,U);i.current.filtered.items.set(pe,me),me>0&&le++}for(let[pe,ve]of u.current)for(let U of ve)if(i.current.filtered.items.get(U)>0){i.current.filtered.groups.add(pe);break}i.current.filtered.count=le}function ze(){var C,Z,X;let q=Ce();q&&(((C=q.parentElement)==null?void 0:C.firstChild)===q&&((X=(Z=q.closest(Co))==null?void 0:Z.querySelector(Av))==null||X.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function Ce(){var C;return(C=D.current)==null?void 0:C.querySelector(`${nm}[aria-selected="true"]`)}function Le(){var C;return Array.from(((C=D.current)==null?void 0:C.querySelectorAll(Vp))||[])}function Ee(C){let Z=Le()[C];Z&&H.setState("value",Z.getAttribute(fs))}function Pe(C){var Z;let X=Ce(),q=Le(),le=q.findIndex(ve=>ve===X),pe=q[le+C];(Z=p.current)!=null&&Z.loop&&(pe=le+C<0?q[q.length-1]:le+C===q.length?q[0]:q[le+C]),pe&&H.setState("value",pe.getAttribute(fs))}function K(C){let Z=Ce(),X=Z==null?void 0:Z.closest(Co),q;for(;X&&!q;)X=C>0?Wv(X,Co):Gv(X,Co),q=X==null?void 0:X.querySelector(Vp);q?H.setState("value",q.getAttribute(fs)):Pe(C)}let ee=()=>Ee(Le().length-1),Y=C=>{C.preventDefault(),C.metaKey?ee():C.altKey?K(1):Pe(1)},P=C=>{C.preventDefault(),C.metaKey?Ee(0):C.altKey?K(-1):Pe(-1)};return x.createElement(it.div,{ref:o,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:C=>{var Z;(Z=O.onKeyDown)==null||Z.call(O,C);let X=C.nativeEvent.isComposing||C.keyCode===229;if(!(C.defaultPrevented||X))switch(C.key){case"n":case"j":{S&&C.ctrlKey&&Y(C);break}case"ArrowDown":{Y(C);break}case"p":case"k":{S&&C.ctrlKey&&P(C);break}case"ArrowUp":{P(C);break}case"Home":{C.preventDefault(),Ee(0);break}case"End":{C.preventDefault(),ee();break}case"Enter":{C.preventDefault();let q=Ce();if(q){let le=new Event(ed);q.dispatchEvent(le)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:ae.inputId,id:ae.labelId,style:qv},v),Ni(s,C=>x.createElement(om.Provider,{value:H},x.createElement(sm.Provider,{value:ae},C))))}),Lv=x.forwardRef((s,o)=>{var i,c;let u=br(),f=x.useRef(null),m=x.useContext(lm),p=Ko(),v=am(s),g=(c=(i=v.current)==null?void 0:i.forceMount)!=null?c:m==null?void 0:m.forceMount;Rn(()=>{if(!g)return p.item(u,m==null?void 0:m.id)},[g]);let j=cm(u,f,[s.value,s.children,f],s.keywords),w=hd(),_=tn($=>$.value&&$.value===j.current),M=tn($=>g||p.filter()===!1?!0:$.search?$.filtered.items.get(u)>0:!0);x.useEffect(()=>{let $=f.current;if(!(!$||s.disabled))return $.addEventListener(ed,L),()=>$.removeEventListener(ed,L)},[M,s.onSelect,s.disabled]);function L(){var $,H;b(),(H=($=v.current).onSelect)==null||H.call($,j.current)}function b(){w.setState("value",j.current,!0)}if(!M)return null;let{disabled:S,value:O,onSelect:I,forceMount:B,keywords:F,...D}=s;return x.createElement(it.div,{ref:Rs(f,o),...D,id:u,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!_,"data-disabled":!!S,"data-selected":!!_,onPointerMove:S||p.getDisablePointerSelection()?void 0:b,onClick:S?void 0:L},s.children)}),Fv=x.forwardRef((s,o)=>{let{heading:i,children:c,forceMount:u,...f}=s,m=br(),p=x.useRef(null),v=x.useRef(null),g=br(),j=Ko(),w=tn(M=>u||j.filter()===!1?!0:M.search?M.filtered.groups.has(m):!0);Rn(()=>j.group(m),[]),cm(m,p,[s.value,s.heading,v]);let _=x.useMemo(()=>({id:m,forceMount:u}),[u]);return x.createElement(it.div,{ref:Rs(p,o),...f,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0},i&&x.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:g},i),Ni(s,M=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?g:void 0},x.createElement(lm.Provider,{value:_},M))))}),Iv=x.forwardRef((s,o)=>{let{alwaysRender:i,...c}=s,u=x.useRef(null),f=tn(m=>!m.search);return!i&&!f?null:x.createElement(it.div,{ref:Rs(u,o),...c,"cmdk-separator":"",role:"separator"})}),Uv=x.forwardRef((s,o)=>{let{onValueChange:i,...c}=s,u=s.value!=null,f=hd(),m=tn(g=>g.search),p=tn(g=>g.selectedItemId),v=Ko();return x.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),x.createElement(it.input,{ref:o,...c,"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":p,id:v.inputId,type:"text",value:u?s.value:m,onChange:g=>{u||f.setState("search",g.target.value),i==null||i(g.target.value)}})}),$v=x.forwardRef((s,o)=>{let{children:i,label:c="Suggestions",...u}=s,f=x.useRef(null),m=x.useRef(null),p=tn(g=>g.selectedItemId),v=Ko();return x.useEffect(()=>{if(m.current&&f.current){let g=m.current,j=f.current,w,_=new ResizeObserver(()=>{w=requestAnimationFrame(()=>{let M=g.offsetHeight;j.style.setProperty("--cmdk-list-height",M.toFixed(1)+"px")})});return _.observe(g),()=>{cancelAnimationFrame(w),_.unobserve(g)}}},[]),x.createElement(it.div,{ref:Rs(f,o),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":c,id:v.listId},Ni(s,g=>x.createElement("div",{ref:Rs(m,v.listInnerRef),"cmdk-list-sizer":""},g)))}),Bv=x.forwardRef((s,o)=>{let{open:i,onOpenChange:c,overlayClassName:u,contentClassName:f,container:m,...p}=s;return x.createElement(Kh,{open:i,onOpenChange:c},x.createElement(Zh,{container:m},x.createElement(Yh,{"cmdk-overlay":"",className:u}),x.createElement(Jh,{"aria-label":s.label,"cmdk-dialog":"",className:f},x.createElement(im,{ref:o,...p}))))}),Hv=x.forwardRef((s,o)=>tn(i=>i.filtered.count===0)?x.createElement(it.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Vv=x.forwardRef((s,o)=>{let{progress:i,children:c,label:u="Loading...",...f}=s;return x.createElement(it.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},Ni(s,m=>x.createElement("div",{"aria-hidden":!0},m)))}),us=Object.assign(im,{List:$v,Item:Lv,Input:Uv,Group:Fv,Separator:Iv,Dialog:Bv,Empty:Hv,Loading:Vv});function Wv(s,o){let i=s.nextElementSibling;for(;i;){if(i.matches(o))return i;i=i.nextElementSibling}}function Gv(s,o){let i=s.previousElementSibling;for(;i;){if(i.matches(o))return i;i=i.previousElementSibling}}function am(s){let o=x.useRef(s);return Rn(()=>{o.current=s}),o}var Rn=typeof window>"u"?x.useEffect:x.useLayoutEffect;function ps(s){let o=x.useRef();return o.current===void 0&&(o.current=s()),o}function tn(s){let o=hd(),i=()=>s(o.snapshot());return x.useSyncExternalStore(o.subscribe,i,i)}function cm(s,o,i,c=[]){let u=x.useRef(),f=Ko();return Rn(()=>{var m;let p=(()=>{var g;for(let j of i){if(typeof j=="string")return j.trim();if(typeof j=="object"&&"current"in j)return j.current?(g=j.current.textContent)==null?void 0:g.trim():u.current}})(),v=c.map(g=>g.trim());f.value(s,p,v),(m=o.current)==null||m.setAttribute(fs,p),u.current=p}),u}var Kv=()=>{let[s,o]=x.useState(),i=ps(()=>new Map);return Rn(()=>{i.current.forEach(c=>c()),i.current=new Map},[s]),(c,u)=>{i.current.set(c,u),o({})}};function Qv(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&&x.isValidElement(o)?x.cloneElement(Qv(o),{ref:o.ref},i(o.props.children)):i(o)}var qv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Zv({onNavigate:s}){const[o,i]=x.useState(!1);return x.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key.toLowerCase()==="k"&&(u.preventDefault(),i(f=>!f))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),r.jsx(us.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:r.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:c=>c.stopPropagation(),children:[r.jsx(us.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"}),r.jsxs(us.List,{className:"max-h-80 overflow-y-auto p-2",children:[r.jsx(us.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),r.jsx(us.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Zc.map(c=>r.jsxs(us.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{s(c.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:[r.jsx(c.icon,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:c.label}),r.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function we(s,o){var v;const i={"Content-Type":"application/json",...o==null?void 0:o.headers},c=localStorage.getItem("mc_sudo_password"),u=localStorage.getItem("mc_hf_token");c&&(i["X-Sudo-Password"]=c);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 g=JSON.parse(f);let j=!1;c&&!("sudo_password"in g)&&(g.sudo_password=c,j=!0),u&&!("hf_token"in g)&&(g.hf_token=u,j=!0),j&&(f=JSON.stringify(g))}catch{}else if(!f){const g={};c&&(g.sudo_password=c),u&&(g.hf_token=u),Object.keys(g).length>0&&(f=JSON.stringify(g))}}const p=await fetch(s,{...o,headers:i,body:f});if(!p.ok)throw new Error(`${p.status} ${p.statusText}`);return p.json()}const Ye={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??""]},Yv=()=>Ut({queryKey:Ye.health,queryFn:()=>we("/api/health"),refetchInterval:1e4}),md=(s=5e3)=>Ut({queryKey:Ye.systemStatus,queryFn:()=>we("/api/system/status"),refetchInterval:s}),Jv=(s=3e3)=>Ut({queryKey:Ye.services,queryFn:()=>we("/api/system/services"),refetchInterval:s}),Ds=(s=4e3)=>Ut({queryKey:Ye.models,queryFn:()=>we("/api/models"),refetchInterval:s}),Xv=(s=4e3)=>Ut({queryKey:Ye.routing,queryFn:()=>we("/api/routing"),refetchInterval:s}),dm=(s=2e3)=>Ut({queryKey:Ye.jobs,queryFn:()=>we("/api/jobs"),refetchInterval:s,select:o=>o.jobs??[]}),um=(s=3e3)=>Ut({queryKey:Ye.tokenStats,queryFn:()=>we("/api/system/token-stats"),refetchInterval:s}),fm=(s=5e3)=>Ut({queryKey:Ye.agentStatus,queryFn:()=>we("/api/agent/status"),refetchInterval:s}),xd=s=>Ut({queryKey:Ye.updates,queryFn:()=>we("/api/maintenance/updates"),refetchInterval:s}),eb=()=>Ut({queryKey:Ye.discover,queryFn:()=>we("/api/discover")}),pm=s=>Ut({queryKey:Ye.connect(s),queryFn:()=>we(s?`/api/connect?${s}`:"/api/connect")}),hm=s=>Ut({queryKey:Ye.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),we(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function St(s){return(s/1024**3).toFixed(1)}function td(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function Vr(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function tb(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Wp(s){return s?`${Math.round(s/1024)}k`:"—"}function mm(s){var o,i,c="";if(typeof s=="string"||typeof s=="number")c+=s;else if(typeof s=="object")if(Array.isArray(s)){var u=s.length;for(o=0;o{const o=ob(s),{conflictingClassGroups:i,conflictingClassGroupModifiers:c}=s;return{getClassGroupId:m=>{const p=m.split(gd);return p[0]===""&&p.length!==1&&p.shift(),xm(p,o)||sb(m)},getConflictingClassGroupIds:(m,p)=>{const v=i[m]||[];return p&&c[m]?[...v,...c[m]]:v}}},xm=(s,o)=>{var m;if(s.length===0)return o.classGroupId;const i=s[0],c=o.nextPart.get(i),u=c?xm(s.slice(1),c):void 0;if(u)return u;if(o.validators.length===0)return;const f=s.join(gd);return(m=o.validators.find(({validator:p})=>p(f)))==null?void 0:m.classGroupId},Gp=/^\[(.+)\]$/,sb=s=>{if(Gp.test(s)){const o=Gp.exec(s)[1],i=o==null?void 0:o.substring(0,o.indexOf(":"));if(i)return"arbitrary.."+i}},ob=s=>{const{theme:o,prefix:i}=s,c={nextPart:new Map,validators:[]};return ib(Object.entries(s.classGroups),i).forEach(([f,m])=>{rd(m,c,f,o)}),c},rd=(s,o,i,c)=>{s.forEach(u=>{if(typeof u=="string"){const f=u===""?o:Kp(o,u);f.classGroupId=i;return}if(typeof u=="function"){if(lb(u)){rd(u(c),o,i,c);return}o.validators.push({validator:u,classGroupId:i});return}Object.entries(u).forEach(([f,m])=>{rd(m,Kp(o,f),i,c)})})},Kp=(s,o)=>{let i=s;return o.split(gd).forEach(c=>{i.nextPart.has(c)||i.nextPart.set(c,{nextPart:new Map,validators:[]}),i=i.nextPart.get(c)}),i},lb=s=>s.isThemeGetter,ib=(s,o)=>o?s.map(([i,c])=>{const u=c.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([m,p])=>[o+m,p])):f);return[i,u]}):s,ab=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,i=new Map,c=new Map;const u=(f,m)=>{i.set(f,m),o++,o>s&&(o=0,c=i,i=new Map)};return{get(f){let m=i.get(f);if(m!==void 0)return m;if((m=c.get(f))!==void 0)return u(f,m),m},set(f,m){i.has(f)?i.set(f,m):u(f,m)}}},gm="!",cb=s=>{const{separator:o,experimentalParseClassName:i}=s,c=o.length===1,u=o[0],f=o.length,m=p=>{const v=[];let g=0,j=0,w;for(let S=0;Sj?w-j:void 0;return{modifiers:v,hasImportantModifier:M,baseClassName:L,maybePostfixModifierPosition:b}};return i?p=>i({className:p,parseClassName:m}):m},db=s=>{if(s.length<=1)return s;const o=[];let i=[];return s.forEach(c=>{c[0]==="["?(o.push(...i.sort(),c),i=[]):i.push(c)}),o.push(...i.sort()),o},ub=s=>({cache:ab(s.cacheSize),parseClassName:cb(s),...nb(s)}),fb=/\s+/,pb=(s,o)=>{const{parseClassName:i,getClassGroupId:c,getConflictingClassGroupIds:u}=o,f=[],m=s.trim().split(fb);let p="";for(let v=m.length-1;v>=0;v-=1){const g=m[v],{modifiers:j,hasImportantModifier:w,baseClassName:_,maybePostfixModifierPosition:M}=i(g);let L=!!M,b=c(L?_.substring(0,M):_);if(!b){if(!L){p=g+(p.length>0?" "+p:p);continue}if(b=c(_),!b){p=g+(p.length>0?" "+p:p);continue}L=!1}const S=db(j).join(":"),O=w?S+gm:S,I=O+b;if(f.includes(I))continue;f.push(I);const B=u(b,L);for(let F=0;F0?" "+p:p)}return p};function hb(){let s=0,o,i,c="";for(;s{if(typeof s=="string")return s;let o,i="";for(let c=0;cw(j),s());return i=ub(g),c=i.cache.get,u=i.cache.set,f=p,p(v)}function p(v){const g=c(v);if(g)return g;const j=pb(v,i);return u(v,j),j}return function(){return f(hb.apply(null,arguments))}}const $e=s=>{const o=i=>i[s]||[];return o.isThemeGetter=!0,o},vm=/^\[(?:([a-z-]+):)?(.+)\]$/i,xb=/^\d+\/\d+$/,gb=new Set(["px","full","screen"]),yb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vb=/\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$/,bb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xr=s=>ms(s)||gb.has(s)||xb.test(s),Ur=s=>Ts(s,"length",Mb),ms=s=>!!s&&!Number.isNaN(Number(s)),Pc=s=>Ts(s,"number",ms),Eo=s=>!!s&&Number.isInteger(Number(s)),kb=s=>s.endsWith("%")&&ms(s.slice(0,-1)),Ne=s=>vm.test(s),$r=s=>yb.test(s),Nb=new Set(["length","size","percentage"]),Sb=s=>Ts(s,Nb,bm),Cb=s=>Ts(s,"position",bm),Eb=new Set(["image","url"]),Pb=s=>Ts(s,Eb,Ob),_b=s=>Ts(s,"",Rb),Po=()=>!0,Ts=(s,o,i)=>{const c=vm.exec(s);return c?c[1]?typeof o=="string"?c[1]===o:o.has(c[1]):i(c[2]):!1},Mb=s=>vb.test(s)&&!bb.test(s),bm=()=>!1,Rb=s=>wb.test(s),Ob=s=>jb.test(s),Db=()=>{const s=$e("colors"),o=$e("spacing"),i=$e("blur"),c=$e("brightness"),u=$e("borderColor"),f=$e("borderRadius"),m=$e("borderSpacing"),p=$e("borderWidth"),v=$e("contrast"),g=$e("grayscale"),j=$e("hueRotate"),w=$e("invert"),_=$e("gap"),M=$e("gradientColorStops"),L=$e("gradientColorStopPositions"),b=$e("inset"),S=$e("margin"),O=$e("opacity"),I=$e("padding"),B=$e("saturate"),F=$e("scale"),D=$e("sepia"),$=$e("skew"),H=$e("space"),ae=$e("translate"),te=()=>["auto","contain","none"],fe=()=>["auto","hidden","clip","visible","scroll"],ke=()=>["auto",Ne,o],ue=()=>[Ne,o],ze=()=>["",xr,Ur],Ce=()=>["auto",ms,Ne],Le=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Ee=()=>["solid","dashed","dotted","double","none"],Pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],ee=()=>["","0",Ne],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[ms,Ne];return{cacheSize:500,separator:":",theme:{colors:[Po],spacing:[xr,Ur],blur:["none","",$r,Ne],brightness:P(),borderColor:[s],borderRadius:["none","","full",$r,Ne],borderSpacing:ue(),borderWidth:ze(),contrast:P(),grayscale:ee(),hueRotate:P(),invert:ee(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[kb,Ur],inset:ke(),margin:ke(),opacity:P(),padding:ue(),saturate:P(),scale:P(),sepia:ee(),skew:P(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[$r]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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:[...Le(),Ne]}],overflow:[{overflow:fe()}],"overflow-x":[{"overflow-x":fe()}],"overflow-y":[{"overflow-y":fe()}],overscroll:[{overscroll:te()}],"overscroll-x":[{"overscroll-x":te()}],"overscroll-y":[{"overscroll-y":te()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Eo,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:ee()}],shrink:[{shrink:ee()}],order:[{order:["first","last","none",Eo,Ne]}],"grid-cols":[{"grid-cols":[Po]}],"col-start-end":[{col:["auto",{span:["full",Eo,Ne]},Ne]}],"col-start":[{"col-start":Ce()}],"col-end":[{"col-end":Ce()}],"grid-rows":[{"grid-rows":[Po]}],"row-start-end":[{row:["auto",{span:[Eo,Ne]},Ne]}],"row-start":[{"row-start":Ce()}],"row-end":[{"row-end":Ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ne]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],pt:[{pt:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"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:[$r]},$r]}],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",$r,Ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pc]}],"font-family":[{font:[Po]}],"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",ms,Pc]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",xr,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":[O]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[O]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ee(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",xr,Ur]}],"underline-offset":[{"underline-offset":["auto",xr,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":[O]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Le(),Cb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Sb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Pb]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[L]}],"gradient-via-pos":[{via:[L]}],"gradient-to-pos":[{to:[L]}],"gradient-from":[{from:[M]}],"gradient-via":[{via:[M]}],"gradient-to":[{to:[M]}],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:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[O]}],"border-style":[{border:[...Ee(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[O]}],"divide-style":[{divide:Ee()}],"border-color":[{border:[u]}],"border-color-x":[{"border-x":[u]}],"border-color-y":[{"border-y":[u]}],"border-color-s":[{"border-s":[u]}],"border-color-e":[{"border-e":[u]}],"border-color-t":[{"border-t":[u]}],"border-color-r":[{"border-r":[u]}],"border-color-b":[{"border-b":[u]}],"border-color-l":[{"border-l":[u]}],"divide-color":[{divide:[u]}],"outline-style":[{outline:["",...Ee()]}],"outline-offset":[{"outline-offset":[xr,Ne]}],"outline-w":[{outline:[xr,Ur]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:ze()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[O]}],"ring-offset-w":[{"ring-offset":[xr,Ur]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",$r,_b]}],"shadow-color":[{shadow:[Po]}],opacity:[{opacity:[O]}],"mix-blend":[{"mix-blend":[...Pe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Pe()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[c]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",$r,Ne]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[j]}],invert:[{invert:[w]}],saturate:[{saturate:[B]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[O]}],"backdrop-saturate":[{"backdrop-saturate":[B]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"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:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[Eo,Ne]}],"translate-x":[{"translate-x":[ae]}],"translate-y":[{"translate-y":[ae]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"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:[xr,Ur,Pc]}],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"]}}},Tb=mb(Db);function J(...s){return Tb(rb(s))}function Uo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const Ab={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",reasoning:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"};function zb(){const{data:s}=Ds(2e3),{data:o}=um(2e3),i=(s==null?void 0:s.models)??[],c=(s==null?void 0:s.running)??[],u=i.filter(v=>c.includes(v.name)),f=x.useRef(null),[m,p]=x.useState(!1);return x.useEffect(()=>{if(!o)return;const v=o.total_tokens;if(f.current!==null&&v>f.current){p(!0);const g=setTimeout(()=>p(!1),4e3);return f.current=v,()=>clearTimeout(g)}f.current=v},[o==null?void 0:o.total_tokens]),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),r.jsxs("span",{className:J("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",m?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[m?r.jsx(B0,{className:"h-3 w-3 animate-pulse"}):r.jsx(R0,{className:"h-3 w-3"}),m?"Inferenz aktiv":"Idle"]})]}),u.length===0?r.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):r.jsx("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:u.map(v=>{var g;return r.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[v.role&&r.jsx("span",{className:J("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",Ab[v.role]||"bg-slate-500/15 text-slate-300 border-slate-500/25"),children:v.role}),r.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(g=v.name.split("/").pop())==null?void 0:g.replace(/\.gguf$/i,"")})]}),r.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Vr(v.size_bytes)," im Unified-RAM"]})]}),r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[r.jsx("span",{className:J("h-1.5 w-1.5 rounded-full bg-emerald-500",m&&"animate-pulse")})," warm"]})]},v.name)})})]})}function fi({value:s,label:o,detail:i}){const u=2*Math.PI*24,f=u-Math.min(s,100)/100*u,m=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return r.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[r.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),r.jsx("circle",{cx:"32",cy:"32",r:24,className:J("fill-none transition-all duration-700 ease-out",m),strokeWidth:"4.5",strokeDasharray:u,strokeDashoffset:f,strokeLinecap:"round"})]}),r.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),r.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),i&&r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Lb(){const{data:s}=md(3e3);return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(fi,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),r.jsx(fi,{value:s.ram.percent,label:"RAM",detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`}),s.gpu&&s.gpu.busy_percent!=null&&s.gpu.gtt_used!=null&&s.gpu.gtt_total!=null&&r.jsx(fi,{value:s.gpu.busy_percent,label:"GPU",detail:`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB`}),s.disk&&r.jsx(fi,{value:s.disk.percent,label:"Disk",detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`})]}):r.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)&&r.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&&r.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&r.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]})}function wm({type:s,title:o,message:i,defaultValue:c,onConfirm:u,onCancel:f}){const m=x.useRef(null);return r.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),r.jsx("button",{onClick:f||(()=>u()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:i}),s==="prompt"&&r.jsx("input",{ref:m,type:"text",defaultValue:c,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:p=>{var v;p.key==="Enter"&&u((v=m.current)==null?void 0:v.value)}}),r.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&r.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"}),r.jsx("button",{onClick:()=>{var v;const p=s==="prompt"?(v=m.current)==null?void 0:v.value:void 0;u(p)},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 Dn(){const[s,o]=x.useState(null),i=x.useCallback(()=>o(null),[]),c=x.useCallback((p,v,g)=>{o({type:"alert",title:p,message:v,onConfirm:()=>{o(null),g==null||g()}})},[]),u=x.useCallback((p,v,g,j)=>{o({type:"confirm",title:p,message:v,onConfirm:()=>{o(null),g()},onCancel:()=>{o(null),j==null||j()}})},[]),f=x.useCallback((p,v,g,j,w)=>{o({type:"prompt",title:p,message:v,defaultValue:g,onConfirm:_=>{o(null),j(_)},onCancel:()=>{o(null),w==null||w()}})},[]),m=s?r.jsx(wm,{...s}):null;return{showAlert:c,showConfirm:u,showPrompt:f,close:i,dialogElement:m}}function Fb(){const s=rn(),{data:o}=xd(3e3),{data:i=[]}=dm(3e3),{showConfirm:c,dialogElement:u}=Dn(),[f,m]=x.useState(""),[p,v]=x.useState(!1),[g,j]=x.useState(""),[w,_]=x.useState(!1),[M,L]=x.useState({open:!1,actionPath:"",actionLabel:""}),b=()=>{s.invalidateQueries({queryKey:Ye.updates}),s.invalidateQueries({queryKey:Ye.jobs}),s.invalidateQueries({queryKey:Ye.models})};async function S(D,$,H,ae){m(`${$} wird ausgeführt...`),v(!0);try{const te={...H},fe=await we(D,{method:"POST",body:JSON.stringify(te)});if(fe.status==="password_required"||fe.status==="incorrect_password"){L({open:!0,actionPath:D,actionLabel:$,payload:H,error:fe.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),m("");return}fe.job_id?m(`${$} gestartet (Job-ID: ${fe.job_id})`):fe.ok?m(`${$} erfolgreich ausgeführt.`):m(`Fehler: ${fe.err||"Unbekannter Fehler"}`),b()}catch(te){m(`Fehler bei ${$}: ${te.message}`)}finally{v(!1)}}async function O(){_(!0);try{const D={...M.payload,sudo_password:g},$=await we(M.actionPath,{method:"POST",body:JSON.stringify(D)});if($.status==="password_required"||$.status==="incorrect_password"){L(H=>({...H,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}$.job_id?m(`${M.actionLabel} gestartet (Job-ID: ${$.job_id})`):$.ok?m(`${M.actionLabel} erfolgreich ausgeführt.`):m(`Fehler: ${$.err||"Unbekannter Fehler"}`),L({open:!1,actionPath:"",actionLabel:""}),j(""),b()}catch(D){m(`Fehler: ${D.message}`),L({open:!1,actionPath:"",actionLabel:""}),j("")}finally{_(!1)}}async function I(D,$){m(`Upgrade für ${D} wird gestartet...`);try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:D,role:$,quant:"Q4_K_M",jinja:!0})}),m("Upgrade-Download gestartet."),b()}catch(H){m(`Upgrade fehlgeschlagen: ${H.message}`)}}const B=i.find(D=>D.label.includes("OS-Update")&&(D.state==="running"||D.state==="queued")),F=i.find(D=>D.label.includes("Engine-Update")&&(D.state==="running"||D.state==="queued"));return r.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:[M.open&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),r.jsx("button",{onClick:()=>{L({open:!1,actionPath:"",actionLabel:""}),j("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",r.jsx("strong",{children:M.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"password",value:g,onChange:D=>j(D.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:D=>D.key==="Enter"&&O(),autoFocus:!0}),M.error&&r.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:M.error})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{L({open:!1,actionPath:"",actionLabel:""}),j("")},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"}),r.jsx("button",{onClick:O,disabled:!g||w,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:w?"Prüfe...":"Ausführen"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(L0,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(o==null?void 0:o.last_check)&&r.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?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:J("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:[r.jsx("span",{children:"OS-Pakete"}),r.jsx("span",{className:"font-mono",children:o.os>0?`${o.os} verfügbar`:"aktuell"})]}),r.jsxs("div",{className:J("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:[r.jsx("span",{children:"Engine (llama.cpp)"}),r.jsx("span",{className:"font-mono",children:o.engine>0?"Update verfügbar":"aktuell"})]}),r.jsxs("div",{className:J("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:[r.jsx("span",{children:"Modell-Upgrades"}),r.jsx("span",{className:"font-mono",children:o.models>0?`${o.models} verfügbar`:"aktuell"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[r.jsx("button",{onClick:()=>S("/api/maintenance/os-update","OS-Update"),disabled:p||!!B,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:B?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",B.progress??0,"%)"]})]}):r.jsx("span",{children:"OS Update"})}),r.jsx("button",{onClick:()=>S("/api/maintenance/engine-update","Engine-Update"),disabled:p||!!F,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:F?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",F.progress??0,"%)"]})]}):r.jsx("span",{children:"Engine Update"})})]}),r.jsxs("button",{onClick:()=>{c("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>S("/api/maintenance/reboot","Reboot"))},disabled:p,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:[r.jsx(Eh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Host Reboot"})]}),o.model_list.length>0&&r.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[r.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),r.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:o.model_list.map(D=>r.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:[r.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${D.role}: ${D.repo}`,children:[r.jsx("span",{className:"text-primary font-bold uppercase",children:D.role}),": ",D.repo.split("/").pop()]}),r.jsxs("button",{onClick:()=>I(D.repo,D.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:[r.jsx(_n,{className:"h-2.5 w-2.5"})," Laden"]})]},D.repo))})]})]}):r.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),f&&r.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}),r.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:[r.jsx(Ms,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),r.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",r.jsx("code",{children:"/etc/sudoers"})," (z.B. ",r.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),r.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:r.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"})}),u]})}function Ib(){const s=rn(),{data:o}=fm(3e3),{data:i}=Ds(),{showAlert:c,dialogElement:u}=Dn(),[f,m]=x.useState(!1),p=(i==null?void 0:i.models)??[];async function v(g){try{await we("/api/agent/brain",{method:"POST",body:JSON.stringify({model:g})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${g}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Ye.agentStatus}),m(!1)}catch(j){c("Fehler",`Fehler beim Wechseln des Gehirns: ${j.message}`)}}return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(o==null?void 0:o.webui_url)&&r.jsxs("a",{href:Uo(o.webui_url),target:"_blank",rel:"noopener",className:J("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:[r.jsx(yi,{className:"h-3 w-3"})," Hermes öffnen"]})]}),o?r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.gateway_reachable?"Online":"Offline"})]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.webui_reachable?"Online":"Offline"})]})]}),r.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",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),r.jsx(Ot,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[r.jsx(zo,{className:"h-3 w-3 shrink-0"}),o.brain_model||"auto"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),r.jsx(Lo,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[r.jsxs("div",{children:["Config: ",o.has_config?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Skills: ",o.has_skills?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Memory: ",o.has_memories?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),o&&r.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Telegram"}),r.jsx("span",{className:J("font-semibold",o.telegram_enabled?"text-emerald-400":""),children:o.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"MCP-Server"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[o.mcp_server_count??0," verbunden"]})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"PC Executor"}),r.jsx("span",{className:J("font-semibold",o.pc_executor_reachable?"text-emerald-400":""),children:o.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),o&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4"}),r.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),r.jsx("button",{onClick:()=>m(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.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 (',r.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),r.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...p.map(g=>{var j;return((j=g.name.split("/").pop())==null?void 0:j.replace(".gguf",""))||g.name})].map(g=>{const j=["auto","fast","heavy"].includes(g);return r.jsxs("button",{onClick:()=>v(g),className:J("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===g||!o.brain_model&&g==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:g}),r.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:j?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===g||!o.brain_model&&g==="auto")&&r.jsx(_s,{className:"h-4 w-4 shrink-0 text-primary"})]},g)})})]})}),u]})}const Ub=["fast","heavy","coder","reasoning","vision","scout"];function $b(){const{data:s}=Ds(3e3),o=(s==null?void 0:s.models)??[],i=(s==null?void 0:s.running)??[];return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(zo,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:Ub.map(c=>{var m;const u=o.find(p=>p.role===c),f=u?i.includes(u.name):!1;return r.jsxs("div",{className:J("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":u?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[r.jsx("div",{className:"min-w-0 flex-1 mr-2",children:r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:J("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",c==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":c==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":c==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":c==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":c==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:c}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:u?(m=u.name.split("/").pop())==null?void 0:m.replace(/\.gguf$/i,""):"nicht zugewiesen"}),u&&r.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[u.prompt_cache&&r.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"}),u.spec_draft_model&&r.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: ${u.spec_draft_model})`,children:"SPEC"}),u.parallel_slots>1&&r.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:`${u.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",u.parallel_slots]}),u.incomplete&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),r.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:u?f?r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},c)})})]}),r.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 Bb(){const s=rn(),{data:o=[]}=hm({limit:3}),[i,c]=x.useState(""),[u,f]=x.useState("stable"),[m,p]=x.useState(!1);async function v(){if(!(!i.trim()||m)){p(!0);try{await we("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:u,source:"dashboard"})}),c(""),s.invalidateQueries({queryKey:["memory"]})}catch(g){console.error(g)}finally{p(!1)}}}return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Ao,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("textarea",{value:i,onChange:g=>c(g.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"}),r.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[r.jsxs("select",{value:u,onChange:g=>f(g.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[r.jsx("option",{value:"stable",children:"🔵 Fakt"}),r.jsx("option",{value:"instruction",children:"📋 Regel"}),r.jsx("option",{value:"user",children:"👤 User"}),r.jsx("option",{value:"versioned",children:"🟡 Version"})]}),r.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:[r.jsx(Ch,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),r.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[r.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),r.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:o.length===0?r.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):o.map(g=>r.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[r.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:g.category}),r.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:g.content,children:g.content})]},g.id))})]})]}),r.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 Hb(){var o;const{data:s}=um(3e3);return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(j0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),s?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),r.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})," €"]}),r.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",s.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),r.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:s.total_tokens.toLocaleString("de-DE")}),r.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Input (Prompts):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Output (Antworten):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),r.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet ggü. Cloud-APIs",(o=s==null?void 0:s.pricing)!=null&&o.heavy?` (Ø ${(s.pricing.heavy.in??0).toFixed(2).replace(".",",")} $ / ${(s.pricing.heavy.out??0).toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})}function Vb(){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.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"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),r.jsx(zb,{}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[r.jsx(Lb,{}),r.jsx(Fb,{})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[r.jsx(Ib,{}),r.jsx($b,{}),r.jsx(Bb,{}),r.jsx(Hb,{})]})]})}function Wb(){const s=rn(),{data:o=[]}=dm(2e3),{showAlert:i,dialogElement:c}=Dn();async function u(p){try{await we(`/api/jobs/${p}/cancel`,{method:"POST"}),s.invalidateQueries({queryKey:Ye.jobs})}catch(v){i("Fehler",v.message)}}const f=o.filter(p=>p.state==="running"||p.state==="queued"),m=o.filter(p=>p.state!=="running"&&p.state!=="queued").slice(-3);return f.length===0&&m.length===0?null:r.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:[r.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),f.map(p=>r.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center text-xs",children:[r.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:p.label}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-muted-foreground font-mono",children:[p.progress??0,"% • ",td(p.done_bytes),"/",td(p.total_bytes),p.eta_s?` • ETA ${tb(p.eta_s)}`:""]}),r.jsx("button",{onClick:()=>u(p.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"})]})]}),r.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${p.progress??0}%`}})})]},p.id)),m.map(p=>r.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[r.jsx("span",{className:"truncate",children:p.label}),r.jsx("span",{className:J("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",p.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:p.state})]},p.id)),c]})}function gn({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 r.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${i[o]}`,children:s})}function Qp({caps:s}){return s?r.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&r.jsx(gn,{children:"💻 Code"}),s.vision&&r.jsx(gn,{children:"👁 Bild"}),s.reasoning&&r.jsx(gn,{children:"🧠 Reason"}),s.moe&&r.jsxs(gn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&r.jsx(gn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&r.jsx(gn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&r.jsx(gn,{children:"🔢 Embed"})]}):null}const Gb=["fast","heavy","coder","reasoning","agent","vision","scout"];function Kb({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 r.jsxs("span",{className:J("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}function qp(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 Qb(){var Tn,zs,Ls,An,Fs;const s=rn(),{data:o,isLoading:i,error:c}=Ds(4e3),{data:u}=Xv(4e3),{data:f}=pm(),{data:m}=xd(4e3),{showAlert:p,showConfirm:v,showPrompt:g,dialogElement:j}=Dn(),w=(o==null?void 0:o.models)??[],_=(o==null?void 0:o.running)??[],M=c?String(c):"",L=()=>{s.invalidateQueries({queryKey:Ye.models}),s.invalidateQueries({queryKey:Ye.routing})},[b,S]=x.useState(null),[O,I]=x.useState(null),[B,F]=x.useState(!1),[D,$]=x.useState(null),[H,ae]=x.useState("grid"),[te,fe]=x.useState("all"),ke=w.filter(A=>te==="in_use"?!!A.role||_.includes(A.name):!0),[ue,ze]=x.useState({width:800,height:360}),Ce=x.useRef(null),Le=x.useCallback(A=>{if(Ce.current&&(Ce.current.disconnect(),Ce.current=null),A){const se=new ResizeObserver(je=>{if(!je||je.length===0)return;const De=je[0].contentRect;ze({width:De.width,height:De.height})});se.observe(A),Ce.current=se}},[]),Ee=ue.width,Pe=ue.height,K=A=>{const se=Ee*.1,je=Pe*A,De=Ee*.5,He=Pe*.5,ir=Ee*.3,zn=je,Ln=Ee*.3;return`M ${se} ${je} C ${ir} ${zn}, ${Ln} ${He}, ${De} ${He}`},ee=A=>{const se=Ee*.5,je=Pe*.5,De=Ee*.9,He=Pe*A,ir=Ee*.7,zn=je,Ln=Ee*.7;return`M ${se} ${je} C ${ir} ${zn}, ${Ln} ${He}, ${De} ${He}`};async function Y(A){try{await we(`/api/models/${encodeURIComponent(A)}/load`,{method:"POST"}),L()}catch(se){p("Fehler",`Fehler beim Laden des Modells: ${se.message}`)}}async function P(A){try{await we(`/api/models/${encodeURIComponent(A)}/unload`,{method:"POST"}),L()}catch(se){p("Fehler",`Fehler beim Entladen des Modells: ${se.message}`)}}async function C(){try{await we("/api/models/unload",{method:"POST"}),L()}catch(A){p("Fehler",`Fehler beim Entladen aller Modelle: ${A.message}`)}}async function Z(A,se){try{await we(`/api/models/${encodeURIComponent(se)}/role`,{method:"POST",body:JSON.stringify({role:A||null})}),L()}catch(je){p("Fehler",`Fehler beim Zuweisen der Rolle: ${je.message||je}`)}}async function X(A,se){g("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(se||32768),async je=>{if(je)try{await we(`/api/models/${encodeURIComponent(A)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(je,10)})}),L()}catch(De){p("Fehler",`Fehler beim Setzen des Kontexts: ${De.message||De}`)}})}async function q(A){v("Modell löschen?",`Modell '${A}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await we(`/api/models/${encodeURIComponent(A)}`,{method:"DELETE"}),L()}catch(se){p("Fehler",`Fehler beim Löschen: ${se.message||se}`)}})}async function le(A,se,je,De){try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:A,role:se,quant:je,jinja:De})}),p("Herunterladen gestartet",`Download für '${A}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(He){p("Fehler",`Fehler beim Starten des Upgrades: ${He.message||He}`)}}async function pe(A){A&&(await navigator.clipboard.writeText(A),F(!0),setTimeout(()=>F(!1),1500))}if(i)return r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(M)return r.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 ve=w.filter(A=>_.includes(A.name)),U=ve.reduce((A,se)=>A+(se.size_bytes||0),0),me=16*1024**3,xt=U>me?U*1.2:me,As=A=>w.find(se=>se.role===A),Zt=A=>{const se=As(A);return se?_.includes(se.name):!1};return r.jsxs("div",{className:"space-y-8",children:[r.jsx("style",{children:` +`)},gv=0,cs=[];function yv(s){var o=x.useRef([]),i=x.useRef([0,0]),c=x.useRef(),u=x.useState(gv++)[0],f=x.useState(Uh)[0],m=x.useRef(s);x.useEffect(function(){m.current=s},[s]),x.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(u));var b=Iy([s.lockRef.current],(s.shards||[]).map(Hp),!0).filter(Boolean);return b.forEach(function(S){return S.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),b.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(u))})}}},[s.inert,s.lockRef.current,s.shards]);var p=x.useCallback(function(b,S){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!m.current.allowPinchZoom;var O=ci(b),I=i.current,B="deltaX"in b?b.deltaX:I[0]-O[0],F="deltaY"in b?b.deltaY:I[1]-O[1],D,$=b.target,H=Math.abs(B)>Math.abs(F)?"h":"v";if("touches"in b&&H==="h"&&$.type==="range")return!1;var ae=window.getSelection(),te=ae&&ae.anchorNode,fe=te?te===$||te.contains($):!1;if(fe)return!1;var ke=$p(H,$);if(!ke)return!0;if(ke?D=H:(D=H==="v"?"h":"v",ke=$p(H,$)),!ke)return!1;if(!c.current&&"changedTouches"in b&&(B||F)&&(c.current=D),!D)return!0;var ue=c.current||D;return hv(ue,S,b,ue==="h"?B:F)},[]),v=x.useCallback(function(b){var S=b;if(!(!cs.length||cs[cs.length-1]!==f)){var O="deltaY"in S?Bp(S):ci(S),I=o.current.filter(function(D){return D.name===S.type&&(D.target===S.target||S.target===D.shadowParent)&&mv(D.delta,O)})[0];if(I&&I.should){S.cancelable&&S.preventDefault();return}if(!I){var B=(m.current.shards||[]).map(Hp).filter(Boolean).filter(function(D){return D.contains(S.target)}),F=B.length>0?p(S,B[0]):!m.current.noIsolation;F&&S.cancelable&&S.preventDefault()}}},[]),g=x.useCallback(function(b,S,O,I){var B={name:b,delta:S,target:O,should:I,shadowParent:vv(O)};o.current.push(B),setTimeout(function(){o.current=o.current.filter(function(F){return F!==B})},1)},[]),j=x.useCallback(function(b){i.current=ci(b),c.current=void 0},[]),w=x.useCallback(function(b){g(b.type,Bp(b),b.target,p(b,s.lockRef.current))},[]),_=x.useCallback(function(b){g(b.type,ci(b),b.target,p(b,s.lockRef.current))},[]);x.useEffect(function(){return cs.push(f),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:_}),document.addEventListener("wheel",v,as),document.addEventListener("touchmove",v,as),document.addEventListener("touchstart",j,as),function(){cs=cs.filter(function(b){return b!==f}),document.removeEventListener("wheel",v,as),document.removeEventListener("touchmove",v,as),document.removeEventListener("touchstart",j,as)}},[]);var M=s.removeScrollBar,z=s.inert;return x.createElement(x.Fragment,null,z?x.createElement(f,{styles:xv(u)}):null,M?x.createElement(iv,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function vv(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const bv=Qy(Ih,yv);var Vh=x.forwardRef(function(s,o){return x.createElement(ji,lr({},s,{ref:o,sideCar:bv}))});Vh.classNames=ji.classNames;var wv=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},ds=new WeakMap,di=new WeakMap,ui={},Cc=0,Wh=function(s){return s&&(s.host||Wh(s.parentNode))},jv=function(s,o){return o.map(function(i){if(s.contains(i))return i;var c=Wh(i);return c&&s.contains(c)?c:(console.error("aria-hidden",i,"in not contained inside",s,". Doing nothing"),null)}).filter(function(i){return!!i})},kv=function(s,o,i,c){var u=jv(o,Array.isArray(s)?s:[s]);ui[i]||(ui[i]=new WeakMap);var f=ui[i],m=[],p=new Set,v=new Set(u),g=function(w){!w||p.has(w)||(p.add(w),g(w.parentNode))};u.forEach(g);var j=function(w){!w||v.has(w)||Array.prototype.forEach.call(w.children,function(_){if(p.has(_))j(_);else try{var M=_.getAttribute(c),z=M!==null&&M!=="false",b=(ds.get(_)||0)+1,S=(f.get(_)||0)+1;ds.set(_,b),f.set(_,S),m.push(_),b===1&&z&&di.set(_,!0),S===1&&_.setAttribute(i,"true"),z||_.setAttribute(c,"true")}catch(O){console.error("aria-hidden: cannot operate on ",_,O)}})};return j(o),p.clear(),Cc++,function(){m.forEach(function(w){var _=ds.get(w)-1,M=f.get(w)-1;ds.set(w,_),f.set(w,M),_||(di.has(w)||w.removeAttribute(c),di.delete(w)),M||w.removeAttribute(i)}),Cc--,Cc||(ds=new WeakMap,ds=new WeakMap,di=new WeakMap,ui={})}},Nv=function(s,o,i){i===void 0&&(i="data-aria-hidden");var c=Array.from(Array.isArray(s)?s:[s]),u=wv(s);return u?(c.push.apply(c,Array.from(u.querySelectorAll("[aria-live], script"))),kv(c,u,i,"aria-hidden")):function(){return null}},ki="Dialog",[Gh]=J0(ki),[Sv,qt]=Gh(ki),Kh=s=>{const{__scopeDialog:o,children:i,open:c,defaultOpen:u,onOpenChange:f,modal:m=!0}=s,p=x.useRef(null),v=x.useRef(null),[g,j]=ny({prop:c,defaultProp:u??!1,onChange:f,caller:ki});return r.jsx(Sv,{scope:o,triggerRef:p,contentRef:v,contentId:br(),titleId:br(),descriptionId:br(),open:g,onOpenChange:j,onOpenToggle:x.useCallback(()=>j(w=>!w),[j]),modal:m,children:i})};Kh.displayName=ki;var Qh="DialogTrigger",Cv=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(Qh,i),f=On(o,u.triggerRef);return r.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":pd(u.open),...c,ref:f,onClick:en(s.onClick,u.onOpenToggle)})});Cv.displayName=Qh;var fd="DialogPortal",[Ev,qh]=Gh(fd,{forceMount:void 0}),Zh=s=>{const{__scopeDialog:o,forceMount:i,children:c,container:u}=s,f=qt(fd,o);return r.jsx(Ev,{scope:o,forceMount:i,children:x.Children.map(c,m=>r.jsx(wi,{present:i||f.open,children:r.jsx(zh,{asChild:!0,container:u,children:m})}))})};Zh.displayName=fd;var bi="DialogOverlay",Yh=x.forwardRef((s,o)=>{const i=qh(bi,s.__scopeDialog),{forceMount:c=i.forceMount,...u}=s,f=qt(bi,s.__scopeDialog);return f.modal?r.jsx(wi,{present:c||f.open,children:r.jsx(_v,{...u,ref:o})}):null});Yh.displayName=bi;var Pv=Rh("DialogOverlay.RemoveScroll"),_v=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(bi,i),f=ky(),m=On(o,f);return r.jsx(Vh,{as:Pv,allowPinchZoom:!0,shards:[u.contentRef],children:r.jsx(it.div,{"data-state":pd(u.open),...c,ref:m,style:{pointerEvents:"auto",...c.style}})})}),Os="DialogContent",Jh=x.forwardRef((s,o)=>{const i=qh(Os,s.__scopeDialog),{forceMount:c=i.forceMount,...u}=s,f=qt(Os,s.__scopeDialog);return r.jsx(wi,{present:c||f.open,children:f.modal?r.jsx(Mv,{...u,ref:o}):r.jsx(Rv,{...u,ref:o})})});Jh.displayName=Os;var Mv=x.forwardRef((s,o)=>{const i=qt(Os,s.__scopeDialog),c=x.useRef(null),u=On(o,i.contentRef,c);return x.useEffect(()=>{const f=c.current;if(f)return Nv(f)},[]),r.jsx(Xh,{...s,ref:u,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:en(s.onCloseAutoFocus,f=>{var m;f.preventDefault(),(m=i.triggerRef.current)==null||m.focus()}),onPointerDownOutside:en(s.onPointerDownOutside,f=>{const m=f.detail.originalEvent,p=m.button===0&&m.ctrlKey===!0;(m.button===2||p)&&f.preventDefault()}),onFocusOutside:en(s.onFocusOutside,f=>f.preventDefault())})}),Rv=x.forwardRef((s,o)=>{const i=qt(Os,s.__scopeDialog),c=x.useRef(!1),u=x.useRef(!1);return r.jsx(Xh,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var m,p;(m=s.onCloseAutoFocus)==null||m.call(s,f),f.defaultPrevented||(c.current||(p=i.triggerRef.current)==null||p.focus(),f.preventDefault()),c.current=!1,u.current=!1},onInteractOutside:f=>{var v,g;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(c.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const m=f.target;((g=i.triggerRef.current)==null?void 0:g.contains(m))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})}),Xh=x.forwardRef((s,o)=>{const{__scopeDialog:i,trapFocus:c,onOpenAutoFocus:u,onCloseAutoFocus:f,...m}=s,p=qt(Os,i);return Fy(),r.jsx(r.Fragment,{children:r.jsx(Th,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:u,onUnmountAutoFocus:f,children:r.jsx(Oh,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":pd(p.open),...m,ref:o,deferPointerDownOutside:!0,onDismiss:()=>p.onOpenChange(!1)})})})}),em="DialogTitle",Ov=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(em,i);return r.jsx(it.h2,{id:u.titleId,...c,ref:o})});Ov.displayName=em;var tm="DialogDescription",Dv=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(tm,i);return r.jsx(it.p,{id:u.descriptionId,...c,ref:o})});Dv.displayName=tm;var rm="DialogClose",Tv=x.forwardRef((s,o)=>{const{__scopeDialog:i,...c}=s,u=qt(rm,i);return r.jsx(it.button,{type:"button",...c,ref:o,onClick:en(s.onClick,()=>u.onOpenChange(!1))})});Tv.displayName=rm;function pd(s){return s?"open":"closed"}var Co='[cmdk-group=""]',Ec='[cmdk-group-items=""]',Av='[cmdk-group-heading=""]',nm='[cmdk-item=""]',Vp=`${nm}:not([aria-disabled="true"])`,ed="cmdk-item-select",fs="data-value",zv=(s,o,i)=>Y0(s,o,i),sm=x.createContext(void 0),Ko=()=>x.useContext(sm),om=x.createContext(void 0),hd=()=>x.useContext(om),lm=x.createContext(void 0),im=x.forwardRef((s,o)=>{let i=ps(()=>{var C,Z;return{search:"",value:(Z=(C=s.value)!=null?C:s.defaultValue)!=null?Z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=ps(()=>new Set),u=ps(()=>new Map),f=ps(()=>new Map),m=ps(()=>new Set),p=am(s),{label:v,children:g,value:j,onValueChange:w,filter:_,shouldFilter:M,loop:z,disablePointerSelection:b=!1,vimBindings:S=!0,...O}=s,I=br(),B=br(),F=br(),D=x.useRef(null),$=Kv();Rn(()=>{if(j!==void 0){let C=j.trim();i.current.value=C,H.emit()}},[j]),Rn(()=>{$(6,ze)},[]);let H=x.useMemo(()=>({subscribe:C=>(m.current.add(C),()=>m.current.delete(C)),snapshot:()=>i.current,setState:(C,Z,X)=>{var q,le,pe,ve;if(!Object.is(i.current[C],Z)){if(i.current[C]=Z,C==="search")ue(),fe(),$(1,ke);else if(C==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(F);U?U.focus():(q=document.getElementById(I))==null||q.focus()}if($(7,()=>{var U;i.current.selectedItemId=(U=Ce())==null?void 0:U.id,H.emit()}),X||$(5,ze),((le=p.current)==null?void 0:le.value)!==void 0){let U=Z??"";(ve=(pe=p.current).onValueChange)==null||ve.call(pe,U);return}}H.emit()}},emit:()=>{m.current.forEach(C=>C())}}),[]),ae=x.useMemo(()=>({value:(C,Z,X)=>{var q;Z!==((q=f.current.get(C))==null?void 0:q.value)&&(f.current.set(C,{value:Z,keywords:X}),i.current.filtered.items.set(C,te(Z,X)),$(2,()=>{fe(),H.emit()}))},item:(C,Z)=>(c.current.add(C),Z&&(u.current.has(Z)?u.current.get(Z).add(C):u.current.set(Z,new Set([C]))),$(3,()=>{ue(),fe(),i.current.value||ke(),H.emit()}),()=>{f.current.delete(C),c.current.delete(C),i.current.filtered.items.delete(C);let X=Ce();$(4,()=>{ue(),(X==null?void 0:X.getAttribute("id"))===C&&ke(),H.emit()})}),group:C=>(u.current.has(C)||u.current.set(C,new Set),()=>{f.current.delete(C),u.current.delete(C)}),filter:()=>p.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:I,inputId:F,labelId:B,listInnerRef:D}),[]);function te(C,Z){var X,q;let le=(q=(X=p.current)==null?void 0:X.filter)!=null?q:zv;return C?le(C,i.current.search,Z):0}function fe(){if(!i.current.search||p.current.shouldFilter===!1)return;let C=i.current.filtered.items,Z=[];i.current.filtered.groups.forEach(q=>{let le=u.current.get(q),pe=0;le.forEach(ve=>{let U=C.get(ve);pe=Math.max(U,pe)}),Z.push([q,pe])});let X=D.current;Le().sort((q,le)=>{var pe,ve;let U=q.getAttribute("id"),me=le.getAttribute("id");return((pe=C.get(me))!=null?pe:0)-((ve=C.get(U))!=null?ve:0)}).forEach(q=>{let le=q.closest(Ec);le?le.appendChild(q.parentElement===le?q:q.closest(`${Ec} > *`)):X.appendChild(q.parentElement===X?q:q.closest(`${Ec} > *`))}),Z.sort((q,le)=>le[1]-q[1]).forEach(q=>{var le;let pe=(le=D.current)==null?void 0:le.querySelector(`${Co}[${fs}="${encodeURIComponent(q[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function ke(){let C=Le().find(X=>X.getAttribute("aria-disabled")!=="true"),Z=C==null?void 0:C.getAttribute(fs);H.setState("value",Z||void 0)}function ue(){var C,Z,X,q;if(!i.current.search||p.current.shouldFilter===!1){i.current.filtered.count=c.current.size;return}i.current.filtered.groups=new Set;let le=0;for(let pe of c.current){let ve=(Z=(C=f.current.get(pe))==null?void 0:C.value)!=null?Z:"",U=(q=(X=f.current.get(pe))==null?void 0:X.keywords)!=null?q:[],me=te(ve,U);i.current.filtered.items.set(pe,me),me>0&&le++}for(let[pe,ve]of u.current)for(let U of ve)if(i.current.filtered.items.get(U)>0){i.current.filtered.groups.add(pe);break}i.current.filtered.count=le}function ze(){var C,Z,X;let q=Ce();q&&(((C=q.parentElement)==null?void 0:C.firstChild)===q&&((X=(Z=q.closest(Co))==null?void 0:Z.querySelector(Av))==null||X.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function Ce(){var C;return(C=D.current)==null?void 0:C.querySelector(`${nm}[aria-selected="true"]`)}function Le(){var C;return Array.from(((C=D.current)==null?void 0:C.querySelectorAll(Vp))||[])}function Ee(C){let Z=Le()[C];Z&&H.setState("value",Z.getAttribute(fs))}function Pe(C){var Z;let X=Ce(),q=Le(),le=q.findIndex(ve=>ve===X),pe=q[le+C];(Z=p.current)!=null&&Z.loop&&(pe=le+C<0?q[q.length-1]:le+C===q.length?q[0]:q[le+C]),pe&&H.setState("value",pe.getAttribute(fs))}function K(C){let Z=Ce(),X=Z==null?void 0:Z.closest(Co),q;for(;X&&!q;)X=C>0?Wv(X,Co):Gv(X,Co),q=X==null?void 0:X.querySelector(Vp);q?H.setState("value",q.getAttribute(fs)):Pe(C)}let ee=()=>Ee(Le().length-1),Y=C=>{C.preventDefault(),C.metaKey?ee():C.altKey?K(1):Pe(1)},P=C=>{C.preventDefault(),C.metaKey?Ee(0):C.altKey?K(-1):Pe(-1)};return x.createElement(it.div,{ref:o,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:C=>{var Z;(Z=O.onKeyDown)==null||Z.call(O,C);let X=C.nativeEvent.isComposing||C.keyCode===229;if(!(C.defaultPrevented||X))switch(C.key){case"n":case"j":{S&&C.ctrlKey&&Y(C);break}case"ArrowDown":{Y(C);break}case"p":case"k":{S&&C.ctrlKey&&P(C);break}case"ArrowUp":{P(C);break}case"Home":{C.preventDefault(),Ee(0);break}case"End":{C.preventDefault(),ee();break}case"Enter":{C.preventDefault();let q=Ce();if(q){let le=new Event(ed);q.dispatchEvent(le)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:ae.inputId,id:ae.labelId,style:qv},v),Ni(s,C=>x.createElement(om.Provider,{value:H},x.createElement(sm.Provider,{value:ae},C))))}),Lv=x.forwardRef((s,o)=>{var i,c;let u=br(),f=x.useRef(null),m=x.useContext(lm),p=Ko(),v=am(s),g=(c=(i=v.current)==null?void 0:i.forceMount)!=null?c:m==null?void 0:m.forceMount;Rn(()=>{if(!g)return p.item(u,m==null?void 0:m.id)},[g]);let j=cm(u,f,[s.value,s.children,f],s.keywords),w=hd(),_=tn($=>$.value&&$.value===j.current),M=tn($=>g||p.filter()===!1?!0:$.search?$.filtered.items.get(u)>0:!0);x.useEffect(()=>{let $=f.current;if(!(!$||s.disabled))return $.addEventListener(ed,z),()=>$.removeEventListener(ed,z)},[M,s.onSelect,s.disabled]);function z(){var $,H;b(),(H=($=v.current).onSelect)==null||H.call($,j.current)}function b(){w.setState("value",j.current,!0)}if(!M)return null;let{disabled:S,value:O,onSelect:I,forceMount:B,keywords:F,...D}=s;return x.createElement(it.div,{ref:Rs(f,o),...D,id:u,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!_,"data-disabled":!!S,"data-selected":!!_,onPointerMove:S||p.getDisablePointerSelection()?void 0:b,onClick:S?void 0:z},s.children)}),Fv=x.forwardRef((s,o)=>{let{heading:i,children:c,forceMount:u,...f}=s,m=br(),p=x.useRef(null),v=x.useRef(null),g=br(),j=Ko(),w=tn(M=>u||j.filter()===!1?!0:M.search?M.filtered.groups.has(m):!0);Rn(()=>j.group(m),[]),cm(m,p,[s.value,s.heading,v]);let _=x.useMemo(()=>({id:m,forceMount:u}),[u]);return x.createElement(it.div,{ref:Rs(p,o),...f,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0},i&&x.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:g},i),Ni(s,M=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?g:void 0},x.createElement(lm.Provider,{value:_},M))))}),Iv=x.forwardRef((s,o)=>{let{alwaysRender:i,...c}=s,u=x.useRef(null),f=tn(m=>!m.search);return!i&&!f?null:x.createElement(it.div,{ref:Rs(u,o),...c,"cmdk-separator":"",role:"separator"})}),Uv=x.forwardRef((s,o)=>{let{onValueChange:i,...c}=s,u=s.value!=null,f=hd(),m=tn(g=>g.search),p=tn(g=>g.selectedItemId),v=Ko();return x.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),x.createElement(it.input,{ref:o,...c,"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":p,id:v.inputId,type:"text",value:u?s.value:m,onChange:g=>{u||f.setState("search",g.target.value),i==null||i(g.target.value)}})}),$v=x.forwardRef((s,o)=>{let{children:i,label:c="Suggestions",...u}=s,f=x.useRef(null),m=x.useRef(null),p=tn(g=>g.selectedItemId),v=Ko();return x.useEffect(()=>{if(m.current&&f.current){let g=m.current,j=f.current,w,_=new ResizeObserver(()=>{w=requestAnimationFrame(()=>{let M=g.offsetHeight;j.style.setProperty("--cmdk-list-height",M.toFixed(1)+"px")})});return _.observe(g),()=>{cancelAnimationFrame(w),_.unobserve(g)}}},[]),x.createElement(it.div,{ref:Rs(f,o),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":c,id:v.listId},Ni(s,g=>x.createElement("div",{ref:Rs(m,v.listInnerRef),"cmdk-list-sizer":""},g)))}),Bv=x.forwardRef((s,o)=>{let{open:i,onOpenChange:c,overlayClassName:u,contentClassName:f,container:m,...p}=s;return x.createElement(Kh,{open:i,onOpenChange:c},x.createElement(Zh,{container:m},x.createElement(Yh,{"cmdk-overlay":"",className:u}),x.createElement(Jh,{"aria-label":s.label,"cmdk-dialog":"",className:f},x.createElement(im,{ref:o,...p}))))}),Hv=x.forwardRef((s,o)=>tn(i=>i.filtered.count===0)?x.createElement(it.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Vv=x.forwardRef((s,o)=>{let{progress:i,children:c,label:u="Loading...",...f}=s;return x.createElement(it.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},Ni(s,m=>x.createElement("div",{"aria-hidden":!0},m)))}),us=Object.assign(im,{List:$v,Item:Lv,Input:Uv,Group:Fv,Separator:Iv,Dialog:Bv,Empty:Hv,Loading:Vv});function Wv(s,o){let i=s.nextElementSibling;for(;i;){if(i.matches(o))return i;i=i.nextElementSibling}}function Gv(s,o){let i=s.previousElementSibling;for(;i;){if(i.matches(o))return i;i=i.previousElementSibling}}function am(s){let o=x.useRef(s);return Rn(()=>{o.current=s}),o}var Rn=typeof window>"u"?x.useEffect:x.useLayoutEffect;function ps(s){let o=x.useRef();return o.current===void 0&&(o.current=s()),o}function tn(s){let o=hd(),i=()=>s(o.snapshot());return x.useSyncExternalStore(o.subscribe,i,i)}function cm(s,o,i,c=[]){let u=x.useRef(),f=Ko();return Rn(()=>{var m;let p=(()=>{var g;for(let j of i){if(typeof j=="string")return j.trim();if(typeof j=="object"&&"current"in j)return j.current?(g=j.current.textContent)==null?void 0:g.trim():u.current}})(),v=c.map(g=>g.trim());f.value(s,p,v),(m=o.current)==null||m.setAttribute(fs,p),u.current=p}),u}var Kv=()=>{let[s,o]=x.useState(),i=ps(()=>new Map);return Rn(()=>{i.current.forEach(c=>c()),i.current=new Map},[s]),(c,u)=>{i.current.set(c,u),o({})}};function Qv(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&&x.isValidElement(o)?x.cloneElement(Qv(o),{ref:o.ref},i(o.props.children)):i(o)}var qv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Zv({onNavigate:s}){const[o,i]=x.useState(!1);return x.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key.toLowerCase()==="k"&&(u.preventDefault(),i(f=>!f))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),r.jsx(us.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:r.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:c=>c.stopPropagation(),children:[r.jsx(us.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"}),r.jsxs(us.List,{className:"max-h-80 overflow-y-auto p-2",children:[r.jsx(us.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),r.jsx(us.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Zc.map(c=>r.jsxs(us.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{s(c.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:[r.jsx(c.icon,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:c.label}),r.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function we(s,o){var v;const i={"Content-Type":"application/json",...o==null?void 0:o.headers},c=localStorage.getItem("mc_sudo_password"),u=localStorage.getItem("mc_hf_token");c&&(i["X-Sudo-Password"]=c);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 g=JSON.parse(f);let j=!1;c&&!("sudo_password"in g)&&(g.sudo_password=c,j=!0),u&&!("hf_token"in g)&&(g.hf_token=u,j=!0),j&&(f=JSON.stringify(g))}catch{}else if(!f){const g={};c&&(g.sudo_password=c),u&&(g.hf_token=u),Object.keys(g).length>0&&(f=JSON.stringify(g))}}const p=await fetch(s,{...o,headers:i,body:f});if(!p.ok)throw new Error(`${p.status} ${p.statusText}`);return p.json()}const Ye={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??""]},Yv=()=>Ut({queryKey:Ye.health,queryFn:()=>we("/api/health"),refetchInterval:1e4}),md=(s=5e3)=>Ut({queryKey:Ye.systemStatus,queryFn:()=>we("/api/system/status"),refetchInterval:s}),Jv=(s=3e3)=>Ut({queryKey:Ye.services,queryFn:()=>we("/api/system/services"),refetchInterval:s}),Ds=(s=4e3)=>Ut({queryKey:Ye.models,queryFn:()=>we("/api/models"),refetchInterval:s}),Xv=(s=4e3)=>Ut({queryKey:Ye.routing,queryFn:()=>we("/api/routing"),refetchInterval:s}),dm=(s=2e3)=>Ut({queryKey:Ye.jobs,queryFn:()=>we("/api/jobs"),refetchInterval:s,select:o=>o.jobs??[]}),um=(s=3e3)=>Ut({queryKey:Ye.tokenStats,queryFn:()=>we("/api/system/token-stats"),refetchInterval:s}),fm=(s=5e3)=>Ut({queryKey:Ye.agentStatus,queryFn:()=>we("/api/agent/status"),refetchInterval:s}),xd=s=>Ut({queryKey:Ye.updates,queryFn:()=>we("/api/maintenance/updates"),refetchInterval:s}),eb=()=>Ut({queryKey:Ye.discover,queryFn:()=>we("/api/discover")}),pm=s=>Ut({queryKey:Ye.connect(s),queryFn:()=>we(s?`/api/connect?${s}`:"/api/connect")}),hm=s=>Ut({queryKey:Ye.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),we(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function St(s){return(s/1024**3).toFixed(1)}function td(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function Vr(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function tb(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Wp(s){return s?`${Math.round(s/1024)}k`:"—"}function mm(s){var o,i,c="";if(typeof s=="string"||typeof s=="number")c+=s;else if(typeof s=="object")if(Array.isArray(s)){var u=s.length;for(o=0;o{const o=ob(s),{conflictingClassGroups:i,conflictingClassGroupModifiers:c}=s;return{getClassGroupId:m=>{const p=m.split(gd);return p[0]===""&&p.length!==1&&p.shift(),xm(p,o)||sb(m)},getConflictingClassGroupIds:(m,p)=>{const v=i[m]||[];return p&&c[m]?[...v,...c[m]]:v}}},xm=(s,o)=>{var m;if(s.length===0)return o.classGroupId;const i=s[0],c=o.nextPart.get(i),u=c?xm(s.slice(1),c):void 0;if(u)return u;if(o.validators.length===0)return;const f=s.join(gd);return(m=o.validators.find(({validator:p})=>p(f)))==null?void 0:m.classGroupId},Gp=/^\[(.+)\]$/,sb=s=>{if(Gp.test(s)){const o=Gp.exec(s)[1],i=o==null?void 0:o.substring(0,o.indexOf(":"));if(i)return"arbitrary.."+i}},ob=s=>{const{theme:o,prefix:i}=s,c={nextPart:new Map,validators:[]};return ib(Object.entries(s.classGroups),i).forEach(([f,m])=>{rd(m,c,f,o)}),c},rd=(s,o,i,c)=>{s.forEach(u=>{if(typeof u=="string"){const f=u===""?o:Kp(o,u);f.classGroupId=i;return}if(typeof u=="function"){if(lb(u)){rd(u(c),o,i,c);return}o.validators.push({validator:u,classGroupId:i});return}Object.entries(u).forEach(([f,m])=>{rd(m,Kp(o,f),i,c)})})},Kp=(s,o)=>{let i=s;return o.split(gd).forEach(c=>{i.nextPart.has(c)||i.nextPart.set(c,{nextPart:new Map,validators:[]}),i=i.nextPart.get(c)}),i},lb=s=>s.isThemeGetter,ib=(s,o)=>o?s.map(([i,c])=>{const u=c.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([m,p])=>[o+m,p])):f);return[i,u]}):s,ab=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,i=new Map,c=new Map;const u=(f,m)=>{i.set(f,m),o++,o>s&&(o=0,c=i,i=new Map)};return{get(f){let m=i.get(f);if(m!==void 0)return m;if((m=c.get(f))!==void 0)return u(f,m),m},set(f,m){i.has(f)?i.set(f,m):u(f,m)}}},gm="!",cb=s=>{const{separator:o,experimentalParseClassName:i}=s,c=o.length===1,u=o[0],f=o.length,m=p=>{const v=[];let g=0,j=0,w;for(let S=0;Sj?w-j:void 0;return{modifiers:v,hasImportantModifier:M,baseClassName:z,maybePostfixModifierPosition:b}};return i?p=>i({className:p,parseClassName:m}):m},db=s=>{if(s.length<=1)return s;const o=[];let i=[];return s.forEach(c=>{c[0]==="["?(o.push(...i.sort(),c),i=[]):i.push(c)}),o.push(...i.sort()),o},ub=s=>({cache:ab(s.cacheSize),parseClassName:cb(s),...nb(s)}),fb=/\s+/,pb=(s,o)=>{const{parseClassName:i,getClassGroupId:c,getConflictingClassGroupIds:u}=o,f=[],m=s.trim().split(fb);let p="";for(let v=m.length-1;v>=0;v-=1){const g=m[v],{modifiers:j,hasImportantModifier:w,baseClassName:_,maybePostfixModifierPosition:M}=i(g);let z=!!M,b=c(z?_.substring(0,M):_);if(!b){if(!z){p=g+(p.length>0?" "+p:p);continue}if(b=c(_),!b){p=g+(p.length>0?" "+p:p);continue}z=!1}const S=db(j).join(":"),O=w?S+gm:S,I=O+b;if(f.includes(I))continue;f.push(I);const B=u(b,z);for(let F=0;F0?" "+p:p)}return p};function hb(){let s=0,o,i,c="";for(;s{if(typeof s=="string")return s;let o,i="";for(let c=0;cw(j),s());return i=ub(g),c=i.cache.get,u=i.cache.set,f=p,p(v)}function p(v){const g=c(v);if(g)return g;const j=pb(v,i);return u(v,j),j}return function(){return f(hb.apply(null,arguments))}}const $e=s=>{const o=i=>i[s]||[];return o.isThemeGetter=!0,o},vm=/^\[(?:([a-z-]+):)?(.+)\]$/i,xb=/^\d+\/\d+$/,gb=new Set(["px","full","screen"]),yb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vb=/\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$/,bb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xr=s=>ms(s)||gb.has(s)||xb.test(s),Ur=s=>Ts(s,"length",Mb),ms=s=>!!s&&!Number.isNaN(Number(s)),Pc=s=>Ts(s,"number",ms),Eo=s=>!!s&&Number.isInteger(Number(s)),kb=s=>s.endsWith("%")&&ms(s.slice(0,-1)),Ne=s=>vm.test(s),$r=s=>yb.test(s),Nb=new Set(["length","size","percentage"]),Sb=s=>Ts(s,Nb,bm),Cb=s=>Ts(s,"position",bm),Eb=new Set(["image","url"]),Pb=s=>Ts(s,Eb,Ob),_b=s=>Ts(s,"",Rb),Po=()=>!0,Ts=(s,o,i)=>{const c=vm.exec(s);return c?c[1]?typeof o=="string"?c[1]===o:o.has(c[1]):i(c[2]):!1},Mb=s=>vb.test(s)&&!bb.test(s),bm=()=>!1,Rb=s=>wb.test(s),Ob=s=>jb.test(s),Db=()=>{const s=$e("colors"),o=$e("spacing"),i=$e("blur"),c=$e("brightness"),u=$e("borderColor"),f=$e("borderRadius"),m=$e("borderSpacing"),p=$e("borderWidth"),v=$e("contrast"),g=$e("grayscale"),j=$e("hueRotate"),w=$e("invert"),_=$e("gap"),M=$e("gradientColorStops"),z=$e("gradientColorStopPositions"),b=$e("inset"),S=$e("margin"),O=$e("opacity"),I=$e("padding"),B=$e("saturate"),F=$e("scale"),D=$e("sepia"),$=$e("skew"),H=$e("space"),ae=$e("translate"),te=()=>["auto","contain","none"],fe=()=>["auto","hidden","clip","visible","scroll"],ke=()=>["auto",Ne,o],ue=()=>[Ne,o],ze=()=>["",xr,Ur],Ce=()=>["auto",ms,Ne],Le=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Ee=()=>["solid","dashed","dotted","double","none"],Pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],ee=()=>["","0",Ne],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[ms,Ne];return{cacheSize:500,separator:":",theme:{colors:[Po],spacing:[xr,Ur],blur:["none","",$r,Ne],brightness:P(),borderColor:[s],borderRadius:["none","","full",$r,Ne],borderSpacing:ue(),borderWidth:ze(),contrast:P(),grayscale:ee(),hueRotate:P(),invert:ee(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[kb,Ur],inset:ke(),margin:ke(),opacity:P(),padding:ue(),saturate:P(),scale:P(),sepia:ee(),skew:P(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[$r]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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:[...Le(),Ne]}],overflow:[{overflow:fe()}],"overflow-x":[{"overflow-x":fe()}],"overflow-y":[{"overflow-y":fe()}],overscroll:[{overscroll:te()}],"overscroll-x":[{"overscroll-x":te()}],"overscroll-y":[{"overscroll-y":te()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Eo,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:ee()}],shrink:[{shrink:ee()}],order:[{order:["first","last","none",Eo,Ne]}],"grid-cols":[{"grid-cols":[Po]}],"col-start-end":[{col:["auto",{span:["full",Eo,Ne]},Ne]}],"col-start":[{"col-start":Ce()}],"col-end":[{"col-end":Ce()}],"grid-rows":[{"grid-rows":[Po]}],"row-start-end":[{row:["auto",{span:[Eo,Ne]},Ne]}],"row-start":[{"row-start":Ce()}],"row-end":[{"row-end":Ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ne]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],pt:[{pt:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"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:[$r]},$r]}],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",$r,Ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pc]}],"font-family":[{font:[Po]}],"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",ms,Pc]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",xr,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":[O]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[O]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ee(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",xr,Ur]}],"underline-offset":[{"underline-offset":["auto",xr,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":[O]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Le(),Cb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Sb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Pb]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[z]}],"gradient-via-pos":[{via:[z]}],"gradient-to-pos":[{to:[z]}],"gradient-from":[{from:[M]}],"gradient-via":[{via:[M]}],"gradient-to":[{to:[M]}],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:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[O]}],"border-style":[{border:[...Ee(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[O]}],"divide-style":[{divide:Ee()}],"border-color":[{border:[u]}],"border-color-x":[{"border-x":[u]}],"border-color-y":[{"border-y":[u]}],"border-color-s":[{"border-s":[u]}],"border-color-e":[{"border-e":[u]}],"border-color-t":[{"border-t":[u]}],"border-color-r":[{"border-r":[u]}],"border-color-b":[{"border-b":[u]}],"border-color-l":[{"border-l":[u]}],"divide-color":[{divide:[u]}],"outline-style":[{outline:["",...Ee()]}],"outline-offset":[{"outline-offset":[xr,Ne]}],"outline-w":[{outline:[xr,Ur]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:ze()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[O]}],"ring-offset-w":[{"ring-offset":[xr,Ur]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",$r,_b]}],"shadow-color":[{shadow:[Po]}],opacity:[{opacity:[O]}],"mix-blend":[{"mix-blend":[...Pe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Pe()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[c]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",$r,Ne]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[j]}],invert:[{invert:[w]}],saturate:[{saturate:[B]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[O]}],"backdrop-saturate":[{"backdrop-saturate":[B]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"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:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[Eo,Ne]}],"translate-x":[{"translate-x":[ae]}],"translate-y":[{"translate-y":[ae]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"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:[xr,Ur,Pc]}],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"]}}},Tb=mb(Db);function J(...s){return Tb(rb(s))}function Uo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const Ab={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",reasoning:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"};function zb(){const{data:s}=Ds(2e3),{data:o}=um(2e3),i=(s==null?void 0:s.models)??[],c=(s==null?void 0:s.running)??[],u=i.filter(v=>c.includes(v.name)),f=x.useRef(null),[m,p]=x.useState(!1);return x.useEffect(()=>{if(!o)return;const v=o.total_tokens;if(f.current!==null&&v>f.current){p(!0);const g=setTimeout(()=>p(!1),4e3);return f.current=v,()=>clearTimeout(g)}f.current=v},[o==null?void 0:o.total_tokens]),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),r.jsxs("span",{className:J("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",m?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[m?r.jsx(B0,{className:"h-3 w-3 animate-pulse"}):r.jsx(R0,{className:"h-3 w-3"}),m?"Inferenz aktiv":"Idle"]})]}),u.length===0?r.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):r.jsx("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:u.map(v=>{var g;return r.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[v.role&&r.jsx("span",{className:J("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",Ab[v.role]||"bg-slate-500/15 text-slate-300 border-slate-500/25"),children:v.role}),r.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(g=v.name.split("/").pop())==null?void 0:g.replace(/\.gguf$/i,"")})]}),r.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Vr(v.size_bytes)," im Unified-RAM"]})]}),r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[r.jsx("span",{className:J("h-1.5 w-1.5 rounded-full bg-emerald-500",m&&"animate-pulse")})," warm"]})]},v.name)})})]})}function fi({value:s,label:o,detail:i}){const u=2*Math.PI*24,f=u-Math.min(s,100)/100*u,m=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return r.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[r.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),r.jsx("circle",{cx:"32",cy:"32",r:24,className:J("fill-none transition-all duration-700 ease-out",m),strokeWidth:"4.5",strokeDasharray:u,strokeDashoffset:f,strokeLinecap:"round"})]}),r.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),r.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),i&&r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Lb(){const{data:s}=md(3e3);return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(fi,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),r.jsx(fi,{value:s.ram.percent,label:"RAM",detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`}),s.gpu&&s.gpu.busy_percent!=null&&s.gpu.gtt_used!=null&&s.gpu.gtt_total!=null&&r.jsx(fi,{value:s.gpu.busy_percent,label:"GPU",detail:`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB`}),s.disk&&r.jsx(fi,{value:s.disk.percent,label:"Disk",detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`})]}):r.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)&&r.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&&r.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&r.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]})}function wm({type:s,title:o,message:i,defaultValue:c,onConfirm:u,onCancel:f}){const m=x.useRef(null);return r.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),r.jsx("button",{onClick:f||(()=>u()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:i}),s==="prompt"&&r.jsx("input",{ref:m,type:"text",defaultValue:c,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:p=>{var v;p.key==="Enter"&&u((v=m.current)==null?void 0:v.value)}}),r.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&r.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"}),r.jsx("button",{onClick:()=>{var v;const p=s==="prompt"?(v=m.current)==null?void 0:v.value:void 0;u(p)},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 Dn(){const[s,o]=x.useState(null),i=x.useCallback(()=>o(null),[]),c=x.useCallback((p,v,g)=>{o({type:"alert",title:p,message:v,onConfirm:()=>{o(null),g==null||g()}})},[]),u=x.useCallback((p,v,g,j)=>{o({type:"confirm",title:p,message:v,onConfirm:()=>{o(null),g()},onCancel:()=>{o(null),j==null||j()}})},[]),f=x.useCallback((p,v,g,j,w)=>{o({type:"prompt",title:p,message:v,defaultValue:g,onConfirm:_=>{o(null),j(_)},onCancel:()=>{o(null),w==null||w()}})},[]),m=s?r.jsx(wm,{...s}):null;return{showAlert:c,showConfirm:u,showPrompt:f,close:i,dialogElement:m}}function Fb(){const s=rn(),{data:o}=xd(3e3),{data:i=[]}=dm(3e3),{showConfirm:c,dialogElement:u}=Dn(),[f,m]=x.useState(""),[p,v]=x.useState(!1),[g,j]=x.useState(""),[w,_]=x.useState(!1),[M,z]=x.useState({open:!1,actionPath:"",actionLabel:""}),b=()=>{s.invalidateQueries({queryKey:Ye.updates}),s.invalidateQueries({queryKey:Ye.jobs}),s.invalidateQueries({queryKey:Ye.models})};async function S(D,$,H,ae){m(`${$} wird ausgeführt...`),v(!0);try{const te={...H},fe=await we(D,{method:"POST",body:JSON.stringify(te)});if(fe.status==="password_required"||fe.status==="incorrect_password"){z({open:!0,actionPath:D,actionLabel:$,payload:H,error:fe.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),m("");return}fe.job_id?m(`${$} gestartet (Job-ID: ${fe.job_id})`):fe.ok?m(`${$} erfolgreich ausgeführt.`):m(`Fehler: ${fe.err||"Unbekannter Fehler"}`),b()}catch(te){m(`Fehler bei ${$}: ${te.message}`)}finally{v(!1)}}async function O(){_(!0);try{const D={...M.payload,sudo_password:g},$=await we(M.actionPath,{method:"POST",body:JSON.stringify(D)});if($.status==="password_required"||$.status==="incorrect_password"){z(H=>({...H,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}$.job_id?m(`${M.actionLabel} gestartet (Job-ID: ${$.job_id})`):$.ok?m(`${M.actionLabel} erfolgreich ausgeführt.`):m(`Fehler: ${$.err||"Unbekannter Fehler"}`),z({open:!1,actionPath:"",actionLabel:""}),j(""),b()}catch(D){m(`Fehler: ${D.message}`),z({open:!1,actionPath:"",actionLabel:""}),j("")}finally{_(!1)}}async function I(D,$){m(`Upgrade für ${D} wird gestartet...`);try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:D,role:$,quant:"Q4_K_M",jinja:!0})}),m("Upgrade-Download gestartet."),b()}catch(H){m(`Upgrade fehlgeschlagen: ${H.message}`)}}const B=i.find(D=>D.label.includes("OS-Update")&&(D.state==="running"||D.state==="queued")),F=i.find(D=>D.label.includes("Engine-Update")&&(D.state==="running"||D.state==="queued"));return r.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:[M.open&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),r.jsx("button",{onClick:()=>{z({open:!1,actionPath:"",actionLabel:""}),j("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",r.jsx("strong",{children:M.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"password",value:g,onChange:D=>j(D.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:D=>D.key==="Enter"&&O(),autoFocus:!0}),M.error&&r.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:M.error})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{z({open:!1,actionPath:"",actionLabel:""}),j("")},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"}),r.jsx("button",{onClick:O,disabled:!g||w,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:w?"Prüfe...":"Ausführen"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(L0,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(o==null?void 0:o.last_check)&&r.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?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:J("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:[r.jsx("span",{children:"OS-Pakete"}),r.jsx("span",{className:"font-mono",children:o.os>0?`${o.os} verfügbar`:"aktuell"})]}),r.jsxs("div",{className:J("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:[r.jsx("span",{children:"Engine (llama.cpp)"}),r.jsx("span",{className:"font-mono",children:o.engine>0?"Update verfügbar":"aktuell"})]}),r.jsxs("div",{className:J("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:[r.jsx("span",{children:"Modell-Upgrades"}),r.jsx("span",{className:"font-mono",children:o.models>0?`${o.models} verfügbar`:"aktuell"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[r.jsx("button",{onClick:()=>S("/api/maintenance/os-update","OS-Update"),disabled:p||!!B,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:B?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",B.progress??0,"%)"]})]}):r.jsx("span",{children:"OS Update"})}),r.jsx("button",{onClick:()=>S("/api/maintenance/engine-update","Engine-Update"),disabled:p||!!F,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:F?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",F.progress??0,"%)"]})]}):r.jsx("span",{children:"Engine Update"})})]}),r.jsxs("button",{onClick:()=>{c("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>S("/api/maintenance/reboot","Reboot"))},disabled:p,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:[r.jsx(Eh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Host Reboot"})]}),o.model_list.length>0&&r.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[r.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),r.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:o.model_list.map(D=>r.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:[r.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${D.role}: ${D.repo}`,children:[r.jsx("span",{className:"text-primary font-bold uppercase",children:D.role}),": ",D.repo.split("/").pop()]}),r.jsxs("button",{onClick:()=>I(D.repo,D.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:[r.jsx(_n,{className:"h-2.5 w-2.5"})," Laden"]})]},D.repo))})]})]}):r.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),f&&r.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}),r.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:[r.jsx(Ms,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),r.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",r.jsx("code",{children:"/etc/sudoers"})," (z.B. ",r.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),r.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:r.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"})}),u]})}function Ib(){const s=rn(),{data:o}=fm(3e3),{data:i}=Ds(),{showAlert:c,dialogElement:u}=Dn(),[f,m]=x.useState(!1),p=(i==null?void 0:i.models)??[];async function v(g){try{await we("/api/agent/brain",{method:"POST",body:JSON.stringify({model:g})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${g}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Ye.agentStatus}),m(!1)}catch(j){c("Fehler",`Fehler beim Wechseln des Gehirns: ${j.message}`)}}return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(o==null?void 0:o.webui_url)&&r.jsxs("a",{href:Uo(o.webui_url),target:"_blank",rel:"noopener",className:J("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:[r.jsx(yi,{className:"h-3 w-3"})," Hermes öffnen"]})]}),o?r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.gateway_reachable?"Online":"Offline"})]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.webui_reachable?"Online":"Offline"})]})]}),r.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",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),r.jsx(Ot,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[r.jsx(zo,{className:"h-3 w-3 shrink-0"}),o.brain_model||"auto"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),r.jsx(Lo,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[r.jsxs("div",{children:["Config: ",o.has_config?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Skills: ",o.has_skills?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Memory: ",o.has_memories?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),o&&r.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Telegram"}),r.jsx("span",{className:J("font-semibold",o.telegram_enabled?"text-emerald-400":""),children:o.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"MCP-Server"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[o.mcp_server_count??0," verbunden"]})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"PC Executor"}),r.jsx("span",{className:J("font-semibold",o.pc_executor_reachable?"text-emerald-400":""),children:o.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),o&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4"}),r.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),r.jsx("button",{onClick:()=>m(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.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 (',r.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),r.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...p.map(g=>{var j;return((j=g.name.split("/").pop())==null?void 0:j.replace(".gguf",""))||g.name})].map(g=>{const j=["auto","fast","heavy"].includes(g);return r.jsxs("button",{onClick:()=>v(g),className:J("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===g||!o.brain_model&&g==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:g}),r.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:j?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===g||!o.brain_model&&g==="auto")&&r.jsx(_s,{className:"h-4 w-4 shrink-0 text-primary"})]},g)})})]})}),u]})}const Ub=["fast","heavy","coder","vision","scout"];function $b(){const{data:s}=Ds(3e3),o=(s==null?void 0:s.models)??[],i=(s==null?void 0:s.running)??[];return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(zo,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:Ub.map(c=>{var m;const u=o.find(p=>p.role===c),f=u?i.includes(u.name):!1;return r.jsxs("div",{className:J("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":u?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[r.jsx("div",{className:"min-w-0 flex-1 mr-2",children:r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:J("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",c==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":c==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":c==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":c==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:c}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:u?(m=u.name.split("/").pop())==null?void 0:m.replace(/\.gguf$/i,""):"nicht zugewiesen"}),u&&r.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[u.prompt_cache&&r.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"}),u.spec_draft_model&&r.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: ${u.spec_draft_model})`,children:"SPEC"}),u.parallel_slots>1&&r.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:`${u.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",u.parallel_slots]}),u.incomplete&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),r.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:u?f?r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},c)})})]}),r.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 Bb(){const s=rn(),{data:o=[]}=hm({limit:3}),[i,c]=x.useState(""),[u,f]=x.useState("stable"),[m,p]=x.useState(!1);async function v(){if(!(!i.trim()||m)){p(!0);try{await we("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:u,source:"dashboard"})}),c(""),s.invalidateQueries({queryKey:["memory"]})}catch(g){console.error(g)}finally{p(!1)}}}return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Ao,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("textarea",{value:i,onChange:g=>c(g.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"}),r.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[r.jsxs("select",{value:u,onChange:g=>f(g.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[r.jsx("option",{value:"stable",children:"🔵 Fakt"}),r.jsx("option",{value:"instruction",children:"📋 Regel"}),r.jsx("option",{value:"user",children:"👤 User"}),r.jsx("option",{value:"versioned",children:"🟡 Version"})]}),r.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:[r.jsx(Ch,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),r.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[r.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),r.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:o.length===0?r.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):o.map(g=>r.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[r.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:g.category}),r.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:g.content,children:g.content})]},g.id))})]})]}),r.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 Hb(){var o;const{data:s}=um(3e3);return r.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:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(j0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),s?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),r.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})," €"]}),r.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",s.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),r.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:s.total_tokens.toLocaleString("de-DE")}),r.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Input (Prompts):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Output (Antworten):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),r.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet ggü. Cloud-APIs",(o=s==null?void 0:s.pricing)!=null&&o.heavy?` (Ø ${(s.pricing.heavy.in??0).toFixed(2).replace(".",",")} $ / ${(s.pricing.heavy.out??0).toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})}function Vb(){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.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"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),r.jsx(zb,{}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[r.jsx(Lb,{}),r.jsx(Fb,{})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[r.jsx(Ib,{}),r.jsx($b,{}),r.jsx(Bb,{}),r.jsx(Hb,{})]})]})}function Wb(){const s=rn(),{data:o=[]}=dm(2e3),{showAlert:i,dialogElement:c}=Dn();async function u(p){try{await we(`/api/jobs/${p}/cancel`,{method:"POST"}),s.invalidateQueries({queryKey:Ye.jobs})}catch(v){i("Fehler",v.message)}}const f=o.filter(p=>p.state==="running"||p.state==="queued"),m=o.filter(p=>p.state!=="running"&&p.state!=="queued").slice(-3);return f.length===0&&m.length===0?null:r.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:[r.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),f.map(p=>r.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center text-xs",children:[r.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:p.label}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-muted-foreground font-mono",children:[p.progress??0,"% • ",td(p.done_bytes),"/",td(p.total_bytes),p.eta_s?` • ETA ${tb(p.eta_s)}`:""]}),r.jsx("button",{onClick:()=>u(p.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"})]})]}),r.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${p.progress??0}%`}})})]},p.id)),m.map(p=>r.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[r.jsx("span",{className:"truncate",children:p.label}),r.jsx("span",{className:J("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",p.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:p.state})]},p.id)),c]})}function gn({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 r.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${i[o]}`,children:s})}function Qp({caps:s}){return s?r.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&r.jsx(gn,{children:"💻 Code"}),s.vision&&r.jsx(gn,{children:"👁 Bild"}),s.reasoning&&r.jsx(gn,{children:"🧠 Reason"}),s.moe&&r.jsxs(gn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&r.jsx(gn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&r.jsx(gn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&r.jsx(gn,{children:"🔢 Embed"})]}):null}const Gb=["fast","heavy","coder","agent","vision","scout"];function Kb({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 r.jsxs("span",{className:J("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}function qp(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 Qb(){var Tn,zs,Ls,An,Fs;const s=rn(),{data:o,isLoading:i,error:c}=Ds(4e3),{data:u}=Xv(4e3),{data:f}=pm(),{data:m}=xd(4e3),{showAlert:p,showConfirm:v,showPrompt:g,dialogElement:j}=Dn(),w=(o==null?void 0:o.models)??[],_=(o==null?void 0:o.running)??[],M=c?String(c):"",z=()=>{s.invalidateQueries({queryKey:Ye.models}),s.invalidateQueries({queryKey:Ye.routing})},[b,S]=x.useState(null),[O,I]=x.useState(null),[B,F]=x.useState(!1),[D,$]=x.useState(null),[H,ae]=x.useState("grid"),[te,fe]=x.useState("all"),ke=w.filter(L=>te==="in_use"?!!L.role||_.includes(L.name):!0),[ue,ze]=x.useState({width:800,height:360}),Ce=x.useRef(null),Le=x.useCallback(L=>{if(Ce.current&&(Ce.current.disconnect(),Ce.current=null),L){const se=new ResizeObserver(je=>{if(!je||je.length===0)return;const De=je[0].contentRect;ze({width:De.width,height:De.height})});se.observe(L),Ce.current=se}},[]),Ee=ue.width,Pe=ue.height,K=L=>{const se=Ee*.1,je=Pe*L,De=Ee*.5,He=Pe*.5,ir=Ee*.3,zn=je,Ln=Ee*.3;return`M ${se} ${je} C ${ir} ${zn}, ${Ln} ${He}, ${De} ${He}`},ee=L=>{const se=Ee*.5,je=Pe*.5,De=Ee*.9,He=Pe*L,ir=Ee*.7,zn=je,Ln=Ee*.7;return`M ${se} ${je} C ${ir} ${zn}, ${Ln} ${He}, ${De} ${He}`};async function Y(L){try{await we(`/api/models/${encodeURIComponent(L)}/load`,{method:"POST"}),z()}catch(se){p("Fehler",`Fehler beim Laden des Modells: ${se.message}`)}}async function P(L){try{await we(`/api/models/${encodeURIComponent(L)}/unload`,{method:"POST"}),z()}catch(se){p("Fehler",`Fehler beim Entladen des Modells: ${se.message}`)}}async function C(){try{await we("/api/models/unload",{method:"POST"}),z()}catch(L){p("Fehler",`Fehler beim Entladen aller Modelle: ${L.message}`)}}async function Z(L,se){try{await we(`/api/models/${encodeURIComponent(se)}/role`,{method:"POST",body:JSON.stringify({role:L||null})}),z()}catch(je){p("Fehler",`Fehler beim Zuweisen der Rolle: ${je.message||je}`)}}async function X(L,se){g("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(se||32768),async je=>{if(je)try{await we(`/api/models/${encodeURIComponent(L)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(je,10)})}),z()}catch(De){p("Fehler",`Fehler beim Setzen des Kontexts: ${De.message||De}`)}})}async function q(L){v("Modell löschen?",`Modell '${L}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await we(`/api/models/${encodeURIComponent(L)}`,{method:"DELETE"}),z()}catch(se){p("Fehler",`Fehler beim Löschen: ${se.message||se}`)}})}async function le(L,se,je,De){try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:L,role:se,quant:je,jinja:De})}),p("Herunterladen gestartet",`Download für '${L}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(He){p("Fehler",`Fehler beim Starten des Upgrades: ${He.message||He}`)}}async function pe(L){L&&(await navigator.clipboard.writeText(L),F(!0),setTimeout(()=>F(!1),1500))}if(i)return r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(M)return r.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 ve=w.filter(L=>_.includes(L.name)),U=ve.reduce((L,se)=>L+(se.size_bytes||0),0),me=16*1024**3,xt=U>me?U*1.2:me,As=L=>w.find(se=>se.role===L),Zt=L=>{const se=As(L);return se?_.includes(se.name):!1};return r.jsxs("div",{className:"space-y-8",children:[r.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -377,7 +377,7 @@ Error generating stack: `+d.message+` stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),r.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:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qc,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",Vr(U)," / ",Vr(xt)," geladen"]}),_.length>0&&r.jsx("button",{onClick:C,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"})]})]}),r.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:ve.length===0?r.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"}):ve.map((A,se)=>{var He;const je=(A.size_bytes||0)/xt*100,De=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][se%4];return r.jsxs("div",{style:{width:`${je}%`},className:J("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",De),title:`${A.name} (${Vr(A.size_bytes)})`,children:[r.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[A.role?`[${A.role}] `:"",(He=A.name.split("/").pop())==null?void 0:He.replace(".gguf","")]}),r.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Vr(A.size_bytes)})]},A.name)})})]}),r.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:[r.jsxs("div",{children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),r.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."})]}),r.jsxs("div",{ref:Le,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[r.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),r.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),r.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),r.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),r.jsx("path",{d:K(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="roocode"||b==="roocode")&&r.jsx("path",{d:K(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="cursor"||b==="cursor")&&r.jsx("path",{d:K(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="opencode"||b==="opencode")&&r.jsx("path",{d:K(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="zed"||b==="zed")&&r.jsx("path",{d:K(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="continue"||b==="continue")&&r.jsx("path",{d:K(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("fast")&&r.jsx("path",{d:ee(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("heavy")&&r.jsx("path",{d:ee(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("coder")&&r.jsx("path",{d:ee(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("vision")&&r.jsx("path",{d:ee(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("scout")&&r.jsx("path",{d:ee(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),r.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:()=>$("roocode"),onMouseLeave:()=>$(null),onClick:()=>S(A=>A==="roocode"?null:"roocode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Roo Code"})]}),r.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:()=>$("cursor"),onMouseLeave:()=>$(null),onClick:()=>S(A=>A==="cursor"?null:"cursor"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Cursor IDE"})]}),r.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:()=>$("opencode"),onMouseLeave:()=>$(null),onClick:()=>S(A=>A==="opencode"?null:"opencode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"OpenCode"})]}),r.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:()=>$("zed"),onMouseLeave:()=>$(null),onClick:()=>S(A=>A==="zed"?null:"zed"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Zed"})]}),r.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:()=>$("continue"),onMouseLeave:()=>$(null),onClick:()=>S(A=>A==="continue"?null:"continue"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Continue"})]}),r.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:[r.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",u!=null&&u.heavy_threshold_chars?u.heavy_threshold_chars/1e3:"4","k Zeichen"]}),r.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"})]}),Gb.map(A=>{var ir;const se=["12%","31%","50%","69%","88%"],je=As(A),De=je?_.includes(je.name):!1;if(A==="reasoning"||A==="agent")return null;const He={fast:0,heavy:1,coder:2,vision:3,scout:4}[A];return r.jsxs("div",{className:J("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",De?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":je?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:se[He]},onClick:()=>I(A),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:A}),De&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:je?(ir=je.name.split("/").pop())==null?void 0:ir.replace(".gguf",""):"Keine Zuweisung"})]},A)}),b&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[b==="roocode"&&"Roo Code Setup",b==="cursor"&&"Cursor Setup",b==="opencode"&&"OpenCode Setup",b==="zed"&&"Zed Setup",b==="continue"&&"Continue Setup"]}),r.jsx("button",{onClick:()=>S(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[b==="roocode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",r.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),r.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",r.jsx("strong",{children:"OpenAI Compatible"}),"."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",r.jsx("code",{children:"settings.json"})," ein."]})]}),b==="cursor"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne Cursor Settings ➔ ",r.jsx("strong",{children:"Models"}),"."]}),r.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",r.jsx("strong",{children:"OpenAI API"})," auf."]}),r.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",r.jsx("strong",{children:"auto"}),"."]})]}),b==="opencode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die ",r.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),r.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",r.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),b==="zed"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die Zed Settings (",r.jsx("code",{children:"ctrl+,"}),")."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",r.jsx("code",{children:"language_models"})," ein."]})]}),b==="continue"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),r.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",r.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),f.tools&&r.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),r.jsxs("button",{onClick:()=>{var A,se,je,De,He;return pe(b==="roocode"?(A=f.tools.cline)==null?void 0:A.snippet:b==="cursor"?(se=f.tools.cursor)==null?void 0:se.snippet:b==="opencode"?(je=f.tools.opencode)==null?void 0:je.snippet:b==="zed"?(De=f.tools.zed)==null?void 0:De.snippet:(He=f.tools.continue)==null?void 0:He.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[B?r.jsx(_s,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Sh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:B?"Kopiert":"Kopieren"})]})]}),r.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:r.jsxs("code",{children:[b==="roocode"&&((Tn=f.tools.cline)==null?void 0:Tn.snippet),b==="cursor"&&((zs=f.tools.cursor)==null?void 0:zs.snippet),b==="opencode"&&((Ls=f.tools.opencode)==null?void 0:Ls.snippet),b==="zed"&&((An=f.tools.zed)==null?void 0:An.snippet),b==="continue"&&((Fs=f.tools.continue)==null?void 0:Fs.snippet)]})})]}),r.jsx("button",{onClick:()=>S(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"})]})})]}),r.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:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),r.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),r.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),r.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),r.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:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),r.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 De;const se=w.find(He=>He.role===A),je=se?_.includes(se.name):!1;return r.jsxs("div",{onClick:()=>I(A),className:J("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]",je?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":se?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:J("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}),je&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:se==null?void 0:se.name,children:se?(De=se.name.split("/").pop())==null?void 0:De.replace(/\.gguf$/i,""):"nicht zugewiesen"}),r.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},A)})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[r.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",ke.length," von ",w.length,")"]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>fe("all"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),r.jsx("button",{onClick:()=>fe("in_use"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>ae("grid"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",H==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),r.jsx("button",{onClick:()=>ae("list"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",H==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),H==="grid"?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:ke.length===0?r.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:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ke.map(A=>{const se=_.includes(A.name),je=m==null?void 0:m.model_list.find(He=>He.role===A.role),De=qp(A.name);return r.jsxs("div",{className:J("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",se?"border-primary/45 shadow-primary/5":A.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-start justify-between gap-3",children:r.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[r.jsx("div",{className:J("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",De.color),title:De.name,children:De.initial}),r.jsxs("div",{className:"min-w-0",children:[r.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()}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[r.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"}),se&&r.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[r.jsx(Do,{className:"h-3 w-3 animate-pulse"})," Warm"]}),A.role&&r.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&&r.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&&r.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&&r.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]}),A.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),r.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:r.jsx(Qp,{caps:A.capabilities})})]}),r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(Qc,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),r.jsx("div",{className:"text-foreground font-semibold",children:Vr(A.size_bytes)})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(O0,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),r.jsx("div",{className:"text-foreground font-semibold",children:Wp(A.ctx)})]})]})]}),je&&r.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:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),r.jsxs("span",{children:["Upgrade verfügbar: ",je.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>le(je.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:[r.jsx(_n,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[r.jsx("button",{onClick:()=>se?P(A.name):Y(A.name),disabled:A.incomplete&&!se,className:J("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",A.incomplete&&!se?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":se?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:se?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>X(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"}),r.jsx("button",{onClick:()=>q(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:r.jsx(qc,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})}):r.jsx("div",{className:"space-y-2",children:ke.length===0?r.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ke.map(A=>{const se=_.includes(A.name),je=qp(A.name);return r.jsxs("div",{className:J("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",se?"border-primary/45":A.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r.jsx("div",{className:J("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",je.color),title:je.name,children:je.initial}),r.jsxs("div",{className:"min-w-0 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.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&&r.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&&r.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&&r.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&&r.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]}),A.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),se&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[r.jsxs("span",{children:["Größe: ",Vr(A.size_bytes)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Kontext: ",Wp(A.ctx)]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:"font-mono text-[9px]",children:A.quant||"GGUF"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[r.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:r.jsx(Qp,{caps:A.capabilities})}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{onClick:()=>se?P(A.name):Y(A.name),disabled:A.incomplete&&!se,className:J("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",A.incomplete&&!se?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":se?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:se?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>X(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"}),r.jsx("button",{onClick:()=>q(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:r.jsx(qc,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})})]}),O&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",O,"' konfigurieren"]}),r.jsx("button",{onClick:()=>I(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",r.jsx("strong",{className:"text-foreground",children:O}),":"]}),r.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[r.jsx("button",{onClick:()=>{Z(O,""),I(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:r.jsx("span",{children:"Zuweisung entfernen"})}),w.map(A=>{var se;return r.jsxs("button",{onClick:()=>{Z(O,A.name),I(null)},className:J("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===O?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(se=A.name.split("/").pop())==null?void 0:se.replace(".gguf","")}),r.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[Vr(A.size_bytes)," · ",A.quant]})]}),A.role===O&&r.jsx(_s,{className:"h-4 w-4 shrink-0 text-primary"})]},A.name)})]})]})}),j]})}function qb(){const[s,o]=x.useState(""),[i,c]=x.useState([]),[u,f]=x.useState("Q4_K_M"),[m,p]=x.useState(""),[v,g]=x.useState(""),[j,w]=x.useState([]);async function _(b){const S=b??s;if(S.trim()){p("Analysiere HuggingFace Repository...");try{const O=await we(`/api/hf/quants?repo=${encodeURIComponent(S)}`);o(O.repo),c(O.quants),O.quants.length&&f(O.quants.includes("Q4_K_M")?"Q4_K_M":O.quants[0]),p(O.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(O){p(`Fehler: ${O}`)}}}async function M(){if(v.trim()){p("Durchsuche HuggingFace...");try{const b=await we(`/api/hf/search?q=${encodeURIComponent(v)}`);w(b.results),p(b.results.length?"":"Keine Ergebnisse gefunden.")}catch(b){p(`Suche fehlgeschlagen: ${b}`)}}}async function L(){if(s.trim()){p("Download-Job wird initiiert...");try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:u,jinja:!0})}),p(`Download gestartet: ${s} (${u}). Fortschritt wird oben angezeigt.`)}catch(b){p(`Download-Fehler: ${b}`)}}}return r.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:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsx("input",{value:s,onChange:b=>o(b.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"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>_(),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&&r.jsxs(r.Fragment,{children:[r.jsx("select",{value:u,onChange:b=>f(b.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(b=>r.jsx("option",{value:b,className:"bg-popover text-foreground",children:b},b))}),r.jsxs("button",{onClick:L,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:[r.jsx(_n,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),r.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:v,onChange:b=>g(b.target.value),onKeyDown:b=>b.key==="Enter"&&M(),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"}),r.jsx(dd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.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",children:"Suchen"})]}),j.length>0&&r.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:j.map(b=>r.jsxs("button",{onClick:()=>{o(b.repo),w([]),g(""),_(b.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:[r.jsx("span",{className:"font-semibold truncate",children:b.repo}),r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[r.jsx(_n,{className:"h-3 w-3"})," ",b.downloads.toLocaleString()]})]},b.repo))}),m&&r.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:m})]})}const Zb={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Kc},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Wc},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Ao},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:To},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:Gc}};function Yb(){const{data:s,isLoading:o,error:i}=eb(),{data:c}=Ds(),{data:u}=xd(),f=(c==null?void 0:c.models)??[],m=i?String(i):"",[p,v]=x.useState({}),[g,j]=x.useState({}),[w,_]=x.useState(!1);async function M(L,b,S,O){v(I=>({...I,[L]:"Starte..."}));try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:L,role:b,quant:S,jinja:O})}),v(I=>({...I,[L]:"Download läuft"}))}catch{v(B=>({...B,[L]:"Fehler"}))}}return o?r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):m||!s?r.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,")."]}):r.jsxs("div",{className:"space-y-8",children:[r.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:[r.jsxs("div",{children:["Modell-Registry geladen für ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ph,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),r.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(L=>{const b=Zb[L.role]||{title:L.title||L.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:zo},S=b.icon,O=f.find(H=>H.role===L.role),I=u==null?void 0:u.model_list.find(H=>H.role===L.role),B=L.models.find(H=>H.repo===L.recommended)||L.models[0];if(!B)return null;const F=p[B.repo],D=L.models.filter(H=>H.repo!==L.recommended),$=!!g[L.role];return r.jsxs("div",{className:J("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",O?"border-border/60":"border-primary/20 shadow-primary/5"),children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.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:r.jsx(S,{className:"h-5.5 w-5.5"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:b.title}),r.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: ",L.role]})]})]}),O?r.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:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):r.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"})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:b.desc}),r.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:O?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:O.name,children:O.name.split("/").pop()}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[r.jsxs("span",{children:["Größe: ",td(O.size_bytes||0)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",O.quant||"GGUF"]})]})]}):r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:B.name,children:B.name}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[r.jsxs("span",{children:["Ersteller: ",B.author]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",B.quant]})]}),r.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:r.jsx(Kb,{fit:B.fit})})]})}),r.jsx("div",{className:"pt-1",children:O?I?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),r.jsxs("span",{children:["Bessere Version in der Registry: ",I.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>M(I.repo,L.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!p[I.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:[r.jsx(_n,{className:"h-3.5 w-3.5"}),p[I.repo]||"Auf neue Version aktualisieren"]})]}):r.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:[r.jsx(_s,{className:"h-4 w-4"})," Auf neuestem Stand"]}):r.jsxs("button",{onClick:()=>M(B.repo,L.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!F,className:J("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",F?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[r.jsx(_n,{className:"h-3.5 w-3.5"}),F||"Optimales Modell einsetzen"]})})]}),D.length>0&&r.jsxs("div",{className:"border-t border-border/20 pt-3",children:[r.jsxs("button",{onClick:()=>j(H=>({...H,[L.role]:!$})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[$?r.jsx(v0,{className:"h-3 w-3"}):r.jsx(x0,{className:"h-3 w-3"}),r.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",D.length,")"]})]}),$&&r.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:D.map(H=>r.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:H.name,children:H.name}),r.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[r.jsxs("span",{children:["Quant: ",H.quant]}),r.jsx("span",{children:"•"}),r.jsx("span",{children:H.fit.text})]})]}),r.jsx("button",{onClick:()=>M(H.repo,L.role,H.quant||"Q4_K_M",H.caps.tools!=="no"),disabled:!!p[H.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:p[H.repo]||"Installieren"})]},H.repo))})]})]},L.role)})}),r.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[r.jsxs("button",{onClick:()=>_(!w),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:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dd,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),r.jsx("span",{className:"text-[10px] text-primary hover:underline",children:w?"Ausblenden ▲":"Anzeigen ▼"})]}),w&&r.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:r.jsx(qb,{})})]})]})}function Jb(){const[s,o]=x.useState("cockpit");return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.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"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),r.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=>r.jsx("button",{onClick:()=>o(i),className:J("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))})]}),r.jsx(Wb,{}),r.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?r.jsx(Qb,{}):r.jsx(Yb,{})})]})}function pi({label:s,percent:o,detail:i,icon:c}){const u=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 r.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:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),r.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),r.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:r.jsx("div",{className:J("h-full transition-all duration-700 ease-out",u),style:{width:`${Math.min(o,100)}%`}})}),i&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Xb(){const{data:s,error:o}=md(3e3),{data:i}=Jv(3e3),{showAlert:c,dialogElement:u}=Dn(),f=o?String(o):"",[m,p]=x.useState(""),[v,g]=x.useState({});async function j(){p("Backup snapshotted...");try{const _=await we("/api/system/backup",{method:"POST"});p(_.ok?`Snapshot erzeugt: ${_.snapshot} (${_.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(_){p(`Fehler: ${_.message}`)}}async function w(_){g(M=>({...M,[_]:!0}));try{const M=await we("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:_})});M.ok?c("Erfolgreich",`Dienst ${_} wurde erfolgreich neu gestartet.`):c("Fehler beim Neustart",`Fehler beim Neustart: ${M.err||"Unbekannter Fehler"}`)}catch(M){c("Fehler",`Fehler: ${M.message}`)}finally{g(M=>({...M,[_]:!1}))}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.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"}),r.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&r.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&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(pi,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:Ot}),r.jsx(pi,{label:"RAM",percent:s.ram.percent,detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`,icon:Do}),s.gpu&&s.gpu.busy_percent!=null&&r.jsx(pi,{label:"GPU",percent:s.gpu.busy_percent,detail:s.gpu.gtt_used!=null&&s.gpu.gtt_total?`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB (GTT/unified)`:s.gpu.vram_used!=null&&s.gpu.vram_total?`${St(s.gpu.vram_used)} / ${St(s.gpu.vram_total)} GB VRAM`:void 0,icon:Ot}),s.disk&&r.jsx(pi,{label:"Disk",percent:s.disk.percent,detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`,icon:Qc})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&r.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&&r.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&r.jsx("span",{children:"|"}),s.temp.gpu!=null&&r.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),i&&r.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:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),r.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"})]}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:i.services.map(_=>r.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:[r.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[r.jsx("span",{className:J("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",_.ok?"bg-emerald-500":"bg-amber-500")}),r.jsxs("div",{className:"truncate",children:[r.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:_.name}),r.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:_.url})]})]}),r.jsx("button",{onClick:()=>w(_.name),disabled:v[_.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:r.jsx(Pn,{className:J("h-3.5 w-3.5",v[_.name]&&"animate-spin")})})]},_.name))}),r.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[r.jsxs("a",{href:Uo(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:[r.jsx(yi,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),r.jsxs("a",{href:Uo(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:[r.jsx(yi,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),r.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:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),r.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:r.jsxs("button",{onClick:j,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:[r.jsx(T0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),m&&r.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:m}),u]})}function e1(){const[s,o]=x.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[i,c]=x.useState(localStorage.getItem("mc_mcp_path")||""),[u,f]=x.useState("cline"),[m,p]=x.useState(!1),v=new URLSearchParams({host:s});i&&v.set("mcp_path",i);const{data:g,error:j}=pm(v.toString()),w=j?String(j):"";function _(S){o(S),S&&localStorage.setItem("mc_host",S)}function M(S){c(S),localStorage.setItem("mc_mcp_path",S)}const L=g==null?void 0:g.tools[u];async function b(){L&&(await navigator.clipboard.writeText(L.snippet),p(!0),setTimeout(()=>p(!1),1500))}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.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"}),r.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."})]}),r.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:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(C0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),r.jsx("input",{value:s,onChange:S=>_(S.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"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(S0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),r.jsx("input",{value:i,onChange:S=>M(S.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"})]})]}),w&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",w]}),g&&r.jsxs("div",{className:"space-y-4",children:[r.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(g.tools).map(([S,O])=>r.jsx("button",{onClick:()=>f(S),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",u===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:O.label},S))}),L&&r.jsxs("div",{className:"space-y-3",children:[L.note&&r.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:[r.jsx(E0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),r.jsx("span",{children:L.note})]}),r.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[r.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),r.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:[r.jsx(vi,{className:"h-3.5 w-3.5 text-primary"}),r.jsx("span",{children:u==="cline"||u==="cursor"?"config.json":"settings.json"})]}),r.jsxs("button",{onClick:b,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?r.jsx(_s,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Sh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:m?"Kopiert":"Kopieren"})]})]}),r.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:r.jsx("code",{children:L.snippet})})]})]})]})]})}const Zp=["user","instruction","stable","versioned","ephemeral"],_c={user:{label:"User",icon:$0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:A0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Ms,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:I0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:w0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Yp={label:"Gedächtnis",icon:Nh,bg:"bg-muted/10",text:"text-muted-foreground"},t1={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 r1(){const[s,o]=x.useState(""),[i,c]=x.useState(""),[u,f]=x.useState(""),[m,p]=x.useState("stable"),[v,g]=x.useState(!1),j=rn(),{showAlert:w,showConfirm:_,dialogElement:M}=Dn(),{data:L=[],error:b}=hm({q:i,category:s}),S=b?String(b):"",O=()=>j.invalidateQueries({queryKey:["memory"]});async function I(){u.trim()&&(await we("/api/memory",{method:"POST",body:JSON.stringify({content:u,category:m,source:"ui"})}),f(""),O())}async function B(D){await we(`/api/memory/${D}`,{method:"DELETE"}),O()}async function F(){g(!0);try{const D=await we("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(D.duplicate_count===0){w("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}_("Deduplizierung bestätigen",`${D.duplicate_count} Dublette(n) in ${D.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await we("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),O()}catch($){w("Fehler",`Fehler beim Löschen: ${$.message}`)}})}catch(D){w("Fehler",`Fehler bei der Deduplizierung: ${D.message}`)}finally{g(!1)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.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)"}),r.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."})]}),r.jsxs("button",{onClick:F,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:[r.jsx(F0,{className:"h-4 w-4 text-primary animate-pulse"}),r.jsx("span",{children:"Deduplizieren"})]})]}),r.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:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),r.jsx("textarea",{value:u,onChange:D=>f(D.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"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),r.jsx("select",{value:m,onChange:D=>p(D.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:Zp.map(D=>{var $;return r.jsx("option",{value:D,className:"bg-popover text-foreground",children:(($=_c[D])==null?void 0:$.label)||D},D)})})]}),r.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 flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[r.jsx(Ch,{className:"h-4 w-4"})," Speichern"]})]})]}),r.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:i,onChange:D=>c(D.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"}),r.jsx(dd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.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:[r.jsx("button",{onClick:()=>o(""),className:J("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"}),Zp.map(D=>{const $=_c[D]||Yp,H=$.icon;return r.jsxs("button",{onClick:()=>o(D),className:J("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===D?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[r.jsx(H,{className:"h-3 w-3"}),r.jsx("span",{children:$.label})]},D)})]})]}),S&&r.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: ",S]}),r.jsx("div",{className:"space-y-3",children:L.length===0?r.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."}):L.map(D=>{const $=_c[D.category]||Yp,H=$.icon;return r.jsxs("div",{className:J("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",t1[D.category]||"border-l-muted"),children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[r.jsxs("span",{className:J("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",$.bg,$.text),children:[r.jsx(H,{className:"h-3 w-3"}),r.jsx("span",{className:"hidden sm:inline",children:$.label})]}),r.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:D.content})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[r.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:D.source}),r.jsx("button",{onClick:()=>B(D.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:r.jsx(qc,{className:"h-3.5 w-3.5"})})]})]},D.id)})}),M]})}function hi({label:s,ok:o,detail:i,icon:c,onClick:u}){return r.jsxs("div",{onClick:u,className:J("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",u&&"cursor-pointer hover:bg-card/70"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),r.jsx(c,{className:J("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),i&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:i,children:i})]}),u&&r.jsxs("button",{onClick:f=>{f.stopPropagation(),u()},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:[r.jsx(Ot,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Gehirn wechseln"})]})]})}function n1(){const{data:s,error:o}=fm(5e3),{data:i}=Ds(),{showAlert:c,dialogElement:u}=Dn(),f=rn(),m=o?String(o):"",p=x.useMemo(()=>["auto","fast","heavy",...((i==null?void 0:i.models)??[]).map(D=>{var $;return(($=D.name.split("/").pop())==null?void 0:$.replace(".gguf",""))||D.name})],[i]),[v,g]=x.useState(null),[j,w]=x.useState(!1),[_,M]=x.useState({width:800,height:360}),L=x.useRef(null),b=x.useCallback(F=>{if(L.current&&(L.current.disconnect(),L.current=null),F){const D=new ResizeObserver($=>{if(!$||$.length===0)return;const H=$[0].contentRect;M({width:H.width,height:H.height})});D.observe(F),L.current=D}},[]),S=_.width,O=_.height,I=(F,D,$,H)=>{const ae=(F+$)/2;return`M ${F} ${D} C ${ae} ${D}, ${ae} ${H}, ${$} ${H}`};async function B(F){try{await we("/api/agent/brain",{method:"POST",body:JSON.stringify({model:F})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${F}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:Ye.agentStatus}),w(!1)}catch(D){c("Fehler",`Fehler beim Wechseln des Gehirns: ${D.message}`)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("style",{children:` + `}),r.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:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qc,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",Vr(U)," / ",Vr(xt)," geladen"]}),_.length>0&&r.jsx("button",{onClick:C,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"})]})]}),r.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:ve.length===0?r.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"}):ve.map((L,se)=>{var He;const je=(L.size_bytes||0)/xt*100,De=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][se%4];return r.jsxs("div",{style:{width:`${je}%`},className:J("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",De),title:`${L.name} (${Vr(L.size_bytes)})`,children:[r.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[L.role?`[${L.role}] `:"",(He=L.name.split("/").pop())==null?void 0:He.replace(".gguf","")]}),r.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Vr(L.size_bytes)})]},L.name)})})]}),r.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:[r.jsxs("div",{children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),r.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."})]}),r.jsxs("div",{ref:Le,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[r.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),r.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),r.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),r.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),r.jsx("path",{d:K(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="roocode"||b==="roocode")&&r.jsx("path",{d:K(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="cursor"||b==="cursor")&&r.jsx("path",{d:K(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="opencode"||b==="opencode")&&r.jsx("path",{d:K(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="zed"||b==="zed")&&r.jsx("path",{d:K(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:K(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(D==="continue"||b==="continue")&&r.jsx("path",{d:K(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("fast")&&r.jsx("path",{d:ee(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("heavy")&&r.jsx("path",{d:ee(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("coder")&&r.jsx("path",{d:ee(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("vision")&&r.jsx("path",{d:ee(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:ee(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Zt("scout")&&r.jsx("path",{d:ee(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),r.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:()=>$("roocode"),onMouseLeave:()=>$(null),onClick:()=>S(L=>L==="roocode"?null:"roocode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Roo Code"})]}),r.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:()=>$("cursor"),onMouseLeave:()=>$(null),onClick:()=>S(L=>L==="cursor"?null:"cursor"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Cursor IDE"})]}),r.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:()=>$("opencode"),onMouseLeave:()=>$(null),onClick:()=>S(L=>L==="opencode"?null:"opencode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"OpenCode"})]}),r.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:()=>$("zed"),onMouseLeave:()=>$(null),onClick:()=>S(L=>L==="zed"?null:"zed"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Zed"})]}),r.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:()=>$("continue"),onMouseLeave:()=>$(null),onClick:()=>S(L=>L==="continue"?null:"continue"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Continue"})]}),r.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:[r.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",u!=null&&u.heavy_threshold_chars?u.heavy_threshold_chars/1e3:"4","k Zeichen"]}),r.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"})]}),Gb.map(L=>{var ir;const se=["12%","31%","50%","69%","88%"],je=As(L),De=je?_.includes(je.name):!1;if(L==="agent")return null;const He={fast:0,heavy:1,coder:2,vision:3,scout:4}[L];return r.jsxs("div",{className:J("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",De?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":je?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:se[He]},onClick:()=>I(L),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:L}),De&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:je?(ir=je.name.split("/").pop())==null?void 0:ir.replace(".gguf",""):"Keine Zuweisung"})]},L)}),b&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[b==="roocode"&&"Roo Code Setup",b==="cursor"&&"Cursor Setup",b==="opencode"&&"OpenCode Setup",b==="zed"&&"Zed Setup",b==="continue"&&"Continue Setup"]}),r.jsx("button",{onClick:()=>S(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[b==="roocode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",r.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),r.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",r.jsx("strong",{children:"OpenAI Compatible"}),"."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",r.jsx("code",{children:"settings.json"})," ein."]})]}),b==="cursor"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne Cursor Settings ➔ ",r.jsx("strong",{children:"Models"}),"."]}),r.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",r.jsx("strong",{children:"OpenAI API"})," auf."]}),r.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",r.jsx("strong",{children:"auto"}),"."]})]}),b==="opencode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die ",r.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),r.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",r.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),b==="zed"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die Zed Settings (",r.jsx("code",{children:"ctrl+,"}),")."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",r.jsx("code",{children:"language_models"})," ein."]})]}),b==="continue"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),r.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",r.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),f.tools&&r.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),r.jsxs("button",{onClick:()=>{var L,se,je,De,He;return pe(b==="roocode"?(L=f.tools.cline)==null?void 0:L.snippet:b==="cursor"?(se=f.tools.cursor)==null?void 0:se.snippet:b==="opencode"?(je=f.tools.opencode)==null?void 0:je.snippet:b==="zed"?(De=f.tools.zed)==null?void 0:De.snippet:(He=f.tools.continue)==null?void 0:He.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[B?r.jsx(_s,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Sh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:B?"Kopiert":"Kopieren"})]})]}),r.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:r.jsxs("code",{children:[b==="roocode"&&((Tn=f.tools.cline)==null?void 0:Tn.snippet),b==="cursor"&&((zs=f.tools.cursor)==null?void 0:zs.snippet),b==="opencode"&&((Ls=f.tools.opencode)==null?void 0:Ls.snippet),b==="zed"&&((An=f.tools.zed)==null?void 0:An.snippet),b==="continue"&&((Fs=f.tools.continue)==null?void 0:Fs.snippet)]})})]}),r.jsx("button",{onClick:()=>S(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"})]})})]}),r.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:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),r.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),r.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),r.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),r.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:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(L=>{var De;const se=w.find(He=>He.role===L),je=se?_.includes(se.name):!1;return r.jsxs("div",{onClick:()=>I(L),className:J("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]",je?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":se?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:J("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",L==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":L==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":L==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":L==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:L}),je&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:se==null?void 0:se.name,children:se?(De=se.name.split("/").pop())==null?void 0:De.replace(/\.gguf$/i,""):"nicht zugewiesen"}),r.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},L)})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[r.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",ke.length," von ",w.length,")"]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>fe("all"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),r.jsx("button",{onClick:()=>fe("in_use"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>ae("grid"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",H==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),r.jsx("button",{onClick:()=>ae("list"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",H==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),H==="grid"?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:ke.length===0?r.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:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ke.map(L=>{const se=_.includes(L.name),je=m==null?void 0:m.model_list.find(He=>He.role===L.role),De=qp(L.name);return r.jsxs("div",{className:J("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",se?"border-primary/45 shadow-primary/5":L.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-start justify-between gap-3",children:r.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[r.jsx("div",{className:J("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",De.color),title:De.name,children:De.initial}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:L.name,children:L.name.split("/").pop()}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[r.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:L.quant||"GGUF"}),se&&r.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[r.jsx(Do,{className:"h-3 w-3 animate-pulse"})," Warm"]}),L.role&&r.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:L.role}),L.prompt_cache&&r.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"}),L.spec_draft_model&&r.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: ${L.spec_draft_model})`,children:"SPEC"}),L.parallel_slots>1&&r.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:`${L.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",L.parallel_slots]}),L.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),r.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:r.jsx(Qp,{caps:L.capabilities})})]}),r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(Qc,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),r.jsx("div",{className:"text-foreground font-semibold",children:Vr(L.size_bytes)})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(O0,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),r.jsx("div",{className:"text-foreground font-semibold",children:Wp(L.ctx)})]})]})]}),je&&r.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:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),r.jsxs("span",{children:["Upgrade verfügbar: ",je.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>le(je.repo,L.role,L.quant||"Q4_K_M",L.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:[r.jsx(_n,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[r.jsx("button",{onClick:()=>se?P(L.name):Y(L.name),disabled:L.incomplete&&!se,className:J("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",L.incomplete&&!se?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":se?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:se?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>X(L.name,L.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"}),r.jsx("button",{onClick:()=>q(L.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:r.jsx(qc,{className:"h-3.5 w-3.5"})})]})]})]},L.name)})}):r.jsx("div",{className:"space-y-2",children:ke.length===0?r.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ke.map(L=>{const se=_.includes(L.name),je=qp(L.name);return r.jsxs("div",{className:J("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",se?"border-primary/45":L.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r.jsx("div",{className:J("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",je.color),title:je.name,children:je.initial}),r.jsxs("div",{className:"min-w-0 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:L.name,children:L.name.split("/").pop()}),L.role&&r.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:L.role}),L.prompt_cache&&r.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"}),L.spec_draft_model&&r.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: ${L.spec_draft_model})`,children:"SPEC"}),L.parallel_slots>1&&r.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:`${L.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",L.parallel_slots]}),L.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),se&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[r.jsxs("span",{children:["Größe: ",Vr(L.size_bytes)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Kontext: ",Wp(L.ctx)]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:"font-mono text-[9px]",children:L.quant||"GGUF"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[r.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:r.jsx(Qp,{caps:L.capabilities})}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{onClick:()=>se?P(L.name):Y(L.name),disabled:L.incomplete&&!se,className:J("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",L.incomplete&&!se?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":se?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:se?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>X(L.name,L.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"}),r.jsx("button",{onClick:()=>q(L.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:r.jsx(qc,{className:"h-3.5 w-3.5"})})]})]})]},L.name)})})]}),O&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.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:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",O,"' konfigurieren"]}),r.jsx("button",{onClick:()=>I(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",r.jsx("strong",{className:"text-foreground",children:O}),":"]}),r.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[r.jsx("button",{onClick:()=>{Z(O,""),I(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:r.jsx("span",{children:"Zuweisung entfernen"})}),w.map(L=>{var se;return r.jsxs("button",{onClick:()=>{Z(O,L.name),I(null)},className:J("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",L.role===O?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(se=L.name.split("/").pop())==null?void 0:se.replace(".gguf","")}),r.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[Vr(L.size_bytes)," · ",L.quant]})]}),L.role===O&&r.jsx(_s,{className:"h-4 w-4 shrink-0 text-primary"})]},L.name)})]})]})}),j]})}function qb(){const[s,o]=x.useState(""),[i,c]=x.useState([]),[u,f]=x.useState("Q4_K_M"),[m,p]=x.useState(""),[v,g]=x.useState(""),[j,w]=x.useState([]);async function _(b){const S=b??s;if(S.trim()){p("Analysiere HuggingFace Repository...");try{const O=await we(`/api/hf/quants?repo=${encodeURIComponent(S)}`);o(O.repo),c(O.quants),O.quants.length&&f(O.quants.includes("Q4_K_M")?"Q4_K_M":O.quants[0]),p(O.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(O){p(`Fehler: ${O}`)}}}async function M(){if(v.trim()){p("Durchsuche HuggingFace...");try{const b=await we(`/api/hf/search?q=${encodeURIComponent(v)}`);w(b.results),p(b.results.length?"":"Keine Ergebnisse gefunden.")}catch(b){p(`Suche fehlgeschlagen: ${b}`)}}}async function z(){if(s.trim()){p("Download-Job wird initiiert...");try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:u,jinja:!0})}),p(`Download gestartet: ${s} (${u}). Fortschritt wird oben angezeigt.`)}catch(b){p(`Download-Fehler: ${b}`)}}}return r.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:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsx("input",{value:s,onChange:b=>o(b.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"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>_(),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&&r.jsxs(r.Fragment,{children:[r.jsx("select",{value:u,onChange:b=>f(b.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(b=>r.jsx("option",{value:b,className:"bg-popover text-foreground",children:b},b))}),r.jsxs("button",{onClick:z,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:[r.jsx(_n,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),r.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:v,onChange:b=>g(b.target.value),onKeyDown:b=>b.key==="Enter"&&M(),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"}),r.jsx(dd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.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",children:"Suchen"})]}),j.length>0&&r.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:j.map(b=>r.jsxs("button",{onClick:()=>{o(b.repo),w([]),g(""),_(b.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:[r.jsx("span",{className:"font-semibold truncate",children:b.repo}),r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[r.jsx(_n,{className:"h-3 w-3"})," ",b.downloads.toLocaleString()]})]},b.repo))}),m&&r.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:m})]})}const Zb={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Kc},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Wc},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Ao},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:To},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:Gc}};function Yb(){const{data:s,isLoading:o,error:i}=eb(),{data:c}=Ds(),{data:u}=xd(),f=(c==null?void 0:c.models)??[],m=i?String(i):"",[p,v]=x.useState({}),[g,j]=x.useState({}),[w,_]=x.useState(!1);async function M(z,b,S,O){v(I=>({...I,[z]:"Starte..."}));try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:z,role:b,quant:S,jinja:O})}),v(I=>({...I,[z]:"Download läuft"}))}catch{v(B=>({...B,[z]:"Fehler"}))}}return o?r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):m||!s?r.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,")."]}):r.jsxs("div",{className:"space-y-8",children:[r.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:[r.jsxs("div",{children:["Modell-Registry geladen für ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ph,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),r.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(z=>{const b=Zb[z.role]||{title:z.title||z.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:zo},S=b.icon,O=f.find(H=>H.role===z.role),I=u==null?void 0:u.model_list.find(H=>H.role===z.role),B=z.models.find(H=>H.repo===z.recommended)||z.models[0];if(!B)return null;const F=p[B.repo],D=z.models.filter(H=>H.repo!==z.recommended),$=!!g[z.role];return r.jsxs("div",{className:J("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",O?"border-border/60":"border-primary/20 shadow-primary/5"),children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.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:r.jsx(S,{className:"h-5.5 w-5.5"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:b.title}),r.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: ",z.role]})]})]}),O?r.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:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):r.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"})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:b.desc}),r.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:O?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:O.name,children:O.name.split("/").pop()}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[r.jsxs("span",{children:["Größe: ",td(O.size_bytes||0)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",O.quant||"GGUF"]})]})]}):r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:B.name,children:B.name}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[r.jsxs("span",{children:["Ersteller: ",B.author]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",B.quant]})]}),r.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:r.jsx(Kb,{fit:B.fit})})]})}),r.jsx("div",{className:"pt-1",children:O?I?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),r.jsxs("span",{children:["Bessere Version in der Registry: ",I.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>M(I.repo,z.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!p[I.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:[r.jsx(_n,{className:"h-3.5 w-3.5"}),p[I.repo]||"Auf neue Version aktualisieren"]})]}):r.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:[r.jsx(_s,{className:"h-4 w-4"})," Auf neuestem Stand"]}):r.jsxs("button",{onClick:()=>M(B.repo,z.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!F,className:J("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",F?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[r.jsx(_n,{className:"h-3.5 w-3.5"}),F||"Optimales Modell einsetzen"]})})]}),D.length>0&&r.jsxs("div",{className:"border-t border-border/20 pt-3",children:[r.jsxs("button",{onClick:()=>j(H=>({...H,[z.role]:!$})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[$?r.jsx(v0,{className:"h-3 w-3"}):r.jsx(x0,{className:"h-3 w-3"}),r.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",D.length,")"]})]}),$&&r.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:D.map(H=>r.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:H.name,children:H.name}),r.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[r.jsxs("span",{children:["Quant: ",H.quant]}),r.jsx("span",{children:"•"}),r.jsx("span",{children:H.fit.text})]})]}),r.jsx("button",{onClick:()=>M(H.repo,z.role,H.quant||"Q4_K_M",H.caps.tools!=="no"),disabled:!!p[H.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:p[H.repo]||"Installieren"})]},H.repo))})]})]},z.role)})}),r.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[r.jsxs("button",{onClick:()=>_(!w),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:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dd,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),r.jsx("span",{className:"text-[10px] text-primary hover:underline",children:w?"Ausblenden ▲":"Anzeigen ▼"})]}),w&&r.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:r.jsx(qb,{})})]})]})}function Jb(){const[s,o]=x.useState("cockpit");return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.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"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),r.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=>r.jsx("button",{onClick:()=>o(i),className:J("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))})]}),r.jsx(Wb,{}),r.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?r.jsx(Qb,{}):r.jsx(Yb,{})})]})}function pi({label:s,percent:o,detail:i,icon:c}){const u=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 r.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:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),r.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),r.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:r.jsx("div",{className:J("h-full transition-all duration-700 ease-out",u),style:{width:`${Math.min(o,100)}%`}})}),i&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function Xb(){const{data:s,error:o}=md(3e3),{data:i}=Jv(3e3),{showAlert:c,dialogElement:u}=Dn(),f=o?String(o):"",[m,p]=x.useState(""),[v,g]=x.useState({});async function j(){p("Backup snapshotted...");try{const _=await we("/api/system/backup",{method:"POST"});p(_.ok?`Snapshot erzeugt: ${_.snapshot} (${_.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(_){p(`Fehler: ${_.message}`)}}async function w(_){g(M=>({...M,[_]:!0}));try{const M=await we("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:_})});M.ok?c("Erfolgreich",`Dienst ${_} wurde erfolgreich neu gestartet.`):c("Fehler beim Neustart",`Fehler beim Neustart: ${M.err||"Unbekannter Fehler"}`)}catch(M){c("Fehler",`Fehler: ${M.message}`)}finally{g(M=>({...M,[_]:!1}))}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.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"}),r.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&r.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&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(pi,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:Ot}),r.jsx(pi,{label:"RAM",percent:s.ram.percent,detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`,icon:Do}),s.gpu&&s.gpu.busy_percent!=null&&r.jsx(pi,{label:"GPU",percent:s.gpu.busy_percent,detail:s.gpu.gtt_used!=null&&s.gpu.gtt_total?`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB (GTT/unified)`:s.gpu.vram_used!=null&&s.gpu.vram_total?`${St(s.gpu.vram_used)} / ${St(s.gpu.vram_total)} GB VRAM`:void 0,icon:Ot}),s.disk&&r.jsx(pi,{label:"Disk",percent:s.disk.percent,detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`,icon:Qc})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&r.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&&r.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&r.jsx("span",{children:"|"}),s.temp.gpu!=null&&r.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),i&&r.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:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),r.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"})]}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:i.services.map(_=>r.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:[r.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[r.jsx("span",{className:J("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",_.ok?"bg-emerald-500":"bg-amber-500")}),r.jsxs("div",{className:"truncate",children:[r.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:_.name}),r.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:_.url})]})]}),r.jsx("button",{onClick:()=>w(_.name),disabled:v[_.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:r.jsx(Pn,{className:J("h-3.5 w-3.5",v[_.name]&&"animate-spin")})})]},_.name))}),r.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[r.jsxs("a",{href:Uo(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:[r.jsx(yi,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),r.jsxs("a",{href:Uo(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:[r.jsx(yi,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),r.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:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),r.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:r.jsxs("button",{onClick:j,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:[r.jsx(T0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),m&&r.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:m}),u]})}function e1(){const[s,o]=x.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[i,c]=x.useState(localStorage.getItem("mc_mcp_path")||""),[u,f]=x.useState("cline"),[m,p]=x.useState(!1),v=new URLSearchParams({host:s});i&&v.set("mcp_path",i);const{data:g,error:j}=pm(v.toString()),w=j?String(j):"";function _(S){o(S),S&&localStorage.setItem("mc_host",S)}function M(S){c(S),localStorage.setItem("mc_mcp_path",S)}const z=g==null?void 0:g.tools[u];async function b(){z&&(await navigator.clipboard.writeText(z.snippet),p(!0),setTimeout(()=>p(!1),1500))}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.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"}),r.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."})]}),r.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:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(C0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),r.jsx("input",{value:s,onChange:S=>_(S.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"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(S0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),r.jsx("input",{value:i,onChange:S=>M(S.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"})]})]}),w&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",w]}),g&&r.jsxs("div",{className:"space-y-4",children:[r.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(g.tools).map(([S,O])=>r.jsx("button",{onClick:()=>f(S),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",u===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:O.label},S))}),z&&r.jsxs("div",{className:"space-y-3",children:[z.note&&r.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:[r.jsx(E0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),r.jsx("span",{children:z.note})]}),r.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[r.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),r.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:[r.jsx(vi,{className:"h-3.5 w-3.5 text-primary"}),r.jsx("span",{children:u==="cline"||u==="cursor"?"config.json":"settings.json"})]}),r.jsxs("button",{onClick:b,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?r.jsx(_s,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Sh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:m?"Kopiert":"Kopieren"})]})]}),r.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:r.jsx("code",{children:z.snippet})})]})]})]})]})}const Zp=["user","instruction","stable","versioned","ephemeral"],_c={user:{label:"User",icon:$0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:A0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Ms,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:I0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:w0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Yp={label:"Gedächtnis",icon:Nh,bg:"bg-muted/10",text:"text-muted-foreground"},t1={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 r1(){const[s,o]=x.useState(""),[i,c]=x.useState(""),[u,f]=x.useState(""),[m,p]=x.useState("stable"),[v,g]=x.useState(!1),j=rn(),{showAlert:w,showConfirm:_,dialogElement:M}=Dn(),{data:z=[],error:b}=hm({q:i,category:s}),S=b?String(b):"",O=()=>j.invalidateQueries({queryKey:["memory"]});async function I(){u.trim()&&(await we("/api/memory",{method:"POST",body:JSON.stringify({content:u,category:m,source:"ui"})}),f(""),O())}async function B(D){await we(`/api/memory/${D}`,{method:"DELETE"}),O()}async function F(){g(!0);try{const D=await we("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(D.duplicate_count===0){w("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}_("Deduplizierung bestätigen",`${D.duplicate_count} Dublette(n) in ${D.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await we("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),O()}catch($){w("Fehler",`Fehler beim Löschen: ${$.message}`)}})}catch(D){w("Fehler",`Fehler bei der Deduplizierung: ${D.message}`)}finally{g(!1)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.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)"}),r.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."})]}),r.jsxs("button",{onClick:F,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:[r.jsx(F0,{className:"h-4 w-4 text-primary animate-pulse"}),r.jsx("span",{children:"Deduplizieren"})]})]}),r.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:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),r.jsx("textarea",{value:u,onChange:D=>f(D.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"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),r.jsx("select",{value:m,onChange:D=>p(D.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:Zp.map(D=>{var $;return r.jsx("option",{value:D,className:"bg-popover text-foreground",children:(($=_c[D])==null?void 0:$.label)||D},D)})})]}),r.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 flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[r.jsx(Ch,{className:"h-4 w-4"})," Speichern"]})]})]}),r.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:i,onChange:D=>c(D.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"}),r.jsx(dd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.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:[r.jsx("button",{onClick:()=>o(""),className:J("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"}),Zp.map(D=>{const $=_c[D]||Yp,H=$.icon;return r.jsxs("button",{onClick:()=>o(D),className:J("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===D?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[r.jsx(H,{className:"h-3 w-3"}),r.jsx("span",{children:$.label})]},D)})]})]}),S&&r.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: ",S]}),r.jsx("div",{className:"space-y-3",children:z.length===0?r.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."}):z.map(D=>{const $=_c[D.category]||Yp,H=$.icon;return r.jsxs("div",{className:J("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",t1[D.category]||"border-l-muted"),children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[r.jsxs("span",{className:J("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",$.bg,$.text),children:[r.jsx(H,{className:"h-3 w-3"}),r.jsx("span",{className:"hidden sm:inline",children:$.label})]}),r.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:D.content})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[r.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:D.source}),r.jsx("button",{onClick:()=>B(D.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:r.jsx(qc,{className:"h-3.5 w-3.5"})})]})]},D.id)})}),M]})}function hi({label:s,ok:o,detail:i,icon:c,onClick:u}){return r.jsxs("div",{onClick:u,className:J("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",u&&"cursor-pointer hover:bg-card/70"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),r.jsx(c,{className:J("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),i&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:i,children:i})]}),u&&r.jsxs("button",{onClick:f=>{f.stopPropagation(),u()},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:[r.jsx(Ot,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Gehirn wechseln"})]})]})}function n1(){const{data:s,error:o}=fm(5e3),{data:i}=Ds(),{showAlert:c,dialogElement:u}=Dn(),f=rn(),m=o?String(o):"",p=x.useMemo(()=>["auto","fast","heavy",...((i==null?void 0:i.models)??[]).map(D=>{var $;return(($=D.name.split("/").pop())==null?void 0:$.replace(".gguf",""))||D.name})],[i]),[v,g]=x.useState(null),[j,w]=x.useState(!1),[_,M]=x.useState({width:800,height:360}),z=x.useRef(null),b=x.useCallback(F=>{if(z.current&&(z.current.disconnect(),z.current=null),F){const D=new ResizeObserver($=>{if(!$||$.length===0)return;const H=$[0].contentRect;M({width:H.width,height:H.height})});D.observe(F),z.current=D}},[]),S=_.width,O=_.height,I=(F,D,$,H)=>{const ae=(F+$)/2;return`M ${F} ${D} C ${ae} ${D}, ${ae} ${H}, ${$} ${H}`};async function B(F){try{await we("/api/agent/brain",{method:"POST",body:JSON.stringify({model:F})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${F}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:Ye.agentStatus}),w(!1)}catch(D){c("Fehler",`Fehler beim Wechseln des Gehirns: ${D.message}`)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -392,4 +392,4 @@ name: tdd-pro description: Drive development with strict TDD practices --- # Instructions -...`}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[r.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",r.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:",r.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:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills find"}),r.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Globaler Pfad:"})," ",r.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 ",r.jsx("i",{children:"code-simplification"}),", ",r.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Projekt-Pfad:"})," ",r.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."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",r.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ot,{className:"h-5 w-5 text-indigo-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),r.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.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."]}),r.jsx("p",{children:r.jsx("strong",{children:"Best Practices für Hermes:"})}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",r.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),r.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:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Lo,{className:"h-5 w-5 text-amber-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),r.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(vi,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),r.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",r.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(Wc,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),r.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",r.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(Lo,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),r.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."})]})]})]}),r.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:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ms,{className:"h-5 w-5 text-emerald-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),r.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[r.jsxs("p",{children:["Mission Control 2 ist als ",r.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Sp,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),r.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),r.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Sp,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),r.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[r.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 o1({title:s,hint:o}){return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold",children:s}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),r.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:[r.jsx(N0,{className:"h-8 w-8 text-muted-foreground"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const l1=[{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 Mc(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function i1({open:s,onClose:o,defaultTab:i="maintenance"}){const[c,u]=x.useState(null),[f,m]=x.useState([]),[p,v]=x.useState("llama-swap"),[g,j]=x.useState(""),[w,_]=x.useState(!1),[M,L]=x.useState(null),[b,S]=x.useState({}),[O,I]=x.useState("maintenance"),[B,F]=x.useState(!1),[D,$]=x.useState(null);function H(U,me,xt){$({type:"alert",title:U,message:me,onConfirm:()=>{$(null),xt&&xt()}})}function ae(U,me,xt){$({type:"confirm",title:U,message:me,onConfirm:()=>{$(null),xt()},onCancel:()=>$(null)})}function te(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[fe,ke]=x.useState(""),[ue,ze]=x.useState(""),[Ce,Le]=x.useState(!1),[Ee,Pe]=x.useState(!1);x.useEffect(()=>{s&&(ke(localStorage.getItem("mc_sudo_password")||""),ze(localStorage.getItem("mc_hf_token")||""))},[s]),x.useEffect(()=>{s&&i&&I(i)},[s,i]);const K=x.useRef(null);function ee(){we("/api/maintenance/updates").then(u).catch(U=>console.error("Error loading updates",U))}function Y(){we("/api/jobs").then(U=>m(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function P(U){_(!0),L(null),we(`/api/maintenance/logs?service=${U}&lines=150`).then(me=>{me.ok?j(me.text):(j(`Fehler beim Laden der Logs: ${me.err||"Unbekannter Fehler"}`),(me.status==="incorrect_password"||me.status==="password_required")&&L(me.status))}).catch(me=>j(`Fehler: ${me.message}`)).finally(()=>{_(!1),setTimeout(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},50)})}x.useEffect(()=>{if(!s)return;ee(),Y();const U=setInterval(()=>{Y(),ee()},3e3);return()=>clearInterval(U)},[s]),x.useEffect(()=>{!s||O!=="logs"||P(p)},[s,O,p]);async function C(){try{await we("/api/maintenance/os-update",{method:"POST"}),Y(),I("maintenance")}catch(U){H("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function Z(){try{await we("/api/maintenance/engine-update",{method:"POST"}),Y(),I("maintenance")}catch(U){H("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function X(){F(!0);try{await we("/api/maintenance/check-updates",{method:"POST"}),Y(),I("maintenance")}catch(U){H("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{F(!1)}}async function q(U,me){try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:me})}),H("Gestartet",`Modell-Upgrade für '${me}' (${U}) gestartet.`),Y(),I("maintenance")}catch(xt){H("Fehler",`Fehler beim Starten des Modell-Upgrades: ${xt.message}`)}}async function le(){ae("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await we("/api/maintenance/reboot",{method:"POST"}),H("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){H("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function pe(U){S(me=>({...me,[U]:!0}));try{const me=await we("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});me.ok?H("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{O==="logs"&&p===U&&P(U)}):H("Fehler",`Fehler beim Neustart: ${me.err||"Unbekannter Fehler"}`)}catch(me){H("Fehler",`Fehler beim Neustart: ${me.message}`)}finally{S(me=>({...me,[U]:!1}))}}async function ve(U){try{await we(`/api/jobs/${U}/cancel`,{method:"POST"}),Y()}catch(me){H("Fehler",`Fehler beim Abbrechen: ${me.message}`)}}return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:J("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}),r.jsxs("div",{className:J("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:[r.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),r.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:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[r.jsx("button",{onClick:()=>I("maintenance"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",O==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),r.jsx("button",{onClick:()=>I("logs"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",O==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),r.jsx("button",{onClick:()=>I("settings"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",O==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[O==="maintenance"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),r.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",te(c.last_check)]}),r.jsxs("button",{onClick:X,disabled:B,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[r.jsx(Pn,{className:J("h-3 w-3",B&&"animate-spin")}),"Nach Updates suchen"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:C,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:[r.jsx(Ms,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),r.jsxs("button",{onClick:Z,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:[r.jsx(z0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),r.jsxs("button",{onClick:le,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:[r.jsx(Eh,{className:"h-4.5 w-4.5"}),r.jsxs("div",{children:[r.jsx("div",{children:"Host-System neu starten (Reboot)"}),r.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(c==null?void 0:c.model_list)&&c.model_list.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",te(c.last_check)]})]}),r.jsx("div",{className:"space-y-2",children:c.model_list.map(U=>r.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold",children:U.title}),r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),r.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),r.jsxs("button",{onClick:()=>q(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:[r.jsx(_n,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),r.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"]})]}),r.jsx("div",{className:"space-y-3",children:f.length===0?r.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 r.jsxs("div",{className:J("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:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[me&&r.jsxs("span",{className:"flex h-2 w-2 relative",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[r.jsxs("span",{children:["ID: ",U.id]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:J(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&&r.jsx("button",{onClick:()=>ve(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"&&r.jsxs("div",{className:"mt-3 space-y-1",children:[r.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),r.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[r.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&r.jsxs("span",{children:[Mc(U.done_bytes)," / ",Mc(U.total_bytes),U.rate_bps!=null&&` (${Mc(U.rate_bps)}/s)`]}),U.eta_s!=null&&r.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),O==="logs"&&r.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("select",{value:p,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:l1.map(U=>r.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),r.jsxs("button",{onClick:()=>pe(p),disabled:b[p],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:[r.jsx(Pn,{className:J("h-3.5 w-3.5",b[p]&&"animate-spin")}),"Restart"]})]}),r.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:[r.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[r.jsx(vi,{className:"h-3 w-3 text-primary"}),r.jsxs("span",{children:["stdout/stderr - ",p]})]}),r.jsx("button",{onClick:()=>P(p),disabled:w,className:"text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(Pn,{className:J("h-3 w-3",w&&"animate-spin")})})]}),r.jsx("pre",{ref:K,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:M==="password_required"||M==="incorrect_password"?r.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[r.jsx(U0,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),r.jsx("div",{className:"text-xs font-semibold text-amber-300",children:M==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),r.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",p," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),r.jsx("button",{onClick:()=>I("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"})]}):w&&!g?r.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):g||r.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),O==="settings"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),r.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."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(Ms,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Ce?"text":"password",value:fe,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"}),r.jsx("button",{type:"button",onClick:()=>Le(!Ce),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ce?r.jsx(Cp,{className:"h-4 w-4"}):r.jsx(Kc,{className:"h-4 w-4"})})]}),r.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."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(P0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Ee?"text":"password",value:ue,onChange:U=>ze(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"}),r.jsx("button",{type:"button",onClick:()=>Pe(!Ee),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ee?r.jsx(Cp,{className:"h-4 w-4"}):r.jsx(Kc,{className:"h-4 w-4"})})]}),r.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."})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",fe),localStorage.setItem("mc_hf_token",ue),H("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"}),r.jsx("button",{onClick:()=>{ke(""),ze(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),H("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"})]})]})]})]}),D&&r.jsx(wm,{type:D.type,title:D.title,message:D.message,onConfirm:D.onConfirm,onCancel:D.onCancel})]})}function a1(){var w,_,M,L,b;const[s,o]=x.useState("dashboard"),[i,c]=x.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[u,f]=x.useState(!1),[m,p]=x.useState("maintenance"),{data:v}=Yv(),{data:g}=md(2e4);x.useEffect(()=>{document.documentElement.classList.add("dark")},[]),x.useEffect(()=>{const S=O=>{var B;p(((B=O.detail)==null?void 0:B.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",S),()=>window.removeEventListener("open-system-drawer",S)},[]);const j=Zc.find(S=>S.id===s);return r.jsxs("div",{className:"flex h-full relative",children:[r.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[r.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]"}),r.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),r.jsx(Zv,{onNavigate:o}),r.jsx(i1,{open:u,onClose:()=>f(!1),defaultTab:m}),r.jsxs("aside",{className:J("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:[r.jsxs("div",{className:J("flex items-center py-4 border-b border-border/40 shrink-0",i?"flex-col gap-3 px-2":"justify-between px-5"),children:[r.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[r.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!i&&r.jsxs("div",{className:"leading-tight",children:[r.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),r.jsx("button",{onClick:()=>{c(S=>{const O=!S;return localStorage.setItem("mc_sidebar_collapsed",O.toString()),O})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:i?"Maximieren":"Minimieren",children:i?r.jsx(y0,{className:"h-4 w-4"}):r.jsx(g0,{className:"h-4 w-4"})})]}),r.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Zc.map(S=>r.jsxs("button",{onClick:()=>o(S.id),className:J("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===S.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:i?S.label:void 0,children:[r.jsx(S.icon,{className:"h-4.5 w-4.5 shrink-0"}),!i&&r.jsx("span",{className:"truncate",children:S.label})]},S.id))}),r.jsx("div",{className:J("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",i?"px-2 text-center":"px-5"),children:i?r.jsx("div",{className:"flex justify-center",children:r.jsx("span",{className:J("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"})}):r.jsxs("div",{className:"space-y-2 text-left",children:[v?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),r.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",r.jsx("span",{className:"truncate",children:"Backend offline"})]}),(g==null?void 0:g.versions)&&r.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[r.jsxs("div",{className:"truncate",title:g.versions.mc2?`${g.versions.mc2.branch}-${g.versions.mc2.hash}${g.versions.mc2.dirty?"*":""} (${g.versions.mc2.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"MC2:"})," ",g.versions.mc2?`${g.versions.mc2.hash}${g.versions.mc2.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:((w=g.versions.engine)==null?void 0:w.type)==="git"?`${g.versions.engine.branch}-${g.versions.engine.hash}${g.versions.engine.dirty?"*":""} (${g.versions.engine.date})`:((_=g.versions.engine)==null?void 0:_.version_text)||"unbekannt",children:[r.jsx("strong",{children:"Engine:"})," ",((M=g.versions.engine)==null?void 0:M.type)==="git"?`${g.versions.engine.hash}${g.versions.engine.dirty?"*":""}`:((b=(L=g.versions.engine)==null?void 0:L.version_text)==null?void 0:b.split(" ").pop())||"—"]}),r.jsxs("div",{className:"truncate",title:g.versions.hermes_ui?`${g.versions.hermes_ui.branch}-${g.versions.hermes_ui.hash}${g.versions.hermes_ui.dirty?"*":""} (${g.versions.hermes_ui.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes UI:"})," ",g.versions.hermes_ui?`${g.versions.hermes_ui.hash}${g.versions.hermes_ui.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:g.versions.hermes_agent?`${g.versions.hermes_agent.branch}-${g.versions.hermes_agent.hash}${g.versions.hermes_agent.dirty?"*":""} (${g.versions.hermes_agent.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes Agent:"})," ",g.versions.hermes_agent?`${g.versions.hermes_agent.hash}${g.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.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:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:j.hint}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.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"}),r.jsxs("button",{onClick:()=>{const S=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(S)},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:[r.jsx(k0,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Suchen"}),r.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),r.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&r.jsx(Vb,{}),s==="models"&&r.jsx(Jb,{}),s==="system"&&r.jsx(Xb,{}),s==="connect"&&r.jsx(e1,{}),s==="memory"&&r.jsx(r1,{}),s==="agent"&&r.jsx(n1,{}),s==="guide"&&r.jsx(s1,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&r.jsx(o1,{title:j.label,hint:j.hint})]})]})]})}const c1=new Xg({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});Eg.createRoot(document.getElementById("root")).render(r.jsx(ch.StrictMode,{children:r.jsx(e0,{client:c1,children:r.jsx(a1,{})})})); +...`}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[r.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",r.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:",r.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:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills find"}),r.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Globaler Pfad:"})," ",r.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 ",r.jsx("i",{children:"code-simplification"}),", ",r.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Projekt-Pfad:"})," ",r.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."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",r.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ot,{className:"h-5 w-5 text-indigo-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),r.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.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."]}),r.jsx("p",{children:r.jsx("strong",{children:"Best Practices für Hermes:"})}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",r.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),r.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:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Lo,{className:"h-5 w-5 text-amber-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),r.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(vi,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),r.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",r.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(Wc,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),r.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",r.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(Lo,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),r.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."})]})]})]}),r.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:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ms,{className:"h-5 w-5 text-emerald-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),r.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[r.jsxs("p",{children:["Mission Control 2 ist als ",r.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Sp,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),r.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),r.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Sp,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),r.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[r.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 o1({title:s,hint:o}){return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold",children:s}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),r.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:[r.jsx(N0,{className:"h-8 w-8 text-muted-foreground"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const l1=[{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 Mc(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function i1({open:s,onClose:o,defaultTab:i="maintenance"}){const[c,u]=x.useState(null),[f,m]=x.useState([]),[p,v]=x.useState("llama-swap"),[g,j]=x.useState(""),[w,_]=x.useState(!1),[M,z]=x.useState(null),[b,S]=x.useState({}),[O,I]=x.useState("maintenance"),[B,F]=x.useState(!1),[D,$]=x.useState(null);function H(U,me,xt){$({type:"alert",title:U,message:me,onConfirm:()=>{$(null),xt&&xt()}})}function ae(U,me,xt){$({type:"confirm",title:U,message:me,onConfirm:()=>{$(null),xt()},onCancel:()=>$(null)})}function te(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[fe,ke]=x.useState(""),[ue,ze]=x.useState(""),[Ce,Le]=x.useState(!1),[Ee,Pe]=x.useState(!1);x.useEffect(()=>{s&&(ke(localStorage.getItem("mc_sudo_password")||""),ze(localStorage.getItem("mc_hf_token")||""))},[s]),x.useEffect(()=>{s&&i&&I(i)},[s,i]);const K=x.useRef(null);function ee(){we("/api/maintenance/updates").then(u).catch(U=>console.error("Error loading updates",U))}function Y(){we("/api/jobs").then(U=>m(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function P(U){_(!0),z(null),we(`/api/maintenance/logs?service=${U}&lines=150`).then(me=>{me.ok?j(me.text):(j(`Fehler beim Laden der Logs: ${me.err||"Unbekannter Fehler"}`),(me.status==="incorrect_password"||me.status==="password_required")&&z(me.status))}).catch(me=>j(`Fehler: ${me.message}`)).finally(()=>{_(!1),setTimeout(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},50)})}x.useEffect(()=>{if(!s)return;ee(),Y();const U=setInterval(()=>{Y(),ee()},3e3);return()=>clearInterval(U)},[s]),x.useEffect(()=>{!s||O!=="logs"||P(p)},[s,O,p]);async function C(){try{await we("/api/maintenance/os-update",{method:"POST"}),Y(),I("maintenance")}catch(U){H("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function Z(){try{await we("/api/maintenance/engine-update",{method:"POST"}),Y(),I("maintenance")}catch(U){H("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function X(){F(!0);try{await we("/api/maintenance/check-updates",{method:"POST"}),Y(),I("maintenance")}catch(U){H("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{F(!1)}}async function q(U,me){try{await we("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:me})}),H("Gestartet",`Modell-Upgrade für '${me}' (${U}) gestartet.`),Y(),I("maintenance")}catch(xt){H("Fehler",`Fehler beim Starten des Modell-Upgrades: ${xt.message}`)}}async function le(){ae("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await we("/api/maintenance/reboot",{method:"POST"}),H("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){H("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function pe(U){S(me=>({...me,[U]:!0}));try{const me=await we("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});me.ok?H("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{O==="logs"&&p===U&&P(U)}):H("Fehler",`Fehler beim Neustart: ${me.err||"Unbekannter Fehler"}`)}catch(me){H("Fehler",`Fehler beim Neustart: ${me.message}`)}finally{S(me=>({...me,[U]:!1}))}}async function ve(U){try{await we(`/api/jobs/${U}/cancel`,{method:"POST"}),Y()}catch(me){H("Fehler",`Fehler beim Abbrechen: ${me.message}`)}}return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:J("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}),r.jsxs("div",{className:J("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:[r.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),r.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:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[r.jsx("button",{onClick:()=>I("maintenance"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",O==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),r.jsx("button",{onClick:()=>I("logs"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",O==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),r.jsx("button",{onClick:()=>I("settings"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",O==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[O==="maintenance"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),r.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",te(c.last_check)]}),r.jsxs("button",{onClick:X,disabled:B,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[r.jsx(Pn,{className:J("h-3 w-3",B&&"animate-spin")}),"Nach Updates suchen"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:C,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:[r.jsx(Ms,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),r.jsxs("button",{onClick:Z,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:[r.jsx(z0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),r.jsxs("button",{onClick:le,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:[r.jsx(Eh,{className:"h-4.5 w-4.5"}),r.jsxs("div",{children:[r.jsx("div",{children:"Host-System neu starten (Reboot)"}),r.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(c==null?void 0:c.model_list)&&c.model_list.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",te(c.last_check)]})]}),r.jsx("div",{className:"space-y-2",children:c.model_list.map(U=>r.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold",children:U.title}),r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),r.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),r.jsxs("button",{onClick:()=>q(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:[r.jsx(_n,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),r.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"]})]}),r.jsx("div",{className:"space-y-3",children:f.length===0?r.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 r.jsxs("div",{className:J("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:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[me&&r.jsxs("span",{className:"flex h-2 w-2 relative",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[r.jsxs("span",{children:["ID: ",U.id]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:J(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&&r.jsx("button",{onClick:()=>ve(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"&&r.jsxs("div",{className:"mt-3 space-y-1",children:[r.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),r.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[r.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&r.jsxs("span",{children:[Mc(U.done_bytes)," / ",Mc(U.total_bytes),U.rate_bps!=null&&` (${Mc(U.rate_bps)}/s)`]}),U.eta_s!=null&&r.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),O==="logs"&&r.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("select",{value:p,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:l1.map(U=>r.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),r.jsxs("button",{onClick:()=>pe(p),disabled:b[p],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:[r.jsx(Pn,{className:J("h-3.5 w-3.5",b[p]&&"animate-spin")}),"Restart"]})]}),r.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:[r.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[r.jsx(vi,{className:"h-3 w-3 text-primary"}),r.jsxs("span",{children:["stdout/stderr - ",p]})]}),r.jsx("button",{onClick:()=>P(p),disabled:w,className:"text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(Pn,{className:J("h-3 w-3",w&&"animate-spin")})})]}),r.jsx("pre",{ref:K,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:M==="password_required"||M==="incorrect_password"?r.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[r.jsx(U0,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),r.jsx("div",{className:"text-xs font-semibold text-amber-300",children:M==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),r.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",p," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),r.jsx("button",{onClick:()=>I("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"})]}):w&&!g?r.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):g||r.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),O==="settings"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),r.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."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(Ms,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Ce?"text":"password",value:fe,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"}),r.jsx("button",{type:"button",onClick:()=>Le(!Ce),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ce?r.jsx(Cp,{className:"h-4 w-4"}):r.jsx(Kc,{className:"h-4 w-4"})})]}),r.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."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(P0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Ee?"text":"password",value:ue,onChange:U=>ze(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"}),r.jsx("button",{type:"button",onClick:()=>Pe(!Ee),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ee?r.jsx(Cp,{className:"h-4 w-4"}):r.jsx(Kc,{className:"h-4 w-4"})})]}),r.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."})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",fe),localStorage.setItem("mc_hf_token",ue),H("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"}),r.jsx("button",{onClick:()=>{ke(""),ze(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),H("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"})]})]})]})]}),D&&r.jsx(wm,{type:D.type,title:D.title,message:D.message,onConfirm:D.onConfirm,onCancel:D.onCancel})]})}function a1(){var w,_,M,z,b;const[s,o]=x.useState("dashboard"),[i,c]=x.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[u,f]=x.useState(!1),[m,p]=x.useState("maintenance"),{data:v}=Yv(),{data:g}=md(2e4);x.useEffect(()=>{document.documentElement.classList.add("dark")},[]),x.useEffect(()=>{const S=O=>{var B;p(((B=O.detail)==null?void 0:B.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",S),()=>window.removeEventListener("open-system-drawer",S)},[]);const j=Zc.find(S=>S.id===s);return r.jsxs("div",{className:"flex h-full relative",children:[r.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[r.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]"}),r.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),r.jsx(Zv,{onNavigate:o}),r.jsx(i1,{open:u,onClose:()=>f(!1),defaultTab:m}),r.jsxs("aside",{className:J("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:[r.jsxs("div",{className:J("flex items-center py-4 border-b border-border/40 shrink-0",i?"flex-col gap-3 px-2":"justify-between px-5"),children:[r.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[r.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!i&&r.jsxs("div",{className:"leading-tight",children:[r.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),r.jsx("button",{onClick:()=>{c(S=>{const O=!S;return localStorage.setItem("mc_sidebar_collapsed",O.toString()),O})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:i?"Maximieren":"Minimieren",children:i?r.jsx(y0,{className:"h-4 w-4"}):r.jsx(g0,{className:"h-4 w-4"})})]}),r.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Zc.map(S=>r.jsxs("button",{onClick:()=>o(S.id),className:J("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===S.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:i?S.label:void 0,children:[r.jsx(S.icon,{className:"h-4.5 w-4.5 shrink-0"}),!i&&r.jsx("span",{className:"truncate",children:S.label})]},S.id))}),r.jsx("div",{className:J("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",i?"px-2 text-center":"px-5"),children:i?r.jsx("div",{className:"flex justify-center",children:r.jsx("span",{className:J("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"})}):r.jsxs("div",{className:"space-y-2 text-left",children:[v?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),r.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",r.jsx("span",{className:"truncate",children:"Backend offline"})]}),(g==null?void 0:g.versions)&&r.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[r.jsxs("div",{className:"truncate",title:g.versions.mc2?`${g.versions.mc2.branch}-${g.versions.mc2.hash}${g.versions.mc2.dirty?"*":""} (${g.versions.mc2.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"MC2:"})," ",g.versions.mc2?`${g.versions.mc2.hash}${g.versions.mc2.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:((w=g.versions.engine)==null?void 0:w.type)==="git"?`${g.versions.engine.branch}-${g.versions.engine.hash}${g.versions.engine.dirty?"*":""} (${g.versions.engine.date})`:((_=g.versions.engine)==null?void 0:_.version_text)||"unbekannt",children:[r.jsx("strong",{children:"Engine:"})," ",((M=g.versions.engine)==null?void 0:M.type)==="git"?`${g.versions.engine.hash}${g.versions.engine.dirty?"*":""}`:((b=(z=g.versions.engine)==null?void 0:z.version_text)==null?void 0:b.split(" ").pop())||"—"]}),r.jsxs("div",{className:"truncate",title:g.versions.hermes_ui?`${g.versions.hermes_ui.branch}-${g.versions.hermes_ui.hash}${g.versions.hermes_ui.dirty?"*":""} (${g.versions.hermes_ui.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes UI:"})," ",g.versions.hermes_ui?`${g.versions.hermes_ui.hash}${g.versions.hermes_ui.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:g.versions.hermes_agent?`${g.versions.hermes_agent.branch}-${g.versions.hermes_agent.hash}${g.versions.hermes_agent.dirty?"*":""} (${g.versions.hermes_agent.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes Agent:"})," ",g.versions.hermes_agent?`${g.versions.hermes_agent.hash}${g.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.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:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:j.hint}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.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"}),r.jsxs("button",{onClick:()=>{const S=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(S)},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:[r.jsx(k0,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Suchen"}),r.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),r.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&r.jsx(Vb,{}),s==="models"&&r.jsx(Jb,{}),s==="system"&&r.jsx(Xb,{}),s==="connect"&&r.jsx(e1,{}),s==="memory"&&r.jsx(r1,{}),s==="agent"&&r.jsx(n1,{}),s==="guide"&&r.jsx(s1,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&r.jsx(o1,{title:j.label,hint:j.hint})]})]})]})}const c1=new Xg({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});Eg.createRoot(document.getElementById("root")).render(r.jsx(ch.StrictMode,{children:r.jsx(e0,{client:c1,children:r.jsx(a1,{})})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 9418262..85bf338 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/components/dashboard/RolesCard.tsx b/frontend/src/components/dashboard/RolesCard.tsx index 9e8650e..d6ef962 100644 --- a/frontend/src/components/dashboard/RolesCard.tsx +++ b/frontend/src/components/dashboard/RolesCard.tsx @@ -2,7 +2,7 @@ import { Layers } from "lucide-react" import { useModels } from "@/lib/queries" import { cn } from "@/lib/utils" -const ROLES = ["fast", "heavy", "coder", "reasoning", "vision", "scout"] +const ROLES = ["fast", "heavy", "coder", "vision", "scout"] export function RolesCard() { const { data } = useModels(3_000) @@ -40,7 +40,6 @@ export function RolesCard() { role === "fast" ? "bg-cyan-500/15 text-cyan-400 border-cyan-500/25" : role === "heavy" ? "bg-amber-500/15 text-amber-400 border-amber-500/25" : role === "coder" ? "bg-violet-500/15 text-violet-400 border-violet-500/25" : - role === "reasoning" ? "bg-emerald-500/15 text-emerald-400 border-emerald-500/25" : role === "vision" ? "bg-pink-500/15 text-pink-400 border-pink-500/25" : "bg-teal-500/15 text-teal-400 border-teal-500/25" )}> diff --git a/frontend/src/components/models/ModelBadges.tsx b/frontend/src/components/models/ModelBadges.tsx index 4b53a46..60b93b4 100644 --- a/frontend/src/components/models/ModelBadges.tsx +++ b/frontend/src/components/models/ModelBadges.tsx @@ -1,7 +1,7 @@ import { type Fit } from "@/lib/api" import { cn } from "@/lib/utils" -export const ROLES = ["fast", "heavy", "coder", "reasoning", "agent", "vision", "scout"] +export const ROLES = ["fast", "heavy", "coder", "agent", "vision", "scout"] export function FitBadge({ fit }: { fit: Fit }) { const tone = { diff --git a/frontend/src/views/models/Cockpit.tsx b/frontend/src/views/models/Cockpit.tsx index 4ae23c1..c1d0f82 100644 --- a/frontend/src/views/models/Cockpit.tsx +++ b/frontend/src/views/models/Cockpit.tsx @@ -440,8 +440,7 @@ export function Cockpit() { const activeModel = getModelForRole(role) const isWarm = activeModel ? running.includes(activeModel.name) : false - // Skip "reasoning" & "agent" to keep layout neat and identical to canonical roles - if (role === "reasoning" || role === "agent") return null + if (role === "agent") return null const indexMap = { fast: 0, heavy: 1, coder: 2, vision: 3, scout: 4 }[role] as number return ( @@ -591,7 +590,7 @@ export function Cockpit() { Gateway Steckplatz-Belegung (Slot-Zuweisung)
- {["fast", "heavy", "coder", "reasoning", "vision", "scout"].map((role) => { + {["fast", "heavy", "coder", "vision", "scout"].map((role) => { const m = models.find((x) => x.role === role) const isWarm = m ? running.includes(m.name) : false @@ -613,7 +612,6 @@ export function Cockpit() { role === "fast" ? "bg-cyan-500/10 text-cyan-400 border-cyan-500/20" : role === "heavy" ? "bg-amber-500/10 text-amber-400 border-amber-500/20" : role === "coder" ? "bg-violet-500/10 text-violet-400 border-violet-500/20" : - role === "reasoning" ? "bg-emerald-500/10 text-emerald-400 border-emerald-500/20" : role === "vision" ? "bg-pink-500/10 text-pink-400 border-pink-500/20" : "bg-teal-500/10 text-teal-400 border-teal-500/20" )}>{role}