import{r as S,j as e}from"./@radix-C7hRs6Kx.js";import{z as i,f as v,u as g,S as j,I as N,h as y,ay as b,ar as w,i as E,B as F}from"./index-D2iSHVZq.js";import{u as I}from"./update-server-settings-mutation-DwMM1LJz.js";import{t as P}from"./zod-C0xYeTvL.js";import{c as B}from"./@tanstack-CSxjHCME.js";import{u as G}from"./index.esm-D7jFlf5N.js";import"./@react-router-CNP6g_RL.js";import"./@reactflow-CQi1Z1Wq.js";const k=i.object({serverName:i.string().min(1)});function q(){var a;const r=S.useId(),{toast:t}=v(),n=B(),{isError:o,isPending:l,data:m}=g({throwOnError:!0}),{mutate:c,isPending:u}=I({onError(s){w(s)&&t({status:"error",emphasis:"subtle",icon:e.jsx(E,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:s.message,rounded:!0})},onSuccess:async()=>{await n.invalidateQueries({queryKey:b()}),t({status:"success",emphasis:"subtle",rounded:!0,description:"Server Settings updated successfully"}),p()}}),{handleSubmit:d,register:x,reset:p,formState:{isValid:f}}=G({resolver:P(k)});function h(s){c({server_name:s.serverName})}return o?null:l?e.jsx(j,{className:"h-[150px] max-w-[600px]"}):e.jsx("div",{className:"w-full max-w-[600px]",children:e.jsxs("form",{className:"space-y-2",onSubmit:d(h),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(N,{placeholder:(a=m.body)==null?void 0:a.server_name,...x("serverName"),id:r,className:"w-full"})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(y,{disabled:u||!f,size:"md",intent:"primary",children:"Update"})})]})})}function O(){return e.jsxs(F,{className:"flex flex-col gap-5 p-5",children:[e.jsx("h1",{className:"text-text-xl font-semibold",children:"General"}),e.jsx(q,{})]})}export{O as default};
