import{j as e}from"./@radix-D8tIKeo-.js";import{w as h,bw as v,e as S,I as g,B as j,bA as y,bZ as N,bs as b,x as w,k as E}from"./index-B44sgOyQ.js";import{u as F}from"./update-server-settings-mutation-tWPwIrcY.js";import{z as i,u as I,t as K}from"./@zod-2qqdh1cM.js";import{h as P}from"./@tanstack-nMqraTcu.js";import{a as k}from"./@monaco-editor-CuNQBT0l.js";import"./@elkjs-CmhuJAjY.js";import"./@react-router-D1ODL_Ub.js";import"./@reactflow-DgowYF6H.js";const q=i.object({serverName:i.string().min(1)});function B(){const r=k.useId(),{toast:t}=h(),a=P(),{isError:n,isPending:o,data:l}=v({throwOnError:!0}),{mutate:m,isPending:c}=F({onError(s){b(s)&&t({status:"error",emphasis:"subtle",icon:e.jsx(w,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:s.message,rounded:!0})},onSuccess:async()=>{a.invalidateQueries({queryKey:y()}),a.invalidateQueries({queryKey:N()}),t({status:"success",emphasis:"subtle",rounded:!0,description:"Server Settings updated successfully"}),x()}}),{handleSubmit:u,register:d,reset:x,formState:{isValid:p}}=I({resolver:K(q)});function f(s){m({server_name:s.serverName})}return n?null:o?e.jsx(S,{className:"h-[150px] max-w-[600px]"}):e.jsx("div",{className:"w-full max-w-[600px]",children:e.jsxs("form",{className:"space-y-2",onSubmit:u(f),children:[e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("label",{htmlFor:r,className:"text-text-sm",children:"Server Name"}),e.jsx(g,{placeholder:l.body?.server_name,...d("serverName"),id:r,className:"w-full"})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{disabled:c||!p,size:"md",intent:"primary",children:"Update"})})]})})}function R(){return e.jsxs(E,{className:"flex flex-col gap-5 p-5",children:[e.jsx("h1",{className:"text-text-xl font-semibold",children:"General"}),e.jsx(B,{})]})}export{R as default};
