import{f as v,a as o,c as _}from"../chunks/vfPE-AD7.js";import{p as B,o as D,c as G,d as m,s as d,g as e,u as H,f as J,e as x,r as h,i as y,t as K}from"../chunks/DhUiKsxN.js";import{s as N}from"../chunks/Dsv8gxIT.js";import{i as c,s as O,a as Q}from"../chunks/DUil1G3I.js";import{g as b}from"../chunks/b2QY-nV2.js";import{r as w}from"../chunks/DyqxJaEr.js";import{p as R}from"../chunks/B2gI4nmm.js";import{p as T}from"../chunks/QNXDtpsh.js";import{p as U}from"../chunks/DEcqogKB.js";import{P as V}from"../chunks/CwpRVHMW.js";import"../chunks/BWzyK28a.js";var W=v('<div class="text-center py-12 text-muted-foreground">Loading profile...</div>'),X=v('<div class="text-center py-12 text-red-500"> </div>'),Y=v('<div class="max-w-2xl mx-auto"><h1 class="text-2xl font-bold mb-6">Edit Server Profile</h1> <!></div>');function na(S,P){B(P,!0);const C=()=>Q(R,"$page",E),[E,F]=O();let i=d(null),u=d(!0),l=d(null);const g=H(()=>parseInt(C().params.id??"0",10));D(async()=>{try{m(i,await T.get(e(g)),!0)}catch(a){m(l,a instanceof Error?a.message:"Failed to load profile",!0)}finally{m(u,!1)}});async function I(a){await U.update(e(g),a),await b(w("/profiles"))}async function $(){await b(w("/profiles"))}var f=Y(),k=J(x(f),2);{var L=a=>{var s=W();o(a,s)},M=a=>{var s=_(),j=y(s);{var q=t=>{var r=X(),p=x(r,!0);h(r),K(()=>N(p,e(l))),o(t,r)},z=t=>{var r=_(),p=y(r);{var A=n=>{V(n,{get profile(){return e(i)},onSubmit:I,onCancel:$})};c(p,n=>{e(i)&&n(A)},!0)}o(t,r)};c(j,t=>{e(l)?t(q):t(z,!1)},!0)}o(a,s)};c(k,a=>{e(u)?a(L):a(M,!1)})}h(f),o(S,f),G(),F()}export{na as component};
