apteva 0.4.29 → 0.4.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{a as tz}from"./App.ca1rz1ph.js";import"./App.4ehxpt48.js";import"./App.6q6bar8b.js";import{g as m2,h as sH,i as UY}from"./App.pmaq48sj.js";import"./App.zjmfm8p6.js";import"./App.ensa6z0r.js";import{A as LX,B as A2,C as v2,D as y2,E as V2,F as hJ,H as D2,I as E2,J as f2,K as T2,l as uJ,m as nz,n as oH,o as rH,p as nH,q as KX,r as k7,s as _X,t as BX,u as Q8,v as mJ,w as UX,x as I2,y as k2,z as OX}from"./App.ncgc9cxy.js";import"./App.f8g7tych.js";import"./App.0sbax9et.js";import{N as tH,O as iJ}from"./App.yv87t9m5.js";import"./App.0ws427h8.js";import{R as G8}from"./App.p0fb1pds.js";import{$ as yJ,S as n,T as $X,U as q8,V as e0,W as C1,X as x2,Y as qY,Z as S2,_ as lJ,aa as u2,ba as b2,ca as c1,da as l2,ea as P2,fa as u4,ga as c2}from"./App.mvtqv6qc.js";var VL=$X((vF)=>{(function(){function G(){if(a=!1,c){var t=vF.unstable_now();e=t;var Z0=!0;try{z:{s=!1,p&&(p=!1,d(v0),v0=-1),i=!0;var K0=g;try{$:{N(t);for(V=_(P);V!==null&&!(V.expirationTime>t&&U());){var h0=V.callback;if(typeof h0==="function"){V.callback=null,g=V.priorityLevel;var f0=h0(V.expirationTime<=t);if(t=vF.unstable_now(),typeof f0==="function"){V.callback=f0,N(t),Z0=!0;break $}V===_(P)&&L(P),N(t)}else L(P);V=_(P)}if(V!==null)Z0=!0;else{var m=_(S);m!==null&&I(M,m.startTime-t),Z0=!1}}break z}finally{V=null,g=K0,i=!1}Z0=void 0}}finally{Z0?l():c=!1}}}function H(t,Z0){var K0=t.length;t.push(Z0);z:for(;0<K0;){var h0=K0-1>>>1,f0=t[h0];if(0<R(f0,Z0))t[h0]=Z0,t[K0]=f0,K0=h0;else break z}}function _(t){return t.length===0?null:t[0]}function L(t){if(t.length===0)return null;var Z0=t[0],K0=t.pop();if(K0!==Z0){t[0]=K0;z:for(var h0=0,f0=t.length,m=f0>>>1;h0<m;){var Q0=2*(h0+1)-1,k0=t[Q0],D0=Q0+1,r0=t[D0];if(0>R(k0,K0))D0<f0&&0>R(r0,k0)?(t[h0]=r0,t[D0]=K0,h0=D0):(t[h0]=k0,t[Q0]=K0,h0=Q0);else if(D0<f0&&0>R(r0,K0))t[h0]=r0,t[D0]=K0,h0=D0;else break z}}return Z0}function R(t,Z0){var K0=t.sortIndex-Z0.sortIndex;return K0!==0?K0:t.id-Z0.id}function N(t){for(var Z0=_(S);Z0!==null;){if(Z0.callback===null)L(S);else if(Z0.startTime<=t)L(S),Z0.sortIndex=Z0.expirationTime,H(P,Z0);else break;Z0=_(S)}}function M(t){if(p=!1,N(t),!s)if(_(P)!==null)s=!0,c||(c=!0,l());else{var Z0=_(S);Z0!==null&&I(M,Z0.startTime-t)}}function U(){return a?!0:vF.unstable_now()-e<C?!1:!0}function I(t,Z0){v0=H0(function(){t(vF.unstable_now())},Z0)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),vF.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var y=performance;vF.unstable_now=function(){return y.now()}}else{var O=Date,F=O.now();vF.unstable_now=function(){return O.now()-F}}var P=[],S=[],E=1,V=null,g=3,i=!1,s=!1,p=!1,a=!1,H0=typeof setTimeout==="function"?setTimeout:null,d=typeof clearTimeout==="function"?clearTimeout:null,B0=typeof setImmediate<"u"?setImmediate:null,c=!1,v0=-1,C=5,e=-1;if(typeof B0==="function")var l=function(){B0(G)};else if(typeof MessageChannel<"u"){var u=new MessageChannel,q0=u.port2;u.port1.onmessage=G,l=function(){q0.postMessage(null)}}else l=function(){H0(G,0)};vF.unstable_IdlePriority=5,vF.unstable_ImmediatePriority=1,vF.unstable_LowPriority=4,vF.unstable_NormalPriority=3,vF.unstable_Profiling=null,vF.unstable_UserBlockingPriority=2,vF.unstable_cancelCallback=function(t){t.callback=null},vF.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<t?Math.floor(1000/t):5},vF.unstable_getCurrentPriorityLevel=function(){return g},vF.unstable_next=function(t){switch(g){case 1:case 2:case 3:var Z0=3;break;default:Z0=g}var K0=g;g=Z0;try{return t()}finally{g=K0}},vF.unstable_requestPaint=function(){a=!0},vF.unstable_runWithPriority=function(t,Z0){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var K0=g;g=t;try{return Z0()}finally{g=K0}},vF.unstable_scheduleCallback=function(t,Z0,K0){var h0=vF.unstable_now();switch(typeof K0==="object"&&K0!==null?(K0=K0.delay,K0=typeof K0==="number"&&0<K0?h0+K0:h0):K0=h0,t){case 1:var f0=-1;break;case 2:f0=250;break;case 5:f0=1073741823;break;case 4:f0=1e4;break;default:f0=5000}return f0=K0+f0,t={id:E++,callback:Z0,priorityLevel:t,startTime:K0,expirationTime:f0,sortIndex:-1},K0>h0?(t.sortIndex=K0,H(S,t),_(P)===null&&t===_(S)&&(p?(d(v0),v0=-1):p=!0,I(M,K0-h0))):(t.sortIndex=f0,H(P,t),s||i||(s=!0,c||(c=!0,l()))),t},vF.unstable_shouldYield=U,vF.unstable_wrapCallback=function(t){var Z0=g;return function(){var K0=g;g=Z0;try{return t.apply(this,arguments)}finally{g=K0}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var CL=$X((TF)=>{var VH=n(e0());(function(){function G(){}function H(O){return""+O}function _(O,F,P){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;try{H(S);var E=!1}catch(V){E=!0}return E&&(console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",typeof Symbol==="function"&&Symbol.toStringTag&&S[Symbol.toStringTag]||S.constructor.name||"Object"),H(S)),{$$typeof:I,key:S==null?null:""+S,children:O,containerInfo:F,implementation:P}}function L(O,F){if(O==="font")return"";if(typeof F==="string")return F==="use-credentials"?F:""}function R(O){return O===null?"`null`":O===void 0?"`undefined`":O===""?"an empty string":'something with type "'+typeof O+'"'}function N(O){return O===null?"`null`":O===void 0?"`undefined`":O===""?"an empty string":typeof O==="string"?JSON.stringify(O):typeof O==="number"?"`"+O+"`":'something with type "'+typeof O+'"'}function M(){var O=y.H;return O===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1
+ import{a as tz}from"./App.ca1rz1ph.js";import"./App.80301vdb.js";import"./App.6q6bar8b.js";import{g as m2,h as sH,i as UY}from"./App.pmaq48sj.js";import"./App.zjmfm8p6.js";import"./App.ensa6z0r.js";import{A as LX,B as A2,C as v2,D as y2,E as V2,F as hJ,H as D2,I as E2,J as f2,K as T2,l as uJ,m as nz,n as oH,o as rH,p as nH,q as KX,r as k7,s as _X,t as BX,u as Q8,v as mJ,w as UX,x as I2,y as k2,z as OX}from"./App.ncgc9cxy.js";import"./App.f8g7tych.js";import"./App.0sbax9et.js";import{N as tH,O as iJ}from"./App.yv87t9m5.js";import"./App.0ws427h8.js";import{R as G8}from"./App.p0fb1pds.js";import{$ as yJ,S as n,T as $X,U as q8,V as e0,W as C1,X as x2,Y as qY,Z as S2,_ as lJ,aa as u2,ba as b2,ca as c1,da as l2,ea as P2,fa as u4,ga as c2}from"./App.mvtqv6qc.js";var VL=$X((vF)=>{(function(){function G(){if(a=!1,c){var t=vF.unstable_now();e=t;var Z0=!0;try{z:{s=!1,p&&(p=!1,d(v0),v0=-1),i=!0;var K0=g;try{$:{N(t);for(V=_(P);V!==null&&!(V.expirationTime>t&&U());){var h0=V.callback;if(typeof h0==="function"){V.callback=null,g=V.priorityLevel;var f0=h0(V.expirationTime<=t);if(t=vF.unstable_now(),typeof f0==="function"){V.callback=f0,N(t),Z0=!0;break $}V===_(P)&&L(P),N(t)}else L(P);V=_(P)}if(V!==null)Z0=!0;else{var m=_(S);m!==null&&I(M,m.startTime-t),Z0=!1}}break z}finally{V=null,g=K0,i=!1}Z0=void 0}}finally{Z0?l():c=!1}}}function H(t,Z0){var K0=t.length;t.push(Z0);z:for(;0<K0;){var h0=K0-1>>>1,f0=t[h0];if(0<R(f0,Z0))t[h0]=Z0,t[K0]=f0,K0=h0;else break z}}function _(t){return t.length===0?null:t[0]}function L(t){if(t.length===0)return null;var Z0=t[0],K0=t.pop();if(K0!==Z0){t[0]=K0;z:for(var h0=0,f0=t.length,m=f0>>>1;h0<m;){var Q0=2*(h0+1)-1,k0=t[Q0],D0=Q0+1,r0=t[D0];if(0>R(k0,K0))D0<f0&&0>R(r0,k0)?(t[h0]=r0,t[D0]=K0,h0=D0):(t[h0]=k0,t[Q0]=K0,h0=Q0);else if(D0<f0&&0>R(r0,K0))t[h0]=r0,t[D0]=K0,h0=D0;else break z}}return Z0}function R(t,Z0){var K0=t.sortIndex-Z0.sortIndex;return K0!==0?K0:t.id-Z0.id}function N(t){for(var Z0=_(S);Z0!==null;){if(Z0.callback===null)L(S);else if(Z0.startTime<=t)L(S),Z0.sortIndex=Z0.expirationTime,H(P,Z0);else break;Z0=_(S)}}function M(t){if(p=!1,N(t),!s)if(_(P)!==null)s=!0,c||(c=!0,l());else{var Z0=_(S);Z0!==null&&I(M,Z0.startTime-t)}}function U(){return a?!0:vF.unstable_now()-e<C?!1:!0}function I(t,Z0){v0=H0(function(){t(vF.unstable_now())},Z0)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),vF.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var y=performance;vF.unstable_now=function(){return y.now()}}else{var O=Date,F=O.now();vF.unstable_now=function(){return O.now()-F}}var P=[],S=[],E=1,V=null,g=3,i=!1,s=!1,p=!1,a=!1,H0=typeof setTimeout==="function"?setTimeout:null,d=typeof clearTimeout==="function"?clearTimeout:null,B0=typeof setImmediate<"u"?setImmediate:null,c=!1,v0=-1,C=5,e=-1;if(typeof B0==="function")var l=function(){B0(G)};else if(typeof MessageChannel<"u"){var u=new MessageChannel,q0=u.port2;u.port1.onmessage=G,l=function(){q0.postMessage(null)}}else l=function(){H0(G,0)};vF.unstable_IdlePriority=5,vF.unstable_ImmediatePriority=1,vF.unstable_LowPriority=4,vF.unstable_NormalPriority=3,vF.unstable_Profiling=null,vF.unstable_UserBlockingPriority=2,vF.unstable_cancelCallback=function(t){t.callback=null},vF.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<t?Math.floor(1000/t):5},vF.unstable_getCurrentPriorityLevel=function(){return g},vF.unstable_next=function(t){switch(g){case 1:case 2:case 3:var Z0=3;break;default:Z0=g}var K0=g;g=Z0;try{return t()}finally{g=K0}},vF.unstable_requestPaint=function(){a=!0},vF.unstable_runWithPriority=function(t,Z0){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var K0=g;g=t;try{return Z0()}finally{g=K0}},vF.unstable_scheduleCallback=function(t,Z0,K0){var h0=vF.unstable_now();switch(typeof K0==="object"&&K0!==null?(K0=K0.delay,K0=typeof K0==="number"&&0<K0?h0+K0:h0):K0=h0,t){case 1:var f0=-1;break;case 2:f0=250;break;case 5:f0=1073741823;break;case 4:f0=1e4;break;default:f0=5000}return f0=K0+f0,t={id:E++,callback:Z0,priorityLevel:t,startTime:K0,expirationTime:f0,sortIndex:-1},K0>h0?(t.sortIndex=K0,H(S,t),_(P)===null&&t===_(S)&&(p?(d(v0),v0=-1):p=!0,I(M,K0-h0))):(t.sortIndex=f0,H(P,t),s||i||(s=!0,c||(c=!0,l()))),t},vF.unstable_shouldYield=U,vF.unstable_wrapCallback=function(t){var Z0=g;return function(){var K0=g;g=Z0;try{return t.apply(this,arguments)}finally{g=K0}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var CL=$X((TF)=>{var VH=n(e0());(function(){function G(){}function H(O){return""+O}function _(O,F,P){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;try{H(S);var E=!1}catch(V){E=!0}return E&&(console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",typeof Symbol==="function"&&Symbol.toStringTag&&S[Symbol.toStringTag]||S.constructor.name||"Object"),H(S)),{$$typeof:I,key:S==null?null:""+S,children:O,containerInfo:F,implementation:P}}function L(O,F){if(O==="font")return"";if(typeof F==="string")return F==="use-credentials"?F:""}function R(O){return O===null?"`null`":O===void 0?"`undefined`":O===""?"an empty string":'something with type "'+typeof O+'"'}function N(O){return O===null?"`null`":O===void 0?"`undefined`":O===""?"an empty string":typeof O==="string"?JSON.stringify(O):typeof O==="number"?"`"+O+"`":'something with type "'+typeof O+'"'}function M(){var O=y.H;return O===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
2
2
  1. You might have mismatching versions of React and the renderer (such as React DOM)
3
3
  2. You might be breaking the Rules of Hooks
4
4
  3. You might have more than one copy of React in the same app
@@ -262,6 +262,6 @@ ${G1}`;s6(T1)},bX=()=>{C6(NX),H8(""),K8(""),m0("idle")},PX=async()=>{if(OY&&H)tr
262
262
  fixed inset-y-0 left-0 z-50 w-64 bg-[#0a0a0a] border-r border-[#1a1a1a] p-4 flex flex-col transform transition-transform duration-200 ease-in-out
263
263
  md:relative md:w-56 md:translate-x-0 md:z-auto
264
264
  ${R?"translate-x-0":"-translate-x-full"}
265
- `,children:[S0.jsxDEV("div",{className:"flex items-center justify-between mb-4 md:hidden",children:[S0.jsxDEV("div",{className:"flex items-center gap-2",children:[S0.jsxDEV("span",{className:"text-[#f97316]",children:">_"},void 0,!1,void 0,this),S0.jsxDEV("span",{className:"text-lg tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S0.jsxDEV("button",{onClick:N,className:"p-2 text-[#666] hover:text-[#e0e0e0] transition",children:S0.jsxDEV(nz,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S0.jsxDEV("nav",{className:"space-y-1 flex-1",children:[S0.jsxDEV(o6,{icon:S0.jsxDEV(oH,{},void 0,!1,void 0,this),label:"Dashboard",active:G==="dashboard",onClick:()=>O("dashboard")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(rH,{},void 0,!1,void 0,this),label:"Agents",active:G==="agents",onClick:()=>O("agents"),badge:H>0?String(H):void 0},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(hJ,{},void 0,!1,void 0,this),label:"Activity",active:G==="activity",onClick:()=>O("activity")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(k7,{},void 0,!1,void 0,this),label:"Tasks",active:G==="tasks",onClick:()=>O("tasks"),badge:_&&_>0?String(_):void 0},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(Q8,{},void 0,!1,void 0,this),label:"MCP",active:G==="mcp",onClick:()=>O("mcp")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(mJ,{},void 0,!1,void 0,this),label:"Skills",active:G==="skills",onClick:()=>O("skills")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(V2,{},void 0,!1,void 0,this),label:"Connections",active:G==="connections",onClick:()=>O("connections")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(y2,{},void 0,!1,void 0,this),label:"Tests",active:G==="tests",onClick:()=>O("tests")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(I2,{},void 0,!1,void 0,this),label:"Telemetry",active:G==="telemetry",onClick:()=>O("telemetry")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(k2,{},void 0,!1,void 0,this),label:"API",active:G==="api",onClick:()=>O("api")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(nH,{},void 0,!1,void 0,this),label:"Settings",active:G==="settings",onClick:()=>O("settings")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&S0.jsxDEV("div",{className:"relative border-t border-[#1a1a1a] pt-3 mt-3",children:[S0.jsxDEV("button",{onClick:()=>y(!I),className:"w-full flex items-center gap-3 px-3 py-2 rounded hover:bg-[#111] transition",children:[S0.jsxDEV("div",{className:"w-8 h-8 rounded-full bg-[#f97316] flex items-center justify-center text-black font-medium text-sm flex-shrink-0",children:M.username.charAt(0).toUpperCase()},void 0,!1,void 0,this),S0.jsxDEV("div",{className:"flex-1 min-w-0 text-left",children:[S0.jsxDEV("p",{className:"text-sm font-medium truncate",children:M.username},void 0,!1,void 0,this),S0.jsxDEV("p",{className:"text-xs text-[#555]",children:M.role},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I&&S0.jsxDEV(S0.Fragment,{children:[S0.jsxDEV("div",{className:"fixed inset-0 z-40",onClick:()=>y(!1)},void 0,!1,void 0,this),S0.jsxDEV("div",{className:"absolute left-3 bottom-full mb-1 w-48 bg-[#111] border border-[#222] rounded-lg shadow-xl z-50",children:S0.jsxDEV("button",{onClick:F,className:"w-full px-4 py-2.5 text-left text-sm text-red-400 hover:bg-[#1a1a1a] transition rounded-lg",children:"Sign out"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function o6({icon:G,label:H,active:_,onClick:L,badge:R}){return S0.jsxDEV("button",{onClick:L,className:`w-full flex items-center gap-3 px-3 py-2 rounded font-medium transition ${_?"bg-[#111] text-[#e0e0e0]":"text-[#666] hover:bg-[#111] hover:text-[#888]"}`,children:[G,H,R&&S0.jsxDEV("span",{className:"ml-auto bg-[#333] text-[#888] text-xs px-2 py-0.5 rounded-full",children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var HY=n(C1(),1);function jJ({message:G,onDismiss:H}){return HY.jsxDEV("div",{className:"bg-red-500/10 border-b border-red-500/30 px-6 py-3 text-red-400 text-sm flex items-center justify-between",children:[HY.jsxDEV("span",{children:G},void 0,!1,void 0,this),HY.jsxDEV("button",{onClick:H,className:"hover:text-red-300",children:HY.jsxDEV(nz,{className:"w-4 h-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var KY=n(e0(),1);var Q4=n(C1(),1);function gJ(){let{login:G}=c1(),[H,_]=KY.useState(""),[L,R]=KY.useState(""),[N,M]=KY.useState(null),[U,I]=KY.useState(!1);return Q4.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center p-8",children:Q4.jsxDEV("div",{className:"w-full max-w-md",children:[Q4.jsxDEV("div",{className:"text-center mb-8",children:[Q4.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-2",children:[Q4.jsxDEV("span",{className:"text-[#f97316] text-3xl",children:">_"},void 0,!1,void 0,this),Q4.jsxDEV("span",{className:"text-3xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q4.jsxDEV("p",{className:"text-[#666]",children:"Run AI agents locally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q4.jsxDEV("div",{className:"bg-[#111] rounded-lg border border-[#1a1a1a] p-8",children:[Q4.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Welcome back"},void 0,!1,void 0,this),Q4.jsxDEV("p",{className:"text-[#666] mb-6",children:"Sign in to continue to apteva"},void 0,!1,void 0,this),Q4.jsxDEV("form",{onSubmit:async(O)=>{O.preventDefault(),M(null),I(!0);let F=await G(H,L);if(!F.success)M(F.error||"Login failed");I(!1)},className:"space-y-4",children:[Q4.jsxDEV("div",{children:[Q4.jsxDEV("label",{htmlFor:"username",className:"block text-sm text-[#888] mb-1",children:"Username"},void 0,!1,void 0,this),Q4.jsxDEV("input",{id:"username",type:"text",value:H,onChange:(O)=>_(O.target.value),placeholder:"Enter your username",autoFocus:!0,required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q4.jsxDEV("div",{children:[Q4.jsxDEV("label",{htmlFor:"password",className:"block text-sm text-[#888] mb-1",children:"Password"},void 0,!1,void 0,this),Q4.jsxDEV("input",{id:"password",type:"password",value:L,onChange:(O)=>R(O.target.value),placeholder:"Enter your password",required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N&&Q4.jsxDEV("div",{className:"p-3 bg-red-500/10 border border-red-500/30 rounded text-red-400 text-sm",children:N},void 0,!1,void 0,this),Q4.jsxDEV("button",{type:"submit",disabled:U||!H||!L,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:U?"Signing in...":"Sign In"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Jz=n(e0(),1),A1=n(C1(),1);function xJ({onComplete:G}){let[H,_]=Jz.useState(""),[L,R]=Jz.useState(""),[N,M]=Jz.useState(""),[U,I]=Jz.useState(""),[y,O]=Jz.useState(!1),[F,P]=Jz.useState(null),[S,E]=Jz.useState(!1);return A1.jsxDEV(A1.Fragment,{children:[A1.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Create your account"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-[#666] mb-6",children:"Set up your admin account to get started with apteva."},void 0,!1,void 0,this),A1.jsxDEV("form",{onSubmit:async(g)=>{if(g.preventDefault(),P(null),L!==N){P("Passwords do not match");return}E(!0);try{let i=await fetch("/api/onboarding/user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:H,password:L,...U&&{email:U}})}),s=await i.json();if(!i.ok){P(s.error||"Failed to create account"),E(!1);return}let p=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:H,password:L})});if(!p.ok){P("Account created but login failed. Please try logging in."),E(!1);return}let a=await p.json();if(a.accessToken)sessionStorage.setItem("accessToken",a.accessToken);G({username:H})}catch(i){P("Failed to create account"),E(!1)}},className:"space-y-4",children:[A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"username",className:"block text-sm text-[#888] mb-1",children:"Username"},void 0,!1,void 0,this),A1.jsxDEV("input",{id:"username",type:"text",value:H,onChange:(g)=>_(g.target.value),placeholder:"Choose a username",autoFocus:!0,required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:"3-20 characters, letters, numbers, underscore"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"password",className:"block text-sm text-[#888] mb-1",children:"Password"},void 0,!1,void 0,this),A1.jsxDEV("input",{id:"password",type:"password",value:L,onChange:(g)=>R(g.target.value),placeholder:"Enter a password",required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:"Min 8 characters, uppercase, lowercase, number"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"confirmPassword",className:"block text-sm text-[#888] mb-1",children:"Confirm Password"},void 0,!1,void 0,this),A1.jsxDEV("input",{id:"confirmPassword",type:"password",value:N,onChange:(g)=>M(g.target.value),placeholder:"Confirm your password",required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!y?A1.jsxDEV("button",{type:"button",onClick:()=>O(!0),className:"text-sm text-[#666] hover:text-[#888] transition",children:"+ Add email for password recovery (optional)"},void 0,!1,void 0,this):A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"email",className:"block text-sm text-[#888] mb-1",children:["Email ",A1.jsxDEV("span",{className:"text-[#666]",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("input",{id:"email",type:"email",value:U,onChange:(g)=>I(g.target.value),placeholder:"For password recovery only",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:"Only used for password recovery, never shared"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F&&A1.jsxDEV("div",{className:"p-3 bg-red-500/10 border border-red-500/30 rounded text-red-400 text-sm",children:F},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"submit",disabled:S||!H||!L||!N,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:S?"Creating account...":"Create Account"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-4 text-center",children:"This will be your admin account with full access to apteva."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var V6=n(e0(),1);var _0=n(C1(),1);function _Y({onComplete:G,needsAccount:H=!1}){let[_,L]=V6.useState(H?0:1),[R,N]=V6.useState([]),[M,U]=V6.useState(null),[I,y]=V6.useState(""),[O,F]=V6.useState(!1),[P,S]=V6.useState(!1),[E,V]=V6.useState(null),[g,i]=V6.useState(null),[s,p]=V6.useState(!1),a=()=>{let e=sessionStorage.getItem("accessToken");return e?{Authorization:`Bearer ${e}`}:{}};V6.useEffect(()=>{if(H&&!s&&_===0)return;fetch("/api/providers",{headers:a()}).then((e)=>e.json()).then((e)=>{let l=(e.providers||[]).filter((u)=>u.type==="llm");N(l)})},[s,_,H]);let H0=R.filter((e)=>e.hasKey),d=async()=>{if(!M||!I)return;F(!0),V(null),i(null);try{S(!0);let l=await(await fetch(`/api/keys/${M}/test`,{method:"POST",headers:{"Content-Type":"application/json",...a()},body:JSON.stringify({key:I})})).json();if(S(!1),!l.valid){V(l.error||"API key is invalid"),F(!1);return}let u=await fetch(`/api/keys/${M}`,{method:"POST",headers:{"Content-Type":"application/json",...a()},body:JSON.stringify({key:I})}),q0=await u.json();if(!u.ok)V(q0.error||"Failed to save key");else{i("API key saved successfully!"),y("");let Z0=await(await fetch("/api/providers",{headers:a()})).json();N(Z0.providers||[]),U(null)}}catch(e){V("Failed to save key")}F(!1)},B0=async()=>{try{let e=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json",...a()},body:JSON.stringify({name:"My Project",description:"Default project for organizing agents",color:"#f97316"})});if(e.ok){let l=await e.json();if(l.project?.id)localStorage.setItem("apteva_current_project",l.project.id)}}catch(e){console.error("Failed to create default project:",e)}await fetch("/api/onboarding/complete",{method:"POST",headers:a()}),G()},c=()=>{p(!0),L(1)},v0=H?3:2,C=H?_:_-1;return _0.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center p-8",children:_0.jsxDEV("div",{className:"w-full max-w-2xl",children:[_0.jsxDEV("div",{className:"text-center mb-8",children:[_0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-2",children:[_0.jsxDEV("span",{className:"text-[#f97316] text-3xl",children:">_"},void 0,!1,void 0,this),_0.jsxDEV("span",{className:"text-3xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("p",{className:"text-[#666]",children:"Run AI agents locally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-8",children:[H&&_0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${_>=0?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),_0.jsxDEV("div",{className:`w-16 h-0.5 ${_>=1?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${_>=1?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),_0.jsxDEV("div",{className:`w-16 h-0.5 ${_>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),_0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${_>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"bg-[#111] rounded-lg border border-[#1a1a1a] p-8",children:[_===0&&H&&_0.jsxDEV(xJ,{onComplete:c},void 0,!1,void 0,this),_===1&&_0.jsxDEV(YM,{providers:R,configuredProviders:H0,selectedProvider:M,apiKey:I,saving:O,testing:P,error:E,success:g,onSelectProvider:U,onApiKeyChange:y,onSaveKey:d,onContinue:()=>L(2)},void 0,!1,void 0,this),_===2&&_0.jsxDEV(JM,{configuredProviders:H0,onAddMore:()=>L(1),onComplete:B0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function YM({providers:G,configuredProviders:H,selectedProvider:_,apiKey:L,saving:R,testing:N,error:M,success:U,onSelectProvider:I,onApiKeyChange:y,onSaveKey:O,onContinue:F}){let P=G.find((S)=>S.id===_);if(_&&P)return _0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:["Add ",P.name," Key"]},void 0,!0,void 0,this),_0.jsxDEV("p",{className:"text-[#666] mb-6",children:"Enter your API key below. It will be encrypted and stored locally."},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"mb-6",children:[_0.jsxDEV("div",{className:"p-4 rounded border border-[#f97316] bg-[#f97316]/5 mb-4",children:_0.jsxDEV("div",{className:"flex items-center justify-between",children:[_0.jsxDEV("div",{children:[_0.jsxDEV("p",{className:"font-medium",children:P.name},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-sm text-[#666]",children:[P.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("a",{href:P.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"space-y-3",children:[_0.jsxDEV("input",{type:"password",value:L,onChange:(S)=>y(S.target.value),placeholder:"Enter your API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316] text-lg"},void 0,!1,void 0,this),M&&_0.jsxDEV("p",{className:"text-red-400 text-sm",children:M},void 0,!1,void 0,this),U&&_0.jsxDEV("p",{className:"text-green-400 text-sm",children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"flex gap-3",children:[_0.jsxDEV("button",{onClick:()=>{I(null),y("")},className:"flex-1 border border-[#333] hover:border-[#666] px-4 py-3 rounded font-medium transition",children:"Back"},void 0,!1,void 0,this),_0.jsxDEV("button",{onClick:O,disabled:!L||R,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:N?"Testing...":R?"Saving...":"Save API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return _0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Welcome to apteva"},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-[#666] mb-6",children:"To get started, you'll need to add at least one AI provider API key. Your keys are encrypted and stored locally."},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"space-y-3 mb-6",children:G.map((S)=>_0.jsxDEV(ZM,{provider:S,selected:!1,onSelect:()=>!S.hasKey&&I(S.id)},S.id,!1,void 0,this))},void 0,!1,void 0,this),_0.jsxDEV("button",{onClick:F,disabled:H.length===0,className:"w-full bg-[#222] hover:bg-[#333] disabled:opacity-50 disabled:cursor-not-allowed px-4 py-3 rounded font-medium transition",children:H.length===0?"Add at least one API key to continue":`Continue with ${H.length} provider${H.length>1?"s":""}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZM({provider:G,selected:H,onSelect:_}){return _0.jsxDEV("div",{onClick:_,className:`p-4 rounded border transition cursor-pointer ${G.hasKey?"border-green-500/30 bg-green-500/5":H?"border-[#f97316] bg-[#f97316]/5":"border-[#222] hover:border-[#333]"}`,children:_0.jsxDEV("div",{className:"flex items-center justify-between",children:[_0.jsxDEV("div",{children:[_0.jsxDEV("p",{className:"font-medium",children:G.name},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-sm text-[#666]",children:[G.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.hasKey?_0.jsxDEV("span",{className:"text-green-400 text-sm flex items-center gap-1",children:[_0.jsxDEV(uJ,{},void 0,!1,void 0,this),"Configured (",G.keyHint,")"]},void 0,!0,void 0,this):_0.jsxDEV("a",{href:G.docsUrl,target:"_blank",rel:"noopener noreferrer",onClick:(L)=>L.stopPropagation(),className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function JM({configuredProviders:G,onAddMore:H,onComplete:_}){return _0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"You're all set!"},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-[#666] mb-6",children:["You've configured ",G.length," provider",G.length>1?"s":"",". You can add more providers later in Settings."]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"space-y-2 mb-6",children:G.map((L)=>_0.jsxDEV("div",{className:"flex items-center gap-3 p-3 bg-[#0a0a0a] rounded",children:[_0.jsxDEV(uJ,{className:"w-5 h-5 text-green-400"},void 0,!1,void 0,this),_0.jsxDEV("span",{children:L.name},void 0,!1,void 0,this),_0.jsxDEV("span",{className:"text-[#666] text-sm",children:["(",L.keyHint,")"]},void 0,!0,void 0,this)]},L.id,!0,void 0,this))},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"flex gap-3",children:[_0.jsxDEV("button",{onClick:H,className:"flex-1 border border-[#333] hover:border-[#f97316] px-4 py-3 rounded font-medium transition",children:"Add More"},void 0,!1,void 0,this),_0.jsxDEV("button",{onClick:_,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-3 rounded font-medium transition",children:"Start Using apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var cJ=n(e0(),1);var S1=n(C1(),1),GM=[{key:"memory",icon:KX,label:"Memory"},{key:"tasks",icon:k7,label:"Tasks"},{key:"files",icon:OX,label:"Files"},{key:"vision",icon:_X,label:"Vision"},{key:"operator",icon:BX,label:"Operator"},{key:"mcp",icon:Q8,label:"MCP"},{key:"realtime",icon:UX,label:"Realtime"},{key:"agents",icon:LX,label:"Multi-Agent"}];function dJ({agent:G,selected:H,onSelect:_,onToggle:L,showProject:R}){let N=GM.filter((V)=>G.features?.[V.key]),M=G.mcpServerDetails||[],U=G.skillDetails||[],{isActive:I,label:y}=lJ(G.id),{projects:O}=u4(),{authFetch:F}=c1(),P=G.projectId?O.find((V)=>V.id===G.projectId):null,[S,E]=cJ.useState([]);return cJ.useEffect(()=>{F(`/api/subscriptions?agent_id=${G.id}`).then((V)=>V.ok?V.json():{subscriptions:[]}).then((V)=>E(V.subscriptions||[])).catch(()=>{})},[G.id,F]),S1.jsxDEV("div",{onClick:_,className:`bg-[#111] rounded p-5 border transition cursor-pointer flex flex-col h-full ${H?"border-[#f97316]":"border-[#1a1a1a] hover:border-[#333]"}`,children:[S1.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[S1.jsxDEV("div",{children:[S1.jsxDEV("h3",{className:"font-semibold text-lg",children:G.name},void 0,!1,void 0,this),S1.jsxDEV("p",{className:"text-sm text-[#666]",children:[G.provider," / ",G.model,G.port&&S1.jsxDEV("span",{className:"text-[#444]",children:[" · :",G.port]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R&&P&&S1.jsxDEV("p",{className:"text-sm text-[#666] flex items-center gap-1.5 mt-1",children:[S1.jsxDEV("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:P.color}},void 0,!1,void 0,this),P.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),S1.jsxDEV(qM,{status:G.status,isActive:I&&G.status==="running",activityLabel:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:N.map(({key:V,icon:g,label:i})=>S1.jsxDEV("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-[#f97316]/10 text-[#f97316]/70 text-xs",title:i,children:[S1.jsxDEV(g,{className:"w-3 h-3"},void 0,!1,void 0,this),i]},V,!0,void 0,this))},void 0,!1,void 0,this),M.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:M.map((V)=>{let g=V.type==="http"&&V.url||V.status==="running";return S1.jsxDEV("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs ${g?"bg-green-500/10 text-green-400":"bg-[#222] text-[#666]"}`,title:`MCP: ${V.name} (${g?"available":V.status})`,children:[S1.jsxDEV(Q8,{className:"w-3 h-3"},void 0,!1,void 0,this),V.name]},V.id,!0,void 0,this)})},void 0,!1,void 0,this),U.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:U.map((V)=>S1.jsxDEV("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs ${V.enabled?"bg-purple-500/10 text-purple-400":"bg-[#222] text-[#666]"}`,title:`Skill: ${V.name} v${V.version}`,children:[S1.jsxDEV(mJ,{className:"w-3 h-3"},void 0,!1,void 0,this),V.name]},V.id,!0,void 0,this))},void 0,!1,void 0,this),S.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:S.map((V)=>S1.jsxDEV("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs ${V.enabled?"bg-cyan-500/10 text-cyan-400":"bg-[#222] text-[#666]"}`,title:`Trigger: ${V.trigger_slug.replace(/_/g," ")}`,children:[S1.jsxDEV(hJ,{className:"w-3 h-3"},void 0,!1,void 0,this),V.trigger_slug.replace(/_/g," ")]},V.id,!0,void 0,this))},void 0,!1,void 0,this),S1.jsxDEV("p",{className:"text-sm text-[#666] line-clamp-2 mb-4 flex-1",children:G.systemPrompt},void 0,!1,void 0,this),S1.jsxDEV("button",{onClick:L,disabled:G.status==="starting"||G.status==="stopping",className:`w-full px-3 py-1.5 rounded text-sm font-medium transition mt-auto ${G.status==="starting"||G.status==="stopping"?"bg-[#333] text-[#666] cursor-wait":G.status==="running"?"bg-[#f97316]/20 text-[#f97316] hover:bg-[#f97316]/30":"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30"}`,children:G.status==="starting"?"Starting...":G.status==="stopping"?"Stopping...":G.status==="running"?"Stop":"Start"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qM({status:G,isActive:H,activityLabel:_}){if(G==="running"&&H&&_)return S1.jsxDEV("span",{className:"px-2 py-1 rounded text-xs font-medium bg-green-500/20 text-green-400 animate-pulse",children:_},void 0,!1,void 0,this);return S1.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ${G==="starting"||G==="stopping"?"bg-yellow-500/20 text-yellow-400 animate-pulse":G==="running"?"bg-[#3b82f6]/20 text-[#3b82f6]":"bg-[#333] text-[#666]"}`,children:G},void 0,!1,void 0,this)}var BY=n(e0(),1);var w0=n(C1(),1),HM=[{key:"memory",label:"Memory",description:"Persistent recall",icon:KX},{key:"tasks",label:"Tasks",description:"Schedule and execute tasks",icon:k7},{key:"files",label:"Files",description:"File storage and management",icon:OX},{key:"vision",label:"Vision",description:"Process images and PDFs",icon:_X},{key:"operator",label:"Operator",description:"Browser automation",icon:BX},{key:"mcp",label:"MCP",description:"External tools/services",icon:Q8},{key:"realtime",label:"Realtime",description:"Voice conversations",icon:UX},{key:"agents",label:"Multi-Agent",description:"Communicate with peer agents",icon:LX}];function aJ({form:G,providers:H,configuredProviders:_,onFormChange:L,onProviderChange:R,onCreate:N,onClose:M,onGoToSettings:U}){let{projects:I,currentProjectId:y}=u4(),O=H.find((d)=>d.id===G.provider),[F,P]=BY.default.useState([]),[S,E]=BY.default.useState(!1);BY.default.useEffect(()=>{if(G.provider==="ollama")E(!0),fetch("/api/providers/ollama/models").then((d)=>d.json()).then((d)=>{if(d.models&&d.models.length>0){if(P(d.models.map((B0)=>({value:B0.value,label:B0.label||B0.value}))),!G.model&&d.models.length>0)L({...G,model:d.models[0].value})}}).catch(()=>P([])).finally(()=>E(!1))},[G.provider]);let V=_.filter((d)=>d.type==="llm").map((d)=>({value:d.id,label:d.name})),g=G.provider==="ollama"&&F.length>0?F:O?.models.map((d)=>({value:d.value,label:d.label,recommended:d.recommended}))||[],i=I.map((d)=>({value:d.id,label:d.name}));BY.default.useEffect(()=>{if(G.projectId===void 0&&y&&y!=="unassigned")L({...G,projectId:y})},[y]);let s=(d)=>{if(d==="agents")if(typeof G.features.agents==="boolean"?G.features.agents:G.features.agents?.enabled??!1)L({...G,features:{...G.features,agents:!1}});else L({...G,features:{...G.features,agents:{enabled:!0,mode:"worker",group:G.projectId||void 0}}});else L({...G,features:{...G.features,[d]:!G.features[d]}})},p=()=>{let d=G.features.agents;if(typeof d==="boolean")return d;return d?.enabled??!1},a=()=>{return YX(G.features,G.projectId).mode||"worker"},H0=(d)=>{let B0=YX(G.features,G.projectId);L({...G,features:{...G.features,agents:{...B0,enabled:!0,mode:d}}})};return w0.jsxDEV(tH,{children:[w0.jsxDEV("h2",{className:"text-xl font-semibold mb-4",children:"Create New Agent"},void 0,!1,void 0,this),V.length===0?w0.jsxDEV(KM,{onGoToSettings:U},void 0,!1,void 0,this):w0.jsxDEV(w0.Fragment,{children:[w0.jsxDEV("div",{className:"space-y-4",children:[w0.jsxDEV(Qz,{label:"Name",children:w0.jsxDEV("input",{type:"text",value:G.name,onChange:(d)=>L({...G,name:d.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] text-[#e0e0e0]",placeholder:"My Agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),I.length>0&&w0.jsxDEV(Qz,{label:"Project",children:w0.jsxDEV(G8,{value:G.projectId||"",options:i,onChange:(d)=>L({...G,projectId:d||null}),placeholder:"Select project..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"Provider",children:w0.jsxDEV(G8,{value:G.provider,options:V,onChange:R,placeholder:"Select provider..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"Model",children:S?w0.jsxDEV("div",{className:"text-sm text-[#666] py-2",children:"Loading Ollama models..."},void 0,!1,void 0,this):G.provider==="ollama"&&g.length===0?w0.jsxDEV("div",{className:"text-sm text-yellow-400/80 py-2",children:["No models found. Run ",w0.jsxDEV("code",{className:"bg-[#1a1a1a] px-1 rounded",children:"ollama pull llama3.3"},void 0,!1,void 0,this)," to download a model."]},void 0,!0,void 0,this):w0.jsxDEV(G8,{value:G.model,options:g,onChange:(d)=>L({...G,model:d}),placeholder:"Select model..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"System Prompt",children:w0.jsxDEV("textarea",{value:G.systemPrompt,onChange:(d)=>L({...G,systemPrompt:d.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 h-24 resize-none focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"Features",children:w0.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:HM.map(({key:d,label:B0,description:c,icon:v0})=>{let C=d==="agents"?p():!!G.features[d];return w0.jsxDEV("button",{type:"button",onClick:()=>s(d),className:`flex items-center gap-3 p-3 rounded border text-left transition ${C?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[w0.jsxDEV(v0,{className:`w-5 h-5 flex-shrink-0 ${C?"text-[#f97316]":"text-[#666]"}`},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"flex-1 min-w-0",children:[w0.jsxDEV("div",{className:`text-sm font-medium ${C?"text-[#f97316]":""}`,children:B0},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"text-xs text-[#666]",children:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},d,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),p()&&w0.jsxDEV(Qz,{label:"Multi-Agent Mode",children:[w0.jsxDEV("div",{className:"flex gap-2",children:[w0.jsxDEV("button",{type:"button",onClick:()=>H0("coordinator"),className:`flex-1 p-3 rounded border text-left transition ${a()==="coordinator"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[w0.jsxDEV("div",{className:`text-sm font-medium ${a()==="coordinator"?"text-[#f97316]":""}`,children:"Coordinator"},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"text-xs text-[#666]",children:"Orchestrates and delegates"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("button",{type:"button",onClick:()=>H0("worker"),className:`flex-1 p-3 rounded border text-left transition ${a()==="worker"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[w0.jsxDEV("div",{className:`text-sm font-medium ${a()==="worker"?"text-[#f97316]":""}`,children:"Worker"},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"text-xs text-[#666]",children:"Receives delegated tasks"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.projectId&&w0.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Group: Using project as agent group"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.provider==="anthropic"&&w0.jsxDEV(Qz,{label:"Agent Built-in Tools",children:[w0.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[w0.jsxDEV("button",{type:"button",onClick:()=>L({...G,features:{...G.features,builtinTools:{...G.features.builtinTools,webSearch:!G.features.builtinTools?.webSearch}}}),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${G.features.builtinTools?.webSearch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[w0.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:w0.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV("span",{className:"text-sm",children:"Web Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("button",{type:"button",onClick:()=>L({...G,features:{...G.features,builtinTools:{...G.features.builtinTools,webFetch:!G.features.builtinTools?.webFetch}}}),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${G.features.builtinTools?.webFetch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[w0.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:w0.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV("span",{className:"text-sm",children:"Web Fetch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Provider-native tools for real-time web access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("div",{className:"flex gap-3 mt-6",children:[w0.jsxDEV("button",{onClick:M,className:"flex-1 border border-[#333] hover:border-[#f97316] hover:text-[#f97316] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),w0.jsxDEV("button",{onClick:N,disabled:!G.name,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Qz({label:G,children:H}){return w0.jsxDEV("div",{children:[w0.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:G},void 0,!1,void 0,this),H]},void 0,!0,void 0,this)}function KM({onGoToSettings:G}){return w0.jsxDEV("div",{className:"text-center py-6",children:[w0.jsxDEV("p",{className:"text-[#666] mb-4",children:"No API keys configured. Add a provider key first."},void 0,!1,void 0,this),w0.jsxDEV("button",{onClick:G,className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Go to Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var I0=n(e0(),1);var W=n(C1(),1),_M=[{key:"memory",label:"Memory",description:"Persistent recall",icon:KX},{key:"tasks",label:"Tasks",description:"Schedule and execute tasks",icon:k7},{key:"files",label:"Files",description:"File storage and management",icon:OX},{key:"vision",label:"Vision",description:"Process images and PDFs",icon:_X},{key:"operator",label:"Operator",description:"Browser automation",icon:BX},{key:"mcp",label:"MCP",description:"External tools/services",icon:Q8},{key:"realtime",label:"Realtime",description:"Voice conversations",icon:UX},{key:"agents",label:"Multi-Agent",description:"Communicate with peer agents",icon:LX}];function oJ({agent:G,providers:H,onClose:_,onStartAgent:L,onUpdateAgent:R,onDeleteAgent:N}){let[M,U]=I0.useState("chat");return W.jsxDEV("div",{className:"w-full h-full flex flex-col overflow-hidden bg-[#0a0a0a] border-l border-[#1a1a1a]",children:[W.jsxDEV("div",{className:"border-b border-[#1a1a1a] flex items-center",children:[W.jsxDEV("div",{className:"flex-1 overflow-x-auto scrollbar-hide px-2 md:px-4",children:W.jsxDEV("div",{className:"flex gap-1",children:[W.jsxDEV(WX,{active:M==="chat",onClick:()=>U("chat"),children:"Chat"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="threads",onClick:()=>U("threads"),children:"Threads"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="tasks",onClick:()=>U("tasks"),children:"Tasks"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="memory",onClick:()=>U("memory"),children:"Memory"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="files",onClick:()=>U("files"),children:"Files"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="settings",onClick:()=>U("settings"),children:"Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:_,className:"text-[#666] hover:text-[#e0e0e0] transition p-2 flex-shrink-0 mr-2",children:W.jsxDEV(nz,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[M==="chat"&&W.jsxDEV(BM,{agent:G,onStartAgent:L},void 0,!1,void 0,this),M==="threads"&&W.jsxDEV(UM,{agent:G},void 0,!1,void 0,this),M==="tasks"&&W.jsxDEV(OM,{agent:G},void 0,!1,void 0,this),M==="memory"&&W.jsxDEV(LM,{agent:G},void 0,!1,void 0,this),M==="files"&&W.jsxDEV(WM,{agent:G},void 0,!1,void 0,this),M==="settings"&&W.jsxDEV(RM,{agent:G,providers:H,onUpdateAgent:R,onDeleteAgent:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function WX({active:G,onClick:H,children:_}){return W.jsxDEV("button",{onClick:H,className:`px-4 py-3 text-sm font-medium border-b-2 transition ${G?"border-[#f97316] text-[#e0e0e0]":"border-transparent text-[#666] hover:text-[#888]"}`,children:_},void 0,!1,void 0,this)}function BM({agent:G,onStartAgent:H}){if(G.status==="running"&&G.port)return W.jsxDEV(GY,{agentId:"default",apiUrl:`/api/agents/${G.id}`,placeholder:"Message this agent...",context:G.systemPrompt,variant:"terminal",headerTitle:G.name},void 0,!1,void 0,this);return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"text-lg mb-2",children:"Agent is not running"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:H,className:"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30 px-4 py-2 rounded font-medium transition",children:"Start Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function UM({agent:G}){let[H,_]=I0.useState([]),[L,R]=I0.useState(!0),[N,M]=I0.useState(null),[U,I]=I0.useState(null),[y,O]=I0.useState([]),[F,P]=I0.useState(!1),{confirm:S,ConfirmDialog:E}=iJ();I0.useEffect(()=>{_([]),I(null),M(null),R(!0)},[G.id]),I0.useEffect(()=>{if(G.status!=="running"){R(!1);return}(async()=>{try{let s=await fetch(`/api/agents/${G.id}/threads`);if(!s.ok)throw Error("Failed to fetch threads");let p=await s.json();_(p.threads||[]),M(null)}catch(s){M(s instanceof Error?s.message:"Failed to load threads")}finally{R(!1)}})()},[G.id,G.status]);let V=async(i)=>{P(!0),I(i);try{let s=await fetch(`/api/agents/${G.id}/threads/${i}/messages`);if(s.ok){let p=await s.json();O(z2(p.messages||[]))}else O([])}catch{O([])}P(!1)},g=async(i,s)=>{if(s.stopPropagation(),!await S("Delete this thread?",{confirmText:"Delete",title:"Delete Thread"}))return;try{if(await fetch(`/api/agents/${G.id}/threads/${i}`,{method:"DELETE"}),_((a)=>a.filter((H0)=>H0.id!==i)),U===i)I(null)}catch{}};if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view threads"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(L)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading threads..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(N)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(U)return W.jsxDEV(W.Fragment,{children:[E,W.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:F?W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:"Loading messages..."},void 0,!1,void 0,this):W.jsxDEV(GY,{agentId:"default",apiUrl:`/api/agents/${G.id}`,threadId:U,initialMessages:y,placeholder:"Continue this conversation...",context:G.systemPrompt,variant:"terminal",showHeader:!0,onHeaderBack:()=>{I(null),O([])}},U,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return W.jsxDEV(W.Fragment,{children:[E,W.jsxDEV("div",{className:"flex-1 overflow-auto",children:H.length===0?W.jsxDEV("div",{className:"flex items-center justify-center h-full text-[#666]",children:W.jsxDEV("p",{children:"No conversation threads yet"},void 0,!1,void 0,this)},void 0,!1,void 0,this):W.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:H.map((i)=>W.jsxDEV("div",{onClick:()=>V(i.id),className:"p-4 cursor-pointer hover:bg-[#111] transition flex items-center justify-between",children:[W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("p",{className:"text-sm font-medium truncate",children:i.title||`Thread ${i.id.slice(0,8)}`},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:[new Date(i.updated_at||i.created_at).toLocaleString(),i.message_count!==void 0&&` • ${i.message_count} messages`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("button",{onClick:(s)=>g(i.id,s),className:"text-[#666] hover:text-red-400 text-lg ml-4",children:"×"},void 0,!1,void 0,this)]},i.id,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function OM({agent:G}){let{authFetch:H}=c1(),[_,L]=I0.useState([]),[R,N]=I0.useState(!0),[M,U]=I0.useState(null),[I,y]=I0.useState("all"),[O,F]=I0.useState(null),[P,S]=I0.useState(!1),{events:E}=S2({agent_id:G.id,category:"task"});I0.useEffect(()=>{L([]),U(null),N(!0),F(null)},[G.id]);let V=async()=>{if(G.status!=="running"){N(!1);return}try{let p=await fetch(`/api/agents/${G.id}/tasks?status=${I}`);if(!p.ok)throw Error("Failed to fetch tasks");let a=await p.json();L(a.tasks||[]),U(null)}catch(p){U(p instanceof Error?p.message:"Failed to load tasks")}finally{N(!1)}},g=async(p)=>{F(p),S(!0);try{let a=await H(`/api/tasks/${p.agentId||G.id}/${p.id}`);if(a.ok){let H0=await a.json();if(H0.task)F({...H0.task,agentId:p.agentId||G.id,agentName:p.agentName||G.name})}}catch(a){console.error("Failed to fetch task details:",a)}finally{S(!1)}};I0.useEffect(()=>{N(!0),V()},[G.id,G.status,I,E.length]);let i={pending:"bg-yellow-500/20 text-yellow-400",running:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",failed:"bg-red-500/20 text-red-400",cancelled:"bg-gray-500/20 text-gray-400"};if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view tasks"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!G.features?.tasks)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Tasks feature is not enabled"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Enable it in Settings to schedule tasks"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(R)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading tasks..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(M)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:M},void 0,!1,void 0,this)},void 0,!1,void 0,this);let s=[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}];if(O)return W.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:[W.jsxDEV("div",{className:"px-4 pt-3 pb-2 border-b border-[#1a1a1a] shrink-0",children:W.jsxDEV("button",{onClick:()=>F(null),className:"text-sm text-[#666] hover:text-[#e0e0e0] transition flex items-center gap-1",children:[W.jsxDEV("span",{children:"←"},void 0,!1,void 0,this)," Back to tasks"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[W.jsxDEV("div",{children:W.jsxDEV("div",{className:"flex items-start justify-between gap-2 mb-1",children:[W.jsxDEV("h3",{className:"text-lg font-medium",children:O.title},void 0,!1,void 0,this),W.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium flex-shrink-0 ${i[O.status]}`,children:O.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),O.description&&W.jsxDEV("div",{children:[W.jsxDEV("h4",{className:"text-xs text-[#666] uppercase tracking-wider mb-1",children:"Description"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm text-[#888] whitespace-pre-wrap",children:O.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[W.jsxDEV("div",{children:[W.jsxDEV("span",{className:"text-[#666]",children:"Type"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"capitalize",children:O.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{children:[W.jsxDEV("span",{className:"text-[#666]",children:"Priority"},void 0,!1,void 0,this),W.jsxDEV("p",{children:O.priority},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.recurrence&&W.jsxDEV("div",{children:[W.jsxDEV("span",{className:"text-[#666]",children:"Recurrence"},void 0,!1,void 0,this),W.jsxDEV("p",{children:sH(O.recurrence)},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#444] mt-0.5 font-mono",children:O.recurrence},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"space-y-2 text-sm",children:[W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Created"},void 0,!1,void 0,this),W.jsxDEV("span",{children:new Date(O.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.execute_at&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Scheduled"},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-[#f97316]",children:UY(O.execute_at)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.executed_at&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Started"},void 0,!1,void 0,this),W.jsxDEV("span",{children:new Date(O.executed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.completed_at&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Completed"},void 0,!1,void 0,this),W.jsxDEV("span",{children:new Date(O.completed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.next_run&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Next Run"},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-[#f97316]",children:UY(O.next_run)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),O.status==="failed"&&O.error&&W.jsxDEV("div",{className:"min-w-0",children:[W.jsxDEV("h4",{className:"text-xs text-red-400 uppercase tracking-wider mb-1",children:"Error"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/20 rounded p-3 overflow-x-auto",children:W.jsxDEV("pre",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:O.error},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.status==="completed"&&O.result&&W.jsxDEV("div",{className:"min-w-0",children:[W.jsxDEV("h4",{className:"text-xs text-green-400 uppercase tracking-wider mb-1",children:"Result"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/20 rounded p-3 overflow-x-auto",children:W.jsxDEV("pre",{className:"text-sm text-green-400 whitespace-pre-wrap break-words",children:typeof O.result==="string"?O.result:JSON.stringify(O.result,null,2)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P&&!O.trajectory&&W.jsxDEV("div",{children:[W.jsxDEV("h4",{className:"text-xs text-[#666] uppercase tracking-wider mb-2",children:"Trajectory"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-sm text-[#555]",children:"Loading trajectory..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.trajectory&&O.trajectory.length>0&&W.jsxDEV("div",{children:[W.jsxDEV("h4",{className:"text-xs text-[#666] uppercase tracking-wider mb-2",children:["Trajectory (",O.trajectory.length," steps)"]},void 0,!0,void 0,this),W.jsxDEV(m2,{trajectory:O.trajectory},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return W.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:[W.jsxDEV("div",{className:"flex gap-2 mb-4",children:s.map((p)=>W.jsxDEV("button",{onClick:()=>y(p.value),className:`px-3 py-1.5 rounded text-sm transition ${I===p.value?"bg-[#f97316] text-black":"bg-[#1a1a1a] hover:bg-[#222]"}`,children:p.label},p.value,!1,void 0,this))},void 0,!1,void 0,this),_.length===0?W.jsxDEV("div",{className:"text-center py-10",children:[W.jsxDEV(k7,{className:"w-10 h-10 mx-auto mb-3 text-[#333]"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-[#666]",children:["No ",I==="all"?"":I+" ","tasks"]},void 0,!0,void 0,this),W.jsxDEV("p",{className:"text-sm text-[#444] mt-1",children:"Tasks will appear here when created"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):W.jsxDEV("div",{className:"space-y-3",children:_.map((p)=>W.jsxDEV("div",{onClick:()=>g(p),className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 cursor-pointer hover:border-[#333] transition",children:[W.jsxDEV("div",{className:"flex items-start justify-between mb-2",children:[W.jsxDEV("div",{className:"flex-1 min-w-0",children:W.jsxDEV("h3",{className:"font-medium",children:p.title||p.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ml-2 ${i[p.status]||i.pending}`,children:p.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.description&&W.jsxDEV("p",{className:"text-sm text-[#888] mb-2 line-clamp-2",children:p.description},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-[#555]",children:[W.jsxDEV("span",{className:"flex items-center gap-1",children:[p.type==="recurring"?W.jsxDEV(D2,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):p.execute_at?W.jsxDEV(E2,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):W.jsxDEV(f2,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),p.type==="recurring"&&p.recurrence?sH(p.recurrence):p.type||"once"]},void 0,!0,void 0,this),p.priority!==void 0&&W.jsxDEV("span",{children:["Priority: ",p.priority]},void 0,!0,void 0,this),p.next_run&&W.jsxDEV("span",{className:"text-[#f97316]",children:UY(p.next_run)},void 0,!1,void 0,this),!p.next_run&&p.execute_at&&W.jsxDEV("span",{className:"text-[#f97316]",children:UY(p.execute_at)},void 0,!1,void 0,this),W.jsxDEV("span",{children:["Created: ",new Date(p.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),p.status==="completed"&&p.result&&W.jsxDEV("div",{className:"mt-3 bg-green-500/10 border border-green-500/20 rounded p-3",children:[W.jsxDEV("h4",{className:"text-xs text-green-400 uppercase tracking-wider mb-1",children:"Result"},void 0,!1,void 0,this),W.jsxDEV("pre",{className:"text-sm text-green-400 whitespace-pre-wrap break-words",children:typeof p.result==="string"?p.result:JSON.stringify(p.result,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.status==="failed"&&p.error&&W.jsxDEV("div",{className:"mt-3 bg-red-500/10 border border-red-500/20 rounded p-3",children:[W.jsxDEV("h4",{className:"text-xs text-red-400 uppercase tracking-wider mb-1",children:"Error"},void 0,!1,void 0,this),W.jsxDEV("pre",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:p.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LM({agent:G}){let[H,_]=I0.useState([]),[L,R]=I0.useState(!0),[N,M]=I0.useState(null),[U,I]=I0.useState(!1),{confirm:y,ConfirmDialog:O}=iJ();I0.useEffect(()=>{_([]),M(null),R(!0)},[G.id]);let F=async()=>{if(G.status!=="running"){R(!1);return}try{let E=await fetch(`/api/agents/${G.id}/memories`);if(!E.ok)throw Error("Failed to fetch memories");let V=await E.json();_(V.memories||[]),I(V.enabled??!1),M(null)}catch(E){M(E instanceof Error?E.message:"Failed to load memories")}finally{R(!1)}};I0.useEffect(()=>{F()},[G.id,G.status]);let P=async(E)=>{try{await fetch(`/api/agents/${G.id}/memories/${E}`,{method:"DELETE"}),_((V)=>V.filter((g)=>g.id!==E))}catch{}},S=async()=>{if(!await y("Clear all memories?",{confirmText:"Clear",title:"Clear Memories"}))return;try{await fetch(`/api/agents/${G.id}/memories`,{method:"DELETE"}),_([])}catch{}};if(!G.features?.memory)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Memory feature is not enabled"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Enable it in Settings to persist knowledge"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view memories"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(L)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading memories..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(N)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!U)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Memory system not initialized"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Check OPENAI_API_KEY for embeddings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return W.jsxDEV(W.Fragment,{children:[O,W.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:[W.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[W.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Stored Memories (",H.length,")"]},void 0,!0,void 0,this),H.length>0&&W.jsxDEV("button",{onClick:S,className:"text-xs text-red-400 hover:text-red-300",children:"Clear All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.length===0?W.jsxDEV("div",{className:"text-center py-10 text-[#666]",children:[W.jsxDEV("p",{children:"No memories stored yet"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm mt-1",children:"The agent will remember important information from conversations"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):W.jsxDEV("div",{className:"space-y-3",children:H.map((E)=>W.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded p-3",children:[W.jsxDEV("div",{className:"flex items-start justify-between gap-2",children:[W.jsxDEV("p",{className:"text-sm text-[#e0e0e0] flex-1",children:E.content},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:()=>P(E.id),className:"text-[#666] hover:text-red-400 text-sm flex-shrink-0",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center gap-3 mt-2",children:[W.jsxDEV("span",{className:`text-xs px-2 py-0.5 rounded ${E.type==="preference"?"bg-purple-500/20 text-purple-400":E.type==="fact"?"bg-green-500/20 text-green-400":"bg-blue-500/20 text-blue-400"}`,children:E.type},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-xs text-[#666]",children:new Date(E.created_at).toLocaleString()},void 0,!1,void 0,this),E.importance&&W.jsxDEV("span",{className:"text-xs text-[#555]",children:["importance: ",E.importance.toFixed(1)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},E.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function WM({agent:G}){let[H,_]=I0.useState([]),[L,R]=I0.useState(!0),[N,M]=I0.useState(null),[U,I]=I0.useState(!1),[y,O]=I0.useState(null),[F,P]=I0.useState(!1),S=I0.default.useRef(null),{confirm:E,ConfirmDialog:V}=iJ();I0.useEffect(()=>{_([]),M(null),R(!0)},[G.id]);let g=async()=>{if(G.status!=="running"){R(!1);return}try{let C=await fetch(`/api/agents/${G.id}/files`);if(!C.ok)throw Error("Failed to fetch files");let e=await C.json();_(e.files||[]),M(null)}catch(C){M(C instanceof Error?C.message:"Failed to load files")}finally{R(!1)}};I0.useEffect(()=>{g()},[G.id,G.status]);let i=async(C)=>{if(!await E("Delete this file?",{confirmText:"Delete",title:"Delete File"}))return;try{await fetch(`/api/agents/${G.id}/files/${C}`,{method:"DELETE"}),_((l)=>l.filter((u)=>u.id!==C))}catch{}},s=(C,e)=>{let l=document.createElement("a");l.href=`/api/agents/${G.id}/files/${C}/download`,l.download=e,l.click()},p=(C)=>{if(C<1024)return`${C} B`;if(C<1048576)return`${(C/1024).toFixed(1)} KB`;return`${(C/1048576).toFixed(1)} MB`},a=async(C)=>{I(!0),O(null);try{let e=new FormData;e.append("file",C);let l=await fetch(`/api/agents/${G.id}/files`,{method:"POST",body:e});if(!l.ok){let u=await l.json();throw Error(u.error||"Upload failed")}await g()}catch(e){O(e instanceof Error?e.message:"Upload failed")}finally{I(!1)}},H0=(C)=>{let e=C.target.files?.[0];if(e)a(e);C.target.value=""},d=(C)=>{C.preventDefault(),P(!1);let e=C.dataTransfer.files?.[0];if(e)a(e)},B0=(C)=>{C.preventDefault(),P(!0)},c=(C)=>{C.preventDefault(),P(!1)},v0=(C)=>{if(C.startsWith("image/"))return"\uD83D\uDDBC";if(C.includes("pdf"))return"\uD83D\uDCD5";if(C.includes("json"))return"{}";if(C.includes("javascript")||C.includes("typescript"))return"⚡";if(C.startsWith("text/"))return"\uD83D\uDCC4";if(C.startsWith("audio/"))return"\uD83C\uDFB5";if(C.startsWith("video/"))return"\uD83C\uDFAC";return"\uD83D\uDCC1"};if(!G.features?.files)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Files feature is not enabled"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Enable it in Settings to manage files"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view files"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(L)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading files..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(N)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this);return W.jsxDEV(W.Fragment,{children:[V,W.jsxDEV("div",{className:`flex-1 overflow-auto p-4 transition ${F?"bg-[#f97316]/5":""}`,onDrop:d,onDragOver:B0,onDragLeave:c,children:[W.jsxDEV("input",{ref:S,type:"file",className:"hidden",onChange:H0},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[W.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Agent Files (",H.length,")"]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("button",{onClick:()=>S.current?.click(),disabled:U,className:"text-xs bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-3 py-1 rounded font-medium transition",children:U?"Uploading...":"Upload"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:g,className:"text-xs text-[#666] hover:text-[#888]",children:"Refresh"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y&&W.jsxDEV("div",{className:"mb-4 text-sm bg-red-500/10 text-red-400 px-3 py-2 rounded",children:y},void 0,!1,void 0,this),F&&W.jsxDEV("div",{className:"mb-4 border-2 border-dashed border-[#f97316] rounded-lg p-8 text-center",children:W.jsxDEV("p",{className:"text-[#f97316]",children:"Drop file to upload"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.length===0&&!F&&W.jsxDEV("div",{className:"text-center py-10 text-[#666]",children:[W.jsxDEV("p",{children:"No files stored yet"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm mt-1",children:"Drop files here, click Upload, or attach files in Chat"},void 0,!1,void 0,this),G.features?.memory&&W.jsxDEV("p",{className:"text-xs mt-2 text-[#555]",children:"Files will be auto-ingested into memory"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.length>0&&W.jsxDEV("div",{className:"space-y-2",children:H.map((C)=>W.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded p-3 flex items-center gap-3",children:[W.jsxDEV("div",{className:"w-10 h-10 bg-[#1a1a1a] rounded flex items-center justify-center text-[#666]",children:v0(C.mime_type)},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("p",{className:"text-sm text-[#e0e0e0] truncate",children:C.filename},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#666]",children:[p(C.size_bytes)," • ",new Date(C.created_at).toLocaleString(),C.source&&C.source!=="upload"&&` • ${C.source}`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("button",{onClick:()=>s(C.id,C.filename),className:"text-xs text-[#666] hover:text-[#f97316] px-2 py-1",children:"↓"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:()=>i(C.id),className:"text-[#666] hover:text-red-400 text-sm",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},C.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RM({agent:G,providers:H,onUpdateAgent:_,onDeleteAgent:L}){let{authFetch:R,isDev:N}=c1(),[M,U]=I0.useState({name:G.name,provider:G.provider,model:G.model,systemPrompt:G.systemPrompt,features:{...G.features,builtinTools:G.features.builtinTools||{webSearch:!1,webFetch:!1}},mcpServers:[...G.mcpServers||[]],skills:[...G.skills||[]]}),[I,y]=I0.useState(!1),[O,F]=I0.useState(!1),[P,S]=I0.useState(null),[E,V]=I0.useState([]),[g,i]=I0.useState([]),[s,p]=I0.useState(null),[a,H0]=I0.useState(null),[d,B0]=I0.useState(!1),[c,v0]=I0.useState([]);I0.useEffect(()=>{R(`/api/subscriptions?agent_id=${G.id}`).then((f)=>f.ok?f.json():{subscriptions:[]}).then((f)=>v0(f.subscriptions||[])).catch(()=>{})},[G.id,R]),I0.useEffect(()=>{(async()=>{try{let i0=await(await R("/api/mcp/servers")).json();V(i0.servers||[])}catch(Y0){console.error("Failed to fetch MCP servers:",Y0)}})()},[R]),I0.useEffect(()=>{(async()=>{try{let Y0=await R(`/api/agents/${G.id}/api-key`);if(Y0.ok){let i0=await Y0.json();p(i0.apiKey),H0(i0.fullKey||null)}}catch(Y0){}})()},[G.id,R]),I0.useEffect(()=>{(async()=>{try{let i0=await(await R("/api/skills")).json();i(i0.skills||[])}catch(Y0){console.error("Failed to fetch skills:",Y0)}})()},[R]),I0.useEffect(()=>{U({name:G.name,provider:G.provider,model:G.model,systemPrompt:G.systemPrompt,features:{...G.features,builtinTools:G.features.builtinTools||{webSearch:!1,webFetch:!1}},mcpServers:[...G.mcpServers||[]],skills:[...G.skills||[]]}),S(null)},[G.id]);let C=H.find((f)=>f.id===M.provider),e=H.filter((f)=>f.hasKey&&f.type==="llm").map((f)=>({value:f.id,label:f.name})),l=C?.models.map((f)=>({value:f.value,label:f.label,recommended:f.recommended}))||[],u=(f)=>{let Y0=H.find((U1)=>U1.id===f),i0=Y0?.models.find((U1)=>U1.recommended)?.value||Y0?.models[0]?.value||"";U((U1)=>({...U1,provider:f,model:i0}))},q0=(f)=>{if(f==="agents")U((Y0)=>{if(typeof Y0.features.agents==="boolean"?Y0.features.agents:Y0.features.agents?.enabled??!1)return{...Y0,features:{...Y0.features,agents:!1}};else return{...Y0,features:{...Y0.features,agents:{enabled:!0,mode:"worker",group:G.projectId||void 0}}}});else if(f==="operator")U((Y0)=>{if(XY(Y0.features).enabled)return{...Y0,features:{...Y0.features,operator:!1}};else return{...Y0,features:{...Y0.features,operator:{enabled:!0}}}});else U((Y0)=>({...Y0,features:{...Y0.features,[f]:!Y0.features[f]}}))},t=(f)=>{U((Y0)=>{let i0=YX(Y0.features,G.projectId);return{...Y0,features:{...Y0.features,agents:{...i0,enabled:!0,mode:f}}}})},Z0=()=>{let f=M.features.agents;if(typeof f==="boolean")return f;return f?.enabled??!1},K0=()=>{return YX(M.features,G.projectId).mode||"worker"},h0=()=>{return XY(M.features).enabled},f0=()=>{return XY(M.features)},m=H.filter((f)=>f.type==="browser"&&f.hasKey),Q0=(f)=>{U((Y0)=>{let i0=XY(Y0.features);return{...Y0,features:{...Y0.features,operator:{...i0,enabled:!0,browser_provider:f}}}})},k0=(f)=>{U((Y0)=>({...Y0,mcpServers:Y0.mcpServers.includes(f)?Y0.mcpServers.filter((i0)=>i0!==f):[...Y0.mcpServers,f]}))},D0=(f)=>{U((Y0)=>({...Y0,skills:Y0.skills.includes(f)?Y0.skills.filter((i0)=>i0!==f):[...Y0.skills,f]}))},r0=async()=>{y(!0),S(null);let f=await _(M);if(y(!1),f.error)S({type:"error",text:f.error});else S({type:"success",text:"Settings saved"}),setTimeout(()=>S(null),2000)},G4=M.name!==G.name||M.provider!==G.provider||M.model!==G.model||M.systemPrompt!==G.systemPrompt||JSON.stringify(M.features)!==JSON.stringify(G.features)||JSON.stringify(M.mcpServers.sort())!==JSON.stringify((G.mcpServers||[]).sort())||JSON.stringify(M.skills.sort())!==JSON.stringify((G.skills||[]).sort());return W.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:W.jsxDEV("div",{className:"space-y-4",children:[W.jsxDEV(y7,{label:"Name",children:W.jsxDEV("input",{type:"text",value:M.name,onChange:(f)=>U((Y0)=>({...Y0,name:f.target.value})),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Provider",children:W.jsxDEV(G8,{value:M.provider,options:e,onChange:u},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Model",children:W.jsxDEV(G8,{value:M.model,options:l,onChange:(f)=>U((Y0)=>({...Y0,model:f}))},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"System Prompt",children:W.jsxDEV("textarea",{value:M.systemPrompt,onChange:(f)=>U((Y0)=>({...Y0,systemPrompt:f.target.value})),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 h-24 resize-none focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Features",children:W.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:_M.map(({key:f,label:Y0,description:i0,icon:U1})=>{let O6=f==="agents"?Z0():f==="operator"?h0():!!M.features[f];return W.jsxDEV("button",{type:"button",onClick:()=>q0(f),className:`flex items-center gap-3 p-3 rounded border text-left transition ${O6?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV(U1,{className:`w-5 h-5 flex-shrink-0 ${O6?"text-[#f97316]":"text-[#666]"}`},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("div",{className:`text-sm font-medium ${O6?"text-[#f97316]":""}`,children:Y0},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:i0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},f,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z0()&&W.jsxDEV(y7,{label:"Multi-Agent Mode",children:[W.jsxDEV("div",{className:"flex gap-2",children:[W.jsxDEV("button",{type:"button",onClick:()=>t("coordinator"),className:`flex-1 p-3 rounded border text-left transition ${K0()==="coordinator"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:`text-sm font-medium ${K0()==="coordinator"?"text-[#f97316]":""}`,children:"Coordinator"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:"Orchestrates and delegates to other agents"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("button",{type:"button",onClick:()=>t("worker"),className:`flex-1 p-3 rounded border text-left transition ${K0()==="worker"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:`text-sm font-medium ${K0()==="worker"?"text-[#f97316]":""}`,children:"Worker"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:"Receives tasks from coordinators"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.projectId&&W.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Group: Using project as agent group"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h0()&&W.jsxDEV(y7,{label:"Browser Provider",children:m.length>0?W.jsxDEV(G8,{value:f0().browser_provider||"",options:[{value:"",label:"Auto (first available)"},...m.map((f)=>({value:f.id,label:f.name}))],onChange:(f)=>Q0(f)},void 0,!1,void 0,this):W.jsxDEV("p",{className:"text-sm text-[#666] p-3 border border-[#222] rounded bg-[#0a0a0a]",children:"No browser providers configured. Go to Settings → Providers to add one."},void 0,!1,void 0,this)},void 0,!1,void 0,this),M.provider==="anthropic"&&W.jsxDEV(y7,{label:"Agent Built-in Tools",children:[W.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[W.jsxDEV("button",{type:"button",onClick:()=>U((f)=>({...f,features:{...f.features,builtinTools:{...f.features.builtinTools,webSearch:!f.features.builtinTools?.webSearch}}})),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${M.features.builtinTools?.webSearch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[W.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:W.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-sm",children:"Web Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("button",{type:"button",onClick:()=>U((f)=>({...f,features:{...f.features,builtinTools:{...f.features.builtinTools,webFetch:!f.features.builtinTools?.webFetch}}})),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${M.features.builtinTools?.webFetch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[W.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:W.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-sm",children:"Web Fetch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Provider-native tools for real-time web access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M.features.mcp&&W.jsxDEV(y7,{label:"MCP Servers",children:E.length===0?W.jsxDEV("p",{className:"text-sm text-[#666]",children:"No MCP servers configured. Add servers in the MCP page first."},void 0,!1,void 0,this):W.jsxDEV("div",{className:"space-y-2",children:[E.filter((f)=>f.project_id===null||f.project_id===G.projectId).map((f)=>{let Y0=f.type==="http"&&f.url,i0=Y0||f.status==="running",U1=Y0?`${f.source||"remote"} • http`:`${f.type} • ${f.package||f.command||"custom"}${f.status==="running"&&f.port?` • :${f.port}`:""}`;return W.jsxDEV("button",{type:"button",onClick:()=>k0(f.id),className:`w-full flex items-center gap-3 p-3 rounded border text-left transition ${M.mcpServers.includes(f.id)?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i0?"bg-green-400":"bg-[#444]"}`},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("span",{className:`text-sm font-medium ${M.mcpServers.includes(f.id)?"text-[#f97316]":""}`,children:f.name},void 0,!1,void 0,this),f.project_id===null&&W.jsxDEV("span",{className:"text-[10px] text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:U1},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:`text-xs px-2 py-0.5 rounded ${i0?"bg-green-500/20 text-green-400":"bg-[#222] text-[#666]"}`,children:Y0?"remote":f.status},void 0,!1,void 0,this)]},f.id,!0,void 0,this)}),W.jsxDEV("p",{className:"text-xs text-[#666] mt-2",children:"Remote servers are always available. Local servers must be running."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Skills",children:g.length===0?W.jsxDEV("p",{className:"text-sm text-[#666]",children:"No skills configured. Add skills in the Skills page first."},void 0,!1,void 0,this):W.jsxDEV("div",{className:"space-y-2",children:[g.filter((f)=>f.enabled&&(f.project_id===null||f.project_id===G.projectId)).map((f)=>W.jsxDEV("button",{type:"button",onClick:()=>D0(f.id),className:`w-full flex items-center gap-3 p-3 rounded border text-left transition ${M.skills.includes(f.id)?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("span",{className:`text-sm font-medium ${M.skills.includes(f.id)?"text-[#f97316]":""}`,children:f.name},void 0,!1,void 0,this),f.project_id===null&&W.jsxDEV("span",{className:"text-[10px] text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:f.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"text-xs px-2 py-0.5 rounded bg-[#222] text-[#666]",children:["v",f.version]},void 0,!0,void 0,this)]},f.id,!0,void 0,this)),W.jsxDEV("p",{className:"text-xs text-[#666] mt-2",children:"Skills provide reusable instructions for the agent."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P&&W.jsxDEV("div",{className:`text-sm px-3 py-2 rounded ${P.type==="success"?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:P.text},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:r0,disabled:!G4||I||!M.name,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:I?"Saving...":"Save Changes"},void 0,!1,void 0,this),G.status==="running"&&G4&&W.jsxDEV("p",{className:"text-xs text-[#666] text-center",children:"Changes will be applied to the running agent"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"mt-8 pt-6 border-t border-[#222]",children:[W.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Subscriptions"},void 0,!1,void 0,this),c.length===0?W.jsxDEV("p",{className:"text-xs text-[#555]",children:"No subscriptions. Set up triggers in Connections to have this agent listen to external events."},void 0,!1,void 0,this):W.jsxDEV("div",{className:"space-y-2",children:c.map((f)=>W.jsxDEV("div",{className:"flex items-center gap-2 px-3 py-2 bg-[#111] rounded border border-[#1a1a1a]",children:[W.jsxDEV("span",{className:`w-2 h-2 rounded-full shrink-0 ${f.enabled?"bg-cyan-400":"bg-[#444]"}`},void 0,!1,void 0,this),W.jsxDEV("span",{className:`text-sm flex-1 ${f.enabled?"text-cyan-400":"text-[#666]"}`,children:f.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),W.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${f.enabled?"bg-cyan-500/10 text-cyan-400":"bg-[#222] text-[#555]"}`,children:f.enabled?"active":"disabled"},void 0,!1,void 0,this)]},f.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s&&W.jsxDEV("div",{className:"mt-8 pt-6 border-t border-[#222]",children:[W.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Developer Info"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"space-y-2",children:[W.jsxDEV("div",{className:"flex items-center justify-between",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"Agent ID"},void 0,!1,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1 rounded text-[#888]",children:G.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center justify-between",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"Port"},void 0,!1,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1 rounded text-[#888]",children:G.port||"N/A"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex flex-col gap-1",children:[W.jsxDEV("div",{className:"flex items-center justify-between",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"API Key"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:()=>B0(!d),className:"text-xs text-[#f97316] hover:text-[#fb923c]",children:d?"Hide":"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1 rounded text-[#888] break-all",children:d?a||s:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.status==="running"&&G.port&&W.jsxDEV("div",{className:"flex flex-col gap-1 mt-2",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"Test with curl"},void 0,!1,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1.5 rounded text-[#666] break-all",children:['curl -H "X-API-Key: ',d?a||s:"***",'" http://localhost:',G.port,"/config"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"mt-8 pt-6 border-t border-[#222]",children:[W.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Danger Zone"},void 0,!1,void 0,this),O?W.jsxDEV("div",{className:"flex gap-2",children:[W.jsxDEV("button",{onClick:()=>F(!1),className:"flex-1 border border-[#333] hover:border-[#444] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:L,className:"flex-1 bg-red-500/20 text-red-400 hover:bg-red-500/30 px-4 py-2 rounded font-medium transition",children:"Confirm Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):W.jsxDEV("button",{onClick:()=>F(!0),className:"w-full border border-red-500/30 text-red-400/70 hover:border-red-500/50 hover:text-red-400 px-4 py-2 rounded font-medium transition",children:"Delete Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function y7({label:G,children:H}){return W.jsxDEV("div",{children:[W.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:G},void 0,!1,void 0,this),H]},void 0,!0,void 0,this)}var h2=n(e0(),1);var v1=n(C1(),1);function rJ({agents:G,loading:H,selectedAgent:_,providers:L,onSelectAgent:R,onCloseAgent:N,onToggleAgent:M,onDeleteAgent:U,onUpdateAgent:I,onNewAgent:y,canCreateAgent:O=!0}){let{currentProjectId:F,currentProject:P}=u4(),S=h2.useMemo(()=>{if(F===null)return G;if(F==="unassigned")return G.filter((V)=>!V.projectId);return G.filter((V)=>V.projectId===F)},[G,F]),E=F===null?"Agents":F==="unassigned"?"Unassigned Agents":P?.name||"Agents";return v1.jsxDEV("div",{className:"flex-1 flex overflow-hidden relative",children:[v1.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[v1.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[v1.jsxDEV("div",{className:"flex items-center gap-3",children:[P&&v1.jsxDEV("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:P.color}},void 0,!1,void 0,this),v1.jsxDEV("h1",{className:"text-xl font-semibold",children:E},void 0,!1,void 0,this),F!==null&&v1.jsxDEV("span",{className:"text-sm text-[#666]",children:["(",S.length," agent",S.length!==1?"s":"",")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y&&v1.jsxDEV("button",{onClick:y,disabled:!O,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H?v1.jsxDEV(tz,{message:"Loading agents..."},void 0,!1,void 0,this):S.length===0?v1.jsxDEV(FM,{onNewAgent:y,canCreateAgent:O,hasProjectFilter:F!==null},void 0,!1,void 0,this):v1.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3 auto-rows-fr",children:S.map((V)=>v1.jsxDEV(dJ,{agent:V,selected:_?.id===V.id,onSelect:()=>R(V),onToggle:(g)=>M(V,g),showProject:F===null},V.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_&&v1.jsxDEV("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px] z-10",onClick:N},void 0,!1,void 0,this),_&&v1.jsxDEV("div",{className:"absolute right-0 top-0 bottom-0 w-full sm:w-[500px] lg:w-[600px] xl:w-[700px] z-20",children:v1.jsxDEV(oJ,{agent:_,providers:L,onClose:N,onStartAgent:(V)=>M(_,V),onUpdateAgent:(V)=>I(_.id,V),onDeleteAgent:()=>U(_.id)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FM({onNewAgent:G,canCreateAgent:H,hasProjectFilter:_}){return v1.jsxDEV("div",{className:"text-center py-20 text-[#666]",children:[_?v1.jsxDEV(v1.Fragment,{children:[v1.jsxDEV("p",{className:"text-lg",children:"No agents in this project"},void 0,!1,void 0,this),v1.jsxDEV("p",{className:"text-sm mt-1",children:"Create an agent or assign existing agents to this project"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):v1.jsxDEV(v1.Fragment,{children:[v1.jsxDEV("p",{className:"text-lg",children:"No agents yet"},void 0,!1,void 0,this),v1.jsxDEV("p",{className:"text-sm mt-1",children:"Create your first agent to get started"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&v1.jsxDEV("button",{onClick:G,disabled:!H,className:"mt-4 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var C4=n(e0(),1);var L0=n(C1(),1);function tJ({agents:G,loading:H,runningCount:_,configuredProviders:L,onNavigate:R,onSelectAgent:N}){let{authFetch:M}=c1(),{currentProjectId:U}=u4(),{events:I,statusChangeCounter:y}=qY(),[O,F]=C4.useState(null),[P,S]=C4.useState([]),[E,V]=C4.useState([]),g=C4.useMemo(()=>{if(!U)return G;if(U==="unassigned")return G.filter((c)=>!c.projectId);return G.filter((c)=>c.projectId===U)},[G,U]),i=C4.useMemo(()=>{return g.filter((c)=>c.status==="running").length},[g]),s=C4.useMemo(()=>{return new Set(g.map((c)=>c.id))},[g]),p=C4.useCallback(async()=>{try{let c=U?`project_id=${encodeURIComponent(U)}`:"",[v0,C,e]=await Promise.all([M(`/api/dashboard${c?`?${c}`:""}`),M(`/api/tasks?status=all${c?`&${c}`:""}`),M(`/api/telemetry/events?type=thread_activity&limit=20${c?`&${c}`:""}`)]);if(v0.ok){let l=await v0.json();F(l)}if(C.ok){let l=await C.json();S(l.tasks||[])}if(e.ok){let l=await e.json();V(l.events||[])}}catch(c){console.error("Failed to fetch dashboard data:",c)}},[M,U]);C4.useEffect(()=>{p()},[p,y]);let a=C4.useMemo(()=>{let c=U?P.filter((v0)=>s.has(v0.agentId)):P;return PM(c)},[P,U,s]),H0=C4.useMemo(()=>{if(!U)return O?.tasks||{total:0,pending:0,running:0,completed:0};let c=a.length,v0=a.filter((l)=>l.status==="pending").length,C=a.filter((l)=>l.status==="running").length,e=a.filter((l)=>l.status==="completed").length;return{total:c,pending:v0,running:C,completed:e}},[O,U,a]),d=C4.useMemo(()=>{let c=I.filter((l)=>l.type==="thread_activity"),v0=new Set(c.map((l)=>l.id)),C=[...c];for(let l of E)if(!v0.has(l.id))C.push(l),v0.add(l.id);let e=C;if(U)e=C.filter((l)=>s.has(l.agent_id));return e.sort((l,u)=>new Date(u.timestamp).getTime()-new Date(l.timestamp).getTime()),e.slice(0,8)},[I,E,U,s]),B0=C4.useMemo(()=>{let c=new Map;for(let v0 of G)c.set(v0.id,v0.name);return c},[G]);return L0.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[L0.jsxDEV("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 mb-6",children:[L0.jsxDEV(nJ,{label:"Agents",value:g.length,subValue:`${i} running`},void 0,!1,void 0,this),L0.jsxDEV(nJ,{label:"Tasks",value:H0.total,subValue:`${H0.pending} pending`},void 0,!1,void 0,this),L0.jsxDEV(nJ,{label:"Completed",value:H0.completed,color:"text-green-400"},void 0,!1,void 0,this),L0.jsxDEV(nJ,{label:"Providers",value:L.length,color:"text-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L0.jsxDEV("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[L0.jsxDEV(eH,{title:"Agents",actionLabel:"View All",onAction:()=>R("agents"),children:H?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this):g.length===0?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:"No agents yet"},void 0,!1,void 0,this):L0.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:g.slice(0,5).map((c)=>L0.jsxDEV(NM,{agent:c,onSelect:()=>N(c),showProject:!U},c.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),L0.jsxDEV(eH,{title:"Activity",actionLabel:"Telemetry",onAction:()=>R("telemetry"),children:d.length===0?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:[L0.jsxDEV("p",{children:"No activity yet"},void 0,!1,void 0,this),L0.jsxDEV("p",{className:"text-sm text-[#444] mt-1",children:"Agent activity will appear here in real-time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L0.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:d.map((c)=>L0.jsxDEV(wM,{activity:c.data?.activity||"Working...",agentName:B0.get(c.agent_id)||c.agent_id,timestamp:c.timestamp},c.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),L0.jsxDEV(eH,{title:"Tasks",actionLabel:"View All",onAction:()=>R("tasks"),children:a.length===0?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:[L0.jsxDEV("p",{children:"No tasks yet"},void 0,!1,void 0,this),L0.jsxDEV("p",{className:"text-sm text-[#444] mt-1",children:"Tasks will appear when agents create them"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L0.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:a.slice(0,5).map((c)=>L0.jsxDEV("div",{className:"px-4 py-3 flex items-center justify-between",children:[L0.jsxDEV("div",{className:"flex-1 min-w-0",children:[L0.jsxDEV("p",{className:"font-medium truncate",children:c.title},void 0,!1,void 0,this),L0.jsxDEV("p",{className:"text-sm text-[#666]",children:[c.agentName,c.recurrence&&L0.jsxDEV("span",{className:"ml-1 text-[#555]",children:["· ",AM(c.recurrence)]},void 0,!0,void 0,this),c.next_run&&L0.jsxDEV("span",{className:"ml-1 text-[#f97316]",children:["· ",j2(c.next_run)]},void 0,!0,void 0,this),!c.next_run&&c.execute_at&&L0.jsxDEV("span",{className:"ml-1 text-[#f97316]",children:["· ",j2(c.execute_at)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L0.jsxDEV(bM,{status:c.status},void 0,!1,void 0,this)]},`${c.agentId}-${c.id}`,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function nJ({label:G,value:H,subValue:_,color:L}){return L0.jsxDEV("div",{className:"bg-[#111] rounded p-4 border border-[#1a1a1a]",children:[L0.jsxDEV("p",{className:"text-sm text-[#666] mb-1",children:G},void 0,!1,void 0,this),L0.jsxDEV("p",{className:`text-2xl font-semibold ${L||""}`,children:H},void 0,!1,void 0,this),_&&L0.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function eH({title:G,actionLabel:H,onAction:_,children:L}){return L0.jsxDEV("div",{className:"bg-[#111] rounded border border-[#1a1a1a] overflow-hidden",children:[L0.jsxDEV("div",{className:"px-4 py-3 border-b border-[#1a1a1a] flex items-center justify-between",children:[L0.jsxDEV("h3",{className:"font-semibold",children:G},void 0,!1,void 0,this),L0.jsxDEV("button",{onClick:_,className:"text-sm text-[#3b82f6] hover:text-[#60a5fa]",children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L]},void 0,!0,void 0,this)}function NM({agent:G,onSelect:H,showProject:_}){let{isActive:L}=lJ(G.id),{projects:R}=u4(),N=G.projectId?R.find((M)=>M.id===G.projectId):null;return L0.jsxDEV("div",{onClick:H,className:"px-4 py-3 hover:bg-[#1a1a1a] cursor-pointer flex items-center justify-between",children:[L0.jsxDEV("div",{className:"flex-1 min-w-0",children:[L0.jsxDEV("p",{className:"font-medium",children:G.name},void 0,!1,void 0,this),L0.jsxDEV("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[L0.jsxDEV("span",{children:G.provider},void 0,!1,void 0,this),_&&N&&L0.jsxDEV(L0.Fragment,{children:[L0.jsxDEV("span",{className:"text-[#444]",children:"·"},void 0,!1,void 0,this),L0.jsxDEV("span",{className:"flex items-center gap-1",children:[L0.jsxDEV("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}},void 0,!1,void 0,this),N.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L0.jsxDEV("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${G.status==="running"?L?"bg-green-400 animate-pulse":"bg-[#3b82f6]":"bg-[#444]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MM(G){let H=Math.floor((Date.now()-new Date(G).getTime())/1000);if(H<5)return"just now";if(H<60)return`${H}s ago`;let _=Math.floor(H/60);if(_<60)return`${_}m ago`;let L=Math.floor(_/60);if(L<24)return`${L}h ago`;return`${Math.floor(L/24)}d ago`}function wM({activity:G,agentName:H,timestamp:_}){return L0.jsxDEV("div",{className:"px-4 py-3",children:[L0.jsxDEV("p",{className:"text-sm truncate",children:G},void 0,!1,void 0,this),L0.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#555] mt-1",children:[L0.jsxDEV("span",{className:"text-[#666]",children:H},void 0,!1,void 0,this),L0.jsxDEV("span",{className:"text-[#444]",children:"·"},void 0,!1,void 0,this),L0.jsxDEV("span",{children:MM(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function bM({status:G}){let H={pending:"bg-yellow-500/20 text-yellow-400",running:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",failed:"bg-red-500/20 text-red-400",cancelled:"bg-gray-500/20 text-gray-400"};return L0.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${H[G]||H.pending}`,children:G},void 0,!1,void 0,this)}function p2(G){if(G.status==="running")return 0;if(G.status==="pending")return 1;if(G.status==="completed")return 2;if(G.status==="failed")return 3;return 4}function PM(G){return[...G].sort((H,_)=>{let L=p2(H),R=p2(_);if(L!==R)return L-R;if(L<=1){let U=H.next_run||H.execute_at||null,I=_.next_run||_.execute_at||null,y=U?new Date(U).getTime():1/0,O=I?new Date(I).getTime():1/0;return y-O}let N=H.completed_at||H.executed_at||H.created_at,M=_.completed_at||_.executed_at||_.created_at;return new Date(M).getTime()-new Date(N).getTime()})}var g2=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function AM(G){try{let H=G.trim().split(/\s+/);if(H.length!==5)return G;let[_,L,R,N,M]=H;if(_.startsWith("*/")&&L==="*"&&R==="*"&&N==="*"&&M==="*"){let I=parseInt(_.slice(2));return I===1?"Every min":`Every ${I}min`}if(_!=="*"&&!_.includes("/")&&L==="*"&&R==="*"&&N==="*"&&M==="*")return"Hourly";if(L.startsWith("*/")&&R==="*"&&N==="*"&&M==="*"){let I=parseInt(L.slice(2));return I===1?"Hourly":`Every ${I}h`}let U=(I,y)=>{let O=parseInt(I),F=parseInt(y);if(isNaN(O))return"";let P=O>=12?"PM":"AM";return`${O===0?12:O>12?O-12:O}:${F.toString().padStart(2,"0")} ${P}`};if(L!=="*"&&!L.includes("/")&&R==="*"&&N==="*"){let I=U(L,_);if(M==="*")return`Daily ${I}`;let y=M.split(",").map((O)=>g2[parseInt(O.trim())]||O);if(y.length===1)return`${y[0]} ${I}`;return`${y.join(" & ")} ${I}`}return G}catch{return G}}function j2(G){let H=new Date(G),_=new Date,L=H.getTime()-_.getTime(),R=L>0,N=Math.abs(L),M=Math.floor(N/60000),U=Math.floor(N/3600000),I=H.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),y=H.toDateString()===_.toDateString(),O=new Date(_);O.setDate(O.getDate()+1);let F=H.toDateString()===O.toDateString();if(y){if(M<1)return"now";if(M<60)return R?`in ${M}m`:`${M}m ago`;return R?`in ${U}h`:`${U}h ago`}if(F)return`Tomorrow ${I}`;return`${g2[H.getDay()]} ${I}`}var Q1=n(C1(),1),kM=D1.lazy(()=>import("./SettingsPage.5k6vp396.js").then((G)=>({default:G.SettingsPage}))),yM=D1.lazy(()=>import("./ActivityPage.41nbye4r.js").then((G)=>({default:G.ActivityPage}))),VM=D1.lazy(()=>import("./TasksPage.sjv0khtv.js").then((G)=>({default:G.TasksPage}))),CM=D1.lazy(()=>import("./McpPage.y396h6fy.js").then((G)=>({default:G.McpPage}))),SM=D1.lazy(()=>import("./SkillsPage.yj3xdsay.js").then((G)=>({default:G.SkillsPage}))),DM=D1.lazy(()=>import("./TestsPage.zzs4qfj8.js").then((G)=>({default:G.TestsPage}))),EM=D1.lazy(()=>import("./TelemetryPage.2qm4w16r.js").then((G)=>({default:G.TelemetryPage}))),fM=D1.lazy(()=>import("./ConnectionsPage.anb3rv9a.js").then((G)=>({default:G.ConnectionsPage}))),mM=D1.lazy(()=>import("./ApiDocsPage.4smnt8m3.js").then((G)=>({default:G.ApiDocsPage})));function hM(){let{isAuthenticated:G,isLoading:H,hasUsers:_,accessToken:L,checkAuth:R}=c1(),{currentProjectId:N,refreshProjects:M}=u4(),U=yJ(),I=u2(),{isComplete:y,setIsComplete:O}=fH(),F=()=>{return L?{Authorization:`Bearer ${L}`}:{}},P=G&&y===!0,{agents:S,loading:E,runningCount:V,fetchAgents:g,createAgent:i,updateAgent:s,deleteAgent:p,toggleAgent:a}=DH(P,N),{providers:H0,configuredProviders:d,fetchProviders:B0}=EH(P),c=d.filter((o)=>o.type==="llm"),v0=D1.useMemo(()=>{if(N===null)return S.length;if(N==="unassigned")return S.filter((o)=>!o.projectId).length;return S.filter((o)=>o.projectId===N).length},[S,N]),[C,e]=D1.useState(!1),[l,u]=D1.useState(null),[q0,t]=D1.useState("dashboard"),[Z0,K0]=D1.useState(null),[h0,f0]=D1.useState(0),[m,Q0]=D1.useState(!1);D1.useEffect(()=>{if(!P)return;(async()=>{try{let n1="/api/tasks?status=pending";if(N!==null)n1+=`&project_id=${encodeURIComponent(N)}`;let d1=await fetch(n1,{headers:F()});if(d1.ok){let U4=await d1.json();f0(U4.count??(U4.tasks||[]).length)}}catch{}})()},[P,L,N,S,U,I]);let[k0,D0]=D1.useState({name:"",model:"",provider:"",systemPrompt:"You are a helpful assistant.",features:{...SH},mcpServers:[],skills:[]});D1.useEffect(()=>{if(c.length>0&&!k0.provider){let o=c[0],n1=o.models.find((d1)=>d1.recommended)?.value||o.models[0]?.value||"";D0((d1)=>({...d1,provider:o.id,model:n1}))}},[c,k0.provider]),D1.useEffect(()=>{if(l){let o=S.find((n1)=>n1.id===l.id);if(o)u(o);else u(null)}},[S,l]);let r0=(o)=>{let n1=H0.find((U4)=>U4.id===o),d1=n1?.models.find((U4)=>U4.recommended)?.value||n1?.models[0]?.value||"";D0((U4)=>({...U4,provider:o,model:d1}))},G4=async()=>{if(!k0.name)return;await i(k0),await M();let o=c[0],n1=o?.models.find((d1)=>d1.recommended)?.value||o?.models[0]?.value||"";D0({name:"",model:n1,provider:o?.id||"",systemPrompt:"You are a helpful assistant.",features:{...SH},mcpServers:[],skills:[]}),e(!1)},f=async(o,n1)=>{n1?.stopPropagation(),K0(null);let d1=await a(o);if(d1.error)K0(d1.error)},Y0=async(o,n1)=>{if(n1?.stopPropagation(),l?.id===o)u(null);await p(o),await M()},i0=(o)=>{u(o),K0(null),t("agents")},U1=(o)=>{t(o),u(null)},O6=()=>{O(!0),B0(),R()};if(H||_===null)return Q1.jsxDEV(tz,{fullScreen:!0},void 0,!1,void 0,this);if(!_)return Q1.jsxDEV(_Y,{onComplete:O6,needsAccount:!0},void 0,!1,void 0,this);if(!G)return Q1.jsxDEV(gJ,{},void 0,!1,void 0,this);if(y===null)return Q1.jsxDEV(tz,{fullScreen:!0},void 0,!1,void 0,this);if(!y)return Q1.jsxDEV(_Y,{onComplete:O6,needsAccount:!1},void 0,!1,void 0,this);return Q1.jsxDEV("div",{className:"h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex flex-col overflow-hidden",children:[Q1.jsxDEV(fJ,{onMenuClick:()=>Q0(!0),agents:S},void 0,!1,void 0,this),Z0&&Q1.jsxDEV(jJ,{message:Z0,onDismiss:()=>K0(null)},void 0,!1,void 0,this),Q1.jsxDEV("div",{className:"flex flex-1 overflow-hidden",children:[Q1.jsxDEV(pJ,{route:q0,agentCount:v0,taskCount:h0,onNavigate:U1,isOpen:m,onClose:()=>Q0(!1)},void 0,!1,void 0,this),Q1.jsxDEV("main",{className:"flex-1 overflow-hidden flex",children:Q1.jsxDEV(D1.Suspense,{fallback:Q1.jsxDEV(tz,{},void 0,!1,void 0,this),children:[q0==="settings"&&Q1.jsxDEV(kM,{},void 0,!1,void 0,this),q0==="activity"&&Q1.jsxDEV(yM,{agents:S,loading:E,onNavigate:t},void 0,!1,void 0,this),q0==="agents"&&Q1.jsxDEV(rJ,{agents:S,loading:E,selectedAgent:l,providers:H0,onSelectAgent:i0,onCloseAgent:()=>u(null),onToggleAgent:f,onDeleteAgent:Y0,onUpdateAgent:s,onNewAgent:()=>e(!0),canCreateAgent:c.length>0},void 0,!1,void 0,this),q0==="dashboard"&&Q1.jsxDEV(tJ,{agents:S,loading:E,runningCount:V,configuredProviders:d,onNavigate:U1,onSelectAgent:i0},void 0,!1,void 0,this),q0==="tasks"&&Q1.jsxDEV(VM,{},void 0,!1,void 0,this),q0==="connections"&&Q1.jsxDEV(fM,{},void 0,!1,void 0,this),q0==="mcp"&&Q1.jsxDEV(CM,{},void 0,!1,void 0,this),q0==="skills"&&Q1.jsxDEV(SM,{},void 0,!1,void 0,this),q0==="tests"&&Q1.jsxDEV(DM,{},void 0,!1,void 0,this),q0==="telemetry"&&Q1.jsxDEV(EM,{},void 0,!1,void 0,this),q0==="api"&&Q1.jsxDEV(mM,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&Q1.jsxDEV(aJ,{form:k0,providers:H0,configuredProviders:d,onFormChange:D0,onProviderChange:r0,onCreate:G4,onClose:()=>e(!1),onGoToSettings:()=>{e(!1),t("settings")}},void 0,!1,void 0,this),Q1.jsxDEV(M2,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pM(){return Q1.jsxDEV(l2,{children:Q1.jsxDEV(c2,{children:Q1.jsxDEV(F2,{children:Q1.jsxDEV(x2,{children:Q1.jsxDEV(hM,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var jM=d2.createRoot(document.getElementById("root"));jM.render(Q1.jsxDEV(pM,{},void 0,!1,void 0,this));
265
+ `,children:[S0.jsxDEV("div",{className:"flex items-center justify-between mb-4 md:hidden",children:[S0.jsxDEV("div",{className:"flex items-center gap-2",children:[S0.jsxDEV("span",{className:"text-[#f97316]",children:">_"},void 0,!1,void 0,this),S0.jsxDEV("span",{className:"text-lg tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S0.jsxDEV("button",{onClick:N,className:"p-2 text-[#666] hover:text-[#e0e0e0] transition",children:S0.jsxDEV(nz,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S0.jsxDEV("nav",{className:"space-y-1 flex-1",children:[S0.jsxDEV(o6,{icon:S0.jsxDEV(oH,{},void 0,!1,void 0,this),label:"Dashboard",active:G==="dashboard",onClick:()=>O("dashboard")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(rH,{},void 0,!1,void 0,this),label:"Agents",active:G==="agents",onClick:()=>O("agents"),badge:H>0?String(H):void 0},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(hJ,{},void 0,!1,void 0,this),label:"Activity",active:G==="activity",onClick:()=>O("activity")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(k7,{},void 0,!1,void 0,this),label:"Tasks",active:G==="tasks",onClick:()=>O("tasks"),badge:_&&_>0?String(_):void 0},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(Q8,{},void 0,!1,void 0,this),label:"MCP",active:G==="mcp",onClick:()=>O("mcp")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(mJ,{},void 0,!1,void 0,this),label:"Skills",active:G==="skills",onClick:()=>O("skills")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(V2,{},void 0,!1,void 0,this),label:"Connections",active:G==="connections",onClick:()=>O("connections")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(y2,{},void 0,!1,void 0,this),label:"Tests",active:G==="tests",onClick:()=>O("tests")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(I2,{},void 0,!1,void 0,this),label:"Telemetry",active:G==="telemetry",onClick:()=>O("telemetry")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(k2,{},void 0,!1,void 0,this),label:"API",active:G==="api",onClick:()=>O("api")},void 0,!1,void 0,this),S0.jsxDEV(o6,{icon:S0.jsxDEV(nH,{},void 0,!1,void 0,this),label:"Settings",active:G==="settings",onClick:()=>O("settings")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&S0.jsxDEV("div",{className:"relative border-t border-[#1a1a1a] pt-3 mt-3",children:[S0.jsxDEV("button",{onClick:()=>y(!I),className:"w-full flex items-center gap-3 px-3 py-2 rounded hover:bg-[#111] transition",children:[S0.jsxDEV("div",{className:"w-8 h-8 rounded-full bg-[#f97316] flex items-center justify-center text-black font-medium text-sm flex-shrink-0",children:M.username.charAt(0).toUpperCase()},void 0,!1,void 0,this),S0.jsxDEV("div",{className:"flex-1 min-w-0 text-left",children:[S0.jsxDEV("p",{className:"text-sm font-medium truncate",children:M.username},void 0,!1,void 0,this),S0.jsxDEV("p",{className:"text-xs text-[#555]",children:M.role},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I&&S0.jsxDEV(S0.Fragment,{children:[S0.jsxDEV("div",{className:"fixed inset-0 z-40",onClick:()=>y(!1)},void 0,!1,void 0,this),S0.jsxDEV("div",{className:"absolute left-3 bottom-full mb-1 w-48 bg-[#111] border border-[#222] rounded-lg shadow-xl z-50",children:S0.jsxDEV("button",{onClick:F,className:"w-full px-4 py-2.5 text-left text-sm text-red-400 hover:bg-[#1a1a1a] transition rounded-lg",children:"Sign out"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function o6({icon:G,label:H,active:_,onClick:L,badge:R}){return S0.jsxDEV("button",{onClick:L,className:`w-full flex items-center gap-3 px-3 py-2 rounded font-medium transition ${_?"bg-[#111] text-[#e0e0e0]":"text-[#666] hover:bg-[#111] hover:text-[#888]"}`,children:[G,H,R&&S0.jsxDEV("span",{className:"ml-auto bg-[#333] text-[#888] text-xs px-2 py-0.5 rounded-full",children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var HY=n(C1(),1);function jJ({message:G,onDismiss:H}){return HY.jsxDEV("div",{className:"bg-red-500/10 border-b border-red-500/30 px-6 py-3 text-red-400 text-sm flex items-center justify-between",children:[HY.jsxDEV("span",{children:G},void 0,!1,void 0,this),HY.jsxDEV("button",{onClick:H,className:"hover:text-red-300",children:HY.jsxDEV(nz,{className:"w-4 h-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var KY=n(e0(),1);var Q4=n(C1(),1);function gJ(){let{login:G}=c1(),[H,_]=KY.useState(""),[L,R]=KY.useState(""),[N,M]=KY.useState(null),[U,I]=KY.useState(!1);return Q4.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center p-8",children:Q4.jsxDEV("div",{className:"w-full max-w-md",children:[Q4.jsxDEV("div",{className:"text-center mb-8",children:[Q4.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-2",children:[Q4.jsxDEV("span",{className:"text-[#f97316] text-3xl",children:">_"},void 0,!1,void 0,this),Q4.jsxDEV("span",{className:"text-3xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q4.jsxDEV("p",{className:"text-[#666]",children:"Run AI agents locally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q4.jsxDEV("div",{className:"bg-[#111] rounded-lg border border-[#1a1a1a] p-8",children:[Q4.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Welcome back"},void 0,!1,void 0,this),Q4.jsxDEV("p",{className:"text-[#666] mb-6",children:"Sign in to continue to apteva"},void 0,!1,void 0,this),Q4.jsxDEV("form",{onSubmit:async(O)=>{O.preventDefault(),M(null),I(!0);let F=await G(H,L);if(!F.success)M(F.error||"Login failed");I(!1)},className:"space-y-4",children:[Q4.jsxDEV("div",{children:[Q4.jsxDEV("label",{htmlFor:"username",className:"block text-sm text-[#888] mb-1",children:"Username"},void 0,!1,void 0,this),Q4.jsxDEV("input",{id:"username",type:"text",value:H,onChange:(O)=>_(O.target.value),placeholder:"Enter your username",autoFocus:!0,required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q4.jsxDEV("div",{children:[Q4.jsxDEV("label",{htmlFor:"password",className:"block text-sm text-[#888] mb-1",children:"Password"},void 0,!1,void 0,this),Q4.jsxDEV("input",{id:"password",type:"password",value:L,onChange:(O)=>R(O.target.value),placeholder:"Enter your password",required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N&&Q4.jsxDEV("div",{className:"p-3 bg-red-500/10 border border-red-500/30 rounded text-red-400 text-sm",children:N},void 0,!1,void 0,this),Q4.jsxDEV("button",{type:"submit",disabled:U||!H||!L,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:U?"Signing in...":"Sign In"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Jz=n(e0(),1),A1=n(C1(),1);function xJ({onComplete:G}){let[H,_]=Jz.useState(""),[L,R]=Jz.useState(""),[N,M]=Jz.useState(""),[U,I]=Jz.useState(""),[y,O]=Jz.useState(!1),[F,P]=Jz.useState(null),[S,E]=Jz.useState(!1);return A1.jsxDEV(A1.Fragment,{children:[A1.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Create your account"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-[#666] mb-6",children:"Set up your admin account to get started with apteva."},void 0,!1,void 0,this),A1.jsxDEV("form",{onSubmit:async(g)=>{if(g.preventDefault(),P(null),L!==N){P("Passwords do not match");return}E(!0);try{let i=await fetch("/api/onboarding/user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:H,password:L,...U&&{email:U}})}),s=await i.json();if(!i.ok){P(s.error||"Failed to create account"),E(!1);return}let p=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:H,password:L})});if(!p.ok){P("Account created but login failed. Please try logging in."),E(!1);return}let a=await p.json();if(a.accessToken)sessionStorage.setItem("accessToken",a.accessToken);G({username:H})}catch(i){P("Failed to create account"),E(!1)}},className:"space-y-4",children:[A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"username",className:"block text-sm text-[#888] mb-1",children:"Username"},void 0,!1,void 0,this),A1.jsxDEV("input",{id:"username",type:"text",value:H,onChange:(g)=>_(g.target.value),placeholder:"Choose a username",autoFocus:!0,required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:"3-20 characters, letters, numbers, underscore"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"password",className:"block text-sm text-[#888] mb-1",children:"Password"},void 0,!1,void 0,this),A1.jsxDEV("input",{id:"password",type:"password",value:L,onChange:(g)=>R(g.target.value),placeholder:"Enter a password",required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:"Min 8 characters, uppercase, lowercase, number"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"confirmPassword",className:"block text-sm text-[#888] mb-1",children:"Confirm Password"},void 0,!1,void 0,this),A1.jsxDEV("input",{id:"confirmPassword",type:"password",value:N,onChange:(g)=>M(g.target.value),placeholder:"Confirm your password",required:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!y?A1.jsxDEV("button",{type:"button",onClick:()=>O(!0),className:"text-sm text-[#666] hover:text-[#888] transition",children:"+ Add email for password recovery (optional)"},void 0,!1,void 0,this):A1.jsxDEV("div",{children:[A1.jsxDEV("label",{htmlFor:"email",className:"block text-sm text-[#888] mb-1",children:["Email ",A1.jsxDEV("span",{className:"text-[#666]",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("input",{id:"email",type:"email",value:U,onChange:(g)=>I(g.target.value),placeholder:"For password recovery only",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:"Only used for password recovery, never shared"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F&&A1.jsxDEV("div",{className:"p-3 bg-red-500/10 border border-red-500/30 rounded text-red-400 text-sm",children:F},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"submit",disabled:S||!H||!L||!N,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:S?"Creating account...":"Create Account"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("p",{className:"text-xs text-[#666] mt-4 text-center",children:"This will be your admin account with full access to apteva."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var V6=n(e0(),1);var _0=n(C1(),1);function _Y({onComplete:G,needsAccount:H=!1}){let[_,L]=V6.useState(H?0:1),[R,N]=V6.useState([]),[M,U]=V6.useState(null),[I,y]=V6.useState(""),[O,F]=V6.useState(!1),[P,S]=V6.useState(!1),[E,V]=V6.useState(null),[g,i]=V6.useState(null),[s,p]=V6.useState(!1),a=()=>{let e=sessionStorage.getItem("accessToken");return e?{Authorization:`Bearer ${e}`}:{}};V6.useEffect(()=>{if(H&&!s&&_===0)return;fetch("/api/providers",{headers:a()}).then((e)=>e.json()).then((e)=>{let l=(e.providers||[]).filter((u)=>u.type==="llm");N(l)})},[s,_,H]);let H0=R.filter((e)=>e.hasKey),d=async()=>{if(!M||!I)return;F(!0),V(null),i(null);try{S(!0);let l=await(await fetch(`/api/keys/${M}/test`,{method:"POST",headers:{"Content-Type":"application/json",...a()},body:JSON.stringify({key:I})})).json();if(S(!1),!l.valid){V(l.error||"API key is invalid"),F(!1);return}let u=await fetch(`/api/keys/${M}`,{method:"POST",headers:{"Content-Type":"application/json",...a()},body:JSON.stringify({key:I})}),q0=await u.json();if(!u.ok)V(q0.error||"Failed to save key");else{i("API key saved successfully!"),y("");let Z0=await(await fetch("/api/providers",{headers:a()})).json();N(Z0.providers||[]),U(null)}}catch(e){V("Failed to save key")}F(!1)},B0=async()=>{try{let e=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json",...a()},body:JSON.stringify({name:"My Project",description:"Default project for organizing agents",color:"#f97316"})});if(e.ok){let l=await e.json();if(l.project?.id)localStorage.setItem("apteva_current_project",l.project.id)}}catch(e){console.error("Failed to create default project:",e)}await fetch("/api/onboarding/complete",{method:"POST",headers:a()}),G()},c=()=>{p(!0),L(1)},v0=H?3:2,C=H?_:_-1;return _0.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center p-8",children:_0.jsxDEV("div",{className:"w-full max-w-2xl",children:[_0.jsxDEV("div",{className:"text-center mb-8",children:[_0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-2",children:[_0.jsxDEV("span",{className:"text-[#f97316] text-3xl",children:">_"},void 0,!1,void 0,this),_0.jsxDEV("span",{className:"text-3xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("p",{className:"text-[#666]",children:"Run AI agents locally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-8",children:[H&&_0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${_>=0?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),_0.jsxDEV("div",{className:`w-16 h-0.5 ${_>=1?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${_>=1?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),_0.jsxDEV("div",{className:`w-16 h-0.5 ${_>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),_0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${_>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"bg-[#111] rounded-lg border border-[#1a1a1a] p-8",children:[_===0&&H&&_0.jsxDEV(xJ,{onComplete:c},void 0,!1,void 0,this),_===1&&_0.jsxDEV(YM,{providers:R,configuredProviders:H0,selectedProvider:M,apiKey:I,saving:O,testing:P,error:E,success:g,onSelectProvider:U,onApiKeyChange:y,onSaveKey:d,onContinue:()=>L(2)},void 0,!1,void 0,this),_===2&&_0.jsxDEV(JM,{configuredProviders:H0,onAddMore:()=>L(1),onComplete:B0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function YM({providers:G,configuredProviders:H,selectedProvider:_,apiKey:L,saving:R,testing:N,error:M,success:U,onSelectProvider:I,onApiKeyChange:y,onSaveKey:O,onContinue:F}){let P=G.find((S)=>S.id===_);if(_&&P)return _0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:["Add ",P.name," Key"]},void 0,!0,void 0,this),_0.jsxDEV("p",{className:"text-[#666] mb-6",children:"Enter your API key below. It will be encrypted and stored locally."},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"mb-6",children:[_0.jsxDEV("div",{className:"p-4 rounded border border-[#f97316] bg-[#f97316]/5 mb-4",children:_0.jsxDEV("div",{className:"flex items-center justify-between",children:[_0.jsxDEV("div",{children:[_0.jsxDEV("p",{className:"font-medium",children:P.name},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-sm text-[#666]",children:[P.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("a",{href:P.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"space-y-3",children:[_0.jsxDEV("input",{type:"password",value:L,onChange:(S)=>y(S.target.value),placeholder:"Enter your API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316] text-lg"},void 0,!1,void 0,this),M&&_0.jsxDEV("p",{className:"text-red-400 text-sm",children:M},void 0,!1,void 0,this),U&&_0.jsxDEV("p",{className:"text-green-400 text-sm",children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"flex gap-3",children:[_0.jsxDEV("button",{onClick:()=>{I(null),y("")},className:"flex-1 border border-[#333] hover:border-[#666] px-4 py-3 rounded font-medium transition",children:"Back"},void 0,!1,void 0,this),_0.jsxDEV("button",{onClick:O,disabled:!L||R,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:N?"Testing...":R?"Saving...":"Save API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return _0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Welcome to apteva"},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-[#666] mb-6",children:"To get started, you'll need to add at least one AI provider API key. Your keys are encrypted and stored locally."},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"space-y-3 mb-6",children:G.map((S)=>_0.jsxDEV(ZM,{provider:S,selected:!1,onSelect:()=>!S.hasKey&&I(S.id)},S.id,!1,void 0,this))},void 0,!1,void 0,this),_0.jsxDEV("button",{onClick:F,disabled:H.length===0,className:"w-full bg-[#222] hover:bg-[#333] disabled:opacity-50 disabled:cursor-not-allowed px-4 py-3 rounded font-medium transition",children:H.length===0?"Add at least one API key to continue":`Continue with ${H.length} provider${H.length>1?"s":""}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZM({provider:G,selected:H,onSelect:_}){return _0.jsxDEV("div",{onClick:_,className:`p-4 rounded border transition cursor-pointer ${G.hasKey?"border-green-500/30 bg-green-500/5":H?"border-[#f97316] bg-[#f97316]/5":"border-[#222] hover:border-[#333]"}`,children:_0.jsxDEV("div",{className:"flex items-center justify-between",children:[_0.jsxDEV("div",{children:[_0.jsxDEV("p",{className:"font-medium",children:G.name},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-sm text-[#666]",children:[G.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.hasKey?_0.jsxDEV("span",{className:"text-green-400 text-sm flex items-center gap-1",children:[_0.jsxDEV(uJ,{},void 0,!1,void 0,this),"Configured (",G.keyHint,")"]},void 0,!0,void 0,this):_0.jsxDEV("a",{href:G.docsUrl,target:"_blank",rel:"noopener noreferrer",onClick:(L)=>L.stopPropagation(),className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function JM({configuredProviders:G,onAddMore:H,onComplete:_}){return _0.jsxDEV(_0.Fragment,{children:[_0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"You're all set!"},void 0,!1,void 0,this),_0.jsxDEV("p",{className:"text-[#666] mb-6",children:["You've configured ",G.length," provider",G.length>1?"s":"",". You can add more providers later in Settings."]},void 0,!0,void 0,this),_0.jsxDEV("div",{className:"space-y-2 mb-6",children:G.map((L)=>_0.jsxDEV("div",{className:"flex items-center gap-3 p-3 bg-[#0a0a0a] rounded",children:[_0.jsxDEV(uJ,{className:"w-5 h-5 text-green-400"},void 0,!1,void 0,this),_0.jsxDEV("span",{children:L.name},void 0,!1,void 0,this),_0.jsxDEV("span",{className:"text-[#666] text-sm",children:["(",L.keyHint,")"]},void 0,!0,void 0,this)]},L.id,!0,void 0,this))},void 0,!1,void 0,this),_0.jsxDEV("div",{className:"flex gap-3",children:[_0.jsxDEV("button",{onClick:H,className:"flex-1 border border-[#333] hover:border-[#f97316] px-4 py-3 rounded font-medium transition",children:"Add More"},void 0,!1,void 0,this),_0.jsxDEV("button",{onClick:_,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-3 rounded font-medium transition",children:"Start Using apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var cJ=n(e0(),1);var S1=n(C1(),1),GM=[{key:"memory",icon:KX,label:"Memory"},{key:"tasks",icon:k7,label:"Tasks"},{key:"files",icon:OX,label:"Files"},{key:"vision",icon:_X,label:"Vision"},{key:"operator",icon:BX,label:"Operator"},{key:"mcp",icon:Q8,label:"MCP"},{key:"realtime",icon:UX,label:"Realtime"},{key:"agents",icon:LX,label:"Multi-Agent"}];function dJ({agent:G,selected:H,onSelect:_,onToggle:L,showProject:R}){let N=GM.filter((V)=>G.features?.[V.key]),M=G.mcpServerDetails||[],U=G.skillDetails||[],{isActive:I,label:y}=lJ(G.id),{projects:O}=u4(),{authFetch:F}=c1(),P=G.projectId?O.find((V)=>V.id===G.projectId):null,[S,E]=cJ.useState([]);return cJ.useEffect(()=>{F(`/api/subscriptions?agent_id=${G.id}`).then((V)=>V.ok?V.json():{subscriptions:[]}).then((V)=>E(V.subscriptions||[])).catch(()=>{})},[G.id,F]),S1.jsxDEV("div",{onClick:_,className:`bg-[#111] rounded p-5 border transition cursor-pointer flex flex-col h-full ${H?"border-[#f97316]":"border-[#1a1a1a] hover:border-[#333]"}`,children:[S1.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[S1.jsxDEV("div",{children:[S1.jsxDEV("h3",{className:"font-semibold text-lg",children:G.name},void 0,!1,void 0,this),S1.jsxDEV("p",{className:"text-sm text-[#666]",children:[G.provider," / ",G.model,G.port&&S1.jsxDEV("span",{className:"text-[#444]",children:[" · :",G.port]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R&&P&&S1.jsxDEV("p",{className:"text-sm text-[#666] flex items-center gap-1.5 mt-1",children:[S1.jsxDEV("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:P.color}},void 0,!1,void 0,this),P.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),S1.jsxDEV(qM,{status:G.status,isActive:I&&G.status==="running",activityLabel:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:N.map(({key:V,icon:g,label:i})=>S1.jsxDEV("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-[#f97316]/10 text-[#f97316]/70 text-xs",title:i,children:[S1.jsxDEV(g,{className:"w-3 h-3"},void 0,!1,void 0,this),i]},V,!0,void 0,this))},void 0,!1,void 0,this),M.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:M.map((V)=>{let g=V.type==="http"&&V.url||V.status==="running";return S1.jsxDEV("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs ${g?"bg-green-500/10 text-green-400":"bg-[#222] text-[#666]"}`,title:`MCP: ${V.name} (${g?"available":V.status})`,children:[S1.jsxDEV(Q8,{className:"w-3 h-3"},void 0,!1,void 0,this),V.name]},V.id,!0,void 0,this)})},void 0,!1,void 0,this),U.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:U.map((V)=>S1.jsxDEV("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs ${V.enabled?"bg-purple-500/10 text-purple-400":"bg-[#222] text-[#666]"}`,title:`Skill: ${V.name} v${V.version}`,children:[S1.jsxDEV(mJ,{className:"w-3 h-3"},void 0,!1,void 0,this),V.name]},V.id,!0,void 0,this))},void 0,!1,void 0,this),S.length>0&&S1.jsxDEV("div",{className:"flex flex-wrap gap-1.5 mb-3",children:S.map((V)=>S1.jsxDEV("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs ${V.enabled?"bg-cyan-500/10 text-cyan-400":"bg-[#222] text-[#666]"}`,title:`Trigger: ${V.trigger_slug.replace(/_/g," ")}`,children:[S1.jsxDEV(hJ,{className:"w-3 h-3"},void 0,!1,void 0,this),V.trigger_slug.replace(/_/g," ")]},V.id,!0,void 0,this))},void 0,!1,void 0,this),S1.jsxDEV("p",{className:"text-sm text-[#666] line-clamp-2 mb-4 flex-1",children:G.systemPrompt},void 0,!1,void 0,this),S1.jsxDEV("button",{onClick:L,disabled:G.status==="starting"||G.status==="stopping",className:`w-full px-3 py-1.5 rounded text-sm font-medium transition mt-auto ${G.status==="starting"||G.status==="stopping"?"bg-[#333] text-[#666] cursor-wait":G.status==="running"?"bg-[#f97316]/20 text-[#f97316] hover:bg-[#f97316]/30":"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30"}`,children:G.status==="starting"?"Starting...":G.status==="stopping"?"Stopping...":G.status==="running"?"Stop":"Start"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qM({status:G,isActive:H,activityLabel:_}){if(G==="running"&&H&&_)return S1.jsxDEV("span",{className:"px-2 py-1 rounded text-xs font-medium bg-green-500/20 text-green-400 animate-pulse",children:_},void 0,!1,void 0,this);return S1.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ${G==="starting"||G==="stopping"?"bg-yellow-500/20 text-yellow-400 animate-pulse":G==="running"?"bg-[#3b82f6]/20 text-[#3b82f6]":"bg-[#333] text-[#666]"}`,children:G},void 0,!1,void 0,this)}var BY=n(e0(),1);var w0=n(C1(),1),HM=[{key:"memory",label:"Memory",description:"Persistent recall",icon:KX},{key:"tasks",label:"Tasks",description:"Schedule and execute tasks",icon:k7},{key:"files",label:"Files",description:"File storage and management",icon:OX},{key:"vision",label:"Vision",description:"Process images and PDFs",icon:_X},{key:"operator",label:"Operator",description:"Browser automation",icon:BX},{key:"mcp",label:"MCP",description:"External tools/services",icon:Q8},{key:"realtime",label:"Realtime",description:"Voice conversations",icon:UX},{key:"agents",label:"Multi-Agent",description:"Communicate with peer agents",icon:LX}];function aJ({form:G,providers:H,configuredProviders:_,onFormChange:L,onProviderChange:R,onCreate:N,onClose:M,onGoToSettings:U}){let{projects:I,currentProjectId:y}=u4(),O=H.find((d)=>d.id===G.provider),[F,P]=BY.default.useState([]),[S,E]=BY.default.useState(!1);BY.default.useEffect(()=>{if(G.provider==="ollama")E(!0),fetch("/api/providers/ollama/models").then((d)=>d.json()).then((d)=>{if(d.models&&d.models.length>0){if(P(d.models.map((B0)=>({value:B0.value,label:B0.label||B0.value}))),!G.model&&d.models.length>0)L({...G,model:d.models[0].value})}}).catch(()=>P([])).finally(()=>E(!1))},[G.provider]);let V=_.filter((d)=>d.type==="llm").map((d)=>({value:d.id,label:d.name})),g=G.provider==="ollama"&&F.length>0?F:O?.models.map((d)=>({value:d.value,label:d.label,recommended:d.recommended}))||[],i=I.map((d)=>({value:d.id,label:d.name}));BY.default.useEffect(()=>{if(G.projectId===void 0&&y&&y!=="unassigned")L({...G,projectId:y})},[y]);let s=(d)=>{if(d==="agents")if(typeof G.features.agents==="boolean"?G.features.agents:G.features.agents?.enabled??!1)L({...G,features:{...G.features,agents:!1}});else L({...G,features:{...G.features,agents:{enabled:!0,mode:"worker",group:G.projectId||void 0}}});else L({...G,features:{...G.features,[d]:!G.features[d]}})},p=()=>{let d=G.features.agents;if(typeof d==="boolean")return d;return d?.enabled??!1},a=()=>{return YX(G.features,G.projectId).mode||"worker"},H0=(d)=>{let B0=YX(G.features,G.projectId);L({...G,features:{...G.features,agents:{...B0,enabled:!0,mode:d}}})};return w0.jsxDEV(tH,{children:[w0.jsxDEV("h2",{className:"text-xl font-semibold mb-4",children:"Create New Agent"},void 0,!1,void 0,this),V.length===0?w0.jsxDEV(KM,{onGoToSettings:U},void 0,!1,void 0,this):w0.jsxDEV(w0.Fragment,{children:[w0.jsxDEV("div",{className:"space-y-4",children:[w0.jsxDEV(Qz,{label:"Name",children:w0.jsxDEV("input",{type:"text",value:G.name,onChange:(d)=>L({...G,name:d.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] text-[#e0e0e0]",placeholder:"My Agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),I.length>0&&w0.jsxDEV(Qz,{label:"Project",children:w0.jsxDEV(G8,{value:G.projectId||"",options:i,onChange:(d)=>L({...G,projectId:d||null}),placeholder:"Select project..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"Provider",children:w0.jsxDEV(G8,{value:G.provider,options:V,onChange:R,placeholder:"Select provider..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"Model",children:S?w0.jsxDEV("div",{className:"text-sm text-[#666] py-2",children:"Loading Ollama models..."},void 0,!1,void 0,this):G.provider==="ollama"&&g.length===0?w0.jsxDEV("div",{className:"text-sm text-yellow-400/80 py-2",children:["No models found. Run ",w0.jsxDEV("code",{className:"bg-[#1a1a1a] px-1 rounded",children:"ollama pull llama3.3"},void 0,!1,void 0,this)," to download a model."]},void 0,!0,void 0,this):w0.jsxDEV(G8,{value:G.model,options:g,onChange:(d)=>L({...G,model:d}),placeholder:"Select model..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"System Prompt",children:w0.jsxDEV("textarea",{value:G.systemPrompt,onChange:(d)=>L({...G,systemPrompt:d.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 h-24 resize-none focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV(Qz,{label:"Features",children:w0.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:HM.map(({key:d,label:B0,description:c,icon:v0})=>{let C=d==="agents"?p():!!G.features[d];return w0.jsxDEV("button",{type:"button",onClick:()=>s(d),className:`flex items-center gap-3 p-3 rounded border text-left transition ${C?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[w0.jsxDEV(v0,{className:`w-5 h-5 flex-shrink-0 ${C?"text-[#f97316]":"text-[#666]"}`},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"flex-1 min-w-0",children:[w0.jsxDEV("div",{className:`text-sm font-medium ${C?"text-[#f97316]":""}`,children:B0},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"text-xs text-[#666]",children:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},d,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),p()&&w0.jsxDEV(Qz,{label:"Multi-Agent Mode",children:[w0.jsxDEV("div",{className:"flex gap-2",children:[w0.jsxDEV("button",{type:"button",onClick:()=>H0("coordinator"),className:`flex-1 p-3 rounded border text-left transition ${a()==="coordinator"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[w0.jsxDEV("div",{className:`text-sm font-medium ${a()==="coordinator"?"text-[#f97316]":""}`,children:"Coordinator"},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"text-xs text-[#666]",children:"Orchestrates and delegates"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("button",{type:"button",onClick:()=>H0("worker"),className:`flex-1 p-3 rounded border text-left transition ${a()==="worker"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[w0.jsxDEV("div",{className:`text-sm font-medium ${a()==="worker"?"text-[#f97316]":""}`,children:"Worker"},void 0,!1,void 0,this),w0.jsxDEV("div",{className:"text-xs text-[#666]",children:"Receives delegated tasks"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.projectId&&w0.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Group: Using project as agent group"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.provider==="anthropic"&&w0.jsxDEV(Qz,{label:"Agent Built-in Tools",children:[w0.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[w0.jsxDEV("button",{type:"button",onClick:()=>L({...G,features:{...G.features,builtinTools:{...G.features.builtinTools,webSearch:!G.features.builtinTools?.webSearch}}}),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${G.features.builtinTools?.webSearch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[w0.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:w0.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV("span",{className:"text-sm",children:"Web Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("button",{type:"button",onClick:()=>L({...G,features:{...G.features,builtinTools:{...G.features.builtinTools,webFetch:!G.features.builtinTools?.webFetch}}}),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${G.features.builtinTools?.webFetch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[w0.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:w0.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},void 0,!1,void 0,this)},void 0,!1,void 0,this),w0.jsxDEV("span",{className:"text-sm",children:"Web Fetch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Provider-native tools for real-time web access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w0.jsxDEV("div",{className:"flex gap-3 mt-6",children:[w0.jsxDEV("button",{onClick:M,className:"flex-1 border border-[#333] hover:border-[#f97316] hover:text-[#f97316] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),w0.jsxDEV("button",{onClick:N,disabled:!G.name,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Qz({label:G,children:H}){return w0.jsxDEV("div",{children:[w0.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:G},void 0,!1,void 0,this),H]},void 0,!0,void 0,this)}function KM({onGoToSettings:G}){return w0.jsxDEV("div",{className:"text-center py-6",children:[w0.jsxDEV("p",{className:"text-[#666] mb-4",children:"No API keys configured. Add a provider key first."},void 0,!1,void 0,this),w0.jsxDEV("button",{onClick:G,className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Go to Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var I0=n(e0(),1);var W=n(C1(),1),_M=[{key:"memory",label:"Memory",description:"Persistent recall",icon:KX},{key:"tasks",label:"Tasks",description:"Schedule and execute tasks",icon:k7},{key:"files",label:"Files",description:"File storage and management",icon:OX},{key:"vision",label:"Vision",description:"Process images and PDFs",icon:_X},{key:"operator",label:"Operator",description:"Browser automation",icon:BX},{key:"mcp",label:"MCP",description:"External tools/services",icon:Q8},{key:"realtime",label:"Realtime",description:"Voice conversations",icon:UX},{key:"agents",label:"Multi-Agent",description:"Communicate with peer agents",icon:LX}];function oJ({agent:G,providers:H,onClose:_,onStartAgent:L,onUpdateAgent:R,onDeleteAgent:N}){let[M,U]=I0.useState("chat");return W.jsxDEV("div",{className:"w-full h-full flex flex-col overflow-hidden bg-[#0a0a0a] border-l border-[#1a1a1a]",children:[W.jsxDEV("div",{className:"border-b border-[#1a1a1a] flex items-center",children:[W.jsxDEV("div",{className:"flex-1 overflow-x-auto scrollbar-hide px-2 md:px-4",children:W.jsxDEV("div",{className:"flex gap-1",children:[W.jsxDEV(WX,{active:M==="chat",onClick:()=>U("chat"),children:"Chat"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="threads",onClick:()=>U("threads"),children:"Threads"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="tasks",onClick:()=>U("tasks"),children:"Tasks"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="memory",onClick:()=>U("memory"),children:"Memory"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="files",onClick:()=>U("files"),children:"Files"},void 0,!1,void 0,this),W.jsxDEV(WX,{active:M==="settings",onClick:()=>U("settings"),children:"Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:_,className:"text-[#666] hover:text-[#e0e0e0] transition p-2 flex-shrink-0 mr-2",children:W.jsxDEV(nz,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[M==="chat"&&W.jsxDEV(BM,{agent:G,onStartAgent:L},void 0,!1,void 0,this),M==="threads"&&W.jsxDEV(UM,{agent:G},void 0,!1,void 0,this),M==="tasks"&&W.jsxDEV(OM,{agent:G},void 0,!1,void 0,this),M==="memory"&&W.jsxDEV(LM,{agent:G},void 0,!1,void 0,this),M==="files"&&W.jsxDEV(WM,{agent:G},void 0,!1,void 0,this),M==="settings"&&W.jsxDEV(RM,{agent:G,providers:H,onUpdateAgent:R,onDeleteAgent:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function WX({active:G,onClick:H,children:_}){return W.jsxDEV("button",{onClick:H,className:`px-4 py-3 text-sm font-medium border-b-2 transition ${G?"border-[#f97316] text-[#e0e0e0]":"border-transparent text-[#666] hover:text-[#888]"}`,children:_},void 0,!1,void 0,this)}function BM({agent:G,onStartAgent:H}){if(G.status==="running"&&G.port)return W.jsxDEV(GY,{agentId:"default",apiUrl:`/api/agents/${G.id}`,placeholder:"Message this agent...",context:G.systemPrompt,variant:"terminal",headerTitle:G.name},void 0,!1,void 0,this);return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"text-lg mb-2",children:"Agent is not running"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:H,className:"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30 px-4 py-2 rounded font-medium transition",children:"Start Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function UM({agent:G}){let[H,_]=I0.useState([]),[L,R]=I0.useState(!0),[N,M]=I0.useState(null),[U,I]=I0.useState(null),[y,O]=I0.useState([]),[F,P]=I0.useState(!1),{confirm:S,ConfirmDialog:E}=iJ();I0.useEffect(()=>{_([]),I(null),M(null),R(!0)},[G.id]),I0.useEffect(()=>{if(G.status!=="running"){R(!1);return}(async()=>{try{let s=await fetch(`/api/agents/${G.id}/threads`);if(!s.ok)throw Error("Failed to fetch threads");let p=await s.json();_(p.threads||[]),M(null)}catch(s){M(s instanceof Error?s.message:"Failed to load threads")}finally{R(!1)}})()},[G.id,G.status]);let V=async(i)=>{P(!0),I(i);try{let s=await fetch(`/api/agents/${G.id}/threads/${i}/messages`);if(s.ok){let p=await s.json();O(z2(p.messages||[]))}else O([])}catch{O([])}P(!1)},g=async(i,s)=>{if(s.stopPropagation(),!await S("Delete this thread?",{confirmText:"Delete",title:"Delete Thread"}))return;try{if(await fetch(`/api/agents/${G.id}/threads/${i}`,{method:"DELETE"}),_((a)=>a.filter((H0)=>H0.id!==i)),U===i)I(null)}catch{}};if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view threads"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(L)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading threads..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(N)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(U)return W.jsxDEV(W.Fragment,{children:[E,W.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:F?W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:"Loading messages..."},void 0,!1,void 0,this):W.jsxDEV(GY,{agentId:"default",apiUrl:`/api/agents/${G.id}`,threadId:U,initialMessages:y,placeholder:"Continue this conversation...",context:G.systemPrompt,variant:"terminal",showHeader:!0,onHeaderBack:()=>{I(null),O([])}},U,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return W.jsxDEV(W.Fragment,{children:[E,W.jsxDEV("div",{className:"flex-1 overflow-auto",children:H.length===0?W.jsxDEV("div",{className:"flex items-center justify-center h-full text-[#666]",children:W.jsxDEV("p",{children:"No conversation threads yet"},void 0,!1,void 0,this)},void 0,!1,void 0,this):W.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:H.map((i)=>W.jsxDEV("div",{onClick:()=>V(i.id),className:"p-4 cursor-pointer hover:bg-[#111] transition flex items-center justify-between",children:[W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("p",{className:"text-sm font-medium truncate",children:i.title||`Thread ${i.id.slice(0,8)}`},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:[new Date(i.updated_at||i.created_at).toLocaleString(),i.message_count!==void 0&&` • ${i.message_count} messages`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("button",{onClick:(s)=>g(i.id,s),className:"text-[#666] hover:text-red-400 text-lg ml-4",children:"×"},void 0,!1,void 0,this)]},i.id,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function OM({agent:G}){let{authFetch:H}=c1(),[_,L]=I0.useState([]),[R,N]=I0.useState(!0),[M,U]=I0.useState(null),[I,y]=I0.useState("all"),[O,F]=I0.useState(null),[P,S]=I0.useState(!1),{events:E}=S2({agent_id:G.id,category:"task"});I0.useEffect(()=>{L([]),U(null),N(!0),F(null)},[G.id]);let V=async()=>{if(G.status!=="running"){N(!1);return}try{let p=await fetch(`/api/agents/${G.id}/tasks?status=${I}`);if(!p.ok)throw Error("Failed to fetch tasks");let a=await p.json();L(a.tasks||[]),U(null)}catch(p){U(p instanceof Error?p.message:"Failed to load tasks")}finally{N(!1)}},g=async(p)=>{F(p),S(!0);try{let a=await H(`/api/tasks/${p.agentId||G.id}/${p.id}`);if(a.ok){let H0=await a.json();if(H0.task)F({...H0.task,agentId:p.agentId||G.id,agentName:p.agentName||G.name})}}catch(a){console.error("Failed to fetch task details:",a)}finally{S(!1)}};I0.useEffect(()=>{N(!0),V()},[G.id,G.status,I,E.length]);let i={pending:"bg-yellow-500/20 text-yellow-400",running:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",failed:"bg-red-500/20 text-red-400",cancelled:"bg-gray-500/20 text-gray-400"};if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view tasks"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!G.features?.tasks)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Tasks feature is not enabled"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Enable it in Settings to schedule tasks"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(R)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading tasks..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(M)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:M},void 0,!1,void 0,this)},void 0,!1,void 0,this);let s=[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}];if(O)return W.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:[W.jsxDEV("div",{className:"px-4 pt-3 pb-2 border-b border-[#1a1a1a] shrink-0",children:W.jsxDEV("button",{onClick:()=>F(null),className:"text-sm text-[#666] hover:text-[#e0e0e0] transition flex items-center gap-1",children:[W.jsxDEV("span",{children:"←"},void 0,!1,void 0,this)," Back to tasks"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[W.jsxDEV("div",{children:W.jsxDEV("div",{className:"flex items-start justify-between gap-2 mb-1",children:[W.jsxDEV("h3",{className:"text-lg font-medium",children:O.title},void 0,!1,void 0,this),W.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium flex-shrink-0 ${i[O.status]}`,children:O.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),O.description&&W.jsxDEV("div",{children:[W.jsxDEV("h4",{className:"text-xs text-[#666] uppercase tracking-wider mb-1",children:"Description"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm text-[#888] whitespace-pre-wrap",children:O.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[W.jsxDEV("div",{children:[W.jsxDEV("span",{className:"text-[#666]",children:"Type"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"capitalize",children:O.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{children:[W.jsxDEV("span",{className:"text-[#666]",children:"Priority"},void 0,!1,void 0,this),W.jsxDEV("p",{children:O.priority},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.recurrence&&W.jsxDEV("div",{children:[W.jsxDEV("span",{className:"text-[#666]",children:"Recurrence"},void 0,!1,void 0,this),W.jsxDEV("p",{children:sH(O.recurrence)},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#444] mt-0.5 font-mono",children:O.recurrence},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"space-y-2 text-sm",children:[W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Created"},void 0,!1,void 0,this),W.jsxDEV("span",{children:new Date(O.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.execute_at&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Scheduled"},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-[#f97316]",children:UY(O.execute_at)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.executed_at&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Started"},void 0,!1,void 0,this),W.jsxDEV("span",{children:new Date(O.executed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.completed_at&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Completed"},void 0,!1,void 0,this),W.jsxDEV("span",{children:new Date(O.completed_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.next_run&&W.jsxDEV("div",{className:"flex justify-between",children:[W.jsxDEV("span",{className:"text-[#666]",children:"Next Run"},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-[#f97316]",children:UY(O.next_run)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),O.status==="failed"&&O.error&&W.jsxDEV("div",{className:"min-w-0",children:[W.jsxDEV("h4",{className:"text-xs text-red-400 uppercase tracking-wider mb-1",children:"Error"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/20 rounded p-3 overflow-x-auto",children:W.jsxDEV("pre",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:O.error},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.status==="completed"&&O.result&&W.jsxDEV("div",{className:"min-w-0",children:[W.jsxDEV("h4",{className:"text-xs text-green-400 uppercase tracking-wider mb-1",children:"Result"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/20 rounded p-3 overflow-x-auto",children:W.jsxDEV("pre",{className:"text-sm text-green-400 whitespace-pre-wrap break-words",children:typeof O.result==="string"?O.result:JSON.stringify(O.result,null,2)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P&&!O.trajectory&&W.jsxDEV("div",{children:[W.jsxDEV("h4",{className:"text-xs text-[#666] uppercase tracking-wider mb-2",children:"Trajectory"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-sm text-[#555]",children:"Loading trajectory..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O.trajectory&&O.trajectory.length>0&&W.jsxDEV("div",{children:[W.jsxDEV("h4",{className:"text-xs text-[#666] uppercase tracking-wider mb-2",children:["Trajectory (",O.trajectory.length," steps)"]},void 0,!0,void 0,this),W.jsxDEV(m2,{trajectory:O.trajectory},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return W.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:[W.jsxDEV("div",{className:"flex gap-2 mb-4",children:s.map((p)=>W.jsxDEV("button",{onClick:()=>y(p.value),className:`px-3 py-1.5 rounded text-sm transition ${I===p.value?"bg-[#f97316] text-black":"bg-[#1a1a1a] hover:bg-[#222]"}`,children:p.label},p.value,!1,void 0,this))},void 0,!1,void 0,this),_.length===0?W.jsxDEV("div",{className:"text-center py-10",children:[W.jsxDEV(k7,{className:"w-10 h-10 mx-auto mb-3 text-[#333]"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-[#666]",children:["No ",I==="all"?"":I+" ","tasks"]},void 0,!0,void 0,this),W.jsxDEV("p",{className:"text-sm text-[#444] mt-1",children:"Tasks will appear here when created"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):W.jsxDEV("div",{className:"space-y-3",children:_.map((p)=>W.jsxDEV("div",{onClick:()=>g(p),className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 cursor-pointer hover:border-[#333] transition",children:[W.jsxDEV("div",{className:"flex items-start justify-between mb-2",children:[W.jsxDEV("div",{className:"flex-1 min-w-0",children:W.jsxDEV("h3",{className:"font-medium",children:p.title||p.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ml-2 ${i[p.status]||i.pending}`,children:p.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.description&&W.jsxDEV("p",{className:"text-sm text-[#888] mb-2 line-clamp-2",children:p.description},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-[#555]",children:[W.jsxDEV("span",{className:"flex items-center gap-1",children:[p.type==="recurring"?W.jsxDEV(D2,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):p.execute_at?W.jsxDEV(E2,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this):W.jsxDEV(f2,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),p.type==="recurring"&&p.recurrence?sH(p.recurrence):p.type||"once"]},void 0,!0,void 0,this),p.priority!==void 0&&W.jsxDEV("span",{children:["Priority: ",p.priority]},void 0,!0,void 0,this),p.next_run&&W.jsxDEV("span",{className:"text-[#f97316]",children:UY(p.next_run)},void 0,!1,void 0,this),!p.next_run&&p.execute_at&&W.jsxDEV("span",{className:"text-[#f97316]",children:UY(p.execute_at)},void 0,!1,void 0,this),W.jsxDEV("span",{children:["Created: ",new Date(p.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),p.status==="completed"&&p.result&&W.jsxDEV("div",{className:"mt-3 bg-green-500/10 border border-green-500/20 rounded p-3",children:[W.jsxDEV("h4",{className:"text-xs text-green-400 uppercase tracking-wider mb-1",children:"Result"},void 0,!1,void 0,this),W.jsxDEV("pre",{className:"text-sm text-green-400 whitespace-pre-wrap break-words",children:typeof p.result==="string"?p.result:JSON.stringify(p.result,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.status==="failed"&&p.error&&W.jsxDEV("div",{className:"mt-3 bg-red-500/10 border border-red-500/20 rounded p-3",children:[W.jsxDEV("h4",{className:"text-xs text-red-400 uppercase tracking-wider mb-1",children:"Error"},void 0,!1,void 0,this),W.jsxDEV("pre",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:p.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LM({agent:G}){let[H,_]=I0.useState([]),[L,R]=I0.useState(!0),[N,M]=I0.useState(null),[U,I]=I0.useState(!1),{confirm:y,ConfirmDialog:O}=iJ();I0.useEffect(()=>{_([]),M(null),R(!0)},[G.id]);let F=async()=>{if(G.status!=="running"){R(!1);return}try{let E=await fetch(`/api/agents/${G.id}/memories`);if(!E.ok)throw Error("Failed to fetch memories");let V=await E.json();_(V.memories||[]),I(V.enabled??!1),M(null)}catch(E){M(E instanceof Error?E.message:"Failed to load memories")}finally{R(!1)}};I0.useEffect(()=>{F()},[G.id,G.status]);let P=async(E)=>{try{await fetch(`/api/agents/${G.id}/memories/${E}`,{method:"DELETE"}),_((V)=>V.filter((g)=>g.id!==E))}catch{}},S=async()=>{if(!await y("Clear all memories?",{confirmText:"Clear",title:"Clear Memories"}))return;try{await fetch(`/api/agents/${G.id}/memories`,{method:"DELETE"}),_([])}catch{}};if(!G.features?.memory)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Memory feature is not enabled"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Enable it in Settings to persist knowledge"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view memories"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(L)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading memories..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(N)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!U)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Memory system not initialized"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Check OPENAI_API_KEY for embeddings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return W.jsxDEV(W.Fragment,{children:[O,W.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:[W.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[W.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Stored Memories (",H.length,")"]},void 0,!0,void 0,this),H.length>0&&W.jsxDEV("button",{onClick:S,className:"text-xs text-red-400 hover:text-red-300",children:"Clear All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.length===0?W.jsxDEV("div",{className:"text-center py-10 text-[#666]",children:[W.jsxDEV("p",{children:"No memories stored yet"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm mt-1",children:"The agent will remember important information from conversations"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):W.jsxDEV("div",{className:"space-y-3",children:H.map((E)=>W.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded p-3",children:[W.jsxDEV("div",{className:"flex items-start justify-between gap-2",children:[W.jsxDEV("p",{className:"text-sm text-[#e0e0e0] flex-1",children:E.content},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:()=>P(E.id),className:"text-[#666] hover:text-red-400 text-sm flex-shrink-0",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center gap-3 mt-2",children:[W.jsxDEV("span",{className:`text-xs px-2 py-0.5 rounded ${E.type==="preference"?"bg-purple-500/20 text-purple-400":E.type==="fact"?"bg-green-500/20 text-green-400":"bg-blue-500/20 text-blue-400"}`,children:E.type},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-xs text-[#666]",children:new Date(E.created_at).toLocaleString()},void 0,!1,void 0,this),E.importance&&W.jsxDEV("span",{className:"text-xs text-[#555]",children:["importance: ",E.importance.toFixed(1)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},E.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function WM({agent:G}){let[H,_]=I0.useState([]),[L,R]=I0.useState(!0),[N,M]=I0.useState(null),[U,I]=I0.useState(!1),[y,O]=I0.useState(null),[F,P]=I0.useState(!1),S=I0.default.useRef(null),{confirm:E,ConfirmDialog:V}=iJ();I0.useEffect(()=>{_([]),M(null),R(!0)},[G.id]);let g=async()=>{if(G.status!=="running"){R(!1);return}try{let C=await fetch(`/api/agents/${G.id}/files`);if(!C.ok)throw Error("Failed to fetch files");let e=await C.json();_(e.files||[]),M(null)}catch(C){M(C instanceof Error?C.message:"Failed to load files")}finally{R(!1)}};I0.useEffect(()=>{g()},[G.id,G.status]);let i=async(C)=>{if(!await E("Delete this file?",{confirmText:"Delete",title:"Delete File"}))return;try{await fetch(`/api/agents/${G.id}/files/${C}`,{method:"DELETE"}),_((l)=>l.filter((u)=>u.id!==C))}catch{}},s=(C,e)=>{let l=document.createElement("a");l.href=`/api/agents/${G.id}/files/${C}/download`,l.download=e,l.click()},p=(C)=>{if(C<1024)return`${C} B`;if(C<1048576)return`${(C/1024).toFixed(1)} KB`;return`${(C/1048576).toFixed(1)} MB`},a=async(C)=>{I(!0),O(null);try{let e=new FormData;e.append("file",C);let l=await fetch(`/api/agents/${G.id}/files`,{method:"POST",body:e});if(!l.ok){let u=await l.json();throw Error(u.error||"Upload failed")}await g()}catch(e){O(e instanceof Error?e.message:"Upload failed")}finally{I(!1)}},H0=(C)=>{let e=C.target.files?.[0];if(e)a(e);C.target.value=""},d=(C)=>{C.preventDefault(),P(!1);let e=C.dataTransfer.files?.[0];if(e)a(e)},B0=(C)=>{C.preventDefault(),P(!0)},c=(C)=>{C.preventDefault(),P(!1)},v0=(C)=>{if(C.startsWith("image/"))return"\uD83D\uDDBC";if(C.includes("pdf"))return"\uD83D\uDCD5";if(C.includes("json"))return"{}";if(C.includes("javascript")||C.includes("typescript"))return"⚡";if(C.startsWith("text/"))return"\uD83D\uDCC4";if(C.startsWith("audio/"))return"\uD83C\uDFB5";if(C.startsWith("video/"))return"\uD83C\uDFAC";return"\uD83D\uDCC1"};if(!G.features?.files)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("div",{className:"text-center",children:[W.jsxDEV("p",{className:"mb-2",children:"Files feature is not enabled"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm",children:"Enable it in Settings to manage files"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(G.status!=="running")return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Start the agent to view files"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(L)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:W.jsxDEV("p",{children:"Loading files..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(N)return W.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-red-400",children:W.jsxDEV("p",{children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this);return W.jsxDEV(W.Fragment,{children:[V,W.jsxDEV("div",{className:`flex-1 overflow-auto p-4 transition ${F?"bg-[#f97316]/5":""}`,onDrop:d,onDragOver:B0,onDragLeave:c,children:[W.jsxDEV("input",{ref:S,type:"file",className:"hidden",onChange:H0},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[W.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Agent Files (",H.length,")"]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("button",{onClick:()=>S.current?.click(),disabled:U,className:"text-xs bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-3 py-1 rounded font-medium transition",children:U?"Uploading...":"Upload"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:g,className:"text-xs text-[#666] hover:text-[#888]",children:"Refresh"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y&&W.jsxDEV("div",{className:"mb-4 text-sm bg-red-500/10 text-red-400 px-3 py-2 rounded",children:y},void 0,!1,void 0,this),F&&W.jsxDEV("div",{className:"mb-4 border-2 border-dashed border-[#f97316] rounded-lg p-8 text-center",children:W.jsxDEV("p",{className:"text-[#f97316]",children:"Drop file to upload"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.length===0&&!F&&W.jsxDEV("div",{className:"text-center py-10 text-[#666]",children:[W.jsxDEV("p",{children:"No files stored yet"},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-sm mt-1",children:"Drop files here, click Upload, or attach files in Chat"},void 0,!1,void 0,this),G.features?.memory&&W.jsxDEV("p",{className:"text-xs mt-2 text-[#555]",children:"Files will be auto-ingested into memory"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.length>0&&W.jsxDEV("div",{className:"space-y-2",children:H.map((C)=>W.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded p-3 flex items-center gap-3",children:[W.jsxDEV("div",{className:"w-10 h-10 bg-[#1a1a1a] rounded flex items-center justify-center text-[#666]",children:v0(C.mime_type)},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("p",{className:"text-sm text-[#e0e0e0] truncate",children:C.filename},void 0,!1,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#666]",children:[p(C.size_bytes)," • ",new Date(C.created_at).toLocaleString(),C.source&&C.source!=="upload"&&` • ${C.source}`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("button",{onClick:()=>s(C.id,C.filename),className:"text-xs text-[#666] hover:text-[#f97316] px-2 py-1",children:"↓"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:()=>i(C.id),className:"text-[#666] hover:text-red-400 text-sm",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},C.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RM({agent:G,providers:H,onUpdateAgent:_,onDeleteAgent:L}){let{authFetch:R,isDev:N}=c1(),[M,U]=I0.useState({name:G.name,provider:G.provider,model:G.model,systemPrompt:G.systemPrompt,features:{...G.features,builtinTools:G.features.builtinTools||{webSearch:!1,webFetch:!1}},mcpServers:[...G.mcpServers||[]],skills:[...G.skills||[]]}),[I,y]=I0.useState(!1),[O,F]=I0.useState(!1),[P,S]=I0.useState(null),[E,V]=I0.useState([]),[g,i]=I0.useState([]),[s,p]=I0.useState(null),[a,H0]=I0.useState(null),[d,B0]=I0.useState(!1),[c,v0]=I0.useState([]);I0.useEffect(()=>{R(`/api/subscriptions?agent_id=${G.id}`).then((f)=>f.ok?f.json():{subscriptions:[]}).then((f)=>v0(f.subscriptions||[])).catch(()=>{})},[G.id,R]),I0.useEffect(()=>{(async()=>{try{let i0=await(await R("/api/mcp/servers")).json();V(i0.servers||[])}catch(Y0){console.error("Failed to fetch MCP servers:",Y0)}})()},[R]),I0.useEffect(()=>{(async()=>{try{let Y0=await R(`/api/agents/${G.id}/api-key`);if(Y0.ok){let i0=await Y0.json();p(i0.apiKey),H0(i0.fullKey||null)}}catch(Y0){}})()},[G.id,R]),I0.useEffect(()=>{(async()=>{try{let i0=await(await R("/api/skills")).json();i(i0.skills||[])}catch(Y0){console.error("Failed to fetch skills:",Y0)}})()},[R]),I0.useEffect(()=>{U({name:G.name,provider:G.provider,model:G.model,systemPrompt:G.systemPrompt,features:{...G.features,builtinTools:G.features.builtinTools||{webSearch:!1,webFetch:!1}},mcpServers:[...G.mcpServers||[]],skills:[...G.skills||[]]}),S(null)},[G.id]);let C=H.find((f)=>f.id===M.provider),e=H.filter((f)=>f.hasKey&&f.type==="llm").map((f)=>({value:f.id,label:f.name})),l=C?.models.map((f)=>({value:f.value,label:f.label,recommended:f.recommended}))||[],u=(f)=>{let Y0=H.find((U1)=>U1.id===f),i0=Y0?.models.find((U1)=>U1.recommended)?.value||Y0?.models[0]?.value||"";U((U1)=>({...U1,provider:f,model:i0}))},q0=(f)=>{if(f==="agents")U((Y0)=>{if(typeof Y0.features.agents==="boolean"?Y0.features.agents:Y0.features.agents?.enabled??!1)return{...Y0,features:{...Y0.features,agents:!1}};else return{...Y0,features:{...Y0.features,agents:{enabled:!0,mode:"worker",group:G.projectId||void 0}}}});else if(f==="operator")U((Y0)=>{if(XY(Y0.features).enabled)return{...Y0,features:{...Y0.features,operator:!1}};else return{...Y0,features:{...Y0.features,operator:{enabled:!0}}}});else U((Y0)=>({...Y0,features:{...Y0.features,[f]:!Y0.features[f]}}))},t=(f)=>{U((Y0)=>{let i0=YX(Y0.features,G.projectId);return{...Y0,features:{...Y0.features,agents:{...i0,enabled:!0,mode:f}}}})},Z0=()=>{let f=M.features.agents;if(typeof f==="boolean")return f;return f?.enabled??!1},K0=()=>{return YX(M.features,G.projectId).mode||"worker"},h0=()=>{return XY(M.features).enabled},f0=()=>{return XY(M.features)},m=H.filter((f)=>f.type==="browser"&&f.hasKey),Q0=(f)=>{U((Y0)=>{let i0=XY(Y0.features);return{...Y0,features:{...Y0.features,operator:{...i0,enabled:!0,browser_provider:f}}}})},k0=(f)=>{U((Y0)=>({...Y0,mcpServers:Y0.mcpServers.includes(f)?Y0.mcpServers.filter((i0)=>i0!==f):[...Y0.mcpServers,f]}))},D0=(f)=>{U((Y0)=>({...Y0,skills:Y0.skills.includes(f)?Y0.skills.filter((i0)=>i0!==f):[...Y0.skills,f]}))},r0=async()=>{y(!0),S(null);let f=await _(M);if(y(!1),f.error)S({type:"error",text:f.error});else S({type:"success",text:"Settings saved"}),setTimeout(()=>S(null),2000)},G4=M.name!==G.name||M.provider!==G.provider||M.model!==G.model||M.systemPrompt!==G.systemPrompt||JSON.stringify(M.features)!==JSON.stringify(G.features)||JSON.stringify(M.mcpServers.sort())!==JSON.stringify((G.mcpServers||[]).sort())||JSON.stringify(M.skills.sort())!==JSON.stringify((G.skills||[]).sort());return W.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:W.jsxDEV("div",{className:"space-y-4",children:[W.jsxDEV(y7,{label:"Name",children:W.jsxDEV("input",{type:"text",value:M.name,onChange:(f)=>U((Y0)=>({...Y0,name:f.target.value})),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Provider",children:W.jsxDEV(G8,{value:M.provider,options:e,onChange:u},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Model",children:W.jsxDEV(G8,{value:M.model,options:l,onChange:(f)=>U((Y0)=>({...Y0,model:f}))},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"System Prompt",children:W.jsxDEV("textarea",{value:M.systemPrompt,onChange:(f)=>U((Y0)=>({...Y0,systemPrompt:f.target.value})),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 h-24 resize-none focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Features",children:W.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:_M.map(({key:f,label:Y0,description:i0,icon:U1})=>{let O6=f==="agents"?Z0():f==="operator"?h0():!!M.features[f];return W.jsxDEV("button",{type:"button",onClick:()=>q0(f),className:`flex items-center gap-3 p-3 rounded border text-left transition ${O6?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV(U1,{className:`w-5 h-5 flex-shrink-0 ${O6?"text-[#f97316]":"text-[#666]"}`},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("div",{className:`text-sm font-medium ${O6?"text-[#f97316]":""}`,children:Y0},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:i0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},f,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z0()&&W.jsxDEV(y7,{label:"Multi-Agent Mode",children:[W.jsxDEV("div",{className:"flex gap-2",children:[W.jsxDEV("button",{type:"button",onClick:()=>t("coordinator"),className:`flex-1 p-3 rounded border text-left transition ${K0()==="coordinator"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:`text-sm font-medium ${K0()==="coordinator"?"text-[#f97316]":""}`,children:"Coordinator"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:"Orchestrates and delegates to other agents"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("button",{type:"button",onClick:()=>t("worker"),className:`flex-1 p-3 rounded border text-left transition ${K0()==="worker"?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:`text-sm font-medium ${K0()==="worker"?"text-[#f97316]":""}`,children:"Worker"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:"Receives tasks from coordinators"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.projectId&&W.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Group: Using project as agent group"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h0()&&W.jsxDEV(y7,{label:"Browser Provider",children:m.length>0?W.jsxDEV(G8,{value:f0().browser_provider||"",options:[{value:"",label:"Auto (first available)"},...m.map((f)=>({value:f.id,label:f.name}))],onChange:(f)=>Q0(f)},void 0,!1,void 0,this):W.jsxDEV("p",{className:"text-sm text-[#666] p-3 border border-[#222] rounded bg-[#0a0a0a]",children:"No browser providers configured. Go to Settings → Providers to add one."},void 0,!1,void 0,this)},void 0,!1,void 0,this),M.provider==="anthropic"&&W.jsxDEV(y7,{label:"Agent Built-in Tools",children:[W.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[W.jsxDEV("button",{type:"button",onClick:()=>U((f)=>({...f,features:{...f.features,builtinTools:{...f.features.builtinTools,webSearch:!f.features.builtinTools?.webSearch}}})),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${M.features.builtinTools?.webSearch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[W.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:W.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-sm",children:"Web Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("button",{type:"button",onClick:()=>U((f)=>({...f,features:{...f.features,builtinTools:{...f.features.builtinTools,webFetch:!f.features.builtinTools?.webFetch}}})),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${M.features.builtinTools?.webFetch?"border-[#f97316] bg-[#f97316]/10 text-[#f97316]":"border-[#222] hover:border-[#333] text-[#888]"}`,children:[W.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:W.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.jsxDEV("span",{className:"text-sm",children:"Web Fetch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Provider-native tools for real-time web access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M.features.mcp&&W.jsxDEV(y7,{label:"MCP Servers",children:E.length===0?W.jsxDEV("p",{className:"text-sm text-[#666]",children:"No MCP servers configured. Add servers in the MCP page first."},void 0,!1,void 0,this):W.jsxDEV("div",{className:"space-y-2",children:[E.filter((f)=>f.project_id===null||f.project_id===G.projectId).map((f)=>{let Y0=f.type==="http"&&f.url,i0=Y0||f.status==="running",U1=Y0?`${f.source||"remote"} • http`:`${f.type} • ${f.package||f.command||"custom"}${f.status==="running"&&f.port?` • :${f.port}`:""}`;return W.jsxDEV("button",{type:"button",onClick:()=>k0(f.id),className:`w-full flex items-center gap-3 p-3 rounded border text-left transition ${M.mcpServers.includes(f.id)?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i0?"bg-green-400":"bg-[#444]"}`},void 0,!1,void 0,this),W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("span",{className:`text-sm font-medium ${M.mcpServers.includes(f.id)?"text-[#f97316]":""}`,children:f.name},void 0,!1,void 0,this),f.project_id===null&&W.jsxDEV("span",{className:"text-[10px] text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:U1},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:`text-xs px-2 py-0.5 rounded ${i0?"bg-green-500/20 text-green-400":"bg-[#222] text-[#666]"}`,children:Y0?"remote":f.status},void 0,!1,void 0,this)]},f.id,!0,void 0,this)}),W.jsxDEV("p",{className:"text-xs text-[#666] mt-2",children:"Remote servers are always available. Local servers must be running."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.jsxDEV(y7,{label:"Skills",children:g.length===0?W.jsxDEV("p",{className:"text-sm text-[#666]",children:"No skills configured. Add skills in the Skills page first."},void 0,!1,void 0,this):W.jsxDEV("div",{className:"space-y-2",children:[g.filter((f)=>f.enabled&&(f.project_id===null||f.project_id===G.projectId)).map((f)=>W.jsxDEV("button",{type:"button",onClick:()=>D0(f.id),className:`w-full flex items-center gap-3 p-3 rounded border text-left transition ${M.skills.includes(f.id)?"border-[#f97316] bg-[#f97316]/10":"border-[#222] hover:border-[#333]"}`,children:[W.jsxDEV("div",{className:"flex-1 min-w-0",children:[W.jsxDEV("div",{className:"flex items-center gap-2",children:[W.jsxDEV("span",{className:`text-sm font-medium ${M.skills.includes(f.id)?"text-[#f97316]":""}`,children:f.name},void 0,!1,void 0,this),f.project_id===null&&W.jsxDEV("span",{className:"text-[10px] text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"text-xs text-[#666]",children:f.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"text-xs px-2 py-0.5 rounded bg-[#222] text-[#666]",children:["v",f.version]},void 0,!0,void 0,this)]},f.id,!0,void 0,this)),W.jsxDEV("p",{className:"text-xs text-[#666] mt-2",children:"Skills provide reusable instructions for the agent."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P&&W.jsxDEV("div",{className:`text-sm px-3 py-2 rounded ${P.type==="success"?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:P.text},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:r0,disabled:!G4||I||!M.name,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:I?"Saving...":"Save Changes"},void 0,!1,void 0,this),G.status==="running"&&G4&&W.jsxDEV("p",{className:"text-xs text-[#666] text-center",children:"Changes will be applied to the running agent"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"mt-8 pt-6 border-t border-[#222]",children:[W.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Subscriptions"},void 0,!1,void 0,this),c.length===0?W.jsxDEV("p",{className:"text-xs text-[#555]",children:"No subscriptions. Set up triggers in Connections to have this agent listen to external events."},void 0,!1,void 0,this):W.jsxDEV("div",{className:"space-y-2",children:c.map((f)=>W.jsxDEV("div",{className:"flex items-center gap-2 px-3 py-2 bg-[#111] rounded border border-[#1a1a1a]",children:[W.jsxDEV("span",{className:`w-2 h-2 rounded-full shrink-0 ${f.enabled?"bg-cyan-400":"bg-[#444]"}`},void 0,!1,void 0,this),W.jsxDEV("span",{className:`text-sm flex-1 ${f.enabled?"text-cyan-400":"text-[#666]"}`,children:f.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),W.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${f.enabled?"bg-cyan-500/10 text-cyan-400":"bg-[#222] text-[#555]"}`,children:f.enabled?"active":"disabled"},void 0,!1,void 0,this)]},f.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s&&W.jsxDEV("div",{className:"mt-8 pt-6 border-t border-[#222]",children:[W.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Developer Info"},void 0,!1,void 0,this),W.jsxDEV("div",{className:"space-y-2",children:[W.jsxDEV("div",{className:"flex items-center justify-between",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"Agent ID"},void 0,!1,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1 rounded text-[#888]",children:G.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex items-center justify-between",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"Port"},void 0,!1,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1 rounded text-[#888]",children:G.port||"N/A"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"flex flex-col gap-1",children:[W.jsxDEV("div",{className:"flex items-center justify-between",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"API Key"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:()=>B0(!d),className:"text-xs text-[#f97316] hover:text-[#fb923c]",children:d?"Hide":"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1 rounded text-[#888] break-all",children:d?a||s:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.status==="running"&&G.port&&W.jsxDEV("div",{className:"flex flex-col gap-1 mt-2",children:[W.jsxDEV("span",{className:"text-xs text-[#666]",children:"Test with curl"},void 0,!1,void 0,this),W.jsxDEV("code",{className:"text-xs bg-[#1a1a1a] px-2 py-1.5 rounded text-[#666] break-all",children:['curl -H "X-API-Key: ',d?a||s:"***",'" http://localhost:',G.port,"/config"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.jsxDEV("div",{className:"mt-8 pt-6 border-t border-[#222]",children:[W.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Danger Zone"},void 0,!1,void 0,this),O?W.jsxDEV("div",{className:"flex gap-2",children:[W.jsxDEV("button",{onClick:()=>F(!1),className:"flex-1 border border-[#333] hover:border-[#444] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),W.jsxDEV("button",{onClick:L,className:"flex-1 bg-red-500/20 text-red-400 hover:bg-red-500/30 px-4 py-2 rounded font-medium transition",children:"Confirm Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):W.jsxDEV("button",{onClick:()=>F(!0),className:"w-full border border-red-500/30 text-red-400/70 hover:border-red-500/50 hover:text-red-400 px-4 py-2 rounded font-medium transition",children:"Delete Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function y7({label:G,children:H}){return W.jsxDEV("div",{children:[W.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:G},void 0,!1,void 0,this),H]},void 0,!0,void 0,this)}var h2=n(e0(),1);var v1=n(C1(),1);function rJ({agents:G,loading:H,selectedAgent:_,providers:L,onSelectAgent:R,onCloseAgent:N,onToggleAgent:M,onDeleteAgent:U,onUpdateAgent:I,onNewAgent:y,canCreateAgent:O=!0}){let{currentProjectId:F,currentProject:P}=u4(),S=h2.useMemo(()=>{if(F===null)return G;if(F==="unassigned")return G.filter((V)=>!V.projectId);return G.filter((V)=>V.projectId===F)},[G,F]),E=F===null?"Agents":F==="unassigned"?"Unassigned Agents":P?.name||"Agents";return v1.jsxDEV("div",{className:"flex-1 flex overflow-hidden relative",children:[v1.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[v1.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[v1.jsxDEV("div",{className:"flex items-center gap-3",children:[P&&v1.jsxDEV("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:P.color}},void 0,!1,void 0,this),v1.jsxDEV("h1",{className:"text-xl font-semibold",children:E},void 0,!1,void 0,this),F!==null&&v1.jsxDEV("span",{className:"text-sm text-[#666]",children:["(",S.length," agent",S.length!==1?"s":"",")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y&&v1.jsxDEV("button",{onClick:y,disabled:!O,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H?v1.jsxDEV(tz,{message:"Loading agents..."},void 0,!1,void 0,this):S.length===0?v1.jsxDEV(FM,{onNewAgent:y,canCreateAgent:O,hasProjectFilter:F!==null},void 0,!1,void 0,this):v1.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3 auto-rows-fr",children:S.map((V)=>v1.jsxDEV(dJ,{agent:V,selected:_?.id===V.id,onSelect:()=>R(V),onToggle:(g)=>M(V,g),showProject:F===null},V.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_&&v1.jsxDEV("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px] z-10",onClick:N},void 0,!1,void 0,this),_&&v1.jsxDEV("div",{className:"absolute right-0 top-0 bottom-0 w-full sm:w-[500px] lg:w-[600px] xl:w-[700px] z-20",children:v1.jsxDEV(oJ,{agent:_,providers:L,onClose:N,onStartAgent:(V)=>M(_,V),onUpdateAgent:(V)=>I(_.id,V),onDeleteAgent:()=>U(_.id)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FM({onNewAgent:G,canCreateAgent:H,hasProjectFilter:_}){return v1.jsxDEV("div",{className:"text-center py-20 text-[#666]",children:[_?v1.jsxDEV(v1.Fragment,{children:[v1.jsxDEV("p",{className:"text-lg",children:"No agents in this project"},void 0,!1,void 0,this),v1.jsxDEV("p",{className:"text-sm mt-1",children:"Create an agent or assign existing agents to this project"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):v1.jsxDEV(v1.Fragment,{children:[v1.jsxDEV("p",{className:"text-lg",children:"No agents yet"},void 0,!1,void 0,this),v1.jsxDEV("p",{className:"text-sm mt-1",children:"Create your first agent to get started"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&v1.jsxDEV("button",{onClick:G,disabled:!H,className:"mt-4 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var C4=n(e0(),1);var L0=n(C1(),1);function tJ({agents:G,loading:H,runningCount:_,configuredProviders:L,onNavigate:R,onSelectAgent:N}){let{authFetch:M}=c1(),{currentProjectId:U}=u4(),{events:I,statusChangeCounter:y}=qY(),[O,F]=C4.useState(null),[P,S]=C4.useState([]),[E,V]=C4.useState([]),g=C4.useMemo(()=>{if(!U)return G;if(U==="unassigned")return G.filter((c)=>!c.projectId);return G.filter((c)=>c.projectId===U)},[G,U]),i=C4.useMemo(()=>{return g.filter((c)=>c.status==="running").length},[g]),s=C4.useMemo(()=>{return new Set(g.map((c)=>c.id))},[g]),p=C4.useCallback(async()=>{try{let c=U?`project_id=${encodeURIComponent(U)}`:"",[v0,C,e]=await Promise.all([M(`/api/dashboard${c?`?${c}`:""}`),M(`/api/tasks?status=all${c?`&${c}`:""}`),M(`/api/telemetry/events?type=thread_activity&limit=20${c?`&${c}`:""}`)]);if(v0.ok){let l=await v0.json();F(l)}if(C.ok){let l=await C.json();S(l.tasks||[])}if(e.ok){let l=await e.json();V(l.events||[])}}catch(c){console.error("Failed to fetch dashboard data:",c)}},[M,U]);C4.useEffect(()=>{p()},[p,y]);let a=C4.useMemo(()=>{let c=U?P.filter((v0)=>s.has(v0.agentId)):P;return PM(c)},[P,U,s]),H0=C4.useMemo(()=>{if(!U)return O?.tasks||{total:0,pending:0,running:0,completed:0};let c=a.length,v0=a.filter((l)=>l.status==="pending").length,C=a.filter((l)=>l.status==="running").length,e=a.filter((l)=>l.status==="completed").length;return{total:c,pending:v0,running:C,completed:e}},[O,U,a]),d=C4.useMemo(()=>{let c=I.filter((l)=>l.type==="thread_activity"),v0=new Set(c.map((l)=>l.id)),C=[...c];for(let l of E)if(!v0.has(l.id))C.push(l),v0.add(l.id);let e=C;if(U)e=C.filter((l)=>s.has(l.agent_id));return e.sort((l,u)=>new Date(u.timestamp).getTime()-new Date(l.timestamp).getTime()),e.slice(0,8)},[I,E,U,s]),B0=C4.useMemo(()=>{let c=new Map;for(let v0 of G)c.set(v0.id,v0.name);return c},[G]);return L0.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[L0.jsxDEV("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 mb-6",children:[L0.jsxDEV(nJ,{label:"Agents",value:g.length,subValue:`${i} running`},void 0,!1,void 0,this),L0.jsxDEV(nJ,{label:"Tasks",value:H0.total,subValue:`${H0.pending} pending`},void 0,!1,void 0,this),L0.jsxDEV(nJ,{label:"Completed",value:H0.completed,color:"text-green-400"},void 0,!1,void 0,this),L0.jsxDEV(nJ,{label:"Providers",value:L.length,color:"text-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L0.jsxDEV("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[L0.jsxDEV(eH,{title:"Agents",actionLabel:"View All",onAction:()=>R("agents"),children:H?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this):g.length===0?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:"No agents yet"},void 0,!1,void 0,this):L0.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:g.slice(0,5).map((c)=>L0.jsxDEV(NM,{agent:c,onSelect:()=>N(c),showProject:!U},c.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),L0.jsxDEV(eH,{title:"Activity",actionLabel:"Telemetry",onAction:()=>R("telemetry"),children:d.length===0?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:[L0.jsxDEV("p",{children:"No activity yet"},void 0,!1,void 0,this),L0.jsxDEV("p",{className:"text-sm text-[#444] mt-1",children:"Agent activity will appear here in real-time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L0.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:d.map((c)=>L0.jsxDEV(wM,{activity:c.data?.activity||"Working...",agentName:B0.get(c.agent_id)||c.agent_id,timestamp:c.timestamp},c.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),L0.jsxDEV(eH,{title:"Tasks",actionLabel:"View All",onAction:()=>R("tasks"),children:a.length===0?L0.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:[L0.jsxDEV("p",{children:"No tasks yet"},void 0,!1,void 0,this),L0.jsxDEV("p",{className:"text-sm text-[#444] mt-1",children:"Tasks will appear when agents create them"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L0.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:a.slice(0,5).map((c)=>L0.jsxDEV("div",{className:"px-4 py-3 flex items-center justify-between",children:[L0.jsxDEV("div",{className:"flex-1 min-w-0",children:[L0.jsxDEV("p",{className:"font-medium truncate",children:c.title},void 0,!1,void 0,this),L0.jsxDEV("p",{className:"text-sm text-[#666]",children:[c.agentName,c.recurrence&&L0.jsxDEV("span",{className:"ml-1 text-[#555]",children:["· ",AM(c.recurrence)]},void 0,!0,void 0,this),c.next_run&&L0.jsxDEV("span",{className:"ml-1 text-[#f97316]",children:["· ",j2(c.next_run)]},void 0,!0,void 0,this),!c.next_run&&c.execute_at&&L0.jsxDEV("span",{className:"ml-1 text-[#f97316]",children:["· ",j2(c.execute_at)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L0.jsxDEV(bM,{status:c.status},void 0,!1,void 0,this)]},`${c.agentId}-${c.id}`,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function nJ({label:G,value:H,subValue:_,color:L}){return L0.jsxDEV("div",{className:"bg-[#111] rounded p-4 border border-[#1a1a1a]",children:[L0.jsxDEV("p",{className:"text-sm text-[#666] mb-1",children:G},void 0,!1,void 0,this),L0.jsxDEV("p",{className:`text-2xl font-semibold ${L||""}`,children:H},void 0,!1,void 0,this),_&&L0.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function eH({title:G,actionLabel:H,onAction:_,children:L}){return L0.jsxDEV("div",{className:"bg-[#111] rounded border border-[#1a1a1a] overflow-hidden",children:[L0.jsxDEV("div",{className:"px-4 py-3 border-b border-[#1a1a1a] flex items-center justify-between",children:[L0.jsxDEV("h3",{className:"font-semibold",children:G},void 0,!1,void 0,this),L0.jsxDEV("button",{onClick:_,className:"text-sm text-[#3b82f6] hover:text-[#60a5fa]",children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L]},void 0,!0,void 0,this)}function NM({agent:G,onSelect:H,showProject:_}){let{isActive:L}=lJ(G.id),{projects:R}=u4(),N=G.projectId?R.find((M)=>M.id===G.projectId):null;return L0.jsxDEV("div",{onClick:H,className:"px-4 py-3 hover:bg-[#1a1a1a] cursor-pointer flex items-center justify-between",children:[L0.jsxDEV("div",{className:"flex-1 min-w-0",children:[L0.jsxDEV("p",{className:"font-medium",children:G.name},void 0,!1,void 0,this),L0.jsxDEV("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[L0.jsxDEV("span",{children:G.provider},void 0,!1,void 0,this),_&&N&&L0.jsxDEV(L0.Fragment,{children:[L0.jsxDEV("span",{className:"text-[#444]",children:"·"},void 0,!1,void 0,this),L0.jsxDEV("span",{className:"flex items-center gap-1",children:[L0.jsxDEV("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}},void 0,!1,void 0,this),N.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L0.jsxDEV("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${G.status==="running"?L?"bg-green-400 animate-pulse":"bg-[#3b82f6]":"bg-[#444]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MM(G){let H=Math.floor((Date.now()-new Date(G).getTime())/1000);if(H<5)return"just now";if(H<60)return`${H}s ago`;let _=Math.floor(H/60);if(_<60)return`${_}m ago`;let L=Math.floor(_/60);if(L<24)return`${L}h ago`;return`${Math.floor(L/24)}d ago`}function wM({activity:G,agentName:H,timestamp:_}){return L0.jsxDEV("div",{className:"px-4 py-3",children:[L0.jsxDEV("p",{className:"text-sm truncate",children:G},void 0,!1,void 0,this),L0.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#555] mt-1",children:[L0.jsxDEV("span",{className:"text-[#666]",children:H},void 0,!1,void 0,this),L0.jsxDEV("span",{className:"text-[#444]",children:"·"},void 0,!1,void 0,this),L0.jsxDEV("span",{children:MM(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function bM({status:G}){let H={pending:"bg-yellow-500/20 text-yellow-400",running:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",failed:"bg-red-500/20 text-red-400",cancelled:"bg-gray-500/20 text-gray-400"};return L0.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${H[G]||H.pending}`,children:G},void 0,!1,void 0,this)}function p2(G){if(G.status==="running")return 0;if(G.status==="pending")return 1;if(G.status==="completed")return 2;if(G.status==="failed")return 3;return 4}function PM(G){return[...G].sort((H,_)=>{let L=p2(H),R=p2(_);if(L!==R)return L-R;if(L<=1){let U=H.next_run||H.execute_at||null,I=_.next_run||_.execute_at||null,y=U?new Date(U).getTime():1/0,O=I?new Date(I).getTime():1/0;return y-O}let N=H.completed_at||H.executed_at||H.created_at,M=_.completed_at||_.executed_at||_.created_at;return new Date(M).getTime()-new Date(N).getTime()})}var g2=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function AM(G){try{let H=G.trim().split(/\s+/);if(H.length!==5)return G;let[_,L,R,N,M]=H;if(_.startsWith("*/")&&L==="*"&&R==="*"&&N==="*"&&M==="*"){let I=parseInt(_.slice(2));return I===1?"Every min":`Every ${I}min`}if(_!=="*"&&!_.includes("/")&&L==="*"&&R==="*"&&N==="*"&&M==="*")return"Hourly";if(L.startsWith("*/")&&R==="*"&&N==="*"&&M==="*"){let I=parseInt(L.slice(2));return I===1?"Hourly":`Every ${I}h`}let U=(I,y)=>{let O=parseInt(I),F=parseInt(y);if(isNaN(O))return"";let P=O>=12?"PM":"AM";return`${O===0?12:O>12?O-12:O}:${F.toString().padStart(2,"0")} ${P}`};if(L!=="*"&&!L.includes("/")&&R==="*"&&N==="*"){let I=U(L,_);if(M==="*")return`Daily ${I}`;let y=M.split(",").map((O)=>g2[parseInt(O.trim())]||O);if(y.length===1)return`${y[0]} ${I}`;return`${y.join(" & ")} ${I}`}return G}catch{return G}}function j2(G){let H=new Date(G),_=new Date,L=H.getTime()-_.getTime(),R=L>0,N=Math.abs(L),M=Math.floor(N/60000),U=Math.floor(N/3600000),I=H.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),y=H.toDateString()===_.toDateString(),O=new Date(_);O.setDate(O.getDate()+1);let F=H.toDateString()===O.toDateString();if(y){if(M<1)return"now";if(M<60)return R?`in ${M}m`:`${M}m ago`;return R?`in ${U}h`:`${U}h ago`}if(F)return`Tomorrow ${I}`;return`${g2[H.getDay()]} ${I}`}var Q1=n(C1(),1),kM=D1.lazy(()=>import("./SettingsPage.p1hc60gk.js").then((G)=>({default:G.SettingsPage}))),yM=D1.lazy(()=>import("./ActivityPage.41nbye4r.js").then((G)=>({default:G.ActivityPage}))),VM=D1.lazy(()=>import("./TasksPage.sjv0khtv.js").then((G)=>({default:G.TasksPage}))),CM=D1.lazy(()=>import("./McpPage.y396h6fy.js").then((G)=>({default:G.McpPage}))),SM=D1.lazy(()=>import("./SkillsPage.yj3xdsay.js").then((G)=>({default:G.SkillsPage}))),DM=D1.lazy(()=>import("./TestsPage.zzs4qfj8.js").then((G)=>({default:G.TestsPage}))),EM=D1.lazy(()=>import("./TelemetryPage.2qm4w16r.js").then((G)=>({default:G.TelemetryPage}))),fM=D1.lazy(()=>import("./ConnectionsPage.anb3rv9a.js").then((G)=>({default:G.ConnectionsPage}))),mM=D1.lazy(()=>import("./ApiDocsPage.4smnt8m3.js").then((G)=>({default:G.ApiDocsPage})));function hM(){let{isAuthenticated:G,isLoading:H,hasUsers:_,accessToken:L,checkAuth:R}=c1(),{currentProjectId:N,refreshProjects:M}=u4(),U=yJ(),I=u2(),{isComplete:y,setIsComplete:O}=fH(),F=()=>{return L?{Authorization:`Bearer ${L}`}:{}},P=G&&y===!0,{agents:S,loading:E,runningCount:V,fetchAgents:g,createAgent:i,updateAgent:s,deleteAgent:p,toggleAgent:a}=DH(P,N),{providers:H0,configuredProviders:d,fetchProviders:B0}=EH(P),c=d.filter((o)=>o.type==="llm"),v0=D1.useMemo(()=>{if(N===null)return S.length;if(N==="unassigned")return S.filter((o)=>!o.projectId).length;return S.filter((o)=>o.projectId===N).length},[S,N]),[C,e]=D1.useState(!1),[l,u]=D1.useState(null),[q0,t]=D1.useState("dashboard"),[Z0,K0]=D1.useState(null),[h0,f0]=D1.useState(0),[m,Q0]=D1.useState(!1);D1.useEffect(()=>{if(!P)return;(async()=>{try{let n1="/api/tasks?status=pending";if(N!==null)n1+=`&project_id=${encodeURIComponent(N)}`;let d1=await fetch(n1,{headers:F()});if(d1.ok){let U4=await d1.json();f0(U4.count??(U4.tasks||[]).length)}}catch{}})()},[P,L,N,S,U,I]);let[k0,D0]=D1.useState({name:"",model:"",provider:"",systemPrompt:"You are a helpful assistant.",features:{...SH},mcpServers:[],skills:[]});D1.useEffect(()=>{if(c.length>0&&!k0.provider){let o=c[0],n1=o.models.find((d1)=>d1.recommended)?.value||o.models[0]?.value||"";D0((d1)=>({...d1,provider:o.id,model:n1}))}},[c,k0.provider]),D1.useEffect(()=>{if(l){let o=S.find((n1)=>n1.id===l.id);if(o)u(o);else u(null)}},[S,l]);let r0=(o)=>{let n1=H0.find((U4)=>U4.id===o),d1=n1?.models.find((U4)=>U4.recommended)?.value||n1?.models[0]?.value||"";D0((U4)=>({...U4,provider:o,model:d1}))},G4=async()=>{if(!k0.name)return;await i(k0),await M();let o=c[0],n1=o?.models.find((d1)=>d1.recommended)?.value||o?.models[0]?.value||"";D0({name:"",model:n1,provider:o?.id||"",systemPrompt:"You are a helpful assistant.",features:{...SH},mcpServers:[],skills:[]}),e(!1)},f=async(o,n1)=>{n1?.stopPropagation(),K0(null);let d1=await a(o);if(d1.error)K0(d1.error)},Y0=async(o,n1)=>{if(n1?.stopPropagation(),l?.id===o)u(null);await p(o),await M()},i0=(o)=>{u(o),K0(null),t("agents")},U1=(o)=>{t(o),u(null)},O6=()=>{O(!0),B0(),R()};if(H||_===null)return Q1.jsxDEV(tz,{fullScreen:!0},void 0,!1,void 0,this);if(!_)return Q1.jsxDEV(_Y,{onComplete:O6,needsAccount:!0},void 0,!1,void 0,this);if(!G)return Q1.jsxDEV(gJ,{},void 0,!1,void 0,this);if(y===null)return Q1.jsxDEV(tz,{fullScreen:!0},void 0,!1,void 0,this);if(!y)return Q1.jsxDEV(_Y,{onComplete:O6,needsAccount:!1},void 0,!1,void 0,this);return Q1.jsxDEV("div",{className:"h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex flex-col overflow-hidden",children:[Q1.jsxDEV(fJ,{onMenuClick:()=>Q0(!0),agents:S},void 0,!1,void 0,this),Z0&&Q1.jsxDEV(jJ,{message:Z0,onDismiss:()=>K0(null)},void 0,!1,void 0,this),Q1.jsxDEV("div",{className:"flex flex-1 overflow-hidden",children:[Q1.jsxDEV(pJ,{route:q0,agentCount:v0,taskCount:h0,onNavigate:U1,isOpen:m,onClose:()=>Q0(!1)},void 0,!1,void 0,this),Q1.jsxDEV("main",{className:"flex-1 overflow-hidden flex",children:Q1.jsxDEV(D1.Suspense,{fallback:Q1.jsxDEV(tz,{},void 0,!1,void 0,this),children:[q0==="settings"&&Q1.jsxDEV(kM,{},void 0,!1,void 0,this),q0==="activity"&&Q1.jsxDEV(yM,{agents:S,loading:E,onNavigate:t},void 0,!1,void 0,this),q0==="agents"&&Q1.jsxDEV(rJ,{agents:S,loading:E,selectedAgent:l,providers:H0,onSelectAgent:i0,onCloseAgent:()=>u(null),onToggleAgent:f,onDeleteAgent:Y0,onUpdateAgent:s,onNewAgent:()=>e(!0),canCreateAgent:c.length>0},void 0,!1,void 0,this),q0==="dashboard"&&Q1.jsxDEV(tJ,{agents:S,loading:E,runningCount:V,configuredProviders:d,onNavigate:U1,onSelectAgent:i0},void 0,!1,void 0,this),q0==="tasks"&&Q1.jsxDEV(VM,{},void 0,!1,void 0,this),q0==="connections"&&Q1.jsxDEV(fM,{},void 0,!1,void 0,this),q0==="mcp"&&Q1.jsxDEV(CM,{},void 0,!1,void 0,this),q0==="skills"&&Q1.jsxDEV(SM,{},void 0,!1,void 0,this),q0==="tests"&&Q1.jsxDEV(DM,{},void 0,!1,void 0,this),q0==="telemetry"&&Q1.jsxDEV(EM,{},void 0,!1,void 0,this),q0==="api"&&Q1.jsxDEV(mM,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&Q1.jsxDEV(aJ,{form:k0,providers:H0,configuredProviders:d,onFormChange:D0,onProviderChange:r0,onCreate:G4,onClose:()=>e(!1),onGoToSettings:()=>{e(!1),t("settings")}},void 0,!1,void 0,this),Q1.jsxDEV(M2,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pM(){return Q1.jsxDEV(l2,{children:Q1.jsxDEV(c2,{children:Q1.jsxDEV(F2,{children:Q1.jsxDEV(x2,{children:Q1.jsxDEV(hM,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var jM=d2.createRoot(document.getElementById("root"));jM.render(Q1.jsxDEV(pM,{},void 0,!1,void 0,this));
266
266
 
267
267
  //# debugId=D66F0EA9B889DBCB64756E2164756E21
@@ -1,3 +1,3 @@
1
- import{c as a}from"./App.4ehxpt48.js";import"./App.ncgc9cxy.js";import"./App.yv87t9m5.js";import"./App.p0fb1pds.js";import"./App.mvtqv6qc.js";export{a as SettingsPage};
1
+ import{c as a}from"./App.80301vdb.js";import"./App.ncgc9cxy.js";import"./App.yv87t9m5.js";import"./App.p0fb1pds.js";import"./App.mvtqv6qc.js";export{a as SettingsPage};
2
2
 
3
3
  //# debugId=96AC58639A6F59EB64756E2164756E21