1import{K as N,r as p,m as C,j as e,S as b}from"./app-DDm4dLCY.js";import{I as n}from"./input-error-Wh-X1cuu.js";import{B as l}from"./button-D9X3vUxO.js";import{C as S,a as I,b as w,c as k,d as D,e as F}from"./card-DifmMaC0.js";import{I as h}from"./input-BjisokTd.js";import{L as i}from"./label-ByReZhaM.js";/* empty css */function T({user:o,className:f=""}){var m;const x=N(),t=p.useRef(null),[s,c]=p.useState(null),a=C({_method:"PUT",name:o.name,email:o.email,photo:null}),d=()=>{var r;(r=t.current)!=null&&r.value&&(t.current.value=null)},j=()=>{t.current&&a.transform(r=>({...r,photo:t.current.files[0]})),a.post(route("user-profile-information.update"),{errorBag:"updateProfileInformation",preserveScroll:!0,onSuccess:()=>d()})},v=()=>{t.current.click()},g=()=>{const r=t.current.files[0];if(!r)return;const u=new FileReader;u.onload=y=>{c(y.target.result)},u.readAsDataURL(r)},P=()=>{b.delete(route("current-user-photo.destroy"),{preserveScroll:!0,onSuccess:()=>{c(null),d()}})};return e.jsx(S,{className:f,children:e.jsxs("form",{className:"contents",onSubmit:r=>{r.preventDefault(),j()},children:[e.jsxs(I,{children:[e.jsx(w,{children:"Profile Information"}),e.jsx(k,{children:"Update your account's profile information and email address."})]}),e.jsxs(D,{className:"space-y-6",children:[((m=x.props.jetstream)==null?void 0:m.managesProfilePhotos)&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("input",{type:"file",className:"hidden",ref:t,onChange:g}),e.jsx(i,{htmlFor:"photo",children:"Photo"}),e.jsx("div",{className:"mt-1",style:{display:s?"none":""},children:e.jsx("img",{src:o.profile_photo_url,alt:o.name,className:"h-20 w-20 rounded-full object-cover"})}),e.jsx("div",{className:"mt-1",style:{display:s?"":"none"},children:e.jsx("span",{className:"block h-20 w-20 rounded-full",style:{backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundImage:`url('${s}')`}})}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.jsx(l,{variant:"outline",type:"button",onClick:r=>{r.preventDefault(),v()},children:"Select A New Photo"}),o.profile_photo_path&&e.jsx(l,{variant:"outline",type:"button",onClick:r=>{r.preventDefault(),P()},children:"Remove Photo"})]}),e.jsx(n,{message:a.errors.photo})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(i,{htmlFor:"name",children:"Name"}),e.jsx(h,{id:"name",type:"text",value:a.data.name,onChange:r=>a.setData("name",r.target.value),autoComplete:"name","aria-invalid":a.errors.name?!0:void 0}),e.jsx(n,{message:a.errors.name})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(i,{htmlFor:"email",children:"Email"}),e.jsx(h,{id:"email",type:"email",value:a.data.email,onChange:r=>a.setData("email",r.target.value),"aria-invalid":a.errors.email?!0:void 0}),e.jsx(n,{message:a.errors.email})]})]}),e.jsxs(F,{className:"justify-end gap-3",children:[a.recentlySuccessful&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved."}),e.jsx(l,{type:"submit",disabled:a.processing,children:"Save"})]})]})})}export{T as default};
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.