1import{_ as y}from"./BsqTxom4.js";import{u as P,s as k,j as U,l as v,r as w,q as A,c as b,b as e,w as C,f as u,v as f,m as s,t as i,g as E,o as x}from"#entry";const V={class:"grid grid-cols-1 lg:grid-cols-3 gap-8"},I={class:"lg:col-span-2"},j={class:"bg-white rounded-xl shadow-lg p-6"},M={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},T=["value"],F={class:"pt-4"},L=["disabled"],R={key:0},S={key:1},z={class:"space-y-6"},B={class:"bg-white rounded-xl shadow-lg p-6 text-center"},G={class:"w-24 h-24 bg-gradient-to-br from-blue-500 to-blue-600 rounded-full flex items-center justify-center mx-auto mb-4"},O={class:"text-3xl font-bold text-white"},$={class:"text-lg font-semibold text-gray-900"},q={class:"text-sm text-gray-500"},H={class:"mt-4"},J={class:"inline-flex px-3 py-1 text-xs font-medium bg-blue-100 text-blue-800 rounded-full"},K={class:"bg-white rounded-xl shadow-lg p-6"},Q={class:"space-y-4"},W={class:"flex items-center justify-between"},X={class:"relative inline-flex items-center cursor-pointer"},Y={class:"bg-white rounded-xl shadow-lg p-6"},Z={class:"space-y-3"},ee={class:"flex justify-between text-sm"},te={class:"font-mono text-gray-900"},se={class:"flex justify-between text-sm"},le={class:"text-gray-900"},oe={class:"flex justify-between text-sm"},ae={class:"inline-flex px-2 py-1 text-xs font-medium bg-blue-100 text-blue-800 rounded-full"},de={__name:"perfil",setup(re){P({title:"Mi Perfil - AutoVentas360",meta:[{name:"robots",content:"noindex, nofollow"}]});const g=k(),{$firebaseAuth:n,$firestore:_}=U(),o=v(()=>g.user),h=v(()=>o.value?.displayName?.charAt(0).toUpperCase()||"U"),l=w({displayName:"",phone:"",subscribeNewsletter:!1}),d=w(!1);A(()=>{o.value&&(l.value={displayName:o.value.displayName||"",phone:o.value.phone||"",subscribeNewsletter:o.value.subscribeNewsletter||!1})});const p=r=>r?new Intl.DateTimeFormat("es-CL",{year:"numeric",month:"long",day:"numeric"}).format(new Date(r)):"No disponible",N=async()=>{d.value=!0;try{const{updateProfile:r}=await y(async()=>{const{updateProfile:c}=await import("#entry").then(m=>m.aD);return{updateProfile:c}},[],import.meta.url),{doc:t,setDoc:a}=await y(async()=>{const{doc:c,setDoc:m}=await import("#entry").then(D=>D.aC);return{doc:c,setDoc:m}},[],import.meta.url);n?.currentUser&&(await r(n.currentUser,{displayName:l.value.displayName}),await a(t(_,"users",n.currentUser.uid),{displayName:l.value.displayName,phone:l.value.phone,subscribeNewsletter:l.value.subscribeNewsletter,updatedAt:new Date},{merge:!0}),await g.loadUserData(n.currentUser.uid),alert("Perfil actualizado correctamente"))}catch(r){console.error("Error actualizando perfil:",r),alert("Error al actualizar el perfil")}finally{d.value=!1}};return(r,t)=>(x(),b("div",null,[t[17]||(t[17]=e("div",{class:"mb-8"},[e("h1",{class:"text-3xl font-bold text-gray-900"},"Mi Perfil"),e("p",{class:"text-gray-600 mt-2"},"Gestiona tu información personal y preferencias")],-1)),e("div",V,[e("div",I,[e("div",j,[t[9]||(t[9]=e("h2",{class:"text-xl font-semibold text-gray-900 mb-6"},"Información Personal",-1)),e("form",{onSubmit:C(N,["prevent"]),class:"space-y-6"},[e("div",M,[e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Nombre completo",-1)),u(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>s(l).displayName=a),type:"text",class:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Tu nombre completo"},null,512),[[f,s(l).displayName]])]),e("div",null,[t[5]||(t[5]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Correo electrónico",-1)),u(e("input",{"onUpdate:modelValue":t[1]||(t[1]=a=>s(l).email=a),type:"email",disabled:"",class:"w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-50 text-gray-500"},null,512),[[f,s(l).email]]),t[6]||(t[6]=e("p",{class:"text-xs text-gray-500 mt-1"},"El email no se puede cambiar",-1))]),e("div",null,[t[7]||(t[7]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Teléfono",-1)),u(e("input",{"onUpdate:modelValue":t[2]||(t[2]=a=>s(l).phone=a),type:"tel",class:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"+56912345678"},null,512),[[f,s(l).phone]])]),e("div",null,[t[8]||(t[8]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Fecha de registro",-1)),e("input",{value:p(s(o)?.createdAt),type:"text",disabled:"",class:"w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-50 text-gray-500"},null,8,T)])]),e("div",F,[e("button",{type:"submit",disabled:s(d),class:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:bg-gray-400 transition-colors font-medium"},[s(d)?(x(),b("span",R,"Guardando...")):(x(),b("span",S,"Guardar Cambios"))],8,L)])],32)])]),e("div",z,[e("div",B,[e("div",G,[e("span",O,i(s(h)),1)]),e("h3",$,i(s(o)?.dis
1playName||"Usuario"),1),e("p",q,i(s(o)?.email),1),e("div",H,[e("span",J," Cliente desde "+i(p(s(o)?.createdAt)),1)])]),e("div",K,[t[12]||(t[12]=e("h3",{class:"text-lg font-semibold text-gray-900 mb-4"},"Preferencias",-1)),e("div",Q,[e("div",W,[t[11]||(t[11]=e("div",null,[e("p",{class:"text-sm font-medium text-gray-900"},"Newsletter"),e("p",{class:"text-xs text-gray-500"},"Recibir ofertas y novedades")],-1)),e("label",X,[u(e("input",{"onUpdate:modelValue":t[3]||(t[3]=a=>s(l).subscribeNewsletter=a),type:"checkbox",class:"sr-only peer"},null,512),[[E,s(l).subscribeNewsletter]]),t[10]||(t[10]=e("div",{class:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"},null,-1))])])])]),e("div",Y,[t[16]||(t[16]=e("h3",{class:"text-lg font-semibold text-gray-900 mb-4"},"Información de Cuenta",-1)),e("div",Z,[e("div",ee,[t[13]||(t[13]=e("span",{class:"text-gray-500"},"ID de Usuario:",-1)),e("span",te,i(s(o)?.uid?.substring(0,8))+"...",1)]),e("div",se,[t[14]||(t[14]=e("span",{class:"text-gray-500"},"Ãltimo acceso:",-1)),e("span",le,i(p(s(o)?.lastLogin)),1)]),e("div",oe,[t[15]||(t[15]=e("span",{class:"text-gray-500"},"Rol:",-1)),e("span",ae,i(s(o)?.role||"cliente"),1)])])])])])]))}};export{de 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.