import{r as e}from"./rolldown-runtime-hePW80VL.js";import{o as t}from"./vendor-forms-yQg41KHz.js";import{t as n}from"./vendor-react-CAGJwf-T.js";import{c as r,t as i}from"./api-sqDSbqTC.js";import{t as a}from"./createLucideIcon-FT8xbHot.js";import{n as o}from"./hooks-CIB34lAK.js";import{D as s,T as c,nt as l}from"./index-Z_bdWDpJ.js";import{a as u,i as d,n as f,r as p,t as m}from"./Card-CBjYg7NQ.js";import{t as h}from"./AccountLayout-eU_RVnjA.js";var g=a(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),_=e(t(),1),v=n();function y(){let e=o(e=>e.auth.user),[t,n]=(0,_.useState)(e?.full_name||``),[a,h]=(0,_.useState)(e?.email||``),[y,b]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{i.get(`/auth/me/`).then(e=>{e.data.full_name&&n(e.data.full_name),e.data.email&&h(e.data.email)}).catch(()=>{})},[]),(0,v.jsx)(`div`,{children:(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(m,{children:[(0,v.jsxs)(d,{children:[(0,v.jsx)(u,{children:`Profile Photo`}),(0,v.jsx)(p,{children:`This image is displayed across the platform next to your name.`})]}),(0,v.jsx)(f,{children:(0,v.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,v.jsxs)(`div`,{className:`relative group`,children:[(0,v.jsx)(l,{fallback:e?.full_name||`Admin`,size:`xl`}),(0,v.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity cursor-pointer`,children:(0,v.jsx)(g,{className:`w-5 h-5 text-white`})})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(s,{variant:`outline`,size:`sm`,children:`Upload photo`}),(0,v.jsx)(s,{variant:`ghost`,size:`sm`,children:`Remove`})]}),(0,v.jsx)(`p`,{className:`text-[12px] text-[var(--color-text-muted)]`,children:`JPG, PNG or GIF. Recommended size 256x256px. Max 2MB.`})]})]})})]}),(0,v.jsxs)(m,{children:[(0,v.jsxs)(d,{children:[(0,v.jsx)(u,{children:`Personal Information`}),(0,v.jsx)(p,{children:`Update your name and contact details.`})]}),(0,v.jsxs)(f,{children:[(0,v.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-5 gap-y-4 max-w-2xl`,children:[(0,v.jsx)(c,{label:`Full Name`,value:t,onChange:e=>n(e.target.value),placeholder:`Enter your full name`}),(0,v.jsx)(c,{label:`Email Address`,type:`email`,value:a,onChange:e=>h(e.target.value),placeholder:`Enter your email`}),(0,v.jsx)(c,{label:`Phone Number`,value:e?.phone||``,disabled:!0,hint:`Phone number cannot be changed.`}),(0,v.jsx)(c,{label:`Role`,value:e?.user_type?e.user_type.charAt(0).toUpperCase()+e.user_type.slice(1):`Admin`,disabled:!0})]}),(0,v.jsx)(`div`,{className:`mt-6 pt-5 border-t border-[var(--color-border-light)] flex justify-end`,children:(0,v.jsx)(s,{onClick:async()=>{b(!0);try{await i.patch(`/auth/me/`,{full_name:t,email:a}),r.success(`Profile updated successfully`)}catch{r.error(`Failed to update profile`)}finally{b(!1)}},isLoading:y,children:`Save changes`})})]})]})]})})}function b(){return(0,v.jsx)(h,{title:`My Profile`,description:`Your personal information, avatar, and contact details.`,children:(0,v.jsx)(y,{})})}export{b as default};