import{u as w,r as b,b as v,j as e,cJ as y}from"./vendor-BKmmeuxg.js";import{I as C}from"./input-error-LaPr_4wd.js";import{L as I}from"./loading-button-BnTVAMJ7.js";import{C as E}from"./card-D9_SJYq6.js";import{I as F}from"./input-DM0goJrn.js";import"./utils-DxSsnXxD.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";const J=()=>{const{props:r}=w(),{translate:o}=r,{input:n,button:i,common:L,dashboard:c}=o,{name:p,photo:d}=r.auth.user,[l,x]=b.useState(d),{data:u,setData:m,post:h,errors:t,clearErrors:f,processing:g}=v({name:p,photo:null}),j=s=>{s.preventDefault(),f(),h(route("settings.profile"))},N=s=>{const a=s.target.files;a&&a[0]&&(m("photo",a[0]),x(URL.createObjectURL(a[0])))};return e.jsx(E,{className:"p-4 sm:p-6",children:e.jsxs("form",{onSubmit:j,className:"flex flex-col items-center gap-6 md:flex-row",children:[e.jsxs("div",{className:"flex w-full flex-col items-center text-center md:max-w-[250px]",children:[e.jsxs("div",{className:"relative mb-4 h-[100px] w-[100px] md:h-[120px] md:w-[120px]",children:[l?e.jsx("img",{alt:"item-1",src:l,className:"h-[100px] w-[100px] rounded-full md:h-[120px] md:w-[120px]"}):e.jsx("div",{className:"h-[100px] w-[100px] rounded-full bg-gray-300 md:h-[120px] md:w-[120px]"}),e.jsx("label",{htmlFor:"formFileSm",className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:e.jsx("div",{className:"flex h-10 w-10 cursor-pointer items-center justify-center rounded-full bg-gray-100",children:e.jsx(y,{className:"h-6 w-6 text-gray-500"})})}),e.jsx("input",{hidden:!0,id:"formFileSm",type:"file",onChange:N})]}),e.jsx("small",{className:"text-gray-500",children:c.image_upload_requirements}),t.photo&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:t.photo})]}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"mt-6 mb-10",children:[e.jsx(F,{required:!0,type:"name",name:"name",value:u.name,placeholder:n.name_placeholder,onChange:s=>m("name",s.target.value)}),e.jsx(C,{message:t.name,className:"mt-2"})]}),e.jsx(I,{loading:g,className:"h-9 w-full",children:i.save_changes})]})]})})};export{J as default};