import{r as h,aQ as v,aJ as e}from"./@ui-core-DKdciH1Z.js";import{x as S,bH as g,e as y,I as j,B as N,bL as b,c9 as w,bC as E,y as F,k as I}from"./index-D7KLAbvI.js";import{u as K}from"./update-server-settings-mutation-qr9WBMBs.js";import{z as i,u as P,t as Q}from"./@zod-DKyD3xVW.js";import"./@react-router-DaIuhn3X.js";import"./@reactflow-CJzATMj6.js";import"./@monaco-editor-CSMpaClf.js";const k=i.object({serverName:i.string().min(1)});function q(){const r=h.useId(),{toast:t}=S(),a=v(),{isError:n,isPending:l,data:o}=g({throwOnError:!0}),{mutate:c,isPending:m}=K({onError(s){E(s)&&t({status:"error",emphasis:"subtle",icon:e.jsx(F,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:s.message,rounded:!0})},onSuccess:async()=>{a.invalidateQueries({queryKey:b()}),a.invalidateQueries({queryKey:w()}),t({status:"success",emphasis:"subtle",rounded:!0,description:"Server Settings updated successfully"}),x()}}),{handleSubmit:u,register:d,reset:x,formState:{isValid:p}}=P({resolver:Q(k)});function f(s){c({server_name:s.serverName})}return n?null:l?e.jsx(y,{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(j,{placeholder:o.body?.server_name,...d("serverName"),id:r,className:"w-full"})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{disabled:m||!p,size:"md",intent:"primary",children:"Update"})})]})})}function H(){return e.jsxs(I,{className:"flex flex-col gap-5 p-5",children:[e.jsx("h1",{className:"text-text-xl font-semibold",children:"General"}),e.jsx(q,{})]})}export{H as default};
