import{n as e}from"./chunk-QTnfLwEv.js";import{C as t,D as n,G as r,H as i,L as a,Y as o,Z as s,_ as c,a as l,et as u,k as d,m as f,o as p,w as m,x as h}from"./app-BdTWMBT0.js";import{n as g}from"./toast-BeKI3aDC.js";import{t as _}from"./i18n-DPFOIxhg.js";import{t as v}from"./UploadButton-KCIkFDeN.js";import{n as y}from"./upload-CsRIgK58.js";import{t as b}from"./InputLabel-B5PE1ru4.js";var x={class:`text-lg font-medium text-gray-900 dark:text-gray-100`},S={class:`mt-1 text-sm text-gray-600 dark:text-gray-400`},C={class:`mt-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700`},w={class:`h-28 w-full bg-gradient-to-r from-indigo-500 to-violet-500`},T=[`src`],E={class:`mt-2 flex items-center gap-4`},D=[`src`],O={key:1,class:`grid h-16 w-16 place-items-center rounded-full bg-indigo-500 font-bold text-white`},k=[`placeholder`],A={class:`mt-1 text-xs text-gray-500`},j={class:`text-sm text-gray-500 dark:text-gray-400`},M={key:0},N={key:1},P=d({__name:`ProfileDetailsForm`,setup(e){let d=p().props.auth?.user??{},P=l({bio:d.bio??``,avatar:d.avatar_path??``,cover:d.cover_path??``}),F=o(null);async function I(e,t){F.value=e;try{let{url:n}=await y(t);P[e]=n}catch{}finally{F.value=null}}function L(){P.post(route(`profile.details`),{preserveScroll:!0,onSuccess:()=>g(_(`Profile saved`))})}let R=null;return i(()=>[P.bio,P.avatar,P.cover],()=>{R&&clearTimeout(R),R=setTimeout(L,800)}),(e,i)=>(a(),m(`section`,null,[h(`header`,null,[h(`h2`,x,u(s(_)(`Profile`)),1),h(`p`,S,u(s(_)(`Your cover image, avatar and bio shown on your public profile.`)),1)]),h(`form`,{class:`mt-6 space-y-6`,onSubmit:c(L,[`prevent`])},[h(`div`,null,[n(b,{value:s(_)(`Cover image`)},null,8,[`value`]),h(`div`,C,[h(`div`,w,[s(P).cover?(a(),m(`img`,{key:0,src:s(P).cover,alt:``,class:`h-28 w-full object-cover`},null,8,T)):t(``,!0)])]),n(v,{class:`mt-2`,uploading:F.value===`cover`,label:s(_)(`Choose cover`),accept:`image/*`,onFile:i[0]||=e=>I(`cover`,e)},null,8,[`uploading`,`label`])]),h(`div`,null,[n(b,{value:s(_)(`Avatar`)},null,8,[`value`]),h(`div`,E,[s(P).avatar?(a(),m(`img`,{key:0,src:s(P).avatar,alt:``,class:`h-16 w-16 rounded-full object-cover`},null,8,D)):(a(),m(`span`,O,u((s(d).name??`?`)[0]),1)),n(v,{uploading:F.value===`avatar`,label:s(_)(`Choose avatar`),accept:`image/*`,onFile:i[1]||=e=>I(`avatar`,e)},null,8,[`uploading`,`label`])])]),h(`div`,null,[n(b,{for:`bio`,value:s(_)(`Bio`)},null,8,[`value`]),r(h(`textarea`,{id:`bio`,"onUpdate:modelValue":i[2]||=e=>s(P).bio=e,rows:`3`,maxlength:`500`,class:`mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300`,placeholder:s(_)(`Tell the community about yourself…`)},null,8,k),[[f,s(P).bio]]),h(`p`,A,u(s(P).bio.length)+`/500`,1)]),h(`p`,j,[s(P).processing||F.value?(a(),m(`span`,M,u(s(_)(`Saving…`)),1)):(a(),m(`span`,N,u(s(_)(`Changes save automatically.`)),1))])],32)]))}}),F=e({default:()=>I}),I=P;export{F as n,I as t};