import{r as s,j as e}from"./0-vendor-react-DWOJpYrt.js";import{B as c}from"./page-ajustes-DgawOEJM.js";import{C as d,c as l,d as m,e as p}from"./page-comunicacion-DmHQUHoW.js";import{g as w,f as S,C as v}from"./timers-DtW-cs9v.js";import"./1-vendor-utils-Delnuc0l.js";import"./2-vendor-markdown-BQlHAcA7.js";const C=[{id:"term-abcde",title:"ABCDE y temperatura",description:"Valorar conciencia, via aerea y temperatura central si es posible."},{id:"term-hipotermia-grave",title:"Hipotermia grave",description:"Evitar movimientos bruscos, monitorizar ritmo y preparar traslado urgente."},{id:"term-hipotermia",title:"Hipotermia",description:"Retirar ropa humeda, aislar del suelo, recalentamiento pasivo, manejar suavemente."},{id:"term-hipertermia",title:"Hipertermia",description:"Enfriamiento rapido: sombra, ropa ligera, pulverizar agua, abanicar. Sueros segun protocolo."},{id:"term-traslado",title:"Traslado urgente",description:"Monitorizar constantes y comunicar evolucion."}],u="checklist_termicas_v1",i={startedAt:null,completed:{}},N=()=>{if(typeof window>"u")return i;try{const t=window.localStorage.getItem(u);if(!t)return i;const r=JSON.parse(t);return{...i,...r}}catch{return i}},y=t=>{if(!(typeof window>"u"))try{window.localStorage.setItem(u,JSON.stringify(t))}catch{}},z=()=>{const[t,r]=s.useState(i),[b,x]=s.useState(Date.now());s.useEffect(()=>{r(N())},[]),s.useEffect(()=>{y(t)},[t]),s.useEffect(()=>{const a=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(a)},[]);const f=w(t.startedAt),h=(a,o)=>{r(n=>({...n,completed:{...n.completed,[a]:o}}))},j=()=>{t.startedAt||r(a=>({...a,startedAt:Date.now()}))},g=()=>{r(i)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Checklist Hipotermia/Hipertermia"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manejo inicial de emergencias termicas."})]}),e.jsxs(d,{children:[e.jsxs(l,{className:"flex flex-row items-center justify-between space-y-0",children:[e.jsx(m,{className:"text-base",children:"Temporizador"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t.startedAt?`Tiempo: ${S(f)}`:"Sin iniciar"})]}),e.jsxs(p,{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Inicia el temporizador al primer contacto."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(c,{onClick:j,disabled:!!t.startedAt,children:"Iniciar"}),e.jsx(c,{variant:"outline",onClick:g,children:"Reiniciar"})]})]})]}),C.map(a=>e.jsxs(d,{children:[e.jsx(l,{className:"flex flex-row items-center justify-between space-y-0",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(v,{checked:!!t.completed[a.id],onCheckedChange:o=>h(a.id,!!o)}),e.jsx(m,{className:"text-base",children:a.title})]})}),e.jsx(p,{className:"text-sm text-muted-foreground",children:a.description})]},a.id))]})};export{z as default};