1import{xt as v,xu as y,xv as w,Gv as L,Nr as O,r as g,a as p,m as e,Gy as S,Gz as D,GA as C,Ns as P,M7 as A,Nt as I,GD as F,HT as T,HU as k,HX as $,Nu as H,Nv as M,Nw as V,a5 as c,Bo as B,GL as U,Nx as q,mU as d,Ny as R,Nz as K,y as X,Gw as Z,Gx as J,NA as G,NB as Q,GC as W,GE as Y,GF as ee,GG as se,GI as te,NC as ae,GK as re,ND as ne,a3 as b,NE as ie,NF as oe,GO as le,GP as de,NG as ce,NH as ue,NI as me,NJ as ge,NK as fe,NL as xe,NM as pe,NN as _e,NO as he,NP as je,Z as Ne,NQ as be,NR as ve,NS as ye,NT as we,NU as Se,NV as De,NW as Ce,NX as Ae,NY as Fe,NZ as E,N_ as Ue,N$ as ze,O0 as Re,O1 as Ge}from"./main-BVeaUmEJ.js";import{F as z}from"./form-error-CDvabrWN.js";import{I as Ee}from"./input-CMDz5b2G.js";import{D as Le}from"./dashboard-layout-CHxiVnU7.js";import"./useRegisterFieldControl-Cddb0p1S.js";v({method:"GET"}).middleware([y]).handler(w("24b0c5d2d185ff0502a3eb8beea797bc15e51dec1254b9bd8fc77841bade6e65"));v({method:"POST"}).middleware([y]).handler(w("2e7f69933c453cebbf080d56f3ea7c1fea07e3eb51de28bf06b1adbcb621290a"));const Oe=v({method:"POST"}).middleware([y]).handler(w("7253aed829d94f7a6fde270c120575deabae90f0e950d67e644fee015ed9da85"));function Pe(){return L({mutationFn:async s=>{const t=new FormData;return t.append("file",s),t.append("isPublic","true"),t.append("folder",O),Oe({data:t})}})}function Ie({className:s}){const[t,n]=g.useState(""),[u,i]=g.useState(""),{data:a,refetch:_}=p.useSession(),r=Pe();g.useEffect(()=>{a?.user?.image&&i(a.user.image)},[a]);const h=a?.user;if(!h)return null;const f=o=>{const l=o.target.files?.[0];l&&m(l),o.target.value=""},m=o=>{const l=X.storage?.maxFileSize;if(o.size>l){n("File size exceeds the server limit"),d.error("File size exceeds the server limit");return}n("");const x=URL.createObjectURL(o);i(x),r.mutate(o,{onSuccess:N=>{p.updateUser({image:N.url},{onSuccess:()=>{i(N.url),URL.revokeObjectURL(x),d.success(K()),_()},onError:j=>{n(`${j.error.status}: ${j.error.message}`),a?.user?.image&&i(a.user.image),URL.revokeObjectURL(x),d.error(R())}})},onError:N=>{const j=N.message||R();n(j),a?.user?.image&&i(a.user.image),URL.revokeObjectURL(x),d.error(j)}})};return e.jsxs(S,{className:c("w-full overflow-hidden py-0 pt-6 flex flex-col",s),children:[e.jsxs(D,{children:[e.jsx(C,{className:"text-lg font-semibold",children:P()}),e.jsx(A,{children:I()})]}),e.jsxs(F,{className:"space-y-4 flex-1",children:[e.jsxs("div",{className:"flex flex-col items-center sm:flex-row gap-4 sm:gap-8",children:[e.jsxs(T,{className:"h-16 w-16 border",children:[e.jsx(k,{src:u??"",alt:h.name??""}),e.jsx($,{className:"absolute inset-0",children:e.jsx(H,{className:"h-8 w-8 text-muted-foreground"})})]}),e.jsxs("label",{className:c(B({variant:"outline",size:"sm"}),"cursor-pointer",r.isPending&&"pointer-events-none opacity-50"),children:[e.jsx("input",{type:"file",accept:"image/png, image/jpeg, image/webp",onChange:f,className:"sr-only",disabled:r.isPending}),r.isPending?M():V()]})]}),e.jsx(z,{message:t})]}),e.jsx(U,{className:"mt-auto px-6 py-4 flex justify-between items-center bg-muted rounded-none",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:q()})})]})}const Te=le({name:de().min(3,{message:ce()}).max(30,{message:ue()})});function ke({className:s}){const[t,n]=g.useState(!1),[u,i]=g.useState(void 0),{data:a,refetch:_}=p.useSession(),r=Z({resolver:J(Te),defaultValues:{name:a?.user?.name||""}});if(g.useEffect(()=>{a?.user?.name&&r.setValue("name",a.user.name)},[a,r]),!a?.user)return null;const f=async m=>{m.name!==a?.user?.name&&await p.updateUser({name:m.name},{onRequest:()=>{n(!0),i("")},onResponse:()=>{n(!1)},onSuccess:()=>{d.success(ge()),_(),r.reset({name:m.name})},onError:o=>{i(`${o.error.status}: ${o.error.message}`),d.error(me())}})};return e.jsxs(S,{className:c("w-full overflow-hidden pt-6 pb-0 flex flex-col",s),children:[e.jsxs(D,{children:[e.jsx(C,{className:"text-lg font-semibold",children:G()}),e.jsx(A,{children:Q()})]}),e.jsx(W,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(f),className:"flex flex-col flex-1",children:[e.jsxs(F,{className:"space-y-4 flex-1",children:[e.jsx(Y,{control:r.control,name:"name",render:({field:m})=>e.jsxs(ee,{children:[e.jsx(se,{children:G()}),e.jsx(te,{children:e.jsx(Ee,{placeholder:ae(),...m})}),e.jsx(re,{})]})}),e.jsx(z,{message:u})]}),e.jsxs(U,{className:"mt-6 px-6 py-4 flex justify-between items-center bg-muted rounded-none",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:ne()}),e.jsx(b,{type:"submit",disabled:t,children:t?ie():oe()})]})]})})]})}function $e(s){return fe(s,"alert-dialog")}function He({...s}){return e.jsx($e,{"data-slot":"alert-dialog",...s})}function Me({...s}){return e.jsx(he,{"data-slot":"alert-dialog-portal",...s})}function Ve({className:s,...t}){return e.jsx(je,{"data-slot":"alert-dialog-overlay",className:c("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",s),...t})}function Be({className:s,size:t="default",...n}){return e.jsxs(Me,{children:[e.jsx(Ve,{}),e.jsx(xe,{"data-slot":"alert-dialog-content","data-size":t,className:c("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 roun
1ded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",s),...n})]})}function qe({className:s,...t}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:c("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",s),...t})}function Ke({className:s,...t}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:c("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",s),...t})}function Xe({className:s,...t}){return e.jsx(pe,{"data-slot":"alert-dialog-title",className:c("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",s),...t})}function Ze({className:s,...t}){return e.jsx(_e,{"data-slot":"alert-dialog-description",className:c("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",s),...t})}function Je(){const[s,t]=g.useState(!1),[n,u]=g.useState(!1),[i,a]=g.useState(""),{data:_,refetch:r}=p.useSession(),h=Ne(),f=_?.user;if(!f)return null;const m=f.subscriptionStatus==="active"||f.subscriptionStatus==="trialing",o=async()=>{if(m){const l=E();a(l),d.error(l),u(!1);return}await p.deleteUser({},{onRequest:()=>{t(!0),a("")},onResponse:()=>{t(!1),u(!1)},onSuccess:()=>{d.success(ze()),r(),h({to:"/"})},onError:l=>{if(l.error.message?.includes("ACTIVE_SUBSCRIPTION")){const x=E();a(x),d.error(x);return}a(`${l.error.status}: ${l.error.message}`),d.error(Ue())}})};return e.jsxs(S,{className:c("w-full border-destructive/50 overflow-hidden pt-6 pb-0 flex flex-col"),children:[e.jsxs(D,{children:[e.jsx(C,{className:"text-lg font-bold text-destructive",children:be()}),e.jsx(A,{children:ve()})]}),e.jsxs(F,{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:ye()}),i&&e.jsx("div",{className:"mt-4",children:e.jsx(z,{message:i})})]}),e.jsx(U,{className:"mt-2 px-6 py-4 flex justify-end items-center bg-muted rounded-none",children:e.jsx(b,{variant:"destructive",onClick:()=>u(!0),children:we()})}),e.jsx(He,{open:n,onOpenChange:u,children:e.jsxs(Be,{children:[e.jsxs(qe,{children:[e.jsx(Xe,{className:"text-destructive",children:Se()}),e.jsx(Ze,{children:De()})]}),e.jsxs(Ke,{className:"flex justify-end gap-3",children:[e.jsx(b,{variant:"outline",onClick:()=>u(!1),children:Ce()}),e.jsx(b,{variant:"destructive",onClick:o,disabled:s,children:s?Ae():Fe()})]})]})})]})}function ts(){return e.jsx(Le,{title:Ge(),description:Re(),children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:e.jsx(ke,{})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:e.jsx(Ie,{})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:e.jsx(Je,{})})]})})}export{ts as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.