1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1954],{2929:(e,a,t)=>{Promise.resolve().then(t.bind(t,46866)),Promise.resolve().then(t.bind(t,12293)),Promise.resolve().then(t.bind(t,88028))},3998:(e,a,t)=>{"use strict";t.d(a,{$:()=>o});var r=t(95155),s=t(49574),i=t(83101),n=t(64269);let d=(0,i.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:a,variant:t="default",size:i="default",...o}=e;return(0,r.jsx)(s.Button,{"data-slot":"button",className:(0,n.cn)(d({variant:t,size:i,className:a})),...o})}},9350:(e,a,t)=>{"use strict";t.d(a,{n:()=>i});var r=t(25959),s=t(89863);let i=(0,r.v)()((0,s.lt)(e=>({session:null,user:null,role:null,isLoading:!0,setSession:a=>e({session:a},!1,"auth/setSession"),setUser:a=>{var t,r;let s=null!=(r=null==a||null==(t=a.app_metadata)?void 0:t.role)?r:null;e({user:a,role:s},!1,"auth/setUser")},setRole:a=>e({role:a},!1,"auth/setRole"),setLoading:a=>e({isLoading:a},!1,"auth/setLoading"),reset:()=>e({session:null,user:null,role:null,isLoading:!1},!1,"auth/reset")}),{name:"AuthStore",enabled:!1}))},11647:(e,a,t)=>{"use strict";t.d(a,{E:()=>o});var r=t(21083),s=t(22027),i=t(83101),n=t(64269);let d=(0,i.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function o(e){let{className:a,variant:t="default",render:i,...o}=e;return(0,s.C)({defaultTagName:"span",props:(0,r.v6)({className:(0,n.cn)(d({variant:t}),a)},o),render:i,state:{slot:"badge",variant:t}})}},12293:(e,a,t)=>{"use strict";t.d(a,{Topbar:()=>O});var r=t(95155),s=t(49155),i=t(85361),n=t(3998),d=t(11647),o=t(59202),l=t(64309),c=t(9350),u=t(12115),m=t(22544),p=t(66942),g=t(95154),x=t(18720),b=t(5379),f=t(69746),v=t(8731),h=t(86841),j=t(58775),y=t(33297),N=t(32470),k=t(67709),z=t(77650),C=t(51834),w=t(65142),A=t(76444),S=t(80721),_=t(73649),P=t(64269);function E(e){let{className:a,size:t="default",...s}=e;return(0,r.jsx)(S.l,{"data-slot":"switch","data-size":t,className:(0,P.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",a),...s,children:(0,r.jsx)(_.p,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}let M=g.Ik({name:g.Yj().min(2,"El nombre debe tener al menos 2 caracteres")});function I(){var e,a;let t=(0,u.useMemo)(()=>(0,z.U)(),[]),s=(0,o.j)(e=>e.activeModal),i=(0,o.j)(e=>e.closeModal),d=(0,c.n)(e=>e.user),l=(0,c.n)(e=>e.role),{theme:g,setTheme:S}=(0,b.D)(),_="editProfile"===s,[P,I]=(0,u.useState)(null),[O,D]=(0,u.useState)(!1),U=(0,m.mN)({resolver:(0,p.u)(M),defaultValues:{name:""}});(0,u.useEffect)(()=>{_&&d&&(async()=>{var e,a;D(!0);let{data:r}=await t.from("staff").select("*").eq("id",d.id).single(),s=null!=r?r:null,i=(null==s?void 0:s.name)||(null==(e=d.user_metadata)?void 0:e.display_name)||(null==(a=d.email)?void 0:a.split("@")[0])||"";I(s),U.reset({name:i}),D(!1)})()},[_,null==d?void 0:d.id]);let J=async e=>{if(!d)return;let a=e.name.trim(),{error:r}=await t.from("staff").update({name:a}).eq("id",d.id);if(r)return void x.o.error("Error al actualizar el perfil.");await t.auth.updateUser({data:{display_name:a}}),x.o.success("Perfil actualizado."),i()};return(0,r.jsx)(C.lG,{open:_,onOpenChange:e=>!e&&i(),children:(0,r.jsxs)(C.Cf,{className:"max-w-sm rounded-[18px]",children:[(0,r.jsxs)(C.c7,{children:[(0,r.jsx)(C.L3,{className:"font-heading text-lg font-semibold",children:"Editar perfil"}),(0,r.jsx)(C.rr,{className:"text-xs text-muted-foreground",children:"Actualiza tus datos personales"})]}),O?(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)(f.A,{className:"size-5 animate-spin text-muted-foreground"})}):(0,r.jsxs)("form",{onSubmit:U.handleSubmit(J),className:"space-y-4 mt-2",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)(A.J,{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[(0,r.jsx)(v.A,{className:"size-3"}),"Email"]}),(0,r.jsx)(w.p,{value:null!=(a=null!=(e=null==P?void 0:P.email)?e:null==d?void 0:d.email)?a:"",disabled:!0,className:"rounded-[12px] h-9 text-sm bg-muted/50 cursor-not-allowed"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)(A.J,{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[(0,r.jsx)(h.A,{className:"size-3"}),"Rol"]}),(0,r.jsx)(w.p,{value:null!=l?l:"",disabled:!0,className:"rounded-[12px] h-9 text-sm bg-muted/50 cursor-not-allowed capitalize"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)(A.J,{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[(0,r.jsx)(j.A,{className:"size-3"}),"Nombre"]}),(0,r.jsx)(w.p,{...U.register("name"),placeholder:"Tu nombre completo",className:"rounded-[12px] h-9 text-sm",autoFocus:!0}),U.formState.errors.name&&(0,r.jsx)("p",{className:"text-xs text-destructive",children:U.formState.errors.name.message})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-[12px] bg-muted/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:["dark"===g?(0,r.jsx)(y.A,{className:"size-3.5 text-muted-foreground"}):(0,r.jsx)(N.A,{className:"size-3.5 text-muted-foreground"}),(0,r.jsx)(A.J,{className:"text-xs cursor-pointer",onClick:()=>S("dark"===g?"light":"dark"),children:"Tema oscuro"})]}),(0,r.jsx)(E,{checked:"dark"===g,onCheckedChange:e=>S(e?"dark":"light"),"aria-label":"Cambiar tema"})]}),(0,r.jsxs)("div",{className:"flex gap-2 pt-2",children:[(0,r.jsx)(n.$,{type:"button",variant:"outline",className:"flex-1 rounded-[12px]",onClick:i,children:"Cancelar"}),(0,r.jsx)(n.$,{type:"submit",className:"flex-1 bg-primary text-[#0D141D] font-semibold rounded-[12px] hover:bg-primary/90",disabled:U.formState.isSubmitting,children:U.formState.isSubmitting?(0,r.jsx)(f.A,{className:"size-4 animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{className:"size-3.5 mr-1.5"}),"Guardar"]})})]})]})]})})}function O(e){let{title:a}=e,t=(0,o.j)(e=>e.toggleSidebar),m=(0,o.j)(e=>e.openModal),p=(0,l.i)(e=>e.unreadCount),g=(0,c.n)(e=>e.user),x=(0,u.useMemo)(()=>{var e,a;return null!=(a=null==g||null==(e=g.email)?void 0:e.slice(0,2).toUpperCase())?a:"??"},[null==g?void 0:g.email]);return(0,r.jsxs)("header",{className:"h-16 border-b border-border bg-background/80 backdrop-blur-sm flex items-center px-6 gap-4 sticky top-0 z-20",children:[(0,r.jsx)(n.$,{variant:"ghost",size:"icon",onClick:t,className:"md:hidden","aria-label":"Abrir men\xfa",children:(0,r.jsx)(s.A,{className:"size-4"})}),(0,r.jsx)("h1",{className:"font-heading font-semibold text-lg text-foreground truncate flex-1",children:a}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(n.$,{variant:"ghost",size:"icon","aria-label":"Notificaciones",children:(0,r.jsx)(i.A,{className:"size-4"})}),p>0&&(0,r.jsx)(d.E,{variant:"secondary",className:"absolute -top-1 -right-1 h-4 min-w-4 text-[9px] px-1 flex items-center justify-center",children:p})]}),(0,r.jsx)("button",{onClick:()=>m("editProfile"),className:"size-8 rounded-full bg-primary flex items-center justify-center text-[11px] font-bold text-[#0D141D] hover:bg-primary/80 transition-colors cursor-pointer","aria-label":"Editar perfil",children:x})]}),(0,r.jsx)(I,{})]})}},46866:(e,a,t)=>{"use strict";t.d(a,{Sidebar:()=>S});var r=t(95155),s=t(12115),i=t(52619),n=t.n(i),d=t(20063),o=t(15239),l=t(5379),c=t(56978),u=t(41516),m=t(33725),p=t(54742),g=t(46139),x=t(78661),b=t(34788),f=t(49155),v=t(14333),h=t(64269),j=t(59202),y=t(64309),N=t(9350),k=t(77650),z=t(18720),C=t(3998),w=t(11647);let A=[{label:"Calendario",href:"/dashboard/calendar",icon:c.A},{label:"Pacientes",href:"/dashboard/patients",icon:u.A},{label:"Citas",href:"/dashboard/appointments",icon:m.A},{label:"Notificaciones",href:"/dashboard/notifications",icon:p.A},{label:"Procedimientos",href:"/dashboard/procedures",icon:g.A,adminOnly:!0},{label:"Configuraci\xf3n",href:"/dashboard/settings",icon:x.A,adminOnly:!0}];function S(){let e=(0,d.usePathname)(),a=(0,d.useRouter)(),t=(0,j.j)(e=>e.sidebarOpen),i=(0,j.j)(e=>e.toggleSidebar),c=(0,y.i)(e=>e.unreadCount),u=(0,N.n)(e=>e.role),m=(0,N.n)(e=>e.reset),p=(0,s.useMemo)(()=>(0,k.U)(),[]),{resolvedTheme:g}=(0,l.D)(),x=(0,s.useCallback)(async()=>{let{error:e}=await p.auth.signOut();if(e)return void z.o.error("Error al cerrar sesi\xf3n");m(),a.push("/login")},[m,a,p]);return(0,r.jsxs)("aside",{className:(0,h.cn)("flex flex-col bg-sidebar border-r border-sidebar-border transition-all duration-300 z-30","fixed inset-y-0 left-0 md:relative md:translate-x-0",t?"w-60 translate-x-0":"w-16 -translate-x-full md:translate-x-0"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-5 border-b border-sidebar-border",children:[t&&(0,r.jsx)(n(),{href:"/dashboard",className:"flex items-center hover:opacity-80 transition-opacity",children:(0,r.jsx)(o.default,{src:"dark"===g?"/logo-cirux-dark.webp":"/logo-cirux-light.webp",alt:"Cirux",width:120,height:32,className:"h-8 w-auto",priority:!0,suppressHydrationWarning:!0})}),(0,r.jsx)(C.$,{variant:"ghost",size:"icon",onClick:i,className:"text-sidebar-foreground hover:bg-sidebar-accent ml-auto","aria-label":t?"Colapsar sidebar":"Expandir sidebar",children:t?(0,r.jsx)(b.A,{className:"size-4"}):(0,r.jsx)(f.A,{className:"size-4"})})]}),(0,r.jsx)("nav",{className:"flex-1 py-4 px-2 space-y-1 overflow-y-auto",children:A.filter(e=>!e.adminOnly||"admin"===u).map(a=>{let s=e.startsWith(a.href),i=a.icon,d="/dashboard/notifications"===a.href;return(0,r.jsxs)(n(),{href:a.href,className:(0,h.cn)("flex items-center gap-3 rounded-[12px] px-3 py-2.5 text-sm font-medium transition-colors","text-sidebar-foreground hover:bg-sidebar-accent hover:text-primary",s&&"bg-primary/10 text-primary"),title:t?void 0:a.label,children:[(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)(i,{className:"size-4"}),d&&c>0&&(0,r.jsx)("span",{className:"absolute -top-1.5 -right-1.5 size-2 bg-secondary rounded-full"})]}),t&&(0,r.jsx)("span",{className:"truncate",children:a.label}),t&&d&&c>0&&(0,r.jsx)(w.E,{variant:"secondary",className:"ml-auto text-[10px] px-1.5 py-0 h-5",children:c})]},a.href)})}),(0,r.jsx)("div",{className:"px-2 py-3 border-t border-sidebar-border",children:(0,r.jsxs)("button",{onClick:x,className:(0,h.cn)("flex items-center gap-3 rounded-[12px] px-3 py-2.5 text-sm font-medium w-full","text-sidebar-foreground hover:bg-destructive/10 hover:text-destructive transition-colors"),title:t?void 0:"Cerrar sesi\xf3n",children:[(0,r.jsx)(v.A,{className:"size-4 flex-shrink-0"}),t&&(0,r.jsx)("span",{children:"Cerrar sesi\xf3n"})]})})]})}},51834:(e,a,t)=>{"use strict";t.d(a,{Cf:()=>f,L3:()=>h,c7:()=>v,lG:()=>g,rr:()=>j});var r=t(95155);t(12115);var s=t(68422),i=t(87263),n=t(54915),d=t(23737),o=t(58905),l=t(50989),c=t(48893),u=t(64269),m=t(3998),p=t(34788);function g(e){let{...a}=e;return(0,r.jsx)(s.D,{"data-slot":"dialog",...a})}function x(e){let{...a}=e;return(0,r.jsx)(i.Z,{"data-slot":"dialog-portal",...a})}function b(e){let{className:a,...t}=e;return(0,r.jsx)(n.X,{"data-slot":"dialog-overlay",className:(0,u.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",a),...t})}function f(e){let{className:a,children:t,showCloseButton:s=!0,...i}=e;return(0,r.jsxs)(x,{children:[(0,r.jsx)(b,{}),(0,r.jsxs)(d.h,{"data-slot":"dialog-content",className:(0,u.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...i,children:[t,s&&(0,r.jsxs)(o.H,{"data-slot":"dialog-close",render:(0,r.jsx)(m.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,r.jsx)(p.A,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function v(e){let{className:a,...t}=e;return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,u.cn)("flex flex-col gap-2",a),...t})}function h(e){let{className:a,...t}=e;return(0,r.jsx)(l.L,{"data-slot":"dialog-title",className:(0,u.cn)("font-heading text-base leading-none font-medium",a),...t})}function j(e){let{className:a,...t}=e;return(0,r.jsx)(c.r,{"data-slot":"dialog-description",className:(0,u.cn)("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",a),...t})}},59202:(e,a,t)=>{"use strict";t.d(a,{j:()=>i});var r=t(25959),s=t(89863);let i=(0,r.v)()((0,s.lt)(e=>({sidebarOpen:!0,activeModal:null,modalPayload:null,setSidebarOpen:a=>e({sidebarOpen:a},!1,"ui/setSidebarOpen"),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen}),!1,"ui/toggleSidebar"),openModal:function(a){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e({activeModal:a,modalPayload:t},!1,"ui/openModal")},closeModal:()=>e({activeModal:null,modalPayload:null},!1,"ui/closeModal")}),{name:"UIStore",enabled:!1}))},64269:(e,a,t)=>{"use strict";t.d(a,{cn:()=>i});var r=t(2821),s=t(75889);function i(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return(0,s.QP)((0,r.$)(a))}},64309:(e,a,t)=>{"use strict";t.d(a,{i:()=>i});var r=t(25959),s=t(89863);let i=(0,r.v)()((0,s.lt)((e,a)=>({pendingConversations:[],systemNotifications:[],unreadCount:0,setPendingConversations:a=>e({pendingConversations:a,unreadCount:a.length},!1,"notifications/setPendingConversations"),addPendingConversation:t=>{a().pendingConversations.some(e=>e.id===t.id)||e(e=>({pendingConversations:[t,...e.pendingConversations],unreadCount:e.unreadCount+1}),!1,"notifications/addPendingConversation")},removePendingConversation:a=>e(e=>({pendingConversations:e.pendingConversations.filter(e=>e.id!==a),unreadCount:Math.max(0,e.unreadCount-1)}),!1,"notifications/removePendingConversation"),setSystemNotifications:a=>e({systemNotifications:a},!1,"notifications/setSystemNotifications"),markAllRead:()=>e({unreadCount:0},!1,"notifications/markAllRead")}),{name:"NotificationStore",enabled:!1}))},65142:(e,a,t)=>{"use strict";t.d(a,{p:()=>n});var r=t(95155);t(12115);var s=t(50092),i=t(64269);function n(e){let{className:a,type:t,...n}=e;return(0,r.jsx)(s.p,{type:t,"data-slot":"input",className:(0,i.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...n})}},76444:(e,a,t)=>{"use strict";t.d(a,{J:()=>i});var r=t(95155);t(12115);var s=t(64269);function i(e){let{className:a,...t}=e;return(0,r.jsx)("label",{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...t})}},77650:(e,a,t)=>{"use strict";t.d(a,{U:()=>s});var r=t(79786);function s(){return(0,r.createBrowserClient)("https://supabase.silvioalzate.shop","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzc5MTYzNDQ1LCJleHAiOjE5MzY4NDM0NDV9.RGVwyQdA7oigXmMylP2Df7DKpNno_8_rSTwd0471zLk")}},88028:(e,a,t)=>{"use strict";t.d(a,{Providers:()=>o});var r=t(95155),s=t(12115),i=t(77650),n=t(9350),d=t(64309);function o(e){let{children:a}=e,{setUser:t,setSession:o,setLoading:l}=(0,n.n)(),{setPendingConversations:c,addPendingConversation:u}=(0,d.i)(),m=(0,s.useMemo)(()=>(0,i.U)(),[]);return(0,s.useEffect)(()=>{(async()=>{var e,a;l(!0);let{data:r}=await m.auth.getSession();o(r.session),t(null!=(a=null==(e=r.session)?void 0:e.user)?a:null),l(!1)})();let{data:{subscription:e}}=m.auth.onAuthStateChange((e,a)=>{var r;o(a),t(null!=(r=null==a?void 0:a.user)?r:null)});return()=>e.unsubscribe()},[o,t,l,m]),(0,s.useEffect)(()=>{(async()=>{let{data:e}=await m.from("conversations").select("*, patient:patients(id, name, phone)").eq("status","pending_human").order("last_message_at",{ascending:!1});e&&c(e)})();let e=m.channel("conversations-realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"conversations",filter:"status=eq.pending_human"},e=>{u(e.new)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"conversations",filter:"status=eq.pending_human"},e=>{u(e.new)}).subscribe();return()=>{m.removeChannel(e)}},[c,u,m]),(0,r.jsx)(r.Fragment,{children:a})}}},e=>{e.O(0,[5730,7711,7349,9574,3540,8720,7958,3652,5922,778,2619,3395,6394,1866,8441,1255,7358],()=>e(e.s=2929)),_N_E=e.O()}]); |