import{B as e,C as t,D as n,E as r,F as i,Q as a,S as o,U as s,Y as c,a as l,b as u,et as d,g as f,i as p,p as m,q as h}from"./app-DEnkw3Nx.js";import{t as g}from"./i18n-BUZiPKGD.js";import{n as _}from"./toast-B4K9E4GI.js";import{n as v}from"./upload-CsRIgK58.js";import{t as y}from"./InputLabel-B6MMJC1q.js";var b={class:`text-lg font-medium text-gray-900 dark:text-gray-100`},x={class:`mt-1 text-sm text-gray-600 dark:text-gray-400`},S={class:`mt-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700`},C={class:`h-28 w-full bg-gradient-to-r from-indigo-500 to-violet-500`},w=[`src`],T={key:0,class:`ml-2 text-sm text-gray-500`},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={key:2,class:`text-sm text-gray-500`},A=[`placeholder`],j={class:`mt-1 text-xs text-gray-500`},M={class:`text-sm text-gray-500 dark:text-gray-400`},N={key:0},P={key:1},F=n({__name:`ProfileDetailsForm`,setup(n){let d=l().props.auth?.user??{},F=p({bio:d.bio??``,avatar:d.avatar_path??``,cover:d.cover_path??``}),I=h(null);async function L(e,t){let n=t.target.files?.[0];if(n){I.value=e;try{let{url:t}=await v(n);F[e]=t}catch{}finally{I.value=null}}}function R(){F.post(route(`profile.details`),{preserveScroll:!0,onSuccess:()=>_(g(`Profile saved`))})}let z=null;return e(()=>[F.bio,F.avatar,F.cover],()=>{z&&clearTimeout(z),z=setTimeout(R,800)}),(e,n)=>(i(),t(`section`,null,[u(`header`,null,[u(`h2`,b,a(c(g)(`Profile`)),1),u(`p`,x,a(c(g)(`Your cover image, avatar and bio shown on your public profile.`)),1)]),u(`form`,{class:`mt-6 space-y-6`,onSubmit:f(R,[`prevent`])},[u(`div`,null,[r(y,{value:c(g)(`Cover image`)},null,8,[`value`]),u(`div`,S,[u(`div`,C,[c(F).cover?(i(),t(`img`,{key:0,src:c(F).cover,alt:``,class:`h-28 w-full object-cover`},null,8,w)):o(``,!0)])]),u(`input`,{type:`file`,accept:`image/*`,class:`mt-2 text-sm text-gray-600 dark:text-gray-400`,onChange:n[0]||=e=>L(`cover`,e)},null,32),I.value===`cover`?(i(),t(`span`,T,a(c(g)(`Uploading…`)),1)):o(``,!0)]),u(`div`,null,[r(y,{value:c(g)(`Avatar`)},null,8,[`value`]),u(`div`,E,[c(F).avatar?(i(),t(`img`,{key:0,src:c(F).avatar,alt:``,class:`h-16 w-16 rounded-full object-cover`},null,8,D)):(i(),t(`span`,O,a((c(d).name??`?`)[0]),1)),u(`input`,{type:`file`,accept:`image/*`,class:`text-sm text-gray-600 dark:text-gray-400`,onChange:n[1]||=e=>L(`avatar`,e)},null,32),I.value===`avatar`?(i(),t(`span`,k,a(c(g)(`Uploading…`)),1)):o(``,!0)])]),u(`div`,null,[r(y,{for:`bio`,value:c(g)(`Bio`)},null,8,[`value`]),s(u(`textarea`,{id:`bio`,"onUpdate:modelValue":n[2]||=e=>c(F).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:c(g)(`Tell the community about yourself…`)},null,8,A),[[m,c(F).bio]]),u(`p`,j,a(c(F).bio.length)+`/500`,1)]),u(`p`,M,[c(F).processing||I.value?(i(),t(`span`,N,a(c(g)(`Saving…`)),1)):(i(),t(`span`,P,a(c(g)(`Changes save automatically.`)),1))])],32)]))}}),I=d({default:()=>L}),L=F;export{I as n,L as t};