PageSourceSearch

https://sanatorioadventista.com.py/assets/Profile-CDeCG1ij.js

js sanatorioadventista.com.py collected 2026-10-05 01:04:07 UTC 23,865 bytes, 22 lines download raw bytes

1import{j as e}from"./vendor-ui-g10SgzjB.js";import{f as W,r as m}from"./vendor-react-Emc0KnY3.js";import{a as U,b as H}from"./vendor-query-CbEodMD_.js";import{u as X}from"./index.esm-aYQ7RHqU.js";import{z as T,t as $}from"./index-Kgw0f4VF.js";import{u as K,c as z,J as w,a as I,k as V}from"./index-C824qTAF.js";import{L as G}from"./Layout-BkfCksVb.js";import{B as k}from"./button-BhpaK5ac.js";import{I as S}from"./input-CoIZ6DZE.js";import{L as y}from"./label-Di0oOt0y.js";import{C as P,a as A,b as E,c as L,d as F}from"./card-DTTklYLn.js";import{T as J,a as Y,b as B,c as M}from"./tabs-B_-SaMsD.js";import{S as C}from"./switch-Baf8ufWd.js";import{u as O}from"./use-toast-DgzTit35.js";import{A as Q,a as Z}from"./alert-TZFII7sS.js";import{P as ee}from"./progress-CI0gpe50.js";import{T as se}from"./triangle-alert-D4XSFrIy.js";import{U as te}from"./user-BtpGq_lC.js";import{S as q}from"./separator-DIjRsnqQ.js";import{C as ae}from"./circle-x-CzUCFpPJ.js";import{C as re}from"./circle-alert-BFpWTK74.js";import{C as ie}from"./circle-check-gQeEdvQ5.js";import{S as D}from"./shield-Da3GVXGY.js";import{c as _}from"./createLucideIcon-DVPlqSGT.js";import{S as ne}from"./shield-check-Ctuh152C.js";import{K as oe}from"./key-mqtyzAQI.js";import{E as ce}from"./eye-off-DzMNSo9k.js";import{E as le}from"./eye-B9oe8oJA.js";import{L as R}from"./loader-circle-CHVhGhLy.js";import{S as de}from"./smartphone-B5zv93Et.js";import{B as ue}from"./badge-D8BnrTPm.js";import{S as me}from"./settings-DlPtOCai.js";import{B as he}from"./bell-DGrPyTj6.js";import{L as fe}from"./LogoutConfirmDialog-CyMTZkXm.js";import{L as pe}from"./log-out-CpQPanyN.js";import"./vendor-charts-CGg_YTLH.js";import"./vendor-supabase-DK0VcjvI.js";import"./alert-dialog-C9TzzIGZ.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const xe=_("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const ge=_("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const je=_("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const ye=_("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),be=()=>{const{profile:s}=K(),t=[{key:"first_name",label:"Nombre"},{key:"last_name",label:"Apellido"},{key:"email",label:"Email"}];if(!s)return{isComplete:!1,missingFields:["Perfil no encontrado"],completionPercentage:0};const i=[];t.forEach(l=>{const d=s[l.key];(!d||typeof d=="string"&&d.trim()==="")&&i.push(l.label)});const o=Math.round((t.length-i.length)/t.length*100);return{isComplete:i.length===0,missingFields:i,completionPercentage:o}},Ne=()=>{const s=W(),{isComplete:t,missingFields:i,completionPercentage:o}=be();return t?null:e.jsxs(Q,{className:"mb-4 border-orange-200 bg-orange-50",children:[e.jsx(se,{className:"h-4 w-4 text-orange-600"}),e.jsxs(Z,{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsxs("span",{className:"font-medium text-orange-800",children:["Completa tu perfil (",o,"%)"]})}),e.jsx(ee,{value:o,className:"h-2 mb-2"}),e.jsxs("p",{className:"text-sm text-orange-700",children:["Faltan: ",i.join(", ")
21]})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>s("/profile"),className:"ml-4 border-orange-300 text-orange-700 hover:bg-orange-100",children:[e.jsx(te,{className:"w-4 h-4 mr-1"}),"Completar Perfil"]})]})]})},ve=()=>{const[s,t]=m.useState(!1),[i,o]=m.useState(null),l=async a=>{const n=new TextEncoder().encode(a),c=await crypto.subtle.digest("SHA-1",n);return Array.from(new Uint8Array(c)).map(h=>h.toString(16).padStart(2,"0")).join("").toUpperCase()},d=async a=>{try{const u=await l(a),n=u.substring(0,5),c=u.substring(5),f=await fetch(`https://api.pwnedpasswords.com/range/${n}`,{headers:{"Add-Padding":"true"}});if(!f.ok)return{isBreached:!1,count:0};const r=(await f.text()).split(`
22`);for(const N of r){const[v,x]=N.split(":");if(v.trim()===c)return{isBreached:!0,count:parseInt(x.trim(),10)}}return{isBreached:!1,count:0}}catch{return{isBreached:!1,count:0}}},j=a=>{const u=[];let n=0;a.length<8?u.push("La contraseña debe tener al menos 8 caracteres"):(n+=20,a.length>=12&&(n+=10),a.length>=16&&(n+=10)),/[A-Z]/.test(a)?n+=15:u.push("Debe incluir al menos una letra mayúscula"),/[a-z]/.test(a)?n+=15:u.push("Debe incluir al menos una letra minúscula"),/[0-9]/.test(a)?n+=15:u.push("Debe incluir al menos un número"),/[!@#$%^&*(),.?":{}|<>_\-+=\[\]\\\/~`]/.test(a)?n+=15:u.push("Debe incluir al menos un carácter especial (!@#$%^&*...)");const c=[/^12345/,/^qwerty/i,/^password/i,/^123456/,/^abcdef/i,/(.)\1{2,}/];for(const f of c)if(f.test(a)){u.push("Evita patrones comunes o caracteres repetidos"),n=Math.max(0,n-20);break}return{score:Math.min(100,n),errors:u}};return{checkPassword:m.useCallback(async a=>{t(!0);try{const{score:u,errors:n}=j(a);let c={isBreached:!1,count:0};n.length===0&&(c=await d(a));const f=[...n];c.isBreached&&f.unshift(`Esta contraseña apareció en ${c.count.toLocaleString()} filtraciones de datos. Elige otra.`);const h={isBreached:c.isBreached,breachCount:c.count,isStrong:u>=60&&!c.isBreached,strengthScore:c.isBreached?0:u,errors:f};return o(h),h}finally{t(!1)}},[]),isChecking:s,lastResult:i}},we=({strengthScore:s,errors:t,isBreached:i,isChecking:o})=>{const l=()=>i?"Comprometida":s<30?"Muy débil":s<50?"Débil":s<70?"Moderada":s<90?"Fuerte":"Muy fuerte",d=()=>i||s<30?"bg-destructive":s<50?"bg-orange-500":s<70?"bg-yellow-500":s<90?"bg-emerald-400":"bg-emerald-500",j=()=>o?e.jsx(D,{className:"h-4 w-4 animate-pulse text-muted-foreground"}):i?e.jsx(ge,{className:"h-4 w-4 text-destructive"}):s>=60&&t.length===0?e.jsx(ne,{className:"h-4 w-4 text-emerald-500"}):e.jsx(D,{className:"h-4 w-4 text-muted-foreground"});return e.jsxs("div",{className:"space-y-2 mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[j(),e.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:z("h-full transition-all duration-300",d()),style:{width:`${i?100:s}%`}})}),e.jsx("span",{className:z("text-xs font-medium",i?"text-destructive":s>=70?"text-emerald-500":"text-muted-foreground"),children:o?"Verificando...":l()})]}),t.length>0&&e.jsx("ul",{className:"space-y-1",children:t.map((p,a)=>e.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[p.includes("filtración")||p.includes("Comprometida")?e.jsx(ae,{className:"h-3.5 w-3.5 text-destructive mt-0.5 shrink-0"}):e.jsx(re,{className:"h-3.5 w-3.5 text-amber-500 mt-0.5 shrink-0"}),e.jsx("span",{className:z(p.includes("filtración")?"text-destructive":"text-muted-foreground"),children:p})]},a))}),t.length===0&&s>=60&&!i&&!o&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-emerald-500",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Contraseña segura"})]})]})};function Ce(){const[s,t]=m.useState(!1),[i,o]=m.useState(""),[l,d]=m.useState(""),[j,p]=m.useState(""),[a,u]=m.useState(!1),[n,c]=m.useState(!1),{checkPassword:f,isChecking:h,lastResult:r}=ve();m.useEffect(()=>{if(l.length>=8){const x=setTimeout(()=>{f(l)},500);return()=>clearTimeout(x)}},[l,f]);const N=async x=>{if(x.preventDefault(),l!==j){w.error("Las contraseñas no coinciden");return}const g=await f(l);if(g.isBreached){w.error("Esta contraseña ha sido expuesta en filtraciones de datos. Elige otra.");return}if(!g.isStrong){w.error(g.errors[0]||"La contraseña no cumple con los requisitos de seguridad.");return}try{t(!0);const{error:b}=await I.auth.updateUser({password:l});if(b)throw b;w.success("Contraseña actualizada exitosamente"),o(""),d(""),p("")}catch(b){console.error("Error updating password:",b),w.error(b.message||"Error al actualizar la contraseña")}finally{t(!1)}},v=async x=>{try{t(!0),c(x),x?w.success("Autenticación de dos factores habilitada"):w.success("Autenticación de dos factores deshabilitada")}catch(g){console.error("Error toggling 2FA:",g),w.error("Error al cambiar la configuración de 2FA")}finally{t(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(P,{children:[e.jsxs(A,{children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5"}),"Cambiar Contraseña"]}),e.jsx(L,{children:"Actualiza tu contraseña para mantener tu cuenta segura"})]}),e.jsx(F,{children:e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"current-password",children:"Contraseña Actual"}),e.jsx(S,{id:"current-password",type:"password",value:i,onChange:x=>o(x.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"new-password",children:"Nueva Contraseña"}),e.jsxs("div",{className:"relative",children:[e.jsx(S,{id:"new-password",type:a?"text":"password",value:l,onCh
22ange:x=>d(x.target.value),required:!0,minLength:8,className:"pr-10"}),e.jsx(k,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>u(!a),children:a?e.jsx(ce,{className:"h-4 w-4"}):e.jsx(le,{className:"h-4 w-4"})})]}),l.length>0&&e.jsx(we,{strengthScore:(r==null?void 0:r.strengthScore)??0,errors:(r==null?void 0:r.errors)??[],isBreached:(r==null?void 0:r.isBreached)??!1,isChecking:h})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"confirm-password",children:"Confirmar Nueva Contraseña"}),e.jsx(S,{id:"confirm-password",type:"password",value:j,onChange:x=>p(x.target.value),required:!0,minLength:8})]}),e.jsxs(k,{type:"submit",disabled:s||h||r&&(!r.isStrong||r.isBreached),children:[s&&e.jsx(R,{className:"mr-2 h-4 w-4 animate-spin"}),h?"Verificando...":"Actualizar Contraseña"]})]})})]}),e.jsx(q,{}),e.jsxs(P,{children:[e.jsxs(A,{children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(de,{className:"h-5 w-5"}),"Autenticación de Dos Factores"]}),e.jsx(L,{children:"Añade una capa extra de seguridad a tu cuenta"})]}),e.jsx(F,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Habilitar 2FA"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Requiere un código de verificación además de tu contraseña"})]}),e.jsx(C,{checked:n,onCheckedChange:v,disabled:s})]})})]}),e.jsx(q,{}),e.jsxs(P,{children:[e.jsxs(A,{children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-5 w-5"}),"Sesiones Activas"]}),e.jsx(L,{children:"Administra dónde está iniciada tu sesión"})]}),e.jsx(F,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Sesión Actual"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:new Date().toLocaleDateString("es-ES",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),e.jsx(k,{variant:"outline",size:"sm",children:"Esta sesión"})]})})})]})]})}const Se=()=>{const[s,t]=m.useState(!1),[i,o]=m.useState(!1),[l,d]=m.useState(null),[j,p]=m.useState(!1),{toast:a}=O();m.useEffect(()=>{(async()=>{if("serviceWorker"in navigator&&"PushManager"in window)try{await V(),t(!0),u()}catch{t(!0)}})()},[]);const u=async()=>{try{const r=await(await navigator.serviceWorker.ready).pushManager.getSubscription();r&&(o(!0),d({endpoint:r.endpoint,keys:{p256dh:btoa(String.fromCharCode(...new Uint8Array(r.getKey("p256dh")))),auth:btoa(String.fromCharCode(...new Uint8Array(r.getKey("auth"))))}}))}catch(h){console.error("Error checking subscription:",h)}};return{isSupported:s,isSubscribed:i,subscription:l,isLoading:j,subscribe:async()=>{if(!s){a({title:"No soportado",description:"Las notificaciones push no están soportadas en este navegador",variant:"destructive"});return}p(!0);try{if(await Notification.requestPermission()!=="granted"){a({title:"Permisos denegados",description:"Para recibir notificaciones, por favor permite el acceso en la configuración del navegador",variant:"destructive"});return}let r;try{r=await V()||await navigator.serviceWorker.ready}catch(x){console.error("Service Worker registration failed:",x),a({title:"Error",description:"No se pudo registrar el Service Worker. Intenta recargar la página.",variant:"destructive"});return}const N=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ke("BEl62iUYgUivxIkv69yViEuiBIa40HI80NkhVCXoNWQRGBx3mLDqjSjrn8BXGMVfWLksNGh0bJ4lWGbwvbIFYmM")}),v={endpoint:N.endpoint,keys:{p256dh:btoa(String.fromCharCode(...new Uint8Array(N.getKey("p256dh")))),auth:btoa(String.fromCharCode(...new Uint8Array(N.getKey("auth"))))}};o(!0),d(v),localStorage.setItem("pushSubscription",JSON.stringify(v)),a({title:"¡Notificaciones activadas!",description:"Recibirás notificaciones sobre el estado de las firmas"})}catch(h){console.error("Error subscribing to push notifications:",h),a({title:"Error",description:"No se pudieron activar las notificaciones. Verifica que tu navegador las soporte.",variant:"destructive"})}finally{p(!1)}},unsubscribe:async()=>{p(!0);try{const r=await(await navigator.serviceWorker.ready).pushManager.getSubscription();r&&(await r.unsubscribe(),o(!1),d(null),localStorage.removeItem("pushSubscription"),a({title:"Notificaciones desactivadas",description:"Ya no recibirás notificaciones push"}))}catch(h){console.error("Error unsubscribing:",h),a({title:"Error",description:"No se pudieron desactivar las notificaciones",variant:"destructive"})}finally{p(!1)}},sendTestNotification:()=>
22{i&&"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(h=>{h.showNotification("Notificación de prueba",{body:"Las notificaciones están funcionando correctamente",icon:"/icons/icon-192x192.png",badge:"/icons/icon-192x192.png",tag:"test-notification"})})}}};function ke(s){const t="=".repeat((4-s.length%4)%4),i=(s+t).replace(/-/g,"+").replace(/_/g,"/"),o=window.atob(i),l=new Uint8Array(o.length);for(let d=0;d<o.length;++d)l[d]=o.charCodeAt(d);return l}const Pe=()=>{const{isSupported:s,isSubscribed:t,isLoading:i,subscribe:o,unsubscribe:l,sendTestNotification:d}=Se(),[j,p]=m.useState(!0),[a,u]=m.useState(!0),[n,c]=m.useState(!0),[f,h]=m.useState(!0),[r,N]=m.useState(!0),v=()=>{t?l():o()};return e.jsx("div",{className:"space-y-6",children:e.jsxs(P,{children:[e.jsxs(A,{children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5"}),"Configuración de Notificaciones"]}),e.jsx(L,{children:"Configura cómo y cuándo quieres recibir notificaciones"})]}),e.jsxs(F,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(y,{className:"text-base font-medium flex items-center gap-2",children:[t?e.jsx(he,{className:"h-4 w-4"}):e.jsx(xe,{className:"h-4 w-4"}),"Notificaciones Push"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Recibe notificaciones inmediatas en tu navegador"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!s&&e.jsx(ue,{variant:"secondary",children:"No soportado"}),s&&e.jsx(C,{checked:t,onCheckedChange:v,disabled:i||!s})]})]}),t&&e.jsx(k,{variant:"outline",size:"sm",onClick:d,className:"ml-6",children:"Enviar notificación de prueba"})]}),e.jsx(q,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{className:"text-base font-medium",children:"Tipos de Notificaciones"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{htmlFor:"signature-notifications",children:"Firmas de documentos"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Cuando se complete o expire una firma"})]}),e.jsx(C,{id:"signature-notifications",checked:a,onCheckedChange:u})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{htmlFor:"document-notifications",children:"Nuevos documentos"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Cuando se generen nuevos documentos"})]}),e.jsx(C,{id:"document-notifications",checked:n,onCheckedChange:c})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{htmlFor:"reminder-notifications",children:"Recordatorios"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Recordatorios de firmas pendientes"})]}),e.jsx(C,{id:"reminder-notifications",checked:f,onCheckedChange:h})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{htmlFor:"email-notifications",children:"Notificaciones por email"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Recibir también notificaciones por correo"})]}),e.jsx(C,{id:"email-notifications",checked:j,onCheckedChange:p})]})]})]}),e.jsx(q,{}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(y,{className:"text-base font-medium flex items-center gap-2",children:[r?e.jsx(je,{className:"h-4 w-4"}):e.jsx(ye,{className:"h-4 w-4"}),"Sonido de notificaciones"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Reproducir sonido al recibir notificaciones"})]}),e.jsx(C,{checked:r,onCheckedChange:N})]})})]})]})})},Ae=()=>{const[s,t]=m.useState(!1),[i,o]=m.useState(!1),{signOut:l}=K(),d=W(),j=async()=>{o(!0);try{await l(),d("/login",{replace:!0})}catch(p){console.error("❌ ProfileLogoutButton: Error al cerrar sesión:",p),d("/login",{replace:!0})}finally{o(!1),t(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"destructive",onClick:()=>t(!0),disabled:i,className:"gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),"Cerrando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"h-4 w-4"}),"Cerrar Sesión"]})}),e.jsx(fe,{open:s,onOpenChange:t,onConfirm:j,isLoading:i})]})},Ee=T.object({first_name:T.string().min(2,{message:"El nombre debe tener al menos 2 caracteres."}),last_name:T.string().min(2,{message:"El apellido debe tener al menos 2 caracteres."}),phone:T.string().min(9,{message:"El teléfono debe tener al menos 9 caracteres."})}),fs=()=>{const[s,t]=m.useState(null),[i,o]=m.useState(!0),[l,d]=m.useState(!1),{toast:j}=O(),{register:p,handleSubmit:a,setValue:u,formState:{errors:n}}=X({resolver:$(Ee)}),{data:c}=U({queryKey:["user"],queryFn:async()=>{const{data:g,error:b}=await I.auth.getUser();if(b)throw b;return g.user}}),{data:f,isLoading:h,refetch:r}=U({queryKey:["profile",c==null?void 0:c.id],queryFn:async()=>
22{if(!c)return null;const{data:g,error:b}=await I.from("profiles").select("*").eq("id",c.id).single();if(b)throw b;return g},enabled:!!c});m.useEffect(()=>{f&&(t(f),u("first_name",f.first_name||""),u("last_name",f.last_name||""),u("phone",f.phone||""),o(!1))},[f,u]);const N=H({mutationFn:async g=>{if(!c)throw new Error("User not found");const{error:b}=await I.from("profiles").update(g).eq("id",c.id);if(b)throw b},onSuccess:()=>{j({title:"Perfil actualizado",description:"Tu perfil ha sido actualizado exitosamente."}),r()},onError:g=>{j({title:"Error",description:g.message,variant:"destructive"})}}),v=g=>{N.mutate(g)},x=g=>{d(g),document.documentElement.classList.toggle("dark",g)};return e.jsx(G,{title:"Perfil",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(Ae,{})}),!s&&e.jsx(Ne,{}),e.jsxs(J,{defaultValue:"profile",className:"space-y-6",children:[e.jsxs(Y,{className:"grid w-full grid-cols-4",children:[e.jsx(B,{value:"profile",children:"Perfil"}),e.jsx(B,{value:"notifications",children:"Notificaciones"}),e.jsx(B,{value:"security",children:"Seguridad"}),e.jsx(B,{value:"preferences",children:"Preferencias"})]}),e.jsx(M,{value:"profile",className:"space-y-6",children:e.jsxs(P,{children:[e.jsxs(A,{children:[e.jsx(E,{children:"Información Personal"}),e.jsx(L,{children:"Actualiza tu información personal aquí."})]}),e.jsx(F,{className:"grid gap-4",children:e.jsxs("form",{onSubmit:a(v),className:"grid gap-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"first_name",children:"Nombre"}),e.jsx(S,{id:"first_name",type:"text",placeholder:"Tu nombre",...p("first_name")}),n.first_name&&e.jsx("p",{className:"text-destructive text-sm",children:n.first_name.message})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"last_name",children:"Apellido"}),e.jsx(S,{id:"last_name",type:"text",placeholder:"Tu apellido",...p("last_name")}),n.last_name&&e.jsx("p",{className:"text-destructive text-sm",children:n.last_name.message})]})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"phone",children:"Teléfono"}),e.jsx(S,{id:"phone",type:"tel",placeholder:"Tu número de teléfono",...p("phone")}),n.phone&&e.jsx("p",{className:"text-destructive text-sm",children:n.phone.message})]}),e.jsx(k,{type:"submit",disabled:N.isPending,children:N.isPending?"Actualizando...":"Actualizar Perfil"})]})})]})}),e.jsx(M,{value:"notifications",className:"space-y-6",children:e.jsx(Pe,{})}),e.jsx(M,{value:"security",className:"space-y-6",children:e.jsx(Ce,{})}),e.jsx(M,{value:"preferences",className:"space-y-6",children:e.jsxs(P,{children:[e.jsxs(A,{children:[e.jsx(E,{children:"Preferencias"}),e.jsx(L,{children:"Configura tus preferencias de la aplicación."})]}),e.jsxs(F,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{htmlFor:"theme",children:"Tema Oscuro"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Activa el tema oscuro para una mejor experiencia visual"})]}),e.jsx(C,{id:"theme",checked:l,onCheckedChange:x})]}),e.jsxs("div",{children:[e.jsx(y,{htmlFor:"language",children:"Idioma"}),e.jsx(S,{id:"language",type:"text",placeholder:"Idioma",disabled:!0,defaultValue:"Español",className:"mt-2"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Próximamente disponible"})]})]})]})})]})]})})};export{fs 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.