import{i as E,T as F,d as v,c as V,w as l,o as p,g as i,t as r,u as e,e as $,a as n,b as t,v as h,J as _,X as A,l as g,f as y,q as D,n as R,y as T}from"./app-WJL2kJBE.js";import{_ as z}from"./Button-B1uOz4tP.js";import{_ as L}from"./FormSection-VZbtMXdy.js";import{_ as C}from"./Input-C4-VG2dv.js";import{_ as k}from"./InputError-idDGfizs.js";import{_ as b}from"./Label-CBaaVbfI.js";import{_ as q}from"./ActionMessage-CbAgcH97.js";import{_ as I}from"./SecondaryButton-DT9RUAGX.js";import"./SectionTitle-DsJypKOL.js";const J={key:0,class:"col-span-6 sm:col-span-4"},M={class:"mt-2"},O=["src","alt"],X={class:"mt-2"},Y={class:"col-span-6 sm:col-span-4"},G={class:"col-span-6 sm:col-span-4"},H={key:0},K={class:"text-sm mt-2"},re={__name:"UpdateProfileInformationForm",props:{user:Object},setup(u){const{t:s}=E({}),P=u,o=F({_method:"PUT",name:P.user.name,email:P.user.email,photo:null}),w=v(null),d=v(null),m=v(null),x=()=>{m.value&&(o.photo=m.value.files[0]),o.post(route("user-profile-information.update"),{errorBag:"updateProfileInformation",preserveScroll:!0,onSuccess:()=>S()})},N=()=>{w.value=!0},U=()=>{m.value.click()},B=()=>{const a=m.value.files[0];if(!a)return;const c=new FileReader;c.onload=f=>{d.value=f.target.result},c.readAsDataURL(a)},j=()=>{T.delete(route("current-user-photo.destroy"),{preserveScroll:!0,onSuccess:()=>{d.value=null,S()}})},S=()=>{var a;(a=m.value)!=null&&a.value&&(m.value.value=null)};return(a,c)=>(p(),V(L,{onSubmitted:x},{title:l(()=>[i(r(e(s)("Profile Information")),1)]),description:l(()=>[i(r(e(s)("Update your account's profile information and email address.")),1)]),form:l(()=>[a.$page.props.jetstream.managesProfilePhotos?(p(),$("div",J,[n("input",{ref_key:"photoInput",ref:m,type:"file",class:"hidden",onChange:B},null,544),t(b,{for:"photo",value:"Photo"}),h(n("div",M,[n("img",{src:u.user.profile_photo_url,alt:u.user.name,class:"rounded-full h-20 w-20 object-cover"},null,8,O)],512),[[_,!d.value]]),h(n("div",X,[n("span",{class:"block rounded-full w-20 h-20 bg-cover bg-no-repeat bg-center",style:A("background-image: url('"+d.value+"');")},null,4)],512),[[_,d.value]]),t(I,{class:"mt-2 mr-2",type:"button",onClick:g(U,["prevent"])},{default:l(()=>[i(r(e(s)("Select A New Photo")),1)]),_:1}),u.user.profile_photo_path?(p(),V(I,{key:0,type:"button",class:"mt-2",onClick:g(j,["prevent"])},{default:l(()=>[i(r(e(s)("Remove Photo")),1)]),_:1})):y("",!0),t(k,{message:e(o).errors.photo,class:"mt-2"},null,8,["message"])])):y("",!0),n("div",Y,[t(b,{for:"name",value:"Name"}),t(C,{id:"name",modelValue:e(o).name,"onUpdate:modelValue":c[0]||(c[0]=f=>e(o).name=f),type:"text",class:"mt-1 block w-full",autocomplete:"name"},null,8,["modelValue"]),t(k,{message:e(o).errors.name,class:"mt-2"},null,8,["message"])]),n("div",G,[t(b,{for:"email",value:"Email"}),t(C,{id:"email",modelValue:e(o).email,"onUpdate:modelValue":c[1]||(c[1]=f=>e(o).email=f),type:"email",class:"mt-1 block w-full"},null,8,["modelValue"]),t(k,{message:e(o).errors.email,class:"mt-2"},null,8,["message"]),a.$page.props.jetstream.hasEmailVerification&&u.user.email_verified_at===null?(p(),$("div",H,[n("p",K,[i(r(e(s)("Your email address is unverified."))+" ",1),t(e(D),{href:a.route("verification.send"),method:"post",as:"button",class:"underline text-gray-600 hover:text-gray-900",onClick:g(N,["prevent"])},{default:l(()=>[i(r(e(s)("Click here to re-send the verification email.")),1)]),_:1},8,["href"])]),h(n("div",{class:"mt-2 font-medium text-sm text-green-600"},r(e(s)("A new verification link has been sent to your email address.")),513),[[_,w.value]])])):y("",!0)])]),actions:l(()=>[t(q,{on:e(o).recentlySuccessful,class:"mr-3"},{default:l(()=>[i(r(e(s)("Saved.")),1)]),_:1},8,["on"]),t(z,{class:R({"opacity-25":e(o).processing}),disabled:e(o).processing},{default:l(()=>[i(r(e(s)("Save")),1)]),_:1},8,["class","disabled"])]),_:1}))}};export{re as default};
