import{c as T,r as c,u as Le,j as e,a as Te,b as Ae,P as V,d as H,e as Ie,f as K,g as ee,q as N,s as y,h as _,i as F,t as p,B as L,S as Z,k as g,I as ae,L as ne}from"./index-DszW2bOJ.js";import{C,a as w,b as S,c as k,d as M,e as O}from"./card-Bxc0HrZ8.js";import{L as P,I as J}from"./label-DLEWKwVs.js";import{S as $,R as A}from"./switch-CgfzYKbb.js";import{c as le,R as Re,I as Ee}from"./index-CTEXMohc.js";import{u as qe,C as oe}from"./index-CdIMhveG.js";import{C as de}from"./circle-x-DqiJ4qlx.js";/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _e=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],U=T("Brain",_e);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ze=T("Globe",Fe);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Oe=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],$e=T("Plug",Oe);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ve=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ie=T("Save",Ve);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ke=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],W=T("Server",Ke);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const De=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],ce=T("SquareTerminal",De);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ge=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ue=T("TriangleAlert",Ge);var D="Tabs",[Qe,xs]=Te(D,[le]),me=le(),[Be,se]=Qe(D),he=c.forwardRef((s,r)=>{const{__scopeTabs:t,value:i,onValueChange:o,defaultValue:d,orientation:a="horizontal",dir:u,activationMode:f="automatic",...v}=s,n=qe(u),[h,l]=Le({prop:i,onChange:o,defaultProp:d??"",caller:D});return e.jsx(Be,{scope:t,baseId:Ae(),value:h,onValueChange:l,orientation:a,dir:n,activationMode:f,children:e.jsx(V.div,{dir:n,"data-orientation":a,...v,ref:r})})});he.displayName=D;var xe="TabsList",ge=c.forwardRef((s,r)=>{const{__scopeTabs:t,loop:i=!0,...o}=s,d=se(xe,t),a=me(t);return e.jsx(Re,{asChild:!0,...a,orientation:d.orientation,dir:d.dir,loop:i,children:e.jsx(V.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:r})})});ge.displayName=xe;var ve="TabsTrigger",fe=c.forwardRef((s,r)=>{const{__scopeTabs:t,value:i,disabled:o=!1,...d}=s,a=se(ve,t),u=me(t),f=be(a.baseId,i),v=Ne(a.baseId,i),n=i===a.value;return e.jsx(Ee,{asChild:!0,...u,focusable:!o,active:n,children:e.jsx(V.button,{type:"button",role:"tab","aria-selected":n,"aria-controls":v,"data-state":n?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:f,...d,ref:r,onMouseDown:H(s.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?a.onValueChange(i):h.preventDefault()}),onKeyDown:H(s.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(i)}),onFocus:H(s.onFocus,()=>{const h=a.activationMode!=="manual";!n&&!o&&h&&a.onValueChange(i)})})})});fe.displayName=ve;var pe="TabsContent",je=c.forwardRef((s,r)=>{const{__scopeTabs:t,value:i,forceMount:o,children:d,...a}=s,u=se(pe,t),f=be(u.baseId,i),v=Ne(u.baseId,i),n=i===u.value,h=c.useRef(n);return c.useEffect(()=>{const l=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(l)},[]),e.jsx(Ie,{present:o||n,children:({present:l})=>e.jsx(V.div,{"data-state":n?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!l,id:v,tabIndex:0,...a,ref:r,style:{...s.style,animationDuration:h.current?"0s":void 0},children:l&&d})})});je.displayName=pe;function be(s,r){return`${s}-trigger-${r}`}function Ne(s,r){return`${s}-content-${r}`}var He=he,Ze=ge,Je=fe,Ue=je;function We({className:s,...r}){return e.jsx(He,{"data-slot":"tabs",className:K("flex flex-col gap-2",s),...r})}function Ye({className:s,...r}){return e.jsx(Ze,{"data-slot":"tabs-list",className:K("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",s),...r})}function Y({className:s,...r}){return e.jsx(Je,{"data-slot":"tabs-trigger",className:K("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),...r})}function X({className:s,...r}){return e.jsx(Ue,{"data-slot":"tabs-content",className:K("flex-1 outline-none",s),...r})}function q(s){return ee({queryKey:N.config.value(s),queryFn:async()=>await y.config.get(s),enabled:!!s})}function Xe(s){const r=_(),{data:t,isLoading:i,error:o,refetch:d}=ee({queryKey:N.server.logs(),queryFn:()=>y.server.getLogs(s),refetchInterval:5e3}),a=F({mutationFn:u=>y.server.clearLogs({type:u}),onSuccess:()=>{r.invalidateQueries({queryKey:N.server.all})}});return{logs:t,isLoading:i,error:o,refetch:d,clearLogs:a.mutate,isClearingLogs:a.isPending}}function es(s={}){const r=_();return F({mutationFn:async({key:t,value:i})=>y.config.set(t,i),onSuccess:(t,i)=>{r.invalidateQueries({queryKey:N.config.value(i.key)}),r.invalidateQueries({queryKey:N.config.all}),(s.invalidateServerLogs||i.key.startsWith("server."))&&r.invalidateQueries({queryKey:N.server.all})}})}function ss(){const s=_();return F({mutationFn:async()=>y.server.restart(),onSuccess:()=>{s.invalidateQueries({queryKey:N.server.all}),p.success("Server restarted",{description:"Server has been restarted with the new configuration"})},onError:r=>{p.error("Failed to restart server",{description:r instanceof Error?r.message:"Unknown error occurred"})}})}function ts(s="all"){const r=_(),{data:t,isLoading:i,error:o,refetch:d}=ee({queryKey:N.server.mcpLogs(s),queryFn:()=>y.server.getMCPLogs({type:s}),staleTime:5e3}),a=F({mutationFn:u=>y.server.clearMCPLogs({type:u}),onSuccess:()=>{r.invalidateQueries({queryKey:N.server.all})}});return{logs:t,isLoading:i,error:o,refetch:d,clearLogs:a.mutate,isClearingLogs:a.isPending}}function rs(){const s=_();return F({mutationFn:async()=>y.server.restartMCP(),onSuccess:()=>{s.invalidateQueries({queryKey:N.server.all}),p.success("MCP Server restarted",{description:"MCP Server has been restarted with the new configuration"})},onError:r=>{console.error("Failed to restart MCP server:",r),p.error("Error restarting MCP server",{description:"Could not restart the MCP server"})}})}function as(){const[s,r]=c.useState("stdout"),[t,i]=c.useState(!1),o=c.useRef(null),{logs:d,isLoading:a,refetch:u,clearLogs:f,isClearingLogs:v}=Xe({type:"all"}),n=c.useMemo(()=>d?Array.isArray(d)?{stdout:d,stderr:[]}:d:{stdout:[],stderr:[]},[d]);c.useEffect(()=>{if(!t)return;const l=setInterval(()=>{u()},5e3);return()=>clearInterval(l)},[t,u]),c.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n]);const h=l=>{f(l),p.success(`${l==="all"?"All":l==="stdout"?"Standard output":"Error"} logs cleared`)};return e.jsxs(C,{className:"border shadow-sm mt-6",children:[e.jsxs(w,{children:[e.jsxs(S,{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Server Logs"]}),e.jsx(k,{children:"View server stdout and stderr logs"})]}),e.jsxs(M,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(g,{variant:s==="stdout"?"default":"outline",size:"sm",onClick:()=>r("stdout"),className:"gap-1",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Standard Output"}),e.jsx("span",{className:"inline sm:hidden",children:"Stdout"}),e.jsx(L,{variant:"secondary",className:"ml-1",children:n.stdout.length})]}),e.jsxs(g,{variant:s==="stderr"?"default":"outline",size:"sm",onClick:()=>r("stderr"),className:"gap-1",children:[e.jsx(ue,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Standard Error"}),e.jsx("span",{className:"inline sm:hidden",children:"Stderr"}),e.jsx(L,{variant:"secondary",className:"ml-1",children:n.stderr.length})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(P,{htmlFor:"auto-refresh",className:"text-sm",children:"Auto-refresh"}),e.jsx($,{id:"auto-refresh",checked:t,onCheckedChange:i})]}),e.jsx(g,{variant:"outline",size:"sm",onClick:()=>u(),disabled:a||v,children:e.jsx(A,{className:`h-4 w-4 ${a?"animate-spin":""}`})}),e.jsx(g,{variant:"outline",size:"sm",onClick:()=>h(s),disabled:a||v,children:e.jsx(de,{className:"h-4 w-4"})})]})]}),e.jsx("div",{ref:o,className:"bg-black text-green-400 p-4 rounded-md font-mono text-sm h-96 overflow-y-auto whitespace-pre-wrap",children:a?e.jsx("div",{className:"text-center py-4",children:e.jsx("div",{className:"animate-pulse",children:"Loading logs..."})}):s==="stdout"?n.stdout.length>0?n.stdout.map((l,j)=>e.jsx("div",{className:"mb-1",children:l},j)):e.jsx("div",{className:"text-gray-500 italic",children:"No standard output logs available"}):n.stderr.length>0?n.stderr.map((l,j)=>e.jsx("div",{className:"text-red-400 mb-1",children:l},j)):e.jsx("div",{className:"text-gray-500 italic",children:"No error logs available"})})]}),e.jsxs(O,{className:"flex justify-between",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:a?"Loading logs...":`Showing ${s==="stdout"?n.stdout.length:n.stderr.length} log entries`}),e.jsx(g,{variant:"destructive",size:"sm",onClick:()=>h("all"),disabled:a||v,children:"Clear All Logs"})]})]})}function ns(){const[s,r]=c.useState("stdout"),[t,i]=c.useState(!1),o=c.useRef(null),{logs:d,isLoading:a,refetch:u,clearLogs:f,isClearingLogs:v}=ts("all"),n=c.useMemo(()=>d?Array.isArray(d)?{stdout:d,stderr:[]}:d:{stdout:[],stderr:[]},[d]);c.useEffect(()=>{if(!t)return;const l=setInterval(()=>{u()},5e3);return()=>clearInterval(l)},[t,u]),c.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n]);const h=l=>{f(l),p.success(`${l==="all"?"All":l==="stdout"?"Standard output":"Error"} logs cleared`)};return e.jsxs(C,{className:"border shadow-sm mt-6",children:[e.jsxs(w,{children:[e.jsxs(S,{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"MCP Server Logs"]}),e.jsx(k,{children:"View MCP server stdout and stderr logs"})]}),e.jsxs(M,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(g,{variant:s==="stdout"?"default":"outline",size:"sm",onClick:()=>r("stdout"),className:"gap-1",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Standard Output"}),e.jsx("span",{className:"inline sm:hidden",children:"Stdout"}),e.jsx(L,{variant:"secondary",className:"ml-1",children:n.stdout.length})]}),e.jsxs(g,{variant:s==="stderr"?"default":"outline",size:"sm",onClick:()=>r("stderr"),className:"gap-1",children:[e.jsx(ue,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Standard Error"}),e.jsx("span",{className:"inline sm:hidden",children:"Stderr"}),e.jsx(L,{variant:"secondary",className:"ml-1",children:n.stderr.length})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(P,{htmlFor:"mcp-auto-refresh",className:"text-sm",children:"Auto-refresh"}),e.jsx($,{id:"mcp-auto-refresh",checked:t,onCheckedChange:i})]}),e.jsx(g,{variant:"outline",size:"sm",onClick:()=>u(),disabled:a||v,children:e.jsx(A,{className:`h-4 w-4 ${a?"animate-spin":""}`})}),e.jsx(g,{variant:"outline",size:"sm",onClick:()=>h(s),disabled:a||v,children:e.jsx(de,{className:"h-4 w-4"})})]})]}),e.jsx("div",{ref:o,className:"bg-black text-green-400 p-4 rounded-md font-mono text-sm h-96 overflow-y-auto whitespace-pre-wrap",children:a?e.jsx("div",{className:"text-center py-4",children:e.jsx("div",{className:"animate-pulse",children:"Loading logs..."})}):s==="stdout"?n.stdout.length>0?n.stdout.map((l,j)=>e.jsx("div",{className:"mb-1",children:l},j)):e.jsx("div",{className:"text-gray-500 italic",children:"No standard output logs available"}):n.stderr.length>0?n.stderr.map((l,j)=>e.jsx("div",{className:"text-red-400 mb-1",children:l},j)):e.jsx("div",{className:"text-gray-500 italic",children:"No error logs available"})})]}),e.jsxs(O,{className:"flex justify-between",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:a?"Loading logs...":`Showing ${s==="stdout"?n.stdout.length:n.stderr.length} log entries`}),e.jsx(g,{variant:"destructive",size:"sm",onClick:()=>h("all"),disabled:a||v,children:"Clear All Logs"})]})]})}function is(){const[s,r]=c.useState(!0),[t,i]=c.useState({enabled:!0,port:5173,corsOrigins:["http://localhost:5173"]}),[o,d]=c.useState(""),[a,u]=c.useState(!1),{data:f,isLoading:v}=q("server.enabled"),{data:n,isLoading:h}=q("server.port"),{data:l,isLoading:j}=q("server.corsOrigins"),x=es({invalidateServerLogs:!0}),I=ss();c.useEffect(()=>{I.isSuccess&&u(!1)},[I.isSuccess]),c.useEffect(()=>{if(!(v||h||j))try{r(!0),console.log("cors config",l),i({enabled:f!=null&&f.value?f.value==="true":!0,port:n!=null&&n.value?parseInt(n.value,10):5173,corsOrigins:l!=null&&l.value?JSON.parse(l.value):["http://localhost:5173"]})}catch(m){console.error("Failed to parse server configuration:",m),p.error("Error loading settings",{description:"Could not load server configuration"})}finally{r(!1)}},[f,n,l,v,h,j]);const ye=async()=>{try{r(!0),await x.mutateAsync({key:"server.enabled",value:t.enabled.toString()}),await x.mutateAsync({key:"server.port",value:t.port.toString()}),await x.mutateAsync({key:"server.corsOrigins",value:JSON.stringify(t.corsOrigins)}),p.success("Settings saved",{description:"Server configuration has been updated"}),u(!0)}catch(m){console.error("Failed to save server configuration:",m),p.error("Error saving settings",{description:"Could not save server configuration"})}finally{r(!1)}},Ce=()=>{I.mutate()},we=()=>{o&&!t.corsOrigins.includes(o)&&(i({...t,corsOrigins:[...t.corsOrigins,o]}),d(""))},Se=m=>{i({...t,corsOrigins:t.corsOrigins.filter(Pe=>Pe!==m)})},[b,G]=c.useState({enabled:!1,port:3e3}),[Q,B]=c.useState(!1),{data:z,isLoading:te}=q("mcpServer.enabled"),{data:R,isLoading:re}=q("mcpServer.port"),E=rs();c.useEffect(()=>{E.isSuccess&&B(!1)},[E.isSuccess]),c.useEffect(()=>{if(!(te||re))try{G({enabled:(z==null?void 0:z.value)==="true",port:R!=null&&R.value?parseInt(R.value,10):3e3})}catch(m){console.error("Failed to parse MCP server configuration:",m),p.error("Error loading MCP settings",{description:"Could not load MCP server configuration"})}},[z,R,te,re]);const ke=async()=>{try{r(!0),await x.mutateAsync({key:"mcpServer.enabled",value:b.enabled.toString()}),await x.mutateAsync({key:"mcpServer.port",value:b.port.toString()}),p.success("MCP Settings saved",{description:"MCP Server configuration has been updated"}),B(!0)}catch(m){console.error("Failed to save MCP server configuration:",m),p.error("Error saving MCP settings",{description:"Could not save MCP server configuration"})}finally{r(!1)}},Me=()=>{E.mutate()};return v||h||j?e.jsx("div",{className:"container mx-auto p-6 max-w-4xl flex items-center justify-center h-[50vh]",children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"border-4 border-primary/30 border-t-primary rounded-full w-12 h-12 animate-spin"}),e.jsx("p",{className:"text-muted-foreground mt-4",children:"Loading settings..."})]})}):e.jsx("div",{className:"min-h-full bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50 p-6",children:e.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"inline-flex items-center justify-center p-4 bg-gradient-to-r from-blue-500 to-purple-600 rounded-2xl text-white shadow-lg",children:e.jsx(W,{className:"h-8 w-8"})}),e.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-gray-900 to-gray-600 bg-clip-text text-transparent",children:"Settings"}),e.jsx("p",{className:"text-lg text-gray-600 max-w-2xl mx-auto",children:"Configure your server and application settings for optimal performance."})]}),e.jsxs(We,{defaultValue:"server",className:"w-full",children:[e.jsxs(Ye,{className:"grid w-full grid-cols-3 bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg",children:[e.jsxs(Y,{value:"server",className:"flex items-center gap-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-purple-600 data-[state=active]:text-white",children:[e.jsx(W,{className:"h-4 w-4"}),"API Server"]}),e.jsxs(Y,{value:"mcpServer",className:"flex items-center gap-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-purple-600 data-[state=active]:text-white",children:[e.jsx(U,{className:"h-4 w-4"}),"MCP Server"]}),e.jsxs(Y,{value:"general",className:"flex items-center gap-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-purple-600 data-[state=active]:text-white",disabled:!0,children:[e.jsx($e,{className:"h-4 w-4"}),"General"]})]}),e.jsxs(X,{value:"server",className:"mt-6",children:[e.jsxs(C,{className:"bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg",children:[e.jsx(w,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-gradient-to-r from-blue-500 to-cyan-500 rounded-lg text-white",children:e.jsx(W,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx(S,{className:"text-xl font-semibold",children:"Server Configuration"}),e.jsx(k,{className:"mt-1 text-gray-600",children:"Configure the built-in API server for receiving logs"})]})]}),e.jsx(L,{variant:t.enabled?"default":"outline",className:"mt-1",children:t.enabled?"Enabled":"Disabled"})]})}),e.jsxs(M,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(P,{htmlFor:"server-enabled",children:"Server Status"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Enable or disable the API server"})]}),e.jsx($,{id:"server-enabled",checked:t.enabled,onCheckedChange:m=>i({...t,enabled:m}),disabled:s||x.isPending})]}),e.jsx(Z,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"server-port",children:"Server Port"}),e.jsx(J,{id:"server-port",type:"number",min:"1000",max:"65535",value:t.port,onChange:m=>i({...t,port:parseInt(m.target.value,10)||5173}),disabled:s||!t.enabled||x.isPending}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The port number the server will listen on (default: 5173)"})]}),e.jsx(Z,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(P,{children:"CORS Origins"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{placeholder:"http://example.com",value:o,onChange:m=>d(m.target.value),disabled:s||!t.enabled||x.isPending}),e.jsx(g,{variant:"outline",onClick:we,disabled:s||!t.enabled||!o||x.isPending,children:"Add"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Specify allowed origins for Cross-Origin Resource Sharing"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:t.corsOrigins.map(m=>e.jsxs(L,{variant:"secondary",className:"pl-2 flex items-center gap-1",children:[e.jsx(ze,{className:"h-3 w-3 mr-1"}),m,e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>Se(m),className:"h-4 w-4 p-0 ml-1 text-muted-foreground hover:text-foreground",disabled:s||!t.enabled||x.isPending,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-3 w-3",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m))})]}),a&&e.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-900 rounded-md p-4 mt-6",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx(ae,{className:"h-5 w-5 text-amber-500 mt-0.5"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("h3",{className:"text-sm font-medium text-amber-800 dark:text-amber-300",children:"Server Restart Required"}),e.jsx("div",{className:"mt-1 text-sm text-amber-700 dark:text-amber-400",children:e.jsx("p",{children:"You'll need to restart the server for the configuration changes to take effect."})})]})]})})]}),e.jsxs(O,{className:"flex justify-end gap-3 pt-2",children:[e.jsxs(g,{variant:"outline",onClick:()=>u(!1),disabled:s||!a||x.isPending,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Restart Later"]}),a&&e.jsxs(g,{variant:"default",onClick:Ce,disabled:s||I.isPending||x.isPending,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Restart Now"]}),e.jsxs(g,{onClick:ye,disabled:s||x.isPending||I.isPending,children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]})]}),e.jsxs(C,{className:"border shadow-sm mt-6",children:[e.jsxs(w,{children:[e.jsxs(S,{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(ne,{className:"h-5 w-5"}),"API Endpoints"]}),e.jsx(k,{children:"The server exposes these endpoints when enabled"})]}),e.jsx(M,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border p-4",children:[e.jsx("h3",{className:"font-medium",children:"API Root"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["http://localhost:",t.port,"/api"]})]}),e.jsxs("div",{className:"rounded-md border p-4",children:[e.jsx("h3",{className:"font-medium",children:"Swagger UI"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["http://localhost:",t.port,"/ui"]})]}),e.jsxs("div",{className:"rounded-md border p-4",children:[e.jsx("h3",{className:"font-medium",children:"API Documentation"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["http://localhost:",t.port,"/doc"]})]})]})})})]}),e.jsx(as,{})]}),e.jsxs(X,{value:"mcpServer",className:"mt-6",children:[e.jsxs(C,{className:"bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg",children:[e.jsx(w,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-gradient-to-r from-purple-500 to-pink-500 rounded-lg text-white",children:e.jsx(U,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx(S,{className:"text-xl font-semibold",children:"MCP Server Configuration"}),e.jsx(k,{className:"mt-1 text-gray-600",children:"Configure the Model Context Protocol server for AI agent access"})]})]}),e.jsx(L,{variant:b.enabled?"default":"outline",className:"mt-1",children:b.enabled?"Enabled":"Disabled"})]})}),e.jsxs(M,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(P,{htmlFor:"mcp-server-enabled",children:"MCP Server Status"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Enable or disable the MCP server for LLM agents"})]}),e.jsx($,{id:"mcp-server-enabled",checked:b.enabled,onCheckedChange:m=>G({...b,enabled:m}),disabled:s||x.isPending})]}),e.jsx(Z,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"mcp-server-port",children:"MCP Server Port"}),e.jsx(J,{id:"mcp-server-port",type:"number",min:"1000",max:"65535",value:b.port,onChange:m=>G({...b,port:parseInt(m.target.value,10)||3e3}),disabled:s||!b.enabled||x.isPending}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The port number the MCP server will listen on (default: 3000)"})]}),Q&&e.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-900 rounded-md p-4 mt-6",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx(ae,{className:"h-5 w-5 text-amber-500 mt-0.5"}),e.jsxs("div",{className:"ml-3",children:[e.jsx("h3",{className:"text-sm font-medium text-amber-800 dark:text-amber-300",children:"MCP Server Restart Required"}),e.jsx("div",{className:"mt-1 text-sm text-amber-700 dark:text-amber-400",children:e.jsx("p",{children:"You'll need to restart the MCP server for the configuration changes to take effect."})})]})]})})]}),e.jsxs(O,{className:"flex justify-end gap-3 pt-2",children:[e.jsxs(g,{variant:"outline",onClick:()=>B(!1),disabled:s||!Q||x.isPending,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Restart Later"]}),Q&&e.jsxs(g,{variant:"default",onClick:Me,disabled:s||E.isPending||x.isPending,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Restart Now"]}),e.jsxs(g,{onClick:ke,disabled:s||x.isPending||E.isPending,children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]})]}),e.jsxs(C,{className:"border shadow-sm mt-6",children:[e.jsxs(w,{children:[e.jsxs(S,{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(ne,{className:"h-5 w-5"}),"MCP Endpoint"]}),e.jsx(k,{children:"The MCP server exposes this endpoint when enabled"})]}),e.jsx(M,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"rounded-md border p-4",children:[e.jsx("h3",{className:"font-medium",children:"MCP Endpoint"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["http://localhost:",b.port,"/mcp"]})]})})})]}),e.jsxs(C,{className:"border shadow-sm mt-6",children:[e.jsxs(w,{children:[e.jsxs(S,{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(U,{className:"h-5 w-5"}),"Available MCP Tools"]}),e.jsx(k,{children:"Tools accessible to AI agents via the MCP protocol"})]}),e.jsx(M,{children:e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:"Mcp tools will be available in a future update"})})})]}),e.jsx(ns,{})]}),e.jsx(X,{value:"general",children:e.jsx("div",{className:"flex items-center justify-center p-12 text-muted-foreground",children:"General settings will be available in a future update"})})]})]})})}const gs=is;export{gs as component};
