From dc002360b0663fb69b3a64d97cf885ac25da6d50 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 24 Apr 2026 02:28:51 +0200 Subject: [PATCH] perf(client): code-split every heavy route via React.lazy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cuts the initial bundle roughly in half. Users who open Home, Extensions, or FAQ download ~343 kB / 106 kB gz instead of 817 kB / 230 kB gz. Heavy clinical reference data (PE_DATA, Fenton LMS, Rosner BP splines, 15 Bedside drug panels, 10 Calculator formulas, 13 Settings sub-sections, 10 Admin sub-tabs) only loads when the user opens that route. client/src/App.tsx Every route except Home / Extensions / FAQ wrapped in React.lazy(() => import(...)) + . Extensions and FAQ stay in the main chunk because they're small (3 kB, 2 kB) and likely visited early. The RouteFallback component shows a single "Loading…" line — Vite prefetches chunks on hover so the delay is typically invisible. Resulting chunks (gzipped): • index.js 106 kB React + Router + Query + Layout + Home + Extensions + FAQ • Bedside.js 33 kB 15 clinical dosing panels • PeGuide.js 36 kB PE_DATA hierarchy + scales + sounds • Calculators.js 42 kB All 10 calculators + BP Rosner coefficients + Fenton + BMI LMS • Settings.js 10 kB 13 Settings sub-sections • Admin.js 7 kB 10 Admin sub-tabs • Learning.js 3 kB • Fenton chunk (shared) 3 kB Reused between Bedside neonatal and the Growth Charts calculator • Note pages (each) 1-2 kB Encounter / SOAP / Well / Sick / Hospital / Chart / Dictation / Vax / Catch-up individually chunked Vite's 500 kB chunk-size warning is gone. No functional changes. --- client/src/App.tsx | 83 ++++++++++++-------- public/app/assets/Admin--1-AiSvo.js | 1 + public/app/assets/Bedside-Dp0dEd6U.js | 1 + public/app/assets/Calculators-DIAUUNQe.js | 1 + public/app/assets/Catchup-B8pTp8ZN.js | 1 + public/app/assets/ChartReview-BiL3eBLI.js | 1 + public/app/assets/ConfirmModal-zYA0ebt6.js | 1 + public/app/assets/Dictation-BOzE18pb.js | 1 + public/app/assets/Encounter-Bke3XfMa.js | 1 + public/app/assets/HospitalCourse-BhtMwZ57.js | 1 + public/app/assets/Learning-DHnt_HCY.js | 1 + public/app/assets/PeGuide-ZAyIHUEG.js | 1 + public/app/assets/Settings-D5OljPbz.js | 4 + public/app/assets/SickVisit-BhmlIsiq.js | 1 + public/app/assets/Soap-DWeR8vsk.js | 1 + public/app/assets/VaxSchedule-BvmWxXa3.js | 1 + public/app/assets/WellVisit-vt8QwDLr.js | 1 + public/app/assets/fenton-9EKyvVkL.js | 1 + public/app/assets/index-4IQgLQaQ.js | 52 ------------ public/app/assets/index-B0uH73Hx.js | 50 ++++++++++++ public/app/assets/jsx-runtime-ByY1xr43.js | 1 + public/app/index.html | 3 +- 22 files changed, 122 insertions(+), 87 deletions(-) create mode 100644 public/app/assets/Admin--1-AiSvo.js create mode 100644 public/app/assets/Bedside-Dp0dEd6U.js create mode 100644 public/app/assets/Calculators-DIAUUNQe.js create mode 100644 public/app/assets/Catchup-B8pTp8ZN.js create mode 100644 public/app/assets/ChartReview-BiL3eBLI.js create mode 100644 public/app/assets/ConfirmModal-zYA0ebt6.js create mode 100644 public/app/assets/Dictation-BOzE18pb.js create mode 100644 public/app/assets/Encounter-Bke3XfMa.js create mode 100644 public/app/assets/HospitalCourse-BhtMwZ57.js create mode 100644 public/app/assets/Learning-DHnt_HCY.js create mode 100644 public/app/assets/PeGuide-ZAyIHUEG.js create mode 100644 public/app/assets/Settings-D5OljPbz.js create mode 100644 public/app/assets/SickVisit-BhmlIsiq.js create mode 100644 public/app/assets/Soap-DWeR8vsk.js create mode 100644 public/app/assets/VaxSchedule-BvmWxXa3.js create mode 100644 public/app/assets/WellVisit-vt8QwDLr.js create mode 100644 public/app/assets/fenton-9EKyvVkL.js delete mode 100644 public/app/assets/index-4IQgLQaQ.js create mode 100644 public/app/assets/index-B0uH73Hx.js create mode 100644 public/app/assets/jsx-runtime-ByY1xr43.js diff --git a/client/src/App.tsx b/client/src/App.tsx index be96457..0a63c5d 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,28 +1,43 @@ +import { lazy, Suspense } from 'react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { BrowserRouter, Routes, Route, Navigate, Link } from 'react-router-dom'; import Layout from '@/components/Layout'; + +// Lightweight pages stay in the main chunk. import Extensions from '@/pages/Extensions'; import Faq from '@/pages/Faq'; -import Dictation from '@/pages/Dictation'; -import Encounter from '@/pages/Encounter'; -import Soap from '@/pages/Soap'; -import SickVisit from '@/pages/SickVisit'; -import HospitalCourse from '@/pages/HospitalCourse'; -import ChartReview from '@/pages/ChartReview'; -import WellVisit from '@/pages/WellVisit'; -import VaxSchedule from '@/pages/VaxSchedule'; -import Catchup from '@/pages/Catchup'; -import Settings from '@/pages/Settings'; -import Learning from '@/pages/Learning'; -import PeGuide from '@/pages/PeGuide'; -import Bedside from '@/pages/Bedside'; -import Calculators from '@/pages/Calculators'; -import Admin from '@/pages/Admin'; + +// Heavy pages lazy-load — keeps the initial bundle small so the home +// screen and quick tools (Extensions, FAQ) paint fast, and users only +// download the big clinical-reference tables (PE_DATA, Fenton LMS, +// Rosner BP splines, Bedside drug panels, Admin sub-tabs) when they +// open those specific routes. +const Dictation = lazy(() => import('@/pages/Dictation')); +const Encounter = lazy(() => import('@/pages/Encounter')); +const Soap = lazy(() => import('@/pages/Soap')); +const SickVisit = lazy(() => import('@/pages/SickVisit')); +const HospitalCourse = lazy(() => import('@/pages/HospitalCourse')); +const ChartReview = lazy(() => import('@/pages/ChartReview')); +const WellVisit = lazy(() => import('@/pages/WellVisit')); +const VaxSchedule = lazy(() => import('@/pages/VaxSchedule')); +const Catchup = lazy(() => import('@/pages/Catchup')); +const Settings = lazy(() => import('@/pages/Settings')); +const Learning = lazy(() => import('@/pages/Learning')); +const PeGuide = lazy(() => import('@/pages/PeGuide')); +const Bedside = lazy(() => import('@/pages/Bedside')); +const Calculators = lazy(() => import('@/pages/Calculators')); +const Admin = lazy(() => import('@/pages/Admin')); const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: 30_000, retry: 1 } }, }); +function RouteFallback() { + return ( +
Loading…
+ ); +} + function Home() { return (
@@ -31,13 +46,13 @@ function Home() { This is the new React tree. The legacy vanilla-JS app still lives at{' '} /.

-

Ported tabs so far:

+

Quick links:

  • Encounter HPI
  • Dictation HPI
  • SOAP Note
  • Sick Visit
  • -
  • Extensions & Pagers
  • +
  • Extensions & Pagers
  • FAQ
@@ -51,23 +66,23 @@ export default function App() { }> } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> + }>
} /> + }>} /> + }>} /> + }>} /> + }>} /> + }>} /> + }>} /> + }>} /> + }>} /> + } /> + }>} /> + }>} /> + }>} /> + }>} /> + }>} /> + }>} /> + } /> {/* catch-all falls back to home while more tabs port over */} } /> diff --git a/public/app/assets/Admin--1-AiSvo.js b/public/app/assets/Admin--1-AiSvo.js new file mode 100644 index 0000000..d10eac3 --- /dev/null +++ b/public/app/assets/Admin--1-AiSvo.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i,o as a,s as o}from"./index-B0uH73Hx.js";import{t as s}from"./ConfirmModal-zYA0ebt6.js";var c=e(t(),1),l=n(),u=`rounded-lg border border-border bg-card p-5 space-y-3`,d=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,f=`block text-xs font-medium text-muted-foreground`,p=`rounded-md bg-primary text-primary-foreground px-3 py-2 text-sm font-medium disabled:opacity-50`,m=`rounded-md border border-border bg-background px-3 py-2 text-xs font-medium hover:bg-muted disabled:opacity-50`,h=`rounded-md bg-destructive text-white px-3 py-2 text-xs font-medium disabled:opacity-50`,g=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,_=`px-2 py-1.5 border-b border-border align-top text-sm`;function v({msg:e}){return e?(0,l.jsx)(`div`,{className:`text-sm `+(e.kind===`ok`?`text-green-600`:e.kind===`err`?`text-destructive`:`text-muted-foreground`),children:e.text}):null}function y(){let e=o(),[t,n]=(0,c.useState)(null),[f,y]=(0,c.useState)(``),[b,x]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[w,T]=(0,c.useState)(``),{data:E,isLoading:D,error:O}=a({queryKey:[`admin-users`],queryFn:()=>i.get(`/api/admin/users`)}),k=r({mutationFn:e=>i.post(`/api/admin/users/${e}/verify`,{}),onSuccess:t=>{n({text:t.message,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-users`]})},onError:e=>n({text:e.message,kind:`err`})}),A=r({mutationFn:e=>i.post(`/api/admin/users/${e}/disable`,{}),onSuccess:t=>{n({text:t.message,kind:`info`}),e.invalidateQueries({queryKey:[`admin-users`]})},onError:e=>n({text:e.message,kind:`err`})}),j=r({mutationFn:e=>i.post(`/api/admin/users/${e}/enable`,{}),onSuccess:t=>{n({text:t.message,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-users`]})},onError:e=>n({text:e.message,kind:`err`})}),M=r({mutationFn:e=>i.post(`/api/admin/users/${e.id}/role`,{role:e.role}),onSuccess:t=>{n({text:t.message,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-users`]})},onError:e=>n({text:e.message,kind:`err`})}),N=r({mutationFn:e=>i.delete(`/api/admin/users/${e}`),onSuccess:t=>{n({text:t.message,kind:`info`}),e.invalidateQueries({queryKey:[`admin-users`]})},onError:e=>n({text:e.message,kind:`err`})}),P=r({mutationFn:e=>i.post(`/api/admin/users/${e.id}/reset-password`,{newPassword:e.newPassword}),onSuccess:e=>{n({text:e.message,kind:`ok`}),C(null),T(``)},onError:e=>n({text:e.message,kind:`err`})}),F=(E?.users||[]).filter(e=>!f||e.email.toLowerCase().includes(f.toLowerCase())||e.name.toLowerCase().includes(f.toLowerCase()));return(0,l.jsxs)(`section`,{className:u,"data-testid":`admin-users-tab`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Users`}),(0,l.jsx)(`input`,{type:`search`,className:d+` max-w-xs`,placeholder:`Search by name or email…`,value:f,onChange:e=>y(e.target.value),"data-testid":`admin-users-search`})]}),D&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),O&&(0,l.jsx)(`div`,{className:`text-sm text-destructive`,children:O.message}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`admin-users-table`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:g,children:`Email`}),(0,l.jsx)(`th`,{className:g,children:`Name`}),(0,l.jsx)(`th`,{className:g,children:`Role`}),(0,l.jsx)(`th`,{className:g,children:`Verified`}),(0,l.jsx)(`th`,{className:g,children:`2FA`}),(0,l.jsx)(`th`,{className:g,children:`Status`}),(0,l.jsx)(`th`,{className:g,children:`Actions`})]})}),(0,l.jsxs)(`tbody`,{children:[F.map(e=>(0,l.jsxs)(`tr`,{"data-testid":`admin-user-row-${e.id}`,className:e.disabled?`opacity-60`:``,children:[(0,l.jsx)(`td`,{className:_,children:e.email}),(0,l.jsx)(`td`,{className:_,children:e.name}),(0,l.jsx)(`td`,{className:_,children:(0,l.jsxs)(`select`,{className:d+` text-xs w-28`,value:e.role||`user`,onChange:t=>M.mutate({id:e.id,role:t.target.value}),"data-testid":`admin-user-role-${e.id}`,children:[(0,l.jsx)(`option`,{value:`user`,children:`user`}),(0,l.jsx)(`option`,{value:`moderator`,children:`moderator`}),(0,l.jsx)(`option`,{value:`admin`,children:`admin`})]})}),(0,l.jsx)(`td`,{className:_+` text-xs`,children:e.email_verified?`✅`:(0,l.jsx)(`button`,{type:`button`,className:m,onClick:()=>k.mutate(e.id),"data-testid":`admin-user-verify-${e.id}`,children:`Verify`})}),(0,l.jsx)(`td`,{className:_+` text-xs`,children:e.totp_enabled?`✅`:`—`}),(0,l.jsx)(`td`,{className:_+` text-xs`,children:e.disabled?(0,l.jsx)(`button`,{type:`button`,className:m,onClick:()=>j.mutate(e.id),"data-testid":`admin-user-enable-${e.id}`,children:`Enable`}):(0,l.jsx)(`button`,{type:`button`,className:m,onClick:()=>A.mutate(e.id),"data-testid":`admin-user-disable-${e.id}`,children:`Disable`})}),(0,l.jsx)(`td`,{className:_+` text-xs`,children:(0,l.jsxs)(`div`,{className:`flex gap-1`,children:[(0,l.jsx)(`button`,{type:`button`,className:m,onClick:()=>C(e),"data-testid":`admin-user-reset-${e.id}`,children:`Reset pw`}),(0,l.jsx)(`button`,{type:`button`,className:h,onClick:()=>x(e),"data-testid":`admin-user-delete-${e.id}`,children:`Delete`})]})})]},e.id)),F.length===0&&E&&(0,l.jsx)(`tr`,{children:(0,l.jsxs)(`td`,{className:_+` text-muted-foreground italic`,colSpan:7,children:[`No users match "`,f,`".`]})})]})]})}),(0,l.jsx)(v,{msg:t}),(0,l.jsx)(s,{open:!!b,title:`Delete ${b?.email}?`,body:`This deletes the user account. Audit log entries are preserved (user_id set to NULL).`,confirmText:`Delete`,danger:!0,busy:N.isPending,onConfirm:()=>{b&&N.mutate(b.id),x(null)},onCancel:()=>x(null)}),S&&(0,l.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,onClick:()=>C(null),children:(0,l.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg border border-border bg-background p-5 shadow-lg space-y-3`,onClick:e=>e.stopPropagation(),children:[(0,l.jsxs)(`h3`,{className:`text-base font-semibold`,children:[`Reset password for `,S.email]}),(0,l.jsx)(`input`,{type:`text`,className:d,placeholder:`New password (8+ chars)`,value:w,onChange:e=>T(e.target.value),autoFocus:!0,minLength:8,"data-testid":`admin-user-reset-input`}),(0,l.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,className:m,onClick:()=>{C(null),T(``)},children:`Cancel`}),(0,l.jsx)(`button`,{type:`button`,className:p,disabled:w.length<8||P.isPending,onClick:()=>P.mutate({id:S.id,newPassword:w}),"data-testid":`admin-user-reset-submit`,children:P.isPending?`Saving…`:`Reset`})]})]})})]})}function b(){let e=o(),[t,n]=(0,c.useState)(null),{data:s}=a({queryKey:[`admin-settings`],queryFn:()=>i.get(`/api/admin/settings`)}),d=r({mutationFn:e=>i.post(`/api/admin/settings/registration`,{enabled:e}),onSuccess:t=>{n({text:t.message,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-settings`]})},onError:e=>n({text:e.message,kind:`err`})});return(0,l.jsxs)(`section`,{className:u,"data-testid":`admin-settings-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Site settings`}),s&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,l.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Total users`}),(0,l.jsx)(`div`,{className:`text-xl font-bold`,children:s.stats.totalUsers})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,l.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`API calls (all time)`}),(0,l.jsx)(`div`,{className:`text-xl font-bold`,children:s.stats.totalApiCalls})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,l.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`API calls (today)`}),(0,l.jsx)(`div`,{className:`text-xl font-bold`,children:s.stats.todayApiCalls})]})]}),(0,l.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,l.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,l.jsx)(`input`,{type:`checkbox`,className:`accent-primary size-4`,checked:s.settings.registrationEnabled,onChange:e=>d.mutate(e.target.checked),"data-testid":`admin-registration-toggle`}),(0,l.jsx)(`span`,{className:`text-sm font-medium`,children:`Allow new user registration`})]})})]}),(0,l.jsx)(v,{msg:t})]})}function x(){let e=o(),[t,n]=(0,c.useState)(null),[s,m]=(0,c.useState)(!1),[h,g]=(0,c.useState)(`info`),[_,y]=(0,c.useState)(``),[b,x]=(0,c.useState)(!1),{data:S}=a({queryKey:[`admin-announcement`],queryFn:()=>i.get(`/api/admin/config/announcement`)});!b&&S&&(m(S.enabled),g(S.type||`info`),y(S.text||``),x(!0));let C=r({mutationFn:async e=>i.put(`/api/admin/config/${encodeURIComponent(e.key)}`,{value:e.value})});async function w(){n(null);try{await Promise.all([C.mutateAsync({key:`announcement.enabled`,value:s?`true`:`false`}),C.mutateAsync({key:`announcement.type`,value:h}),C.mutateAsync({key:`announcement.text`,value:_})]),n({text:`Announcement saved`,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-announcement`]})}catch(e){n({text:e.message,kind:`err`})}}return(0,l.jsxs)(`section`,{className:u,"data-testid":`admin-announcement-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Announcement banner`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Shown at the top of every page when enabled. Use for scheduled maintenance, outage notices, or release notes.`}),(0,l.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,l.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,l.jsx)(`input`,{type:`checkbox`,className:`accent-primary size-4`,checked:s,onChange:e=>m(e.target.checked),"data-testid":`admin-announcement-enabled`}),(0,l.jsx)(`span`,{className:`text-sm`,children:`Show banner`})]})}),(0,l.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,l.jsxs)(`div`,{className:`sm:col-span-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Severity`}),(0,l.jsxs)(`select`,{className:d,value:h,onChange:e=>g(e.target.value),"data-testid":`admin-announcement-type`,children:[(0,l.jsx)(`option`,{value:`info`,children:`Info (blue)`}),(0,l.jsx)(`option`,{value:`warning`,children:`Warning (amber)`}),(0,l.jsx)(`option`,{value:`critical`,children:`Critical (red)`})]})]}),(0,l.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,l.jsx)(`label`,{className:f,children:`Message`}),(0,l.jsx)(`textarea`,{rows:3,className:d+` resize-y`,value:_,onChange:e=>y(e.target.value),placeholder:`e.g. Scheduled maintenance Thursday 02:00 UTC — expect 10 minutes of downtime.`,"data-testid":`admin-announcement-text`})]})]}),(0,l.jsx)(`button`,{type:`button`,onClick:w,disabled:C.isPending,className:p,"data-testid":`admin-announcement-save`,children:C.isPending?`Saving…`:`Save announcement`}),(0,l.jsx)(v,{msg:t})]})}var S=`rounded-lg border border-border bg-card p-5 space-y-3`,C=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,w=`block text-xs font-medium text-muted-foreground`,T=`rounded-md bg-primary text-primary-foreground px-3 py-2 text-sm font-medium disabled:opacity-50`,E=`rounded-md border border-border bg-background px-3 py-2 text-xs font-medium hover:bg-muted disabled:opacity-50`,D=`rounded-md bg-destructive text-white px-3 py-2 text-xs font-medium disabled:opacity-50`,O=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,k=`px-2 py-1.5 border-b border-border align-top text-sm`;function A({msg:e}){return e?(0,l.jsx)(`div`,{className:`text-sm `+(e.kind===`ok`?`text-green-600`:e.kind===`err`?`text-destructive`:`text-muted-foreground`),children:e.text}):null}function j(){return r({mutationFn:e=>i.put(`/api/admin/config/${encodeURIComponent(e.key)}`,{value:e.value})})}function M(){let e=o(),[t,n]=(0,c.useState)(null),[u,d]=(0,c.useState)(!1),[f,p]=(0,c.useState)(``),[m,h]=(0,c.useState)(`587`),[g,_]=(0,c.useState)(``),[v,y]=(0,c.useState)(``),[b,x]=(0,c.useState)(``),[O,k]=(0,c.useState)(`false`),[j,M]=(0,c.useState)(!1),[N,P]=(0,c.useState)(``),[F,I]=(0,c.useState)(`verify`),{data:L}=a({queryKey:[`admin-smtp-status`],queryFn:()=>i.get(`/api/admin/config/smtp/status`)});!j&&L&&(p(L.host||``),h(String(L.port??`587`)),_(L.user||``),x(L.from||``),M(!0));let R=r({mutationFn:e=>i.put(`/api/admin/config/smtp`,e),onSuccess:()=>{n({text:`SMTP settings saved`,kind:`ok`}),y(``),e.invalidateQueries({queryKey:[`admin-smtp-status`]})},onError:e=>n({text:e.message,kind:`err`})}),z=r({mutationFn:()=>i.delete(`/api/admin/config/smtp`),onSuccess:t=>{n({text:t.message,kind:`info`}),e.invalidateQueries({queryKey:[`admin-smtp-status`]})},onError:e=>n({text:e.message,kind:`err`})}),B=r({mutationFn:e=>i.post(`/api/admin/config/test-email`,e),onSuccess:()=>n({text:`Test email sent to ${N}`,kind:`ok`}),onError:e=>n({text:e.message,kind:`err`})});return(0,l.jsxs)(`section`,{className:S,"data-testid":`admin-smtp-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`SMTP`}),L&&(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Status: `,L.configured?`✅ Configured`:`❌ Not configured`,L.source&&(0,l.jsxs)(l.Fragment,{children:[` · source: `,(0,l.jsx)(`strong`,{children:L.source})]})]}),(0,l.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Host`}),(0,l.jsx)(`input`,{className:C,value:f,onChange:e=>p(e.target.value),placeholder:`smtp.example.com`,"data-testid":`smtp-host`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Port`}),(0,l.jsx)(`input`,{className:C,value:m,onChange:e=>h(e.target.value),placeholder:`587`,"data-testid":`smtp-port`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Username`}),(0,l.jsx)(`input`,{className:C,value:g,onChange:e=>_(e.target.value),"data-testid":`smtp-user`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Password`}),(0,l.jsx)(`input`,{type:`password`,className:C,value:v,onChange:e=>y(e.target.value),placeholder:`Leave blank to keep existing`,"data-testid":`smtp-pass`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`From`}),(0,l.jsx)(`input`,{className:C,value:b,onChange:e=>x(e.target.value),placeholder:`noreply@example.com`,"data-testid":`smtp-from`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Secure (TLS)`}),(0,l.jsxs)(`select`,{className:C,value:O,onChange:e=>k(e.target.value),"data-testid":`smtp-secure`,children:[(0,l.jsx)(`option`,{value:`false`,children:`STARTTLS (587)`}),(0,l.jsx)(`option`,{value:`true`,children:`SSL/TLS (465)`})]})]})]}),(0,l.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,l.jsx)(`button`,{type:`button`,className:T,disabled:R.isPending||!f,onClick:()=>R.mutate({host:f,port:m,user:g,pass:v,from:b,secure:O===`true`}),"data-testid":`smtp-save`,children:R.isPending?`Saving…`:`Save SMTP settings`}),(0,l.jsx)(`button`,{type:`button`,className:D,onClick:()=>d(!0),"data-testid":`smtp-clear`,children:`Clear DB override`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 space-y-2`,children:[(0,l.jsx)(`div`,{className:`text-sm font-semibold`,children:`Send test email`}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2 items-end`,children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-[200px]`,children:[(0,l.jsx)(`label`,{className:w,children:`Recipient`}),(0,l.jsx)(`input`,{type:`email`,className:C,value:N,onChange:e=>P(e.target.value),placeholder:`recipient@example.com`,"data-testid":`smtp-test-to`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Template`}),(0,l.jsxs)(`select`,{className:C,value:F,onChange:e=>I(e.target.value),"data-testid":`smtp-test-template`,children:[(0,l.jsx)(`option`,{value:`verify`,children:`verify`}),(0,l.jsx)(`option`,{value:`reset`,children:`reset`}),(0,l.jsx)(`option`,{value:`password-changed`,children:`password-changed`})]})]}),(0,l.jsx)(`button`,{type:`button`,className:E,disabled:B.isPending||!N,onClick:()=>B.mutate({to:N,template:F}),"data-testid":`smtp-test-send`,children:B.isPending?`Sending…`:`Send test`})]})]}),(0,l.jsx)(A,{msg:t}),(0,l.jsx)(s,{open:u,title:`Clear DB SMTP settings?`,body:`Removes smtp.* entries from the DB. Env vars will still apply if they're set (e.g. SMTP_HOST from OpenBao).`,confirmText:`Clear`,danger:!0,busy:z.isPending,onConfirm:()=>{z.mutate(),d(!1)},onCancel:()=>d(!1)})]})}var N=[`verify`,`reset`,`password-changed`];function P(){let e=o(),[t,n]=(0,c.useState)(null),[r,s]=(0,c.useState)(`verify`),[u,d]=(0,c.useState)(``),[f,p]=(0,c.useState)(``),{data:m}=a({queryKey:[`admin-config`],queryFn:()=>i.get(`/api/admin/config`)});function h(e){s(e);let t=new Map((m?.config||[]).map(e=>[e.key,e.value||``]));d(t.get(`email.`+e+`.subject`)||``),p(t.get(`email.`+e+`.body`)||``)}m&&!u&&!f&&h(r);let g=j();async function _(){n(null);try{await Promise.all([g.mutateAsync({key:`email.`+r+`.subject`,value:u}),g.mutateAsync({key:`email.`+r+`.body`,value:f})]),n({text:`Email template saved`,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-config`]})}catch(e){n({text:e.message,kind:`err`})}}return(0,l.jsxs)(`section`,{className:S,"data-testid":`admin-email-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Email templates`}),(0,l.jsxs)(`div`,{className:`max-w-xs`,children:[(0,l.jsx)(`label`,{className:w,children:`Template`}),(0,l.jsx)(`select`,{className:C,value:r,onChange:e=>h(e.target.value),"data-testid":`email-template`,children:N.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Subject`}),(0,l.jsx)(`input`,{className:C,value:u,onChange:e=>d(e.target.value),"data-testid":`email-subject`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:w,children:`Body (HTML)`}),(0,l.jsx)(`textarea`,{rows:10,className:C+` resize-y font-mono text-xs`,value:f,onChange:e=>p(e.target.value),"data-testid":`email-body`})]}),(0,l.jsx)(`button`,{type:`button`,className:T,disabled:g.isPending,onClick:_,"data-testid":`email-save`,children:g.isPending?`Saving…`:`Save template`}),(0,l.jsx)(A,{msg:t})]})}function F(){let e=o(),[t,n]=(0,c.useState)(null),[u,d]=(0,c.useState)(``),[f,p]=(0,c.useState)(``),[m,h]=(0,c.useState)(!1),{data:g}=a({queryKey:[`admin-prompts`],queryFn:()=>i.get(`/api/admin/config/prompts`)});g&&!u&&g.prompts.length>0&&(d(g.prompts[0].key),p(g.prompts[0].value));function _(e){d(e);let t=g?.prompts.find(t=>t.key===e);p(t?.value||``)}let v=j(),y=r({mutationFn:e=>i.post(`/api/admin/config/prompts/${encodeURIComponent(e)}/reset`,{}),onSuccess:t=>{p(t.value),n({text:`Prompt reset to default`,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-prompts`]})},onError:e=>n({text:e.message,kind:`err`})});async function b(){n(null);try{await v.mutateAsync({key:`prompt.`+u,value:f}),n({text:`Prompt saved`,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-prompts`]})}catch(e){n({text:e.message,kind:`err`})}}return(0,l.jsxs)(`section`,{className:S,"data-testid":`admin-prompts-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`AI Prompts`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`System prompts injected before each generation. Reset restores the hardcoded default from src/utils/prompts.ts.`}),(0,l.jsxs)(`div`,{className:`max-w-md`,children:[(0,l.jsx)(`label`,{className:w,children:`Prompt`}),(0,l.jsx)(`select`,{className:C,value:u,onChange:e=>_(e.target.value),"data-testid":`prompts-select`,children:(g?.prompts||[]).map(e=>(0,l.jsx)(`option`,{value:e.key,children:e.key},e.key))})]}),(0,l.jsx)(`textarea`,{rows:14,className:C+` resize-y font-mono text-xs`,value:f,onChange:e=>p(e.target.value),"data-testid":`prompts-text`}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,className:T,disabled:v.isPending||!u,onClick:b,"data-testid":`prompts-save`,children:v.isPending?`Saving…`:`Save prompt`}),(0,l.jsx)(`button`,{type:`button`,className:E,disabled:!u,onClick:()=>h(!0),"data-testid":`prompts-reset`,children:`Reset to default`})]}),(0,l.jsx)(A,{msg:t}),(0,l.jsx)(s,{open:m,title:`Reset "${u}"?`,body:`Restores the hardcoded default. Cannot be undone.`,confirmText:`Reset`,danger:!0,busy:y.isPending,onConfirm:()=>{y.mutate(u),h(!1)},onCancel:()=>h(!1)})]})}function I(){let e=o(),[t,n]=(0,c.useState)(null),{data:s}=a({queryKey:[`admin-models`],queryFn:()=>i.get(`/api/admin/config/models`)}),u=r({mutationFn:e=>i.put(`/api/admin/config/models/toggle`,e),onSuccess:()=>e.invalidateQueries({queryKey:[`admin-models`]}),onError:e=>n({text:e.message,kind:`err`})}),d=r({mutationFn:e=>i.put(`/api/admin/config/models/default`,{modelId:e}),onSuccess:(t,r)=>{n({text:`Default model set to ${r}`,kind:`ok`}),e.invalidateQueries({queryKey:[`admin-models`]})},onError:e=>n({text:e.message,kind:`err`})});return(0,l.jsxs)(`section`,{className:S,"data-testid":`admin-models-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`AI Models`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Active provider: `,(0,l.jsx)(`strong`,{children:s?.provider||`—`}),s?.defaultModel&&(0,l.jsxs)(l.Fragment,{children:[` · Default: `,(0,l.jsx)(`strong`,{children:s.defaultModel})]})]}),s?.litellmHint&&(0,l.jsx)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:`LiteLLM provider has no built-in model list — use the legacy "Discover" flow to populate.`}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`admin-models-table`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Enabled`}),(0,l.jsx)(`th`,{className:O,children:`Default`}),(0,l.jsx)(`th`,{className:O,children:`Model ID`}),(0,l.jsx)(`th`,{className:O,children:`Label`})]})}),(0,l.jsxs)(`tbody`,{children:[(s?.models||[]).map(e=>(0,l.jsxs)(`tr`,{"data-testid":`admin-model-row-${e.id}`,children:[(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(`input`,{type:`checkbox`,className:`accent-primary size-4`,checked:e.enabled,onChange:t=>u.mutate({id:e.id,enabled:t.target.checked})})}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(`input`,{type:`radio`,name:`default-model`,checked:s?.defaultModel===e.id,onChange:()=>d.mutate(e.id),disabled:!e.enabled})}),(0,l.jsx)(`td`,{className:k+` font-mono text-xs`,children:e.id}),(0,l.jsx)(`td`,{className:k,children:e.label||`—`})]},e.id)),(s?.models||[]).length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{className:k+` italic text-muted-foreground`,colSpan:4,children:`No models available.`})})]})]})}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Model discovery (search + add-custom) still lives in the legacy viewer — ports when the provider integration is revamped.`}),(0,l.jsx)(A,{msg:t})]})}function L(e){return a({queryKey:[`voice-provider`,e],queryFn:()=>i.get(e)})}function R(){let e=o(),[t,n]=(0,c.useState)(null),{data:r}=L(`/api/admin/config/tts`),i=j(),[a,s]=(0,c.useState)(``);r&&a===``&&r.defaultVoice&&s(r.defaultVoice);async function u(){n(null);try{await i.mutateAsync({key:`tts.default_voice`,value:a}),n({text:`Default TTS voice saved`,kind:`ok`}),e.invalidateQueries({queryKey:[`voice-provider`,`/api/admin/config/tts`]})}catch(e){n({text:e.message,kind:`err`})}}return(0,l.jsxs)(`section`,{className:S,"data-testid":`admin-tts-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`TTS Provider`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Active provider: `,(0,l.jsx)(`strong`,{children:r?.provider||`—`})]}),(0,l.jsxs)(`div`,{className:`max-w-md`,children:[(0,l.jsx)(`label`,{className:w,children:`Default voice`}),(0,l.jsxs)(`select`,{className:C,value:a,onChange:e=>s(e.target.value),"data-testid":`admin-tts-voice`,children:[(0,l.jsx)(`option`,{value:``,children:`(none)`}),(r?.voices||[]).map(e=>(0,l.jsx)(`option`,{value:e.value,children:e.label||e.value},e.value))]})]}),(0,l.jsx)(`button`,{type:`button`,className:T,disabled:i.isPending,onClick:u,"data-testid":`admin-tts-save`,children:i.isPending?`Saving…`:`Save default voice`}),(0,l.jsx)(A,{msg:t})]})}function z(){let e=o(),[t,n]=(0,c.useState)(null),{data:r}=L(`/api/admin/config/stt`),i=j(),[a,s]=(0,c.useState)(``);r&&a===``&&r.defaultModel&&s(r.defaultModel);async function u(){n(null);try{await i.mutateAsync({key:`stt.default_model`,value:a}),n({text:`Default STT model saved`,kind:`ok`}),e.invalidateQueries({queryKey:[`voice-provider`,`/api/admin/config/stt`]})}catch(e){n({text:e.message,kind:`err`})}}return(0,l.jsxs)(`section`,{className:S,"data-testid":`admin-stt-tab`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`STT Provider`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Active provider: `,(0,l.jsx)(`strong`,{children:r?.provider||`—`})]}),(0,l.jsxs)(`div`,{className:`max-w-md`,children:[(0,l.jsx)(`label`,{className:w,children:`Default STT model`}),(0,l.jsxs)(`select`,{className:C,value:a,onChange:e=>s(e.target.value),"data-testid":`admin-stt-model`,children:[(0,l.jsx)(`option`,{value:``,children:`(none)`}),(r?.models||[]).map(e=>(0,l.jsx)(`option`,{value:e.value,children:e.label||e.value},e.value))]})]}),(0,l.jsx)(`button`,{type:`button`,className:T,disabled:i.isPending,onClick:u,"data-testid":`admin-stt-save`,children:i.isPending?`Saving…`:`Save default model`}),(0,l.jsx)(A,{msg:t})]})}var B=[``,`auth`,`admin`,`clinical`,`export`,`integration`,`documents`];function V(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(100),{data:o,isLoading:s,error:u,refetch:d}=a({queryKey:[`admin-logs`,e,n],queryFn:()=>i.get(`/api/admin/logs/all?limit=${n}${e?`&category=`+encodeURIComponent(e):``}`)});return(0,l.jsxs)(`section`,{className:S,"data-testid":`admin-logs-tab`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Audit Logs`}),(0,l.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,l.jsx)(`label`,{className:w,children:`Category`}),(0,l.jsx)(`select`,{className:C+` w-36 text-xs`,value:e,onChange:e=>t(e.target.value),"data-testid":`admin-logs-category`,children:B.map(e=>(0,l.jsx)(`option`,{value:e,children:e||`(all)`},e))}),(0,l.jsx)(`label`,{className:w,children:`Limit`}),(0,l.jsx)(`select`,{className:C+` w-24 text-xs`,value:n,onChange:e=>r(Number(e.target.value)),"data-testid":`admin-logs-limit`,children:[50,100,200,500].map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))}),(0,l.jsx)(`button`,{type:`button`,className:E,onClick:()=>d(),children:`Refresh`})]})]}),s&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),u&&(0,l.jsx)(`div`,{className:`text-sm text-destructive`,children:u.message}),(0,l.jsx)(`div`,{className:`overflow-x-auto max-h-[70vh] overflow-y-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`admin-logs-table`,children:[(0,l.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Time`}),(0,l.jsx)(`th`,{className:O,children:`User`}),(0,l.jsx)(`th`,{className:O,children:`Category`}),(0,l.jsx)(`th`,{className:O,children:`Action`}),(0,l.jsx)(`th`,{className:O,children:`Detail`}),(0,l.jsx)(`th`,{className:O,children:`IP`})]})}),(0,l.jsx)(`tbody`,{children:(o?.logs||[]).map(e=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` text-xs whitespace-nowrap`,children:new Date(e.timestamp).toLocaleString()}),(0,l.jsxs)(`td`,{className:k+` text-xs`,children:[e.user_email||`—`,e.user_name?` (${e.user_name})`:``]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.category}),(0,l.jsx)(`td`,{className:k+` text-xs font-mono`,children:e.action}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.detail}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e.ip_address||``})]},e.id))})]})})]})}var H=`rounded-lg border border-border bg-card p-5 space-y-3`,U=[{id:`users`,label:`Users`},{id:`settings`,label:`Site settings`},{id:`announcement`,label:`Announcement`},{id:`models`,label:`AI models`},{id:`tts`,label:`TTS provider`},{id:`stt`,label:`STT provider`},{id:`smtp`,label:`SMTP`},{id:`email`,label:`Email templates`},{id:`prompts`,label:`AI prompts`},{id:`logs`,label:`Audit logs`}];function W(){let{data:e,isLoading:t}=a({queryKey:[`auth-me`],queryFn:()=>i.get(`/api/auth/me`),staleTime:5*6e4}),[n,r]=(0,c.useState)(`users`);return t?(0,l.jsx)(`div`,{className:`max-w-3xl mx-auto p-6 text-sm text-muted-foreground`,children:`Checking permissions…`}):e?.user.role===`admin`?(0,l.jsxs)(`div`,{className:`max-w-6xl mx-auto p-6 space-y-4`,"data-testid":`admin-shell`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Admin Panel`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Users, site settings, announcement banner, AI model management, TTS/STT provider, SMTP, email templates, and audit logs.`})]}),(0,l.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`admin-subnav`,children:U.map(e=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors `+(n===e.id?`bg-primary text-primary-foreground border-primary`:`bg-muted hover:bg-muted/80 border-border`),"data-testid":`admin-tab-`+e.id,children:e.label},e.id))}),n===`users`&&(0,l.jsx)(y,{}),n===`settings`&&(0,l.jsx)(b,{}),n===`announcement`&&(0,l.jsx)(x,{}),n===`models`&&(0,l.jsx)(I,{}),n===`tts`&&(0,l.jsx)(R,{}),n===`stt`&&(0,l.jsx)(z,{}),n===`smtp`&&(0,l.jsx)(M,{}),n===`email`&&(0,l.jsx)(P,{}),n===`prompts`&&(0,l.jsx)(F,{}),n===`logs`&&(0,l.jsx)(V,{})]}):(0,l.jsx)(`div`,{className:`max-w-3xl mx-auto p-6`,children:(0,l.jsxs)(`section`,{className:H,"data-testid":`admin-access-denied`,children:[(0,l.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Admin only`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This page is restricted to users with the admin role. If you believe this is a mistake, contact your site administrator.`})]})})}export{W as default}; \ No newline at end of file diff --git a/public/app/assets/Bedside-Dp0dEd6U.js b/public/app/assets/Bedside-Dp0dEd6U.js new file mode 100644 index 0000000..3dbbe00 --- /dev/null +++ b/public/app/assets/Bedside-Dp0dEd6U.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{c as r,d as i,i as a,l as o,u as s}from"./fenton-9EKyvVkL.js";var c=e(t(),1),l=n(),u=`rounded-lg border border-border bg-card p-5 space-y-3`,d=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,f=`block text-xs font-medium text-muted-foreground`,p=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,m=`px-2 py-1.5 border-b border-border align-top text-sm`;function h({label:e}){let t=e.indexOf(`(`);return t<0?(0,l.jsx)(`span`,{className:`font-semibold`,children:e}):(0,l.jsxs)(`span`,{children:[(0,l.jsx)(`span`,{className:`font-semibold`,children:e.slice(0,t).trim()}),` `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.slice(t)})]})}function g({children:e,notes:t=!0}){return(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:p,children:`Drug`}),(0,l.jsx)(`th`,{className:p,children:`Dose`}),(0,l.jsx)(`th`,{className:p,children:`Route`}),t&&(0,l.jsx)(`th`,{className:p,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:e})]})})}function _({name:e,dose:t,route:n,notes:r}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:m+` font-semibold`,dangerouslySetInnerHTML:{__html:e}}),(0,l.jsx)(`td`,{className:m,children:t}),(0,l.jsx)(`td`,{className:m+` text-xs`,children:n}),r!==void 0&&(0,l.jsx)(`td`,{className:m+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}function v(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`0`),[i,o]=(0,c.useState)(``),[s,p]=(0,c.useState)(`male`),[m,v]=(0,c.useState)(``),[y,b]=(0,c.useState)({appearance:2,pulse:2,grimace:2,activity:2,respiration:2}),x=Number.parseInt(e,10),S=Number.parseInt(n,10)||0,C=Number.parseFloat(i),w=Number.isFinite(x)&&x>=22&&x<=44&&Number.isFinite(C)&&C>0?a(x,S,C,s):null,T=Number.parseFloat(m),E=Number.isFinite(T)&&T>0,D=E?Math.round(T*.01*100)/100:0,O=E?Math.round(T*.03*100)/100:0,k=E?Math.round(T*.05*100)/100:0,A=E?Math.round(T*.1*100)/100:0,j=E?Math.round(T*10):0,M=E?Math.round(T*2*10)/10:0,N=Object.values(y).reduce((e,t)=>e+t,0),P=N>=7?`Reassuring`:N>=4?`Moderately depressed`:`Severely depressed`,F=N>=7?`text-green-600 bg-green-50`:N>=4?`text-amber-600 bg-amber-50`:`text-destructive bg-red-50`,I=N>=7?`Routine newborn care. Continue reassessment. Repeat at 5 min.`:N>=4?`Stimulate, clear airway, warm. Give O₂ if cyanotic. Ventilate with PPV if HR <100 or apneic/gasping. Reassess q30 sec.`:`Full NRP pathway — PPV immediately. Intubate if PPV ineffective. Chest compressions if HR <60. Epinephrine and volume per NRP.`;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-neonatal`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Neonatal Assessment + NRP + Apgar`}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Gestational age + size assessment (Fenton 2013)`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-2 sm:grid-cols-4 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`GA weeks`}),(0,l.jsx)(`input`,{type:`number`,min:`22`,max:`44`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`neo-weeks`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`GA days (0-6)`}),(0,l.jsx)(`input`,{type:`number`,min:`0`,max:`6`,className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`neo-days`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Birth wt (g)`}),(0,l.jsx)(`input`,{type:`number`,min:`200`,max:`7000`,className:d,value:i,onChange:e=>o(e.target.value),"data-testid":`neo-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Sex`}),(0,l.jsxs)(`select`,{className:d,value:s,onChange:e=>p(e.target.value),"data-testid":`neo-sex`,children:[(0,l.jsx)(`option`,{value:`male`,children:`Male`}),(0,l.jsx)(`option`,{value:`female`,children:`Female`})]})]})]}),w&&(0,l.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,"data-testid":`neo-result`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:w.gaClass.color+`55`,background:w.gaClass.color+`10`},children:[(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Gestational Age`}),(0,l.jsx)(`div`,{className:`text-base font-bold`,style:{color:w.gaClass.color},children:w.gaClass.label}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[x,` wk `,S,` d (`,w.gaDecimal.toFixed(1),` wk)`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:w.weightClass.color+`55`,background:w.weightClass.color+`10`},children:[(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Weight for Gestational Age`}),(0,l.jsx)(`div`,{className:`text-base font-bold`,style:{color:w.weightClass.color},children:w.weightClass.label}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[w.percentile.toFixed(1),`th percentile · `,w.weightClass.detail]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:w.bwClass.color+`55`,background:w.bwClass.color+`10`},children:[(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Birth Weight Category`}),(0,l.jsx)(`div`,{className:`text-base font-bold`,style:{color:w.bwClass.color},children:w.bwClass.label}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[C,` g (`,(C/1e3).toFixed(2),` kg)`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/40 p-3 text-xs`,children:[(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:[`Fenton (`,s,`)`]}),(0,l.jsxs)(`div`,{className:`space-y-0.5 mt-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Expected weight (M):`}),` `,w.expectedWeight,` g`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Z-score:`}),` `,w.z.toFixed(2)]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Percentile:`}),` `,w.percentile.toFixed(1),`%`]})]})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`NRP pathway (AHA/AAP 8th ed 2020)`}),(0,l.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`BIRTH — ASSESS (first 30 sec)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Term? Tone? Breathing/crying? All yes → routine care. Any no → warm, dry, stimulate, clear airway PRN, evaluate HR + resp.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <100 OR apneic/gasping (60 s)`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`Start PPV`}),` 40-60 breaths/min, room air for term / 21-30% for preterm. Attach SpO₂ (right hand) ± ECG. MR SOPA if ineffective.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <100 after 30 s effective PPV`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Reassess ventilation — ensure chest rise. Consider increasing FiO₂, intubation, or LMA. Continue PPV.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-red-500 bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <60 after 30 s effective PPV`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`Intubate + chest compressions`}),` — 3:1 ratio (90 compressions + 30 breaths/min), FiO₂ 100%, lower 1/3 sternum, depth 1/3 AP chest.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-100 dark:bg-red-950/40 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <60 despite compressions + PPV × 60 s`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`Epinephrine 1:10,000 (0.1 mg/mL):`}),` IV/IO 0.01-0.03 mg/kg (0.1-0.3 mL/kg) — preferred. ETT 0.05-0.1 mg/kg. Repeat q3-5 min. Hypovolemia: `,(0,l.jsx)(`strong`,{children:`NS 10 mL/kg IV/IO over 5-10 min`}),`.`]})]})]}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2 text-xs`,children:[(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`Target SpO₂ (preductal):`}),(0,l.jsx)(`br`,{}),`1 min 60-65% · 2 min 65-70% · 3 min 70-75% · 4 min 75-80% · 5 min 80-85% · 10 min 85-95%`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`Initial ETT size:`}),(0,l.jsx)(`br`,{}),`<1 kg / <28 wk: 2.5 · 1-2 kg / 28-34 wk: 3.0 · 2-3 kg / 34-38 wk: 3.5 · >3 kg / >38 wk: 3.5-4.0`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`ETT depth (lip):`}),` ~6 + weight(kg) cm`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`NRP drug doses`}),(0,l.jsxs)(`div`,{className:`max-w-xs`,children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:m,onChange:e=>v(e.target.value),"data-testid":`nrp-weight`})]}),E?(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Epinephrine 1:10,000`,dose:(0,l.jsx)(h,{label:`${D}-${O} mg, ${Math.round(D*10)/10}-${Math.round(O*10)/10} mL (0.01-0.03 mg/kg = 0.1-0.3 mL/kg)`}),route:`IV / IO`,notes:`Preferred route. Repeat q3-5 min.`}),(0,l.jsx)(_,{name:`Epinephrine 1:10,000`,dose:(0,l.jsx)(h,{label:`${k}-${A} mg, ${Math.round(k*10)/10}-${Math.round(A*10)/10} mL (0.05-0.1 mg/kg = 0.5-1 mL/kg)`}),route:`ETT`,notes:`While IV being placed.`}),(0,l.jsx)(_,{name:`Normal saline`,dose:(0,l.jsx)(h,{label:`${j} mL (10 mL/kg)`}),route:`IV / IO`,notes:`Over 5-10 min for volume. Repeat PRN.`}),(0,l.jsx)(_,{name:`Dextrose 10%`,dose:(0,l.jsx)(h,{label:`${M} mL (2 mL/kg = 0.2 g/kg)`}),route:`IV slow push`,notes:`For documented hypoglycemia. Then D10 infusion 4-6 mg/kg/min.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see NRP doses.`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Concentration note:`}),` NRP uses epinephrine `,(0,l.jsx)(`strong`,{children:`1:10,000`}),` (0.1 mg/mL). NOT 1:1000 (1 mg/mL) — that is IM for anaphylaxis / older patients.`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Apgar score`}),(0,l.jsx)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-5 text-xs`,children:[[`appearance`,`Appearance`,[`Blue/pale`,`Body pink, extremities blue`,`All pink`]],[`pulse`,`Pulse`,[`Absent`,`<100 bpm`,`≥100 bpm`]],[`grimace`,`Grimace`,[`No response`,`Grimace`,`Cough/sneeze`]],[`activity`,`Activity`,[`Limp`,`Some flexion`,`Active motion`]],[`respiration`,`Respiration`,[`Absent`,`Slow/irregular`,`Good/crying`]]].map(([e,t,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:t}),(0,l.jsx)(`select`,{className:d,value:y[e],onChange:t=>b({...y,[e]:Number(t.target.value)}),"data-testid":`apgar-`+e,children:n.map((e,t)=>(0,l.jsxs)(`option`,{value:t,children:[t,` — `,e]},t))})]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+F,"data-testid":`apgar-result`,children:[(0,l.jsxs)(`div`,{className:`text-base font-bold`,children:[`Apgar: `,N,`/10 — `,P]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:I})]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground italic`,children:[`Fenton TR, Kim JH. BMC Pediatr 2013;13:59 · NRP 8th ed (AHA/AAP 2020) · Apgar is a description of status — `,(0,l.jsx)(`strong`,{children:`never`}),` delay resuscitation while scoring.`]})]})}function y(){let[e,t]=(0,c.useState)(`asthma`),[n,r]=(0,c.useState)(``),i=Number.parseFloat(n),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n):null,[p,m]=(0,c.useState)(null),[v,y]=(0,c.useState)({spo2:0,retractions:0,scalene:0,air:0,wheeze:0}),b=Object.values(v).reduce((e,t)=>e+t,0),x=b<=3?`Mild`:b<=7?`Moderate`:`Severe`,S=b<=3?`text-green-600 bg-green-50`:b<=7?`text-amber-600 bg-amber-50`:`text-destructive bg-red-50`,[C,w]=(0,c.useState)({conscious:0,cyanosis:0,stridor:0,air:0,retractions:0}),T=Object.values(C).reduce((e,t)=>e+t,0),E=T<=2?`Mild`:T<=5?`Moderate`:T<=11?`Severe`:`Impending Respiratory Failure`,D=T<=2?`text-green-600 bg-green-50`:T<=5?`text-amber-600 bg-amber-50`:T<=11?`text-destructive bg-red-50`:`text-red-900 bg-red-100`,[O,k]=(0,c.useState)({age:`gte12w`,spo2:`ok`,hydration:`ok`,distress:`mild`}),A=O.distress===`severe`||O.spo2===`low`||O.hydration===`poor`||O.age===`lt12w`;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-respiratory`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Respiratory`}),(0,l.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:[`asthma`,`pram`,`croup`,`bronch`].map(n=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:`px-3 py-1 rounded-full text-xs font-medium border `+(e===n?`bg-primary text-primary-foreground border-primary`:`bg-muted border-border`),"data-testid":`resp-mode-`+n,children:n===`asthma`?`Asthma`:n===`pram`?`PRAM`:n===`croup`?`Croup (Westley)`:`Bronchiolitis`},n))}),e!==`pram`&&e!==`bronch`&&(0,l.jsxs)(`div`,{className:`max-w-xs`,children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`resp-weight`})]}),e===`asthma`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`flex gap-2`,children:[`mild`,`moderate`,`severe`].map(e=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`px-3 py-1 rounded text-xs font-medium border `+(p===e?e===`mild`?`bg-green-600 text-white`:e===`moderate`?`bg-amber-500 text-white`:`bg-destructive text-white`:`bg-muted`),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),p&&!a&&(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`}),p===`mild`&&a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in sentences, no accessory muscle use, SpO₂ ≥94%`}),(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Albuterol (MDI)`,dose:`4-8 puffs via spacer`,route:`Inhaled`,notes:`q20min × 3 doses, then q1-4h`}),(0,l.jsx)(_,{name:`Albuterol (neb)`,dose:(0,l.jsx)(h,{label:`${o(.15,5,`mg`).label} (min 2.5 mg)`}),route:`Nebulized`,notes:`q20min × 3 doses`}),(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:`PO/IV`,notes:`Single dose, or 2 days`}),(0,l.jsx)(_,{name:`Prednisolone`,dose:(0,l.jsx)(h,{label:`${o(1,60).label}/day`}),route:`PO`,notes:`Alternative: 3-5 day course`})]})]}),p===`moderate`&&a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in phrases, some accessory muscle use, SpO₂ 90-93%`}),(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Albuterol (neb)`,dose:(0,l.jsx)(h,{label:`${o(.15,5,`mg`).label} (min 2.5 mg)`}),route:`Nebulized`,notes:`q20min × 3 doses, then continuous if needed`}),(0,l.jsx)(_,{name:`Ipratropium`,dose:i<20?`250 mcg`:`500 mcg`,route:`Nebulized`,notes:`q20min × 3 doses with albuterol`}),(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:`PO/IV/IM`,notes:`Single dose`}),(0,l.jsx)(_,{name:`O₂ supplemental`,dose:`Target SpO₂ ≥94%`,route:`NC/mask`,notes:`Titrate to effect`})]})]}),p===`severe`&&a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in words only, significant accessory muscle use, SpO₂ <90%. Consider ICU.`}),(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Albuterol continuous`,dose:(0,l.jsx)(h,{label:`${o(.5,20,`mg`).label}/hr`}),route:`Continuous neb`,notes:`Or 0.15-0.3 mg/kg q20min`}),(0,l.jsx)(_,{name:`Ipratropium`,dose:i<20?`250 mcg`:`500 mcg`,route:`Nebulized`,notes:`q20min × 3 doses with albuterol`}),(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:`IV`,notes:`Or methylprednisolone 2 mg/kg IV (max 60 mg)`}),(0,l.jsx)(_,{name:`Magnesium sulfate`,dose:(0,l.jsx)(h,{label:`${o(50,2e3).label} IV over 20 min`}),route:`IV`,notes:`Single dose, monitor BP`}),(0,l.jsx)(_,{name:`Epinephrine (IM)`,dose:(0,l.jsx)(h,{label:`${o(.01,.5).label} (1:1000)`}),route:`IM`,notes:`If impending arrest / no IV access`}),(0,l.jsx)(_,{name:`Terbutaline`,dose:(0,l.jsx)(h,{label:`${o(.01,.4).label} SC/IV`}),route:`SC/IV`,notes:`Then 0.1-10 mcg/kg/min infusion`}),(0,l.jsx)(_,{name:`O₂ supplemental`,dose:`Target SpO₂ ≥94%`,route:`High flow / NIPPV`,notes:`Consider BiPAP/CPAP`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-xs text-red-900 dark:text-red-100`,children:[(0,l.jsx)(`strong`,{children:`Continuous monitoring.`}),` Consider ICU admission. If no response to magnesium → terbutaline infusion. If impending respiratory failure → intubation (ketamine preferred induction agent).`]})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`NAEPP/GINA guidelines. Always use clinical judgment.`})]}),e===`pram`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pediatric Respiratory Assessment Measure (PRAM) — for asthma exacerbation severity (0-12).`}),(0,l.jsx)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2`,children:[[`spo2`,`SpO₂`,[`≥95% (0)`,`92-94% (1)`,`<92% (2)`]],[`retractions`,`Suprasternal retractions`,[`Absent (0)`,`Present (2)`]],[`scalene`,`Scalene muscle use`,[`Absent (0)`,`Present (2)`]],[`air`,`Air entry`,[`Normal (0)`,`Mild ↓ at bases (1)`,`Widespread ↓ (2)`,`Absent/minimal (3)`]],[`wheeze`,`Wheezing`,[`Absent (0)`,`Expiratory only (1)`,`Ins+exp (2)`,`Audible without stethoscope/silent chest (3)`]]].map(([e,t,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:t}),(0,l.jsx)(`select`,{className:d,value:v[e],onChange:t=>y({...v,[e]:Number(t.target.value)}),"data-testid":`pram-`+e,children:n.map((e,t)=>(0,l.jsx)(`option`,{value:t,children:e},t))})]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+S,"data-testid":`pram-result`,children:[(0,l.jsxs)(`div`,{className:`text-base font-bold`,children:[`PRAM Score: `,b,`/12 — `,x]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Mild (0-3): outpatient management. Moderate (4-7): consider oral steroids + frequent bronchodilators. Severe (8-12): aggressive treatment, consider ICU.`})]})]}),e===`croup`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Westley croup score (0-17).`}),(0,l.jsx)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2`,children:[[`conscious`,`Level of consciousness`,[`Normal (0)`,`Disoriented (5)`]],[`cyanosis`,`Cyanosis`,[`None (0)`,`With agitation (4)`,`At rest (5)`]],[`stridor`,`Stridor`,[`None (0)`,`With agitation (1)`,`At rest (2)`]],[`air`,`Air entry`,[`Normal (0)`,`Decreased (1)`,`Severely decreased (2)`]],[`retractions`,`Retractions`,[`None (0)`,`Mild (1)`,`Moderate (2)`,`Severe (3)`]]].map(([e,t,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:t}),(0,l.jsx)(`select`,{className:d,value:C[e],onChange:t=>w({...C,[e]:Number(t.target.value)}),"data-testid":`croup-`+e,children:n.map((e,t)=>(0,l.jsx)(`option`,{value:t,children:e},t))})]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+D,"data-testid":`croup-result`,children:[(0,l.jsxs)(`div`,{className:`text-base font-bold`,children:[`Westley: `,T,`/17 — `,E]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Mild ≤2 · Moderate 3-5 · Severe 6-11 · Impending failure ≥12.`})]}),a&&(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:T<=2?`PO`:T<=5?`PO/IM`:`IV/IM`,notes:`Preferred corticosteroid; single dose`}),T>2&&(0,l.jsx)(_,{name:`Racemic epinephrine`,dose:`0.5 mL of 2.25% solution`,route:`Nebulized`,notes:`May repeat q15-20min, observe 2-4 h`}),T>2&&(0,l.jsx)(_,{name:`Nebulized epinephrine`,dose:`0.5 mL/kg of 1:1000 (max 5 mL)`,route:`Nebulized`,notes:`Alternative to racemic`}),T>5&&(0,l.jsx)(_,{name:`Heliox`,dose:`70:30 or 80:20`,route:`Face mask`,notes:`Consider if not responding`})]})]}),e===`bronch`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age`}),(0,l.jsxs)(`select`,{className:d,value:O.age,onChange:e=>k({...O,age:e.target.value}),children:[(0,l.jsx)(`option`,{value:`lt12w`,children:`<12 weeks (high risk)`}),(0,l.jsx)(`option`,{value:`gte12w`,children:`≥12 weeks`})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`SpO₂`}),(0,l.jsxs)(`select`,{className:d,value:O.spo2,onChange:e=>k({...O,spo2:e.target.value}),children:[(0,l.jsx)(`option`,{value:`ok`,children:`≥90%`}),(0,l.jsx)(`option`,{value:`low`,children:`<90%`})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Hydration`}),(0,l.jsxs)(`select`,{className:d,value:O.hydration,onChange:e=>k({...O,hydration:e.target.value}),children:[(0,l.jsx)(`option`,{value:`ok`,children:`Adequate`}),(0,l.jsx)(`option`,{value:`poor`,children:`Poor oral intake`})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Distress`}),(0,l.jsxs)(`select`,{className:d,value:O.distress,onChange:e=>k({...O,distress:e.target.value}),children:[(0,l.jsx)(`option`,{value:`mild`,children:`Mild`}),(0,l.jsx)(`option`,{value:`moderate`,children:`Moderate`}),(0,l.jsx)(`option`,{value:`severe`,children:`Severe`})]})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+(A?`text-destructive bg-red-50`:`text-green-600 bg-green-50`),"data-testid":`bronch-result`,children:[(0,l.jsx)(`div`,{className:`text-base font-bold`,children:A?`Admit / Observe`:`Likely Safe for Discharge`}),O.age===`lt12w`&&(0,l.jsx)(`div`,{className:`text-xs text-destructive mt-1`,children:`⚠ Age <12 weeks — high risk for apnea. Monitor closely.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`NOT recommended (AAP 2014/2023):`}),` Albuterol/salbutamol (no benefit), epinephrine (no evidence), systemic corticosteroids (no benefit), antibiotics (unless bacterial co-infection), chest physiotherapy.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Clinical Practice Guideline: Management of Bronchiolitis in Infants and Children (2014, reaffirmed 2023). RSV most common (50-80%).`})]})]})}function b(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(``),i=Number.parseFloat(e),a=Number.parseFloat(n),o=Number.isFinite(i)&&i>0,s=o?Math.round(i*1*10)/10:0,p=o?Math.round(i*2*10)/10:0,m=o?Math.round(i*6*10)/10:0,h=o?Math.round(i*8*10)/10:0,v=Number.isFinite(a)&&a>=0?a<.1?`30-40`:a<1?`25-35`:a<5?`20-25`:a<12?`16-20`:`12-16`:``;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-ventilation`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`O₂ & Ventilation`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-2 max-w-md`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`vent-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age (years)`}),(0,l.jsx)(`input`,{type:`number`,min:`0`,step:`0.5`,className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`vent-age`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Target SpO₂`}),(0,l.jsxs)(g,{notes:!0,children:[(0,l.jsx)(_,{name:`Most children`,dose:`94-98%`,route:`—`,notes:`Normal`}),(0,l.jsx)(_,{name:`Bronchiolitis (AAP 2014/2023)`,dose:`≥90%`,route:`—`,notes:`Don't chase higher saturations`}),(0,l.jsx)(_,{name:`Chronic lung disease / CF`,dose:`90-94%`,route:`—`,notes:`Avoid hyperoxia in CO₂ retainers`}),(0,l.jsx)(_,{name:`Preterm neonate`,dose:`90-95%`,route:`—`,notes:`Minimize ROP risk`}),(0,l.jsx)(_,{name:`Term neonate (min of life)`,dose:`Per NRP ladder`,route:`—`,notes:`1 min 60-65% · 10 min 85-95%`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Escalation ladder`}),(0,l.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`1. Nasal cannula (low-flow)`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`0.5-6 L/min`}),` · FiO₂ ~24-40% · comfortable, no humidification. Good for mild hypoxia.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`2. Simple face mask`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`6-10 L/min`}),` · FiO₂ 35-60%. Must keep flow >6 L/min to flush CO₂.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`3. Non-rebreather mask`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`10-15 L/min`}),` · FiO₂ 60-90%. Reservoir bag must stay inflated.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`4. High-flow nasal cannula (HFNC)`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:o?`1-2 L/kg/min = ${s}-${p} L/min`:`1-2 L/kg/min`}),` · heated + humidified · FiO₂ 30-100% titratable · generates ~2-5 cmH₂O PEEP. Reassess at 1-2 h.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-red-500 bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`5. Non-invasive (CPAP / BiPAP)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`CPAP 5-10 cmH₂O · BiPAP IPAP 10-14 / EPAP 5. Needs cooperative patient, intact airway reflexes, no copious secretions.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-100 dark:bg-red-950/40 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`6. Intubate + mechanical ventilation`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`When NIV fails, airway compromised, apnea, or GCS ≤8. See Airway tab for RSI drugs.`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Bag-Valve-Mask (BVM)`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`When:`}),` apnea, bradycardia (HR <60 neonate; inadequate breathing at any age), during resuscitation.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rate:`}),` Newborn 40-60/min · Infant-child 20-30/min · Adolescent 10-12/min (1 breath q5-6 sec).`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tidal volume:`}),` 6-8 mL/kg — gentle chest rise only. Avoid over-ventilation.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Technique:`}),` head tilt / jaw thrust, E-C or 2-thumb mask seal, squeeze 1 sec, release fully.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Not ventilating?`}),` MR SOPA — Mask reseal, Reposition airway, Suction, Open mouth, Pressure ↑, Alternative airway.`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Mechanical vent — starting settings`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Mode:`}),` Volume-control OR Pressure-control. PRVC / SIMV-PS hybrids.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tidal volume:`}),` `,(0,l.jsx)(`strong`,{children:o?`${m}-${h} mL`:`6-8 mL/kg`}),` (6-8 mL/kg). Use 4-6 mL/kg for ARDS.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rate:`}),` `,v?`${v}/min (age ${a} yr)`:`Newborn 30-40 · Infant 25-35 · Child 16-20 · Adolescent 12-16`,`.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`PEEP:`}),` start 5 cmH₂O. Increase to 8-12+ for refractory hypoxia.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`FiO₂:`}),` start 100%, wean rapidly to lowest that maintains target SpO₂.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`I:E ratio:`}),` 1:2 normally; 1:3-4 for obstructive disease.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Plateau pressure:`}),` keep <30 cmH₂O (ideally <28).`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Adjusting for gas exchange`}),(0,l.jsxs)(g,{notes:!0,children:[(0,l.jsx)(_,{name:`Low SpO₂ (oxygenation)`,dose:`↑ FiO₂`,route:`—`,notes:`Then ↑ PEEP (recruits collapsed alveoli)`}),(0,l.jsx)(_,{name:`↑ PCO₂ (ventilation)`,dose:`↑ Rate`,route:`—`,notes:`Then ↑ Tidal volume`}),(0,l.jsx)(_,{name:`↓ PCO₂ (over-ventilating)`,dose:`↓ Rate`,route:`—`,notes:`Then ↓ Tidal volume`}),(0,l.jsx)(_,{name:`High peak pressure`,dose:`Check tube / compliance`,route:`—`,notes:`Suction, bronchodilator, lower TV`}),(0,l.jsx)(_,{name:`Auto-PEEP (asthma, bronch)`,dose:`↓ Rate, ↑ Te`,route:`—`,notes:`Disconnect + bag briefly if critical`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-xs text-green-900 dark:text-green-100`,children:[(0,l.jsx)(`strong`,{children:`Mental model:`}),` Oxygenation is mostly `,(0,l.jsx)(`strong`,{children:`FiO₂ + PEEP`}),`. Ventilation (CO₂) is mostly `,(0,l.jsx)(`strong`,{children:`rate + tidal volume`}),`. Obstructive (asthma, bronchiolitis) → long expiratory time, permissive hypercapnia. Restrictive (ARDS) → low TV, high PEEP, permissive hypercapnia + hypoxia.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP / PALS / AARC guidance.`})]})}function x(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`child`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n):null,p=n===`neonate`?`Neonate (0-28 d)`:n===`infant`?`Young infant (29 d - 3 mo)`:`Older child / adolescent`,m=a?Math.round(i*20):null;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-sepsis`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Sepsis & Fever`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2 max-w-md`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`sepsis-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age band`}),(0,l.jsxs)(`select`,{className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`sepsis-age`,children:[(0,l.jsx)(`option`,{value:`neonate`,children:`Neonate (0-28 d)`}),(0,l.jsx)(`option`,{value:`infant`,children:`Infant (29 d - 3 mo)`}),(0,l.jsx)(`option`,{value:`child`,children:`Older child / adolescent`})]})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm font-semibold text-destructive`,children:[`Sepsis approach — `,p,a?`, ${i} kg`:``]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Definition — Phoenix Sepsis Criteria (JAMA 2024)`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Sepsis`}),` = suspected or confirmed infection + Phoenix Score ≥2 (organ dysfunction across respiratory, cardiovascular, coagulation, neurological).`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Septic shock`}),` = sepsis + cardiovascular dysfunction (vasoactive support, or ↑lactate ≥5, or ↓MAP for age).`]}),(0,l.jsx)(`div`,{className:`text-muted-foreground italic`,children:`Previous SIRS-based criteria (Goldstein 2005) are now superseded.`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Red flags`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-xs text-red-900 dark:text-red-100`,children:[`Abnormal behavior / mentation · Fever + ill-appearance · Tachycardia out of proportion to fever · Prolonged cap refill (>3 s) · Cold/mottled extremities · Weak pulses or wide pulse pressure ("warm shock") · Hypotension is a `,(0,l.jsx)(`strong`,{children:`LATE`}),` sign · Any immune compromise / indwelling line.`]}),(0,l.jsxs)(`h3`,{className:`text-sm font-semibold mt-2`,children:[`Empirical therapy — `,p]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[n===`neonate`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Workup (full sepsis eval):`}),` CBC+diff, CRP, blood culture, UA+urine culture (cath), `,(0,l.jsx)(`strong`,{children:`LP`}),` (CSF+HSV PCR), CXR if respiratory sx, procalcitonin. `,(0,l.jsx)(`strong`,{children:`Early-onset`}),` (<72 h): GBS, E. coli, Listeria. `,(0,l.jsx)(`strong`,{children:`Late-onset`}),` (>72 h): CoNS, S. aureus, gram-negs, Candida.`]}),n===`infant`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Workup:`}),` Use validated rules — PECARN, Aronson, Rochester, Step-by-Step. CBC+ANC, procalcitonin/CRP, blood culture, UA+urine culture. Many warrant LP + admission + empiric abx. `,(0,l.jsx)(`strong`,{children:`Coverage:`}),` GBS, E. coli, Listeria (up to ~6 wk), S. pneumo, N. meningitidis, H. flu, Salmonella.`]}),n===`child`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Recognition:`}),` Phoenix score or clinical concern + suspected infection. `,(0,l.jsx)(`strong`,{children:`Workup:`}),` CBC, CRP, procalcitonin, blood cx (+site-specific), lactate, blood gas, glucose, electrolytes, coags, LP if CNS concern. Source-directed imaging.`]})]}),a&&(0,l.jsxs)(g,{children:[n===`neonate`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{name:`Ampicillin`,dose:(0,l.jsx)(h,{label:o(100,2e3).label}),route:`IV`,notes:`q8-12h. Covers GBS, Listeria, Enterococcus.`}),(0,l.jsx)(_,{name:`Gentamicin`,dose:(0,l.jsx)(h,{label:o(4,120).label}),route:`IV`,notes:`q24-48h. Monitor levels.`}),(0,l.jsx)(_,{name:`Cefotaxime (add)`,dose:(0,l.jsx)(h,{label:o(50,2e3).label}),route:`IV`,notes:`If meningitis or gram-neg concern.`}),(0,l.jsx)(_,{name:`Acyclovir`,dose:(0,l.jsx)(h,{label:o(20,1200).label}),route:`IV q8h`,notes:`HSV risk: maternal lesions, vesicles, seizures, CSF pleocytosis.`})]}),n===`infant`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{name:`Ceftriaxone`,dose:(0,l.jsx)(h,{label:o(75,2e3).label}),route:`IV / IM`,notes:`q24h (100 mg/kg/day divided q12h for meningitis). Avoid <28 d if hyperbilirubinemia.`}),(0,l.jsx)(_,{name:`Ampicillin`,dose:(0,l.jsx)(h,{label:o(100,2e3).label}),route:`IV`,notes:`If <6 wk: add for Listeria coverage.`}),(0,l.jsx)(_,{name:`Vancomycin`,dose:(0,l.jsx)(h,{label:o(15,1e3).label}),route:`IV`,notes:`If severe / MRSA risk / meningitis.`}),(0,l.jsx)(_,{name:`Acyclovir`,dose:(0,l.jsx)(h,{label:o(20,1200).label}),route:`IV q8h`,notes:`<6 wk with suspicion of HSV.`})]}),n===`child`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{name:`Ceftriaxone`,dose:(0,l.jsx)(h,{label:o(50,2e3).label}),route:`IV`,notes:`q24h (100 mg/kg/day divided for meningitis).`}),(0,l.jsx)(_,{name:`Vancomycin`,dose:(0,l.jsx)(h,{label:o(15,1e3).label}),route:`IV`,notes:`q6h. If severe, indwelling line, or MRSA prevalence >10%.`}),(0,l.jsx)(_,{name:`Piperacillin-tazobactam`,dose:(0,l.jsx)(h,{label:o(100,4500).label}),route:`IV`,notes:`If intra-abdominal / neutropenic.`}),(0,l.jsx)(_,{name:`Clindamycin`,dose:(0,l.jsx)(h,{label:o(10,900).label}),route:`IV`,notes:`Adjunct for toxic shock syndrome (toxin suppression).`}),(0,l.jsx)(_,{name:`Acyclovir`,dose:(0,l.jsx)(h,{label:o(20,1200).label}),route:`IV q8h`,notes:`If HSV CNS concern.`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`First-hour bundle (SSC Peds 2020)`}),(0,l.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`0-5 min — Recognize`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Screen, sepsis huddle/activation, ABCs, O₂ to SpO₂ >94%, warm.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`5-15 min — Access & labs`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Two IVs or IO. Draw blood cx (ideally before abx), lactate, CBC, CMP, coags, blood gas, glucose. UA + culture. Source-specific cultures.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`15-30 min — Fluids`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[a?(0,l.jsxs)(l.Fragment,{children:[`NS or LR `,(0,l.jsxs)(`strong`,{children:[m,` mL`]}),` bolus (20 mL/kg) over 5-10 min.`]}):(0,l.jsx)(l.Fragment,{children:`NS/LR 10-20 mL/kg bolus over 5-10 min.`}),` Reassess HR, perfusion, lungs, liver. Repeat up to 40-60 mL/kg; stop if crackles/hepatomegaly.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`30-60 min — Antibiotics + reassess`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Broad-spectrum empiric abx within 1 hour (≤1 h in septic shock). Recheck lactate, perfusion.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`>60 min — Fluid-refractory shock`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Start vasoactive (`,(0,l.jsx)(`strong`,{children:`epinephrine 0.05-0.3 mcg/kg/min`}),` cold / `,(0,l.jsx)(`strong`,{children:`norepinephrine 0.05-0.3 mcg/kg/min`}),` warm). Central/IO access. Stress-dose hydrocortisone `,a?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`strong`,{children:[o(2,100).value,` mg`]}),` IV (2 mg/kg, max 100 mg)`]}):`2 mg/kg IV (max 100 mg)`,` if catecholamine-resistant. ICU.`]})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Resuscitation targets`}),(0,l.jsx)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:`Normal mentation · Cap refill ≤2 s · Warm extremities · Strong peripheral pulses · UOP ≥1 mL/kg/hr · MAP ≥5th %ile for age (>65 mmHg adolescent) · SpO₂ ≥94% · Lactate trending down.`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Phoenix Sepsis Criteria (Schlapbach et al., JAMA 2024) · Surviving Sepsis Campaign Pediatric 2020 · AAP pediatric sepsis guidance.`})]})}var S=[{key:`head`,label:`Head`,vals:[18,13,11,9,7],ageSensitive:!0},{key:`neck`,label:`Neck`,vals:[2,2,2,2,2]},{key:`ant_trunk`,label:`Anterior trunk`,vals:[13,13,13,13,13]},{key:`post_trunk`,label:`Posterior trunk`,vals:[13,13,13,13,13]},{key:`r_buttock`,label:`Right buttock`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`l_buttock`,label:`Left buttock`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`genital`,label:`Genitalia`,vals:[1,1,1,1,1]},{key:`r_uparm`,label:`R upper arm`,vals:[4,4,4,4,4]},{key:`l_uparm`,label:`L upper arm`,vals:[4,4,4,4,4]},{key:`r_forearm`,label:`R forearm`,vals:[3,3,3,3,3]},{key:`l_forearm`,label:`L forearm`,vals:[3,3,3,3,3]},{key:`r_hand`,label:`R hand`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`l_hand`,label:`L hand`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`r_thigh`,label:`R thigh`,vals:[5.5,8,8.5,9,9.5],ageSensitive:!0},{key:`l_thigh`,label:`L thigh`,vals:[5.5,8,8.5,9,9.5],ageSensitive:!0},{key:`r_leg`,label:`R lower leg`,vals:[5,5.5,6,6.5,7],ageSensitive:!0},{key:`l_leg`,label:`L lower leg`,vals:[5,5.5,6,6.5,7],ageSensitive:!0},{key:`r_foot`,label:`R foot`,vals:[3.5,3.5,3.5,3.5,3.5]},{key:`l_foot`,label:`L foot`,vals:[3.5,3.5,3.5,3.5,3.5]}],C=[{id:`infant`,label:`Infant (<1 y)`},{id:`young`,label:`Young child (1-5 y)`},{id:`child`,label:`Child (5-10 y)`},{id:`adol`,label:`Adolescent (10-15 y)`},{id:`adult`,label:`Adult (>15 y)`}];function w(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`young`),[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)({}),p=C.findIndex(e=>e.id===n),m=S.reduce((e,t)=>e+t.vals[p]*Math.min(100,Math.max(0,o[t.key]??0))/100,0),h=i.trim()?Number(i):Math.round(m*10)/10,g=Number.parseFloat(e),_=Number.isFinite(g)&&g>0,v=Number.isFinite(h)&&h>0,y=_&&v?Math.round(4*g*h):0,b=Math.round(y/2),x=Math.round(b/8),w=y-b,T=Math.round(w/16),E=_?Math.round(g<=10?g*4:g<=20?40+(g-10)*2:60+(g-20)):0;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-burns`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Burns — Lund-Browder + Parkland`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-3 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`burn-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age band`}),(0,l.jsx)(`select`,{className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`burn-age`,children:C.map(e=>(0,l.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`TBSA override (%)`}),(0,l.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`1`,className:d,value:i,onChange:e=>a(e.target.value),placeholder:v?String(h):`auto`,"data-testid":`burn-tbsa`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Body parts — % of each region burned (2° or deeper)`}),(0,l.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2`,children:S.map(e=>{let t=e.vals[p];return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/30 rounded p-2`,children:[(0,l.jsxs)(`label`,{className:`flex-1 text-xs`,children:[e.label,` `,(0,l.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t,`%`,e.ageSensitive?`*`:``,`)`]})]}),(0,l.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`5`,className:`w-16 rounded border border-input bg-background px-2 py-1 text-xs text-right`,value:o[e.key]??0,onChange:t=>s({...o,[e.key]:Number(t.target.value)}),"data-testid":`burn-region-`+e.key}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`%`})]},e.key)})}),v&&(0,l.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Computed TBSA: `,(0,l.jsxs)(`strong`,{children:[h,`%`]})]}),!_&&(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see Parkland + maintenance fluids.`}),!v&&_&&(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter % per region or override TBSA to compute fluids.`}),_&&v&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm font-semibold text-destructive`,"data-testid":`burn-result`,children:[`Burn fluid resuscitation — `,g,` kg, `,h,`% TBSA (2° or deeper)`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Parkland formula:`}),` 4 mL × kg × %TBSA = `,(0,l.jsxs)(`strong`,{children:[y,` mL LR over 24 hours`]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`First 8 h`}),` (from time of burn): `,b,` mL (~`,(0,l.jsxs)(`strong`,{children:[x,` mL/hr`]}),`)`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Next 16 h:`}),` `,w,` mL (~`,(0,l.jsxs)(`strong`,{children:[T,` mL/hr`]}),`)`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Plus maintenance (4-2-1):`}),` `,E,` mL/hr (D5 ½NS ± 20 mEq KCl/L once UOP established). Consider dextrose in children <30 kg.`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Titrate to UOP:`}),` target 1-2 mL/kg/hr (infants / children), 0.5-1 mL/kg/hr (adolescents). `,(0,l.jsx)(`strong`,{children:`Clinical response trumps formula.`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Other pearls`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rule of palm:`}),` Patient's palm + fingers ≈ 1% TBSA — good for scattered burns.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`First-degree burns DO NOT count`}),` toward TBSA or Parkland.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Analgesia:`}),` Morphine 0.05-0.1 mg/kg IV q2h, or fentanyl 1-2 mcg/kg IV q30-60 min.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tetanus`}),` prophylaxis if indicated. Tdap/Td ± TIG.`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Burn center referral (ABA)`}),(0,l.jsx)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:`Partial-thickness >10% TBSA · any full-thickness · face/hands/feet/genital/perineum/major joints · electrical/chemical/inhalation · associated trauma · significant comorbidities · pediatric burns in non-pediatric center.`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ABA Advanced Burn Life Support 2018 · Parkland formula: Baxter 1968 · Lund-Browder 1944.`})]})}var T=`rounded-lg border border-border bg-card p-5 space-y-3`,E=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,D=`block text-xs font-medium text-muted-foreground`,O=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,k=`px-2 py-1.5 border-b border-border align-top text-sm`;function A({id:e,value:t,onChange:n,testid:r}){return(0,l.jsxs)(`div`,{className:`max-w-xs`,children:[(0,l.jsx)(`label`,{htmlFor:e,className:D,children:`Weight (kg)`}),(0,l.jsx)(`input`,{id:e,type:`number`,min:`0.3`,step:`0.1`,className:E,value:t,onChange:e=>n(e.target.value),"data-testid":r})]})}function j({label:e}){let t=e.indexOf(`(`);if(t<0)return(0,l.jsx)(`span`,{className:`font-semibold`,children:e});let n=e.slice(0,t).trim(),r=e.slice(t);return(0,l.jsxs)(`span`,{children:[(0,l.jsx)(`span`,{className:`font-semibold`,children:n}),` `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})}var M={epi:{perKg:.01,max:.5,unit:`mg`},fluids:{perKg:20,max:null,unit:`mL`},dph:{perKg:1.25,max:50,unit:`mg`},ranitidine:{perKg:1,max:50,unit:`mg`},dex:{perKg:.6,max:16,unit:`mg`},mpn:{perKg:2,max:125,unit:`mg`},glucagon:{perKg:.02,max:1,unit:`mg`}};function N(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e);if(!Number.isFinite(n)||n<=0)return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-anaphylaxis`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Anaphylaxis`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Emergency management. Epinephrine IM is the immediate and only proven lifesaving step.`}),(0,l.jsx)(A,{id:`anaph-wt`,value:e,onChange:t,testid:`anaph-weight`}),(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]});let r=s(n,M.epi.perKg,M.epi.max,M.epi.unit),i=Math.round(r.value*10)/10,a=n<10?`Draw up manually`:n<=25?`EpiPen Jr / Auvi-Q 0.15 mg`:`EpiPen / Auvi-Q 0.3 mg`,o=s(n,M.fluids.perKg,M.fluids.max,M.fluids.unit),u=s(n,M.dph.perKg,M.dph.max),d=s(n,M.ranitidine.perKg,M.ranitidine.max),f=s(n,M.dex.perKg,M.dex.max),p=s(n,M.mpn.perKg,M.mpn.max),m=s(n,M.glucagon.perKg,M.glucagon.max),h=[[`STEP 2`,`Position`,`Supine + legs elevated`,`—`,`If dyspneic: sitting position. If vomiting: recovery position`],[`STEP 3`,`O₂`,`High flow 10-15 L/min`,`Face mask`,`100% O₂. Prepare for airway management`],[`STEP 4`,`IV fluids`,`NS ${o.label} bolus`,`IV/IO`,`Repeat up to 60 mL/kg for hypotension`],[`STEP 5`,`Diphenhydramine`,u.label,`IV/IM/PO`,`H1 blocker. NOT first-line — adjunct only`],[``,`Ranitidine`,d.label,`IV over 5 min`,`H2 blocker. Optional adjunct`],[`STEP 6`,`Dexamethasone`,f.label,`IV/IM/PO`,`Prevents biphasic reaction (4-6 hrs later)`],[``,`Methylprednisolone`,p.label,`IV`,`Alternative steroid`],[`REFRACTORY`,`Epinephrine gtt`,`0.1-1 mcg/kg/min`,`IV infusion`,`For persistent hypotension despite fluids + IM epi`],[``,`Glucagon`,m.label,`IV/IM`,`For patients on beta-blockers not responding to epi`]];return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-anaphylaxis`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Anaphylaxis`}),(0,l.jsx)(A,{id:`anaph-wt`,value:e,onChange:t,testid:`anaph-weight`}),(0,l.jsxs)(`div`,{className:`rounded-lg border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-4 space-y-1`,children:[(0,l.jsx)(`div`,{className:`text-base font-bold text-destructive`,children:`STEP 1: Epinephrine IM — GIVE IMMEDIATELY`}),(0,l.jsxs)(`div`,{className:`text-sm font-semibold`,children:[`Epinephrine 1:1000 (1 mg/mL): `,(0,l.jsxs)(`span`,{className:`text-destructive`,children:[r.value,` mg (`,i,` mL)`]}),` IM to lateral thigh`]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[M.epi.perKg,` mg/kg (max `,M.epi.max,` mg) · Auto-injector: `,a]}),(0,l.jsx)(`div`,{className:`text-xs text-destructive`,children:`May repeat every 5-15 minutes if symptoms persist. No contraindications in anaphylaxis.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`anaph-table`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Step`}),(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:h.map((e,t)=>(0,l.jsxs)(`tr`,{className:e[0]===`REFRACTORY`||t>0&&h[t-1][0]===`REFRACTORY`&&e[0]===``?`bg-amber-50 dark:bg-amber-950/30`:``,children:[(0,l.jsx)(`td`,{className:k+` font-semibold text-primary text-xs`,children:e[0]}),(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e[1]}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:e[2]})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e[3]}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e[4]})]},t))})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Observe minimum 4-6 hours`}),` after last dose of epinephrine (biphasic reactions occur in 5-20% of cases). Discharge with EpiPen prescription and anaphylaxis action plan. Refer to allergist.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ASCIA Anaphylaxis Guidelines 2021 · WAO Anaphylaxis Guidance 2020 · AAP/ACAAI Practice Parameters.`})]})}function P(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`general`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n):null,u=[{id:`general`,label:`PALS General`},{id:`asystole`,label:`Asystole / PEA`},{id:`brady`,label:`Bradycardia`},{id:`svt`,label:`SVT`},{id:`vfib`,label:`VF / Pulseless VT`},{id:`vt`,label:`Stable VT`}];function d({name:e,dose:t,route:n,notes:r}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:t})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:r})]})}function f({children:e}){return(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:e})]})})}function p(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.1,10,`mL`),n=o(.1,2.5,`mg`),r=o(5,300,`mg`),i=o(1,100,`mg`),s=o(.02,.5,`mg`),c=o(.1,6,`mg`),u=o(.2,12,`mg`),p=o(1,50,`mEq`),m=o(20,1e3,`mg`),h=o(.2,10,`mL`),g=o(60,3e3,`mg`),_=o(.6,30,`mL`),v=o(50,2e3,`mg`),y=o(2,null,`mL`);return(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Epinephrine 1:10,000`,dose:`${e.label} (${t.label})`,route:`IV / IO`,notes:`0.01 mg/kg = 0.1 mL/kg of 1:10,000. Max single dose 1 mg. Repeat q3-5 min.`}),(0,l.jsx)(d,{name:`Epinephrine ET`,dose:n.label,route:`ETT`,notes:`0.1 mg/kg (1 mL/kg of 1:10,000) if no IV/IO`}),(0,l.jsx)(d,{name:`Amiodarone`,dose:r.label,route:`IV / IO bolus`,notes:`5 mg/kg for arrest. Max 300 mg. Repeat up to 2 times (max 15 mg/kg/day).`}),(0,l.jsx)(d,{name:`Lidocaine`,dose:i.label,route:`IV / IO bolus`,notes:`1 mg/kg. Alternative to amiodarone for VF/VT.`}),(0,l.jsx)(d,{name:`Atropine`,dose:`${s.label} (min 0.1 mg)`,route:`IV / IO`,notes:`0.02 mg/kg. Bradycardia from ↑vagal tone or AV block.`}),(0,l.jsx)(d,{name:`Adenosine (1st)`,dose:c.label,route:`IV push + flush`,notes:`0.1 mg/kg (max 6 mg). For SVT. Rapid push, double flush.`}),(0,l.jsx)(d,{name:`Adenosine (2nd)`,dose:u.label,route:`IV push + flush`,notes:`0.2 mg/kg (max 12 mg). Second dose if first unsuccessful.`}),(0,l.jsx)(d,{name:`Sodium bicarb 8.4%`,dose:p.label,route:`IV / IO`,notes:`1 mEq/kg. ONLY if severe metabolic acidosis, hyperK, or TCA OD. Not routine.`}),(0,l.jsx)(d,{name:`Calcium chloride 10%`,dose:`${m.label} (${h.label})`,route:`IV / IO (central preferred)`,notes:`For hyperK, hypoCa, Mg OD, CCB OD. 20 mg/kg = 0.2 mL/kg.`}),(0,l.jsx)(d,{name:`Calcium gluconate 10%`,dose:`${g.label} (${_.label})`,route:`IV / IO (peripheral OK)`,notes:`60 mg/kg = 0.6 mL/kg. Preferred peripherally.`}),(0,l.jsx)(d,{name:`Magnesium sulfate`,dose:v.label,route:`IV over 10-20 min`,notes:`25-50 mg/kg. Torsades, severe asthma. Max 2 g.`}),(0,l.jsx)(d,{name:`Dextrose 10%`,dose:`${y.label} (0.2 g/kg)`,route:`IV push`,notes:`For documented hypoglycemia`}),(0,l.jsx)(d,{name:`Defibrillation`,dose:`2 J/kg → 4 J/kg → 10 J/kg (max 10 J/kg or adult dose)`,route:`Pad`,notes:`For VF/pulseless VT. Resume CPR immediately after shock.`}),(0,l.jsx)(d,{name:`Cardioversion (sync)`,dose:`0.5-1 J/kg → 2 J/kg`,route:`Pad`,notes:`For unstable SVT/VT. Sedate if possible.`})]})}function m(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.1,2.5,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`CPR`,dose:`100-120/min, depth 1/3 AP`,route:`—`,notes:`15:2 (2 rescuer) or 30:2 (single). Rotate every 2 min.`}),(0,l.jsx)(d,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`0.01 mg/kg 1:10,000 = 0.1 mL/kg. Q3-5 min. Start early.`}),(0,l.jsx)(d,{name:`Epinephrine ETT`,dose:t.label,route:`ETT`,notes:`0.1 mg/kg if no IV access`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Reversible causes (H's & T's)`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2 text-xs`,children:[(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`H's`}),` — Hypoxia, Hypovolemia, H+ (acidosis), Hypo/hyperK, Hypoglycemia, Hypothermia`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`T's`}),` — Tension PTX, Tamponade, Toxins, Thrombosis (MI/PE), Trauma`]})]})]})}function h(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.02,.5,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Bradycardia with poor perfusion (HR < 60)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Start CPR if HR < 60 with poor perfusion despite oxygenation and ventilation.`})]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`First-line. Q3-5 min.`}),(0,l.jsx)(d,{name:`Atropine`,dose:`${t.label} (min 0.1 mg)`,route:`IV / IO`,notes:`If ↑ vagal tone or AV block. Max 1 mg child / 0.5 mg infant.`}),(0,l.jsx)(d,{name:`Transcutaneous pacing`,dose:`—`,route:`Pad`,notes:`For refractory bradycardia not responsive to drugs.`}),(0,l.jsx)(d,{name:`Consider`,dose:`—`,route:`—`,notes:`Hypoxia, tension pneumothorax, ↑ICP, toxic ingestion (organo, CCB, BB), heart block`})]})]})}function g(){if(!a)return null;let e=o(.1,6,`mg`),t=o(.2,12,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`SVT — narrow complex, rate usually >220 infant / >180 child`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Differentiate from sinus tach: abrupt onset/offset, no P waves or abnormal P axis, HR minimally variable.`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`If STABLE`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Vagal maneuvers`,dose:`Ice to face, blow into syringe, Valsalva`,route:`—`,notes:`Try first in stable patient`}),(0,l.jsx)(d,{name:`Adenosine (1st)`,dose:e.label,route:`IV push (proximal) + flush`,notes:`Rapid push, 3-way stopcock with NS flush`}),(0,l.jsx)(d,{name:`Adenosine (2nd)`,dose:t.label,route:`IV push + flush`,notes:`If first dose unsuccessful`}),(0,l.jsx)(d,{name:`Procainamide`,dose:`15 mg/kg over 30-60 min`,route:`IV`,notes:`Expert consult. Avoid with amiodarone.`}),(0,l.jsx)(d,{name:`Amiodarone`,dose:`5 mg/kg over 20-60 min`,route:`IV`,notes:`Expert consult.`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`If UNSTABLE`}),(0,l.jsx)(f,{children:(0,l.jsx)(d,{name:`Synchronized cardioversion`,dose:`0.5-1 J/kg → 2 J/kg`,route:`Pad`,notes:`Sedate if possible. Pre-treat with adenosine if IV available.`})})]})}function _(){if(!a)return null;let e=o(.01,1,`mg`),t=o(5,300,`mg`),n=o(1,100,`mg`),r=o(50,2e3,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-destructive`,children:`VF / Pulseless VT`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`High-quality CPR + defibrillation are key. Minimize interruptions.`})]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Defibrillation (1st)`,dose:`2 J/kg`,route:`Pad`,notes:`Resume CPR immediately after shock.`}),(0,l.jsx)(d,{name:`Defibrillation (2nd)`,dose:`4 J/kg`,route:`Pad`,notes:`After 2 min CPR.`}),(0,l.jsx)(d,{name:`Defibrillation (3rd+)`,dose:`≥4 J/kg (max 10 J/kg or adult dose)`,route:`Pad`,notes:``}),(0,l.jsx)(d,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`After 2nd shock. Q3-5 min.`}),(0,l.jsx)(d,{name:`Amiodarone`,dose:t.label,route:`IV / IO bolus`,notes:`Refractory VF/VT. Max 15 mg/kg/day.`}),(0,l.jsx)(d,{name:`Lidocaine`,dose:n.label,route:`IV / IO`,notes:`Alternative to amiodarone. Then 20-50 mcg/kg/min gtt.`}),(0,l.jsx)(d,{name:`Mg sulfate`,dose:r.label,route:`IV over 1-2 min`,notes:`For torsades or hypoMg.`})]})]})}function v(){if(!a)return null;let e=o(5,300,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Stable monomorphic VT`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Expert consult. Avoid combining QT-prolonging agents.`})]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Amiodarone`,dose:`5 mg/kg over 20-60 min = ${e.value} mg over 20-60 min`,route:`IV`,notes:``}),(0,l.jsx)(d,{name:`Procainamide`,dose:`15 mg/kg over 30-60 min`,route:`IV`,notes:`Do not combine with amiodarone`}),(0,l.jsx)(d,{name:`Sync cardioversion`,dose:`0.5-1 → 2 J/kg`,route:`Pad`,notes:`If becomes unstable. Sedate.`})]})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-cardiac`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Cardiac Arrest / PALS`}),(0,l.jsx)(A,{id:`cardiac-wt`,value:e,onChange:t,testid:`cardiac-weight`}),(0,l.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:u.map(e=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-3 py-1.5 rounded-full text-xs font-medium border `+(n===e.id?`bg-primary text-primary-foreground border-primary`:`bg-muted hover:bg-muted/80 border-border`),"data-testid":`cardiac-view-`+e.id,children:e.label},e.id))}),a?(0,l.jsxs)(`div`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm font-semibold text-destructive`,children:[u.find(e=>e.id===n)?.label,` — `,i,` kg`]}),n===`general`&&(0,l.jsx)(p,{}),n===`asystole`&&(0,l.jsx)(m,{}),n===`brady`&&(0,l.jsx)(h,{}),n===`svt`&&(0,l.jsx)(g,{}),n===`vfib`&&(0,l.jsx)(_,{}),n===`vt`&&(0,l.jsx)(v,{}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Concentrations:`}),` Epi 1:10,000 (0.1 mg/mL) for IV arrest. 1:1000 (1 mg/mL) for IM anaphylaxis. Atropine <0.1 mg can cause paradoxical bradycardia.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AHA PALS Guidelines 2020 · Always verify against institutional protocols.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var F={lorazepam:{perKg:.1,max:4,unit:`mg`,route:`IV / IO`,note:`Slow push over 1-2 min.`,suffix:` (IV preferred)`},midazolam:{perKg:.2,max:10,unit:`mg`,route:`IM / IN / buccal`,note:`Use 5 mg/mL concentrate for IN; split between nares.`},diazepam:{perKg:.5,max:20,unit:`mg`,route:`PR`,note:`Only if no IV/IM/IN access.`},levetiracetam:{perKg:60,max:4500,unit:`mg`,route:`IV over 5-15 min`,note:`Best tolerability. No ECG monitoring needed.`,suffix:` (preferred)`},fosphenytoin:{perKg:20,max:1500,unit:`mg PE`,route:`IV over 10 min`,note:`Max rate 3 mg PE/kg/min. Monitor ECG, BP. Avoid if cardiac dysrhythmia.`},valproate:{perKg:40,max:3e3,unit:`mg`,route:`IV over 10 min`,note:`Avoid <2 yr, hepatic / mitochondrial disease, pregnancy.`},phenobarb:{perKg:20,max:1e3,unit:`mg`,route:`IV over 20 min`,note:`Last-choice 2nd line. High risk of resp depression + hypotension.`},midazGttBolus:{perKg:.2,max:10,unit:`mg`},midazGttLow:{perKg:.05,max:2,unit:`mg/hr`},midazGttHigh:{perKg:.5,max:18,unit:`mg/hr`},pentobarbBolus:{perKg:5,max:200,unit:`mg`},pentobarbGttLow:{perKg:1,max:null,unit:`mg/hr`},pentobarbGttHigh:{perKg:5,max:null,unit:`mg/hr`},propofolBolus:{perKg:2,max:100,unit:`mg`},propofolGttLow:{perKg:2,max:null,unit:`mg/hr`},propofolGttHigh:{perKg:5,max:null,unit:`mg/hr`},ketamineBolus:{perKg:2,max:100,unit:`mg`},ketamineGttLow:{perKg:1,max:null,unit:`mg/hr`},ketamineGttHigh:{perKg:5,max:null,unit:`mg/hr`}};function I(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=(e,t,i=`mg`)=>r?s(n,e,t,i):null,a=r?Math.round(n*2*10)/10:0,o=r?Math.round(n*5*10)/10:0;function u({time:e,color:t,title:n,children:r,last:i=!1}){return(0,l.jsxs)(`div`,{className:`flex gap-3`,children:[(0,l.jsxs)(`div`,{className:`flex flex-col items-center flex-shrink-0`,children:[(0,l.jsx)(`div`,{className:`w-16 py-1.5 rounded-full text-white text-xs font-bold text-center ${t}`,children:e}),!i&&(0,l.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-1`})]}),(0,l.jsxs)(`div`,{className:`flex-1 rounded-r-md border-l-4 p-3 bg-muted/30`,style:{borderLeftColor:`currentColor`},children:[(0,l.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wide mb-2`,children:n}),(0,l.jsx)(`div`,{className:`text-sm space-y-2`,children:r})]})]})}function d({name:e,f:t,route:n,notes:r,suffix:i}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsxs)(`td`,{className:k+` font-semibold`,children:[e,i&&(0,l.jsx)(`span`,{className:`text-xs text-green-700 ml-1`,children:i})]}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:t.label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-seizure`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Seizures — Status Epilepticus Pathway`}),(0,l.jsx)(A,{id:`seizure-wt`,value:e,onChange:t,testid:`seizure-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsxs)(`div`,{className:`font-bold text-destructive text-sm`,children:[`Status Epilepticus Pathway — `,n,` kg`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Time = 0 at seizure onset. Do not pause between steps for benzo to take effect — act on the clock.`})]}),(0,l.jsxs)(`div`,{className:`space-y-0`,children:[(0,l.jsxs)(u,{time:`0 min`,color:`bg-blue-500 text-white`,title:`Stabilize`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`ABCs`}),` — position, 100% O₂ via NC / NRB, suction. `,(0,l.jsx)(`strong`,{children:`IV or IO`}),` × 2. Continuous SpO₂, ECG, BP.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`POC glucose`}),` — if <60 mg/dL: `,(0,l.jsxs)(`strong`,{children:[`D10W `,a,`-`,o,` mL IV`]}),` (2-5 mL/kg).`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Labs`}),`: CBC, CMP, Mg, Ca, Phos, VBG, lactate, AED levels, toxicology if unclear etiology.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Consider pyridoxine`}),` 100 mg IV in infants <18 mo or INH ingestion. Temperature: treat hyperthermia aggressively.`]})]}),(0,l.jsx)(u,{time:`5 min`,color:`bg-purple-500 text-white`,title:`1st benzodiazepine (give once, pick by access)`,children:(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsx)(d,{name:`Lorazepam`,f:i(F.lorazepam.perKg,F.lorazepam.max),route:`IV / IO`,notes:`Slow push over 1-2 min.`,suffix:` (IV preferred)`}),(0,l.jsx)(d,{name:`Midazolam`,f:i(F.midazolam.perKg,F.midazolam.max),route:`IM / IN / buccal`,notes:`Use 5 mg/mL concentrate for IN; split between nares.`}),(0,l.jsx)(d,{name:`Diazepam`,f:i(F.diazepam.perKg,F.diazepam.max),route:`PR`,notes:`Only if no IV/IM/IN access.`})]})]})})}),(0,l.jsxs)(u,{time:`10 min`,color:`bg-violet-500 text-white`,title:`2nd benzodiazepine — if still seizing`,children:[`Repeat same agent + dose `,(0,l.jsx)(`strong`,{children:`once`}),`. Prepare 2nd-line now (don't wait to see if benzo works). If apnea/airway compromise: BVM, consider advanced airway.`]}),(0,l.jsx)(u,{time:`20 min`,color:`bg-amber-500 text-white`,title:`2nd-line anti-epileptic — pick one (ESETT: equivalent efficacy)`,children:(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsx)(d,{name:`Levetiracetam`,f:i(F.levetiracetam.perKg,F.levetiracetam.max),route:`IV over 5-15 min`,notes:`Best tolerability. No ECG monitoring needed.`,suffix:` (preferred)`}),(0,l.jsx)(d,{name:`Fosphenytoin`,f:i(F.fosphenytoin.perKg,F.fosphenytoin.max,`mg PE`),route:`IV over 10 min`,notes:`Max rate 3 mg PE/kg/min. Monitor ECG, BP. Avoid if cardiac dysrhythmia.`}),(0,l.jsx)(d,{name:`Valproic acid`,f:i(F.valproate.perKg,F.valproate.max),route:`IV over 10 min`,notes:`Avoid <2 yr, hepatic / mitochondrial disease, pregnancy.`}),(0,l.jsx)(d,{name:`Phenobarbital`,f:i(F.phenobarb.perKg,F.phenobarb.max),route:`IV over 20 min`,notes:`Last-choice 2nd line. High risk of resp depression + hypotension.`})]})]})})}),(0,l.jsxs)(u,{time:`30 min`,color:`bg-red-500 text-white`,title:`Still seizing? Consider 2nd agent from 2nd-line OR proceed to refractory`,children:[`If the first 2nd-line drug failed, give a different 2nd-line agent `,(0,l.jsx)(`strong`,{children:`OR`}),` move directly to refractory therapy. Activate ICU, prepare for intubation. Confirm etiology not reversible (electrolytes, glucose, fever, toxin).`]}),(0,l.jsxs)(u,{time:`40 min`,color:`bg-destructive text-white`,title:`Refractory status — intubate + continuous infusion + continuous EEG`,last:!0,children:[(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsxs)(`tr`,{children:[(0,l.jsxs)(`td`,{className:k+` font-semibold`,children:[`Midazolam `,(0,l.jsx)(`span`,{className:`text-xs text-green-700`,children:`(1st-line infusion)`})]}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.midazGttBolus.perKg,F.midazGttBolus.max).value,` mg → gtt `,i(F.midazGttLow.perKg,F.midazGttLow.max,`mg/hr`).value,`–`,i(F.midazGttHigh.perKg,F.midazGttHigh.max,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 0.2 mg/kg, gtt 0.05-0.5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Titrate to seizure control / burst suppression.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Pentobarbital`}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.pentobarbBolus.perKg,F.pentobarbBolus.max).value,` mg → gtt `,i(F.pentobarbGttLow.perKg,null,`mg/hr`).value,`–`,i(F.pentobarbGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 5 mg/kg, gtt 1-5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Causes hypotension — often need pressors.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Propofol`}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.propofolBolus.perKg,F.propofolBolus.max).value,` mg → gtt `,i(F.propofolGttLow.perKg,null,`mg/hr`).value,`–`,i(F.propofolGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 2 mg/kg, gtt 2-5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsxs)(`td`,{className:k+` text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`PRIS risk in children`}),` — limit to <4 mg/kg/hr and duration <48 h.`]})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Ketamine`}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.ketamineBolus.perKg,F.ketamineBolus.max).value,` mg → gtt `,i(F.ketamineGttLow.perKg,null,`mg/hr`).value,`–`,i(F.ketamineGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 2 mg/kg, gtt 1-5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`NMDA antagonist — rescue. Good BP profile; useful if refractory to GABAergics.`})]})]})]})}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-2`,children:[(0,l.jsx)(`strong`,{children:`Continuous EEG within 1 h`}),` — target electrographic seizure suppression × 24-48 h, then wean. Reassess etiology: CNS imaging, LP, expanded workup.`]})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100 space-y-1`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`Key points`}),(0,l.jsxs)(`div`,{children:[`• Do `,(0,l.jsx)(`strong`,{children:`NOT`}),` wait for benzo response before starting the 2nd-line — parallel preparation.`]}),(0,l.jsxs)(`div`,{children:[`• Maximum `,(0,l.jsx)(`strong`,{children:`2 benzo doses`}),` total (1 pre-hospital + 1 in ED, or 2 in ED).`]}),(0,l.jsx)(`div`,{children:`• Respiratory depression is common — have BVM, airway equipment, naloxone, flumazenil accessible (but avoid flumazenil here).`}),(0,l.jsx)(`div`,{children:`• ESETT trial: levetiracetam = fosphenytoin = valproate for efficacy. Pick by tolerability / contraindications.`}),(0,l.jsx)(`div`,{children:`• Always reassess: ongoing seizure? Non-convulsive status? Pseudo-seizure? → continuous EEG if any doubt.`})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Based on AES Guidelines 2016 and ESETT (Kapur et al., NEJM 2019). Verify all doses against institutional protocols.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function L(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(``),i=Number.parseFloat(e),a=Number.parseFloat(n),o=Number.isFinite(i)&&i>0,u=(e,t,n=`mg`)=>o?s(i,e,t,n):null,d=Number.isFinite(a)&&a>=0,f=d?Math.round((a/4+4)*2)/2:null,p=d?Math.round((a/4+3.5)*2)/2:null,m=f?Math.round(f*3*10)/10:null,h=d?a<1?`Miller 0-1`:a<2?`Miller 1 / Mac 1`:a<8?`Miller 2 / Mac 2`:`Miller/Mac 3`:`—`,g=o?i<5?`1`:i<10?`1.5`:i<20?`2`:i<30?`2.5`:i<50?`3`:i<70?`4`:`5`:`—`,_=o&&i<10?2:1.5,v=u(6,null,`mL`),y=u(8,null,`mL`);function b({title:e,rows:t}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:e}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:t.map((e,t)=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e[0]}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:e[1]})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e[2]}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e[3]})]},t))})]})})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-airway`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Airway / RSI`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-md`,children:[(0,l.jsx)(A,{id:`airway-wt`,value:e,onChange:t,testid:`airway-weight`}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`airway-age`,className:D,children:`Age (years)`}),(0,l.jsx)(`input`,{id:`airway-age`,type:`number`,min:`0`,step:`0.5`,className:E,value:n,onChange:e=>r(e.target.value),"data-testid":`airway-age`})]})]}),o?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold text-blue-900 dark:text-blue-100`,children:[`RSI doses & equipment — `,i,` kg`,d?`, ~${a} yr`:``]}),(0,l.jsx)(b,{title:`Pre-medication (optional)`,rows:[[`Atropine`,`${u(.02,1,`mg`).label} (min 0.1 mg)`,`IV`,`Consider <1 yr or if using succinylcholine, or bradycardia risk`],[`Lidocaine 2%`,u(1.5,100,`mg`).label,`IV over 1 min`,`For ↑ICP, asthma; give 2-3 min pre-induction`],[`Fentanyl`,`${u(2,150,`mcg`).label} (2-3 mcg/kg)`,`IV over 1 min`,`Blunts sympathetic response; avoid if hypotensive`]]}),(0,l.jsx)(b,{title:`Induction`,rows:[[`Ketamine`,`${u(1.5,150,`mg`).label} (1-2 mg/kg)`,`IV`,`Preserves BP. First-line for shock, asthma, sepsis`],[`Etomidate`,u(.3,30,`mg`).label,`IV`,`Hemodynamically neutral. Avoid in septic shock (adrenal suppression)`],[`Propofol`,`${u(2,200,`mg`).label} (1-2 mg/kg)`,`IV`,`Causes hypotension. Avoid in shock`],[`Midazolam`,u(.2,10,`mg`).label,`IV`,`Less optimal induction — slower onset`]]}),(0,l.jsx)(b,{title:`Paralytics`,rows:[[`Rocuronium`,`${u(1.2,100,`mg`).label} (1-1.2 mg/kg)`,`IV`,`30-60 sec onset; 30-45 min duration. First-line non-depolarizing.`],[`Succinylcholine`,u(_,150,`mg`).label,`IV`,`<10kg: 2 mg/kg; ≥10kg: 1.5 mg/kg. Avoid in burns/crush/hyperK/MH/NM dz. IM option: 4 mg/kg.`],[`Vecuronium`,u(.1,10,`mg`).label,`IV`,`2-3 min onset; longer duration than roc`]]}),(0,l.jsx)(b,{title:`Maintenance sedation / analgesia`,rows:[[`Midazolam gtt`,`${u(.05,2,`mg`).label}–${u(.2,10,`mg`).label}/hr`,`IV infusion`,`0.05-0.2 mg/kg/hr`],[`Fentanyl gtt`,`${u(1,100,`mcg`).label}–${u(4,200,`mcg`).label}/hr`,`IV infusion`,`1-4 mcg/kg/hr`],[`Ketamine gtt`,`${u(.5,30,`mg`).label}–${u(2,100,`mg`).label}/hr`,`IV infusion`,`0.5-2 mg/kg/hr. Good for asthma`],[`Dexmedetomidine gtt`,`0.2-1.4 mcg/kg/hr`,`IV infusion`,`No resp depression; causes bradycardia + hypotension`],[`Rocuronium gtt`,`10-12 mcg/kg/min`,`IV infusion`,`If continued paralysis needed — only with adequate sedation`]]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Equipment sizing`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3 text-xs`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:d?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`ETT (uncuffed):`}),` `,f,` mm`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`ETT (cuffed):`}),` `,p,` mm`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Depth at lip:`}),` ~`,m,` cm`]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{children:(0,l.jsx)(`em`,{children:`Enter age for ETT / blade sizing.`})}),(0,l.jsx)(`div`,{children:`ETT (uncuffed) = (age/4) + 4`}),(0,l.jsx)(`div`,{children:`ETT (cuffed) = (age/4) + 3.5`}),(0,l.jsx)(`div`,{children:`Depth = ETT size × 3`})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Laryngoscope blade:`}),` `,h]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`LMA size:`}),` `,g]}),(0,l.jsx)(`div`,{children:`OPA = corner mouth → angle mandible`}),(0,l.jsx)(`div`,{children:`NPA = tip nose → tragus`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 md:col-span-2`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Suction catheter (Fr):`}),` ETT size × 2`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`NG tube:`}),` ETT × 2`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Chest tube:`}),` 4 × ETT`]})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Ventilator — starting settings`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Mode:`}),` Volume or pressure control`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tidal volume:`}),` 6-8 mL/kg (= `,v.value,`-`,y.value,` mL). Use lower (4-6 mL/kg) for ARDS.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rate:`}),` Infant 25-30, Child 15-25, Adolescent 12-16`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`PEEP:`}),` 5 cmH₂O (↑ for oxygenation problems)`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`FiO₂:`}),` Start 100%, wean to SpO₂ 92-97%`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`I:E ratio:`}),` 1:2 (1:3-4 for obstructive disease)`]})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Harriet Lane Handbook 23rd ed · PALS 2020. Always confirm doses against institutional protocols.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function R(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0;function i(e,t,n,r){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:t})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}let a=r?[i(`Lorazepam`,s(n,.05,2).label,`PO`,`0.05 mg/kg. May repeat in 30 min.`),i(`Midazolam`,s(n,.5,10).label,`PO`,`0.5 mg/kg (max 10 mg)`),i(`Midazolam`,s(n,.3,10).label,`IN (5 mg/mL)`,`0.3 mg/kg split between nares (max 10 mg)`),i(`Olanzapine (ODT)`,n<30?`2.5-5 mg`:`5-10 mg`,`PO / ODT`,`Age ≥6 yr. Avoid IM + benzo combo (risk of resp depression).`),i(`Diphenhydramine`,s(n,1,50).label,`PO`,`1 mg/kg. Adjunct only; sedating.`)]:null,o=r?[i(`Midazolam`,s(n,.1,5).label,`IV / IM`,`0.05-0.1 mg/kg IV, 0.1-0.15 mg/kg IM (max 10 mg)`),i(`Lorazepam`,s(n,.1,4).label,`IV / IM`,`0.05-0.1 mg/kg (max 4 mg). May cause resp depression.`),i(`Haloperidol`,n<40?`0.025-0.075 mg/kg = ${Math.round(n*.05*100)/100} mg`:`2.5-5 mg`,`IM / IV`,`Avoid <3 yr. Risk: QT, EPS, NMS. ECG if repeated.`),i(`Olanzapine`,n<40?`2.5-5 mg`:`5-10 mg`,`IM`,`Avoid benzo co-administration (resp depression, hypotension)`),i(`Ketamine`,s(n,4,500).label,`IM`,`4-5 mg/kg IM (rescue for severe excited delirium). Monitor airway.`),i(`Droperidol`,`0.03-0.07 mg/kg = ${Math.round(n*.05*100)/100} mg`,`IM / IV`,`Effective but QT concern — get ECG.`)]:null;return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-agitation`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Agitation`}),(0,l.jsx)(A,{id:`agit-wt`,value:e,onChange:t,testid:`agit-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3 text-sm font-semibold text-purple-900 dark:text-purple-100`,children:[`Agitation management — `,n,` kg`]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-green-800 dark:text-green-200`,children:`Step 1 — Non-pharmacologic`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Dim lights, quiet room, familiar caregiver present, reduce stimulation. Rule out hypoglycemia, hypoxia, pain, ↑ICP, toxic ingestion, infection.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`Step 2 — Oral / intranasal (cooperative)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`First-line for moderate agitation if the patient will accept PO/IN.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:a})]})}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Step 3 — IM / IV (severe, uncooperative, or safety risk)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Require continuous monitoring. Consider restraints only as last resort.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:o})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Monitoring:`}),` Continuous SpO₂ + HR after parenteral sedation. Have airway equipment, flumazenil, naloxone, and IV access ready.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Clinical Report on Pediatric Agitation · ACEP Guidelines for Acute Agitation.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function z(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=(e,t,i=`mg`)=>r?s(n,e,t,i):null,a=r?n<15?`2 mg`:n<30?`4 mg`:`8 mg`:null;return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-antiemetics`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Antiemetics`}),(0,l.jsx)(A,{id:`emet-wt`,value:e,onChange:t,testid:`emet-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold text-blue-900 dark:text-blue-100`,children:[`Antiemetic doses — `,n,` kg`]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Ondansetron`}),(0,l.jsxs)(`td`,{className:k+` text-xs`,children:[a,` (weight band) OR `,(0,l.jsx)(j,{label:i(.15,8).label})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / ODT / IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`First-line. Max single 8 mg. Repeat q8h. QT prolongation — avoid with other QT drugs. <6 mo: limited data.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Metoclopramide`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(.15,10).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV / IM / PO`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`0.1-0.15 mg/kg (max 10 mg). Give with diphenhydramine to prevent EPS / dystonia.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Dimenhydrinate`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(1.25,50).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / IV / IM / PR`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`1.25 mg/kg (max 50 mg) q6h. ≥2 yr.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Diphenhydramine`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(1,50).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / IV / IM`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`1 mg/kg (max 50 mg) q6h. Adjunct, sedating.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Promethazine`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(.25,25).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / IV / IM`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:`0.25-1 mg/kg. CONTRAINDICATED <2 yr (resp depression). Tissue injury if IV extrav.`}})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Dexamethasone`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(.15,10).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV / PO`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Adjunct, esp. chemo-induced. 0.15 mg/kg (max 10 mg).`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Scopolamine patch`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`1.5 mg patch`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`Transdermal`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`≥12 yr. Motion sickness. Apply 4h before exposure.`})]})]})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Pearls:`}),` Ondansetron is first-line in ED for acute gastroenteritis vomiting — single PO/ODT dose increases oral rehydration success. Avoid anticholinergics + opioid combinations. Check QTc if stacking ondansetron + other QT drugs.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP gastroenteritis guidance · WHO essential medicines · Lexicomp.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var B={neonate:{sepsis:{first:`Ampicillin + gentamicin`,alt:`Add cefotaxime if meningitis suspected or gram-neg concern`,duration:`7-10 days; 21 days if confirmed meningitis`,notes:`Cover GBS, E. coli, Listeria. Add acyclovir if HSV risk (maternal lesions, vesicles, seizures).`},meningitis:{first:`Ampicillin + cefotaxime (or gentamicin) + acyclovir`,alt:`Add vancomycin if gram-positive cocci`,duration:`14-21 days depending on organism`,notes:`HSV coverage essential. LP + HSV PCR.`},pna:{first:`Ampicillin + gentamicin`,alt:`Add cefotaxime for gram-neg`,duration:`7-10 days`,notes:`Same as sepsis coverage.`},uti:{first:`Ampicillin + gentamicin`,alt:`Cefotaxime if sensitivities known`,duration:`10-14 days`,notes:`Evaluate for sepsis. Renal US and VCUG workup.`},skin:{first:`Ampicillin + gentamicin`,alt:`Add vancomycin if MRSA risk`,duration:`7-10 days`,notes:`Omphalitis, mastitis — broad coverage.`},ent:{first:`Discuss with infectious diseases`,alt:`—`,duration:`—`,notes:`Rare in neonates. Any ear/throat infection warrants sepsis eval.`},neutropenic:{first:`Cefepime or piperacillin-tazobactam`,alt:`Add vancomycin if indwelling line, severe mucositis, or MRSA`,duration:`Until ANC recovery + afebrile ≥48h`,notes:`Oncology/ID consult.`},ic:{first:`Ampicillin + gentamicin + metronidazole`,alt:`Or piperacillin-tazobactam`,duration:`7-14 days`,notes:`NEC: add metronidazole/clindamycin for anaerobes.`},bone:{first:`Ampicillin + gentamicin`,alt:`Vancomycin if MRSA risk`,duration:`3-6 weeks (IV then PO)`,notes:`Usually hematogenous. S. aureus, GBS, E. coli.`}},infant:{sepsis:{first:`Ampicillin + ceftriaxone (or gentamicin)`,alt:`+ vancomycin if MRSA / severe`,duration:`7-10 days`,notes:`Add acyclovir if HSV suspected (<6 wks). Fever in <90 days requires workup.`},meningitis:{first:`Ceftriaxone + vancomycin (± ampicillin if <6 wks for Listeria)`,alt:`+ acyclovir if HSV`,duration:`10-14 days (longer for Listeria/gram-neg)`,notes:`Dexamethasone if H. influenzae suspected.`},pna:{first:`Ampicillin (or ceftriaxone)`,alt:`Add azithromycin if atypical`,duration:`7-10 days`,notes:`S. pneumoniae most common. RSV/viral often primary.`},uti:{first:`Ceftriaxone or cefotaxime`,alt:`Ampicillin + gentamicin`,duration:`10-14 days`,notes:`US kidney/bladder if first febrile UTI.`},skin:{first:`Cefazolin or clindamycin`,alt:`Vancomycin if MRSA risk`,duration:`7-10 days`,notes:`Consider MRSA if purulent or local resistance >10%.`},ent:{first:`Amoxicillin (90 mg/kg/day) for AOM`,alt:`Amox-clav if recent abx/treatment failure`,duration:`AOM 10 days <2 yr; 7 days ≥2 yr`,notes:`Observe mild AOM if >6 mo and no severe features.`},neutropenic:{first:`Cefepime or piperacillin-tazobactam`,alt:`+ vancomycin for severe/mucositis/line`,duration:`Until ANC recovery + afebrile`,notes:`Oncology/ID consult.`},ic:{first:`Ceftriaxone + metronidazole`,alt:`Piperacillin-tazobactam`,duration:`5-7 days (uncomplicated), longer for complicated`,notes:`Appendicitis — surgical consult.`},bone:{first:`Cefazolin ± vancomycin`,alt:`Clindamycin`,duration:`3-4 weeks (IV then PO transition)`,notes:`S. aureus most common. Kingella in <4 yr.`}},child:{sepsis:{first:`Ceftriaxone + vancomycin`,alt:`Piperacillin-tazobactam if intra-abdominal`,duration:`7-14 days`,notes:`Expand if specific source. Add antifungal if prolonged neutropenia.`},meningitis:{first:`Ceftriaxone + vancomycin`,alt:`+ dexamethasone (Hib coverage)`,duration:`10-14 days`,notes:`Lumbar puncture. Dexamethasone 0.15 mg/kg q6h x 4 days.`},pna:{first:`Ampicillin OR amoxicillin (high dose)`,alt:`Ceftriaxone if hospitalized; add azithromycin for atypical`,duration:`5-7 days (uncomplicated)`,notes:`Mycoplasma if >5 yr. Consider viral causes.`},uti:{first:`Cephalexin or TMP-SMX (PO)`,alt:`Ceftriaxone if ill`,duration:`7-10 days (10-14 if pyelo)`,notes:`Culture-guided de-escalation.`},skin:{first:`Cephalexin or clindamycin`,alt:`TMP-SMX or doxycycline if MRSA`,duration:`5-10 days`,notes:`Abscess — incision & drainage primary tx.`},ent:{first:`Amoxicillin 90 mg/kg/day (AOM); Penicillin V for strep pharyngitis`,alt:`Amox-clav; cephalexin if non-anaphylactic PCN allergy`,duration:`AOM 5-10 days; strep 10 days`,notes:`Strep pharyngitis dose: PCN V 250 mg BID-TID (<27 kg) or 500 mg BID (≥27 kg).`},neutropenic:{first:`Cefepime OR piperacillin-tazobactam`,alt:`+ vancomycin`,duration:`Until ANC recovery + afebrile`,notes:`Add empiric antifungal if fever >4-7 days.`},ic:{first:`Ceftriaxone + metronidazole`,alt:`Piperacillin-tazobactam`,duration:`5-7 days (uncomplicated appendicitis)`,notes:`Surgical consult.`},bone:{first:`Cefazolin ± vancomycin`,alt:`Clindamycin`,duration:`3-4 weeks total`,notes:`S. aureus, group A strep. Consider MRSA if severe.`}}},V={neonate:`Neonate (0-28 d)`,infant:`Infant (1-3 mo)`,child:`Child (>3 mo)`},H=[[`sepsis`,`Sepsis / bacteremia`],[`meningitis`,`Meningitis`],[`pna`,`Pneumonia`],[`uti`,`Urinary tract infection`],[`skin`,`Skin / soft tissue`],[`ent`,`Ear / throat (ENT)`],[`neutropenic`,`Febrile neutropenia`],[`ic`,`Intra-abdominal`],[`bone`,`Bone / joint`]];function U(){let[e,t]=(0,c.useState)(`child`),[n,r]=(0,c.useState)(`sepsis`),i=B[e][n];return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-antimicrobials`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Antimicrobials (empirical)`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`abx-age`,className:D,children:`Age band`}),(0,l.jsx)(`select`,{id:`abx-age`,className:E,value:e,onChange:e=>t(e.target.value),"data-testid":`abx-age`,children:Object.entries(V).map(([e,t])=>(0,l.jsx)(`option`,{value:e,children:t},e))})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`abx-infection`,className:D,children:`Infection`}),(0,l.jsx)(`select`,{id:`abx-infection`,className:E,value:n,onChange:e=>r(e.target.value),"data-testid":`abx-infection`,children:H.map(([e,t])=>(0,l.jsx)(`option`,{value:e,children:t},e))})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold text-blue-900 dark:text-blue-100`,children:[V[e],` — `,H.find(([e])=>e===n)?.[1]]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{className:`text-green-800 dark:text-green-200`,children:`First-line:`}),` `,i.first]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Alternative / add:`}),` `,i.alt]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Duration:`}),` `,i.duration]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Notes:`}),` `,i.notes]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Red Book · IDSA guidelines · Harriet Lane. Always tailor to local resistance patterns and culture results.`})]})}function W(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=r?Math.round(n*20):null;return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-trauma`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Trauma — primary survey + MTP`}),(0,l.jsx)(A,{id:`trauma-wt`,value:e,onChange:t,testid:`trauma-weight`}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Primary Survey — ABCDE`}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-destructive`,children:`A — Airway + c-spine`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Maintain airway (jaw thrust, suction). `,(0,l.jsx)(`strong`,{children:`Manual inline stabilization`}),`; apply collar. Intubate if GCS ≤8, inadequate airway, or impending compromise. Avoid succinylcholine if burn/crush/prolonged immobilization.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`B — Breathing`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`SpO₂, bilateral breath sounds, chest wall integrity. Identify tension PTX (needle decompression), open PTX (3-sided dressing), flail chest, massive hemothorax.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-green-800 dark:text-green-200`,children:`C — Circulation`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Two large-bore IVs / IO. Control hemorrhage (direct pressure, tourniquet, pelvic binder).`,` `,r?(0,l.jsxs)(l.Fragment,{children:[`NS or LR 20 mL/kg = `,(0,l.jsxs)(`strong`,{children:[i,` mL`]}),` bolus.`]}):(0,l.jsx)(l.Fragment,{children:`NS/LR 20 mL/kg bolus.`}),` `,`Consider blood after 40-60 mL/kg crystalloid or in Class III shock.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`D — Disability`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`GCS, pupils, glucose, gross motor. Consider ↑ICP (head up 30°, mannitol 0.5-1 g/kg or hypertonic saline 3% 3-5 mL/kg).`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-violet-500 bg-violet-50 dark:bg-violet-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-violet-800 dark:text-violet-200`,children:`E — Exposure + environment`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Fully expose; prevent hypothermia (warm blankets, fluids).`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Massive Transfusion Protocol (MTP)`}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Ratio`}),(0,l.jsx)(`td`,{className:k,children:`1:1:1 (pRBC : FFP : platelets)`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`—`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Activate early if ≥40 mL/kg transfused or ongoing hemorrhage. Avoid excessive crystalloid.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Tranexamic acid (TXA)`}),(0,l.jsx)(`td`,{className:k,children:`15 mg/kg IV (max 1 g) over 10 min → 2 mg/kg/hr × 8h`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Within 3 hr of injury. CRASH-2 / MATIC.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Calcium`}),(0,l.jsx)(`td`,{className:k,children:`20 mg/kg CaCl or 60 mg/kg Ca-gluconate IV per unit citrated blood`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Citrated blood chelates calcium.`})]})]})]})}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`C-spine clearance (NEXUS / CCR)`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[`Pediatric c-spine decision tools are imperfect. `,(0,l.jsx)(`strong`,{children:`Imaging if any:`}),` focal neurologic deficit, altered mental status, neck pain / tenderness, torticollis, substantial torso injury, high-risk mechanism (diving, MVC >55 mph, fall >10 ft). Plain films + CT if positive or equivocal.`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Pediatric shock — signs`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-xs text-red-900 dark:text-red-200`,children:[`Children compensate well — `,(0,l.jsx)(`strong`,{children:`hypotension is a late finding`}),`. Early signs: tachycardia, cool extremities, weak peripheral pulses, prolonged cap refill (>3 sec), narrowed pulse pressure, altered mentation. Minimum SBP = 70 + (2 × age in years) for ages 1-10.`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Secondary survey — AMPLE + head-to-toe`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[(0,l.jsx)(`strong`,{children:`AMPLE:`}),` Allergies, Medications, Past history, Last meal, Events of injury. Head-to-toe exam; log-roll for back; digital rectal; neurovascular checks of all extremities.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ATLS 10th ed · PALS 2020 · PECARN c-spine rule · CRASH-2 trial (TXA).`})]})}var G=[{name:`Ketamine IV`,display:`Ketamine`,perKgLow:1.5,perKgHigh:2,maxLow:100,maxHigh:150,unit:`mg`,route:`IV`,onset:`1 min`,duration:`15-30 min`,notes:`Dissociative. Preserves airway reflexes.`},{name:`Ketamine IM`,display:null,perKgLow:4,perKgHigh:5,maxLow:300,maxHigh:400,unit:`mg`,route:`IM`,onset:`3-5 min`,duration:`30-60 min`,notes:`Give atropine 0.01 mg/kg to reduce secretions.`},{name:`Midazolam IV`,display:`Midazolam`,perKgLow:.05,perKgHigh:.1,maxLow:2,maxHigh:5,unit:`mg`,route:`IV`,onset:`2-3 min`,duration:`30-60 min`,notes:`Anxiolysis. Titrate q3-5 min.`},{name:`Midazolam IN/PO`,display:null,perKg:.5,max:20,unit:`mg`,route:`IN/PO`,onset:`10-15 min`,duration:`30-60 min`,notes:`IN (max 10 mg / naris) or PO (max 20 mg).`},{name:`Propofol`,display:`Propofol`,perKg:1,max:40,unit:`mg`,route:`IV`,onset:`30 sec`,duration:`5-10 min`,notes:`Short procedures. Causes apnea — manage airway.`},{name:`Fentanyl IV`,display:`Fentanyl`,perKg:1,max:100,unit:`mcg`,route:`IV`,onset:`2-3 min`,duration:`30-60 min`,notes:`Analgesic. Often combined with midazolam.`},{name:`Fentanyl IN`,display:null,perKg:2,max:100,unit:`mcg`,route:`IN`,onset:`5-10 min`,duration:`30-60 min`,notes:`Intranasal.`},{name:`Nitrous oxide`,display:`Nitrous oxide`,doseDisplay:`50:50 or 70:30 mix`,unit:`mix`,route:`Inhaled`,onset:`2-5 min`,duration:`5 min off`,notes:`Self-administered via demand valve. Anxiolysis + mild analgesia.`},{name:`Dexmedetomidine IN`,display:`Dexmedetomidine`,perKgLow:2,perKgHigh:3,maxLow:100,maxHigh:null,unit:`mcg`,route:`IN`,onset:`15-30 min`,duration:`60-90 min`,notes:`Intranasal. No respiratory depression. Good for imaging.`},{name:`Naloxone`,display:`Naloxone`,perKg:.1,max:2,unit:`mg`,route:`IV/IM/IN`,reverses:`Opioids (fentanyl, morphine)`,notes:`Max 2 mg. Repeat q2-3 min. Duration shorter than opioids — monitor for re-sedation.`},{name:`Flumazenil`,display:`Flumazenil`,perKg:.01,max:.2,unit:`mg`,route:`IV`,reverses:`Benzodiazepines (midazolam)`,notes:`Max 0.2 mg single dose. Repeat q1 min to max 1 mg total. Risk of seizures — use cautiously.`}];function K(e,t){if(t.doseDisplay)return t.doseDisplay;let n=t.unit===`mcg`?` mcg`:t.unit===`mix`?``:` mg`,r=t.unit===`mcg`?`mcg`:`mg`;if(t.perKgLow!=null){let i=s(e,t.perKgLow,t.maxLow??null).value;return t.perKgHigh==null?`${i}${n} (${t.perKgLow} ${r}/kg)`:`${i}-${s(e,t.perKgHigh,t.maxHigh??null).value}${n} (${t.perKgLow}-${t.perKgHigh} ${r}/kg)`}return t.perKg==null?``:`${s(e,t.perKg,t.max??null).value}${n} (${t.perKg} ${r}/kg)`}function q(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=G.filter(e=>!e.reverses),a=G.filter(e=>e.reverses);function o({dg:e}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e.display??``}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:K(n,e)})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.route}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.onset??``}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.duration??``}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e.notes})]})}function s({dg:e}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e.display}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:K(n,e)})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.route}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.reverses}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e.notes})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-sedation`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Procedural Sedation`}),(0,l.jsx)(A,{id:`sed-wt`,value:e,onChange:t,testid:`sed-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3 text-sm font-semibold text-purple-900 dark:text-purple-100`,children:[`Procedural Sedation — `,n,` kg patient`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Sedation Agents`}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Onset`}),(0,l.jsx)(`th`,{className:O,children:`Duration`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:i.map(e=>(0,l.jsx)(o,{dg:e},e.name))})]})}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold text-destructive`,children:`Reversal Agents`}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{className:`bg-red-50 dark:bg-red-950/30`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Reverses`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:a.map(e=>(0,l.jsx)(s,{dg:e},e.name))})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Pre-sedation checklist:`}),` NPO status (2h clear liquids, 6h solids), consent, monitoring equipment (pulse ox, capnography, BP), resuscitation equipment at bedside, suction ready, IV access. Minimum monitoring: continuous SpO₂, HR, capnography. Provider capable of managing airway must be present.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Guidelines for Monitoring and Management of Pediatric Patients Before, During, and After Sedation · ASA Practice Guidelines for Sedation and Analgesia by Non-Anesthesiologists.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var J=[[`approach`,`General approach (stabilize → toxidrome → decon → antidote)`],[`acetaminophen`,`Acetaminophen overdose`],[`opioids`,`Opioid overdose`],[`iron`,`Iron overdose`],[`tca`,`Tricyclic antidepressant (TCA) overdose`],[`bbccb`,`β-blocker / CCB overdose`],[`benzo`,`Benzodiazepine overdose`],[`organo`,`Organophosphate / carbamate poisoning`],[`salicylate`,`Salicylate overdose`],[`etoh`,`Toxic alcohols (methanol / ethylene glycol)`],[`dialyzable`,`Dialyzable drugs (ISTUMBLE)`]];function Y(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`approach`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n).value:null;function u({color:e,title:t,body:n}){return(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 ${e} p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold mb-1`,children:t}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:n})]})}function d({drug:e,dose:t,route:n,notes:r}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e}),(0,l.jsx)(`td`,{className:k,children:t}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}function f({children:e}){return(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:e})]})})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-toxicology`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Toxicology`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-xl`,children:[(0,l.jsx)(A,{id:`tox-wt`,value:e,onChange:t,testid:`tox-weight`}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`tox-topic`,className:D,children:`Topic`}),(0,l.jsx)(`select`,{id:`tox-topic`,className:E,value:n,onChange:e=>r(e.target.value),"data-testid":`tox-topic`,children:J.map(([e,t])=>(0,l.jsx)(`option`,{value:e,children:t},e))})]})]}),n===`approach`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(u,{color:`border-blue-500 bg-blue-50 dark:bg-blue-950/30`,title:`1. Stabilize (ABCDE)`,body:(0,l.jsx)(l.Fragment,{children:`Airway, breathing, circulation, disability (glucose, pupils, GCS), exposure. Naloxone if depressed LOC + resp depression. Dextrose if hypoglycemic. Thiamine in select cases.`})}),(0,l.jsx)(u,{color:`border-purple-500 bg-purple-50 dark:bg-purple-950/30`,title:`2. Identify toxidrome`,body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Sympathomimetic:`}),` HTN, tachy, mydriasis, diaphoresis (cocaine, meth). `,(0,l.jsx)(`strong`,{children:`Anticholinergic:`}),` hot/dry, mydriasis, tachy, delirium (antihistamines, TCAs). `,(0,l.jsx)(`strong`,{children:`Cholinergic:`}),` SLUDGE-M, miosis (organophosphates). `,(0,l.jsx)(`strong`,{children:`Opioid:`}),` miosis, resp depression, ↓LOC. `,(0,l.jsx)(`strong`,{children:`Sedative-hypnotic:`}),` ↓LOC, normal/low vitals.`]})}),(0,l.jsx)(u,{color:`border-amber-500 bg-amber-50 dark:bg-amber-950/30`,title:`3. Decontamination`,body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Activated charcoal`}),` 1 g/kg PO (max 50 g): within 1h of ingestion, intact airway, ingestion adsorbed (not Li, metals, alcohols). Avoid caustics/hydrocarbons. `,(0,l.jsx)(`strong`,{children:`Whole bowel irrigation:`}),` PEG for metals/iron/lithium/sustained release. `,(0,l.jsx)(`strong`,{children:`Gastric lavage:`}),` rarely indicated. `,(0,l.jsx)(`strong`,{children:`Ipecac:`}),` no longer recommended.`]})}),(0,l.jsx)(u,{color:`border-green-500 bg-green-50 dark:bg-green-950/30`,title:`4. Enhance elimination`,body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Urinary alkalinization`}),` (salicylates, phenobarbital). `,(0,l.jsx)(`strong`,{children:`Hemodialysis`}),` (see ISTUMBLE). `,(0,l.jsx)(`strong`,{children:`Lipid emulsion`}),` for lipid-soluble drug toxicity (LA, CCB, TCA).`]})}),(0,l.jsx)(u,{color:`border-destructive bg-red-50 dark:bg-red-950/30`,title:`5. Antidotes`,body:(0,l.jsxs)(l.Fragment,{children:[`See topic list. `,(0,l.jsx)(`strong`,{children:`Contact Poison Center`}),` (US: 1-800-222-1222) early for any significant exposure.`]})})]}),n===`acetaminophen`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Acetaminophen overdose`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Acute toxic dose: >150 mg/kg (or 7.5 g total) single ingestion. Hepatotoxic after 24h; AST/ALT peak day 3-4.`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[(0,l.jsx)(`strong`,{children:`Diagnosis:`}),` Draw level at 4h post-ingestion (or on arrival if >4h). Plot on `,(0,l.jsx)(`strong`,{children:`Rumack-Matthew nomogram`}),` (treatment line at 150 mcg/mL at 4h).`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`N-acetylcysteine (NAC) — IV`,dose:`150 mg/kg over 1h → 50 mg/kg over 4h → 100 mg/kg over 16h (21h total)`,route:`IV`,notes:`Total 300 mg/kg. Most effective if started <8h post-ingestion.`}),(0,l.jsx)(d,{drug:`N-acetylcysteine — PO`,dose:`140 mg/kg load, then 70 mg/kg q4h × 17 doses`,route:`PO`,notes:`Alternative to IV. Unpleasant taste — often with juice.`}),(0,l.jsx)(d,{drug:`Activated charcoal`,dose:`1 g/kg (max 50 g)`,route:`PO`,notes:`If within 1-2h of ingestion and airway protected.`})]}),a&&(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[(0,l.jsxs)(`strong`,{children:[`For `,i,` kg:`]}),` IV loading = `,o(150,null),` mg over 1h `,(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`(150 mg/kg)`}),`; 2nd bag = `,o(50,null),` mg over 4h `,(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`(50 mg/kg)`}),`; 3rd bag = `,o(100,null),` mg over 16h `,(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`(100 mg/kg)`}),`. `,(0,l.jsx)(`em`,{children:`Total 300 mg/kg.`})]})]}),n===`opioids`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Opioid overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Triad: `,(0,l.jsx)(`strong`,{children:`miosis + respiratory depression + ↓ LOC`}),`. Fentanyl / synthetics may require repeated/higher doses.`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Naloxone (initial)`,dose:a?`0.01-0.1 mg/kg = ${o(.01,null)}-${o(.1,null)} mg`:`0.01-0.1 mg/kg`,route:`IV / IM / IN / IO`,notes:`Start low if chronic opioid use (avoid withdrawal). Titrate to respiratory effort, not consciousness.`}),(0,l.jsx)(d,{drug:`Naloxone (full reversal)`,dose:`2 mg IV/IM/IN`,route:`IV / IM / IN`,notes:`If no chronic use and severe resp depression. Repeat q2-3 min.`}),(0,l.jsx)(d,{drug:`Naloxone infusion`,dose:`2/3 of effective bolus per hour`,route:`IV`,notes:`For long-acting opioids (methadone, fentanyl patch, sustained release)`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[`Observe ≥4h after last dose; longer for long-acting agents. Duration of naloxone (30-90 min) is shorter than most opioids — `,(0,l.jsx)(`strong`,{children:`re-sedation is common`}),`.`]})]}),n===`iron`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Iron overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Toxic dose: elemental Fe ≥20 mg/kg. Severe ≥60 mg/kg. `,(0,l.jsx)(`strong`,{children:`Charcoal does NOT bind iron.`})]}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[(0,l.jsx)(`strong`,{children:`Stages:`}),` 1) GI (0-6h: vomiting, bloody diarrhea); 2) Latent (6-24h); 3) Shock/metabolic acidosis (12-24h); 4) Hepatotoxicity (2-5d); 5) Gastric scarring (2-8 wk).`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Whole bowel irrigation`,dose:`PEG-ES 25-40 mL/kg/hr`,route:`NG`,notes:`For radiopaque pills on KUB or ingested sustained-release iron.`}),(0,l.jsx)(d,{drug:`Deferoxamine`,dose:`15 mg/kg/hr IV infusion`,route:`IV`,notes:`Max 6-8 g/day. Indications: shock, metabolic acidosis, Fe >500 mcg/dL, or severe symptoms. Urine turns 'vin rosé' color.`})]}),(0,l.jsx)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:`Iron level at 4-6h. <350 usually asymptomatic; 350-500 mild; >500 severe. Consider KUB for radiopaque pills.`})]}),n===`tca`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`TCA overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Anticholinergic + Na-channel blockade. `,(0,l.jsx)(`strong`,{children:`Risks:`}),` seizure, VT/VF, hypotension, coma. ECG: QRS >100 ms or R in aVR >3 mm predicts toxicity.`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Sodium bicarbonate 8.4%`,dose:`1-2 mEq/kg IV bolus → infusion`,route:`IV`,notes:`Goal pH 7.45-7.55 and narrowing QRS. Repeat bolus for QRS widening, hypotension, or arrhythmia.`}),(0,l.jsx)(d,{drug:`Mg sulfate`,dose:a?`${o(50,2e3)} mg`:`25-50 mg/kg (max 2 g)`,route:`IV over 10 min`,notes:`For torsades.`}),(0,l.jsx)(d,{drug:`IV lipid emulsion 20%`,dose:`1.5 mL/kg bolus → 0.25 mL/kg/min × 30-60 min`,route:`IV`,notes:`If refractory shock/arrest. Consult toxicology.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Avoid`}),` Class IA/IC antiarrhythmics, beta-blockers, physostigmine (risk of asystole with TCAs).`]})]}),n===`bbccb`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`β-blocker / Calcium-channel blocker overdose`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Bradycardia + hypotension. CCBs (esp. verapamil, diltiazem, amlodipine) can be lethal in small pediatric doses.`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`IV fluids`,dose:`20 mL/kg NS bolus`,route:`IV`,notes:`Cautious — avoid volume overload`}),(0,l.jsx)(d,{drug:`Calcium chloride 10% or gluconate`,dose:`CaCl 20 mg/kg / Ca-glu 60 mg/kg`,route:`IV`,notes:`First-line for CCB. Repeat q15-20 min.`}),(0,l.jsx)(d,{drug:`Glucagon`,dose:`50 mcg/kg IV bolus → 50-150 mcg/kg/hr`,route:`IV`,notes:`β-blocker antidote. GI side effects common.`}),(0,l.jsx)(d,{drug:`High-dose insulin (HIE)`,dose:`Regular insulin 1 U/kg bolus → 0.5-2 U/kg/hr + D25% infusion`,route:`IV`,notes:`Hyperinsulinemic euglycemia therapy. Monitor K+ and glucose closely.`}),(0,l.jsx)(d,{drug:`Vasopressors`,dose:`Epi / norepi infusion`,route:`IV`,notes:`Titrate to MAP.`}),(0,l.jsx)(d,{drug:`Lipid emulsion 20%`,dose:`1.5 mL/kg → 0.25 mL/kg/min`,route:`IV`,notes:`For lipid-soluble CCBs (verapamil) if refractory.`}),(0,l.jsx)(d,{drug:`Methylene blue / ECMO`,dose:`—`,route:`—`,notes:`Rescue therapy — toxicology/ICU consult.`})]})]}),n===`benzo`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Benzodiazepine overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Sedation + resp depression. Usually supportive — intubation rarely needed alone. `,(0,l.jsx)(`strong`,{children:`Flumazenil caution.`})]}),(0,l.jsx)(f,{children:(0,l.jsx)(d,{drug:`Flumazenil`,dose:`0.01 mg/kg (max 0.2 mg) IV, may repeat q1 min to max 1 mg`,route:`IV`,notes:`Only for iatrogenic reversal in a benzo-naive patient with no TCAs, seizure disorder, or chronic benzo use. Can precipitate seizures.`})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[`In real-world ingestion, `,(0,l.jsx)(`strong`,{children:`supportive care (airway, monitoring)`}),` is usually safer than flumazenil.`]})]}),n===`organo`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Organophosphate / carbamate poisoning`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Cholinergic toxidrome: `,(0,l.jsx)(`strong`,{children:`SLUDGE-M`}),` (salivation, lacrimation, urination, defecation, GI distress, emesis, miosis) + muscle fasciculation, bradycardia, bronchorrhea. Decontamination critical (PPE for providers).`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Atropine`,dose:`0.05 mg/kg IV, double q3-5 min until bronchial secretions dry`,route:`IV`,notes:`Endpoint = dry lungs, not dry mouth or heart rate. Can require huge doses.`}),(0,l.jsx)(d,{drug:`Pralidoxime (2-PAM)`,dose:`25-50 mg/kg IV over 30 min (max 2 g) → 10-20 mg/kg/hr`,route:`IV`,notes:`Only for organophosphates (not carbamates). Regenerates acetylcholinesterase.`}),(0,l.jsx)(d,{drug:`Diazepam / midazolam`,dose:`Standard seizure doses`,route:`IV`,notes:`For seizures or severe fasciculations.`})]})]}),n===`salicylate`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Salicylate overdose`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Mixed respiratory alkalosis + anion gap metabolic acidosis. Tinnitus, tachypnea, diaphoresis, hyperthermia. Severe: CNS depression, seizures, pulmonary edema, cerebral edema.`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Fluids`,dose:`Aggressive resuscitation`,route:`IV`,notes:`Dehydration common. Avoid fluid overload (risk of pulmonary edema).`}),(0,l.jsx)(d,{drug:`Sodium bicarb`,dose:`1-2 mEq/kg IV bolus → drip`,route:`IV`,notes:`Urinary alkalinization (goal urine pH >7.5). Prevents CNS entry.`}),(0,l.jsx)(d,{drug:`Glucose`,dose:`Maintain euglycemia even if BG normal`,route:`IV`,notes:`CNS hypoglycemia despite normal serum glucose.`}),(0,l.jsx)(d,{drug:`Hemodialysis`,dose:`—`,route:`—`,notes:`For severe: altered MS, pulmonary edema, renal failure, refractory acidosis, or level >100 mg/dL acute / >60 chronic.`})]})]}),n===`etoh`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Toxic alcohols (methanol / ethylene glycol)`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Anion gap metabolic acidosis + osmolar gap. Methanol → visual changes, blindness. Ethylene glycol → calcium oxalate crystals in urine, renal failure.`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Fomepizole`,dose:`15 mg/kg IV load → 10 mg/kg q12h × 4 → 15 mg/kg q12h`,route:`IV`,notes:`First-line. Inhibits alcohol dehydrogenase.`}),(0,l.jsx)(d,{drug:`Ethanol (alternative)`,dose:`Load 600 mg/kg → maintain level 100-150 mg/dL`,route:`IV / PO`,notes:`If fomepizole unavailable. Monitor closely.`}),(0,l.jsx)(d,{drug:`Hemodialysis`,dose:`—`,route:`—`,notes:`For severe acidosis, end-organ damage, or high levels.`}),(0,l.jsx)(d,{drug:`Folate / thiamine / pyridoxine`,dose:`Standard doses`,route:`IV`,notes:`Methanol: folate. EG: thiamine + pyridoxine (divert to non-toxic metabolites).`})]})]}),n===`dialyzable`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Dialyzable drugs (ISTUMBLE)`}),(0,l.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm`,children:[[`I`,`Isopropyl alcohol, INH`],[`S`,`Salicylates`],[`T`,`Theophylline, Toxic alcohols`],[`U`,`Uremia-related drugs`],[`M`,`Methanol, Metformin, Methotrexate`],[`B`,`Barbiturates (long-acting)`],[`L`,`Lithium`],[`E`,`Ethylene glycol`]].map(([e,t])=>(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsxs)(`strong`,{children:[e,`:`]}),` `,t]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Poor candidates for HD:`}),` Large Vd (TCAs, digoxin, BBs), highly protein-bound (benzos, CCBs), lipid-soluble (opioids, phenothiazines). EXTRIP recommendations are evidence-based — consult toxicology.`]})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Call Poison Control early: 1-800-222-1222 (US) · Refs: Goldfrank's Toxicologic Emergencies · EXTRIP workgroup.`})]})}function ee(e){switch(e){case`anaphylaxis`:return(0,l.jsx)(N,{});case`cardiac`:return(0,l.jsx)(P,{});case`seizure`:return(0,l.jsx)(I,{});case`airway`:return(0,l.jsx)(L,{});case`agitation`:return(0,l.jsx)(R,{});case`antiemetics`:return(0,l.jsx)(z,{});case`antimicrobials`:return(0,l.jsx)(U,{});case`trauma`:return(0,l.jsx)(W,{});case`sedation`:return(0,l.jsx)(q,{});case`toxicology`:return(0,l.jsx)(Y,{});case`neonatal`:return(0,l.jsx)(v,{});case`respiratory`:return(0,l.jsx)(y,{});case`ventilation`:return(0,l.jsx)(b,{});case`sepsis`:return(0,l.jsx)(x,{});case`burns`:return(0,l.jsx)(w,{});default:return null}}var te=new Set([`anaphylaxis`,`cardiac`,`seizure`,`airway`,`agitation`,`antiemetics`,`antimicrobials`,`trauma`,`sedation`,`toxicology`,`neonatal`,`respiratory`,`ventilation`,`sepsis`,`burns`]),X=`rounded-lg border border-border bg-card p-5 space-y-3`,ne=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,re=`rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted`,Z=`block text-xs font-medium text-muted-foreground`,Q=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,$=[{id:`neonatal`,label:`Neonatal`,icon:`👶`,summary:`GA classification, AGA/SGA/LGA, prematurity category (Fenton 2013 / WHO).`},{id:`airway`,label:`Airway / RSI`,icon:`💨`,summary:`ETT size + depth, RSI induction + paralytic dosing by weight.`},{id:`cardiac`,label:`Cardiac Arrest`,icon:`❤️`,summary:`PALS dosing (epinephrine, amiodarone, lidocaine), defibrillation J/kg.`},{id:`respiratory`,label:`Respiratory`,icon:`🫁`,summary:`Asthma, bronchiolitis, croup severity + dosing.`},{id:`ventilation`,label:`O₂ & Ventilation`,icon:`🌀`,summary:`NC / HFNC / CPAP / BiPAP flow + FiO₂ targets by age.`},{id:`seizure`,label:`Seizures`,icon:`🧠`,summary:`Benzodiazepine + second/third-line weight-based dosing.`},{id:`sepsis`,label:`Sepsis & Fever`,icon:`🦠`,summary:`Empirical antibiotics + fluid bolus dosing by weight.`},{id:`anaphylaxis`,label:`Anaphylaxis`,icon:`💉`,summary:`Epinephrine IM, IV infusion, steroid + antihistamine dosing.`},{id:`sedation`,label:`Sedation`,icon:`🛌`,summary:`Procedural sedation regimens — ketamine, propofol, midazolam.`},{id:`agitation`,label:`Agitation`,icon:`😤`,summary:`Weight-based haloperidol, olanzapine, lorazepam.`},{id:`antiemetics`,label:`Antiemetics`,icon:`💊`,summary:`Ondansetron, metoclopramide, promethazine dosing.`},{id:`antimicrobials`,label:`Antimicrobials`,icon:`🧫`,summary:`Common empirical regimens keyed to syndrome + weight.`},{id:`burns`,label:`Burns`,icon:`🔥`,summary:`TBSA % (Lund-Browder, Rule of Nines-children), Parkland fluids.`},{id:`toxicology`,label:`Toxicology`,icon:`☠️`,summary:`Common toxidromes + antidotes + decontamination windows.`},{id:`trauma`,label:`Trauma`,icon:`🩹`,summary:`PECARN, c-spine, blood-product dosing, TXA.`}];function ie(){let[e,t]=(0,c.useState)(``),[n,a]=(0,c.useState)(`apls`),[s,u]=(0,c.useState)(``),d=i(e),f=d==null?null:r(d),p=f?n===`bestguess`?f.all.bestGuess:f.all.apls:null,m=s.trim()||(p==null?``:String(p));function h(){t(``),a(`apls`),u(``)}return(0,l.jsxs)(`section`,{className:X,"data-testid":`bedside-weight-estimator`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Age → Weight Estimator`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Shared starting point for Bedside dosing. Uses the same APLS and Best Guess formulas as the legacy app.`})]}),(0,l.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[1.2fr_1fr_1fr_auto] md:items-end`,children:[(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:`bedside-react-age`,className:Z,children:`Age`}),(0,l.jsx)(`input`,{id:`bedside-react-age`,value:e,onChange:e=>t(e.target.value),placeholder:`e.g. "18m", "3y", "2y5m"`,className:Q,"data-testid":`bedside-age-input`})]}),(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:`bedside-react-formula`,className:Z,children:`Formula`}),(0,l.jsxs)(`select`,{id:`bedside-react-formula`,value:n,onChange:e=>{a(e.target.value),u(``)},className:Q,"data-testid":`bedside-formula-select`,children:[(0,l.jsx)(`option`,{value:`apls`,children:`APLS`}),(0,l.jsx)(`option`,{value:`bestguess`,children:`Best Guess`})]})]}),(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:`bedside-react-weight`,className:Z,children:`Weight (kg)`}),(0,l.jsx)(`input`,{id:`bedside-react-weight`,type:`number`,min:`0.3`,step:`0.1`,value:m,onChange:e=>u(e.target.value),className:Q,"data-testid":`bedside-weight-input`})]}),(0,l.jsx)(`button`,{type:`button`,onClick:h,className:re,children:`Clear`})]}),e.trim()&&d==null?(0,l.jsx)(`div`,{className:`rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-200`,children:`Could not parse age. Try "3y", "18 months", or "15 days".`}):null,f&&p!=null?(0,l.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/40 p-4 text-sm`,"data-testid":`bedside-estimate-result`,children:[(0,l.jsxs)(`div`,{className:`font-semibold`,children:[p,` kg estimated from `,o(d??0)]}),(0,l.jsxs)(`div`,{className:`text-muted-foreground`,children:[`APLS: `,f.all.apls,` kg · Best Guess: `,f.all.bestGuess,` kg. You can override the weight field.`]})]}):null]})}function ae({pill:e}){return(0,l.jsxs)(`section`,{className:X,"data-testid":`bedside-panel-`+e.id,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,l.jsx)(`span`,{className:`text-2xl`,"aria-hidden":!0,children:e.icon}),(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label})]}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary}),(0,l.jsx)(`div`,{className:`rounded-md border border-amber-300 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm space-y-2`,children:(0,l.jsx)(`p`,{className:`text-amber-900 dark:text-amber-100`,children:`Weight-based calculators for this module run in the legacy viewer while the clinical data is verified for a direct React port. Open the legacy Bedside tab to use the full dosing flow.`})}),(0,l.jsx)(`a`,{href:`/#bedside`,className:ne+` inline-block`,children:`Open in legacy viewer`})]})}function oe(){let[e,t]=(0,c.useState)($[0].id),n=$.find(t=>t.id===e)??$[0];return(0,l.jsxs)(`div`,{className:`max-w-5xl mx-auto p-6 space-y-4`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Bedside`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Emergency and rapid-reference pediatric tools. Weight-based dosing throughout — always verify against institutional protocols.`})]}),(0,l.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`bedside-subnav`,children:$.map(n=>(0,l.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors `+(e===n.id?`bg-primary text-primary-foreground border-primary`:`bg-muted hover:bg-muted/80 border-border`),"data-testid":`bedside-pill-`+n.id,children:[(0,l.jsx)(`span`,{className:`mr-1`,"aria-hidden":!0,children:n.icon}),n.label]},n.id))}),(0,l.jsx)(ie,{}),te.has(n.id)?ee(n.id):(0,l.jsx)(ae,{pill:n})]})}export{oe as default}; \ No newline at end of file diff --git a/public/app/assets/Calculators-DIAUUNQe.js b/public/app/assets/Calculators-DIAUUNQe.js new file mode 100644 index 0000000..26250ab --- /dev/null +++ b/public/app/assets/Calculators-DIAUUNQe.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,n as i,o as a,r as o,s,t as c}from"./fenton-9EKyvVkL.js";var l=e(t(),1),u={p95:{6:6,12:7.2,18:8.5,24:9.6,30:11.2,36:12.8,42:13.8,48:14.8,54:15.6,60:16.2,66:16.8,72:17.4,84:18,96:18.4,108:18.8,120:19},p75:{6:4.5,12:5.5,18:6.6,24:7.8,30:9.2,36:10.6,42:11.6,48:12.6,54:13.4,60:14,66:14.6,72:15,84:15.4,96:15.6,108:15.8,120:16},p40:{6:3,12:4,18:5,24:6.2,30:7.2,36:8.4,42:9.2,48:10,54:10.6,60:11.2,66:11.8,72:12.2,84:12.6,96:12.8,108:13,120:13.2}},d={12:8.5,13:8.7,14:8.9,15:9,16:9.2,17:9.4,18:9.6,19:9.8,20:9.9,21:10.1,22:10.3,23:10.4,24:10.6,25:10.8,26:10.9,27:11.1,28:11.3,29:11.4,30:11.6,31:11.7,32:11.9,33:12,34:12.2,35:12.3,36:12.5,37:12.6,38:12.8,39:12.9,40:13.1,41:13.2,42:13.4,43:13.5,44:13.6,45:13.8,46:13.9,47:14,48:14.2,49:14.3,50:14.4,51:14.5,52:14.7,53:14.8,54:14.9,55:15,56:15.1,57:15.3,58:15.4,59:15.5,60:15.6,61:15.7,62:15.8,63:15.9,64:16,65:16.1,66:16.2,67:16.3,68:16.4,69:16.5,70:16.6,71:16.7,72:16.8,73:16.9,74:17,75:17.1,76:17.2,77:17.3,78:17.4,79:17.5,80:17.5,81:17.6,82:17.7,83:17.8,84:17.8,85:17.9,86:18,87:18.1,88:18.1,89:18.2,90:18.3,91:18.3,92:18.4,93:18.5,94:18.5,95:18.6,96:18.6},f={12:9,13:9.2,14:9.4,15:9.6,16:9.8,17:9.9,18:10.1,19:10.3,20:10.5,21:10.6,22:10.8,23:11,24:11.2,25:11.3,26:11.5,27:11.7,28:11.8,29:12,30:12.1,31:12.3,32:12.5,33:12.6,34:12.8,35:12.9,36:13.1,37:13.2,38:13.4,39:13.5,40:13.7,41:13.8,42:13.9,43:14.1,44:14.2,45:14.4,46:14.5,47:14.6,48:14.8,49:14.9,50:15,51:15.1,52:15.3,53:15.4,54:15.5,55:15.6,56:15.8,57:15.9,58:16,59:16.1,60:16.2,61:16.3,62:16.5,63:16.6,64:16.7,65:16.8,66:16.9,67:17,68:17.1,69:17.2,70:17.3,71:17.4,72:17.5,73:17.6,74:17.7,75:17.8,76:17.9,77:17.9,78:18,79:18.1,80:18.2,81:18.3,82:18.4,83:18.4,84:18.5,85:18.6,86:18.7,87:18.8,88:18.8,89:18.9,90:19,91:19,92:19.1,93:19.2,94:19.2,95:19.3,96:19.3},p={12:9.6,13:9.8,14:9.9,15:10.1,16:10.3,17:10.5,18:10.7,19:10.8,20:11,21:11.2,22:11.4,23:11.5,24:11.7,25:11.9,26:12.1,27:12.2,28:12.4,29:12.5,30:12.7,31:12.9,32:13,33:13.2,34:13.3,35:13.5,36:13.6,37:13.8,38:13.9,39:14.1,40:14.2,41:14.4,42:14.5,43:14.7,44:14.8,45:15,46:15.1,47:15.2,48:15.4,49:15.5,50:15.6,51:15.8,52:15.9,53:16,54:16.1,55:16.3,56:16.4,57:16.5,58:16.6,59:16.7,60:16.9,61:17,62:17.1,63:17.2,64:17.3,65:17.4,66:17.5,67:17.6,68:17.7,69:17.8,70:17.9,71:18,72:18.1,73:18.2,74:18.3,75:18.4,76:18.5,77:18.6,78:18.7,79:18.8,80:18.9,81:19,82:19,83:19.1,84:19.2,85:19.3,86:19.4,87:19.4,88:19.5,89:19.6,90:19.7,91:19.7,92:19.8,93:19.9,94:19.9,95:20,96:20},m={12:10.1,13:10.3,14:10.5,15:10.7,16:10.8,17:11,18:11.2,19:11.4,20:11.6,21:11.7,22:11.9,23:12.1,24:12.3,25:12.4,26:12.6,27:12.8,28:12.9,29:13.1,30:13.3,31:13.4,32:13.6,33:13.8,34:13.9,35:14.1,36:14.2,37:14.4,38:14.5,39:14.7,40:14.8,41:15,42:15.1,43:15.3,44:15.4,45:15.6,46:15.7,47:15.8,48:16,49:16.1,50:16.2,51:16.4,52:16.5,53:16.6,54:16.8,55:16.9,56:17,57:17.1,58:17.3,59:17.4,60:17.5,61:17.6,62:17.7,63:17.8,64:17.9,65:18.1,66:18.2,67:18.3,68:18.4,69:18.5,70:18.6,71:18.7,72:18.8,73:18.9,74:19,75:19.1,76:19.2,77:19.3,78:19.4,79:19.5,80:19.5,81:19.6,82:19.7,83:19.8,84:19.9,85:20,86:20,87:20.1,88:20.2,89:20.3,90:20.3,91:20.4,92:20.5,93:20.6,94:20.6,95:20.7,96:20.7},h={12:10.6,13:10.8,14:11,15:11.2,16:11.4,17:11.6,18:11.8,19:11.9,20:12.1,21:12.3,22:12.5,23:12.7,24:12.8,25:13,26:13.2,27:13.3,28:13.5,29:13.7,30:13.8,31:14,32:14.2,33:14.3,34:14.5,35:14.7,36:14.8,37:15,38:15.1,39:15.3,40:15.4,41:15.6,42:15.7,43:15.9,44:16,45:16.2,46:16.3,47:16.4,48:16.6,49:16.7,50:16.8,51:17,52:17.1,53:17.2,54:17.4,55:17.5,56:17.6,57:17.8,58:17.9,59:18,60:18.1,61:18.2,62:18.4,63:18.5,64:18.6,65:18.7,66:18.8,67:18.9,68:19,69:19.1,70:19.2,71:19.3,72:19.5,73:19.6,74:19.7,75:19.7,76:19.8,77:19.9,78:20,79:20.1,80:20.2,81:20.3,82:20.4,83:20.5,84:20.6,85:20.6,86:20.7,87:20.8,88:20.9,89:21,90:21,91:21.1,92:21.2,93:21.3,94:21.3,95:21.4,96:21.5},g={12:11.2,13:11.3,14:11.5,15:11.7,16:11.9,17:12.1,18:12.3,19:12.5,20:12.7,21:12.8,22:13,23:13.2,24:13.4,25:13.6,26:13.7,27:13.9,28:14.1,29:14.2,30:14.4,31:14.6,32:14.7,33:14.9,34:15.1,35:15.2,36:15.4,37:15.6,38:15.7,39:15.9,40:16,41:16.2,42:16.3,43:16.5,44:16.6,45:16.8,46:16.9,47:17.1,48:17.2,49:17.4,50:17.5,51:17.6,52:17.8,53:17.9,54:18.1,55:18.2,56:18.3,57:18.5,58:18.6,59:18.7,60:18.9,61:19,62:19.1,63:19.3,64:19.4,65:19.5,66:19.6,67:19.7,68:19.9,69:20,70:20.1,71:20.2,72:20.3,73:20.4,74:20.5,75:20.6,76:20.7,77:20.8,78:20.9,79:21,80:21.1,81:21.2,82:21.3,83:21.4,84:21.5,85:21.5,86:21.6,87:21.7,88:21.8,89:21.9,90:21.9,91:22,92:22.1,93:22.2,94:22.2,95:22.3,96:22.3},_={12:6.9,13:7.1,14:7.2,15:7.4,16:7.6,17:7.7,18:7.9,19:8.1,20:8.2,21:8.4,22:8.6,23:8.7,24:8.9,25:9,26:9.2,27:9.3,28:9.5,29:9.6,30:9.8,31:9.9,32:10.1,33:10.2,34:10.3,35:10.5,36:10.6,37:10.8,38:10.9,39:11,40:11.2,41:11.3,42:11.4,43:11.5,44:11.7,45:11.8,46:11.9,47:12,48:12.2,49:12.3,50:12.4,51:12.5,52:12.6,53:12.7,54:12.8,55:13,56:13.1,57:13.2,58:13.3,59:13.4,60:13.5,61:13.6,62:13.7,63:13.8,64:13.9,65:14,66:14.1,67:14.2,68:14.2,69:14.3,70:14.4,71:14.5,72:14.6,73:14.7,74:14.8,75:14.8,76:14.9,77:15,78:15.1,79:15.1,80:15.2,81:15.3,82:15.3,83:15.4,84:15.5,85:15.5,86:15.6,87:15.7,88:15.7,89:15.8,90:15.8,91:15.9,92:15.9,93:16,94:16.1,95:16.1,96:16.1},v={12:7.4,13:7.6,14:7.8,15:8,16:8.1,17:8.3,18:8.5,19:8.6,20:8.8,21:9,22:9.1,23:9.3,24:9.4,25:9.6,26:9.8,27:9.9,28:10.1,29:10.2,30:10.4,31:10.5,32:10.7,33:10.8,34:11,35:11.1,36:11.2,37:11.4,38:11.5,39:11.7,40:11.8,41:11.9,42:12.1,43:12.2,44:12.3,45:12.5,46:12.6,47:12.7,48:12.8,49:13,50:13.1,51:13.2,52:13.3,53:13.4,54:13.5,55:13.7,56:13.8,57:13.9,58:14,59:14.1,60:14.2,61:14.3,62:14.4,63:14.5,64:14.6,65:14.7,66:14.8,67:14.9,68:15,69:15.1,70:15.2,71:15.3,72:15.4,73:15.4,74:15.5,75:15.6,76:15.7,77:15.8,78:15.8,79:15.9,80:16,81:16.1,82:16.1,83:16.2,84:16.3,85:16.4,86:16.4,87:16.5,88:16.6,89:16.6,90:16.7,91:16.7,92:16.8,93:16.8,94:16.9,95:17,96:17},y={12:8,13:8.1,14:8.3,15:8.5,16:8.7,17:8.9,18:9,19:9.2,20:9.4,21:9.5,22:9.7,23:9.9,24:10,25:10.2,26:10.4,27:10.5,28:10.7,29:10.8,30:11,31:11.1,32:11.3,33:11.4,34:11.6,35:11.7,36:11.9,37:12,38:12.2,39:12.3,40:12.4,41:12.6,42:12.7,43:12.9,44:13,45:13.1,46:13.2,47:13.4,48:13.5,49:13.6,50:13.8,51:13.9,52:14,53:14.1,54:14.2,55:14.4,56:14.5,57:14.6,58:14.7,59:14.8,60:14.9,61:15,62:15.1,63:15.2,64:15.3,65:15.4,66:15.5,67:15.6,68:15.7,69:15.8,70:15.9,71:16,72:16.1,73:16.2,74:16.3,75:16.4,76:16.5,77:16.6,78:16.6,79:16.7,80:16.8,81:16.9,82:17,83:17,84:17.1,85:17.2,86:17.2,87:17.3,88:17.4,89:17.4,90:17.5,91:17.6,92:17.6,93:17.7,94:17.8,95:17.8,96:17.9},b={12:8.5,13:8.6,14:8.8,15:9,16:9.2,17:9.4,18:9.5,19:9.7,20:9.9,21:10,22:10.2,23:10.4,24:10.5,25:10.7,26:10.8,27:11,28:11.2,29:11.3,30:11.5,31:11.6,32:11.8,33:11.9,34:12.1,35:12.2,36:12.4,37:12.5,38:12.7,39:12.8,40:12.9,41:13.1,42:13.2,43:13.3,44:13.5,45:13.6,46:13.7,47:13.9,48:14,49:14.1,50:14.2,51:14.4,52:14.5,53:14.6,54:14.7,55:14.8,56:14.9,57:15.1,58:15.2,59:15.3,60:15.4,61:15.5,62:15.6,63:15.7,64:15.8,65:15.9,66:16,67:16.1,68:16.2,69:16.3,70:16.4,71:16.5,72:16.6,73:16.6,74:16.7,75:16.8,76:16.9,77:17,78:17.1,79:17.1,80:17.2,81:17.3,82:17.4,83:17.4,84:17.5,85:17.6,86:17.6,87:17.7,88:17.8,89:17.8,90:17.9,91:18,92:18,93:18.1,94:18.1,95:18.2,96:18.2},x={12:16.4,13:16.5,14:16.6,15:16.8,16:16.9,17:17,18:17.2,19:17.3,20:17.4,21:17.5,22:17.7,23:17.8,24:17.9,25:18,26:18.2,27:18.3,28:18.4,29:18.5,30:18.7,31:18.8,32:18.9,33:19,34:19.1,35:19.2,36:19.4,37:19.5,38:19.6,39:19.7,40:19.8,41:19.9,42:20,43:20.1,44:20.2,45:20.3,46:20.5,47:20.6,48:20.7,49:20.8,50:20.9,51:21,52:21.1,53:21.2,54:21.3,55:21.4,56:21.5,57:21.6,58:21.7,59:21.7,60:21.8,61:21.9,62:22,63:22.1,64:22.2,65:22.3,66:22.4,67:22.5,68:22.6,69:22.6,70:22.7,71:22.8,72:22.9,73:23,74:23.1,75:23.1,76:23.2,77:23.3,78:23.4,79:23.4,80:23.5,81:23.6,82:23.7,83:23.7,84:23.8,85:23.9,86:23.9,87:24,88:24.1,89:24.1,90:24.2,91:24.3,92:24.3,93:24.4,94:24.4,95:24.5,96:24.5},S={12:17.5,13:17.7,14:17.8,15:17.9,16:18.1,17:18.2,18:18.3,19:18.5,20:18.6,21:18.7,22:18.9,23:19,24:19.1,25:19.2,26:19.4,27:19.5,28:19.6,29:19.7,30:19.9,31:20,32:20.1,33:20.2,34:20.4,35:20.5,36:20.6,37:20.7,38:20.8,39:20.9,40:21,41:21.2,42:21.3,43:21.4,44:21.5,45:21.6,46:21.7,47:21.8,48:21.9,49:22,50:22.1,51:22.2,52:22.3,53:22.4,54:22.5,55:22.6,56:22.7,57:22.8,58:22.9,59:23,60:23.1,61:23.2,62:23.2,63:23.3,64:23.4,65:23.5,66:23.6,67:23.7,68:23.8,69:23.8,70:23.9,71:24,72:24.1,73:24.1,74:24.2,75:24.3,76:24.4,77:24.4,78:24.5,79:24.6,80:24.6,81:24.7,82:24.8,83:24.8,84:24.9,85:25,86:25,87:25.1,88:25.2,89:25.2,90:25.3,91:25.3,92:25.4,93:25.4,94:25.5,95:25.5,96:25.5},C={12:18.7,13:18.8,14:18.9,15:19.1,16:19.2,17:19.4,18:19.5,19:19.6,20:19.8,21:19.9,22:20.1,23:20.2,24:20.3,25:20.5,26:20.6,27:20.7,28:20.8,29:21,30:21.1,31:21.2,32:21.3,33:21.5,34:21.6,35:21.7,36:21.8,37:21.9,38:22.1,39:22.2,40:22.3,41:22.4,42:22.5,43:22.6,44:22.7,45:22.8,46:22.9,47:23,48:23.1,49:23.2,50:23.3,51:23.4,52:23.5,53:23.6,54:23.7,55:23.8,56:23.9,57:24,58:24.1,59:24.2,60:24.3,61:24.4,62:24.5,63:24.5,64:24.6,65:24.7,66:24.8,67:24.9,68:24.9,69:25,70:25.1,71:25.2,72:25.2,73:25.3,74:25.4,75:25.5,76:25.5,77:25.6,78:25.7,79:25.7,80:25.8,81:25.8,82:25.9,83:26,84:26,85:26.1,86:26.1,87:26.2,88:26.2,89:26.3,90:26.3,91:26.4,92:26.4,93:26.5,94:26.5,95:26.5,96:26.6},w={12:19.7,13:19.9,14:20,15:20.1,16:20.3,17:20.4,18:20.6,19:20.7,20:20.8,21:21,22:21.1,23:21.2,24:21.4,25:21.5,26:21.6,27:21.7,28:21.9,29:22,30:22.1,31:22.2,32:22.3,33:22.4,34:22.6,35:22.7,36:22.8,37:22.9,38:23,39:23.1,40:23.2,41:23.3,42:23.4,43:23.5,44:23.6,45:23.7,46:23.8,47:23.9,48:24,49:24.1,50:24.2,51:24.3,52:24.4,53:24.5,54:24.6,55:24.7,56:24.7,57:24.8,58:24.9,59:25,60:25.1,61:25.2,62:25.2,63:25.3,64:25.4,65:25.5,66:25.5,67:25.6,68:25.7,69:25.7,70:25.8,71:25.9,72:25.9,73:26,74:26,75:26.1,76:26.2,77:26.2,78:26.3,79:26.3,80:26.4,81:26.4,82:26.5,83:26.5,84:26.6,85:26.6,86:26.7,87:26.7,88:26.7,89:26.8,90:26.8,91:26.9,92:26.9,93:26.9,94:27,95:27,96:27},T={12:14.6,13:14.8,14:14.9,15:15,16:15.1,17:15.3,18:15.4,19:15.5,20:15.6,21:15.8,22:15.9,23:16,24:16.1,25:16.2,26:16.3,27:16.4,28:16.5,29:16.6,30:16.8,31:16.9,32:17,33:17.1,34:17.2,35:17.3,36:17.4,37:17.5,38:17.6,39:17.7,40:17.7,41:17.8,42:17.9,43:18,44:18.1,45:18.2,46:18.3,47:18.4,48:18.5,49:18.5,50:18.6,51:18.7,52:18.8,53:18.9,54:18.9,55:19,56:19.1,57:19.2,58:19.2,59:19.3,60:19.4,61:19.4,62:19.5,63:19.6,64:19.6,65:19.7,66:19.8,67:19.8,68:19.9,69:19.9,70:20,71:20.1,72:20.1,73:20.2,74:20.2,75:20.3,76:20.3,77:20.4,78:20.4,79:20.5,80:20.5,81:20.6,82:20.6,83:20.6,84:20.7,85:20.7,86:20.8,87:20.8,88:20.8,89:20.9,90:20.9,91:20.9,92:21,93:21,94:21,95:21.1,96:21.1},ee={12:15.2,13:15.3,14:15.4,15:15.6,16:15.7,17:15.8,18:15.9,19:16.1,20:16.2,21:16.3,22:16.4,23:16.5,24:16.6,25:16.8,26:16.9,27:17,28:17.1,29:17.2,30:17.3,31:17.4,32:17.5,33:17.6,34:17.7,35:17.8,36:17.9,37:18,38:18.1,39:18.2,40:18.3,41:18.4,42:18.5,43:18.6,44:18.7,45:18.8,46:18.9,47:19,48:19.1,49:19.2,50:19.2,51:19.3,52:19.4,53:19.5,54:19.6,55:19.7,56:19.7,57:19.8,58:19.9,59:20,60:20.1,61:20.1,62:20.2,63:20.3,64:20.3,65:20.4,66:20.5,67:20.6,68:20.6,69:20.7,70:20.8,71:20.8,72:20.9,73:20.9,74:21,75:21.1,76:21.1,77:21.2,78:21.2,79:21.3,80:21.4,81:21.4,82:21.5,83:21.5,84:21.6,85:21.6,86:21.7,87:21.7,88:21.8,89:21.8,90:21.9,91:21.9,92:22,93:22,94:22,95:22.1,96:22.1},te={12:15.7,13:15.9,14:16,15:16.1,16:16.2,17:16.4,18:16.5,19:16.6,20:16.7,21:16.8,22:17,23:17.1,24:17.2,25:17.3,26:17.4,27:17.5,28:17.7,29:17.8,30:17.9,31:18,32:18.1,33:18.2,34:18.3,35:18.4,36:18.5,37:18.6,38:18.7,39:18.8,40:18.9,41:19,42:19.1,43:19.2,44:19.3,45:19.4,46:19.5,47:19.6,48:19.7,49:19.8,50:19.9,51:20,52:20.1,53:20.1,54:20.2,55:20.3,56:20.4,57:20.5,58:20.6,59:20.7,60:20.7,61:20.8,62:20.9,63:21,64:21.1,65:21.1,66:21.2,67:21.3,68:21.4,69:21.4,70:21.5,71:21.6,72:21.7,73:21.7,74:21.8,75:21.9,76:21.9,77:22,78:22.1,79:22.1,80:22.2,81:22.3,82:22.3,83:22.4,84:22.5,85:22.5,86:22.6,87:22.6,88:22.7,89:22.8,90:22.8,91:22.9,92:22.9,93:23,94:23,95:23.1,96:23.1},ne={12:16.3,13:16.4,14:16.5,15:16.6,16:16.7,17:16.9,18:17,19:17.1,20:17.2,21:17.3,22:17.4,23:17.6,24:17.7,25:17.8,26:17.9,27:18,28:18.1,29:18.2,30:18.3,31:18.4,32:18.5,33:18.7,34:18.8,35:18.9,36:19,37:19.1,38:19.2,39:19.3,40:19.4,41:19.5,42:19.6,43:19.7,44:19.8,45:19.9,46:19.9,47:20,48:20.1,49:20.2,50:20.3,51:20.4,52:20.5,53:20.6,54:20.7,55:20.8,56:20.8,57:20.9,58:21,59:21.1,60:21.2,61:21.3,62:21.3,63:21.4,64:21.5,65:21.6,66:21.7,67:21.7,68:21.8,69:21.9,70:22,71:22,72:22.1,73:22.2,74:22.2,75:22.3,76:22.4,77:22.5,78:22.5,79:22.6,80:22.7,81:22.7,82:22.8,83:22.8,84:22.9,85:23,86:23,87:23.1,88:23.1,89:23.2,90:23.3,91:23.3,92:23.4,93:23.4,94:23.5,95:23.5,96:23.5};function E(e,t){let n=Object.keys(e).map(Number).sort((e,t)=>e-t);if(t<=n[0])return e[n[0]];if(t>=n[n.length-1])return e[n[n.length-1]];for(let r=0;r=n[r]&&t<=n[r+1]){let i=(t-n[r])/(n[r+1]-n[r]);return e[n[r]]+i*(e[n[r+1]]-e[n[r]])}return e[n[0]]}function re(e,t){let n=E(u.p95,e),r=E(u.p75,e),i=E(u.p40,e),a;return a=t>=n?`High-Risk`:t>=r?`High-Intermediate`:t>=i?`Low-Intermediate`:`Low-Risk`,{p95:n,p75:r,p40:i,zone:a}}function ie(e,t){return t===`medium`?e===35?_:e===36?v:e===37?y:b:e===35?d:e===36?f:e===37?p:e===38?m:e===39?h:g}function ae(e,t){return t===`medium`?e===35?T:e===36?ee:e===37?te:ne:e===35?x:e===36?S:e===37?C:w}function D(e,t,n,r){let i=E(ie(e,r),t),a=E(ae(e,r),t),o;return o=n>=a?`Above Exchange`:n>=i?`Above Phototherapy`:`Below Phototherapy`,{photoThreshold:i,exchangeThreshold:a,status:o}}var O={male:{24:{L:-1.982374,M:16.5478,S:.080127},30:{L:-1.642107,M:16.2497,S:.075499},36:{L:-1.419991,M:16.0003,S:.072634},42:{L:-1.438165,M:15.7941,S:.071495},48:{L:-1.714869,M:15.6282,S:.071889},54:{L:-2.155348,M:15.5026,S:.073491},60:{L:-2.615166,M:15.4191,S:.075992},66:{L:-2.981797,M:15.3795,S:.079211},72:{L:-3.211705,M:15.3835,S:.083048},78:{L:-3.314769,M:15.429,S:.0874},84:{L:-3.323189,M:15.5129,S:.092131},90:{L:-3.270455,M:15.6317,S:.097082},96:{L:-3.183058,M:15.7823,S:.102091},102:{L:-3.079383,M:15.9617,S:.107013},108:{L:-2.971148,M:16.1671,S:.111721},114:{L:-2.865311,M:16.3961,S:.116113},120:{L:-2.765648,M:16.6461,S:.120112},126:{L:-2.673903,M:16.9151,S:.123664},132:{L:-2.59056,M:17.2009,S:.126735},138:{L:-2.51532,M:17.5014,S:.129309},144:{L:-2.447426,M:17.8146,S:.131389},150:{L:-2.385858,M:18.1387,S:.132991},156:{L:-2.329457,M:18.4718,S:.134141},162:{L:-2.277017,M:18.812,S:.13488},168:{L:-2.227362,M:19.1576,S:.135251},174:{L:-2.179426,M:19.5067,S:.135309},180:{L:-2.132345,M:19.8577,S:.13511},186:{L:-2.085574,M:20.2086,S:.134718},192:{L:-2.039015,M:20.5576,S:.134198},198:{L:-1.99315,M:20.9029,S:.13362},204:{L:-1.949135,M:21.2425,S:.133057},210:{L:-1.908831,M:21.5742,S:.132585},216:{L:-1.87467,M:21.8959,S:.132286},222:{L:-1.849323,M:22.2054,S:.132249},228:{L:-1.835138,M:22.5007,S:.132566},234:{L:-1.833401,M:22.7799,S:.133339},240:{L:-1.843581,M:23.0414,S:.134675}},female:{24:{L:-1.024497,M:16.388,S:.085026},30:{L:-1.534542,M:16.0059,S:.080932},36:{L:-2.096829,M:15.6992,S:.078605},42:{L:-2.618733,M:15.4647,S:.077904},48:{L:-3.018522,M:15.2985,S:.078713},54:{L:-3.2593,M:15.1961,S:.080904},60:{L:-3.350078,M:15.1519,S:.0843},66:{L:-3.325522,M:15.1606,S:.08868},72:{L:-3.225607,M:15.2169,S:.093803},78:{L:-3.084291,M:15.3161,S:.099427},84:{L:-2.926187,M:15.4536,S:.105325},90:{L:-2.76731,M:15.6252,S:.111295},96:{L:-2.617192,M:15.827,S:.117159},102:{L:-2.480952,M:16.0552,S:.122771},108:{L:-2.360921,M:16.3061,S:.128014},114:{L:-2.257782,M:16.5763,S:.132797},120:{L:-2.171296,M:16.8623,S:.137057},126:{L:-2.100749,M:17.161,S:.140754},132:{L:-2.045235,M:17.4691,S:.143868},138:{L:-2.003802,M:17.7836,S:.146399},144:{L:-1.975521,M:18.1015,S:.148361},150:{L:-1.95952,M:18.42,S:.149783},156:{L:-1.954978,M:18.7364,S:.150705},162:{L:-1.9611,M:19.0481,S:.151176},168:{L:-1.977074,M:19.3526,S:.151256},174:{L:-2.002014,M:19.6475,S:.15101},180:{L:-2.034893,M:19.9306,S:.150512},186:{L:-2.07446,M:20.1998,S:.149843},192:{L:-2.119157,M:20.4533,S:.14909},198:{L:-2.167045,M:20.6891,S:.148349},204:{L:-2.215738,M:20.9058,S:.147723},210:{L:-2.262382,M:21.1016,S:.147323},216:{L:-2.303688,M:21.2753,S:.147269},222:{L:-2.336038,M:21.4255,S:.147689},228:{L:-2.355678,M:21.5508,S:.148724},234:{L:-2.35898,M:21.6501,S:.150521},240:{L:-2.342797,M:21.7219,S:.153241}}};function k(e){let t=e<0?-1:1,n=Math.abs(e)/Math.sqrt(2),r=1/(1+.3275911*n);return .5*(1+t*(1-((((1.061405429*r+-1.453152027)*r+1.421413741)*r+-.284496736)*r+.254829592)*r*Math.exp(-n*n)))}function oe(e,t,n,r){let i;i=Math.abs(t)<.001?Math.log(e/n)/r:((e/n)**+t-1)/(t*r);let a=k(i);return{z:i,percentile:Math.round(a*1e4)/100}}function se(e,t,n){let r=1.645,i=Math.abs(n.L)<.001?n.M*Math.exp(n.S*r):n.M*(1+n.L*n.S*r)**(1/n.L),a=t/i*100;return e>=95?a>=140?{label:`Class 3 Severe Obesity`,color:`#7f1d1d`,bg:`#fecaca`,pctOf95:a,bmi95:i}:a>=120?{label:`Class 2 Severe Obesity`,color:`#dc2626`,bg:`#fee2e2`,pctOf95:a,bmi95:i}:{label:`Obese (Class 1)`,color:`#ef4444`,bg:`#fee2e2`,pctOf95:a,bmi95:i}:e>=85?{label:`Overweight`,color:`#f97316`,bg:`#ffedd5`,pctOf95:a,bmi95:i}:e>=5?{label:`Healthy Weight`,color:`#10b981`,bg:`#d1fae5`,pctOf95:a,bmi95:i}:{label:`Underweight`,color:`#f59e0b`,bg:`#fef3c7`,pctOf95:a,bmi95:i}}function ce(e,t,n,r){let i=e/(t/100)**2,a=Math.max(24,Math.min(240,n)),s=o(O[r],a),{z:c,percentile:l}=oe(i,s.L,s.M,s.S),u=se(l,i,s);return{bmi:i,z:c,percentile:l,L:s.L,M:s.M,S:s.S,classification:u}}var le=[1.07244896,1.051272912,1.041951175,1.012592236,.970541909,.921129988,.868221392,.81454413,.761957977,.711660228,.664323379,.620285102,.57955631,.54198094,.511429832,.482799937,.455521041,.429150288,.403351725,.377878239,.352555862,.327270297,.301955463,.276583851,.251158446,.225705996,.20027145,.174913356,.149700081,.12470671,.100012514,.075698881,.051847635,.02853967,.005853853,-.016133871,-.037351181,-.057729947,-.077206672,-.09572283,-.113225128,-.129665689,-.145002179,-.159197885,-.172221748,-.184048358,-.194660215,-.204030559,-.212174408,-.219069129,-.224722166,-.229140412,-.232335686,-.234324563,-.235128195,-.234772114,-.233286033,-.230703633,-.227062344,-.222403111,-.216770161,-.210210748,-.202774891,-.194515104,-.185486099,-.175744476,-.165348396,-.15435722,-.142831123,-.130830669,-.118416354,-.105648092,-.092584657,-.079283065,-.065797888,-.0521805,-.03847825,-.024733545,-.010982868,.002744306,.016426655,.030052231,.043619747,.05713988,.070636605,.08414848,.097729873,.111452039,.125404005,.13969316,.154445482,.169805275,.185934346,.203010488,.2212252,.240780542,.261885086,.284748919,.309577733,.336566048,.365889711,.397699038,.432104409,.46917993,.508943272,.551354277,.596307363,.643626542,.693062173,.744289752,.79691098,.85045728,.904395871,.958138449,1.011054559,1.062474568,1.111727029,1.158135105,1.201050821,1.239852328,1.274006058,1.303044695,1.326605954,1.344443447,1.356437773,1.362602695,1.363085725,1.358162799,1.348227142,1.333772923,1.315374704,1.293664024,1.269304678,1.242968236,1.21531127,1.186955477,1.158471522,1.130367088,1.103079209,1.076970655,1.052329922,1.029374161,1.008254396,.989062282,.971837799,.95657215,.94324228,.931767062,.922058291,.914012643,.907516917,.902452436,.898698641,.896143482,.894659668,.89413892,.894475371,.895569834,.897330209,.899671635,.902516442,.905793969,.909440266,.913397733,.91761471,.922045055,.926647697,.931386217,.93622842,.941145943,.94611388,.95111043,.956116576,.961115792,.966093766,.971038162,.975938391,.980785418,.985571579,.99029042,.994936555,.999505539,1.003993753,1.0083983,1.012716921,1.016947912,1.021090055,1.025142554,1.029104983,1.032977233,1.036759475,1.040452117,1.044055774,1.047571238,1.050999451,1.054341482,1.057598512,1.060771808,1.063862715,1.066872639,1.069803036,1.072655401,1.075431258,1.078132156,1.080759655,1.083315329,1.085800751,1.088217496,1.090567133,1.092851222,1.095071313,1.097228939,1.099325619,1.101362852,1.103342119,1.105264876,1.107132561,1.108046193],ue=[84.97555512,85.3973169,86.29026318,87.15714182,87.9960184,88.8055115,89.58476689,90.33341722,91.0515436,91.7396352,92.39854429,93.02945392,93.63382278,94.21335709,94.79643239,95.37391918,95.94692677,96.51644912,97.08337211,97.6484807,98.21246579,98.77593069,99.33939735,99.9033122,100.4680516,101.033927,101.6011898,102.1700358,102.7406094,103.3130077,103.8872839,104.4634511,105.0414853,105.6213287,106.2028921,106.7860583,107.3706841,107.9566031,108.5436278,109.1315521,109.7201531,110.3091934,110.8984228,111.4875806,112.0763967,112.6645943,113.2518902,113.8380006,114.4226317,115.0054978,115.5863089,116.1647782,116.7406221,117.3135622,117.8833259,118.4496481,119.0122722,119.5709513,120.1254495,120.6755427,121.22102,121.7616844,122.2973542,122.827864,123.3530652,123.8728276,124.38704,124.8956114,125.398472,125.895574,126.3868929,126.8724284,127.3522056,127.8262759,128.2947187,128.757642,129.2151839,129.6675143,130.1148354,130.5573839,130.995432,131.4292887,131.8593015,132.2858574,132.7093845,133.1303527,133.5492749,133.9667073,134.3832499,134.7995463,135.2162826,135.634186,136.0540223,136.4765925,136.9027281,137.3332846,137.7691339,138.2111552,138.6602228,139.1171933,139.5828898,140.0580848,140.5434787,141.0396832,141.5471945,142.0663731,142.59742,143.1403553,143.6949981,144.2609497,144.8375809,145.4240246,146.0191748,146.621692,147.2300177,147.8423918,148.4568879,149.0714413,149.6838943,150.2920328,150.8936469,151.4865636,152.0686985,152.6380955,153.1929631,153.7317031,154.2529332,154.755501,155.2384904,155.7012216,156.1432438,156.564323,156.9644258,157.3436995,157.7024507,158.0411233,158.3602756,158.6605588,158.9426964,159.2074654,159.455679,159.688172,159.9057871,160.1093647,160.299733,160.4776996,160.6440526,160.7995428,160.9448916,161.0807857,161.2078755,161.3267744,161.4380593,161.5422726,161.639917,161.7314645,161.8173534,161.8979913,161.9737558,162.0449969,162.1120386,162.17518,162.2346979,162.2908474,162.343864,162.3939652,162.4413513,162.4862071,162.5287029,162.5689958,162.6072309,162.6435418,162.6780519,162.7108751,162.7421168,162.7718741,162.8002371,162.8272889,162.8531067,162.8777619,162.9013208,162.9238449,162.9453912,162.9660131,162.9857599,163.0046776,163.0228094,163.0401953,163.0568727,163.0728768,163.0882404,163.1029943,163.1171673,163.1307866,163.1438776,163.1564644,163.1685697,163.1802146,163.1914194,163.202203,163.2125835,163.2225779,163.2322024,163.2414722,163.2504019,163.2590052,163.2672954,163.2752848,163.2829854,163.2904086,163.297565,163.304465,163.3111185,163.3175349,163.3237231,163.3296918,163.3354491,163.338251],de=[.040791394,.040859727,.041142161,.041349399,.041500428,.041610508,.041691761,.04175368,.041803562,.041846882,.041887626,.041928568,.041971514,.042017509,.042104522,.042199507,.042300333,.042405225,.042512706,.042621565,.042730809,.042839638,.042947412,.043053626,.043157889,.043259907,.043359463,.043456406,.043550638,.043642107,.043730791,.043816701,.043899867,.043980337,.044058171,.04413344,.044206218,.044276588,.044344632,.044410436,.044474084,.044535662,.044595254,.044652942,.044708809,.044762936,.044815402,.044866288,.044915672,.044963636,.045010259,.045055624,.045099817,.045142924,.045185036,.045226249,.045266662,.045306383,.045345524,.045384203,.045422551,.045460702,.045498803,.045537012,.045575495,.045614432,.045654016,.04569445,.045735953,.045778759,.045823114,.04586928,.045917535,.045968169,.04602149,.046077818,.046137487,.046200842,.04626824,.046340046,.046416629,.046498361,.046585611,.046678741,.046778099,.04688401,.046996769,.047116633,.047243801,.047378413,.047520521,.047670085,.047826946,.04799081,.048161228,.04833757,.048519011,.048704503,.048892759,.049082239,.049271137,.049457371,.049638596,.049812203,.049975355,.050125012,.050257992,.050371024,.050460835,.050524236,.050558224,.050560083,.050527494,.050458634,.050352269,.050207825,.050025434,.049805967,.049551023,.049262895,.048944504,.048599314,.048231224,.047844442,.047443362,.04703243,.046616026,.046198356,.04578335,.045374597,.044975281,.044588148,.044215488,.043859135,.04352048,.043200497,.042899776,.042618565,.042356812,.042114211,.041890247,.04168424,.041495379,.041322765,.041165437,.041022401,.040892651,.040775193,.040669052,.040573288,.040487005,.040409354,.040339537,.040276811,.040220488,.040169932,.040124562,.040083845,.040047295,.040014473,.03998498,.039958458,.039934584,.039913066,.039893644,.039876087,.039860185,.039845754,.039832629,.039820663,.039809725,.0397997,.039790485,.039781991,.039774136,.03976685,.03976007,.039753741,.039747815,.039742249,.039737004,.039732048,.039727352,.03972289,.03971864,.039714581,.039710697,.039706971,.039703391,.039699945,.039696623,.039693415,.039690313,.039687311,.039684402,.039681581,.039678842,.039676182,.039673596,.039671082,.039668635,.039666254,.039663936,.039661679,.039659481,.039657339,.039655252,.039653218,.039651237,.039649306,.039647424,.039645591,.039643804,.039642063,.039640367,.039638715,.039637105,.039636316],A=[.941523967,1.00720807,.837251351,.681492975,.538779654,.407697153,.286762453,.174489485,.069444521,-.029720564,-.124251789,-.215288396,-.30385434,-.390918369,-.254801167,-.125654535,-.00316735,.11291221,.222754969,.326530126,.42436156,.516353108,.602595306,.683170764,.758158406,.827636736,.891686306,.95039153,1.003830006,1.05213569,1.0953669,1.133652119,1.167104213,1.195845353,1.220004233,1.239715856,1.255121285,1.266367398,1.273606657,1.276996893,1.276701119,1.272887366,1.265728536,1.255402281,1.242090871,1.225981067,1.207263978,1.186140222,1.162796198,1.137442868,1.110286487,1.081536236,1.05140374,1.020102497,.987847213,.954853043,.921334742,.887505723,.85357703,.819756239,.786246296,.753244292,.720940222,.689515708,.659142731,.629997853,.602203984,.575908038,.55123134,.528279901,.507143576,.487895344,.470590753,.455267507,.441945241,.430625458,.421291648,.413909588,.408427813,.404778262,.402877077,.402625561,.40391127,.406609232,.410583274,.415687443,.421767514,.428662551,.436206531,.44423,.45256176,.461030578,.469466904,.477704608,.48558272,.492947182,.499652617,.505564115,.510559047,.514528903,.517381177,.519041285,.519454524,.518588072,.516433004,.513006312,.508352901,.502547502,.495696454,.487939275,.479449924,.470437652,.461147305,.451858946,.442886661,.434576385,.427302633,.421464027,.417477538,.415771438,.416777012,.420919142,.428606007,.440218167,.456097443,.476536014,.501766234,.531951655,.567179725,.607456565,.652704121,.702759868,.757379106,.816239713,.878947416,.945053486,1.014046108,1.085383319,1.158487278,1.232768816,1.307628899,1.382473225,1.456720479,1.529810247,1.601219573,1.670433444,1.736995571,1.800483802,1.860518777,1.916765525,1.968934444,2.016781776,2.060109658,2.098765817,2.132642948,2.16167779,2.185849904,2.205180153,2.219728869,2.2295937,2.234907144,2.235833767,2.232567138,2.2253265,2.214353232,2.199905902,2.182262864,2.161704969,2.138524662,2.113023423,2.085490286,2.0562195,2.025496648,1.993598182,1.960789092,1.927320937,1.89343024,1.859337259,1.825245107,1.791339209,1.757787065,1.724738292,1.692324905,1.660661815,1.629847495,1.599964788,1.571081817,1.543252982,1.516519998,1.490912963,1.466451429,1.44314546,1.420996665,1.399999187,1.380140651,1.361403047,1.343763564,1.327195355,1.311668242,1.297149359,1.283603728,1.270994782,1.25928483,1.248435461,1.23840791,1.229163362,1.220663228,1.212869374,1.20574431,1.199251356,1.19335477,1.188019859,1.183213059,1.178901998,1.175055543,1.171643828,1.16863827,1.167279219],j=[86.45220101,86.86160934,87.65247282,88.42326434,89.17549228,89.91040853,90.62907762,91.33242379,92.02127167,92.69637946,93.35846546,94.00822923,94.64636981,95.27359106,95.91474929,96.54734328,97.17191309,97.78897727,98.3990283,99.00254338,99.599977,100.191764,100.7783198,101.3600411,101.9373058,102.5104735,103.0798852,103.645864,104.208713,104.7687256,105.3261638,105.8812823,106.4343146,106.9854769,107.534968,108.0829695,108.6296457,109.1751441,109.7195954,110.2631136,110.8057967,111.3477265,111.8889694,112.4295761,112.9695827,113.5090108,114.0478678,114.5861486,115.1238315,115.6608862,116.1972691,116.732925,117.2677879,117.8017819,118.3348215,118.8668123,119.397652,119.9272309,120.455433,120.9821362,121.5072136,122.0305342,122.5519634,123.0713645,123.588599,124.1035312,124.6160161,125.1259182,125.6331012,126.1374319,126.6387804,127.1370217,127.6320362,128.1237104,128.6119383,129.096622,129.5776723,130.0550101,130.5285669,130.9982857,131.4641218,131.9260439,132.3840348,132.838092,133.2882291,133.7344759,134.1768801,134.6155076,135.0504433,135.4817925,135.9096813,136.3342577,136.7556923,137.1741794,137.5899378,138.0032114,138.4142703,138.8234114,139.2309592,139.6372663,140.042714,140.4477127,140.8527022,141.2581515,141.6645592,142.072452,142.4823852,142.8949403,143.3107241,143.7303663,144.1545167,144.5838414,145.0190192,145.4607359,145.9096784,146.3665278,146.8319513,147.3065929,147.7910635,148.2859294,148.7917006,149.3088178,149.8376391,150.3784267,150.9313331,151.4963887,152.0734897,152.6623878,153.2626819,153.8738124,154.495058,155.1255365,155.7642086,156.4098858,157.0612415,157.7168289,158.3750929,159.034399,159.6930501,160.3493168,161.0014586,161.6477515,162.2865119,162.9161202,163.535045,164.1418486,164.7352199,165.3139755,165.8770715,166.4236087,166.9528354,167.4641466,167.9570814,168.4313175,168.8866644,169.3230548,169.7405351,170.139255,170.5194567,170.881464,171.2256717,171.5525345,171.8625576,172.1562865,172.4342983,172.6971935,172.9455898,173.180112,173.4013896,173.6100518,173.8067179,173.9919998,174.1664951,174.3307855,174.4854344,174.6309856,174.7679617,174.8968634,175.0181691,175.1323345,175.2397926,175.340954,175.4362071,175.5259191,175.6104358,175.690083,175.7651671,175.8359757,175.9027788,175.9658293,176.0253641,176.081605,176.1347593,176.1850208,176.2325707,176.2775781,176.3202008,176.3605864,176.3988725,176.4351874,176.469651,176.5023751,176.533464,176.5630153,176.5911197,176.6178621,176.6433219,176.6675729,176.6906844,176.712721,176.733743,176.753807,176.7729657,176.7912687,176.8087622,176.8254895,176.8414914,176.8492322],fe=[.040321528,.040395626,.040577525,.040723122,.040833194,.040909059,.040952433,.04096533,.040949976,.040908737,.040844062,.040758431,.040654312,.04053412,.040572876,.04061691,.040666414,.040721467,.040782045,.040848042,.040919281,.040995524,.041076485,.041161838,.041251224,.041344257,.041440534,.041539635,.041641136,.041744602,.041849607,.041955723,.042062532,.042169628,.042276619,.042383129,.042488804,.042593311,.042696342,.042797615,.042896877,.042993904,.043088503,.043180513,.043269806,.043356287,.043439893,.043520597,.043598407,.043673359,.043745523,.043815003,.043881929,.043946461,.044008785,.044069112,.044127675,.044184725,.044240532,.044295379,.044349559,.044403374,.04445713,.044511135,.044565693,.044621104,.044677662,.044735646,.044795322,.044856941,.04492073,.044986899,.045055632,.045127088,.045201399,.045278671,.045358979,.045442372,.045528869,.045618459,.045711105,.045806742,.045905281,.046006604,.046110573,.046217028,.04632579,.046436662,.04654943,.046663871,.046779748,.046896817,.047014827,.047133525,.047252654,.047371961,.047491194,.047610108,.047728463,.04784603,.047962592,.048077942,.048191889,.048304259,.048414893,.048523648,.048630402,.04873505,.048837504,.048937694,.049035564,.049131073,.049224189,.049314887,.049403145,.049488934,.049572216,.049652935,.049731004,.0498063,.04987865,.049947823,.050013518,.050075353,.050132858,.050185471,.050232532,.050273285,.050306885,.050332406,.05034886,.050355216,.050350423,.050333444,.050303283,.050259018,.050199837,.050125062,.05003418,.049926861,.049802977,.04966261,.049506051,.049333801,.049146553,.04894519,.048730749,.048504404,.048267442,.04802123,.047767192,.047506783,.047241456,.04697265,.046701759,.046430122,.046159004,.045889585,.045622955,.045360101,.045101913,.044849174,.044602566,.044362674,.044129985,.043904897,.043687723,.043478698,.043277987,.043085685,.042901835,.042726424,.042559396,.042400652,.042250063,.042107465,.041972676,.041845488,.041725679,.041613015,.041507249,.041408129,.041315398,.041228796,.04114806,.041072931,.04100315,.040938463,.040878617,.040823368,.040772475,.040725706,.040682834,.04064364,.040607913,.040575448,.040546051,.040519532,.040495713,.040474421,.040455493,.040438773,.040424111,.040411366,.040400405,.040391101,.040383334,.04037699,.040371962,.040368149,.040365456,.040363795,.04036308,.040363233,.040364179,.04036585,.04036818,.040369574],pe=[[-7.4855,-1.2252,1.2643,-6.8797,20.4744,.7114,-.0066,-.0667,.3564,-.0012,.5278,-.6927,.1388],[8.4462,-.9598,.9046,-5.1098,15.1548,.5919,-.0029,-.065,.2495,-.003,.4421,-.5724,.0997],[26.6223,-1.1479,1.2134,-8.4665,28.0408,.475,1e-4,-.0643,.2062,-.023,.5561,-.7467,.185],[31.8947,-.867,1.1693,-8.2932,26.0849,.4251,-2e-4,-.0535,.1718,-.008,.3954,-.5402,.1473],[30.9472,-1.1288,1.5926,-11.7371,34.5934,.4578,-.0019,-.0341,.1144,-.0167,.6897,-1.0025,.3867],[23.152,-1.1368,1.751,-13.8556,41.2104,.527,-.0048,-.0149,.0623,.0062,.4347,-.6509,.2798],[19.3036,-.923,1.6566,-14.2294,42.9522,.5494,-.0062,-.0051,.0555,.0242,.1295,-.1986,.0876],[20.0191,-1.0378,1.6928,-13.6476,40.8615,.5596,-.0071,.0146,-.03,.0135,.1632,-.2423,.1013],[21.6515,-.9745,1.5964,-13.0096,38.8309,.5462,-.0063,.0087,-.0183,.0093,.2644,-.3848,.1477],[22.6952,-.8665,1.4799,-11.8203,34.2277,.537,-.0066,.0176,-.0648,.0046,.3226,-.4689,.1811],[23.1615,-.8132,1.4422,-11.8893,34.8542,.5329,-.0063,.013,-.0367,.008,.34,-.5072,.2171],[27.9,-.8288,1.4257,-11.5803,33.7393,.4995,-.0049,.0013,.0117,-.0014,.4954,-.7333,.3051],[34.8678,-.801,1.429,-11.2835,32.3656,.4469,-.0037,-.0037,.0274,-4e-4,.3936,-.5873,.251],[37.7557,-.9638,1.5603,-11.545,31.5671,.4392,-.0035,.0024,-.0164,-.0087,.395,-.575,.2238],[39.9509,-1.0185,1.6189,-11.6485,31.009,.4284,-.0032,.0051,-.0452,-.0101,.3516,-.5073,.1906],[40.8576,-.9313,1.5386,-11.5031,31.8413,.418,-.0029,.0019,-.0291,-.0081,.3507,-.5094,.1968],[42.1455,-.9104,1.5356,-11.4411,31.5567,.4098,-.0029,.0038,-.0368,-.006,.2848,-.4155,.1642],[44.0009,-1.0103,1.6565,-11.8711,31.8672,.4038,-.0026,7e-4,-.0172,-.0017,.1877,-.2802,.1211],[42.9483,-.9479,1.6532,-12.4439,34.3937,.4097,-.0029,.0023,-.0231,-3e-4,.1892,-.2761,.1077],[43.4489,-.9355,1.5751,-11.4463,30.9525,.4076,-.0027,0,-.0199,.0013,.1619,-.2376,.0949],[42.0432,-.9668,1.5892,-11.2769,29.6658,.4235,-.003,9e-4,-.0194,.0051,.1181,-.1781,.0784],[43.3921,-.9251,1.5125,-10.669,27.8566,.4122,-.0025,-8e-4,-.0269,-3e-4,.178,-.2571,.0962],[43.1823,-.9153,1.5502,-11.2058,29.7148,.4154,-.0028,.0025,-.0386,.0053,.0679,-.0977,.0352],[43.5111,-.8427,1.4724,-10.8634,29.5168,.4107,-.0027,.0019,-.0416,-.0023,.1644,-.2282,.0711],[44.8115,-.9195,1.5496,-10.7815,27.8384,.4087,-.003,.012,-.0908,-.0063,.1451,-.1957,.053],[45.1153,-.8419,1.4685,-10.4821,27.7389,.404,-.003,.0148,-.1094,-.0047,.1524,-.2131,.0715],[45.0184,-.9109,1.4637,-9.8769,25.3956,.4124,-.0031,.0163,-.1196,-.0095,.2128,-.3015,.1084],[46.8396,-.9336,1.4913,-10.0409,25.5791,.4004,-.0025,.0087,-.0854,-.0083,.207,-.2945,.1065],[46.3627,-1.0691,1.6403,-10.8997,27.3749,.4156,-.003,.0128,-.0892,-.006,.1891,-.2783,.1168],[46.056,-1.0253,1.6174,-10.8914,27.6133,.4169,-.0032,.0134,-.0831,-.0015,.1168,-.1751,.0794],[45.8707,-1.0687,1.6929,-11.5282,29.3823,.4234,-.0035,.0189,-.1052,-.002,.0549,-.0766,.0279],[46.225,-1.0493,1.6305,-11.0002,28.295,.4212,-.0032,.015,-.0892,.001,.0192,-.0279,.014],[49.7043,-1.1168,1.6687,-10.6909,26.5418,.4005,-.0027,.0175,-.1166,-.0029,-.0064,.0124,-.0056],[52.501,-1.2283,1.7174,-10.288,24.6009,.39,-.0025,.0229,-.1413,-.0055,-.0773,.1151,-.0428],[52.638,-1.2668,1.7982,-10.7251,24.8323,.393,-.0027,.0233,-.1352,-.0037,-.1218,.1797,-.0678],[52.9451,-1.2987,1.8214,-10.8739,25.4383,.3952,-.0028,.0249,-.1365,-.0026,-.1753,.2588,-.1002],[51.6977,-1.2275,1.7723,-10.6355,24.5465,.4024,-.0032,.0273,-.1377,.0023,-.2334,.3428,-.1327],[51.5803,-1.1856,1.7323,-10.549,24.7169,.4027,-.0033,.029,-.1504,.004,-.2752,.4081,-.1658],[52.5542,-1.1951,1.7357,-10.3953,23.5706,.3978,-.0032,.0312,-.1661,5e-4,-.2249,.34,-.1482],[54.7146,-1.2604,1.8028,-10.773,24.4075,.3869,-.0029,.0332,-.1862,-.002,-.2181,.3306,-.1449],[56.735,-1.199,1.8011,-11.3328,26.8609,.3684,-.0025,.0319,-.1874,2e-4,-.2443,.3686,-.1611],[57.7385,-1.2515,1.8588,-11.3519,25.8098,.3657,-.0024,.0287,-.1704,-9e-4,-.2306,.3502,-.1567],[57.7098,-1.257,1.9037,-11.8077,27.0173,.3677,-.0024,.0271,-.1572,-.0012,-.1965,.298,-.1324],[58.0736,-1.2363,1.9353,-12.317,28.6066,.3643,-.0024,.0253,-.1507,.002,-.178,.2641,-.1092],[62.0223,-1.2128,1.9237,-12.157,27.903,.3343,-.0016,.0242,-.1555,-4e-4,-.21,.315,-.136],[62.1221,-1.1404,1.8555,-11.839,27.3698,.3308,-.0017,.026,-.1685,-.0024,-.1452,.2208,-.0993],[62.7962,-1.113,1.8421,-11.7266,26.7715,.3253,-.0016,.0282,-.1884,-.0019,-.1808,.2766,-.1276],[61.7073,-1.2183,1.9323,-12.0462,26.8742,.3435,-.0022,.0321,-.2009,-.0018,-.1943,.2958,-.1342],[61.7636,-1.1885,1.9597,-12.4946,27.9124,.342,-.0022,.0308,-.1956,.003,-.234,.3493,-.149],[63.7493,-1.2055,1.96,-12.5069,28.0089,.3283,-.0012,.0195,-.1595,-.002,-.1708,.2634,-.1258],[62.2586,-1.077,1.8646,-12.2702,27.8184,.3328,-.0012,.0137,-.1292,-.0024,-.0705,.1151,-.0646],[64.2911,-1.0805,1.8431,-11.8647,26.3816,.3191,-7e-4,.0088,-.1057,-.007,-.0325,.0621,-.0471],[68.9778,-1.2187,1.888,-11.2553,23.9127,.294,3e-4,.0053,-.0991,-.0123,-.0668,.1121,-.0648],[70.4806,-1.165,1.8218,-10.7395,22.4622,.2801,9e-4,1e-4,-.0853,-.0136,-.0702,.1225,-.0781],[70.6109,-1.1182,1.8262,-11.2854,24.8046,.2768,.001,-7e-4,-.084,-.01,-.1092,.1806,-.1041],[69.8975,-1.1611,1.8731,-11.7046,26.3452,.287,7e-4,.0018,-.0954,-.0067,-.1524,.2386,-.1185],[69.191,-1.1401,1.9015,-12.217,27.9129,.2928,3e-4,.0055,-.111,-.0035,-.2103,.3262,-.1586],[69.9619,-1.1195,1.8816,-11.9235,26.817,.2873,5e-4,.0046,-.1118,-.0053,-.1918,.3015,-.1525],[68.3161,-1.0128,1.7759,-11.6001,26.6764,.2951,3e-4,.0028,-.1008,-.0022,-.2321,.3639,-.1831],[68.0555,-.9162,1.6469,-10.7107,24.2868,.2927,6e-4,-.0014,-.0813,-4e-4,-.236,.3707,-.1882],[65.6124,-.7989,1.5036,-9.8072,21.9786,.3055,4e-4,-.0054,-.0567,-.0017,-.1403,.2328,-.1369],[65.1636,-.7707,1.457,-9.5828,21.8374,.3086,5e-4,-.0086,-.0391,-.0024,-.0941,.1647,-.109],[66.6766,-.913,1.5894,-9.8498,21.1477,.3073,8e-4,-.0116,-.029,-.0052,-.0645,.1189,-.0865],[65.4537,-.895,1.5329,-9.3616,19.7235,.3178,7e-4,-.0136,-.0176,-.0044,-.0173,.0444,-.0479],[64.8596,-.9404,1.6229,-9.8355,19.8054,.3274,2e-4,-.0077,-.0396,-.006,.0077,.0094,-.0359],[64.7808,-.935,1.5826,-9.392,18.2771,.3302,2e-4,-.0082,-.0324,-.009,.0629,-.0712,-.0032],[65.5762,-.9693,1.558,-8.833,16.6679,.3289,3e-4,-.009,-.0304,-.0092,.0526,-.0599,-.0011],[64.0451,-1.1203,1.7205,-9.4755,16.9051,.3537,-7e-4,.0019,-.0701,-.0041,-.1202,.1997,-.1156],[66.825,-1.1964,1.8333,-10.0226,17.9273,.3397,-6e-4,.0056,-.0822,-.0081,-.1245,.2047,-.1138],[65.6846,-1.2525,1.9018,-10.459,18.6882,.3537,-9e-4,.0036,-.066,-.0057,-.113,.1831,-.0985],[65.3052,-1.2617,1.9135,-10.5223,18.771,.3604,-.0013,.0085,-.0848,-.0046,-.1438,.2265,-.112],[64.899,-1.2245,1.8584,-10.1192,17.7416,.3641,-.0016,.0138,-.1073,-.0048,-.1372,.2161,-.1063],[65.3578,-1.2248,1.8289,-9.7674,16.8046,.3627,-.0014,.0124,-.1066,-.0057,-.1576,.2502,-.1263],[64.5514,-1.1783,1.7442,-9.4075,16.9106,.3687,-.0013,.0091,-.0924,-.0076,-.0787,.1365,-.0847],[66.0885,-1.1878,1.7936,-9.5264,16.3425,.3605,-.0016,.0179,-.1274,-.0072,-.185,.2994,-.1608],[67.302,-1.1912,1.725,-8.4639,12.8607,.3551,-.0016,.0212,-.1358,-.0076,-.2055,.3238,-.1601],[69.6151,-1.1726,1.7606,-8.9219,14.4437,.3387,-.0015,.026,-.1521,-.0094,-.1704,.2659,-.1257],[70.5901,-1.2426,1.8162,-8.921,13.7988,.3388,-.0016,.0283,-.1619,-.016,-.066,.1157,-.069],[74.0399,-1.3696,1.9736,-9.9705,16.4081,.322,-.001,.0261,-.1607,-.0211,.054,-.068,.017],[78.1837,-1.4118,1.9659,-9.2285,13.6521,.2962,-4e-4,.0279,-.176,-.0236,.0265,-.035,.0171],[77.8733,-1.5496,2.1217,-10.0164,15.085,.3117,-.0013,.041,-.234,-.0167,-.141,.2059,-.0717],[78.6258,-1.5819,2.1292,-10.2662,16.5876,.311,-.0011,.0374,-.2191,-.0181,-.0881,.1294,-.044],[78.1114,-1.6551,2.2258,-11.1197,18.7127,.3231,-.0016,.0421,-.2369,-.0174,-.0626,.0903,-.0264],[79.7562,-1.6836,2.2862,-11.9207,21.9312,.3146,-.0013,.038,-.2147,-.0164,-.0397,.0537,-.0083],[81.1825,-1.7413,2.3012,-11.7683,21.4169,.3106,-.0011,.0381,-.2099,-.0197,.0394,-.07,.0551],[82.4317,-1.7326,2.3369,-11.7377,20.8323,.3043,-.0014,.0468,-.2545,-.0145,-.1069,.1451,-.0329],[83.4279,-1.7479,2.3341,-12.1336,23.8773,.3009,-9e-4,.0394,-.2205,-.0159,-.0384,.039,.0189],[87.5318,-1.8801,2.4042,-11.8201,21.5,.2804,0,.0344,-.215,-.0208,-.0131,.0053,.0276],[91.5471,-1.9424,2.5247,-12.4507,21.7964,.2576,5e-4,.0374,-.2444,-.0294,-.0119,.0227,-.01],[92.4497,-1.8508,2.5523,-13.6421,26.226,.2495,0,.0494,-.305,-.0184,-.1813,.2673,-.1041],[92.8328,-1.7523,2.5128,-13.17,23.6191,.2436,5e-4,.0322,-.2188,-.0162,-.1657,.2435,-.0938],[100.346,-1.9852,2.7015,-12.334,16.8429,.2061,.0016,.0236,-.1616,-.0093,-.4796,.6954,-.2616],[106.8231,-1.8617,2.4704,-10.3756,11.994,.1537,.0038,.0071,-.1169,-.0192,-.4992,.7439,-.3113],[111.3953,-1.9833,2.5967,-11.4122,16.0199,.1324,.0046,.0068,-.1417,-.0242,-.6418,.9712,-.431],[117.6411,-2.0964,2.6981,-11.2572,13.4182,.0991,.0053,.0132,-.1836,-.0338,-.4799,.719,-.3037],[121.3735,-2.3828,2.9534,-12.2263,14.8292,.0974,.0055,.0085,-.1487,-.0205,-.6271,.9041,-.3313],[115.9126,-2.5317,3.2788,-15.2093,22.0287,.1601,.0028,.0231,-.181,6e-4,-.7258,1.0194,-.3341],[125.5877,-1.6743,2.6055,-13.4481,23.2621,.0405,.006,-9e-4,-.0707,.0296,-1.1873,1.6794,-.5743],[135.675,-1.8473,2.0605,-8.0487,16.9201,-.0112,.0136,-.0896,.1678,-.0337,.3359,-.5938,.4196]],me=[[36.3363,-.4513,-.2328,28.8499,-129.833,-.0182,7e-4,.0464,-.2691,-.0622,-.2979,.6276,-.5522],[30.6534,-1.0645,-.5369,30.836,-125.69,.1058,.0021,.039,-.2859,-.0568,-.8988,1.5116,-.9035],[46.6521,-.8427,-.8134,29.0051,-109.524,-.0091,.0049,.0484,-.379,-.0684,-.6066,1.0179,-.5945],[34.7995,-1.0943,-.5132,24.8976,-93.9462,.1143,6e-4,.0856,-.4757,-.03,-.9349,1.424,-.6362],[15.9095,-.3518,-.6484,19.5391,-72.0796,.2253,-.0045,.1041,-.5073,.007,-1.3455,2.0777,-.9953],[12.8878,-.0974,-1.0427,20.0319,-66.1203,.2379,-.002,.0402,-.2008,-.0112,-.4679,.7618,-.4226],[3.2759,-.1741,-.7763,16.2511,-53.8662,.3223,-.0044,.0485,-.2089,-.0061,-.2448,.4092,-.2385],[12.846,-.0649,-.8792,16.2183,-50.693,.2474,-.0022,.0311,-.123,-.0255,.239,-.3265,.1012],[12.8668,.1716,-1.0619,16.2814,-49.2028,.2361,-.002,.0293,-.1263,-.0322,.5303,-.7561,.2762],[9.112,.1408,-1.0811,16.1015,-48.0962,.2737,-.0032,.0416,-.1676,-.0278,.5837,-.8523,.3437],[11.7225,-.2667,-.674,14.1978,-45.5872,.284,-.0034,.0505,-.203,-.0368,.5673,-.8255,.3314],[19.5753,-.4609,-.4453,12.7133,-41.9359,.2384,-.002,.0503,-.2232,-.0503,.7475,-1.0987,.4581],[21.1297,-.7489,-.2784,12.1653,-40.6521,.2491,-.0015,.0462,-.2201,-.0415,.5736,-.8537,.3742],[17.5087,-.5589,-.5804,13.6135,-42.3595,.2699,-.0017,.0438,-.2286,-.0325,.5451,-.8138,.3581],[19.125,-.6931,-.358,11.3984,-35.5973,.2679,-9e-4,.0341,-.1992,-.0272,.3386,-.5034,.2204],[12.3312,-.7307,-.2314,9.1993,-27.9046,.3246,-.002,.0272,-.1474,-.0218,.4218,-.6267,.2695],[8.7933,-.5755,-.2574,8.5358,-26.1118,.3473,-.0031,.0313,-.1447,-.0249,.4514,-.6549,.2572],[6.8234,-.7262,-.0687,7.7821,-26.4927,.3781,-.0044,.0462,-.203,-.0214,.2612,-.3714,.1375],[6.5708,-.6226,-.1738,8.0763,-26.5849,.3759,-.0041,.0378,-.1688,-.0223,.3339,-.475,.1725],[12.4952,-.781,.0532,6.8239,-24.2698,.3431,-.0032,.0368,-.1732,-.0262,.1513,-.1909,.0331],[16.8254,-.4175,-.2206,7.4894,-23.9702,.2885,-.0021,.0295,-.1608,-.0154,-.0241,.0763,-.095],[17.8811,-.4367,-.1266,7.0389,-24.15,.2868,-.0028,.0392,-.1928,-.0081,-.278,.4577,-.2641],[16.5734,-.2666,-.2542,7.0108,-22.3832,.2899,-.0032,.0387,-.1806,-.0041,-.2653,.436,-.2519],[19.9011,-.2317,-.3427,7.6601,-23.4789,.2636,-.002,.0303,-.1519,-.0146,-.0788,.162,-.1394],[21.7218,-.2625,-.2345,6.6903,-20.9185,.2553,-.0023,.0347,-.1547,-.023,.0302,.0052,-.0801],[21.9955,-.4947,-.0505,6.3827,-21.7936,.2719,-.0028,.0392,-.1593,-.0334,.1394,-.1536,-.0152],[25.2014,-.5716,.0877,5.7268,-21.1119,.2566,-.0032,.0512,-.2028,-.0358,.0855,-.0747,-.0456],[24.9355,-.6578,.231,4.6551,-18.8514,.2671,-.0039,.0592,-.2224,-.0268,-.0489,.114,-.1096],[23.5259,-.5069,.1119,4.7744,-18.0734,.2698,-.004,.0557,-.2087,-.0263,.0265,.0098,-.0803],[22.6538,-.3685,-.0683,5.5225,-18.8175,.2682,-.0033,.0439,-.1629,-.0299,.2232,-.2808,.039],[25.1343,-.4732,.0854,3.9605,-13.912,.2571,-.0028,.0398,-.1488,-.038,.4146,-.5644,.1571],[26.0776,-.4748,.0973,4.2405,-15.6978,.2526,-.0028,.0409,-.1485,-.0398,.4214,-.5758,.1652],[27.7828,-.4017,.07,4.258,-15.4754,.2367,-.0027,.0432,-.1635,-.035,.3149,-.4222,.1074],[33.321,-.5491,.2782,3.9722,-17.4641,.2081,-.0028,.0559,-.2079,-.0453,.3091,-.4165,.114],[34.8309,-.6942,.426,3.3318,-16.8497,.2081,-.003,.0647,-.2508,-.0416,.1445,-.1779,.0236],[37.5926,-.6443,.3677,3.4067,-16.42,.1823,-.0015,.0474,-.1947,-.0411,.2234,-.2936,.0668],[39.4412,-.5625,.2263,4.2984,-18.3087,.1635,-3e-4,.0348,-.1585,-.0452,.3142,-.4246,.1158],[40.6765,-.6234,.3141,3.8208,-17.9457,.1599,-2e-4,.0372,-.1782,-.041,.1452,-.1684,-.0017],[38.5263,-.6294,.3817,3.0897,-16.2418,.1784,-7e-4,.0354,-.1608,-.0439,.2718,-.3597,.0853],[38.8799,-.7551,.4856,2.734,-15.7989,.186,-8e-4,.037,-.1615,-.0449,.292,-.3993,.1186],[41.2743,-.9011,.6699,2.2512,-16.8137,.1795,-9e-4,.042,-.1746,-.0484,.2216,-.293,.0726],[42.2558,-1.0062,.7158,2.6789,-19.1943,.1817,-9e-4,.0441,-.1858,-.0468,.0978,-.112,.002],[40.2612,-.9872,.7444,1.7973,-16.1566,.1974,-.0012,.0445,-.1857,-.0476,.1203,-.1402,.0055],[43.6457,-1.0069,.734,1.9082,-15.776,.1751,-5e-4,.0411,-.1774,-.054,.2098,-.2758,.0684],[37.4261,-1.0061,.8119,.7582,-12.6239,.2262,-.0023,.0517,-.2087,-.0439,.0866,-.0919,-.0122],[39.6219,-1.2657,1.1924,-1.7105,-7.6258,.228,-.0027,.0582,-.2341,-.047,-.0208,.0811,-.1069],[40.843,-1.2324,1.2238,-1.9885,-7.0689,.2204,-.0032,.0673,-.2749,-.0429,-.1374,.2503,-.1721],[43.5592,-1.2444,1.2281,-1.7233,-8.2869,.2012,-.0024,.0607,-.2564,-.0432,-.1732,.3033,-.1943],[44.6015,-1.2557,1.2143,-1.1069,-11.0077,.197,-.0025,.062,-.2557,-.0368,-.2817,.4521,-.2374],[43.431,-1.4836,1.4844,-2.8301,-7.691,.2221,-.0031,.0664,-.2718,-.0343,-.3518,.5529,-.2744],[40.2503,-1.5293,1.5113,-3.3498,-5.9574,.2524,-.0038,.0674,-.2644,-.0307,-.3766,.5899,-.2912],[38.7912,-1.4248,1.4482,-3.6476,-4.2826,.2581,-.0037,.0597,-.2243,-.033,-.308,.4967,-.266],[43.1602,-1.3762,1.3057,-2.4967,-6.1669,.2217,-.0018,.0357,-.1265,-.0409,-.031,.0745,-.0711],[44.7535,-1.2714,1.1636,-1.6742,-7.0124,.2031,-6e-4,.0171,-.0429,-.0436,.1573,-.2169,.0706],[44.9528,-1.1354,1.0103,-.6896,-9.5126,.1953,-5e-4,.0153,-.0298,-.0404,.1044,-.1372,.0343],[39.8113,-.9011,.8911,-1.1437,-6.6547,.2237,-.002,.0227,-.0406,-.0358,.093,-.1099,.0051],[37.8989,-1.0051,1.0055,-1.5428,-6.9588,.2482,-.0029,.031,-.0735,-.0328,-.0609,.1319,-.119],[35.1924,-.8104,.8253,-.5962,-9.35,.2601,-.0037,.0368,-.0925,-.0269,-.1549,.2764,-.1888],[35.6873,-.7372,.8448,-1.3541,-6.8503,.254,-.0041,.0431,-.1168,-.023,-.2589,.4332,-.2593],[32.6133,-.5491,.7277,-1.3961,-5.5317,.2691,-.0053,.0532,-.1439,-.0153,-.3595,.5813,-.3205],[34.8437,-.4711,.6905,-1.4542,-4.7991,.2492,-.0052,.0579,-.1655,-.0189,-.3396,.557,-.3175],[35.5381,-.4317,.6593,-1.2682,-5.2622,.2433,-.0053,.063,-.1896,-.0217,-.3173,.5302,-.316],[36.1777,-.4466,.641,-.9947,-5.8087,.2409,-.0052,.0631,-.1933,-.022,-.1927,.3323,-.2121],[41.2921,-.4612,.5856,-.5033,-6.0372,.2021,-.0034,.0497,-.1573,-.0331,.0525,-.035,-.0513],[43.0646,-.3308,.3256,1.3124,-9.9318,.1798,-.0016,.0281,-.0904,-.0459,.3232,-.4202,.0842],[44.3551,-.1948,.1835,1.9859,-10.8501,.1628,-.0011,.0241,-.0832,-.0524,.5032,-.684,.19],[41.152,.0212,-.0243,2.9817,-12.3905,.1771,-.0019,.0273,-.0838,-.047,.5514,-.7673,.2434],[40.7747,.1804,-.1901,4.1333,-15.4608,.1742,-.0025,.0343,-.0976,-.0441,.5815,-.8266,.2933],[42.6723,.2057,-.2093,4.492,-16.8094,.1599,-.0024,.0353,-.0956,-.0449,.6759,-.9819,.3834],[44.4726,.1842,-.1287,4.2111,-17.151,.1485,-.0024,.0365,-.0871,-.036,.5025,-.7363,.2978],[44.4307,.0412,.0455,3.5578,-17.0706,.1602,-.0031,.0461,-.1195,-.0272,.2636,-.3881,.1611],[46.146,-.1944,.3303,2.0667,-14.4506,.1634,-.0032,.0504,-.1357,-.0212,.0591,-.0927,.0497],[48.5522,-.2845,.4266,2.1896,-16.3502,.1537,-.0035,.0626,-.1955,-.0152,-.2111,.308,-.1179],[47.5272,-.3843,.5027,1.5489,-14.8051,.1683,-.0032,.0566,-.179,-.0162,-.1752,.2648,-.1172],[42.3688,-.2544,.359,1.5821,-13.3586,.2003,-.0031,.0394,-.1,-.023,.1762,-.2505,.0889],[40.419,-.1244,.2024,2.2651,-13.8723,.2085,-.0028,.0242,-.027,-.0263,.4803,-.717,.3102],[41.2786,-.4001,.5512,.3246,-9.9661,.2234,-.0037,.0333,-.0397,-.0258,.411,-.6274,.2957],[44.5475,-.4095,.5884,.3313,-11.0779,.202,-.0036,.0417,-.0815,-.024,.2501,-.3889,.1968],[48.1433,-.5054,.6845,.6598,-14.3615,.1854,-.0038,.0599,-.1887,-.0266,.0236,-.0355,.0216],[36.6027,-.2846,.4948,.5126,-11.9027,.2648,-.0058,.0611,-.1823,-.0318,.3126,-.4516,.177],[32.668,-.2953,.5385,-.5236,-7.6933,.2977,-.0064,.0584,-.1674,-.0333,.4917,-.7205,.2953],[34.2675,-.3725,.6712,-1.4456,-4.71,.2927,-.0065,.0568,-.1384,-.0262,.4807,-.7367,.354],[34.5736,-.5184,.8798,-2.5558,-3.2479,.3039,-.0074,.0666,-.1528,-.013,.1827,-.311,.2009],[38.2705,-.8498,1.178,-3.1281,-5.8888,.2993,-.0068,.0702,-.2122,-.0147,-.202,.2993,-.1195],[27.2619,-.709,1.1524,-4.729,.3025,.3797,-.0092,.0796,-.2446,-.0222,.1254,-.163,.0363],[30.6429,-.6031,1.1239,-5.8827,7.3287,.3476,-.0081,.0684,-.2186,-.027,.4252,-.6274,.2628],[38.2584,-.5815,1.057,-5.5212,7.7327,.2884,-.0057,.0424,-.1141,-.0255,.4732,-.7143,.3218],[34.2063,-.6992,1.3687,-7.5293,9.9367,.33,-.0072,.0412,-.0552,-.0037,.0265,-.062,.0645],[28.3761,-.5032,1.1656,-6.5035,7.3478,.3702,-.009,.0557,-.0992,.0012,-.2162,.3295,-.1511],[31.5473,-.191,.8482,-4.995,5.5448,.333,-.0093,.0772,-.2338,-.0012,-.3665,.5893,-.3214],[28.0599,-.1241,.7701,-4.7329,5.1931,.3597,-.0102,.0796,-.2161,-.0098,.0298,-.0073,-.0557],[23.6587,.3036,.2722,-3.1305,5.7577,.3693,-.0097,.0627,-.1368,-.0164,.4595,-.6438,.21],[30.6936,.0131,.6061,-3.5047,1.8377,.3406,-.0098,.0776,-.195,-.0166,.1956,-.2534,.0492],[36.2121,-.1094,.7833,-3.9736,.5351,.3083,-.0089,.0774,-.1975,-.0148,.091,-.0977,-.0189],[42.9427,-.2087,1.2659,-7.7504,8.427,.2634,-.0082,.0706,-.1836,.0138,-.4419,.6751,-.3217],[35.6163,-.3308,1.3791,-8.3941,8.0466,.3365,-.0098,.0787,-.2043,-5e-4,-.1455,.2492,-.1613],[52.6206,.342,.8903,-5.8391,3.6866,.1778,-.0082,.0886,-.2524,.0117,-.5949,.9156,-.4441],[73.797,-.1315,1.1805,-3.1333,-12.7158,.0592,-.0043,.0809,-.2789,-.052,.1674,-.2079,.0315],[106.9205,-.8638,1.9387,-5.949,-7.0235,-.131,.0011,.064,-.2761,-.1211,.5938,-.7577,.1352]],he=[[-15.1614,.1585,.7927,-16.2445,64.9588,.7016,-.0159,.0803,-.1501,.0109,.1002,-.1603,.0565],[7.1181,.1808,.1658,-8.1838,41.4072,.5512,-.0095,.054,-.1228,.0057,.0042,.0299,-.0661],[16.6833,-.0164,.2766,-6.0204,29.5897,.5,-.0072,.037,-.0808,-.0092,.0673,-.0993,.0246],[4.2312,.3344,.0389,-4.8857,26.2991,.583,-.0104,.0473,-.0885,9e-4,.0958,-.155,.0586],[7.5365,-.0042,.4065,-5.8405,25.1459,.5865,-.0109,.0523,-.0938,.001,.0934,-.1598,.0738],[9.1488,-.3319,.8441,-9.4288,35.3411,.6019,-.0121,.0661,-.1243,-.0028,.105,-.187,.0975],[8.942,-.0756,.7374,-10.0163,38.7888,.5921,-.0126,.0712,-.1373,.013,.076,-.1417,.0814],[7.6195,.0671,.6085,-8.8982,34.0775,.5961,-.0127,.0706,-.1365,.0147,.0961,-.1812,.1062],[4.7191,.0248,.8039,-10.5118,37.6146,.6241,-.014,.074,-.1321,.0285,.0747,-.1503,.0994],[-3.7807,.2569,.5926,-10.5763,40.4022,.6754,-.0144,.0649,-.1065,.0265,.1273,-.2395,.1377],[-4.3588,.5128,.4441,-11.0057,43.9366,.6643,-.0141,.0598,-.0914,.0297,.1526,-.2899,.1703],[.9793,.277,.5168,-10.2491,40.6962,.6426,-.0127,.0539,-.0858,.0133,.1639,-.2987,.1604],[4.1744,.2919,.5211,-10.2719,41.0334,.6197,-.0121,.0528,-.0869,.0122,.1661,-.3033,.1633],[6.8468,.1938,.5369,-9.8873,39.859,.6088,-.0115,.0517,-.0889,.0046,.1768,-.321,.1715],[11.1461,.2378,.3678,-8.151,35.8557,.5761,-.01,.044,-.0795,-7e-4,.1778,-.321,.1698],[12.4221,.276,.2488,-6.8316,31.9031,.5662,-.0092,.0391,-.073,-.0089,.2003,-.3583,.1859],[10.6386,.5028,.0451,-6.0581,30.8189,.5675,-.0093,.0395,-.0789,-.0048,.1885,-.3309,.1625],[11.895,.4259,.0403,-5.1913,27.4155,.5654,-.0088,.0351,-.0686,-.0151,.216,-.3783,.1854],[15.6199,.2947,.1255,-4.8706,25.2474,.5485,-.0083,.0349,-.0709,-.0153,.1958,-.3402,.1631],[19.1961,.2043,.1214,-4.058,22.8341,.5297,-.0074,.031,-.0656,-.025,.2093,-.3615,.171],[24.9014,.1164,.1324,-3.0351,18.7307,.4951,-.0063,.0283,-.0649,-.0265,.1862,-.3184,.1463],[27.7411,-2e-4,.251,-3.251,17.9354,.4835,-.0062,.0313,-.073,-.026,.1667,-.2835,.1289],[26.5408,-.0132,.3133,-3.6487,17.7499,.4961,-.0068,.0361,-.0837,-.0188,.1384,-.2306,.0976],[24.9608,.0679,.2933,-3.7963,17.8167,.5066,-.0077,.043,-.0991,-.0102,.1136,-.1873,.0762],[30.7628,-.0404,.3473,-3.514,16.9902,.4711,-.0065,.0402,-.0991,-.0135,.1043,-.172,.0705],[32.9166,-.0712,.3957,-3.9,17.9467,.4584,-.0062,.0397,-.0994,-.0111,.0905,-.1473,.0576],[35.8384,-.154,.4647,-4.0996,18.2022,.4447,-.0061,.0445,-.1155,-.0116,.0725,-.1148,.0406],[35.8936,-.2601,.5885,-4.4079,17.6393,.4551,-.0069,.0522,-.1317,-.0062,.042,-.0594,.0107],[35.6599,-.2948,.6396,-4.5403,17.3049,.4616,-.0074,.0559,-.1397,-.0065,.0482,-.0732,.0217],[34.2326,-.3816,.7322,-4.795,17.0262,.4801,-.0079,.0573,-.1393,-.0049,.0527,-.0851,.0332],[38.436,-.518,.8471,-5.2375,18.6249,.4592,-.0074,.0594,-.1493,-.0109,.0578,-.0961,.042],[37.4759,-.3108,.6669,-4.487,17.3228,.4543,-.0072,.0558,-.1401,-.0071,.0668,-.1148,.0546],[38.2626,-.2565,.595,-3.8813,15.733,.4471,-.0072,.0565,-.1436,-.0047,.058,-.0993,.0468],[40.1654,-.373,.7286,-4.669,17.4341,.4421,-.0071,.0576,-.1469,-5e-4,.0365,-.0612,.0272],[42.9794,-.5548,.8878,-5.2907,18.8227,.4348,-.0069,.0595,-.1514,-.0022,.033,-.0585,.0309],[45.6449,-.6118,.8823,-5.0487,18.8985,.4196,-.0061,.0555,-.1462,-.0051,.0381,-.069,.0387],[46.6551,-.5689,.866,-5.0611,19.3856,.41,-.0059,.0537,-.1435,-.0027,.039,-.0728,.0431],[47.5003,-.5697,.8793,-5.203,19.8144,.4057,-.0059,.0563,-.1527,-.0019,.0291,-.0538,.0314],[45.403,-.5065,.8608,-5.5153,21.0092,.4195,-.0064,.0585,-.1569,.0032,.0197,-.0361,.0204],[44.8971,-.395,.8017,-5.6222,21.9379,.4168,-.0064,.0554,-.147,.0027,.0376,-.069,.0382],[47.5247,-.4291,.8436,-5.8317,22.6883,.3999,-.0058,.0527,-.1421,.0015,.0382,-.0702,.0389],[46.463,-.3679,.8717,-6.4206,23.9766,.4049,-.006,.0518,-.1372,.0093,.0233,-.0445,.0258],[43.9842,-.1919,.792,-6.7209,25.4109,.4126,-.0063,.0508,-.1325,.0119,.037,-.0693,.0383],[43.2939,-.2722,.8627,-7.0319,25.6372,.4253,-.0066,.052,-.1346,.0151,.022,-.0414,.0222],[44.9267,-.3058,.9029,-7.1291,25.4723,.4173,-.0066,.054,-.1396,.0166,.008,-.0161,.0087],[45.3659,-.1577,.7596,-6.3854,23.8924,.4047,-.006,.0477,-.1258,.015,.0245,-.0444,.0212],[45.5821,-.0245,.5923,-5.4731,22.294,.3963,-.0056,.046,-.1251,.0164,.0239,-.0431,.0201],[47.1433,-.0461,.591,-5.2852,21.7529,.3877,-.0053,.0449,-.1222,.0153,.0223,-.0412,.0208],[51.495,-.1432,.644,-5.3385,21.775,.3619,-.0042,.0417,-.1223,.0089,.0218,-.0369,.0143],[49.2507,-.0452,.5634,-5.0092,21.3118,.3735,-.0044,.0403,-.1176,.0104,.0345,-.0607,.0278],[48.723,-.0088,.5464,-5.0086,21.4246,.3773,-.0046,.0403,-.114,.0144,.0211,-.0365,.0147],[46.2919,.137,.4328,-4.7097,21.0581,.387,-.0047,.0368,-.1041,.0171,.0335,-.0595,.027],[47.5969,.1489,.3829,-4.2807,20.076,.3772,-.0039,.0315,-.0941,.0134,.0397,-.0681,.0283],[48.5103,.1248,.3886,-4.0219,19.1219,.3741,-.0039,.0318,-.0943,.0115,.0417,-.0714,.03],[47.0617,.2003,.3427,-3.9935,19.2648,.3815,-.0041,.0313,-.0915,.0121,.0505,-.0878,.0394],[47.9002,.1572,.3732,-3.8154,17.8605,.3802,-.0041,.032,-.0944,.0113,.0408,-.067,.024],[49.115,.0782,.4887,-4.5668,19.8764,.3783,-.0042,.0339,-.0974,.0137,.0304,-.0508,.019],[49.9451,.1037,.4323,-3.9989,18.2108,.3716,-.0039,.0318,-.0942,.0126,.0354,-.0602,.0246],[50.1287,.2012,.3324,-3.2058,15.608,.3664,-.0039,.0327,-.0981,.0177,.0133,-.0189,1e-4],[49.51,.1993,.3903,-3.8043,17.1157,.3729,-.0042,.0344,-.1008,.0221,.0041,-.0038,-.0061],[47.0301,.2961,.3665,-3.9702,17.4284,.3864,-.0047,.0328,-.0906,.0207,.0246,-.0408,.0138],[46.9571,.2268,.4324,-4.3249,18.4933,.3932,-.0048,.0332,-.0914,.0225,.0162,-.0255,.0051],[45.7187,.319,.3143,-3.5355,16.3535,.3986,-.0048,.0327,-.0905,.0195,.039,-.0672,.0285],[46.6338,.3294,.3122,-3.6994,16.9404,.3928,-.0047,.0327,-.0892,.02,.0422,-.0754,.036],[46.796,.2184,.4173,-4.2913,18.3125,.4005,-.0048,.0316,-.0843,.0138,.0632,-.1146,.0591],[45.6059,.2609,.3536,-3.7119,16.4744,.409,-.005,.0313,-.0814,.0161,.0671,-.1239,.0669],[46.2843,.1969,.384,-3.6001,15.9912,.4103,-.005,.0321,-.0828,.0153,.0735,-.139,.08],[42.7066,.3391,.2772,-3.5789,16.5957,.4304,-.0057,.0333,-.0798,.0158,.0981,-.1852,.1067],[42.8015,.3061,.3293,-3.7417,16.4765,.4348,-.0061,.0357,-.0812,.0203,.0909,-.1775,.1098],[44.6588,.3589,.2756,-3.1211,14.5181,.4196,-.0059,.0374,-.0881,.0175,.0943,-.1832,.1126],[45.4978,.2369,.3198,-2.8753,12.9699,.4238,-.0058,.0377,-.09,.0126,.0997,-.1911,.1148],[44.3791,.247,.2747,-2.2776,10.7861,.4342,-.0061,.0387,-.0918,.0106,.1113,-.2121,.1265],[44.5213,.3308,.2335,-2.5761,12.6357,.4295,-.006,.0393,-.0953,.015,.1005,-.192,.1141],[43.3339,.3496,.2289,-2.6952,12.6151,.4397,-.0064,.0411,-.0987,.0118,.1138,-.2135,.1223],[45.7745,.2806,.323,-3.0124,12.5836,.4279,-.0062,.0429,-.1061,.0132,.0996,-.1888,.1104],[46.2858,.2501,.3239,-2.6897,11.1237,.4274,-.0059,.0399,-.1008,.0086,.1214,-.2293,.1336],[47.1461,.0565,.3804,-1.9028,7.5777,.4368,-.0058,.0399,-.1016,-.0042,.1495,-.2777,.1579],[49.8411,-.0213,.4353,-2.2574,9.0572,.4224,-.0051,.0374,-.0989,-.0067,.1499,-.2787,.1591],[54.41,-.2754,.6713,-3.3139,10.8614,.4065,-.0045,.0392,-.1059,-.0134,.1536,-.2881,.1687],[59.0571,-.3916,.714,-3.2563,11.6335,.3792,-.0031,.0313,-.0925,-.0235,.1848,-.3462,.2023],[61.5501,-.4923,.8257,-3.7049,12.2735,.3688,-.0028,.0301,-.0892,-.0258,.1974,-.3735,.2231],[62.0991,-.5602,.8523,-3.3702,9.855,.371,-.0025,.0277,-.085,-.0253,.1895,-.3572,.2113],[63.7402,-.7486,1.0333,-4.0639,10.5288,.3743,-.0026,.0296,-.0853,-.0264,.1907,-.3647,.2234],[63.1912,-.7684,1.0572,-4.1343,10.1666,.3825,-.0028,.0301,-.0846,-.0226,.1752,-.3347,.204],[65.29,-.9003,1.2109,-4.7056,10.0344,.3789,-.0031,.0353,-.0982,-.0171,.1415,-.2745,.173],[69.7586,-.9059,1.1421,-3.8514,8.3464,.3466,-.0015,.0272,-.0852,-.0254,.1633,-.3147,.1963],[68.7204,-.7413,1.161,-4.8929,11.4709,.347,-.0023,.0323,-.0945,-.0166,.1384,-.2677,.1676],[70.0709,-.7105,1.1845,-4.9763,11.0263,.3366,-.0017,.0271,-.0857,-.0132,.1197,-.2317,.1451],[71.2247,-.6095,1.0475,-4.2244,9.2028,.3239,-8e-4,.022,-.0796,-.0212,.1383,-.2581,.1496],[71.0728,-.5897,.954,-3.2255,5.828,.3275,-5e-4,.0181,-.0707,-.02,.1457,-.2721,.1573],[70.0217,-.3531,.6571,-1.1748,.806,.3265,-6e-4,.0201,-.0785,-.0091,.1053,-.1976,.115],[70.5203,-.3866,.7711,-1.2734,-1.0004,.3319,-.0017,.0287,-.092,.009,.0424,-.0915,.0678],[76.3547,-.7212,.9341,-1.3303,-1.6526,.314,-2e-4,.0247,-.0938,-.0122,.0896,-.174,.1101],[90.6025,-1.3557,1.1746,.1551,-7.729,.2521,.0034,.0132,-.0881,-.0357,.0885,-.1674,.1033],[102.6662,-1.2263,.8589,3.2534,-15.7885,.1576,.0072,-.0076,-.0516,-.0325,.0706,-.1432,.1009],[102.9154,-1.5899,1.4523,-.5061,-7.5933,.1871,.0055,.002,-.0596,-.0411,.1113,-.2264,.1604],[125.2207,-3.3398,2.9466,-5.4863,-1.908,.1438,.0076,.0111,-.0959,-.1006,.1222,-.2249,.1376],[125.8697,-3.2997,3.1051,-7.3155,3.4281,.1505,.0067,.0193,-.1148,-.0879,.0819,-.1569,.1076],[99.6314,-2.8535,3.065,-6.4997,-4.9829,.3473,-.001,.0499,-.1346,-.0354,-.0379,.0681,-.0284]],ge=[[-13.567,-1.1325,-1.7078,28.8607,-81.1719,.4118,3e-4,-.0263,.0507,-.0087,-.1202,.2977,-.2691],[-43.7777,1.9512,-3.8763,28.8717,-57.6407,.4741,-.0029,-.0496,.1518,-.0191,.1992,-.2879,.0508],[-35.5221,1.6542,-3.2001,22.4882,-41.299,.4425,-.0025,-.0428,.1269,-.0674,.3133,-.465,.1062],[-25.9772,2.0924,-3.8188,24.4956,-38.8551,.3556,3e-4,-.0543,.1499,-.0796,.4423,-.7299,.2906],[-16.9931,2.2497,-3.7873,23.1323,-35.1791,.2916,6e-4,-.0481,.1416,-.0641,.3962,-.6572,.2638],[-19.6683,2.3137,-3.7117,22.8638,-35.7152,.3203,-.0015,-.0388,.1406,-.0689,.4499,-.7699,.3469],[-33.2858,2.7679,-4.0941,22.3138,-27.6548,.3986,-.0021,-.0592,.2053,-.0938,.6243,-1.0803,.5056],[-42.522,3.0229,-4.2155,22.1584,-27.6854,.4632,-.0051,-.0392,.1567,-.0631,.512,-.8671,.3759],[-34.2517,2.7721,-3.6109,17.4453,-15.4161,.4233,-.0055,-.0269,.1286,-.0371,.366,-.6077,.2427],[-42.4833,3.1554,-3.8233,16.9605,-12.0012,.466,-.0072,-.0191,.1105,-.0294,.3572,-.5855,.2225],[-54.4375,3.0764,-3.5785,15.2542,-9.8518,.569,-.0112,-.0014,.0879,-.034,.4004,-.6627,.2631],[-38.5925,2.3768,-3.1326,15.4931,-14.1216,.5015,-.0094,.0059,.0528,-.0475,.355,-.5818,.2245],[-40.8119,2.5241,-3.3547,16.1453,-12.993,.5119,-.0092,.0039,.0554,-.0504,.3968,-.6637,.2771],[-46.3014,2.6717,-3.5156,16.4588,-11.9729,.5495,-.0106,.0106,.0468,-.0493,.4299,-.7314,.3246],[-47.6314,2.9586,-3.758,16.7192,-10.3567,.5434,-.0102,.0067,.0518,-.0595,.4837,-.8241,.3686],[-41.6665,2.9392,-3.8754,17.5857,-10.8233,.4983,-.0073,-.0149,.0964,-.0817,.5737,-.987,.4563],[-45.7369,2.9396,-3.8633,17.231,-10.561,.5321,-.008,-.0146,.1016,-.0765,.5824,-1.0084,.4748],[-51.929,2.9378,-3.7832,15.9238,-7.0752,.586,-.0101,-.0013,.0747,-.0647,.5498,-.9515,.4469],[-45.8559,3.0516,-3.9216,17.0729,-10.1336,.5356,-.0086,-.0063,.0786,-.0616,.5196,-.8956,.415],[-39.5605,2.8551,-3.5847,14.9465,-5.3128,.5025,-.0082,-.003,.0687,-.0683,.5134,-.8848,.4109],[-33.7657,2.9223,-3.533,14.1257,-2.6863,.4575,-.0075,-.0012,.0596,-.0664,.4876,-.8388,.3872],[-32.281,2.6018,-3.2278,12.8399,-.8793,.472,-.0081,.0063,.0419,-.062,.4496,-.7751,.3605],[-31.5797,2.3929,-2.9101,11.2038,1.5782,.4845,-.0091,.0143,.0265,-.0586,.4152,-.712,.3258],[-32.2816,2.6349,-3.0487,11.5875,.5188,.4779,-.0097,.0203,.0104,-.044,.3694,-.6297,.2818],[-25.44,2.7183,-3.2535,13.5284,-4.0414,.421,-.007,.0038,.0396,-.0469,.3676,-.6261,.2792],[-22.8873,2.5652,-3.2543,13.672,-3.1603,.4141,-.0056,-.0066,.0583,-.0566,.3787,-.6382,.2747],[-20.7911,2.6849,-3.4699,14.9131,-5.2628,.3921,-.0042,-.015,.0686,-.0663,.3974,-.6642,.2789],[-18.557,2.4292,-3.0989,12.2737,1.0228,.3937,-.0045,-.0121,.0655,-.073,.4005,-.667,.277],[-17.5306,2.5085,-3.1093,11.7413,3.3022,.3838,-.0047,-.009,.0598,-.0637,.3744,-.6243,.2595],[-14.3488,2.3673,-3.0068,11.4653,3.7471,.3712,-.004,-.0129,.0679,-.0681,.3759,-.6244,.2561],[-16.6395,2.3516,-2.9622,11.2382,3.1551,.3924,-.0047,-.0114,.0678,-.0675,.3777,-.6258,.2543],[-10.6475,2.2971,-2.8656,10.1755,7.4446,.3509,-.0034,-.0169,.0752,-.0763,.3958,-.6548,.2643],[-10.0847,2.4662,-2.9361,10.2311,6.9534,.3368,-.0033,-.0182,.08,-.073,.3922,-.6484,.2607],[-9.646,2.4037,-2.8587,10.171,5.6614,.3398,-.0036,-.0141,.0709,-.0667,.3688,-.6116,.2487],[-5.5,2.2058,-2.7946,11.4006,-.0691,.3246,-.003,-.0129,.0635,-.0713,.3492,-.5757,.231],[-3.1184,2.0845,-2.7566,11.9122,-2.7527,.3161,-.0025,-.0137,.0596,-.0779,.347,-.5661,.2186],[-1.8889,1.938,-2.5612,10.5284,.4557,.3178,-.0027,-.01,.0505,-.0868,.3703,-.6072,.2401],[1.3652,1.8159,-2.5509,11.3987,-2.5982,.3031,-.002,-.0117,.0496,-.095,.3856,-.6354,.2568],[4.1129,1.8155,-2.5332,11.0415,-.7368,.2849,-.0018,-.0081,.038,-.0883,.364,-.6035,.2493],[1.4862,1.9999,-2.7504,12.2222,-3.4789,.295,-.0018,-.0113,.0461,-.0881,.3736,-.6168,.2503],[-2.474,2.0859,-2.8319,12.5224,-3.8212,.3229,-.0028,-.0094,.0487,-.086,.392,-.6551,.2772],[-.415,1.9078,-2.6838,12.7489,-6.852,.3217,-.0029,-.0082,.0472,-.0801,.3635,-.6077,.2576],[-.0497,1.8113,-2.6253,12.8018,-7.7129,.3277,-.0029,-.0071,.0414,-.0794,.3497,-.5807,.2402],[-1.5833,1.7827,-2.6894,13.4925,-9.1732,.3439,-.003,-.0061,.0371,-.0845,.3665,-.6098,.2548],[1.209,1.7298,-2.6076,12.8518,-6.9268,.3277,-.0027,-.0052,.0323,-.087,.3703,-.6203,.2656],[1.2834,1.6318,-2.5106,12.1368,-4.9164,.335,-.0025,-.0086,.0415,-.0924,.386,-.6467,.2773],[-.4438,1.6936,-2.4801,11.7414,-4.8147,.3463,-.0031,-.0075,.0435,-.0895,.3834,-.6422,.2749],[-.2325,1.613,-2.4272,12.1673,-8.1046,.3529,-.0033,-.0065,.0434,-.0851,.3606,-.6019,.2545],[-2.1989,1.6982,-2.4926,12.7697,-10.7769,.3643,-.0037,-.0061,.0459,-.0859,.3821,-.6441,.2821],[-.8411,1.6919,-2.4301,12.0592,-8.667,.3572,-.004,-5e-4,.0305,-.0865,.3748,-.6317,.2776],[.1678,1.6387,-2.3829,11.423,-6.0839,.3552,-.0038,-4e-4,.0275,-.0933,.3894,-.6552,.2867],[.8079,1.7778,-2.4652,11.0582,-4.0097,.3404,-.0029,-.0096,.0477,-.0928,.4036,-.6792,.2963],[-1.1219,1.8103,-2.4361,10.7708,-4.1791,.3561,-.0036,-.0078,.0484,-.0819,.3736,-.6278,.2717],[-4.8133,1.8058,-2.331,9.8828,-2.9487,.3871,-.0049,-.0019,.0409,-.0736,.3513,-.5879,.2503],[-8.1979,2.0298,-2.494,10.6089,-5.3076,.4011,-.0058,.0028,.0321,-.0692,.3504,-.5851,.247],[-6.752,2.0613,-2.4814,10.131,-3.6573,.3884,-.0055,2e-4,.0371,-.0753,.3769,-.6294,.2655],[-3.566,1.8329,-2.2802,9.0883,-.4962,.3807,-.005,-7e-4,.0371,-.081,.3819,-.6401,.2738],[1.0387,1.7975,-2.2844,9.2486,-.6268,.3494,-.0037,-.0064,.0437,-.0821,.3621,-.6004,.2472],[1.6962,1.5592,-2.1909,9.9497,-4.5187,.3625,-.0033,-.0098,.0505,-.0904,.364,-.5976,.2383],[1.7174,1.6924,-2.3499,11.1189,-8.075,.3556,-.0029,-.0144,.0602,-.0871,.3514,-.5716,.2195],[-1.1808,1.896,-2.4788,11.4555,-8.5302,.3668,-.0036,-.0124,.0586,-.0775,.3326,-.5377,.2006],[-1.9286,1.8974,-2.4107,10.6569,-6.2357,.3747,-.0042,-.0079,.0509,-.0731,.3224,-.5217,.1951],[-.6762,1.6316,-2.0498,8.2301,-.4293,.3859,-.0052,.0017,.0314,-.0748,.3067,-.4907,.1753],[.0177,1.3931,-1.7224,6.2104,3.67,.398,-.006,.0074,.0231,-.0781,.3064,-.4907,.1763],[1.8242,1.4415,-1.8531,7.4867,.3209,.381,-.0045,-.0055,.0517,-.0808,.3148,-.504,.181],[3.3864,1.5296,-1.8957,8.1805,-2.714,.3667,-.0046,-.0044,.0516,-.0669,.2582,-.4028,.1272],[1.4518,1.5557,-2.0588,9.891,-7.5275,.3836,-.0047,-.0045,.0515,-.0676,.2556,-.3964,.1218],[-.2228,1.7851,-2.3148,11.3445,-10.9345,.3835,-.0048,-.0063,.0572,-.0663,.2738,-.4312,.1425],[-1.2686,1.848,-2.3626,11.0795,-8.9995,.3885,-.0049,-.0053,.0531,-.0765,.3143,-.5003,.1745],[-1.1771,1.9498,-2.33,9.7844,-3.6954,.382,-.0052,-.0022,.0473,-.0778,.3354,-.5421,.202],[-1.5905,1.9246,-2.2012,8.7588,-1.7051,.39,-.0063,.0071,.0279,-.0723,.315,-.5067,.1847],[1.3907,1.7403,-1.9434,6.9646,2.6064,.3789,-.006,.0072,.0262,-.0787,.3279,-.5282,.1939],[5.7059,1.724,-1.9265,7.7741,-2.061,.3493,-.0054,.0068,.0244,-.0694,.282,-.4467,.1515],[12.6597,1.3459,-1.7148,8.837,-8.9553,.3265,-.0048,.0144,-.0045,-.065,.1958,-.2892,.0669],[14.3993,1.3957,-1.9442,11.1527,-15.7051,.3118,-.0037,.0089,-4e-4,-.0745,.2201,-.3286,.0822],[17.6818,1.388,-1.9866,11.7883,-17.7697,.2899,-.0031,.0095,-.0089,-.0708,.1938,-.2807,.056],[11.917,1.6817,-2.3045,13.3873,-21.1645,.3206,-.0046,.0186,-.0278,-.0691,.2114,-.3145,.0776],[9.2777,1.6967,-2.2055,11.4045,-13.2029,.3418,-.0056,.0253,-.0412,-.0758,.2487,-.3832,.1165],[5.8584,1.6874,-2.0515,9.5688,-8.1664,.3719,-.0073,.0382,-.0675,-.0715,.2508,-.3923,.1289],[9.3245,1.5374,-1.8954,9.7989,-11.7858,.3581,-.0073,.0413,-.0754,-.063,.2057,-.3147,.0928],[16.2286,1.2597,-1.7964,11.1013,-18.2966,.3267,-.0058,.0385,-.0835,-.0656,.1577,-.2201,.0326],[15.2268,1.0841,-1.7857,12.168,-22.5467,.3504,-.0059,.0373,-.0777,-.0718,.1751,-.253,.0528],[10.4724,1.4733,-2.2295,13.8392,-23.1801,.3634,-.0056,.0276,-.0497,-.0848,.2636,-.4153,.1436],[5.2365,1.5165,-2.1802,12.4214,-17.9441,.4039,-.0071,.0317,-.0486,-.0919,.3179,-.5147,.1988],[10.1259,1.4465,-1.9666,11.6878,-19.1724,.3722,-.0063,.0273,-.0379,-.0743,.2451,-.3873,.1349],[8.7996,1.6042,-2.2123,13.8638,-26.1613,.3767,-.006,.0209,-.0216,-.0624,.2044,-.3117,.0907],[7.3808,1.9753,-2.5467,14.6551,-24.7762,.366,-.0058,.0184,-.0173,-.0685,.2633,-.4213,.1535],[8.2409,1.8093,-1.8703,8.5537,-10.4574,.3742,-.008,.033,-.0361,-.0481,.1904,-.2951,.0924],[16.3443,1.4613,-1.5844,8.5531,-13.7014,.3376,-.0067,.028,-.0305,-.0421,.1473,-.2208,.0564],[13.6814,1.7899,-2.0949,11.8906,-20.3017,.3408,-.0062,.0239,-.0268,-.0499,.1898,-.2958,.0953],[-2.2305,2.0458,-2.0636,8.7608,-9.0684,.4491,-.0095,.0277,-.0118,-.0522,.2641,-.4295,.1659],[7.1024,1.4245,-1.2884,5.4006,-5.1633,.4266,-.0107,.0507,-.0701,-.0223,.0801,-.0982,-.0105],[22.5224,1.2411,-1.1587,5.4827,-6.229,.3231,-.008,.0497,-.0852,-.035,.0837,-.1047,-.0066],[7.1688,2.0574,-2.1429,8.7073,-6.973,.3913,-.0079,.0285,-.027,-.0746,.3209,-.5246,.2072],[10.9219,1.7121,-1.5447,6.0756,-5.588,.3914,-.0095,.0458,-.0634,-.034,.1515,-.2269,.0567],[.0292,1.3826,-1.5163,7.1831,-10.5716,.5124,-.0137,.0821,-.1555,-.0443,.1613,-.2416,.0645],[-7.4708,1.924,-1.6304,5.8484,-7.4136,.5394,-.0152,.0752,-.1166,-.0193,.205,-.3492,.1599],[17.4158,1.6902,-1.3304,3.6898,3.0431,.3737,-.0096,.0478,-.0772,-.0183,.131,-.2054,.0662],[-2.725,3.8134,-2.3052,3.5243,8.0191,.4042,-.0133,.0238,.0586,.0627,.0422,-.052,-.018]];function M(e){let t=e<0?-1:1,n=Math.abs(e)/Math.sqrt(2),r=1/(1+.3275911*n);return .5*(1+t*(1-((((1.061405429*r+-1.453152027)*r+1.421413741)*r+-.284496736)*r+.254829592)*r*Math.exp(-n*n)))}function N(e,t,n){let r=Math.max(0,Math.min(217,Math.round(e*12)-24)),i,a,o;t===`female`?(i=le[r],a=ue[r],o=de[r]):(i=A[r],a=j[r],o=fe[r]);let s=((n/a)**+i-1)/(i*o);return{z:s,percentile:M(s)*100}}function P(e,t,n,r,i){let a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;t===`female`?(a=106.7,o=140.7,s=154,c=160.5,l=168.9,u=5,d=10.7,f=13.16,p=14.51,m=17.33,h=6.701,g=16.438,_=46.8,v=84.46,y=203.608,b=(e-10)*(n-147)):(a=107.8,o=140,s=154.5,c=166.4,l=179.1,u=5.06,d=10.79,f=13.22,p=14.51,m=17.3,h=-15,g=8.9,_=50.375,v=112.684,y=250.04,b=(e-10)*(n-150));let x=n,S=e,C=Math.max(0,x-a),w=Math.max(0,x-c),T=Math.max(0,x-l),ee=C**3-w**3*(l-a)/(l-c)+T**3*(c-a)/(l-c),te=Math.max(0,x-o)**3-w**3*(l-o)/(l-c)+T**3*(c-o)/(l-c),ne=Math.max(0,x-s)**3-w**3*(l-s)/(l-c)+T**3*(c-s)/(l-c),E=ee/100,re=te/100,ie=ne/100,ae=Math.max(0,S-u),D=Math.max(0,S-p),O=Math.max(0,S-m),k=ae**3-D**3*(m-u)/(m-p)+O**3*(p-u)/(m-p),oe=Math.max(0,S-d)**3-D**3*(m-d)/(m-p)+O**3*(p-d)/(m-p),se=Math.max(0,S-f)**3-D**3*(m-f)/(m-p)+O**3*(p-f)/(m-p),ce=k/100,le=oe/100,ue=se/100,de=Math.max(0,b-h),A=Math.max(0,b-v),j=Math.max(0,b-y),fe=de**3-A**3*(y-h)/(y-v)+j**3*(v-h)/(y-v),M=Math.max(0,b-g)**3-A**3*(y-g)/(y-v)+j**3*(v-g)/(y-v),N=Math.max(0,b-_)**3-A**3*(y-_)/(y-v)+j**3*(v-_)/(y-v),P=fe/1e4,F=M/1e4,I=N/1e4,L;L=t===`female`?r===`sys`?pe:me:r===`sys`?he:ge;let R=Array(99);for(let e=0;e<99;e++)R[e]=L[e][0]+L[e][5]*x+L[e][6]*E+L[e][7]*re+L[e][8]*ie+L[e][1]*S+L[e][2]*ce+L[e][3]*le+L[e][4]*ue+L[e][9]*b+L[e][10]*P+L[e][11]*F+L[e][12]*I;let z=1/0,B=50;for(let e=0;e<99;e++){let t=Math.abs(i-R[e]);t=13?(a=r>=140?`stage2`:r>=130?`stage1`:r>=120?`elevated`:`normal`,o=i>=90?`stage2`:i>=80?`stage1`:`normal`):(a=t>=107||r>=140?`stage2`:t>=95||r>=130?`stage1`:t>=90||r>=120?`elevated`:`normal`,o=n>=107||i>=90?`stage2`:n>=95||i>=80?`stage1`:n>=90?`elevated`:`normal`);let s={normal:0,elevated:1,stage1:2,stage2:3},c=s[a]>=s[o]?a:o;return{sysClass:a,diaClass:o,classification:c}}function I(e,t,n,r,i){let a=N(e,t,n),o=P(e,t,n,`sys`,r),s=P(e,t,n,`dia`,i),c=F(e,o.percentile,s.percentile,r,i);return{sysPercentile:o.percentile,diaPercentile:s.percentile,heightPercentile:a.percentile,sysClass:c.sysClass,diaClass:c.diaClass,classification:c.classification}}var L=n(),R=`rounded-lg border border-border bg-card p-5 space-y-3`,z=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,B=`block text-xs font-medium text-muted-foreground`,_e=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,ve=`rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted`,ye=`rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-200`,V={normal:{label:`Normal`,color:`#10b981`,bg:`#d1fae5`},elevated:{label:`Elevated`,color:`#f59e0b`,bg:`#fef3c7`},stage1:{label:`Stage 1 Hypertension`,color:`#f97316`,bg:`#ffedd5`},stage2:{label:`Stage 2 Hypertension`,color:`#ef4444`,bg:`#fee2e2`}};function be(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(`female`),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null);function h(){let t=Number.parseFloat(e),r=Number.parseFloat(i),a=Number.parseFloat(o),s=Number.parseFloat(c);if(!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(a)||!Number.isFinite(s)){f(`Fill in all fields.`),m(null);return}if(t<1||t>17){f(`Age must be 1-17 years.`),m(null);return}if(r<50||r>200){f(`Height must be 50-200 cm.`),m(null);return}f(``),m(I(t,n,r,a,s))}let g=p?V[p.classification]:null;return(0,L.jsxs)(`section`,{className:R,"data-testid":`calc-panel-bp`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`BP Percentile (AAP 2017)`}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`Age (years)`}),(0,L.jsx)(`input`,{type:`number`,min:`1`,max:`17`,step:`0.1`,className:z,value:e,onChange:e=>t(e.target.value),"data-testid":`bp-age`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`Sex`}),(0,L.jsxs)(`select`,{className:z,value:n,onChange:e=>r(e.target.value),"data-testid":`bp-sex`,children:[(0,L.jsx)(`option`,{value:`female`,children:`Female`}),(0,L.jsx)(`option`,{value:`male`,children:`Male`})]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`Height (cm)`}),(0,L.jsx)(`input`,{type:`number`,min:`50`,max:`200`,step:`0.1`,className:z,value:i,onChange:e=>a(e.target.value),"data-testid":`bp-height`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`SBP (mmHg)`}),(0,L.jsx)(`input`,{type:`number`,min:`50`,max:`220`,step:`1`,className:z,value:o,onChange:e=>s(e.target.value),"data-testid":`bp-sbp`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`DBP (mmHg)`}),(0,L.jsx)(`input`,{type:`number`,min:`30`,max:`150`,step:`1`,className:z,value:c,onChange:e=>u(e.target.value),"data-testid":`bp-dbp`})]})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:h,className:_e,"data-testid":`calc-bp-calculate`,children:`Calculate`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{t(``),a(``),s(``),u(``),m(null),f(``)},className:ve,children:`Clear`})]}),d&&(0,L.jsx)(`div`,{className:ye,children:d}),p&&g&&(0,L.jsxs)(`div`,{className:`rounded-lg p-4 space-y-2`,style:{background:g.bg,borderLeft:`4px solid ${g.color}`},"data-testid":`calc-bp-result`,children:[(0,L.jsx)(`div`,{className:`text-base font-bold`,style:{color:g.color},children:g.label}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 text-sm`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Systolic`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[p.sysPercentile,`th %ile`]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:V[p.sysClass].label})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Diastolic`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[p.diaPercentile,`th %ile`]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:V[p.diaClass].label})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Height`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[p.heightPercentile.toFixed(0),`th %ile`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Overall`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:g.label})]})]})]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Flynn JT et al. Clinical Practice Guideline for Screening and Management of High Blood Pressure in Children and Adolescents. Pediatrics 2017;140(3):e20171904.`})]})}function xe(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(`male`),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null);function h(){let t=(Number.parseFloat(e)||0)+(Number.parseInt(n,10)||0)/12,r=Number.parseFloat(o),a=Number.parseFloat(c);if(!t||!Number.isFinite(r)||r<=0||!Number.isFinite(a)||a<=0){f(`Fill in all fields.`),m(null);return}if(t<2||t>20){f(`Age must be 2-20 years.`),m(null);return}f(``),m(ce(r,a,Math.round(t*12),i))}return(0,L.jsxs)(`section`,{className:R,"data-testid":`calc-panel-bmi`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`BMI Percentile (CDC 2000)`}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:col-span-1`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`Age (yr)`}),(0,L.jsx)(`input`,{type:`number`,min:`2`,max:`20`,step:`0.1`,className:z,value:e,onChange:e=>t(e.target.value),"data-testid":`bmi-age-yr`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`Months`}),(0,L.jsx)(`input`,{type:`number`,min:`0`,max:`11`,className:z,value:n,onChange:e=>r(e.target.value),"data-testid":`bmi-age-mo`})]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`Sex`}),(0,L.jsxs)(`select`,{className:z,value:i,onChange:e=>a(e.target.value),"data-testid":`bmi-sex`,children:[(0,L.jsx)(`option`,{value:`male`,children:`Male`}),(0,L.jsx)(`option`,{value:`female`,children:`Female`})]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:B,children:`Weight (kg)`}),(0,L.jsx)(`input`,{type:`number`,min:`1`,max:`200`,step:`0.1`,className:z,value:o,onChange:e=>s(e.target.value),"data-testid":`bmi-weight`})]}),(0,L.jsxs)(`div`,{className:`sm:col-span-1`,children:[(0,L.jsx)(`label`,{className:B,children:`Height (cm)`}),(0,L.jsx)(`input`,{type:`number`,min:`50`,max:`220`,step:`0.1`,className:z,value:c,onChange:e=>u(e.target.value),"data-testid":`bmi-height`})]})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:h,className:_e,"data-testid":`calc-bmi-calculate`,children:`Calculate`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{t(``),r(``),s(``),u(``),m(null),f(``)},className:ve,children:`Clear`})]}),d&&(0,L.jsx)(`div`,{className:ye,children:d}),p&&(0,L.jsxs)(`div`,{className:`rounded-lg p-4 space-y-2`,style:{background:p.classification.bg,borderLeft:`4px solid ${p.classification.color}`},"data-testid":`calc-bmi-result`,children:[(0,L.jsx)(`div`,{className:`text-base font-bold`,style:{color:p.classification.color},children:p.classification.label}),(0,L.jsxs)(`div`,{className:`text-sm`,children:[`BMI `,p.bmi.toFixed(1),` kg/m² — `,p.percentile,`th percentile`]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 text-sm`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`BMI`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:p.bmi.toFixed(1)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Percentile`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[p.percentile,`th`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Z-Score`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:p.z.toFixed(2)})]}),p.percentile>=85&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`% of 95th`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[p.classification.pctOf95.toFixed(0),`%`]})]})]})]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`CDC 2000 LMS tables · Kuczmarski et al. Vital Health Stat 11. 2002;(246).`})]})}var Se={premie:{label:`Premie`,hr:{awake:`120-170`,sleeping:`100-150`},rr:`40-70`,sbp:`55-75`,dbp:`35-45`,temp:`36.5-37.5`,weight:`0.5-2.5 kg`,spo2:`88-95% (target)`,notes:[`HR and RR are highly variable and depend on gestational age`,`BP increases with gestational age and postnatal age`,`Target SpO2 88-95% to reduce retinopathy of prematurity risk`,`Temperature instability is common — use servo-controlled warmers`,`Bradycardia (<100 bpm) and apnea are common in premature infants`]},"0-3mo":{label:`0-3 Months`,hr:{awake:`100-150`,sleeping:`85-135`},rr:`35-55`,sbp:`65-85`,dbp:`45-55`,temp:`36.5-37.5`,weight:`2.5-6 kg`,spo2:`>95%`,notes:[`HR normally increases with crying (up to 180-190 bpm) — this is physiologic`,`Periodic breathing (pauses <10 sec) is normal in neonates`,`Acrocyanosis (blue hands/feet) is normal; central cyanosis is not`,`BP is best measured in the right arm (pre-ductal) in neonates`,`Normal weight loss of 5-7% in first 3-5 days; regain by 10-14 days`]},"3-6mo":{label:`3-6 Months`,hr:{awake:`90-120`,sleeping:`75-110`},rr:`30-45`,sbp:`70-90`,dbp:`50-65`,temp:`36.5-37.5`,weight:`5-8 kg`,spo2:`>95%`,notes:[`Expected weight gain: 20-30 g/day (150-200 g/week)`,`HR gradually decreases as vagal tone matures`,`RR >60 at rest may indicate lower respiratory tract disease`,`BP should be measured with appropriate cuff size (width 40% of arm circumference)`]},"6-12mo":{label:`6-12 Months`,hr:{awake:`80-120`,sleeping:`70-110`},rr:`25-40`,sbp:`80-100`,dbp:`55-65`,temp:`36.0-37.5`,weight:`8-10 kg`,spo2:`>95%`,notes:[`Expected weight: triple birth weight by 12 months (~10 kg average)`,`Weight gain slows to ~10-15 g/day`,`Sinus arrhythmia (HR varies with breathing) is normal`,`Febrile tachycardia: HR increases ~10 bpm per 1 degree C above 37`]},"1-3yr":{label:`1-3 Years`,hr:{awake:`70-110`,sleeping:`60-100`},rr:`20-30`,sbp:`90-105`,dbp:`55-70`,temp:`36.0-37.5`,weight:`10-15 kg`,spo2:`>95%`,notes:[`Expected weight gain: ~200-250 g/month (2-2.5 kg/year)`,`Tachycardia: HR >110 at rest warrants evaluation`,`Tachypnea: RR >30 at rest may indicate respiratory distress`,`BP screening begins at age 3 per AAP 2017 guidelines`,`Estimated weight: 2 x (age in years) + 8`]},"3-6yr":{label:`3-6 Years`,hr:{awake:`65-110`,sleeping:`55-100`},rr:`20-25`,sbp:`95-110`,dbp:`60-75`,temp:`36.0-37.5`,weight:`14-20 kg`,spo2:`>95%`,notes:[`Annual BP screening recommended from age 3`,`Normal BP <90th percentile for age, sex, and height`,`Elevated BP: 90th to <95th percentile (or 120/80 if lower)`,`Estimated weight: 2 x (age in years) + 8`,`ETT size (uncuffed): (age/4) + 4`]},"6-12yr":{label:`6-12 Years`,hr:{awake:`60-95`,sleeping:`50-85`},rr:`14-22`,sbp:`100-120`,dbp:`60-75`,temp:`36.0-37.5`,weight:`20-40 kg`,spo2:`>95%`,notes:[`Resting HR >95 or <60 warrants evaluation`,`BP should be measured at every clinical encounter`,`Stage 1 HTN: >=95th percentile on 3 separate occasions`,`Estimated weight: 3 x (age in years) + 7`,`ETT size (cuffed): (age/4) + 3.5`]},">12yr":{label:`>12 Years`,hr:{awake:`55-85`,sleeping:`45-75`},rr:`12-18`,sbp:`110-135`,dbp:`65-85`,temp:`36.0-37.5`,weight:`40-80 kg`,spo2:`>95%`,notes:[`Vital signs approach adult values`,`From age 13: use adult BP thresholds (AAP 2017)`,`Normal: <120/<80 mmHg; Elevated: 120-129/<80 mmHg`,`Stage 1 HTN: 130-139/80-89 mmHg; Stage 2 HTN: >=140/>=90 mmHg`,`Orthostatic vitals: measure lying, sitting, standing if dizzy`,`Athletic bradycardia (HR 45-60) may be normal in trained adolescents`]}},Ce=[`premie`,`0-3mo`,`3-6mo`,`6-12mo`,`1-3yr`,`3-6yr`,`6-12yr`,`>12yr`];function we(){let[e,t]=(0,l.useState)(`1-3yr`),n=Se[e];return(0,L.jsxs)(`section`,{className:R,"data-testid":`calc-panel-vitals`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Vital Signs by Age`}),(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(`label`,{className:B,children:`Age group`}),(0,L.jsx)(`select`,{className:z,value:e,onChange:e=>t(e.target.value),"data-testid":`vitals-age-select`,children:Ce.map(e=>(0,L.jsx)(`option`,{value:e,children:Se[e].label},e))})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3 text-sm`,"data-testid":`vitals-result`,children:[(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Heart rate (awake)`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[n.hr.awake,` bpm`]})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Heart rate (sleep)`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[n.hr.sleeping,` bpm`]})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Respiratory rate`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[n.rr,` /min`]})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`SpO₂`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:n.spo2})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`SBP`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[n.sbp,` mmHg`]})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`DBP`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[n.dbp,` mmHg`]})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Temperature`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[n.temp,` °C`]})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Weight`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:n.weight})]})]}),(0,L.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs`,children:[(0,L.jsx)(`div`,{className:`font-semibold mb-1`,children:`Clinical notes`}),(0,L.jsx)(`ul`,{className:`list-disc pl-5 space-y-0.5`,children:n.notes.map((e,t)=>(0,L.jsx)(`li`,{children:e},t))})]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Harriet Lane Handbook 23rd ed · PALS · AAP 2017 BP guidelines.`})]})}var Te=[{name:`Adenosine`,indication:`SVT`,category:`cardiac`,route:`IV/IO rapid bolus`,calc:e=>{let t=+(e*.1).toFixed(2),n=+(e*.2).toFixed(2),r=+(e*.3).toFixed(2);return{dose:`${t} mg (0.1 mg/kg)`,extra:`May repeat: ${Math.min(n,12)} mg (0.2 mg/kg), then ${Math.min(r,12)} mg (0.3 mg/kg)`,max:`Max first dose 6 mg, max subsequent 12 mg`}}},{name:`Amiodarone`,indication:`VT / VF`,category:`cardiac`,route:`IV/IO`,calc:e=>{let t=+(e*5).toFixed(1);return{dose:`${Math.min(t,300)} mg (5 mg/kg)`,extra:`No pulse: push undiluted. Pulse: over 20-60 min. Subsequent max 150 mg.`,max:`Max first 300 mg, max total 15 mg/kg/24hr or 2200 mg`}}},{name:`Atropine`,indication:`Bradycardia`,category:`cardiac`,route:`IV/IO/IM`,calc:e=>{let t=+(e*.02).toFixed(3),n=`${(e*.04).toFixed(3)}-${(e*.06).toFixed(3)}`;return{dose:`${Math.min(t,.5)} mg (0.02 mg/kg)`,extra:`ETT dose: ${n} mg (0.04-0.06 mg/kg)`,max:`Max single 0.5 mg, max total 1 mg`}}},{name:`Calcium Chloride 10%`,indication:`Hypocalcemia / Hyperkalemia`,category:`metabolic`,route:`IV/IO`,calc:e=>{let t=+(e*20).toFixed(0);return{dose:`${Math.min(t,1e3)} mg (20 mg/kg)`,extra:`Give slowly. Central line preferred.`,max:`Max 1 g (1000 mg)`}}},{name:`Calcium Gluconate 10%`,indication:`Hypocalcemia / Hyperkalemia`,category:`metabolic`,route:`IV/IO`,calc:e=>{let t=+(e*60).toFixed(0);return{dose:`${Math.min(t,3e3)} mg (60 mg/kg)`,extra:`Give slowly over 10-20 min with cardiac monitoring.`,max:`Max 3 g (3000 mg)`}}},{name:`Dextrose`,indication:`Hypoglycemia`,category:`metabolic`,route:`IV`,calc:e=>{let t=`${+(e*.5).toFixed(1)}-${+(e*1).toFixed(1)}`,n=``;return n=e<5?`D10W: ${(e*5).toFixed(1)}-${(e*10).toFixed(1)} mL (5-10 mL/kg)`:e<45?`D25W: ${(e*2).toFixed(1)}-${(e*4).toFixed(1)} mL (2-4 mL/kg)`:`D50W: ${(e*1).toFixed(1)}-${(e*2).toFixed(1)} mL (1-2 mL/kg)`,{dose:`${t} g (0.5-1 g/kg)`,extra:n,max:`Max 25 g`}}},{name:`Epinephrine`,indication:`Pulseless arrest / Anaphylaxis`,category:`cardiac`,route:`IV/IO/IM/ETT`,calc:e=>{let t=+(e*.01).toFixed(3),n=+(e*.1).toFixed(2),r=+(e*.1).toFixed(2),i=+(e*.01).toFixed(3);return{dose:`${Math.min(t,1)} mg IV/IO (0.01 mg/kg of 0.1 mg/mL = ${Math.min(n,10)} mL) q3-5 min`,extra:`ETT: ${Math.min(r,2.5)} mg (0.1 mg/kg of 1 mg/mL). Anaphylaxis IM: ${Math.min(i,.5)} mg (0.01 mg/kg)`,max:`Max IV 1 mg, max ETT 2.5 mg, max IM 0.5 mg`}}},{name:`Hydrocortisone`,indication:`Adrenal crisis`,category:`metabolic`,route:`IV/IM/IO`,calc:e=>{let t=+(e*2).toFixed(1);return{dose:`${Math.min(t,100)} mg (2 mg/kg)`,extra:`Stress dosing for adrenal insufficiency.`,max:`Max 100 mg`}}},{name:`Insulin (Regular)`,indication:`Hyperkalemia`,category:`metabolic`,route:`IV`,calc:e=>{let t=+(e*.1).toFixed(2),n=+(e*.5).toFixed(1);return{dose:`${Math.min(t,5)} units (0.1 units/kg)`,extra:`Give with ${n} g/kg dextrose (0.5 g/kg). Monitor glucose closely.`,max:`Max 5 units`}}},{name:`Lidocaine`,indication:`Antiarrhythmic`,category:`cardiac`,route:`IV/IO`,calc:e=>{let t=+(e*1).toFixed(1),n=`${(e*2).toFixed(1)}-${(e*3).toFixed(1)}`;return{dose:`${Math.min(t,100)} mg (1 mg/kg)`,extra:`ETT: ${n} mg (2-3 mg/kg). May repeat q5 min.`,max:`Max 100 mg/dose, max total 3 mg/kg`}}},{name:`Magnesium Sulfate`,indication:`Torsades de Pointes`,category:`cardiac`,route:`IV/IO`,calc:e=>{let t=+(e*50).toFixed(0);return{dose:`${Math.min(t,2e3)} mg (50 mg/kg)`,extra:`Give over 10-20 min (faster if pulseless).`,max:`Max 2 g (2000 mg)`}}},{name:`Naloxone`,indication:`Opioid overdose`,category:`reversal`,route:`IV/IO/IM/IN/ETT`,calc:e=>{let t=`${+(e*.001).toFixed(4)}-${+(e*.005).toFixed(4)}`,n=+(e*.1).toFixed(3);return{dose:`Partial: ${t} mg (0.001-0.005 mg/kg)`,extra:`Full reversal: ${Math.min(n,2)} mg (0.1 mg/kg)`,max:`Max partial first dose 0.1 mg, max full 2 mg`}}},{name:`Sodium Bicarbonate`,indication:`Metabolic acidosis`,category:`metabolic`,route:`IV/IO`,calc:e=>{let t=+(e*1).toFixed(1);return{dose:`${Math.min(t,50)} mEq (1 mEq/kg)`,extra:e<10?`Dilute to 0.5 mEq/mL (use 4.2% solution) for neonates/small infants.`:`Use 8.4% solution (1 mEq/mL).`,max:`Max 50 mEq`}}}],H={cardiac:`#ef4444`,metabolic:`#3b82f6`,reversal:`#10b981`},Ee={cardiac:`Cardiac`,metabolic:`Metabolic`,reversal:`Reversal`};function De(){let[e,t]=(0,l.useState)(``),n=Number.parseFloat(e);return(0,L.jsxs)(`section`,{className:R,"data-testid":`calc-panel-resus`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Resus Medications`}),(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(`label`,{className:B,children:`Weight (kg)`}),(0,L.jsx)(`input`,{type:`number`,min:`0.5`,max:`100`,step:`0.1`,className:z,value:e,onChange:e=>t(e.target.value),"data-testid":`resus-weight`})]}),Number.isFinite(n)&&n>0?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-sm font-semibold`,children:[`Doses for `,n,` kg patient`]}),(0,L.jsx)(`div`,{className:`flex gap-3 flex-wrap text-xs`,children:[`cardiac`,`metabolic`,`reversal`].map(e=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full`,style:{background:H[e]}}),Ee[e]]},e))}),(0,L.jsx)(`div`,{className:`grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3`,"data-testid":`resus-result`,children:Te.map(e=>{let t=e.calc(n),r=H[e.category];return(0,L.jsxs)(`div`,{className:`rounded-lg border bg-card overflow-hidden`,style:{borderColor:r+`55`},children:[(0,L.jsxs)(`div`,{className:`px-3 py-2 border-b`,style:{background:r+`10`,borderColor:r+`22`},children:[(0,L.jsx)(`div`,{className:`text-sm font-bold`,style:{color:r},children:e.name}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.indication})]}),(0,L.jsxs)(`div`,{className:`p-3 text-sm space-y-1`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{children:`Dose:`}),` `,t.dose]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.extra}),(0,L.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`strong`,{children:`Max:`}),` `,t.max]}),(0,L.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`strong`,{children:`Route:`}),` `,e.route]})]})]},e.name)})}),(0,L.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,L.jsx)(`strong`,{children:`Disclaimer:`}),` Always verify doses against institutional protocols and current guidelines.`]})]}):(0,L.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var Oe={premie:{label:`Premie (1-3 kg)`,bvm:`Infant`,nasal:`12 Fr`,oral:`Infant`,blade:`Miller 0`,ett:`2.5-3.0`,lma:`1`,glidescope:`1`,iv:`22-24 ga`,cvl:`3 Fr`,ngt:`5 Fr`,chest:`10-12 Fr`,foley:`6 Fr`},newborn:{label:`Newborn (2-4 kg)`,bvm:`Infant`,nasal:`14-16 Fr`,oral:`Small 50 mm`,blade:`Miller 0`,ett:`3.0-3.5`,lma:`1`,glidescope:`1`,iv:`22-24 ga`,cvl:`3-4 Fr`,ngt:`5-8 Fr`,chest:`10-12 Fr`,foley:`6 Fr`},"6mo":{label:`6 months (6-8 kg)`,bvm:`Infant`,nasal:`14-16 Fr`,oral:`Small 60 mm`,blade:`Miller 1`,ett:`3.5`,lma:`1.5`,glidescope:`2`,iv:`20-24 ga`,cvl:`4 Fr`,ngt:`8 Fr`,chest:`12-18 Fr`,foley:`8 Fr`},"1yr":{label:`1 year (10 kg)`,bvm:`Small child`,nasal:`14-18 Fr`,oral:`Small 60 mm`,blade:`Miller 1 / MAC 2`,ett:`4.0`,lma:`2`,glidescope:`2`,iv:`20-24 ga`,cvl:`4-5 Fr`,ngt:`10 Fr`,chest:`16-20 Fr`,foley:`8 Fr`},"2-3yr":{label:`2-3 years (12-16 kg)`,bvm:`Small child`,nasal:`14-18 Fr`,oral:`Small 70 mm`,blade:`Miller 1 / MAC 2`,ett:`4.0-4.5`,lma:`2`,glidescope:`2`,iv:`18-22 ga`,cvl:`4-5 Fr`,ngt:`10-12 Fr`,chest:`16-24 Fr`,foley:`8 Fr`},"4-6yr":{label:`4-6 years (20-25 kg)`,bvm:`Child`,nasal:`16-20 Fr`,oral:`Small 70-80 mm`,blade:`Miller 2 / MAC 2`,ett:`4.5-5.0`,lma:`2.5`,glidescope:`3`,iv:`18-22 ga`,cvl:`5 Fr`,ngt:`12-14 Fr`,chest:`20-28 Fr`,foley:`8 Fr`},"7-10yr":{label:`7-10 years (25-35 kg)`,bvm:`Child / Small adult`,nasal:`18-22 Fr`,oral:`Medium 80-90 mm`,blade:`Miller 2 / MAC 2`,ett:`5.5-6.0`,lma:`2.5-3`,glidescope:`3`,iv:`18-22 ga`,cvl:`5 Fr`,ngt:`12-14 Fr`,chest:`20-32 Fr`,foley:`8 Fr`},"11-15yr":{label:`11-15 years (40-50 kg)`,bvm:`Adult`,nasal:`22-36 Fr`,oral:`Medium 90 mm`,blade:`Miller 2 / MAC 3`,ett:`6.0-6.5`,lma:`3`,glidescope:`3 or 4`,iv:`18-20 ga`,cvl:`7 Fr`,ngt:`14-18 Fr`,chest:`28-38 Fr`,foley:`10 Fr`},"16yr":{label:`16+ years (>50 kg)`,bvm:`Adult`,nasal:`22-36 Fr`,oral:`Medium 90 mm`,blade:`Miller 2 / MAC 3`,ett:`7.0-8.0`,lma:`4`,glidescope:`3 or 4`,iv:`18-20 ga`,cvl:`7 Fr`,ngt:`14-18 Fr`,chest:`28-42 Fr`,foley:`12 Fr`}},ke=[`premie`,`newborn`,`6mo`,`1yr`,`2-3yr`,`4-6yr`,`7-10yr`,`11-15yr`,`16yr`];function Ae(){let[e,t]=(0,l.useState)(`1yr`),n=Oe[e],r=[[`BVM`,n.bvm],[`Nasopharyngeal`,n.nasal],[`Oropharyngeal`,n.oral],[`Laryngoscope`,n.blade],[`ETT`,n.ett],[`LMA`,n.lma],[`Glidescope`,n.glidescope],[`IV`,n.iv],[`Central line`,n.cvl],[`NG tube`,n.ngt],[`Chest tube`,n.chest],[`Foley`,n.foley]];return(0,L.jsxs)(`section`,{className:R,"data-testid":`calc-panel-equipment`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Equipment Sizing`}),(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(`label`,{className:B,children:`Age / weight band`}),(0,L.jsx)(`select`,{className:z,value:e,onChange:e=>t(e.target.value),"data-testid":`equip-age-select`,children:ke.map(e=>(0,L.jsx)(`option`,{value:e,children:Oe[e].label},e))})]}),(0,L.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-3 text-sm`,"data-testid":`equip-result`,children:r.map(([e,t])=>(0,L.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:e}),(0,L.jsx)(`div`,{className:`font-semibold`,children:t})]},e))}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Harriet Lane Handbook · PALS · Broselow cross-reference.`})]})}var U=`rounded-lg border border-border bg-card p-5 space-y-3`,W=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,G=`rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted`,K=`space-y-1`,q=`block text-xs font-medium text-muted-foreground`,J=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,Y=`rounded-lg border border-border bg-muted/40 p-4`,X=`rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-200`,Z=[{id:`bp`,label:`BP Percentile`,summary:`AAP 2017 age/height/sex-adjusted BP percentiles (Rosner quantile splines).`,source:`AAP 2017 (Flynn) — Rosner splines`,ported:!0},{id:`bmi`,label:`BMI Percentile`,summary:`BMI-for-age (CDC 2000 z-score tables).`,source:`CDC 2000 LMS`,ported:!0},{id:`growth`,label:`Growth Charts`,summary:`Fenton 2013 preterm weight-for-GA with Z-score + percentile + SGA/AGA/LGA classification.`,source:`Fenton 2013 LMS`,ported:!0},{id:`bili`,label:`Bilirubin`,summary:`AAP 2022 phototherapy + exchange thresholds and Bhutani nomogram risk zones.`,source:`AAP 2022 (Kemper) + Bhutani 1999`,ported:!0},{id:`vitals`,label:`Vital Signs`,summary:`Normal HR / RR / BP ranges by age.`,source:`Harriet Lane + PALS + AHA`,ported:!0},{id:`bsa`,label:`Body Surface Area`,summary:`Mosteller body surface area formula.`,source:`Mosteller 1987`,ported:!0},{id:`dose`,label:`Weight-Based Dosing`,summary:`Generic mg/kg dosing with optional max-dose cap and concentration conversion.`,source:`Legacy calculator formula`,ported:!0},{id:`resus`,label:`Resus Meds`,summary:`Code-cart dosing (epinephrine, amiodarone, atropine, etc.).`,source:`PALS`,ported:!0},{id:`gcs`,label:`GCS`,summary:`Child/adult and infant Glasgow Coma Scale variants.`,source:`Teasdale + pediatric modification`,ported:!0},{id:`equipment`,label:`Equipment`,summary:`ETT size, blade, NG, Foley, suction by age/weight.`,source:`PALS + Broselow cross-reference`,ported:!0}];function je(e){if(!e.trim())return null;let t=Number(e);return Number.isFinite(t)?t:null}function Q({id:e,labelText:t,value:n,onChange:r,min:i,max:a,step:o=`0.1`,placeholder:s}){return(0,L.jsxs)(`div`,{className:K,children:[(0,L.jsx)(`label`,{htmlFor:e,className:q,children:t}),(0,L.jsx)(`input`,{id:e,type:`number`,min:i,max:a,step:o,value:n,onChange:e=>r(e.target.value),placeholder:s,className:J})]})}function Me(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(``),[i,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``);function u(){let t=a(Number(e),Number(n));if(t==null){c(`Enter a valid weight and height.`),o(null);return}c(``),o(t)}function d(){t(``),r(``),o(null),c(``)}return(0,L.jsxs)(`section`,{className:U,"data-testid":`calc-panel-bsa`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Body Surface Area`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Mosteller formula: BSA (m2) = sqrt(height(cm) x weight(kg) / 3600).`}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(Q,{id:`react-bsa-weight`,labelText:`Weight (kg)`,value:e,onChange:t,min:`1`,max:`200`,placeholder:`20`}),(0,L.jsx)(Q,{id:`react-bsa-height`,labelText:`Height (cm)`,value:n,onChange:r,min:`30`,max:`220`,placeholder:`110`})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:u,className:W,"data-testid":`calc-bsa-calculate`,children:`Calculate`}),(0,L.jsx)(`button`,{type:`button`,onClick:d,className:G,children:`Clear`})]}),s?(0,L.jsx)(`div`,{className:X,children:s}):null,i==null?null:(0,L.jsxs)(`div`,{className:Y,"data-testid":`calc-bsa-result`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Mosteller BSA`}),(0,L.jsxs)(`div`,{className:`text-2xl font-semibold`,children:[i.toFixed(3),` m²`]}),(0,L.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[e,` kg, `,n,` cm`]})]})]})}function Ne(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(`1`),[o,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(``);function g(){let t=s({weightKg:Number(e),dosePerKg:Number(n),frequencyPerDay:Number(i),maxSingleDoseMg:je(o),concentrationMgPerMl:je(u)});if(t==null){h(`Enter a valid weight, mg/kg dose, and frequency.`),p(null);return}h(``),p(t)}function _(){t(``),r(``),a(`1`),c(``),d(``),p(null),h(``)}return(0,L.jsxs)(`section`,{className:U,"data-testid":`calc-panel-dose`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Weight-Based Dosing`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generic mg/kg calculator. Always verify medication-specific dosing against formulary and local policy.`}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,L.jsx)(Q,{id:`react-dose-weight`,labelText:`Patient Weight (kg)`,value:e,onChange:t,min:`1`,max:`200`,placeholder:`15`}),(0,L.jsx)(Q,{id:`react-dose-per-kg`,labelText:`Dose (mg/kg)`,value:n,onChange:r,min:`0.01`,step:`0.01`,placeholder:`10`}),(0,L.jsxs)(`div`,{className:K,children:[(0,L.jsx)(`label`,{htmlFor:`react-dose-frequency`,className:q,children:`Frequency`}),(0,L.jsxs)(`select`,{id:`react-dose-frequency`,value:i,onChange:e=>a(e.target.value),className:J,children:[(0,L.jsx)(`option`,{value:`1`,children:`Once daily`}),(0,L.jsx)(`option`,{value:`2`,children:`Twice daily (BID)`}),(0,L.jsx)(`option`,{value:`3`,children:`Three times daily (TID)`}),(0,L.jsx)(`option`,{value:`4`,children:`Four times daily (QID)`}),(0,L.jsx)(`option`,{value:`6`,children:`Every 4 hours (Q4H)`})]})]}),(0,L.jsx)(Q,{id:`react-dose-max`,labelText:`Max single dose (mg, optional)`,value:o,onChange:c,min:`0`,step:`1`,placeholder:`500`}),(0,L.jsx)(Q,{id:`react-dose-concentration`,labelText:`Concentration (mg/mL, optional)`,value:u,onChange:d,min:`0`,placeholder:`40`})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:g,className:W,"data-testid":`calc-dose-calculate`,children:`Calculate`}),(0,L.jsx)(`button`,{type:`button`,onClick:_,className:G,children:`Clear`})]}),m?(0,L.jsx)(`div`,{className:X,children:m}):null,f==null?null:(0,L.jsx)(`div`,{className:Y,"data-testid":`calc-dose-result`,children:(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Single Dose`}),(0,L.jsxs)(`div`,{className:`text-xl font-semibold`,children:[f.singleDoseMg.toFixed(1),` mg`]}),f.capped?(0,L.jsx)(`div`,{className:`text-xs text-red-600`,children:`Capped at max dose`}):null]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Daily Total`}),(0,L.jsxs)(`div`,{className:`text-xl font-semibold`,children:[f.dailyDoseMg.toFixed(1),` mg/day`]}),(0,L.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`x `,f.frequencyPerDay,`/day`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Volume`}),(0,L.jsx)(`div`,{className:`text-xl font-semibold`,children:f.volumeMl==null?`n/a`:`${f.volumeMl.toFixed(1)} mL`}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`per dose`})]})]})})]})}var Pe={child:{eye:[[`4`,`4 - Spontaneous`],[`3`,`3 - To speech`],[`2`,`2 - To pain`],[`1`,`1 - None`]],verbal:[[`5`,`5 - Oriented`],[`4`,`4 - Confused`],[`3`,`3 - Inappropriate words`],[`2`,`2 - Incomprehensible sounds`],[`1`,`1 - None`]],motor:[[`6`,`6 - Obeys commands`],[`5`,`5 - Localizes pain`],[`4`,`4 - Withdraws to pain`],[`3`,`3 - Abnormal flexion`],[`2`,`2 - Abnormal extension`],[`1`,`1 - None`]]},infant:{eye:[[`4`,`4 - Spontaneous`],[`3`,`3 - To speech/sound`],[`2`,`2 - To painful stimuli`],[`1`,`1 - None`]],verbal:[[`5`,`5 - Coos/babbles`],[`4`,`4 - Irritable cry`],[`3`,`3 - Cries to pain`],[`2`,`2 - Moans to pain`],[`1`,`1 - None`]],motor:[[`6`,`6 - Normal spontaneous movement`],[`5`,`5 - Withdraws to touch`],[`4`,`4 - Withdraws to pain`],[`3`,`3 - Abnormal flexion`],[`2`,`2 - Abnormal extension`],[`1`,`1 - None`]]}};function $({id:e,labelText:t,value:n,options:r,onChange:i}){return(0,L.jsxs)(`div`,{className:K,children:[(0,L.jsx)(`label`,{htmlFor:e,className:q,children:t}),(0,L.jsx)(`select`,{id:e,value:n,onChange:e=>i(e.target.value),className:J,children:r.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})]})}function Fe(){let[e,t]=(0,l.useState)(`child`),[n,i]=(0,l.useState)(`4`),[a,o]=(0,l.useState)(`5`),[s,c]=(0,l.useState)(`6`),u=r(Number(n),Number(a),Number(s)),d=Pe[e];function f(e){t(e),i(`4`),o(`5`),c(`6`)}return(0,L.jsxs)(`section`,{className:U,"data-testid":`calc-panel-gcs`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Glasgow Coma Scale`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select responses to calculate child/adult or infant-modified GCS. Total score 3-15.`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>f(`child`),className:`px-3 py-1.5 rounded-full text-xs font-medium border `+(e===`child`?`bg-primary text-primary-foreground border-primary`:`bg-muted border-border`),children:`Child / Adult`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>f(`infant`),className:`px-3 py-1.5 rounded-full text-xs font-medium border `+(e===`infant`?`bg-primary text-primary-foreground border-primary`:`bg-muted border-border`),children:`Infant`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,L.jsx)($,{id:`react-gcs-eye`,labelText:`Eye Opening`,value:n,options:d.eye,onChange:i}),(0,L.jsx)($,{id:`react-gcs-verbal`,labelText:`Verbal Response`,value:a,options:d.verbal,onChange:o}),(0,L.jsx)($,{id:`react-gcs-motor`,labelText:`Motor Response`,value:s,options:d.motor,onChange:c})]}),u==null?null:(0,L.jsxs)(`div`,{className:Y,"data-testid":`calc-gcs-result`,children:[(0,L.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:e===`infant`?`Infant-modified GCS`:`Child / adult GCS`}),(0,L.jsxs)(`div`,{className:`text-3xl font-semibold`,children:[`GCS: `,u.total,`/15`]}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u.severity}),(0,L.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:`Interpretation: 13-15 Mild, 9-12 Moderate, 3-8 Severe/Coma.`})]})]})}function Ie({pill:e}){return(0,L.jsxs)(`section`,{className:U,"data-testid":`calc-panel-`+e.id,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary}),(0,L.jsxs)(`div`,{className:`rounded-md border border-amber-300 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm space-y-2`,children:[(0,L.jsxs)(`p`,{className:`text-amber-900 dark:text-amber-100`,children:[(0,L.jsx)(`strong`,{children:`Source of truth:`}),` `,e.source,`.`]}),(0,L.jsx)(`p`,{className:`text-amber-900 dark:text-amber-100`,children:`This calculator runs in the legacy viewer. A React port is gated on capturing test vectors from the vanilla implementation so the numerical output can be verified byte-for-byte — the migration checkpoint specifically flags this class of data as the one an LLM is most likely to silently simplify.`})]}),(0,L.jsx)(`a`,{href:`/#calculators`,className:W+` inline-block`,children:`Open in legacy viewer`})]})}function Le(){let[e,t]=(0,l.useState)(`aap`),[n,r]=(0,l.useState)(`38`),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(`low`),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(``);function _(){let t=Number(i),r=Number(o);if(!Number.isFinite(t)||!Number.isFinite(r)||t<=0||r<=0){g(`Enter hours of life and TSB (mg/dL).`),f(null),m(null);return}if(g(``),e===`aap`){let e=Number(n);if(!Number.isFinite(e)||e<35){g(`AAP 2022 thresholds apply to GA ≥35 weeks.`),f(null);return}f(D(e,t,r,c)),m(null)}else m(re(t,r)),f(null)}let v=d?d.status===`Above Exchange`?`text-red-800 bg-red-100`:d.status===`Above Phototherapy`?`text-red-700 bg-red-50`:`text-green-700 bg-green-50`:``,y=p?p.zone===`High-Risk`?`text-red-800 bg-red-100`:p.zone===`High-Intermediate`?`text-orange-700 bg-orange-50`:p.zone===`Low-Intermediate`?`text-amber-700 bg-amber-50`:`text-green-700 bg-green-50`:``;return(0,L.jsxs)(`section`,{className:U,"data-testid":`calc-panel-bili`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Bilirubin`}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>t(`aap`),className:`px-3 py-1 rounded text-xs font-medium `+(e===`aap`?`bg-primary text-primary-foreground`:`bg-muted`),"data-testid":`bili-mode-aap`,children:`AAP 2022 Phototherapy`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>t(`bhutani`),className:`px-3 py-1 rounded text-xs font-medium `+(e===`bhutani`?`bg-primary text-primary-foreground`:`bg-muted`),"data-testid":`bili-mode-bhutani`,children:`Bhutani Nomogram`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e===`aap`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:K,children:[(0,L.jsx)(`label`,{htmlFor:`bili-ga`,className:q,children:`GA (weeks)`}),(0,L.jsx)(`select`,{id:`bili-ga`,className:J,value:n,onChange:e=>r(e.target.value),children:[35,36,37,38,39,40].map(e=>(0,L.jsxs)(`option`,{value:e,children:[e,e===40?`+`:``]},e))})]}),(0,L.jsxs)(`div`,{className:K,children:[(0,L.jsx)(`label`,{htmlFor:`bili-risk`,className:q,children:`Neurotoxicity risk`}),(0,L.jsxs)(`select`,{id:`bili-risk`,className:J,value:c,onChange:e=>u(e.target.value),children:[(0,L.jsx)(`option`,{value:`low`,children:`No risk factors`}),(0,L.jsx)(`option`,{value:`medium`,children:`With risk factors`})]})]})]}),(0,L.jsx)(Q,{id:`bili-hours`,labelText:`Age (hours)`,value:i,onChange:a,min:`0`,max:`336`,placeholder:`48`}),(0,L.jsx)(Q,{id:`bili-tsb`,labelText:`TSB (mg/dL)`,value:o,onChange:s,min:`0`,max:`50`,placeholder:`15`})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,className:W,onClick:_,"data-testid":`calc-bili-calculate`,children:`Calculate`}),(0,L.jsx)(`button`,{type:`button`,className:G,onClick:()=>{a(``),s(``),f(null),m(null),g(``)},children:`Clear`})]}),h&&(0,L.jsx)(`div`,{className:X,children:h}),d&&(0,L.jsxs)(`div`,{className:Y+` space-y-2`,"data-testid":`calc-bili-aap-result`,children:[(0,L.jsx)(`div`,{className:`inline-block px-2 py-1 rounded text-sm font-bold `+v,children:d.status}),(0,L.jsxs)(`div`,{className:`text-sm`,children:[`TSB `,o,` mg/dL at `,i,` hours of life (GA `,n,`w `,c===`medium`?`with`:`without`,` risk factors)`]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Phototherapy`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[d.photoThreshold.toFixed(1),` mg/dL`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Exchange`}),(0,L.jsxs)(`div`,{className:`font-semibold text-red-800`,children:[d.exchangeThreshold.toFixed(1),` mg/dL`]})]})]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP 2022 CPG (Kemper et al.). Always use clinical judgment.`})]}),p&&(0,L.jsxs)(`div`,{className:Y+` space-y-2`,"data-testid":`calc-bili-bhutani-result`,children:[(0,L.jsxs)(`div`,{className:`inline-block px-2 py-1 rounded text-sm font-bold `+y,children:[p.zone,` Zone`]}),(0,L.jsxs)(`div`,{className:`text-sm`,children:[`TSB `,o,` mg/dL at `,i,` hours of life`]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`40th %ile`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:p.p40.toFixed(1)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`75th %ile`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:p.p75.toFixed(1)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`95th %ile`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:p.p95.toFixed(1)})]})]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Bhutani 1999 hour-specific risk nomogram for infants ≥35 weeks GA.`})]})]})}function Re(){let[e,t]=(0,l.useState)(`male`),[n,r]=(0,l.useState)(``),[a,o]=(0,l.useState)(``),[s,u]=(0,l.useState)(null),[d,f]=(0,l.useState)(``);function p(){let t=Number(n),r=Number(a);if(!Number.isFinite(t)||!Number.isFinite(r)||t<22||t>50||r<=0){f(`Enter GA (22-50 weeks) and weight (grams).`),u(null);return}f(``),u(i(t,r,e))}let m=s?c(s.percentile):null,h=m===`SGA`?`text-orange-700 bg-orange-50`:m===`LGA`?`text-amber-700 bg-amber-50`:`text-green-700 bg-green-50`;return(0,L.jsxs)(`section`,{className:U,"data-testid":`calc-panel-growth`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Fenton 2013 Preterm Growth`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Weight-for-gestational-age Z-score + percentile + SGA/AGA/LGA classification.`}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,L.jsxs)(`div`,{className:K,children:[(0,L.jsx)(`label`,{htmlFor:`fenton-sex`,className:q,children:`Sex`}),(0,L.jsxs)(`select`,{id:`fenton-sex`,className:J,value:e,onChange:e=>t(e.target.value),children:[(0,L.jsx)(`option`,{value:`male`,children:`Male`}),(0,L.jsx)(`option`,{value:`female`,children:`Female`})]})]}),(0,L.jsx)(Q,{id:`fenton-ga`,labelText:`GA (weeks)`,value:n,onChange:r,min:`22`,max:`50`,step:`0.1`,placeholder:`32`}),(0,L.jsx)(Q,{id:`fenton-weight`,labelText:`Weight (g)`,value:a,onChange:o,min:`200`,max:`7000`,step:`10`,placeholder:`1500`})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,className:W,onClick:p,"data-testid":`calc-fenton-calculate`,children:`Calculate`}),(0,L.jsx)(`button`,{type:`button`,className:G,onClick:()=>{r(``),o(``),u(null),f(``)},children:`Clear`})]}),d&&(0,L.jsx)(`div`,{className:X,children:d}),s&&m&&(0,L.jsxs)(`div`,{className:Y+` space-y-2`,"data-testid":`calc-fenton-result`,children:[(0,L.jsx)(`div`,{className:`inline-block px-2 py-1 rounded text-sm font-bold `+h,children:m}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 text-sm`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Percentile`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[s.percentile.toFixed(1),`%`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Z-score`}),(0,L.jsx)(`div`,{className:`font-semibold`,children:s.z.toFixed(2)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Median (M)`}),(0,L.jsxs)(`div`,{className:`font-semibold`,children:[Math.round(s.M),` g`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`L / S`}),(0,L.jsxs)(`div`,{className:`font-mono text-xs`,children:[s.L.toFixed(3),` / `,s.S.toFixed(3)]})]})]}),(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Fenton TR, Kim JH. Systematic review — revised Fenton growth chart for preterm infants. BMC Pediatr 2013;13:59.`})]})]})}function ze({pill:e}){return e.id===`bsa`?(0,L.jsx)(Me,{}):e.id===`dose`?(0,L.jsx)(Ne,{}):e.id===`gcs`?(0,L.jsx)(Fe,{}):e.id===`bili`?(0,L.jsx)(Le,{}):e.id===`growth`?(0,L.jsx)(Re,{}):e.id===`bmi`?(0,L.jsx)(xe,{}):e.id===`vitals`?(0,L.jsx)(we,{}):e.id===`resus`?(0,L.jsx)(De,{}):e.id===`equipment`?(0,L.jsx)(Ae,{}):e.id===`bp`?(0,L.jsx)(be,{}):(0,L.jsx)(Ie,{pill:e})}function Be(){let[e,t]=(0,l.useState)(Z[0].id),n=Z.find(t=>t.id===e)??Z[0];return(0,L.jsxs)(`div`,{className:`max-w-5xl mx-auto p-6 space-y-4`,children:[(0,L.jsxs)(`header`,{children:[(0,L.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Calculators`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pediatric calculators — BP percentiles, bilirubin thresholds, growth, dosing, equipment sizing. Simple pure-formula calculators run in React now; high-risk table-driven calculators remain legacy-gated until vectors are captured.`})]}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`calc-subnav`,children:Z.map(n=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors `+(e===n.id?`bg-primary text-primary-foreground border-primary`:`bg-muted hover:bg-muted/80 border-border`),"data-testid":`calc-pill-`+n.id,children:[n.label,n.ported?(0,L.jsx)(`span`,{className:`ml-1 text-[10px] opacity-80`,children:`React`}):null]},n.id))}),(0,L.jsx)(ze,{pill:n})]})}export{Be as default}; \ No newline at end of file diff --git a/public/app/assets/Catchup-B8pTp8ZN.js b/public/app/assets/Catchup-B8pTp8ZN.js new file mode 100644 index 0000000..d8f4c5f --- /dev/null +++ b/public/app/assets/Catchup-B8pTp8ZN.js @@ -0,0 +1 @@ +import{t as e}from"./jsx-runtime-ByY1xr43.js";import{i as t,o as n}from"./index-B0uH73Hx.js";var r=e();function i(){let{data:e,isLoading:i,error:a}=n({queryKey:[`schedule-data`],queryFn:()=>t.get(`/api/schedule-data`)});return i?(0,r.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading…`}):a?(0,r.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:a.message}):e?(0,r.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,r.jsxs)(`header`,{children:[(0,r.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Catch-Up Schedule`}),(0,r.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`CDC 2025 catch-up immunization schedule — minimum ages and intervals per vaccine.`})]}),Object.entries(e.catchUpSchedule).map(([t,n])=>{let i=e.vaccineFullNames[t]||t,a=n.catchUpNotes?Array.isArray(n.catchUpNotes)?n.catchUpNotes:[n.catchUpNotes]:[];return(0,r.jsxs)(`section`,{className:`rounded-lg border border-border bg-card overflow-hidden`,children:[(0,r.jsxs)(`header`,{className:`px-4 py-2 border-b border-border bg-muted/40 flex items-center justify-between`,children:[(0,r.jsx)(`h2`,{className:`text-sm font-semibold`,children:i}),n.minimumAgeForDose1&&(0,r.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Min age dose 1: `,(0,r.jsx)(`strong`,{children:n.minimumAgeForDose1})]})]}),n.series&&n.series.length>0&&(0,r.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,r.jsx)(`thead`,{className:`bg-muted/20`,children:(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Dose`}),(0,r.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Min age`}),(0,r.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Min interval from prev`}),(0,r.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Notes`})]})}),(0,r.jsx)(`tbody`,{children:n.series.map(e=>(0,r.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,r.jsxs)(`td`,{className:`px-3 py-2 font-semibold`,children:[`Dose `,e.dose]}),(0,r.jsx)(`td`,{className:`px-3 py-2`,children:e.minimumAge||`—`}),(0,r.jsx)(`td`,{className:`px-3 py-2`,children:e.minimumIntervalToPrev||`—`}),(0,r.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.notes||``})]},String(e.dose)))})]}),a.length>0&&(0,r.jsx)(`ul`,{className:`list-disc pl-8 py-2 text-xs text-muted-foreground space-y-1`,children:a.map((e,t)=>(0,r.jsx)(`li`,{children:e},t))})]},t)})]}):null}export{i as default}; \ No newline at end of file diff --git a/public/app/assets/ChartReview-BiL3eBLI.js b/public/app/assets/ChartReview-BiL3eBLI.js new file mode 100644 index 0000000..9b3317f --- /dev/null +++ b/public/app/assets/ChartReview-BiL3eBLI.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i}from"./index-B0uH73Hx.js";var a=e(t(),1),o=n();function s(){return{date:``,content:``,labs:``}}function c(){let[e,t]=(0,a.useState)(`outpatient`),[n,c]=(0,a.useState)(``),[l,u]=(0,a.useState)(``),[d,f]=(0,a.useState)(``),[p,m]=(0,a.useState)([s()]),[h,g]=(0,a.useState)(``),[_,v]=(0,a.useState)(null),y=r({mutationFn:e=>i.post(`/api/generate-chart-review`,e),onSuccess:e=>v(e.review)});function b(e,t){m(n=>n.map((n,r)=>r===e?{...n,...t}:n))}function x(t){t.preventDefault(),v(null);let r=p.filter(e=>e.content.trim());y.mutate({type:e,patientAge:n,patientGender:l,pmh:d,visits:e===`outpatient`?r:void 0,subspecialty:e===`subspecialty`?r:void 0,edVisits:e===`ed`?r:void 0,additionalInstructions:h||void 0})}let S=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,o.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,o.jsxs)(`header`,{children:[(0,o.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Chart Review`}),(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Past visits → summary for pre-charting.`})]}),(0,o.jsxs)(`form`,{onSubmit:x,className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`grid grid-cols-4 gap-3`,children:[(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Review type`}),(0,o.jsxs)(`select`,{className:S,value:e,onChange:e=>t(e.target.value),children:[(0,o.jsx)(`option`,{value:`outpatient`,children:`Outpatient`}),(0,o.jsx)(`option`,{value:`subspecialty`,children:`Subspecialty`}),(0,o.jsx)(`option`,{value:`ed`,children:`ED`})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,o.jsx)(`input`,{className:S,value:n,onChange:e=>c(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,o.jsxs)(`select`,{className:S,value:l,onChange:e=>u(e.target.value),children:[(0,o.jsx)(`option`,{value:``,children:`Select`}),(0,o.jsx)(`option`,{children:`Male`}),(0,o.jsx)(`option`,{children:`Female`})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`PMH`}),(0,o.jsx)(`input`,{className:S,value:d,onChange:e=>f(e.target.value)})]})]}),(0,o.jsxs)(`div`,{className:`space-y-3`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsx)(`span`,{className:`text-sm font-semibold`,children:`Visits`}),(0,o.jsx)(`button`,{type:`button`,onClick:()=>m(e=>[...e,s()]),className:`text-xs rounded-md border border-border px-2 py-1`,children:`+ Add visit`})]}),p.map((e,t)=>(0,o.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-2 bg-card`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`input`,{type:`date`,className:S+` max-w-xs`,value:e.date,onChange:e=>b(t,{date:e.target.value})}),p.length>1&&(0,o.jsx)(`button`,{type:`button`,onClick:()=>m(e=>e.filter((e,n)=>n!==t)),className:`text-xs text-destructive`,children:`Remove`})]}),(0,o.jsx)(`textarea`,{className:S+` min-h-[100px] font-mono text-sm`,placeholder:`Visit note content — paste here.`,value:e.content,onChange:e=>b(t,{content:e.target.value})}),(0,o.jsx)(`textarea`,{className:S+` min-h-[60px] font-mono text-xs`,placeholder:`Labs from this visit (optional)`,value:e.labs,onChange:e=>b(t,{labs:e.target.value})})]},t))]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Additional instructions`}),(0,o.jsx)(`textarea`,{className:S+` min-h-[60px] text-sm`,placeholder:`e.g. 'Focus on thyroid management', 'Highlight medication changes'`,value:h,onChange:e=>g(e.target.value)})]}),y.error&&(0,o.jsx)(`div`,{className:`text-sm text-destructive`,children:y.error.message}),(0,o.jsx)(`button`,{type:`submit`,disabled:y.isPending||!p.some(e=>e.content.trim()),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:y.isPending?`Generating…`:`Generate Chart Review`})]}),_&&(0,o.jsxs)(`section`,{className:`rounded-lg border border-border bg-card`,children:[(0,o.jsxs)(`header`,{className:`px-4 py-2 border-b border-border flex items-center justify-between bg-muted/40`,children:[(0,o.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Chart Review`}),(0,o.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(_),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,o.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:_})]})]})}export{c as default}; \ No newline at end of file diff --git a/public/app/assets/ConfirmModal-zYA0ebt6.js b/public/app/assets/ConfirmModal-zYA0ebt6.js new file mode 100644 index 0000000..d60df62 --- /dev/null +++ b/public/app/assets/ConfirmModal-zYA0ebt6.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";var r=e(t(),1),i=n();function a({open:e,title:t,body:n,confirmText:a=`Confirm`,cancelText:o=`Cancel`,danger:s=!1,requirePassword:c=!1,passwordPlaceholder:l=`Password`,onConfirm:u,onCancel:d,busy:f=!1}){let[p,m]=(0,r.useState)(``);if((0,r.useEffect)(()=>{e||m(``)},[e]),(0,r.useEffect)(()=>{function t(t){e&&t.key===`Escape`&&d()}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,d]),!e)return null;let h=f||c&&!p;return(0,i.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`confirm-modal-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,onClick:d,children:(0,i.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg border border-border bg-background p-5 shadow-lg space-y-3`,onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(`h3`,{id:`confirm-modal-title`,className:`text-base font-semibold`,children:t}),n&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),c&&(0,i.jsx)(`input`,{type:`password`,autoFocus:!0,value:p,onChange:e=>m(e.target.value),placeholder:l,className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,onKeyDown:e=>{e.key===`Enter`&&!h&&u(p)}}),(0,i.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:d,className:`rounded-md border border-border px-3 py-2 text-sm`,"data-testid":`confirm-modal-cancel`,children:o}),(0,i.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>u(c?p:void 0),className:`rounded-md px-3 py-2 text-sm font-medium text-white disabled:opacity-50 `+(s?`bg-destructive`:`bg-primary`),"data-testid":`confirm-modal-ok`,children:f?`Working…`:a})]})]})})}export{a as t}; \ No newline at end of file diff --git a/public/app/assets/Dictation-BOzE18pb.js b/public/app/assets/Dictation-BOzE18pb.js new file mode 100644 index 0000000..18d10ae --- /dev/null +++ b/public/app/assets/Dictation-BOzE18pb.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i,t as a}from"./index-B0uH73Hx.js";var o=e(t(),1),s=n();function c(){let[e,t]=(0,o.useState)(``),[n,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(`outpatient`),[d,f]=(0,o.useState)(``),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(null),_=r({mutationFn:e=>i.post(`/api/generate-hpi-dictation`,e),onSuccess:e=>m(e.hpi),onError:()=>m(null)});function v(t){t.preventDefault(),g(null);let r={transcript:d,patientAge:e,patientGender:n,setting:l},i=a.safeParse(r);if(!i.success){g(i.error.issues.map(e=>e.message).join(`, `));return}m(null),_.mutate(i.data)}function y(){f(``),m(null),g(null)}let b=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,s.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,s.jsxs)(`header`,{children:[(0,s.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Voice Dictation → HPI`}),(0,s.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Dictate your narrative → AI restructures into polished HPI. Audio-capture UI is a follow-up; this minimal form supports typed/pasted transcripts.`})]}),(0,s.jsxs)(`form`,{onSubmit:v,className:`space-y-4`,children:[(0,s.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,s.jsx)(`input`,{className:b,placeholder:`e.g. 8 months`,value:e,onChange:e=>t(e.target.value)})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,s.jsxs)(`select`,{className:b,value:n,onChange:e=>c(e.target.value),children:[(0,s.jsx)(`option`,{value:``,children:`Select`}),(0,s.jsx)(`option`,{children:`Male`}),(0,s.jsx)(`option`,{children:`Female`})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Setting`}),(0,s.jsxs)(`select`,{className:b,value:l,onChange:e=>u(e.target.value),children:[(0,s.jsx)(`option`,{value:`outpatient`,children:`Outpatient`}),(0,s.jsx)(`option`,{value:`inpatient`,children:`Inpatient / Floors`})]})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Transcript / dictation`}),(0,s.jsx)(`button`,{type:`button`,onClick:y,className:`text-xs text-muted-foreground underline`,children:`Clear`})]}),(0,s.jsx)(`textarea`,{className:b+` min-h-[200px] font-mono text-sm`,placeholder:`Type or paste your dictation here, then click Generate.`,value:d,onChange:e=>f(e.target.value)})]}),h&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:h}),_.error&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:_.error.message}),(0,s.jsx)(`div`,{className:`flex gap-2`,children:(0,s.jsx)(`button`,{type:`submit`,disabled:_.isPending||!d.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:_.isPending?`Generating…`:`Generate HPI`})})]}),p&&(0,s.jsxs)(`section`,{className:`rounded-lg border border-border bg-card`,children:[(0,s.jsxs)(`header`,{className:`px-4 py-2 border-b border-border flex items-center justify-between bg-muted/40`,children:[(0,s.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Generated HPI`}),(0,s.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(p),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,s.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:p})]})]})}export{c as default}; \ No newline at end of file diff --git a/public/app/assets/Encounter-Bke3XfMa.js b/public/app/assets/Encounter-Bke3XfMa.js new file mode 100644 index 0000000..87035a0 --- /dev/null +++ b/public/app/assets/Encounter-Bke3XfMa.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i,t as a}from"./index-B0uH73Hx.js";var o=e(t(),1),s=n();function c(){let[e,t]=(0,o.useState)(``),[n,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(`outpatient`),[d,f]=(0,o.useState)(``),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(null),_=r({mutationFn:e=>i.post(`/api/generate-hpi-encounter`,e),onSuccess:e=>m(e.hpi)});function v(t){t.preventDefault(),g(null);let r={transcript:d,patientAge:e,patientGender:n,setting:l},i=a.safeParse(r);if(!i.success){g(i.error.issues.map(e=>e.message).join(`, `));return}m(null),_.mutate(i.data)}let y=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,s.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,s.jsxs)(`header`,{children:[(0,s.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Live Encounter → HPI`}),(0,s.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Record or paste an encounter transcript; generate a structured HPI.`})]}),(0,s.jsxs)(`form`,{onSubmit:v,className:`space-y-4`,children:[(0,s.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,s.jsx)(`input`,{className:y,placeholder:`e.g. 5 years`,value:e,onChange:e=>t(e.target.value)})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,s.jsxs)(`select`,{className:y,value:n,onChange:e=>c(e.target.value),children:[(0,s.jsx)(`option`,{value:``,children:`Select`}),(0,s.jsx)(`option`,{children:`Male`}),(0,s.jsx)(`option`,{children:`Female`})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Setting`}),(0,s.jsxs)(`select`,{className:y,value:l,onChange:e=>u(e.target.value),children:[(0,s.jsx)(`option`,{value:`outpatient`,children:`Outpatient`}),(0,s.jsx)(`option`,{value:`inpatient`,children:`Inpatient / Floors`})]})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Transcript`}),(0,s.jsx)(`textarea`,{className:y+` min-h-[220px] font-mono text-sm`,placeholder:`Type or paste an encounter transcript, then click Generate.`,value:d,onChange:e=>f(e.target.value)})]}),h&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:h}),_.error&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:_.error.message}),(0,s.jsx)(`button`,{type:`submit`,disabled:_.isPending||!d.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:_.isPending?`Generating…`:`Generate HPI`})]}),p&&(0,s.jsxs)(`section`,{className:`rounded-lg border border-border bg-card`,children:[(0,s.jsxs)(`header`,{className:`px-4 py-2 border-b border-border flex items-center justify-between bg-muted/40`,children:[(0,s.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Generated HPI`}),(0,s.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(p),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,s.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:p})]})]})}export{c as default}; \ No newline at end of file diff --git a/public/app/assets/HospitalCourse-BhtMwZ57.js b/public/app/assets/HospitalCourse-BhtMwZ57.js new file mode 100644 index 0000000..63cb3d7 --- /dev/null +++ b/public/app/assets/HospitalCourse-BhtMwZ57.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i}from"./index-B0uH73Hx.js";var a=e(t(),1),o=n();function s(){let[e,t]=(0,a.useState)(``),[n,s]=(0,a.useState)(``),[c,l]=(0,a.useState)(``),[u,d]=(0,a.useState)(`floor`),[f,p]=(0,a.useState)(``),[m,h]=(0,a.useState)(`auto`),[g,_]=(0,a.useState)(``),[v,y]=(0,a.useState)(``),[b,x]=(0,a.useState)(``),[S,C]=(0,a.useState)(null),w=r({mutationFn:e=>i.post(`/api/generate-hospital-course`,e),onSuccess:e=>C({hospitalCourse:e.hospitalCourse,format:e.format||`auto`})});function T(t){t.preventDefault(),C(null);let r=v.split(/\n\s*\n/).map(e=>e.trim()).filter(Boolean).map((e,t)=>({date:`Day ${t+1}`,type:`Progress Note`,content:e}));w.mutate({notes:r,hAndP:g?{date:`Admission`,content:g}:void 0,patientAge:e,patientGender:n,pmh:c,setting:u,los:f?parseInt(f):void 0,formatPreference:m,additionalInstructions:b||void 0})}let E=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,o.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,o.jsxs)(`header`,{children:[(0,o.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Hospital Course`}),(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Progress notes + H&P → hospital course summary (prose, day-by-day, or organ-system format).`})]}),(0,o.jsxs)(`form`,{onSubmit:T,className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,o.jsx)(`input`,{className:E,value:e,onChange:e=>t(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,o.jsxs)(`select`,{className:E,value:n,onChange:e=>s(e.target.value),children:[(0,o.jsx)(`option`,{value:``,children:`Select`}),(0,o.jsx)(`option`,{children:`Male`}),(0,o.jsx)(`option`,{children:`Female`})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Setting`}),(0,o.jsxs)(`select`,{className:E,value:u,onChange:e=>d(e.target.value),children:[(0,o.jsx)(`option`,{value:`floor`,children:`Floor`}),(0,o.jsx)(`option`,{value:`picu`,children:`PICU`}),(0,o.jsx)(`option`,{value:`nicu`,children:`NICU`}),(0,o.jsx)(`option`,{value:`psych`,children:`Psych`})]})]})]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,o.jsxs)(`label`,{className:`flex flex-col gap-1 col-span-2`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`PMH`}),(0,o.jsx)(`input`,{className:E,placeholder:`e.g. Asthma, hypothyroidism`,value:c,onChange:e=>l(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`LOS (days)`}),(0,o.jsx)(`input`,{className:E,type:`number`,value:f,onChange:e=>p(e.target.value)})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Format`}),(0,o.jsxs)(`select`,{className:E,value:m,onChange:e=>h(e.target.value),children:[(0,o.jsx)(`option`,{value:`auto`,children:`Auto (infer from setting + LOS)`}),(0,o.jsx)(`option`,{value:`prose`,children:`Prose summary`}),(0,o.jsx)(`option`,{value:`dayByDay`,children:`Day-by-day`}),(0,o.jsx)(`option`,{value:`organSystem`,children:`Organ-system (ICU)`})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`H&P`}),(0,o.jsx)(`textarea`,{className:E+` min-h-[120px] font-mono text-sm`,value:g,onChange:e=>_(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsxs)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Progress notes `,(0,o.jsx)(`span`,{className:`normal-case font-normal text-muted-foreground`,children:`(separate each note with a blank line)`})]}),(0,o.jsx)(`textarea`,{className:E+` min-h-[200px] font-mono text-sm`,value:v,onChange:e=>y(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Additional instructions`}),(0,o.jsx)(`textarea`,{className:E+` min-h-[60px] text-sm`,value:b,onChange:e=>x(e.target.value)})]}),w.error&&(0,o.jsx)(`div`,{className:`text-sm text-destructive`,children:w.error.message}),(0,o.jsx)(`button`,{type:`submit`,disabled:w.isPending||!v.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:w.isPending?`Generating…`:`Generate Hospital Course`})]}),S&&(0,o.jsxs)(`section`,{className:`rounded-lg border border-border bg-card`,children:[(0,o.jsxs)(`header`,{className:`px-4 py-2 border-b border-border flex items-center justify-between bg-muted/40`,children:[(0,o.jsxs)(`h2`,{className:`text-sm font-semibold`,children:[`Hospital Course `,(0,o.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,S.format,`)`]})]}),(0,o.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(S.hospitalCourse),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,o.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:S.hospitalCourse})]})]})}export{s as default}; \ No newline at end of file diff --git a/public/app/assets/Learning-DHnt_HCY.js b/public/app/assets/Learning-DHnt_HCY.js new file mode 100644 index 0000000..7325096 --- /dev/null +++ b/public/app/assets/Learning-DHnt_HCY.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i,o as a,s as o}from"./index-B0uH73Hx.js";var s=e(t(),1),c=n(),l=`rounded-lg border border-border bg-card p-5 space-y-3`,u=`px-3 py-1 rounded-full text-xs font-medium border transition-colors cursor-pointer`,d=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,f=`rounded-md bg-primary text-primary-foreground px-3 py-2 text-sm font-medium disabled:opacity-50`,p=`rounded-md border border-border px-3 py-2 text-sm disabled:opacity-50`;function m(e){switch(e){case`quiz`:return`Quiz`;case`pearl`:return`Pearl`;case`presentation`:return`Slides`;default:return`Article`}}function h({row:e,onOpen:t}){return(0,c.jsxs)(`button`,{type:`button`,onClick:t,className:`w-full text-left rounded-lg border border-border bg-card hover:bg-muted/60 p-4 transition-colors`,"data-testid":`lh-feed-item-`+e.slug,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground uppercase tracking-wide mb-1`,children:[(0,c.jsx)(`span`,{className:`font-semibold`,children:m(e.content_type)}),e.category_name&&(0,c.jsxs)(`span`,{children:[`· `,e.category_name]}),e.question_count?(0,c.jsxs)(`span`,{children:[`· `,e.question_count,` Q`]}):null]}),(0,c.jsx)(`div`,{className:`text-sm font-semibold`,children:e.title}),e.subject&&(0,c.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5 truncate`,children:e.subject})]})}function g({filter:e,query:t,onOpen:n}){let{data:r,isLoading:o,error:s}=a({queryKey:t?[`learning-search`,t]:e?[`learning-category`,e]:[`learning-feed`],queryFn:()=>t?i.get(`/api/learning/search?q=`+encodeURIComponent(t)):e?i.get(`/api/learning/category/`+encodeURIComponent(e)):i.get(`/api/learning/feed?limit=30`)});if(o)return(0,c.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`});if(s)return(0,c.jsx)(`div`,{className:`text-sm text-destructive`,children:s.message});let l=r?.content||[];return l.length===0?(0,c.jsx)(`div`,{className:`text-sm text-muted-foreground italic py-4`,children:`No content found.`}):(0,c.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,"data-testid":`lh-feed`,children:l.map(e=>(0,c.jsx)(h,{row:e,onOpen:()=>n(e.slug)},e.id))})}function _(e){let t={};for(let n of e)t[n.id]={optionIds:new Set};return t}function v({content:e,onReset:t}){let n=o(),[a,u]=(0,s.useState)(()=>_(e.questions)),[d,m]=(0,s.useState)(null),[h,g]=(0,s.useState)(null),v=r({mutationFn:e=>i.post(`/api/learning/submit-quiz`,e),onSuccess:t=>{m(t),n.invalidateQueries({queryKey:[`learning-content`,e.slug]})},onError:e=>g(e.message||`Submit failed`)});function y(t){t.preventDefault(),g(null);let n=e.questions.map(e=>{let t=a[e.id];return e.question_type===`multi`?{questionId:e.id,optionIds:Array.from(t?.optionIds||[])}:{questionId:e.id,optionId:t?.optionId??null}});v.mutate({contentId:e.id,answers:n})}function b(e,t){u(n=>({...n,[e.id]:{optionId:t,optionIds:new Set}}))}function x(e,t){u(n=>{let r=new Set(n[e.id]?.optionIds||[]);return r.has(t)?r.delete(t):r.add(t),{...n,[e.id]:{optionIds:r}}})}if(d){let n=d.percentage>=80?`bg-green-600`:d.percentage>=50?`bg-amber-500`:`bg-destructive`;return(0,c.jsxs)(`section`,{className:l,"data-testid":`lh-quiz-results`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,c.jsx)(`h3`,{className:`text-base font-semibold`,children:`Results`}),(0,c.jsxs)(`span`,{className:`px-2 py-0.5 rounded text-xs font-semibold text-white `+n,"data-testid":`lh-quiz-score`,children:[d.score,`/`,d.total,` (`,d.percentage,`%)`]})]}),(0,c.jsx)(`div`,{className:`space-y-3`,children:d.results.map((e,t)=>(0,c.jsxs)(`div`,{className:`rounded-md border border-border p-3 bg-muted/30`,children:[(0,c.jsxs)(`div`,{className:`text-sm font-medium`,children:[(0,c.jsx)(`span`,{className:e.isCorrect?`text-green-600`:`text-destructive`,children:e.isCorrect?`✓`:`✗`}),` `,`Q`,t+1,`: `,e.questionText]}),!e.isCorrect&&e.correctOptionText&&(0,c.jsxs)(`div`,{className:`text-xs text-green-700 mt-1`,children:[(0,c.jsx)(`strong`,{children:`Correct:`}),` `,e.correctOptionText]}),!e.isCorrect&&e.selectedExplanation&&(0,c.jsxs)(`div`,{className:`text-xs text-destructive mt-1`,children:[(0,c.jsx)(`strong`,{children:`Why incorrect:`}),` `,e.selectedExplanation]}),e.generalExplanation&&(0,c.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.generalExplanation})]},e.questionId))}),(0,c.jsxs)(`div`,{className:`flex gap-2`,children:[(0,c.jsx)(`button`,{type:`button`,className:p,onClick:()=>{m(null),u(_(e.questions))},children:`Retake`}),(0,c.jsx)(`button`,{type:`button`,className:f,onClick:t,children:`Back to Feed`})]})]})}return(0,c.jsxs)(`section`,{className:l,"data-testid":`lh-quiz`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,c.jsx)(`h3`,{className:`text-base font-semibold`,children:`Quiz`}),(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.questions.length,` question`,e.questions.length===1?``:`s`]})]}),(0,c.jsxs)(`form`,{onSubmit:y,className:`space-y-4`,children:[e.questions.map((e,t)=>{let n=e.question_type===`multi`,r=e.question_type===`true_false`?`True / False`:n?`Multiple Select`:`Single Choice`;return(0,c.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-2 bg-muted/30`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,c.jsxs)(`span`,{className:`font-semibold`,children:[`Q`,t+1]}),(0,c.jsx)(`span`,{children:r})]}),(0,c.jsx)(`div`,{className:`text-sm font-medium`,children:e.question_text}),n&&(0,c.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Select all that apply`}),(0,c.jsx)(`div`,{className:`space-y-1`,children:e.options.map(t=>{let r=a[e.id],i=n?r?.optionIds.has(t.id)===!0:r?.optionId===t.id;return(0,c.jsxs)(`label`,{className:`flex items-start gap-2 text-sm cursor-pointer hover:bg-muted/50 rounded px-2 py-1`,children:[(0,c.jsx)(`input`,{type:n?`checkbox`:`radio`,name:`q-`+e.id,checked:i,onChange:()=>n?x(e,t.id):b(e,t.id),className:`mt-0.5`}),(0,c.jsx)(`span`,{children:t.option_text})]},t.id)})})]},e.id)}),h&&(0,c.jsx)(`div`,{className:`text-sm text-destructive`,children:h}),(0,c.jsx)(`button`,{type:`submit`,className:f,disabled:v.isPending,"data-testid":`btn-lh-submit-quiz`,children:v.isPending?`Submitting…`:`Submit Answers`})]})]})}function y({slug:e,onBack:t}){let{data:n,isLoading:r,error:o}=a({queryKey:[`learning-content`,e],queryFn:()=>i.get(`/api/learning/content/`+encodeURIComponent(e))});if(r)return(0,c.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`});if(o)return(0,c.jsx)(`div`,{className:`text-sm text-destructive`,children:o.message});if(!n)return null;let s=n.content;return(0,c.jsxs)(`div`,{className:`space-y-4`,children:[(0,c.jsx)(`button`,{type:`button`,className:p,onClick:t,"data-testid":`btn-lh-back`,children:`← Back to Feed`}),(0,c.jsxs)(`section`,{className:l,"data-testid":`lh-viewer`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,c.jsx)(`h2`,{className:`text-xl font-semibold`,"data-testid":`lh-viewer-title`,children:s.title}),(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[m(s.content_type),s.category_name?` · `+s.category_name:``,s.author_name?` · `+s.author_name:``]})]}),s.content_type===`presentation`?(0,c.jsxs)(`div`,{className:`text-center py-8 space-y-3 bg-muted/30 rounded-md`,children:[(0,c.jsx)(`div`,{className:`text-4xl`,children:`📊`}),(0,c.jsx)(`div`,{className:`text-sm font-medium`,children:s.title}),(0,c.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Slide rendering lives in the legacy viewer.`}),(0,c.jsx)(`a`,{href:`/#learning/`+encodeURIComponent(s.slug),className:f+` inline-block`,rel:`noreferrer`,children:`Open in legacy viewer`})]}):(0,c.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed`,"data-testid":`lh-viewer-body`,children:s.body||``})]}),s.progress&&s.progress.length>0&&(0,c.jsxs)(`section`,{className:l,children:[(0,c.jsx)(`h3`,{className:`text-base font-semibold`,children:`Your past attempts`}),(0,c.jsx)(`div`,{className:`space-y-1 text-sm`,children:s.progress.map((e,t)=>{let n=e.total>0?Math.round(e.score/e.total*100):0,r=n>=70?`text-green-600`:`text-amber-600`;return(0,c.jsxs)(`div`,{className:`flex justify-between border-b border-border py-1`,children:[(0,c.jsx)(`span`,{children:new Date(e.completed_at).toLocaleDateString()}),(0,c.jsxs)(`span`,{className:`font-semibold `+r,children:[e.score,`/`,e.total,` (`,n,`%)`]})]},t)})})]}),s.questions&&s.questions.length>0&&(0,c.jsx)(v,{content:s,onReset:t})]})}function b(){let[e,t]=(0,s.useState)(``),[n,r]=(0,s.useState)(``),[o,f]=(0,s.useState)(null),{data:p}=a({queryKey:[`learning-categories`],queryFn:()=>i.get(`/api/learning/categories`)});return o?(0,c.jsx)(`div`,{className:`max-w-4xl mx-auto p-6`,children:(0,c.jsx)(y,{slug:o,onBack:()=>f(null)})}):(0,c.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,c.jsxs)(`header`,{children:[(0,c.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Learning Hub`}),(0,c.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pediatric education, clinical pearls, and self-assessment quizzes.`})]}),(0,c.jsx)(`div`,{className:l,children:(0,c.jsx)(`input`,{type:`search`,className:d,placeholder:`Search topics, subjects…`,value:e,onChange:e=>t(e.target.value),"data-testid":`lh-search`})}),(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`lh-categories`,children:[(0,c.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:u+(n===``?` bg-primary text-primary-foreground border-primary`:` bg-muted hover:bg-muted/80`),children:`All`}),p?.categories.map(e=>(0,c.jsx)(`button`,{type:`button`,onClick:()=>r(e.slug),className:u+(n===e.slug?` bg-primary text-primary-foreground border-primary`:` bg-muted hover:bg-muted/80`),"data-testid":`lh-cat-`+e.slug,children:e.name},e.id))]}),(0,c.jsx)(g,{filter:n,query:e.trim(),onOpen:e=>f(e)})]})}export{b as default}; \ No newline at end of file diff --git a/public/app/assets/PeGuide-ZAyIHUEG.js b/public/app/assets/PeGuide-ZAyIHUEG.js new file mode 100644 index 0000000..93378bc --- /dev/null +++ b/public/app/assets/PeGuide-ZAyIHUEG.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i}from"./index-B0uH73Hx.js";var a=e(t(),1),o=[`newborn`,`infant`,`toddler`,`preschool`,`school`,`adolescent`],s=[`msk`,`neuro`,`resp`,`cv`],c={msk:`Musculoskeletal`,neuro:`Neuro`,resp:`Respiratory`,cv:`Cardiovascular`},l={newborn:{label:`Newborn (0–28 days)`,msk:{overview:`Exam done warm, quiet, undressed. Focus: birth injury, DDH, congenital anomaly. All steps symmetric.`,components:[{name:`Resting posture`,steps:[{label:`Observe posture`,method:`Place supine and undisturbed for 30s`,normal:`Symmetric flexion at hips, knees, elbows`},{label:`Hand position`,method:`Inspect resting hands`,normal:`Loosely fisted; opens intermittently`},{label:`Symmetry`,method:`Compare left vs right side at rest`,normal:`Mirror-image posture`}],abnormalHints:[`Frog-leg (hypotonia)`,`Asymmetric arm (brachial plexus/clavicle fx)`,`Opisthotonos (CNS)`,`Persistent fisting with thumb in palm`]},{name:`Clavicles`,steps:[{label:`Palpate right clavicle`,method:`Trace from sternoclavicular joint to acromion with index finger`,normal:`Smooth, continuous, no step-off`},{label:`Palpate left clavicle`,method:`Same technique on left side`,normal:`Smooth, continuous`},{label:`Crepitus check`,method:`Light pressure along length of clavicle while gently abducting arm`,normal:`No crepitus, no pain response`}],abnormalHints:[`Palpable step-off or callus (fracture — LGA, shoulder dystocia)`,`Asymmetric Moro on affected side`]},{name:`Hips — DDH screen`,steps:[{label:`Thigh/gluteal folds`,method:`Undress completely; compare skin-fold symmetry`,normal:`Symmetric thigh and gluteal folds`},{label:`Abduction`,method:`Flex hips 90°, abduct simultaneously`,normal:`Both hips abduct to ≥75° symmetrically`},{label:`Barlow maneuver`,method:`Thumb on medial thigh, flex hip 90°, adduct, apply gentle posterior pressure`,normal:`No clunk or movement felt (negative)`},{label:`Ortolani maneuver`,method:`From Barlow position: abduct and lift with fingers on greater trochanter`,normal:`No clunk as hip returns (negative)`},{label:`Galeazzi sign`,method:`Knees flexed together with feet on table; compare knee heights`,normal:`Knees level — no leg-length discrepancy`}],abnormalHints:[`Palpable Ortolani clunk (dislocated, reducible)`,`Barlow clunk (dislocatable)`,`Limited abduction`,`Positive Galeazzi (shortened femur)`]},{name:`Spine and back`,steps:[{label:`Position prone`,method:`Turn infant prone, support chest`,normal:`Tolerates position, lifts head briefly`},{label:`Palpate midline`,method:`Run finger from C-spine to coccyx`,normal:`Straight midline, no step-offs or gaps`},{label:`Sacral inspection`,method:`Inspect sacral dimple if present; measure depth, distance from anus`,normal:`No dimple, or dimple <5mm deep and <2.5cm from anus`},{label:`Cutaneous markers`,method:`Inspect midline skin from neck to coccyx`,normal:`No hair tuft, hemangioma, lipoma, or sinus tract`}],abnormalHints:[`Deep sacral dimple (>5mm) or >2.5cm from anus — imaging`,`Hair tuft, hemangioma, lipoma (occult dysraphism)`,`Palpable defect`]},{name:`Upper extremities`,steps:[{label:`Spontaneous movement`,method:`Observe both arms for 30s`,normal:`Symmetric antigravity movement`},{label:`Digits`,method:`Count and inspect fingers both hands`,normal:`5 digits each, no webbing or duplication`},{label:`Palmar creases`,method:`Inspect palmar creases`,normal:`Normal triradiate creases`}],abnormalHints:[`Erb/Klumpke palsy (paucity of movement)`,`Polydactyly, syndactyly`,`Single transverse (simian) palmar crease`]},{name:`Lower extremities / feet`,steps:[{label:`Hip and knee range`,method:`Gently flex, extend, internally/externally rotate each`,normal:`Full symmetric range, no contracture`},{label:`Foot alignment`,method:`Inspect resting foot position`,normal:`Midline or mildly adducted forefoot`},{label:`Passive correction`,method:`Gently attempt to bring foot to neutral`,normal:`Fully correctable to neutral`},{label:`Stroke test`,method:`Stroke lateral border of foot`,normal:`Foot dorsiflexes and everts reflexively`}],abnormalHints:[`Rigid clubfoot (non-correctable talipes equinovarus)`,`Fixed metatarsus adductus`,`Rocker-bottom foot (trisomy 18)`,`Calcaneovalgus`]}]},neuro:{overview:`Primitive reflexes present and symmetric. Tone assessed passively and actively. Full exam 3–5 min on a quiet, fed infant.`,components:[{name:`Alertness and behavior`,steps:[{label:`State cycling`,method:`Observe over 1–2 min for alert periods`,normal:`Alert periods with spontaneous eye opening`},{label:`Response to voice`,method:`Speak softly near ear`,normal:`Quiets to voice or turns toward sound`},{label:`Consolability`,method:`If crying, attempt to soothe with swaddling or voice`,normal:`Consolable within 1–2 min`}],abnormalHints:[`Lethargy`,`Jitteriness not stopped by passive flexion`,`Irritability unrelieved by feeding`]},{name:`Cranial nerves`,steps:[{label:`CN II — pupil response`,method:`Shine light in each eye`,normal:`Pupils equal, reactive to light, direct and consensual`},{label:`CN II — blink to light`,method:`Bright light in the line of sight`,normal:`Reflex blink`},{label:`CN VII — facial symmetry at rest`,method:`Observe resting face`,normal:`Symmetric nasolabial folds`},{label:`CN VII — facial symmetry with cry`,method:`Note face during a cry`,normal:`Symmetric grimace`},{label:`CN IX, X, XII — suck and swallow`,method:`Offer clean gloved finger, pacifier, or during feed`,normal:`Strong coordinated suck-swallow, no choking`}],abnormalHints:[`Asymmetric face (CN VII injury — usually forceps)`,`Poor suck or uncoordinated swallow`,`Fixed or unequal pupil`]},{name:`Tone — passive`,steps:[{label:`Pull-to-sit`,method:`Grasp hands/wrists, pull smoothly to sit`,normal:`Brief head lag at term; not dramatic`},{label:`Ventral suspension`,method:`Suspend prone over hand at chest`,normal:`Head briefly lifts to horizontal; extremities flexed`},{label:`Arm recoil`,method:`Extend both arms fully at elbows, release`,normal:`Rapid return to flexion`},{label:`Popliteal angle`,method:`Hip flexed 90°, extend knee maximally`,normal:`≤110°`}],abnormalHints:[`Marked head lag (hypotonia)`,`Slip-through on vertical suspension`,`Hypertonia / scissoring`,`Floppy limbs with no recoil`]},{name:`Spontaneous movement`,steps:[{label:`Observe limbs`,method:`Undisturbed over 1 min, note movement`,normal:`Symmetric antigravity movement of all 4 limbs`},{label:`Quality of movement`,method:`Note smoothness vs jitteriness`,normal:`Smooth, mildly variable movements`}],abnormalHints:[`Paucity of movement in one limb`,`Coarse jitteriness`,`Clonic jerks`,`Tonic posturing`]},{name:`Primitive reflexes`,steps:[{label:`Moro`,method:`Support head; allow 30° head drop or loud clap`,normal:`Symmetric arm abduction then flexion, often cry`},{label:`Rooting`,method:`Stroke cheek at corner of mouth`,normal:`Turns head toward stroke and opens mouth`},{label:`Palmar grasp`,method:`Press into palm with finger`,normal:`Strong, symmetric finger flexion`},{label:`Plantar grasp`,method:`Press ball of foot below toes`,normal:`Toes flex around finger symmetrically`},{label:`Stepping`,method:`Hold upright with feet touching surface`,normal:`Alternating stepping movements`},{label:`Tonic neck (fencing)`,method:`Turn head to one side with infant supine`,normal:`Same-side arm extends, opposite flexes (not obligate)`},{label:`Galant`,method:`Stroke paravertebrally from shoulder to buttock, one side`,normal:`Trunk curves toward stroked side`}],abnormalHints:[`Absent or asymmetric Moro — CNS injury, brachial plexus, clavicle fx`,`Absent grasps — CNS depression`,`Obligate tonic neck is abnormal`]},{name:`Babinski (plantar response)`,steps:[{label:`Stroke lateral sole`,method:`Firm stroke from heel toward toes along lateral plantar border`,normal:`Up-going great toe with fanning (normal in newborn)`},{label:`Symmetry check`,method:`Repeat opposite foot`,normal:`Symmetric response`}],abnormalHints:[`Asymmetric response is always abnormal`]}]},resp:{overview:`Newborn respiratory transition — RDS, TTN, pneumonia, meconium aspiration dominate the differential. Normal RR ≤ 60. Grunting is an alarm sign.`,components:[{name:`Inspection`,significance:`Detects distress and localises cause. Silverman score quantifies retraction severity.`,pearl:`Grunting is physiologic PEEP against a partially closed glottis — always a sign of significant lung pathology in a newborn. Never dismiss it as fussy breathing.`,steps:[{label:`Respiratory rate`,method:`Count over full 60 s, quiet and undisturbed.`,normal:`40–60 /min; tachypnea > 60`},{label:`Work of breathing (Silverman)`,method:`Inspect for upper-chest retraction, lower-chest retraction, xiphoid retraction, nasal flaring, grunting. Score 0–2 for each.`,normal:`Total Silverman 0 — no distress`},{label:`Audible sounds`,method:`Listen without stethoscope — stridor? grunting? wheeze across the room?`,normal:`Quiet respirations`},{label:`Colour`,method:`Inspect trunk and mucous membranes for central cyanosis; acrocyanosis (blue hands/feet) is normal in the first days.`,normal:`Pink trunk and mucous membranes`},{label:`Chest shape`,method:`Inspect AP:transverse diameter and symmetry.`,normal:`Slightly barrel-shaped is normal; symmetric`}],abnormalHints:[`Grunting — RDS, pneumonia, sepsis, CHD`,`Retractions + tachypnea — RDS, TTN, pneumothorax`,`Central cyanosis — cyanotic CHD, severe lung disease, persistent pulmonary HTN`,`Asymmetric chest movement — pneumothorax, diaphragmatic hernia`]},{name:`Auscultation`,significance:`Short stethoscope time in neonates because they fuss easily — get the most important zones first.`,pearl:`Listen at the axilla, not just the anterior chest — pneumothorax can sound normal anteriorly. Auscultate both axillae systematically.`,steps:[{label:`Air entry — anterior`,method:`Listen bilaterally at the upper and lower anterior chest.`,normal:`Symmetric bilateral air entry`},{label:`Air entry — axillary`,method:`Listen bilaterally at each axilla — this is the most sensitive area for detecting a small pneumothorax.`,normal:`Clear and symmetric`},{label:`Adventitious sounds`,method:`Listen for transmitted upper-airway sounds, crackles (RDS, pneumonia), grunting sounds.`,normal:`No crackles, no wheeze, clear sounds`},{label:`Inspiration:expiration ratio`,method:`Observe breath-sound timing.`,normal:`Inspiration > expiration in length`}],abnormalHints:[`Asymmetric air entry — pneumothorax, diaphragmatic hernia, endobronchial intubation`,`Fine crackles — RDS, TTN, pneumonia`,`Absent breath sounds unilaterally — pneumothorax or selective intubation`]}]},cv:{overview:`Neonatal CV exam screens for CHD — the window of presentation is short and some lesions (duct-dependent) decompensate within hours of birth. Pre/postductal saturations + femoral pulses are the two fastest screens.`,components:[{name:`Inspection and pre/postductal saturations`,significance:`Pre/postductal SpO₂ differential > 3% suggests a duct-dependent lesion or persistent pulmonary HTN. Universal CCHD screening uses this.`,pearl:`Pulse ox on the right hand = preductal (proximal to PDA insertion). Foot = postductal. Both arms and both legs should match; a differential is a red flag for critical CHD.`,steps:[{label:`Central cyanosis`,method:`Inspect tongue, lips, oral mucosa.`,normal:`Pink mucous membranes`},{label:`Pre/postductal SpO₂`,method:`Measure SpO₂ in right hand (preductal) AND either foot (postductal). Baby must be ≥24 hr old for CCHD screening.`,normal:`Both ≥ 95% AND difference < 3%`},{label:`Peripheral perfusion`,method:`Capillary refill on sternum; note mottling or distal cyanosis.`,normal:`Capillary refill < 2 s, warm pink extremities`},{label:`Precordial activity`,method:`Inspect anterior chest for hyperactive precordium.`,normal:`Not visible or minimally visible`}],abnormalHints:[`Central cyanosis with SpO₂ < 95% → cyanotic CHD workup (4-extremity BP, ECG, hyperoxia test, echo)`,`Differential > 3% (pre > post) → duct-dependent systemic flow (HLHS, coarctation, interrupted arch)`,`Preductal < postductal — persistent pulmonary HTN with reversed shunt`]},{name:`Palpation and auscultation`,significance:`Absent femoral pulses + arm-leg BP gradient = coarctation. Many CHD lesions manifest murmurs only after ductus closes (48–72 h).`,pearl:`Always palpate femoral pulses before discharging any newborn. Absent femorals in a well-appearing baby can be the only finding in a ductal-dependent coarctation — catastrophic if missed.`,steps:[{label:`Apex beat`,method:`Palpate at the 4th ICS left of sternum (apex is higher in newborns).`,normal:`Palpable at 4th ICS, mid-clavicular or just lateral`},{label:`Femoral pulses`,method:`Palpate both femoral pulses at the mid-inguinal point while simultaneously feeling the right brachial pulse — detects delay.`,normal:`Present, symmetric, equal timing with brachial`},{label:`Auscultate each cardiac area`,method:`Use pediatric diaphragm at each classic point; baby quiet if possible.`,normal:`S1 S2 crisp; physiologic flow murmur sometimes present in the first 24–48 h`},{label:`Continuous murmur`,method:`Listen below the left clavicle for a continuous ("machinery") murmur of PDA.`,normal:`No continuous murmur after the first day of life in a term baby`},{label:`Four-limb BP (if any concern)`,method:`Right arm, left arm, both legs.`,normal:`Within 10 mmHg across limbs`}],abnormalHints:[`Absent femoral pulses — coarctation of the aorta (surgical emergency if duct-dependent)`,`Harsh holosystolic at LLSB — VSD`,`Continuous machinery murmur — PDA (expected in preterm; in term > 48 h is abnormal)`,`Gallop S3/S4 — heart failure`,`Single S2 — transposition, truncus, severe AS/PS`]}]}},infant:{label:`Infant (1–12 months)`,msk:{overview:`Continued DDH screen through 6 months. Watch motor progression and symmetry of tone/movement.`,components:[{name:`Hips — continued DDH screen`,steps:[{label:`Thigh-fold symmetry`,method:`Inspect with infant supine, thighs flexed`,normal:`Symmetric folds`},{label:`Barlow/Ortolani (through 3mo)`,method:`As in newborn — thumb medial, flex 90°, adduct+push then abduct+lift`,normal:`Negative bilaterally`},{label:`Abduction (any age)`,method:`Flex 90°, abduct simultaneously`,normal:`≥70° symmetric abduction`},{label:`Galeazzi`,method:`Knees flexed feet flat on exam table`,normal:`Knees equal height`}],abnormalHints:[`Clunk on Barlow/Ortolani (<3mo)`,`Limited abduction`,`Asymmetric folds`,`Positive Galeazzi`]},{name:`Gross-motor milestones (age-appropriate)`,steps:[{label:`Head control`,method:`Prone, pull-to-sit, held upright`,normal:`Age-appropriate: 2mo lifts head 45°; 4mo no head lag`},{label:`Rolling`,method:`Observe on flat surface`,normal:`Rolls back-to-front by 5–6mo`},{label:`Sitting`,method:`Place in sitting position`,normal:`Tripod sit by 6mo; sits without support by 7–8mo`},{label:`Standing`,method:`Support under arms`,normal:`Bears weight by 6mo; pulls to stand by 9mo`}],abnormalHints:[`Milestone delay by ≥2mo`,`Loss of previously attained milestone`,`Asymmetric use of limbs`]},{name:`Spine`,steps:[{label:`Palpate seated`,method:`Run finger along spine with infant sitting or held upright`,normal:`Midline, no step-offs`},{label:`Back curvature`,method:`Inspect sitting and lying`,normal:`Physiologic gentle kyphosis in early infancy; lumbar lordosis as sitting develops`}],abnormalHints:[`Fixed kyphoscoliosis`,`Sacral dimple with cutaneous marker`,`Step-off`]},{name:`Extremities`,steps:[{label:`Passive range`,method:`Through each major joint`,normal:`Full symmetric range`},{label:`Joint inspection`,method:`Inspect for swelling, warmth, effusion`,normal:`No swelling, warmth, or effusion`},{label:`Feet alignment`,method:`Observe standing if pulling up, else passive positioning`,normal:`Correctable or aligned feet; flexible`}],abnormalHints:[`Joint swelling/warmth (septic vs reactive arthritis)`,`Rigid clubfoot`,`Persistent asymmetric tone`]}]},neuro:{overview:`Primitive reflexes fading on schedule; protective reflexes emerging; gross motor and tone interlinked.`,components:[{name:`Alertness and social engagement`,steps:[{label:`Social smile`,method:`Face-to-face interaction`,normal:`Social smile by 6–8 weeks`},{label:`Tracking`,method:`Move object across visual field`,normal:`180° horizontal tracking by 3mo`},{label:`Engagement`,method:`Face-to-face, voice, toys`,normal:`Age-appropriate reciprocal interaction`}],abnormalHints:[`No social smile by 3mo`,`Absent tracking past 3mo`,`Poor engagement (developmental concern)`]},{name:`Cranial nerves`,steps:[{label:`Pupils`,method:`Light response each eye`,normal:`Equal reactive`},{label:`Eye alignment`,method:`Inspect with gaze forward and in all directions`,normal:`No strabismus past 4mo`},{label:`Facial symmetry`,method:`Observe smile and cry`,normal:`Symmetric`},{label:`Suck and swallow`,method:`Observe feeding`,normal:`Coordinated, no choking`}],abnormalHints:[`Persistent nystagmus`,`Strabismus past 4mo`,`Asymmetric face`]},{name:`Tone`,steps:[{label:`Pull-to-sit`,method:`Gently pull wrists/hands`,normal:`No head lag by 4mo`},{label:`Ventral suspension`,method:`Support prone, observe`,normal:`Head above horizontal, extremities actively flexed (age-dependent)`},{label:`Vertical suspension`,method:`Support under arms, lift`,normal:`Does not slip through hands`}],abnormalHints:[`Persistent head lag past 4mo (hypotonia)`,`Hypertonia / scissoring (UMN)`,`Slip-through on vertical suspension`]},{name:`Primitive reflex integration`,steps:[{label:`Moro`,method:`Head drop or clap`,normal:`Absent by 6mo`},{label:`Palmar grasp`,method:`Press into palm`,normal:`Integrated by 5–6mo; replaced by voluntary grasp`},{label:`Tonic neck`,method:`Turn head to side`,normal:`Absent by 6mo`},{label:`Rooting`,method:`Stroke cheek`,normal:`Absent by 3–4mo`}],abnormalHints:[`Persistence of any primitive reflex past 6mo warrants eval (CP, CNS injury)`]},{name:`Protective and postural reflexes`,steps:[{label:`Parachute`,method:`Held prone, tilt head downward suddenly`,normal:`Symmetric arm extension protectively by 9mo (emerges 6–9mo)`},{label:`Lateral propping`,method:`Seated infant, gentle tilt to one side`,normal:`Arm extends to catch by 6–7mo`},{label:`Landau`,method:`Suspend prone`,normal:`Extends head, spine, legs by 6mo`}],abnormalHints:[`Absent parachute after 12mo (concerning)`,`Asymmetric lateral propping`,`Absent Landau`]}]},resp:{overview:`Infant respiratory disease centers on bronchiolitis, reactive airways, and pneumonia. Normal RR ≤ 50 (< 2 mo: ≤ 60). Infants are obligate nose-breathers — nasal congestion alone can cause significant WOB.`,components:[{name:`Inspection`,significance:`Infant distress signs escalate fast. Nasal flaring, tracheal tug, head bobbing = significant WOB. Apnea in an infant < 2 mo is an emergency.`,pearl:`A quiet infant with retractions is more worrying than a crying one — exhausted infants stop crying and become hypoxic silently.`,steps:[{label:`Respiratory rate`,method:`Count over full 60 s while quiet.`,normal:`< 2 mo: ≤ 60; 2–12 mo: ≤ 50`},{label:`Work of breathing`,method:`Inspect nasal flaring, subcostal/intercostal/suprasternal retractions, tracheal tug, head-bobbing, accessory muscle use.`,normal:`No retractions, effortless breathing`},{label:`Audible sounds`,method:`Stridor? Wheeze across the room? Grunting? Prolonged expiration?`,normal:`Quiet respirations`},{label:`Colour and feeding history`,method:`Central cyanosis? Poor feeding (feeding is an effort marker in infants)?`,normal:`Pink, feeds well`},{label:`Apnea observation`,method:`Watch for ≥ 20-s pauses or pauses < 20 s with bradycardia/cyanosis.`,normal:`No apneas`}],abnormalHints:[`Grunting / persistent retractions — pneumonia, bronchiolitis, CHF`,`Wheeze — bronchiolitis (RSV), asthma, foreign body`,`Stridor — croup (6 mo–6 y), laryngomalacia (infant), foreign body`,`Apnea — bronchiolitis, sepsis, pertussis, seizure`]},{name:`Auscultation`,significance:`Infants have a thin chest wall — sounds transmit widely. Symmetry, wheeze, and crackles are the main findings.`,pearl:`In bronchiolitis, the classical finding is widespread end-inspiratory fine crackles PLUS expiratory wheeze. Tachypnea + retractions in an RSV-season infant confirms.`,steps:[{label:`Air entry — bilateral`,method:`Warm stethoscope; listen at anterior chest and both axillae, both sides.`,normal:`Symmetric air entry`},{label:`Wheeze`,method:`Listen in expiration. Diffuse wheeze = lower airway; focal wheeze = foreign body or local obstruction.`,normal:`No wheeze`},{label:`Crackles`,method:`Listen in late inspiration. Focal = pneumonia; diffuse fine = bronchiolitis.`,normal:`No crackles`},{label:`Prolonged expiration`,method:`Note expiration:inspiration length ratio.`,normal:`Inspiration ≥ expiration`}],abnormalHints:[`Focal crackles + fever — pneumonia`,`Diffuse wheeze + fine crackles in an RSV-season infant — bronchiolitis`,`Silent chest with extreme WOB — impending respiratory failure`]}]},cv:{overview:`Most CHD manifests in the first year as pulmonary blood-flow changes and the ductus closes. Infant CV exam = growth review + inspection + femoral pulses + auscultation. A harsh pan-systolic LLSB murmur in a 6-week-old = VSD until proven otherwise.`,components:[{name:`Inspection and functional assessment`,significance:`Heart failure in infants presents as poor feeding, sweating during feeds (diaphoresis), tachypnea, and poor weight gain. These historical features predict bad exam findings.`,pearl:`Ask "Does the baby sweat while feeding?" — infant CHF presents with diaphoresis on the forehead during feeds, well before peripheral edema appears.`,steps:[{label:`Growth trajectory`,method:`Plot weight-for-age on WHO chart. Failure to thrive raises CHD concern.`,normal:`Tracking ≥ 10th percentile or stable on personal curve`},{label:`Feeding history`,method:`Ask about feed duration, sweating with feeds, tachypnea with feeds, tiring easily.`,normal:`Feeds < 20 min, no diaphoresis, no tachypnea`},{label:`Central cyanosis`,method:`Inspect tongue and oral mucosa.`,normal:`Pink`},{label:`Clubbing`,method:`Inspect finger nail beds (subtle in infants).`,normal:`No clubbing`},{label:`Peripheral perfusion`,method:`Cap refill, warmth of extremities.`,normal:`Cap refill < 2 s, warm extremities`}],abnormalHints:[`Poor weight gain — consider CHF from L-to-R shunt (VSD, PDA, AVSD)`,`Diaphoresis with feeds — infant CHF`,`Tiring with feeds — significant CHD`,`Central cyanosis — cyanotic CHD (ToF, TGA, TA, etc.)`]},{name:`Palpation and auscultation`,significance:`Femoral pulses + 4-limb BP screen coarctation. A harsh holosystolic murmur at LLSB is almost always a VSD in this age.`,pearl:`Listen over each of the 5 classic points as in the adult exam — the locations shift slightly with infant chest size but relative positions are the same. Also listen at the back: coarctation murmurs radiate there.`,steps:[{label:`Apex beat`,method:`Palpate at 4th ICS mid-clavicular line.`,normal:`Palpable at 4th ICS in infants`},{label:`Femoral pulses`,method:`Palpate bilaterally, simultaneously with right brachial.`,normal:`Present, equal, no delay vs brachial`},{label:`Listen at each classic area (APTM)`,method:`See APTM diagram. Use pediatric stethoscope with both diaphragm and bell.`,normal:`S1 and S2 crisp, no murmur or physiologic only`},{label:`Listen over the back (interscapular)`,method:`Check for radiation of coarctation murmurs.`,normal:`No radiating murmur`}],abnormalHints:[`Harsh holosystolic LLSB murmur — VSD`,`Continuous "machinery" murmur below left clavicle — PDA`,`Systolic ejection at ULSB + fixed split S2 — ASD`,`Ejection murmur at ULSB + cyanosis — tetralogy of Fallot`,`Absent femorals + radio-femoral delay — coarctation`,`Gallop + tachycardia — heart failure`]}]}},toddler:{label:`Toddler (1–3 years)`,msk:{overview:`Gait, physiologic alignment changes, in-toeing, joint range. Cooperation unpredictable — use play.`,components:[{name:`Gait`,steps:[{label:`Base of support`,method:`Have child walk ~10 feet`,normal:`Wide-based initially, narrowing by 2y`},{label:`Heel-strike`,method:`Observe foot contact pattern`,normal:`Heel-strike developing by 18mo, consistent by 2y`},{label:`Arm swing`,method:`Observe reciprocal arm swing`,normal:`Reciprocal arm swing by 18mo`},{label:`Symmetry`,method:`Watch both sides in stance and swing`,normal:`Symmetric stride length and cadence`}],abnormalHints:[`Toe-walking past 2y (idiopathic vs CP vs DMD)`,`Limp (Legg-Calvé-Perthes, transient synovitis, trauma)`,`Wide-based ataxia`]},{name:`Knee alignment`,steps:[{label:`Stand feet together`,method:`Feet/medial malleoli touching; inspect knees`,normal:`Genu varum resolving by 18–24mo; mild genu valgum common by 2–3y`},{label:`Intercondylar or intermalleolar distance`,method:`Measure if alignment appears abnormal`,normal:`<5cm intercondylar (varum) or <8cm intermalleolar (valgum)`},{label:`Symmetry`,method:`Compare sides`,normal:`Symmetric`}],abnormalHints:[`Persistent varum past 2y`,`Severe valgum >8cm`,`Unilateral (Blount disease, rickets)`]},{name:`Feet alignment`,steps:[{label:`In-toeing / out-toeing`,method:`Observe foot angle during gait`,normal:`Mild in-toeing common (tibial torsion, femoral anteversion)`},{label:`Arch during stance`,method:`Stand flat, then on tiptoes`,normal:`Flexible flat foot that forms arch on tiptoe`},{label:`Heel alignment`,method:`View from behind standing`,normal:`Neutral or mildly valgus heel`}],abnormalHints:[`Rigid flat foot (tarsal coalition)`,`Fixed metatarsus adductus`,`Severe in-toeing >15°`]},{name:`Joint range`,steps:[{label:`Hips`,method:`Flex, abduct, rotate each hip`,normal:`Full symmetric range, no pain`},{label:`Knees`,method:`Flex, extend; palpate for effusion`,normal:`Full range, no effusion, stable`},{label:`Ankles`,method:`Dorsiflex, plantarflex, invert, evert`,normal:`Full range`},{label:`Shoulders, elbows, wrists`,method:`Through full range each`,normal:`Full symmetric range`}],abnormalHints:[`Joint effusion (septic vs reactive)`,`Guarded or painful motion`,`Asymmetric limitation`]},{name:`Spine`,steps:[{label:`Inspect standing`,method:`View spine from behind`,normal:`Midline, no prominent curve`},{label:`Palpate midline`,method:`Run finger along spinous processes`,normal:`Midline, no step-off, no tenderness`},{label:`Shoulder/hip symmetry`,method:`Compare shoulder and hip heights`,normal:`Symmetric`}],abnormalHints:[`Fixed scoliosis`,`Abnormal kyphosis`,`Asymmetric shoulder/hip`,`Midline tenderness`]}]},neuro:{overview:`Shifting to adult-pattern exam. Primitive reflexes should be absent. Use play-based techniques.`,components:[{name:`Mental status and language`,steps:[{label:`Engagement`,method:`Interaction with examiner/parent`,normal:`Alert, interactive, age-appropriate`},{label:`Language — expressive`,method:`Note spontaneous utterances`,normal:`1y: 1–3 words; 2y: 2-word phrases; 3y: short sentences`},{label:`Language — receptive`,method:`Ask to point to body parts or follow simple commands`,normal:`Follows age-appropriate commands`}],abnormalHints:[`Language regression (autism, epileptic encephalopathy)`,`Poor engagement`,`No 2-word phrases by 2y`]},{name:`Cranial nerves`,steps:[{label:`CN II — pupil response`,method:`Shine light each eye`,normal:`Pupils equal reactive`},{label:`CN III, IV, VI — EOM`,method:`Follow toy in H pattern`,normal:`Full smooth tracking, no strabismus`},{label:`CN V — facial sensation`,method:`Light touch on forehead, cheek, jaw`,normal:`Responds to touch, symmetric`},{label:`CN VII — face`,method:`Elicit smile, watch eye closure during cry`,normal:`Symmetric face`},{label:`CN IX, X, XII — mouth`,method:`Say "ahh"; stick out tongue`,normal:`Palate rises symmetrically; tongue midline`}],abnormalHints:[`Strabismus`,`Facial asymmetry`,`Tongue deviation`,`Absent palate elevation`]},{name:`Motor — tone and bulk`,steps:[{label:`Passive tone`,method:`Move each limb through full range`,normal:`Normal resistance throughout`},{label:`Bulk inspection`,method:`Inspect muscle bulk of thighs, calves, glutes`,normal:`Symmetric, age-appropriate bulk`},{label:`Contracture check`,method:`Test for heel-cord tightness, hamstring tightness`,normal:`No contractures`}],abnormalHints:[`Spasticity (especially catch in ankles)`,`Hypotonia`,`Calf pseudo-hypertrophy (DMD)`]},{name:`Motor — functional strength`,steps:[{label:`Rising from floor`,method:`Place flat on back; ask to stand up`,normal:`Rises without using hands to push off thighs (no Gowers)`},{label:`Climbing stairs`,method:`Observe or history`,normal:`Climbs holding rail`},{label:`Squatting/getting up`,method:`Encourage via play`,normal:`Squats and rises without help`}],abnormalHints:[`Gowers sign (proximal weakness — DMD)`,`Unable to climb stairs at age expected`,`Calf pain on walking (myositis)`]},{name:`Deep tendon reflexes`,steps:[{label:`Patellar`,method:`Sitting or supine with distraction (toy)`,normal:`2+ symmetric`},{label:`Biceps`,method:`Arm at rest, strike thumb on tendon`,normal:`2+ symmetric`},{label:`Achilles`,method:`With distraction`,normal:`2+ symmetric`}],abnormalHints:[`Hyperreflexia or clonus (UMN, CP)`,`Absent reflexes (LMN, neuropathy)`,`Asymmetry`]},{name:`Coordination and gait`,steps:[{label:`Run`,method:`Watch run ~10 feet`,normal:`Runs with reciprocal arm swing by 2y`},{label:`Stairs`,method:`Observe`,normal:`Climbs with rail`},{label:`Kick ball`,method:`Place ball; observe kick`,normal:`Kicks by 2y`},{label:`Ataxia check`,method:`Watch for fluency of movement`,normal:`Smooth, no tremor`}],abnormalHints:[`Ataxic gait`,`Intention tremor`,`Clumsiness beyond age`]},{name:`Plantar response`,steps:[{label:`Stroke lateral sole`,method:`Firm stroke from heel to toes`,normal:`Down-going great toe (plantar flexion) by age 2`}],abnormalHints:[`Up-going toe after age 2 = UMN sign (Babinski positive)`]}]},resp:{overview:`Toddler respiratory disease: viral URIs, reactive airways, croup (6 mo–6 y classical age), foreign-body aspiration (age 1–3 is peak). Normal RR ≤ 40.`,components:[{name:`Inspection`,pearl:`Sudden onset of unilateral wheeze + choking history in a toddler = foreign body until proven otherwise. CXR in expiration (or decubitus) helps show the trapped air.`,steps:[{label:`Respiratory rate`,method:`Count over full 60 s if possible.`,normal:`≤ 40 /min`},{label:`Work of breathing`,method:`Retractions, nasal flaring, tracheal tug.`,normal:`No retractions`},{label:`Audible sounds`,method:`Stridor (croup), wheeze, barking cough.`,normal:`Quiet respirations`},{label:`Drooling / posture`,method:`Tripod positioning, drooling (epiglottitis in unvaccinated child).`,normal:`No drooling, normal posture`}],abnormalHints:[`Barking cough + stridor — croup`,`Drooling + tripod + toxic — epiglottitis (emergency)`,`Sudden unilateral wheeze — foreign body aspiration`]},{name:`Auscultation`,steps:[{label:`Air entry`,method:`Cooperation variable — listen quickly and systematically.`,normal:`Symmetric`},{label:`Adventitious sounds`,method:`Wheeze, crackles, stridor at the neck.`,normal:`Clear lung fields`},{label:`Unilateral findings`,method:`Focal wheeze, decreased air entry, or asymmetry — think foreign body or pneumonia.`,normal:`Symmetric bilateral`}],abnormalHints:[`Unilateral decreased breath sounds + wheeze — foreign body`,`Focal crackles — pneumonia`,`Diffuse wheeze — asthma/RAD`]}]},cv:{overview:`Most hemodynamically significant CHD has been detected by this age. Innocent murmurs peak here (Still's murmur, venous hum). The exam is adult-pattern but with smaller chest and less cooperation.`,components:[{name:`Inspection and palpation`,pearl:`Innocent murmurs are a normal finding in well toddlers — soft, systolic, at the LLSB, musical, and they change with position. Anything that doesn't fit that pattern deserves referral.`,steps:[{label:`General appearance + growth`,method:`Happy, active, tracking growth.`,normal:`Normal growth and activity`},{label:`Colour and clubbing`,method:`Inspect tongue, nail beds.`,normal:`Pink, no clubbing`},{label:`Apex beat`,method:`Palpate at 5th ICS mid-clavicular line.`,normal:`Located at 5th ICS MCL, tapping quality`},{label:`Peripheral pulses`,method:`Brachial + femoral, symmetric and simultaneous.`,normal:`Symmetric, no delay`}],abnormalHints:[`Tiring with play, poor growth — missed CHD`,`Cyanosis + clubbing — cyanotic CHD`,`Absent femorals — coarctation`]},{name:`Auscultation`,steps:[{label:`All 5 classic points`,method:`See APTM diagram above — Aortic, Pulmonic, Erb's, Tricuspid, Mitral.`,normal:`Crisp S1, S2 with physiologic split at pulmonic area`},{label:`Evaluate any murmur`,method:`Timing, location, radiation, grade. Apply the "7 S" innocent-murmur criteria.`,normal:`No murmur, or soft (≤ grade 2) innocent murmur`},{label:`Change with position`,method:`Have toddler sit, stand, lie down — does the murmur change? Innocent murmurs typically disappear or soften with standing.`,normal:`Murmur (if any) changes with position`}],abnormalHints:[`Harsh, loud (≥3/6), radiating, or diastolic murmur — not innocent, refer`,`Cyanosis + murmur — CHD workup`,`Fixed split S2 — ASD`]}]}},preschool:{label:`Preschool (3–5 years)`,msk:{overview:`Functional gait maneuvers, scoliosis screen, resolving physiologic alignment.`,components:[{name:`Gait — multiple patterns`,steps:[{label:`Normal gait`,method:`Walk ~15 feet barefoot`,normal:`Symmetric, smooth, reciprocal arm swing`},{label:`Heel walking`,method:`Walk on heels only`,normal:`Able by 4y`},{label:`Toe walking`,method:`Walk on toes only`,normal:`Able by 4y`},{label:`Tandem walking`,method:`Heel-to-toe along a line for 5 steps`,normal:`Able by 4y with minimal deviation`},{label:`Hopping`,method:`Hop on one foot`,normal:`3–5 hops on preferred foot by 4y`}],abnormalHints:[`Persistent toe-walking`,`Asymmetric stance/stride`,`Difficulty with any pattern`]},{name:`Alignment`,steps:[{label:`Knee alignment`,method:`Stand feet together`,normal:`Mild residual valgus resolving; neutral by 6–7y`},{label:`Foot arch`,method:`Standing, then tiptoe`,normal:`Arch forms on tiptoe (flexible flat foot)`},{label:`Heel position`,method:`View from behind standing`,normal:`Neutral or mild valgus`}],abnormalHints:[`Persistent unilateral varum`,`Rigid flat foot (no arch on tiptoe)`,`Pes cavus`]},{name:`Scoliosis screen (Adam forward-bend)`,steps:[{label:`Position`,method:`Feet together, bend forward at waist, arms hanging, palms together`,normal:`Arms and head relaxed`},{label:`View from behind`,method:`Examiner at same height; look along back`,normal:`Symmetric paraspinal contour`},{label:`View from side`,method:`Side view for kyphosis`,normal:`Smooth thoracic curve`}],abnormalHints:[`Rib hump (thoracic scoliosis)`,`Lumbar prominence`,`Asymmetric scapular height`]},{name:`Joint range and stability`,steps:[{label:`Active range`,method:`Ask to perform full range at hips, knees, ankles, shoulders, elbows, wrists`,normal:`Full symmetric range, no pain`},{label:`Knee stability`,method:`Palpate for effusion; assess stability if complaint`,normal:`Stable, no effusion`},{label:`Carrying angle (elbows)`,method:`Arms at sides, palms forward`,normal:`Normal valgus carrying angle`}],abnormalHints:[`Joint hypermobility (Beighton score)`,`Effusion`,`Pain with motion`,`Valgus >15°`]},{name:`Feet`,steps:[{label:`Standing inspection`,method:`View from front and behind`,normal:`Symmetric feet, neutral heel, flexible flat feet common`},{label:`Tiptoe`,method:`Stand on tiptoes`,normal:`Arch forms, symmetric`},{label:`Pes planus vs cavus`,method:`Note arch height`,normal:`Flexible flat foot or mild arch`}],abnormalHints:[`Rigid flat foot`,`Pes cavus (Charcot-Marie-Tooth)`,`Pain`]}]},neuro:{overview:`Formal pediatric neuro exam now feasible — most 4- and 5-year-olds cooperate with structured testing.`,components:[{name:`Mental status and language`,steps:[{label:`Orientation (age-appropriate)`,method:`Ask name, age, where you are`,normal:`Knows name and age by 3y; location by 4–5y`},{label:`Speech intelligibility`,method:`Listen to spontaneous speech`,normal:`Strangers understand by 4y`},{label:`Receptive language`,method:`2- and 3-step commands`,normal:`Follows 3-step commands by 4–5y`}],abnormalHints:[`Dysarthria`,`Expressive or receptive language delay`,`Inattention`]},{name:`Cranial nerves (II–XII)`,steps:[{label:`CN II — visual acuity`,method:`HOTV chart or pictures at 10ft, each eye`,normal:`20/30 or better by 4y; 20/25 by 5y`},{label:`CN II — visual fields`,method:`Confrontation with toys from periphery`,normal:`Full fields`},{label:`CN II — pupils`,method:`Light response each eye`,normal:`PERRL`},{label:`CN III, IV, VI — EOM`,method:`Follow toy in H pattern; include convergence`,normal:`Full EOM, convergence present`},{label:`CN V — sensation`,method:`Light touch forehead, cheek, jaw each side`,normal:`Intact, symmetric`},{label:`CN V — motor`,method:`Clench teeth, palpate masseter`,normal:`Symmetric strong bulk`},{label:`CN VII — face`,method:`Smile, wrinkle forehead, close eyes, puff cheeks`,normal:`Symmetric movement of all regions`},{label:`CN VIII — hearing`,method:`Finger rub each ear or whispered words`,normal:`Intact bilaterally`},{label:`CN IX, X — palate`,method:`Open mouth, say "ahh"`,normal:`Palate rises symmetrically, uvula midline`},{label:`CN XI — SCM/trapezius`,method:`Shrug shoulders, turn head against resistance`,normal:`Symmetric strength`},{label:`CN XII — tongue`,method:`Stick tongue out, move side to side`,normal:`Midline, no atrophy, full movement`}],abnormalHints:[`Strabismus (amblyopia risk)`,`Facial weakness`,`Tongue deviation/fasciculations`,`Uvula off-midline`]},{name:`Motor — tone, bulk, strength`,steps:[{label:`Tone inspection`,method:`Passive range all four limbs`,normal:`Normal tone throughout`},{label:`Bulk inspection`,method:`Observe muscle bulk symmetry`,normal:`Symmetric, age-appropriate`},{label:`Strength — shoulder abduction`,method:`Arms out, push down against resistance`,normal:`5/5 bilaterally`},{label:`Strength — elbow flexion`,method:`Flex elbow against resistance`,normal:`5/5 bilaterally`},{label:`Strength — grip`,method:`Squeeze examiner's fingers`,normal:`5/5 symmetric`},{label:`Strength — hip flexion`,method:`Lift leg off table against resistance`,normal:`5/5 bilaterally`},{label:`Strength — knee extension`,method:`Straighten knee against resistance`,normal:`5/5 bilaterally`},{label:`Strength — dorsiflexion`,method:`Pull toes up against resistance`,normal:`5/5 bilaterally`}],abnormalHints:[`Focal weakness`,`Gowers sign`,`Pseudohypertrophy (DMD)`,`Atrophy`]},{name:`Deep tendon reflexes`,steps:[{label:`Biceps`,method:`Thumb on biceps tendon, strike`,normal:`2+ symmetric`},{label:`Patellar`,method:`Knees hanging, strike patellar tendon`,normal:`2+ symmetric`},{label:`Achilles`,method:`Slight dorsiflexion, strike Achilles tendon`,normal:`2+ symmetric`},{label:`Plantar response`,method:`Stroke lateral sole heel-to-toes`,normal:`Down-going great toe`}],abnormalHints:[`Hyperreflexia or clonus (UMN)`,`Hyporeflexia (LMN)`,`Up-going plantar (Babinski — abnormal past 2y)`,`Asymmetry`]},{name:`Coordination`,steps:[{label:`Finger-to-nose`,method:`Touch examiner's finger then own nose, repeat`,normal:`Smooth, no dysmetria`},{label:`Heel-to-shin`,method:`Run heel down opposite shin`,normal:`Smooth bilaterally`},{label:`Rapid alternating movements`,method:`Tap palm with opposite hand alternating palm/back`,normal:`Rhythmic, symmetric`},{label:`Tandem walk`,method:`Heel-to-toe for 5 steps`,normal:`Minimal deviation`}],abnormalHints:[`Dysmetria`,`Dysdiadochokinesia`,`Intention tremor`,`Ataxic tandem`]},{name:`Sensory`,steps:[{label:`Light touch — hands`,method:`Cotton wisp on palm/dorsum, eyes closed`,normal:`Feels each touch`},{label:`Light touch — feet`,method:`Same on dorsum of foot bilaterally`,normal:`Feels each touch`}],abnormalHints:[`Focal sensory loss`,`Stocking-glove loss`]},{name:`Gait and Romberg`,steps:[{label:`Normal gait`,method:`Walk ~20 feet`,normal:`Smooth, symmetric`},{label:`Heel walk`,method:`Walk on heels`,normal:`Able without difficulty`},{label:`Toe walk`,method:`Walk on toes`,normal:`Able without difficulty`},{label:`Tandem`,method:`Heel-to-toe`,normal:`Intact`},{label:`Romberg (5y+)`,method:`Feet together, eyes closed, stand 10s`,normal:`Stable without sway`}],abnormalHints:[`Ataxic gait (cerebellar)`,`Romberg positive (dorsal column)`,`Circumduction (UMN)`]}]},resp:{overview:`Adult-pattern but shorter. Cooperation better than toddler. RR ≤ 30. Common: asthma/RAD, pneumonia, URIs.`,components:[{name:`Inspection`,steps:[{label:`Respiratory rate`,method:`Count over full 60 s quietly.`,normal:`≤ 30 /min`},{label:`Work of breathing`,method:`Retractions, nasal flaring, accessory muscle use.`,normal:`Effortless breathing`},{label:`Audible sounds`,method:`Wheeze, stridor, cough quality (barking = croup).`,normal:`Quiet`},{label:`Chest shape`,method:`AP:transverse, hyperinflation signs.`,normal:`Not barrel-chested`}],abnormalHints:[`Barrel chest — chronic asthma, cystic fibrosis`,`Retractions + wheeze — asthma exacerbation`]},{name:`Auscultation`,steps:[{label:`Systematic zones`,method:`Upper, mid, lower fields anteriorly and posteriorly; axillae bilaterally. Cooperative deep breaths through mouth.`,normal:`Symmetric vesicular sounds`},{label:`Wheeze`,method:`Expiratory, diffuse (asthma) or focal (foreign body, rare at this age).`,normal:`No wheeze`},{label:`Crackles`,method:`Focal = pneumonia; diffuse fine = interstitial disease (rare in kids).`,normal:`No crackles`}],abnormalHints:[`Focal crackles + fever — pneumonia`,`Diffuse wheeze — asthma`,`Prolonged expiration with wheeze — lower airway obstruction`]}]},cv:{overview:`Most CHD is detected by this age. Innocent murmurs peak in this range. Sports participation exams require thorough CV screening.`,components:[{name:`Inspection and palpation`,steps:[{label:`General and growth`,method:`Track on growth curve; activity tolerance.`,normal:`Normal growth, active`},{label:`Apex beat`,method:`5th ICS mid-clavicular line.`,normal:`Normal position and character`},{label:`Peripheral pulses`,method:`Brachial + femoral simultaneously. BP in arm and leg if HTN.`,normal:`Symmetric, no delay`}],abnormalHints:[`Absent femorals or arm-leg BP gradient — coarctation (always check in HTN screening)`,`Displaced apex — cardiomegaly`]},{name:`Auscultation`,pearl:`The 7 "S" criteria and the 5 classic innocent murmurs (see panel above) handle most murmurs you'll find in this age group. Still's murmur is the single most common.`,steps:[{label:`All 5 classic points`,method:`Walk through A → P → E → T → M with diaphragm then bell.`,normal:`S1 S2 clear, physiologic S2 split at pulmonic, no added sounds`},{label:`Any murmur`,method:`Characterise: timing, location, radiation, grade, character. Apply 7 S criteria + compare to innocent-murmur panel.`,normal:`No murmur, or innocent flow murmur meeting all 7 S criteria`},{label:`Position change`,method:`Standing vs supine. Innocent murmurs typically soften or disappear on standing.`,normal:`Murmur (if any) changes with position`},{label:`Sports screening extras (if applicable)`,method:`Screen for HOCM — murmur intensifies with Valsalva and standing (opposite of most).`,normal:`No murmur worsening on Valsalva`}],abnormalHints:[`Murmur breaking any of the 7 S criteria — refer`,`Harsh systolic at LUSB + fixed split S2 — ASD`,`Murmur louder with Valsalva — HOCM (sports participation risk)`,`Diastolic murmur — always pathologic`]}]}},school:{label:`School-age (6–11 years)`,msk:{overview:`Scoliosis screening peri-puberty, sports overuse injuries, resolving alignment.`,components:[{name:`Scoliosis screen (forward-bend + scoliometer)`,steps:[{label:`Standing inspection`,method:`Shoulders and iliac crest heights`,normal:`Symmetric shoulder and pelvic heights`},{label:`Forward bend (Adam test)`,method:`Feet together, bend forward at waist, arms hanging palms together`,normal:`Symmetric paraspinal contour`},{label:`Rib hump`,method:`View tangentially from behind at level of curve`,normal:`No rib hump`},{label:`Lumbar prominence`,method:`Same view at lumbar level`,normal:`No prominence`},{label:`Scoliometer (if available)`,method:`Place scoliometer across rib hump, read angle of trunk rotation`,normal:`ATR < 5°; ≥7° → refer`}],abnormalHints:[`Rib hump`,`ATR ≥7°`,`Asymmetric shoulders or pelvis`,`Decompensation (plumb line offset)`]},{name:`Back and spine`,steps:[{label:`Posture inspection`,method:`Standing, view front/back/side`,normal:`Normal spinal curves; plumb line centered`},{label:`Palpate spinous processes`,method:`From C2 to S1`,normal:`No tenderness, no step-off`},{label:`Range of motion`,method:`Flex, extend, lateral bend, rotate`,normal:`Full painless range`}],abnormalHints:[`Midline tenderness`,`Step-off (spondylolisthesis)`,`Limited motion with pain`]},{name:`Alignment`,steps:[{label:`Knees`,method:`Feet together, inspect`,normal:`Neutral alignment by 6–7y`},{label:`Feet`,method:`Stand, then tiptoes`,normal:`Medial arch present, symmetric`},{label:`Leg lengths`,method:`Supine, measure ASIS to medial malleolus if asymmetric`,normal:`Equal within 1cm`}],abnormalHints:[`Residual valgum`,`Pes cavus`,`Leg-length discrepancy >1cm`]},{name:`Joint stability and sports exam (if active)`,steps:[{label:`Active range all joints`,method:`Through full range`,normal:`Full symmetric range, no pain or crepitus`},{label:`Knee — Lachman (if sports-active)`,method:`Knee 20° flexion, stabilize femur, pull tibia forward`,normal:`Firm endpoint, no laxity`},{label:`Knee — McMurray`,method:`Flexed knee, rotate tibia while extending`,normal:`No pain or click`},{label:`Shoulder — impingement (Neer/Hawkins)`,method:`Passive shoulder flexion with arm in internal rotation`,normal:`No pain`},{label:`Ankle stability`,method:`Anterior drawer and talar tilt`,normal:`No laxity`}],abnormalHints:[`ACL laxity (positive Lachman)`,`Meniscal click`,`Shoulder impingement`,`Ankle instability`]},{name:`Gait and functional movement`,steps:[{label:`Normal gait`,method:`Walk 20 feet`,normal:`Smooth, symmetric`},{label:`Single-leg stance`,method:`Stand on one foot 10s each side`,normal:`Stable without Trendelenburg drop`},{label:`Squat`,method:`Full squat and rise`,normal:`Full squat without pain or asymmetry`},{label:`Hop on one foot`,method:`5 hops each side`,normal:`Able and symmetric`}],abnormalHints:[`Trendelenburg sign (hip abductor weakness)`,`Antalgic gait`,`Asymmetric squat`,`Pain with hop`]}]},neuro:{overview:`Adult-pattern six-component exam: mental status, CN, motor, reflexes, sensory, coordination/gait.`,components:[{name:`Mental status`,steps:[{label:`Orientation`,method:`Name, age, school, city, day of week`,normal:`Oriented x 4`},{label:`Attention`,method:`Count backward from 20; days of week backward`,normal:`Intact`},{label:`3-item recall`,method:`Ball-flag-tree; ask at 3 and 5 min`,normal:`3/3 recall at 5 min`},{label:`Language`,method:`Name common objects; repeat a sentence`,normal:`Fluent, no paraphasia`}],abnormalHints:[`Inattention (ADHD features)`,`Memory deficits`,`Word-finding difficulty`,`Perseveration`]},{name:`Cranial nerves (II–XII)`,steps:[{label:`CN II — acuity`,method:`Snellen at 20ft each eye with corrective lenses if worn`,normal:`20/20 or baseline`},{label:`CN II — fields`,method:`Confrontation, 4 quadrants each eye`,normal:`Full fields`},{label:`CN II — fundoscopy (if indicated)`,method:`Direct ophthalmoscopy — disc, vessels, macula`,normal:`Sharp disc, normal cup-disc ratio, no papilledema`},{label:`CN II, III — pupils`,method:`Direct and consensual light, accommodation`,normal:`PERRLA`},{label:`CN III, IV, VI — EOM`,method:`Follow finger in H pattern; convergence`,normal:`Full EOM, no nystagmus, convergence intact`},{label:`CN V — sensation`,method:`Light touch V1 (forehead), V2 (cheek), V3 (jaw) each side`,normal:`Intact, symmetric`},{label:`CN V — motor`,method:`Clench teeth, palpate masseter/temporalis; jaw opening`,normal:`Symmetric strength`},{label:`CN VII`,method:`Raise eyebrows, close eyes tight, smile/show teeth, puff cheeks`,normal:`Symmetric movement, all regions`},{label:`CN VIII`,method:`Finger rub each ear; Weber/Rinne if deficit`,normal:`Hears bilaterally`},{label:`CN IX, X`,method:`Palate elevation with "ahh"; uvula midline; voice quality`,normal:`Symmetric elevation, uvula midline, normal voice`},{label:`CN XI`,method:`Shrug shoulders against resistance; head turn against resistance`,normal:`5/5 SCM and trapezius`},{label:`CN XII`,method:`Stick tongue out; side-to-side`,normal:`Midline, no atrophy or fasciculations`}],abnormalHints:[`Papilledema (increased ICP)`,`Focal cranial nerve deficit — any warrants workup`,`Tongue fasciculations (LMN/MND)`]},{name:`Motor — bulk, tone, strength`,steps:[{label:`Bulk inspection`,method:`Shoulders, thighs, calves, intrinsic hand muscles`,normal:`Symmetric, no atrophy`},{label:`Tone`,method:`Passive range at elbows, wrists, knees, ankles`,normal:`Normal resistance throughout`},{label:`Strength — deltoids`,method:`Shoulder abduction against resistance`,normal:`5/5 bilaterally`},{label:`Strength — biceps`,method:`Elbow flexion against resistance`,normal:`5/5`},{label:`Strength — triceps`,method:`Elbow extension against resistance`,normal:`5/5`},{label:`Strength — grip`,method:`Squeeze 2 fingers`,normal:`5/5 symmetric`},{label:`Strength — finger abduction`,method:`Spread fingers against resistance`,normal:`5/5`},{label:`Strength — hip flexion`,method:`Lift leg supine against resistance`,normal:`5/5`},{label:`Strength — knee extension`,method:`Straighten knee against resistance`,normal:`5/5`},{label:`Strength — dorsiflexion`,method:`Pull toes up against resistance`,normal:`5/5`},{label:`Strength — plantarflexion`,method:`Push foot down against resistance`,normal:`5/5`}],abnormalHints:[`Focal weakness (localize)`,`Spasticity (UMN)`,`Atrophy`,`Fasciculations`]},{name:`Deep tendon reflexes`,steps:[{label:`Biceps (C5-C6)`,method:`Thumb on tendon, strike`,normal:`2+ symmetric`},{label:`Triceps (C7-C8)`,method:`Strike triceps tendon`,normal:`2+ symmetric`},{label:`Brachioradialis (C5-C6)`,method:`Strike distal radius`,normal:`2+ symmetric`},{label:`Patellar (L3-L4)`,method:`Knees hanging, strike tendon`,normal:`2+ symmetric`},{label:`Achilles (S1)`,method:`Slight dorsiflexion, strike tendon`,normal:`2+ symmetric`},{label:`Plantar response`,method:`Stroke lateral sole heel-to-toes`,normal:`Down-going bilaterally`},{label:`Clonus`,method:`Rapid dorsiflexion at ankle`,normal:`No sustained clonus`}],abnormalHints:[`Hyperreflexia with clonus (UMN: stroke, MS, cord lesion)`,`Hyporeflexia (LMN, neuropathy, myopathy)`,`Asymmetry`,`Up-going Babinski`,`Sustained clonus`]},{name:`Sensory`,steps:[{label:`Light touch — upper`,method:`Cotton wisp dorsum of hands, eyes closed`,normal:`Intact, symmetric`},{label:`Light touch — lower`,method:`Same on dorsum of feet`,normal:`Intact, symmetric`},{label:`Pain — upper`,method:`Broken Q-tip or pin on hands`,normal:`Intact, symmetric`},{label:`Pain — lower`,method:`Same on feet`,normal:`Intact, symmetric`},{label:`Vibration`,method:`128 Hz tuning fork at distal IP joint of great toes`,normal:`Feels vibration; counts down seconds`},{label:`Proprioception`,method:`Move great toe up/down with eyes closed`,normal:`Identifies direction correctly`}],abnormalHints:[`Dermatomal loss (nerve root)`,`Stocking-glove (neuropathy)`,`Loss of vibration/proprioception (dorsal column — B12, tabes, MS)`]},{name:`Coordination`,steps:[{label:`Finger-nose-finger`,method:`Touch examiner finger then own nose, examiner moves target`,normal:`Smooth, accurate, no dysmetria`},{label:`Heel-to-shin`,method:`Supine: heel down opposite shin`,normal:`Smooth, on-target`},{label:`Rapid alternating movements`,method:`Supinate/pronate hand on knee rapidly`,normal:`Rhythmic, symmetric`},{label:`Fine motor`,method:`Finger tapping (thumb to each finger in sequence)`,normal:`Rhythmic, accurate`}],abnormalHints:[`Dysmetria (past-pointing, overshoot)`,`Intention tremor`,`Dysdiadochokinesia`]},{name:`Gait and Romberg`,steps:[{label:`Normal gait`,method:`Walk 20 feet`,normal:`Narrow-based, smooth, reciprocal arm swing`},{label:`Heel walk`,method:`Walk on heels`,normal:`Able without difficulty`},{label:`Toe walk`,method:`Walk on toes`,normal:`Able without difficulty`},{label:`Tandem`,method:`Heel-to-toe along a line`,normal:`Minimal deviation, 10+ steps`},{label:`Romberg`,method:`Feet together, eyes closed, 30s`,normal:`Stable without fall or significant sway`}],abnormalHints:[`Wide-based (cerebellar)`,`Steppage (peripheral neuropathy)`,`Scissoring (UMN)`,`Romberg positive (dorsal column)`,`Circumduction`]}]},resp:{overview:`Nearly adult-pattern. Exam the same as adolescent with slightly more flexibility in cooperation. RR ≤ 30 in younger school-age, ≤ 20 in older. Sports history relevant (exercise-induced asthma).`,components:[{name:`Inspection`,steps:[{label:`Respiratory rate`,method:`Count over 60 s.`,normal:`≤ 30 (6–11 y)`},{label:`Work of breathing`,method:`Retractions, accessory muscles.`,normal:`Effortless`},{label:`Audible sounds`,method:`Listen for wheeze, stridor.`,normal:`Quiet`},{label:`Chest shape`,method:`Barrel chest, pectus deformities.`,normal:`Normal shape`},{label:`Clubbing`,method:`Schamroth window test.`,normal:`No clubbing`}],abnormalHints:[`Clubbing — CF, chronic hypoxemia, bronchiectasis`,`Barrel chest — chronic asthma, CF`]},{name:`Palpation and percussion`,steps:[{label:`Tracheal position`,method:`Middle finger in suprasternal notch.`,normal:`Midline`},{label:`Chest expansion`,method:`Hands laterally, thumbs meeting at spine. Deep breath.`,normal:`Symmetric 3–5 cm`},{label:`Tactile fremitus`,method:`Ulnar side of hand; "ninety-nine". Compare sides.`,normal:`Symmetric`},{label:`Percussion`,method:`Pleximeter + plexor technique. Compare sides.`,normal:`Resonant throughout`}],abnormalHints:[`Deviated trachea — pneumothorax, effusion, collapse`,`Dull percussion — consolidation, effusion`,`Hyper-resonant — pneumothorax, hyperinflation`]},{name:`Auscultation`,steps:[{label:`Systematic zones`,method:`Six anterior + four lateral + six posterior zones, compare side-to-side.`,normal:`Symmetric vesicular sounds`},{label:`Adventitious sounds`,method:`Wheeze, crackles, rhonchi, rub, stridor at neck. Use sounds library for reference.`,normal:`No added sounds`},{label:`Cough re-listen`,method:`Secretions (rhonchi, coarse crackles) should clear; fibrosis crackles do not.`,normal:`Secretion-based sounds clear with cough`}],abnormalHints:[`Focal crackles + fever — pneumonia`,`Diffuse fine crackles — early interstitial disease`,`Expiratory wheeze — asthma / RAD`]}]},cv:{overview:`Nearly adult-pattern. Sports participation screening is a key indication in this age. HOCM screening (family history of sudden cardiac death, exertional syncope, murmur louder with Valsalva) is specifically relevant.`,components:[{name:`Inspection and palpation`,pearl:`For sports participation exams, always ask about exertional symptoms (syncope, chest pain, unexpected fatigue) AND family history of sudden cardiac death before age 50. Screening exam alone catches only ~3% of HOCM.`,steps:[{label:`General and growth`,method:`Track on growth curve; review activity tolerance.`,normal:`Normal growth, age-appropriate activity`},{label:`Colour and clubbing`,method:`Inspect mucous membranes and nail beds.`,normal:`Pink, no clubbing`},{label:`Apex beat`,method:`Palpate at 5th ICS mid-clavicular line.`,normal:`Normal position, tapping character`},{label:`Peripheral pulses`,method:`Simultaneous brachial + femoral.`,normal:`Symmetric, no delay`},{label:`Blood pressure`,method:`Measure BP with appropriately sized cuff. If elevated, check both arms and one leg.`,normal:`Age-appropriate (< 120/80 roughly by 10+ years)`}],abnormalHints:[`Exertional syncope — HOCM, arrhythmia, LQTS`,`BP differential — coarctation`,`Displaced apex — cardiomegaly`]},{name:`Auscultation`,steps:[{label:`All 5 classic points`,method:`See APTM diagram. A → P → E → T → M with diaphragm and bell.`,normal:`S1, S2 clear with physiologic split at P, no added sounds`},{label:`Grade any murmur`,method:`Levine 1–6 (see scales above); characterise timing, location, radiation.`,normal:`No murmur, or innocent flow murmur meeting all 7 S criteria`},{label:`Innocent vs pathologic`,method:`Apply 7 S criteria; compare to innocent-murmur panel.`,normal:`Innocent murmur (if present) clearly fits all 7 S features`},{label:`Dynamic maneuvers`,method:`Standing: HOCM louder; most others soften. Valsalva: HOCM louder.`,normal:`Murmur (if any) softens on standing and Valsalva`}],abnormalHints:[`Murmur louder with Valsalva / standing — HOCM (sports disqualification considerations)`,`Any diastolic murmur`,`Murmur ≥ grade 3, radiating, or with thrill`]}]}},adolescent:{label:`Adolescent (12–21 years)`,msk:{overview:`Sports-related injuries, adolescent scoliosis, apophyseal overuse, hypermobility screening.`,components:[{name:`Scoliosis screen`,steps:[{label:`Standing inspection`,method:`Patient undressed to waist (keep privacy); compare shoulders, iliac crests, scapular heights`,normal:`Symmetric shoulders and pelvis`},{label:`Forward bend (Adam)`,method:`Feet together, bend forward, arms hanging palms together`,normal:`Symmetric paraspinal contour`},{label:`Scoliometer`,method:`Place across thoracic and lumbar regions at maximum prominence`,normal:`ATR <5°; 5–6° monitor; ≥7° refer`},{label:`Plumb line check`,method:`Drop plumb from C7; note where it falls`,normal:`Passes through gluteal cleft (compensated)`},{label:`Leg lengths`,method:`Supine; ASIS to medial malleolus each side`,normal:`Within 1cm`}],abnormalHints:[`Rib/lumbar hump`,`ATR ≥7°`,`Decompensation (plumb off gluteal cleft)`,`Leg-length discrepancy driving apparent curve`]},{name:`Back pain evaluation (if complaint)`,steps:[{label:`Inspect and palpate`,method:`Spinous processes, paraspinal muscles, SI joints`,normal:`Non-tender`},{label:`Range of motion`,method:`Flex, extend, lateral bend, rotate`,normal:`Full painless range`},{label:`Single-leg hyperextension (stork)`,method:`Stand on one foot, extend back — each side`,normal:`No pain (negative for spondylolysis)`},{label:`Straight-leg raise`,method:`Supine, lift straight leg to 70°+`,normal:`No radicular pain to 70°`},{label:`SI joint tests`,method:`FABER, SI compression`,normal:`No pain`}],abnormalHints:[`Spondylolysis (positive stork test)`,`Radicular pain (disc herniation)`,`SI joint pathology`,`Inflammatory back pain pattern`]},{name:`Joint stability — sports-specific`,steps:[{label:`Knee — Lachman`,method:`Knee 20° flexion, stabilize femur, pull tibia anteriorly`,normal:`Firm endpoint, no laxity (ACL intact)`},{label:`Knee — anterior drawer`,method:`Knee 90°, pull tibia forward`,normal:`No excess anterior translation`},{label:`Knee — varus/valgus stress`,method:`Stress at 0 and 30° flexion`,normal:`No gap opening (LCL/MCL intact)`},{label:`Knee — McMurray`,method:`Flex, rotate tibia while extending`,normal:`No pain or click`},{label:`Shoulder — apprehension`,method:`Abduct and externally rotate`,normal:`No apprehension`},{label:`Shoulder — Neer/Hawkins`,method:`Passive flexion with internal rotation`,normal:`No pain`},{label:`Ankle — anterior drawer`,method:`Pull heel forward with tibia stabilized`,normal:`No laxity`},{label:`Ankle — talar tilt`,method:`Invert heel with tibia stabilized`,normal:`No excess tilt`}],abnormalHints:[`ACL/PCL tear`,`MCL/LCL laxity`,`Meniscal injury`,`Shoulder instability/impingement`,`Ankle ligament laxity`]},{name:`Apophysitis and overuse screen`,steps:[{label:`Tibial tubercle`,method:`Palpate with knee flexed`,normal:`Non-tender`},{label:`Calcaneal apophysis`,method:`Palpate posterior calcaneus`,normal:`Non-tender`},{label:`Iliac apophyses`,method:`Palpate ASIS, AIIS, iliac crest`,normal:`Non-tender`},{label:`Rotator cuff`,method:`Empty-can (Jobe) test`,normal:`No pain or weakness`}],abnormalHints:[`Osgood-Schlatter (tibial tubercle tender)`,`Sever (calcaneal tender)`,`Iliac apophysitis`,`Rotator cuff tendinopathy`]},{name:`Hypermobility screen (Beighton)`,steps:[{label:`Fifth finger extension`,method:`Passive extension of fifth MCP to >90°`,normal:`No hyperextension (1 pt each side if positive)`},{label:`Thumb to forearm`,method:`Passive flexion of thumb to touch forearm`,normal:`Does not reach (1 pt each side if positive)`},{label:`Elbow hyperextension`,method:`Hyperextension >10°`,normal:`No hyperextension (1 pt each side if positive)`},{label:`Knee hyperextension`,method:`Hyperextension >10°`,normal:`No hyperextension (1 pt each side if positive)`},{label:`Palms to floor`,method:`Feet together, bend forward, palms flat on floor with knees straight`,normal:`Cannot reach (1 pt if positive)`}],abnormalHints:[`Beighton ≥5/9 suggests hypermobility spectrum (hEDS workup if with other features)`]},{name:`Alignment and gait`,steps:[{label:`Standing alignment`,method:`View knees, feet`,normal:`Neutral alignment, medial arch`},{label:`Normal gait`,method:`Walk 20 feet`,normal:`Symmetric, smooth`},{label:`Functional movements`,method:`Squat, single-leg stance, hop`,normal:`Full symmetric function`}],abnormalHints:[`Antalgic gait`,`Trendelenburg`,`Asymmetric squat`]}]},neuro:{overview:`Full adult-pattern neuro exam across six pillars: mental status, cranial nerves, motor, reflexes, sensory, coordination/gait. In adolescents, screen concussion sequelae if sports-active; frontal release signs must be absent.`,components:[{name:`Mental status`,significance:`Detects cognitive change (concussion, substance use, mood disorder, rare neurodegenerative disease).`,pearl:`Attention precedes memory. A patient who can't attend (serial 7s, months backward) will fail memory even with intact hippocampus — distinguish before calling it a memory problem.`,steps:[{label:`Orientation`,method:`Name, age, date, location, situation`,normal:`Oriented x 4`},{label:`Attention`,method:`Count backward from 100 by 7s (serial 7s) or months of year backward`,normal:`Intact`},{label:`Short-term memory`,method:`3-item registration and recall at 5 min`,normal:`3/3 recall`},{label:`Language`,method:`Object naming; sentence repetition; reading; writing`,normal:`Fluent, no paraphasia, comprehends written and spoken`},{label:`Executive function`,method:`Similarities (apple/orange); interpret proverb`,normal:`Abstract, age-appropriate`}],abnormalHints:[`Post-concussion cognitive changes`,`Mood or personality changes`,`Subtle executive dysfunction`,`Word-finding difficulty`]},{name:`Cranial nerves (II–XII, full formal exam)`,significance:`Localises brainstem, base-of-skull, and specific nerve pathology. Subtle deficits (RAPD, mild facial weakness, Horner) are easily missed — exam discipline matters.`,pearl:`The fastest screen for a CN deficit is asking the patient to speak, smile, look around, and swallow water. What's preserved in everyday function tells you what's likely intact — then examine formally to confirm and to catch the subtle.`,steps:[{label:`CN I (if indicated)`,method:`Coffee or cinnamon each nostril separately`,normal:`Identifies both`},{label:`CN II — acuity`,method:`Snellen at 20ft each eye; corrective lenses if worn`,normal:`20/20 or baseline`},{label:`CN II — fields`,method:`Confrontation, 4 quadrants each eye`,normal:`Full fields`},{label:`CN II — fundoscopy`,method:`Direct ophthalmoscopy — disc, vessels, macula`,normal:`Sharp disc, normal cup/disc, no papilledema`},{label:`CN II, III — pupils`,method:`Direct, consensual, swinging flashlight, accommodation`,normal:`PERRLA, no RAPD`},{label:`CN III, IV, VI — EOM`,method:`H pattern, convergence, note nystagmus or ptosis`,normal:`Full conjugate movement, no nystagmus, convergence intact`},{label:`CN V — sensation`,method:`Light touch V1, V2, V3 each side`,normal:`Intact, symmetric`},{label:`CN V — motor`,method:`Clench jaw, palpate masseter/temporalis; lateral jaw movement`,normal:`Symmetric strength and bulk`},{label:`CN V — corneal reflex (if indicated)`,method:`Cotton wisp to cornea`,normal:`Blinks bilaterally`},{label:`CN VII`,method:`Wrinkle forehead, close eyes against resistance, smile/bare teeth, puff cheeks`,normal:`Symmetric all four movements`},{label:`CN VIII — hearing`,method:`Finger rub each ear; Weber (midline) + Rinne (air > bone) if deficit`,normal:`Equal bilaterally`},{label:`CN IX, X`,method:`Palate elevation with "ahh"; uvula midline; voice; gag (if indicated)`,normal:`Symmetric palate, uvula midline, normal voice`},{label:`CN XI`,method:`Shoulder shrug and head turn against resistance`,normal:`5/5 SCM and trapezius bilaterally`},{label:`CN XII`,method:`Tongue protrusion, side to side; inspect for fasciculations/atrophy`,normal:`Midline, no atrophy or fasciculations, full movement`}],abnormalHints:[`Any focal cranial nerve deficit`,`Papilledema`,`RAPD`,`Nystagmus`,`Facial asymmetry`,`Tongue deviation`]},{name:`Motor — bulk, tone, strength`,significance:`Localises lesion to UMN vs LMN vs muscle vs junction. Pattern of weakness (proximal vs distal, symmetric vs focal) narrows differential.`,pearl:`Pronator drift is the most sensitive screen for subtle UMN weakness — a normal-feeling arm that drifts down with eyes closed still has corticospinal tract dysfunction. Always do it even when formal strength is 5/5.`,steps:[{label:`Bulk inspection`,method:`Inspect shoulders, biceps, thighs, calves, dorsal interossei (between metacarpals) of hands.`,normal:`Symmetric bulk; no atrophy, no pseudohypertrophy`},{label:`Tone — upper`,method:`Passive flex-extend elbow and pronate-supinate wrist at slow then quick speeds. Then pronator drift: arms outstretched, palms up, eyes closed for 10 s.`,normal:`Smooth passive range; no drift, no pronation of the outstretched hand`},{label:`Tone — lower`,method:`Passive knee flexion-extension; quick ankle dorsiflexion to check for catch. Heel-slap test: roll thigh and watch for ankle swing.`,normal:`Normal resistance, no catch, symmetric`},{label:`Strength — deltoid (C5)`,method:`Patient abducts both arms to 90°. Examiner pushes down on each arm just above the elbow while patient resists. Compare sides.`,normal:`Holds against full resistance — MRC 5/5 bilaterally`},{label:`Strength — biceps (C5–C6)`,method:`Elbow flexed 90°, supinated. Examiner grasps wrist and pulls to extend while patient resists.`,normal:`Holds against full resistance — 5/5`},{label:`Strength — triceps (C7)`,method:`Elbow flexed 90°. Examiner pushes wrist toward shoulder while patient extends against resistance.`,normal:`Extends against full resistance — 5/5`},{label:`Strength — wrist extension (C6–C7)`,method:`Patient makes fist, extends wrist. Examiner pushes down on knuckles while patient holds wrist up.`,normal:`Holds against full resistance — 5/5`},{label:`Strength — finger flexion / grip (C8)`,method:`Patient grips two of examiner's crossed fingers as hard as possible. Compare sides.`,normal:`Strong symmetric grip — 5/5`},{label:`Strength — finger abduction (T1)`,method:`Patient spreads fingers wide. Examiner squeezes index and little fingers together while patient resists.`,normal:`Holds fingers apart — 5/5`},{label:`Strength — hip flexion (L2–L3)`,method:`Supine. Patient lifts straight leg 30° off table. Examiner pushes down on thigh just above knee while patient resists.`,normal:`Holds thigh up against full resistance — 5/5`},{label:`Strength — knee extension (L3–L4)`,method:`Sitting, knee 90°. Patient straightens knee while examiner pushes distal shin down.`,normal:`Extends against full resistance — 5/5`},{label:`Strength — ankle dorsiflexion (L4–L5)`,method:`Patient pulls toes and foot up toward shin. Examiner pushes foot down at the dorsum.`,normal:`Holds dorsiflexion against full resistance — 5/5; preserved heel-walk`},{label:`Strength — great toe extension (L5)`,method:`Patient extends great toe up while examiner pushes it down with thumb.`,normal:`Holds against full resistance — 5/5 (classic L5 test)`},{label:`Strength — ankle plantarflexion (S1)`,method:`Patient pushes foot down against examiner's hand at the ball. OR ask patient to toe-walk 10 steps (more sensitive — unilateral plantarflexion weakness shows immediately).`,normal:`Full power; toe-walks symmetrically — 5/5`}],abnormalHints:[`Focal weakness → localise by myotome`,`Pronator drift (subtle UMN, always check even with 5/5)`,`Spasticity / catch (UMN)`,`Atrophy (LMN, disuse)`,`Fasciculations (MND, ALS)`,`Pseudohypertrophy of calves (DMD in a young male)`]},{name:`Deep tendon reflexes`,significance:`Reflex pattern (increased, decreased, asymmetric) localises UMN vs LMN vs root vs peripheral nerve. Inexpensive and fast, but asymmetry is the most informative finding.`,pearl:`A reinforced reflex is still a reflex. If you can't elicit it initially, use Jendrassik (teeth clench or pull interlocked fingers apart) to boost — absent reflexes without reinforcement aren't truly absent.`,steps:[{label:`Biceps (C5–C6)`,method:`Patient's arm relaxed across lap. Examiner places thumb firmly on biceps tendon at the cubital fossa, strikes thumb with reflex hammer. Compare both sides sequentially.`,normal:`2+ symmetric — visible contraction of biceps, slight elbow flexion`},{label:`Brachioradialis (C5–C6)`,method:`Arm relaxed. Strike the distal radius about 3 cm proximal to the wrist, on its radial (thumb) side.`,normal:`2+ symmetric — elbow flexion and slight forearm supination`},{label:`Triceps (C7)`,method:`Support the patient's arm at the wrist with elbow at 90°. Strike the triceps tendon just above the olecranon.`,normal:`2+ symmetric — triceps contraction, slight elbow extension`},{label:`Finger flexors — Hoffmann sign`,method:`Grasp the middle finger's distal phalanx, flick it downward quickly and release. Watch the thumb and index finger.`,normal:`Negative — no thumb flexion, no index flexion (positive = corticospinal tract dysfunction)`},{label:`Patellar (L3–L4)`,method:`Patient sits with knees hanging freely off the table. Strike the patellar tendon just below the patella.`,normal:`2+ symmetric — quadriceps contraction with knee extension`},{label:`Achilles (S1)`,method:`Patient's knee slightly flexed and leg externally rotated, or kneeling on a chair. Slightly dorsiflex the foot and strike the Achilles tendon.`,normal:`2+ symmetric — plantar flexion of the foot`},{label:`Plantar response (Babinski)`,method:`Stroke the lateral aspect of the sole firmly from the heel toward the little toe, then curve across the ball of the foot.`,normal:`Toes flex downward (plantar flexion, "down-going") bilaterally in anyone ≥ 2 years`},{label:`Ankle clonus`,method:`Knee slightly bent. Support the shin with one hand, quickly and sharply dorsiflex the foot with the other, hold in dorsiflexion.`,normal:`≤ 3 non-sustained beats is acceptable; sustained rhythmic oscillation = pathological clonus (UMN)`}],abnormalHints:[`Hyperreflexia + sustained clonus = UMN (MS, myelopathy, cord lesion, stroke)`,`Symmetric hyporeflexia = peripheral polyneuropathy, GBS, myopathy, hypothyroid, B12 deficiency`,`Asymmetric hyporeflexia = radiculopathy at that segment`,`Hoffmann positive = corticospinal tract dysfunction at cervical cord or above`,`Up-going Babinski after age 2 = UMN (always abnormal)`]},{name:`Sensory`,steps:[{label:`Light touch — upper`,method:`Cotton wisp, dorsum of hands, eyes closed`,normal:`Intact, symmetric`},{label:`Light touch — lower`,method:`Dorsum of feet`,normal:`Intact, symmetric`},{label:`Pain — upper`,method:`Broken Q-tip sharp end, hands`,normal:`Intact, symmetric`},{label:`Pain — lower`,method:`Same on feet`,normal:`Intact, symmetric`},{label:`Temperature (if indicated)`,method:`Cold tuning fork each area`,normal:`Intact`},{label:`Vibration`,method:`128 Hz tuning fork at distal IP of great toes; count seconds to fade`,normal:`Feels vibration; appropriate duration`},{label:`Proprioception`,method:`Move great toe up/down with eyes closed`,normal:`Identifies direction correctly`},{label:`Two-point discrimination (if indicated)`,method:`Blunt calipers on fingertip`,normal:`<5mm on fingertip`},{label:`Stereognosis (if indicated)`,method:`Identify coin/key in hand with eyes closed`,normal:`Correct identification`}],abnormalHints:[`Dermatomal loss (nerve root)`,`Stocking-glove loss (length-dependent neuropathy)`,`Dorsal column loss (B12, tabes, MS — positive Romberg, vibration loss)`,`Cortical deficit (astereognosis, impaired 2-pt)`]},{name:`Coordination`,steps:[{label:`Finger-nose-finger`,method:`Alternate examiner's finger and own nose; examiner moves target`,normal:`Smooth, accurate bilaterally`},{label:`Heel-to-shin`,method:`Supine: heel down opposite shin and back`,normal:`Smooth, accurate`},{label:`Rapid alternating (Dysdiadochokinesis)`,method:`Supinate/pronate hand rapidly on thigh`,normal:`Rhythmic, symmetric`},{label:`Finger tapping`,method:`Thumb to each finger in sequence rapidly`,normal:`Rhythmic, smooth, symmetric`}],abnormalHints:[`Dysmetria (cerebellar)`,`Intention tremor`,`Dysdiadochokinesia`,`Decomposed movement`]},{name:`Gait and Romberg`,steps:[{label:`Normal gait`,method:`Walk 20 feet`,normal:`Narrow-based, smooth, reciprocal arm swing`},{label:`Heel walk`,method:`Walk on heels only`,normal:`Able without difficulty`},{label:`Toe walk`,method:`Walk on toes only`,normal:`Able without difficulty`},{label:`Tandem`,method:`Heel-to-toe along a line, 10+ steps`,normal:`Minimal deviation`},{label:`Romberg`,method:`Feet together, eyes open then closed, 30s`,normal:`Stable — no significant sway or fall with eyes closed`},{label:`Single-leg stance`,method:`10s each side, eyes open`,normal:`Stable without drift`}],abnormalHints:[`Ataxic (wide-based — cerebellar)`,`Steppage (peripheral neuropathy / foot drop)`,`Circumduction (UMN hemiparesis)`,`Scissoring`,`Romberg positive (dorsal column)`]},{name:`Frontal release / primitive reflexes`,steps:[{label:`Grasp reflex`,method:`Stroke palm`,normal:`Absent`},{label:`Snout reflex`,method:`Tap upper lip`,normal:`No lip pucker`},{label:`Glabellar tap`,method:`Tap between eyebrows — should habituate after 3–4 taps`,normal:`Habituates (no sustained blink)`},{label:`Palmomental`,method:`Stroke thenar eminence`,normal:`No ipsilateral chin twitch`}],abnormalHints:[`Presence suggests frontal lobe pathology, neurodegenerative disease, or severe TBI — rare in adolescence but relevant in post-concussion workup`]}]},resp:{overview:`Systematic respiratory exam: inspection → palpation → percussion → auscultation → special maneuvers. Always start from observation — rate, pattern, work of breathing, and audible sounds (stridor, grunting) can be diagnostic before the stethoscope touches the chest.`,components:[{name:`Inspection — observation before touching`,significance:`Detects respiratory distress and localises the level of airway compromise before any equipment is used. High yield: RR, WOB, audible sounds, chest shape, colour.`,pearl:`Audible stridor at rest from across the room = upper-airway obstruction, often urgent. Grunting in an infant = significant distress — never dismiss as fussiness.`,steps:[{label:`Respiratory rate`,method:`Count over a full 60 seconds (not 15×4) — children normally breathe irregularly. Count while the patient is calm, before any interaction.`,normal:`Within age-appropriate range (see scales card above)`},{label:`Respiratory pattern`,method:`Observe depth, regularity, and inspiration:expiration ratio. Watch for prolonged expiration, paradoxical chest-abdominal movement, or apneas.`,normal:`Regular, I:E ratio ~1:2, no pauses > 10 s in an infant`},{label:`Work of breathing`,method:`Inspect for nasal flaring, suprasternal/intercostal/subcostal retractions, accessory muscle use (SCM, abdominals), tripod positioning, head-bobbing in infants.`,normal:`No retractions; breathing effortless`},{label:`Audible sounds (no stethoscope)`,method:`Listen at the bedside without the stethoscope. Grunting? Stridor? Wheezing audible across the room? Hoarse voice?`,normal:`No audible stridor, grunting, or wheeze`},{label:`Chest shape and symmetry`,method:`Inspect from front and lateral. Note AP-to-transverse diameter, pectus excavatum/carinatum, chest wall asymmetry.`,normal:`AP:transverse ~1:2 (not barrel-chested); symmetric`},{label:`Colour and perfusion`,method:`Inspect lips, tongue, nail beds for central cyanosis. Check peripheral perfusion (capillary refill, mottling).`,normal:`Pink, cap refill < 2 s, no cyanosis`},{label:`Clubbing`,method:`Inspect fingernails: Schamroth sign (reverse a finger against its mirror — normal forms a diamond-shaped window, clubbed does not).`,normal:`Normal nail angle, Schamroth window present`}],abnormalHints:[`Audible stridor — upper airway (croup, epiglottitis, foreign body, laryngomalacia)`,`Grunting in infant — significant distress`,`Tripod positioning, accessory muscle use — severe distress`,`Barrel chest — chronic air-trapping (asthma, CF)`,`Central cyanosis — significant hypoxemia`,`Clubbing in a child — cystic fibrosis, chronic hypoxemia, bronchiectasis, cyanotic CHD`]},{name:`Palpation`,significance:`Localises pathology: consolidation increases tactile fremitus; pneumothorax/effusion decreases it. Trachea deviates AWAY from expanding lesions and TOWARD collapsing ones.`,pearl:`Tracheal deviation is one of the fastest bedside clues to mediastinal shift — tension pneumothorax pushes it away, lobar collapse pulls it toward. Palpate with the middle finger in the suprasternal notch.`,steps:[{label:`Tracheal position`,method:`Patient sitting upright, neck slightly extended. Place middle finger in the suprasternal notch, check equal distance to each SCM.`,normal:`Midline`},{label:`Chest expansion — symmetry`,method:`Hands on lateral chest wall with thumbs meeting at the spine (posterior) or xiphoid (anterior). Patient takes a deep breath. Watch thumbs separate symmetrically.`,normal:`Symmetric 3–5 cm separation`},{label:`Tactile fremitus`,method:`Ulnar surface of hand on chest wall. Ask patient to say "ninety-nine" repeatedly. Move hand systematically across each zone, comparing sides.`,normal:`Equal mild vibration bilaterally over lung fields`},{label:`Chest wall tenderness`,method:`Palpate ribs, costochondral junctions, sternum, and intercostal spaces.`,normal:`No tenderness`},{label:`Subcutaneous emphysema`,method:`Gentle palpation along clavicles, neck, chest wall.`,normal:`No crepitus under skin`}],abnormalHints:[`Tracheal deviation — tension pneumothorax, large pleural effusion (away); upper lobe collapse (toward)`,`Asymmetric expansion — pneumothorax, large effusion, lobar collapse, phrenic palsy`,`Increased fremitus — consolidation (pneumonia), lobar pneumonia`,`Decreased/absent fremitus — pleural effusion, pneumothorax, obstruction`,`Costochondral tenderness — costochondritis, trauma`,`Subcutaneous emphysema — pneumothorax, tracheobronchial injury`]},{name:`Percussion`,significance:`Differentiates air (hyper-resonant), fluid (dull), and consolidated lung (dull) without imaging. Well-performed percussion detects a pleural effusion > 300 mL or a pneumothorax with ~90% sensitivity.`,pearl:`Pleximeter fingertip must be flat against the chest wall — lift other fingers off. The "feel" of a percussion note is as informative as the sound: dullness has a dense, reflected quality; hyper-resonance feels hollow and springy.`,steps:[{label:`Technique`,method:`Place middle finger of non-dominant hand (pleximeter) flat on chest wall; strike distal IP joint with tip of dominant middle finger (plexor) using a quick wrist flick.`,normal:`N/A — technique step`},{label:`Systematic zones`,method:`Percuss from apex to base, comparing side-to-side at each level. Include anterior, lateral (mid-axillary), and posterior fields.`,normal:`Resonant throughout lung fields`},{label:`Cardiac dullness`,method:`Percuss from resonant lung toward the heart border. Left sternal border dullness starts at the 3rd–5th ICS.`,normal:`Dullness beginning at the expected cardiac border`},{label:`Hepatic dullness`,method:`Right 5th–6th ICS mid-clavicular line transitions from resonant to dull.`,normal:`Liver edge dullness at expected level`},{label:`Diaphragmatic excursion`,method:`Patient inhales fully then exhales fully; mark level of dullness at each end. Difference is diaphragm excursion.`,normal:`3–5 cm excursion bilaterally`}],abnormalHints:[`Hyper-resonant — pneumothorax, emphysematous bulla, severe asthma attack`,`Dull — consolidation, pleural effusion (stony dull), atelectasis, pleural thickening, large mass`,`Raised diaphragm (loss of excursion) — effusion, paralysis, subdiaphragmatic pathology`]},{name:`Auscultation — normal breath sounds`,significance:`Breath sound quality varies by location. Bronchial sounds heard peripherally = consolidation; absent breath sounds = pneumothorax, effusion, obstruction.`,pearl:`Always compare corresponding points side-to-side sequentially — your ear calibrates to "normal" one side and immediately hears asymmetry. Listen through a full respiratory cycle at each zone.`,steps:[{label:`Technique`,method:`Diaphragm of stethoscope directly on skin (not over clothing). Patient breathes slowly and deeply through an open mouth.`,normal:`N/A — technique`},{label:`Vesicular sounds (peripheral)`,method:`Listen over lung fields away from the sternum. Play the "Normal vesicular" sample above for reference.`,normal:`Soft, low-pitched, inspiration > expiration in length and loudness`},{label:`Bronchovesicular (over main bronchi)`,method:`Listen at the 1st–2nd ICS anteriorly and between scapulae posteriorly.`,normal:`Intermediate pitch, inspiration = expiration`},{label:`Bronchial (over trachea)`,method:`Listen directly over the manubrium or trachea.`,normal:`Harsh, high-pitched, expiration > inspiration`},{label:`Systematic comparison`,method:`Six zones anteriorly (upper/mid/lower × L/R), four lateral, six posterior. Compare side-to-side at each zone.`,normal:`Symmetric breath sounds at every paired zone`}],abnormalHints:[`Bronchial sounds heard peripherally — consolidation (pneumonia)`,`Absent/diminished breath sounds — pneumothorax, effusion, severe obstruction, obesity / muscular chest`,`Prolonged expiration — lower airway obstruction (asthma, bronchiolitis)`]},{name:`Auscultation — adventitious sounds`,significance:`Adventitious (added) sounds are the key diagnostic finding. Timing (inspiratory vs expiratory vs biphasic), character (continuous vs discontinuous), and location are all informative.`,pearl:`Ask the patient to cough and re-listen. Secretions (rhonchi, some coarse crackles) clear or change; fine crackles of fibrosis or early pneumonia do not. The cough test separates two differential groups in one maneuver.`,steps:[{label:`Listen for wheeze`,method:`Continuous musical sounds, typically expiratory. Use the "Wheeze" sample for reference.`,normal:`No wheeze`},{label:`Listen for crackles — fine`,method:`Short, high-pitched, discontinuous "Velcro" sounds. Typically end-inspiratory, bibasilar. Use the "Fine crackles" sample.`,normal:`No crackles`},{label:`Listen for crackles — coarse`,method:`Longer, lower-pitched, louder than fine. Use the "Coarse crackles" sample.`,normal:`No crackles`},{label:`Listen for rhonchi`,method:`Low-pitched, continuous, snore-like. Often change with cough. Use the "Rhonchi" sample.`,normal:`No rhonchi`},{label:`Listen for pleural rub`,method:`Grating, creaky, biphasic, does NOT clear with cough. Use the "Pleural rub" sample.`,normal:`No pleural rub`},{label:`Listen at the neck (for stridor)`,method:`Place stethoscope over the anterior neck. Stridor is loudest here and differentiates from wheeze (loudest over chest). Use the "Stridor" sample.`,normal:`No stridor`},{label:`Listen for expiratory grunting (infants)`,method:`Often audible without a stethoscope at the bedside — short, low-pitched sound at the end of each expiration (glottal closure against exhaled air).`,normal:`No grunting`},{label:`Cough re-listen`,method:`Have patient cough forcefully; re-listen to any abnormal area. Note if the sound clears or changes.`,normal:`Any secretion-based sound should clear or change with cough`}],abnormalHints:[`Wheeze — asthma, bronchiolitis, foreign body (localised), anaphylaxis`,`Fine crackles — pulmonary edema, interstitial lung disease, early pneumonia`,`Coarse crackles — bronchitis, pneumonia, bronchiectasis, aspiration`,`Rhonchi — large-airway secretions`,`Pleural rub — pleurisy, PE, pneumonia with pleural involvement`,`Stridor — upper airway obstruction (croup, epiglottitis, FB)`]},{name:`Special maneuvers — transmitted voice sounds`,significance:`Vocal resonance tests detect consolidation (increased transmission) and effusion/pneumothorax (decreased). Useful when auscultation suggests asymmetry.`,pearl:`Whispered pectoriloquy is the most sensitive of the three — whispered words transmitted clearly through consolidated lung. If "one, two, three" whispered becomes clearly audible over one lung zone, there is consolidation underneath.`,steps:[{label:`Bronchophony`,method:`Patient says "ninety-nine" in normal voice. Listen at each lung zone with the stethoscope.`,normal:`Muffled, indistinct sound`},{label:`Egophony`,method:`Patient says "ee" continuously. Listen over any suspicious area.`,normal:`"Ee" sounds like "ee" (no change)`},{label:`Whispered pectoriloquy`,method:`Patient whispers "one, two, three" or "ninety-nine". Listen over each zone.`,normal:`Whisper is faint and indistinct`}],abnormalHints:[`Bronchophony increased — consolidation`,`Egophony positive ("ee" → "A" / "ay") — consolidation, sometimes top of an effusion`,`Whispered pectoriloquy positive (whisper clearly audible) — consolidation`]}]},cv:{overview:`Systematic cardiovascular exam: inspection → palpation → auscultation at the five classic points → peripheral vascular exam. Always palpate the apex BEFORE auscultating — knowing where the apex lies tells you where to put the stethoscope and flags cardiomegaly immediately.`,components:[{name:`Inspection`,significance:`Detects obvious precordial activity, chest-wall signs of congenital heart disease, and systemic markers (cyanosis, clubbing, dysmorphic features).`,pearl:`Clubbing + central cyanosis in a well-appearing adolescent = cyanotic congenital heart disease until proven otherwise. Inspect the fingernails before reaching for the stethoscope.`,steps:[{label:`General appearance`,method:`Observe body habitus, features suggesting syndromic CHD (Turner, Down, Marfan, Williams).`,normal:`No dysmorphic features, appropriate growth`},{label:`Central cyanosis`,method:`Inspect lips, tongue, and oral mucosa for bluish discoloration.`,normal:`Pink oral mucosa, no cyanosis`},{label:`Peripheral cyanosis / clubbing`,method:`Inspect nail beds; do Schamroth's window (oppose nails of 4th fingers — normally forms a diamond-shaped window).`,normal:`Pink nail beds, Schamroth window present`},{label:`Precordial bulge`,method:`Inspect anterior chest wall tangentially for asymmetric prominence over the heart.`,normal:`Symmetric chest, no bulge`},{label:`Visible apex beat`,method:`Inspect for a visible cardiac impulse at the 5th ICS mid-clavicular line.`,normal:`Apex may be visible in thin patients; should not be displaced`},{label:`Neck veins (JVP)`,method:`Patient reclined 45°, head turned slightly left. Observe the right internal jugular pulsation; measure vertical height above the sternal angle.`,normal:`≤ 4 cm above sternal angle (≤ 9 cm H₂O from right atrium)`}],abnormalHints:[`Central cyanosis — right-to-left shunt, severe hypoxemia`,`Clubbing — cyanotic CHD, chronic hypoxemia`,`Precordial bulge — long-standing cardiomegaly (grew during skeletal growth)`,`Visible apex displaced lateral/inferior — cardiomegaly`,`Elevated JVP — right-heart failure, fluid overload, cardiac tamponade`]},{name:`Palpation`,significance:`Localises the apex (confirms cardiac size), detects thrills (loud murmurs), and identifies a parasternal heave (RV hypertrophy).`,pearl:`If you feel a thrill, the murmur is at least grade 4/6 — grade your murmur as ≥4 even if it sounds less impressive. Thrill = loud, palpable turbulence.`,steps:[{label:`Apex beat — localise`,method:`Feel with the tips of the fingers at the 5th ICS mid-clavicular line. If not found, roll the patient to the left lateral decubitus position.`,normal:`Located at 5th ICS, mid-clavicular line, less than 2 cm in diameter`},{label:`Apex character`,method:`Describe: tapping (normal), heaving (pressure overload, e.g. AS/HTN), thrusting (volume overload, e.g. AR/MR), dyskinetic (MI/aneurysm).`,normal:`Brief tapping quality`},{label:`Parasternal heave`,method:`Place the heel of the hand along the left sternal border. Sustained outward movement with each systole = heave.`,normal:`No heave`},{label:`Thrills`,method:`Use the palmar aspect of the hand at each of the 5 auscultation areas (A, P, E, T, M). A thrill = palpable turbulence.`,normal:`No thrills`},{label:`Peripheral pulses — upper`,method:`Palpate radial pulses bilaterally, then brachial. Note rate, rhythm, volume, and symmetry.`,normal:`Symmetric 2+ pulses, regular rhythm, age-appropriate rate`},{label:`Peripheral pulses — lower`,method:`Palpate femoral pulses. Compare to brachial — radio-femoral or brachio-femoral delay suggests coarctation of the aorta.`,normal:`Femoral pulses 2+ symmetric, no delay relative to radial`}],abnormalHints:[`Apex displaced laterally/inferiorly — cardiomegaly`,`Heaving apex — pressure overload (AS, HTN)`,`Thrusting apex — volume overload (AR, MR)`,`Thrill over precordium — always pathological; at least grade 4/6 murmur`,`Parasternal heave — RV hypertrophy (pulmonary HTN, pulmonary stenosis, VSD with Eisenmenger)`,`Radio-femoral delay — coarctation of the aorta (always check in a hypertensive adolescent)`]},{name:`Auscultation — approach`,significance:`Systematic technique ensures every relevant finding is detected. Listen at all 5 points, with both diaphragm and bell, in supine/sitting/left-lateral positions as needed.`,pearl:`Time every murmur by simultaneously palpating the carotid pulse with the fingers of your free hand. Pulse = systole. Murmur heard during the pulse = systolic; in between pulses = diastolic.`,steps:[{label:`Positioning`,method:`Patient supine, head of bed at 30°. Exam room quiet, patient relaxed. Warm the stethoscope first.`,normal:`N/A — technique`},{label:`Diaphragm technique`,method:`Firm contact with skin. Detects HIGH-pitched sounds: S1, S2, systolic ejection murmurs, AR, MR.`,normal:`N/A — technique`},{label:`Bell technique`,method:`Very light contact — enough to make a seal but not stretch the skin. Detects LOW-pitched sounds: S3, S4, mitral stenosis rumble.`,normal:`N/A — technique`},{label:`Listen at each of the 5 points`,method:`A → P → E → T → M in order, each with diaphragm then bell. Spend a full cycle at each zone.`,normal:`S1 crisp, S2 clear (splits physiologically on inspiration at P), no added sounds, no murmur`},{label:`Left lateral decubitus position`,method:`If apex murmur suspected. Roll patient to left side. Listen at the apex with the BELL for mitral stenosis rumble or S3/S4.`,normal:`No added sounds, no diastolic rumble`},{label:`Sitting forward, held expiration`,method:`Patient leans forward, exhales fully, holds. Listen at left lower sternal border and Erb's point with the DIAPHRAGM for aortic regurgitation (soft early diastolic decrescendo).`,normal:`No early-diastolic murmur`}],abnormalHints:[`Fixed split S2 (no change with respiration) — ASD`,`Loud S2 at pulmonic area — pulmonary HTN`,`S3 — volume overload, CHF (can be normal in young athletes)`,`S4 — stiff ventricle (HTN, HCM, ischemia)`,`Audible opening snap — mitral stenosis (rare in children)`]},{name:`Auscultation — heart sounds and murmurs`,significance:`Characterising a murmur by timing, location, radiation, pitch, quality, and dynamic maneuvers narrows the differential.`,pearl:`Innocent murmurs in children share 7 "S" features: Soft (≤ grade 2), Systolic, Short, Single (no added S3/S4), Small (localised, non-radiating), Sweet (musical), Sensitive to position/respiration (louder supine, softer standing). Anything breaking this pattern deserves workup.`,steps:[{label:`S1`,method:`Listen at the apex (mitral). Coincides with the carotid pulse upstroke. Mitral + tricuspid closure.`,normal:`Single, crisp, single-component sound`},{label:`S2`,method:`Listen at the pulmonic area in HELD INSPIRATION and HELD EXPIRATION. Note whether S2 splits physiologically (wider in inspiration, narrower/absent in expiration).`,normal:`Physiologic split (widens on inspiration, narrows on expiration)`},{label:`S3 / S4 gallops`,method:`Bell at the apex in left lateral decubitus. S3 = early diastole (after S2), low-pitched. S4 = late diastole (just before S1).`,normal:`Absent in adults; S3 can be normal in young athletes under age 30`},{label:`Identify murmur — timing`,method:`Time vs carotid pulse. Systolic (during pulse) vs diastolic (between pulses) vs continuous.`,normal:`No murmur, or only soft innocent flow murmur`},{label:`Identify murmur — location + radiation`,method:`Where loudest? Does it radiate? AS → carotids. MR → axilla. Coarctation → back.`,normal:`N/A — characterise only if murmur present`},{label:`Identify murmur — character`,method:`Crescendo-decrescendo (ejection) vs holosystolic (plateau) vs decrescendo early-diastolic (AR, PR) vs mid-diastolic rumble (MS, TS).`,normal:`N/A — characterise only if murmur present`},{label:`Grade intensity`,method:`Levine 1–6 scale (see scales card above).`,normal:`No murmur, or grade ≤ 2 soft innocent flow murmur`},{label:`Dynamic maneuvers`,method:`Standing: ↑HOCM, ↑MVP click (earlier). Squatting: opposite. Valsalva: ↑HOCM, most others decrease.`,normal:`No significant change with posture`}],abnormalHints:[`Holosystolic murmur at apex → axilla — mitral regurgitation`,`Holosystolic at lower left sternal border (LLSB) — VSD, tricuspid regurgitation`,`Systolic ejection at upper right sternal border → carotids — aortic stenosis`,`Systolic ejection at upper left sternal border — pulmonary stenosis`,`Continuous "machinery" below left clavicle — PDA`,`Early diastolic at Erb's point, leaning forward — aortic regurgitation`,`Diastolic rumble at apex, bell in left-lateral — mitral stenosis`,`Fixed split S2 + systolic flow murmur — ASD`]},{name:`Peripheral vascular exam`,significance:`Coarctation of the aorta hides until BP and pulses are checked in all four extremities. Differential diagnosis of a hypertensive adolescent should include this in the first 60 seconds.`,pearl:`Four-limb BP measurement is mandatory in any adolescent with hypertension or a murmur. Upper-extremity BP > lower-extremity BP (or brachio-femoral delay) = coarctation until excluded.`,steps:[{label:`Four-limb blood pressure`,method:`Measure BP in right arm, left arm, and at least one leg. Use appropriately sized cuff (bladder width 40% of limb circumference, length 80–100%).`,normal:`Arm BPs within 10 mmHg of each other; leg systolic within 20 mmHg of arm systolic (may be higher)`},{label:`Radial pulses`,method:`Palpate both radials simultaneously — note any delay or asymmetry.`,normal:`Simultaneous, symmetric, 2+`},{label:`Radio-femoral delay`,method:`Palpate radial and femoral simultaneously. Feel the femoral as clearly "after" the radial = delay.`,normal:`No delay`},{label:`Femoral pulses`,method:`Palpate both femoral pulses at the mid-inguinal point. Compare amplitude to radials.`,normal:`Symmetric 2+ pulses, equal amplitude to radial`},{label:`Dorsalis pedis + posterior tibialis`,method:`Palpate in both feet.`,normal:`2+ pulses bilaterally`},{label:`Capillary refill`,method:`Press and release the nail bed; time to normal colour.`,normal:`< 2 sec`}],abnormalHints:[`Asymmetric upper-extremity BP (> 10 mmHg) — subclavian stenosis or coarctation at the origin`,`Upper >> lower-extremity BP — coarctation of the aorta`,`Diminished or absent femoral pulses with brachio-femoral delay — coarctation`,`Bounding pulses with wide pulse pressure — AR, PDA, arteriovenous fistula, thyrotoxicosis, anemia`,`Weak thready pulses — low output state (heart failure, shock, hypovolemia)`,`Prolonged capillary refill — dehydration, shock, cold stress`]}]}}},u={mrc:{title:`MRC strength grade (0–5)`,icon:`fa-hand-fist`,rows:[[`5`,`Normal power — holds against full resistance`],[`4`,`Reduced — moves against gravity + some resistance`],[`3`,`Moves against gravity only (no added resistance)`],[`2`,`Full range with gravity eliminated (horizontal plane)`],[`1`,`Flicker / trace contraction, no joint movement`],[`0`,`No contraction`]]},dtr:{title:`Deep-tendon reflex grade (0–4+)`,icon:`fa-circle-dot`,rows:[[`0`,`Absent`],[`1+`,`Hypoactive — trace, only with reinforcement`],[`2+`,`Normal`],[`3+`,`Brisk — may still be normal in anxious patients`],[`4+`,`Hyperactive with sustained clonus — always abnormal`]]},plantar:{title:`Plantar response (Babinski)`,icon:`fa-shoe-prints`,rows:[[`Down-going`,`Normal in anyone ≥ 2 years`],[`Up-going`,`Normal < 2 years; abnormal after — UMN lesion`],[`Asymmetric`,`Always abnormal at any age`]]},beighton:{title:`Beighton hypermobility score (0–9)`,icon:`fa-hands`,rows:[[`≤ 3`,`Normal flexibility`],[`4`,`Borderline — consider in context`],[`≥ 5`,`Hypermobility spectrum; screen for hEDS if other features present`]]},atr:{title:`Scoliometer — angle of trunk rotation`,icon:`fa-ruler`,rows:[[`< 5°`,`Normal, no follow-up`],[`5–6°`,`Borderline — re-check at each visit`],[`≥ 7°`,`Refer for PA/lateral spine x-ray + orthopedic evaluation`]]},rr:{title:`Respiratory rate — upper limit by age (awake)`,icon:`fa-lungs`,rows:[[`Newborn`,`≤ 60 /min`],[`< 2 months`,`≤ 60 /min (WHO tachypnea cutoff)`],[`2–12 months`,`≤ 50 /min (WHO tachypnea cutoff)`],[`1–5 years`,`≤ 40 /min (WHO tachypnea cutoff)`],[`6–11 years`,`≤ 30 /min`],[`≥ 12 years`,`≤ 20 /min (adult pattern)`]]},spo2:{title:`Pulse oximetry (SpO₂) — at room air`,icon:`fa-heart-pulse`,rows:[[`≥ 95%`,`Normal`],[`92–94%`,`Mild hypoxemia — investigate cause`],[`< 92%`,`Moderate hypoxemia — supplemental O₂`],[`< 88%`,`Severe — urgent intervention; target ≥ 90% acutely`]]},silverman:{title:`Silverman–Andersen retraction score (neonatal, 0–10)`,icon:`fa-baby`,rows:[[`0`,`No respiratory distress`],[`1–3`,`Mild — close observation`],[`4–6`,`Moderate distress — consider CPAP / support`],[`7–10`,`Severe — imminent respiratory failure, intubate`]]},westley:{title:`Westley croup severity score`,icon:`fa-stethoscope`,rows:[[`≤ 2`,`Mild — home management, cool mist, oral dexamethasone`],[`3–5`,`Moderate — nebulised epinephrine + dexamethasone`],[`6–11`,`Severe — admit, continuous monitoring`],[`≥ 12`,`Impending respiratory failure — ICU / airway management`]]},murmurGrade:{title:`Heart-murmur grading (Levine 1–6)`,icon:`fa-wave-square`,rows:[[`1/6`,`Very faint — heard only with concentration`],[`2/6`,`Soft but readily heard`],[`3/6`,`Moderately loud, no thrill`],[`4/6`,`Loud WITH a palpable thrill`],[`5/6`,`Very loud; audible with stethoscope just off the chest`],[`6/6`,`Audible without the stethoscope touching the chest`]]},pulseAmp:{title:`Pulse amplitude grade (0–4)`,icon:`fa-heart-pulse`,rows:[[`0`,`Absent`],[`1+`,`Diminished, thready`],[`2+`,`Normal`],[`3+`,`Bounding`],[`4+`,`Bounding with visible pulsation (e.g., aortic regurgitation)`]]},capRefill:{title:`Capillary refill time`,icon:`fa-hand`,rows:[[`< 2 sec`,`Normal`],[`2–3 sec`,`Borderline — consider hydration / perfusion`],[`≥ 3 sec`,`Delayed — dehydration, shock, low cardiac output`]]}},d={msk:[`atr`,`beighton`],neuro:[`mrc`,`dtr`,`plantar`],resp:[`rr`,`spo2`,`silverman`,`westley`],cv:[`murmurGrade`,`pulseAmp`,`capRefill`]},f=[{letter:`A`,color:`#dc2626`,title:`Aortic area`,location:`2nd ICS, right sternal border`,listen:`S2 (aortic component), aortic stenosis, aortic regurgitation`},{letter:`P`,color:`#2563eb`,title:`Pulmonic area`,location:`2nd ICS, left sternal border`,listen:`S2 (pulmonic component), pulmonic stenosis, PDA, physiologic split of S2`,innocent:`Pulmonary flow murmur (children, adolescents) — upper left sternal border`},{letter:`E`,color:`#059669`,title:`Erb's point`,location:`3rd ICS, left sternal border`,listen:`Aortic regurgitation (best here), transitional zone murmurs`,innocent:`Still's murmur classically radiates to Erb's / LLSB`},{letter:`T`,color:`#d97706`,title:`Tricuspid area`,location:`4th–5th ICS, lower left sternal border`,listen:`Tricuspid regurgitation, VSD, S3/S4, holosystolic murmurs`,innocent:`Still's murmur — vibratory, musical, age 3–7 y (loudest between LLSB and apex)`},{letter:`M`,color:`#7c3aed`,title:`Mitral area (apex)`,location:`5th ICS, mid-clavicular line`,listen:`S1, mitral regurgitation, mitral stenosis (with bell, left-lateral decubitus)`}],p=[{name:`Still's (vibratory) murmur`,age:`3–7 y (most common in children)`,location:`LLSB, radiating to apex`,character:`Low-frequency vibratory / musical systolic, grade 2–3/6, mid-systolic, "twanging-string" quality`,confirm:`Louder supine, softer or disappears on standing or Valsalva. No radiation to neck/back. Normal S2.`},{name:`Pulmonary flow murmur`,age:`School-age and adolescents, thin chest`,location:`Upper left sternal border (2nd–3rd ICS)`,character:`Soft blowing early systolic ejection, grade 1–2/6, higher-pitched`,confirm:`No ejection click. Physiologic split of S2. Louder supine, softer on standing. No radiation.`},{name:`Venous hum`,age:`Ages 3–8, disappears by adolescence`,location:`Supraclavicular or infraclavicular area, usually right`,character:`Soft continuous hum, louder in diastole. Only innocent continuous murmur.`,confirm:`Disappears when supine OR when jugular vein is gently compressed (key maneuver). Turning head to opposite side also alters it.`},{name:`Carotid bruit / supraclavicular bruit`,age:`Children and adolescents`,location:`Supraclavicular fossa, right > left; may radiate to carotid`,character:`Brief early systolic, grade 2–3/6, higher-pitched than Still's`,confirm:`Softer or disappears with hyperextension of the shoulders. Normal cardiac exam otherwise. No radiation below the clavicles.`},{name:`Peripheral pulmonary stenosis (PPS, neonatal)`,age:`Newborns and infants < 6–12 months`,location:`Upper LSB, radiates to BOTH axillae and the back`,character:`Soft systolic ejection murmur, grade 1–2/6`,confirm:`Typical age + radiation to back/axillae. Resolves by age 1 as branch pulmonary arteries grow. Persistence or louder grade warrants echo.`}],m=[{key:`normal`,src:`/audio/respiratory/normal-vesicular.ogg`,title:`Normal vesicular breath sounds`,where:`Peripheral lung fields`,features:`Soft, rustling. Inspiration louder and longer than expiration.`,clinical:`Baseline — deviation elsewhere is what you listen for.`},{key:`wheeze`,src:`/audio/respiratory/wheeze.ogg`,title:`Wheeze`,where:`Diffuse in asthma; localised in foreign body`,features:`Continuous, high-pitched, musical. Usually expiratory; biphasic if severe.`,clinical:`Lower-airway narrowing — asthma, bronchiolitis, foreign body, bronchomalacia. Silent chest in severe asthma is an ominous sign.`},{key:`stridor`,src:`/audio/respiratory/stridor.ogg`,title:`Stridor`,where:`Louder over neck than chest — upper airway`,features:`Continuous, high-pitched, harsh. Classically inspiratory (extrathoracic obstruction); biphasic if fixed.`,clinical:`Croup, epiglottitis, foreign body, laryngomalacia (infant). Distinguish from wheeze by auscultating the neck — stridor is loudest there.`},{key:`finecrackles`,src:`/audio/respiratory/crackles-fine.ogg`,title:`Fine (end-inspiratory) crackles`,where:`Bibasilar in pulmonary edema/fibrosis; focal in pneumonia`,features:`Discontinuous, brief, high-pitched. "Velcro" quality. Late inspiratory, do NOT clear with cough.`,clinical:`Alveolar opening — pulmonary fibrosis, pulmonary edema, early pneumonia, atelectasis.`},{key:`coarsecrackles`,src:`/audio/respiratory/crackles-coarse.ogg`,title:`Coarse crackles`,where:`Lower lobes; either side`,features:`Discontinuous, longer and louder than fine crackles. Lower-pitched. Can be early or late inspiratory; often clear partly with cough.`,clinical:`Secretions in larger airways — bronchitis, later pneumonia, bronchiectasis, aspiration.`},{key:`rhonchi`,src:`/audio/respiratory/rhonchi.ogg`,title:`Rhonchi`,where:`Central or anywhere with airway secretions`,features:`Continuous, low-pitched, snore-like. Typically expiratory. Clear or change with cough.`,clinical:`Large-airway secretions — bronchitis, pneumonia with large-airway involvement, cystic fibrosis, bronchiectasis.`},{key:`pleuralrub`,src:`/audio/respiratory/pleural-rub.ogg`,title:`Pleural friction rub`,where:`Focal, often lateral or posterior lower chest`,features:`Grating, creaky — "leather on leather". Biphasic (heard in inspiration and expiration). Does NOT clear with cough.`,clinical:`Pleural inflammation — pleuritis, pulmonary embolism, pneumonia with pleural involvement, viral pleurisy.`}],h=[{key:`normal`,src:`/audio/cardiac/normal.ogg`,title:`Normal heart sounds (S1, S2)`,where:`All four classic auscultation points`,rate:`~61 bpm reference`,features:`"lub-dub": S1 (closure of mitral + tricuspid) louder at apex; S2 (closure of aortic + pulmonic) louder at base. Physiologic S2 split on inspiration.`,clinical:`Reference for rhythm, rate, and the normal S1–S2 interval. Listen for what's changed — not just what's added.`},{key:`infant-normal`,src:`/audio/cardiac/infant-normal.ogg`,title:`Infant normal heart sounds`,where:`Infant chest — rate will be higher than adult`,rate:`Pediatric reference (120–160 bpm range)`,features:`Same S1–S2 pattern, faster rate. Short diastole makes murmurs easier to miss — careful auscultation needed.`,clinical:`Reference for neonatal/infant rhythm. Any murmur in the first 72 h should prompt pre/postductal sat screening.`},{key:`vsd`,src:`/audio/cardiac/vsd.wav`,title:`Ventricular septal defect (VSD)`,where:`Lower left sternal border (4th ICS)`,features:`Harsh, blowing, holosystolic (pansystolic) murmur — plateau shape through all of systole. Often accompanied by a thrill if large.`,clinical:`Most common congenital heart defect. Small VSD: loud murmur, usually asymptomatic, may close spontaneously. Large VSD: softer murmur (less pressure gradient) but signs of heart failure, pulmonary hypertension.`},{key:`mvp`,src:`/audio/cardiac/mitral-prolapse.wav`,title:`Mitral valve prolapse (MVP) — click + late systolic murmur`,where:`Apex (5th ICS, mid-clavicular line)`,features:`Mid-systolic click followed by a late-systolic crescendo murmur. Timing of click changes with maneuvers: earlier with standing or Valsalva, later with squatting.`,clinical:`Often benign, especially in thin young women. Features suggesting need for echo: thickened/redundant leaflets, associated MR, symptoms (palpitations, chest pain), arrhythmias.`},{key:`stills`,src:`/audio/cardiac/stills-murmur.ogg`,title:`Still's murmur (innocent)`,where:`LLSB, radiating to apex`,rate:`Classic age 3–7 y (this recording is a toddler)`,features:`Low-frequency vibratory / musical systolic, grade 2–3/6, mid-systolic, "twanging-string" quality.`,clinical:`The most common innocent murmur of childhood. Louder supine, softer or disappears on standing or Valsalva. Normal S2. No radiation to neck or back. No workup needed when classic.`},{key:`functional`,src:`/audio/cardiac/functional-murmur.wav`,title:`Functional (innocent) murmur — adult female`,where:`Left sternal border, soft systolic`,features:`Soft systolic murmur in a structurally normal heart — often from increased cardiac output, thin chest wall, anemia, hyperthyroidism, or pregnancy.`,clinical:`Benign if it meets the 7 S criteria. Investigate if loud (≥3/6), holosystolic, diastolic, radiating, or with thrill / symptoms.`}],g=n(),_=`rounded-lg border border-border bg-card p-5 space-y-3`,v=`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors cursor-pointer`,y=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,b=`rounded-md border border-border bg-background px-3 py-2 text-sm font-medium hover:bg-muted disabled:opacity-50`,x=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`;function S(e,t,n,r){return`${e}/${t}/${n}/${r}`}function C({id:e,scale:t}){return(0,g.jsxs)(`section`,{className:`rounded-md border border-border bg-background p-3`,"data-testid":`scale-`+e,children:[(0,g.jsx)(`h4`,{className:`text-sm font-semibold mb-2`,children:t.title}),(0,g.jsx)(`table`,{className:`w-full text-xs`,children:(0,g.jsx)(`tbody`,{children:t.rows.map(([e,t],n)=>(0,g.jsxs)(`tr`,{className:`border-b border-border last:border-0`,children:[(0,g.jsx)(`td`,{className:`py-1 pr-3 font-mono font-semibold whitespace-nowrap`,children:e}),(0,g.jsx)(`td`,{className:`py-1 text-muted-foreground`,children:t})]},n))})})]})}function w({entry:e}){return(0,g.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3 space-y-2`,"data-testid":`sound-`+e.key,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold`,children:e.title}),(0,g.jsx)(`audio`,{controls:!0,preload:`none`,className:`w-full`,children:(0,g.jsx)(`source`,{src:e.src})}),(0,g.jsxs)(`div`,{className:`text-xs space-y-0.5 text-muted-foreground`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-semibold`,children:`Where:`}),` `,e.where]}),e.rate&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-semibold`,children:`Rate:`}),` `,e.rate]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-semibold`,children:`Features:`}),` `,e.features]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-semibold`,children:`Clinical:`}),` `,e.clinical]})]})]})}function T({step:e,status:t,onStatus:n}){let r=`text-xs font-medium px-2 py-1 rounded border`;return(0,g.jsxs)(`div`,{className:`flex items-start gap-2 py-2 border-b border-border last:border-0`,children:[(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[(0,g.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Method:`}),` `,e.method]}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,g.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Normal:`}),` `,e.normal]})]}),(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-1 flex-shrink-0`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>n(t===`normal`?null:`normal`),className:r+` `+(t===`normal`?`bg-green-600 text-white border-green-600`:`border-green-600 text-green-700 hover:bg-green-50 dark:hover:bg-green-950/30`),children:`Normal`}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>n(t===`abnormal`?null:`abnormal`),className:r+` `+(t===`abnormal`?`bg-destructive text-white border-destructive`:`border-destructive text-destructive hover:bg-red-50 dark:hover:bg-red-950/30`),children:`Abnormal`})]})]})}function E({age:e,sys:t,idx:n,comp:r,getStatus:i,setStatus:a}){return(0,g.jsxs)(`div`,{className:_,"data-testid":`pe-component-${e}-${t}-${n}`,children:[(0,g.jsx)(`h3`,{className:`text-base font-semibold`,children:r.name}),(0,g.jsx)(`div`,{children:r.steps.map((r,o)=>{let s=S(e,t,n,o);return(0,g.jsx)(T,{step:r,status:i(s),onStatus:e=>a(s,e)},o)})}),r.abnormalHints.length>0&&(0,g.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 p-3`,children:[(0,g.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-destructive mb-1`,children:`Watch for`}),(0,g.jsx)(`ul`,{className:`list-disc pl-5 text-xs text-red-900 dark:text-red-200 space-y-0.5`,children:r.abnormalHints.map((e,t)=>(0,g.jsx)(`li`,{children:e},t))})]}),r.pearl&&(0,g.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 border border-amber-300 dark:border-amber-800 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,g.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Pearl:`}),` `,r.pearl]}),r.significance&&(0,g.jsxs)(`div`,{className:`rounded-md bg-sky-50 dark:bg-sky-950/30 border border-sky-200 dark:border-sky-900 p-3 text-xs text-sky-900 dark:text-sky-100`,children:[(0,g.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Significance:`}),` `,r.significance]})]})}function D(){let[e,t]=(0,a.useState)(`toddler`),[n,T]=(0,a.useState)(`msk`),[D,O]=(0,a.useState)(``),[k,A]=(0,a.useState)(``),[j,M]=(0,a.useState)(`narrative`),[N,P]=(0,a.useState)({}),[F,I]=(0,a.useState)(null),L=l[e],R=L[n],z=r({mutationFn:e=>i.post(`/api/generate-pe-narrative`,e),onSuccess:e=>I(e.narrative),onError:e=>I(`Generation failed: `+e.message)}),B=(0,a.useMemo)(()=>{let t=0,r=0,i=0;return R.components.forEach((a,o)=>a.steps.forEach((a,s)=>{let c=N[S(e,n,o,s)]??null;c===`normal`?t++:c===`abnormal`?r++:i++})),{normal:t,abnormal:r,notAssessed:i}},[e,n,R,N]);function V(){P(t=>{let r={...t};return R.components.forEach((t,i)=>t.steps.forEach((t,a)=>{delete r[S(e,n,i,a)]})),r}),I(null)}function H(){P(t=>{let r={...t};return R.components.forEach((t,i)=>t.steps.forEach((t,a)=>{r[S(e,n,i,a)]=`normal`})),r})}function U(){I(null);let t=[];R.components.forEach((r,i)=>r.steps.forEach((a,o)=>{t.push({component:r.name,label:a.label,method:a.method,normal:a.normal,status:N[S(e,n,i,o)]??null})})),z.mutate({steps:t,ageGroup:e,system:n,patientAge:D||void 0,patientGender:k||void 0,format:j})}let W=B.normal+B.abnormal;return(0,g.jsxs)(`div`,{className:`max-w-5xl mx-auto p-6 space-y-5`,children:[(0,g.jsxs)(`header`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Physical Exam Guide`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Age-group and system-specific exam checklist with abnormal-finding hints. Toggle normal / abnormal on each step, then generate a narrative for your note.`})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Age group`}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`pe-age-group-pills`,children:o.map(n=>(0,g.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:v+(e===n?` bg-primary text-primary-foreground border-primary`:` bg-muted hover:bg-muted/80 border-border`),"data-testid":`pe-age-`+n,children:l[n].label},n))})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`System`}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`pe-system-pills`,children:s.map(e=>(0,g.jsx)(`button`,{type:`button`,onClick:()=>T(e),className:v+(n===e?` bg-primary text-primary-foreground border-primary`:` bg-muted hover:bg-muted/80 border-border`),"data-testid":`pe-system-`+e,children:c[e]},e))})]}),(0,g.jsxs)(`section`,{className:_+` border-l-4 border-l-primary`,"data-testid":`pe-overview`,children:[(0,g.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[L.label,` — `,c[n]]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:R.overview})]}),n===`cv`&&(0,g.jsxs)(`section`,{className:_,"data-testid":`pe-cv-aptm`,children:[(0,g.jsx)(`h3`,{className:`text-base font-semibold`,children:`Auscultation landmarks (APTM + Erb's)`}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:f.map(e=>(0,g.jsxs)(`div`,{className:`flex gap-3 items-start rounded-md border border-border p-3`,children:[(0,g.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center font-bold text-white flex-shrink-0`,style:{background:e.color},children:e.letter}),(0,g.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[(0,g.jsx)(`div`,{className:`font-semibold`,children:e.title}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.location}),(0,g.jsxs)(`div`,{className:`text-xs mt-1`,children:[(0,g.jsx)(`strong`,{children:`Listen for:`}),` `,e.listen]}),e.innocent&&(0,g.jsxs)(`div`,{className:`text-xs text-green-700 dark:text-green-300 mt-1`,children:[(0,g.jsx)(`em`,{children:`Innocent:`}),` `,e.innocent]})]})]},e.letter))}),(0,g.jsx)(`h3`,{className:`text-base font-semibold mt-3`,children:`Cardiac sounds library`}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:h.map(e=>(0,g.jsx)(w,{entry:e},e.key))}),(0,g.jsx)(`h3`,{className:`text-base font-semibold mt-3`,children:`Classic innocent murmurs`}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:p.map(e=>(0,g.jsxs)(`div`,{className:`rounded-md border border-green-200 dark:border-green-900 bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1`,children:[(0,g.jsx)(`div`,{className:`font-semibold`,children:e.name}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Age: `,e.age,` · Location: `,e.location]}),(0,g.jsxs)(`div`,{className:`text-xs`,children:[(0,g.jsx)(`strong`,{children:`Sound:`}),` `,e.character]}),(0,g.jsxs)(`div`,{className:`text-xs`,children:[(0,g.jsx)(`strong`,{children:`Confirm innocent:`}),` `,e.confirm]})]},e.name))})]}),n===`resp`&&(0,g.jsxs)(`section`,{className:_,"data-testid":`pe-resp-sounds`,children:[(0,g.jsx)(`h3`,{className:`text-base font-semibold`,children:`Respiratory sounds library`}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:m.map(e=>(0,g.jsx)(w,{entry:e},e.key))})]}),d[n]&&d[n].length>0&&(0,g.jsxs)(`details`,{className:_,"data-testid":`pe-scales`,children:[(0,g.jsx)(`summary`,{className:`cursor-pointer font-semibold text-sm`,children:`Grading scales & reference`}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3 mt-3`,children:d[n].map(e=>{let t=u[e];return t?(0,g.jsx)(C,{id:e,scale:t},e):null})})]}),(0,g.jsxs)(`section`,{className:`space-y-3`,"data-testid":`pe-checklist`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,g.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Exam checklist`}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground flex items-center gap-3`,children:[(0,g.jsxs)(`span`,{className:`text-green-600`,children:[B.normal,` normal`]}),(0,g.jsxs)(`span`,{className:`text-destructive`,children:[B.abnormal,` abnormal`]}),(0,g.jsxs)(`span`,{children:[B.notAssessed,` not assessed`]})]})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:H,className:b,"data-testid":`btn-pe-all-normal`,children:`Mark all normal`}),(0,g.jsx)(`button`,{type:`button`,onClick:V,className:b,"data-testid":`btn-pe-reset`,children:`Reset`})]}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 gap-3`,children:R.components.map((t,r)=>(0,g.jsx)(E,{age:e,sys:n,idx:r,comp:t,getStatus:e=>N[e]??null,setStatus:(e,t)=>P(n=>({...n,[e]:t}))},r))})]}),(0,g.jsxs)(`section`,{className:_,"data-testid":`pe-generate`,children:[(0,g.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Generate Exam Report`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Uses the statuses above + optional patient context.`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-3`,children:[(0,g.jsx)(`input`,{className:x,placeholder:`Patient age (e.g. 3y)`,value:D,onChange:e=>O(e.target.value)}),(0,g.jsx)(`input`,{className:x,placeholder:`Patient gender (optional)`,value:k,onChange:e=>A(e.target.value)}),(0,g.jsxs)(`select`,{className:x,value:j,onChange:e=>M(e.target.value),children:[(0,g.jsx)(`option`,{value:`narrative`,children:`Narrative`}),(0,g.jsx)(`option`,{value:`list`,children:`List`})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`button`,{type:`button`,className:y,onClick:U,disabled:z.isPending||W===0,"data-testid":`btn-pe-generate`,children:z.isPending?`Generating…`:`Generate Exam Report`}),W===0&&(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Mark at least one step before generating.`})]}),F&&(0,g.jsx)(`div`,{className:`rounded-md border border-border bg-muted/40 p-3 whitespace-pre-wrap text-sm`,"data-testid":`pe-narrative`,children:F})]})]})}export{D as default}; \ No newline at end of file diff --git a/public/app/assets/Settings-D5OljPbz.js b/public/app/assets/Settings-D5OljPbz.js new file mode 100644 index 0000000..171064a --- /dev/null +++ b/public/app/assets/Settings-D5OljPbz.js @@ -0,0 +1,4 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i,o as a,s as o}from"./index-B0uH73Hx.js";import{t as s}from"./ConfirmModal-zYA0ebt6.js";var c=e(t(),1),l=n(),u=`rounded-lg border border-border bg-card p-5 space-y-3`,d=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,f=`rounded-md bg-primary text-primary-foreground px-3 py-2 text-sm font-medium disabled:opacity-50`,p=`rounded-md border border-border px-3 py-2 text-sm disabled:opacity-50`,m=`rounded-md bg-destructive text-white px-3 py-2 text-sm font-medium disabled:opacity-50`;function h({msg:e}){return e?(0,l.jsx)(`div`,{className:`text-sm `+(e.kind===`ok`?`text-green-600`:e.kind===`err`?`text-destructive`:`text-muted-foreground`),children:e.text}):null}function g(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`just now`:t<3600?Math.floor(t/60)+`m ago`:t<86400?Math.floor(t/3600)+`h ago`:Math.floor(t/86400)+`d ago`}function _(){let e=o(),[t,n]=(0,c.useState)(``),[a,s]=(0,c.useState)(``),[p,m]=(0,c.useState)(``),[g,_]=(0,c.useState)(null),v=r({mutationFn:e=>i.post(`/api/auth/change-password`,e),onSuccess:t=>{_({text:t.message||`Password changed`,kind:`ok`}),n(``),s(``),m(``),e.invalidateQueries({queryKey:[`sessions`]}),t.passwordWarning&&setTimeout(()=>_({text:t.passwordWarning,kind:`info`}),2e3)},onError:e=>_({text:e.message,kind:`err`})});function y(e){if(e.preventDefault(),_(null),!t||!a)return _({text:`Fill in all fields`,kind:`err`});if(a.length<8)return _({text:`New password must be 8+ characters`,kind:`err`});if(a!==p)return _({text:`Passwords do not match`,kind:`err`});v.mutate({currentPassword:t,newPassword:a})}return(0,l.jsxs)(`section`,{className:u,"data-testid":`change-password-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Change Password`}),(0,l.jsxs)(`form`,{onSubmit:y,className:`space-y-2 max-w-sm`,children:[(0,l.jsx)(`input`,{type:`password`,className:d,placeholder:`Current password`,value:t,onChange:e=>n(e.target.value),"data-testid":`pw-current`}),(0,l.jsx)(`input`,{type:`password`,className:d,placeholder:`New password (8+ characters)`,minLength:8,value:a,onChange:e=>s(e.target.value),"data-testid":`pw-new`}),(0,l.jsx)(`input`,{type:`password`,className:d,placeholder:`Confirm new password`,minLength:8,value:p,onChange:e=>m(e.target.value),"data-testid":`pw-confirm`}),(0,l.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,l.jsx)(`button`,{type:`submit`,disabled:v.isPending,className:f,"data-testid":`btn-change-password`,children:v.isPending?`Changing…`:`Change Password`}),(0,l.jsx)(h,{msg:g})]})]})]})}function v({codes:e,onClose:t}){return(0,l.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,children:(0,l.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-border bg-background p-5 shadow-lg space-y-3`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Save your backup codes`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Each code can be used once if you lose access to your authenticator. They will not be shown again.`}),(0,l.jsx)(`pre`,{className:`bg-muted p-3 rounded text-sm font-mono whitespace-pre-wrap break-all`,children:e.join(` +`)}),(0,l.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,onClick:()=>navigator.clipboard?.writeText(e.join(` +`)),className:p,children:`Copy`}),(0,l.jsx)(`button`,{type:`button`,onClick:t,className:f,children:`I've saved them`})]})]})})}function y({user:e}){let t=o(),n=e.totp_enabled===!0,[g,_]=(0,c.useState)(`idle`),[y,b]=(0,c.useState)(null),[x,S]=(0,c.useState)(``),[C,w]=(0,c.useState)(``),[T,E]=(0,c.useState)(null),[D,O]=(0,c.useState)(!1),[k,A]=(0,c.useState)(null),{data:j}=a({queryKey:[`2fa-backup-count`],queryFn:()=>i.get(`/api/auth/2fa/backup-codes/count`),enabled:n}),M=r({mutationFn:()=>i.post(`/api/auth/setup-2fa`,{}),onSuccess:e=>{b(e),_(`setup`),A(null)},onError:e=>A({text:e.message,kind:`err`})}),N=r({mutationFn:e=>i.post(`/api/auth/verify-2fa`,{code:e}),onSuccess:e=>{_(`idle`),S(``),b(null),e.backupCodes&&e.backupCodes.length&&E(e.backupCodes),t.invalidateQueries({queryKey:[`auth-me`]}),t.invalidateQueries({queryKey:[`2fa-backup-count`]}),A({text:`2FA enabled`,kind:`ok`})},onError:e=>A({text:e.message||`Invalid code`,kind:`err`})}),P=r({mutationFn:e=>i.post(`/api/auth/disable-2fa`,{password:e}),onSuccess:()=>{_(`idle`),w(``),t.invalidateQueries({queryKey:[`auth-me`]}),t.invalidateQueries({queryKey:[`2fa-backup-count`]}),A({text:`2FA disabled`,kind:`info`})},onError:e=>A({text:e.message||`Failed`,kind:`err`})}),F=r({mutationFn:e=>i.post(`/api/auth/2fa/backup-codes`,{password:e}),onSuccess:e=>{O(!1),e.codes&&e.codes.length&&E(e.codes),t.invalidateQueries({queryKey:[`2fa-backup-count`]})},onError:e=>{O(!1),A({text:e.message||`Failed to regenerate codes`,kind:`err`})}});return(0,l.jsxs)(`section`,{className:u,"data-testid":`2fa-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Two-Factor Authentication`}),(0,l.jsxs)(`p`,{className:`text-sm`,"data-testid":`2fa-status`,children:[`Status:`,` `,(0,l.jsx)(`span`,{className:n?`text-green-600 font-medium`:`text-destructive font-medium`,children:n?`✅ Enabled`:`❌ Not enabled`})]}),!n&&g===`idle`&&(0,l.jsx)(`button`,{type:`button`,className:f,onClick:()=>M.mutate(),disabled:M.isPending,"data-testid":`btn-setup-2fa`,children:M.isPending?`Setting up…`:`Enable 2FA`}),n&&g===`idle`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive`,onClick:()=>_(`disabling`),"data-testid":`btn-disable-2fa`,children:`Disable 2FA`}),j&&(0,l.jsxs)(`span`,{className:`text-sm `+(j.remaining<=2?`text-orange-500`:`text-muted-foreground`),children:[j.remaining,` backup codes remaining.`]}),j&&(0,l.jsx)(`button`,{type:`button`,className:p,onClick:()=>O(!0),"data-testid":`btn-regen-backup-codes`,children:`Regenerate`})]}),g===`setup`&&y&&(0,l.jsxs)(`div`,{className:`space-y-3 p-3 bg-muted/40 rounded-md`,children:[(0,l.jsx)(`p`,{className:`text-sm`,children:`Scan this QR code with your authenticator app:`}),(0,l.jsx)(`img`,{src:y.qrCode,alt:`2FA QR code`,className:`bg-white p-2 rounded max-w-[240px]`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Or enter manually: `,(0,l.jsx)(`code`,{className:`bg-muted px-2 py-0.5 rounded text-xs`,children:y.secret})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,l.jsx)(`input`,{type:`text`,maxLength:6,className:d+` max-w-[140px] font-mono tracking-widest`,placeholder:`123456`,value:x,onChange:e=>S(e.target.value.replace(/\D/g,``)),"data-testid":`2fa-verify-code`}),(0,l.jsx)(`button`,{type:`button`,className:f,disabled:x.length!==6||N.isPending,onClick:()=>N.mutate(x),"data-testid":`btn-verify-2fa`,children:N.isPending?`Verifying…`:`Verify & Enable`}),(0,l.jsx)(`button`,{type:`button`,className:p,onClick:()=>{_(`idle`),b(null),S(``)},children:`Cancel`})]})]}),g===`disabling`&&(0,l.jsxs)(`div`,{className:`space-y-2 p-3 bg-muted/40 rounded-md max-w-sm`,children:[(0,l.jsx)(`label`,{className:`block text-sm font-medium`,children:`Enter your password to confirm:`}),(0,l.jsx)(`input`,{type:`password`,className:d,value:C,onChange:e=>w(e.target.value),placeholder:`Password`,"data-testid":`2fa-disable-password`}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,className:m,disabled:!C||P.isPending,onClick:()=>P.mutate(C),"data-testid":`btn-disable-2fa-confirm`,children:P.isPending?`Disabling…`:`Confirm Disable`}),(0,l.jsx)(`button`,{type:`button`,className:p,onClick:()=>{_(`idle`),w(``)},"data-testid":`btn-disable-2fa-cancel`,children:`Cancel`})]})]}),(0,l.jsx)(h,{msg:k}),(0,l.jsx)(s,{open:D,title:`Regenerate backup codes?`,body:`This invalidates your existing codes. Enter your current password to confirm.`,confirmText:`Regenerate`,danger:!0,requirePassword:!0,passwordPlaceholder:`Current password`,busy:F.isPending,onConfirm:e=>e&&F.mutate(e),onCancel:()=>O(!1)}),T&&(0,l.jsx)(v,{codes:T,onClose:()=>E(null)})]})}function b({s:e,isCurrent:t,onRevoke:n}){return(0,l.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border-2 px-3 py-2 `+(t?`border-primary bg-primary/5`:`border-border bg-muted/40`),"data-testid":`session-row-`+e.id,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsxs)(`div`,{className:`text-sm font-medium truncate`,children:[e.device_label||`Unknown device`,t&&(0,l.jsx)(`span`,{className:`ml-2 text-xs text-primary font-medium`,children:`(this device)`})]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.ip_address||`—`,` · Created `,new Date(e.created_at).toLocaleDateString(),` · Active `,g(e.last_activity)]})]}),!t&&(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive text-xs`,onClick:n,"data-testid":`btn-revoke-session-`+e.id,children:`Revoke`})]})}function x(){let e=o(),[t,n]=(0,c.useState)(null),[d,f]=(0,c.useState)(null),{data:m,isLoading:g,error:_}=a({queryKey:[`sessions`],queryFn:()=>i.get(`/api/sessions`)}),v=r({mutationFn:e=>i.delete(`/api/sessions/`+e),onSuccess:()=>{f({text:`Session revoked`,kind:`info`}),e.invalidateQueries({queryKey:[`sessions`]})},onError:e=>f({text:e.message,kind:`err`})}),y=r({mutationFn:()=>i.delete(`/api/sessions`),onSuccess:t=>{f({text:`All other sessions revoked (`+(t.revoked||0)+` removed)`,kind:`info`}),e.invalidateQueries({queryKey:[`sessions`]})},onError:e=>f({text:e.message,kind:`err`})}),x=v.isPending||y.isPending;return(0,l.jsxs)(`section`,{className:u,"data-testid":`sessions-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Active Sessions`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Devices where you are currently logged in. Revoke any session to immediately log that device out.`}),(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive text-xs`,onClick:()=>n({kind:`all`}),"data-testid":`btn-revoke-all-sessions`,children:`Revoke All Other Sessions`}),g&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading sessions…`}),_&&(0,l.jsx)(`div`,{className:`text-sm text-destructive`,children:`Could not load sessions.`}),(0,l.jsxs)(`div`,{className:`space-y-2`,children:[m?.sessions.map(e=>(0,l.jsx)(b,{s:e,isCurrent:e.id===m.currentSessionId,onRevoke:()=>n({kind:`one`,id:e.id})},e.id)),m&&m.sessions.length===0&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No active sessions found.`})]}),(0,l.jsx)(h,{msg:d}),(0,l.jsx)(s,{open:t?.kind===`one`,title:`Revoke this session?`,body:`That device will be logged out.`,confirmText:`Revoke`,danger:!0,busy:x,onConfirm:()=>{t?.kind===`one`&&v.mutate(t.id),n(null)},onCancel:()=>n(null)}),(0,l.jsx)(s,{open:t?.kind===`all`,title:`Revoke all other sessions?`,body:`All other devices will be logged out.`,confirmText:`Revoke All`,danger:!0,busy:x,onConfirm:()=>{y.mutate(),n(null)},onCancel:()=>n(null)})]})}function S({user:e}){let t=o(),n=!!e.nextcloud_url,[a,m]=(0,c.useState)(e.nextcloud_url||``),[g,_]=(0,c.useState)(e.nextcloud_user||``),[v,y]=(0,c.useState)(``),[b,x]=(0,c.useState)(e.webdav_learning_path||``),[S,C]=(0,c.useState)(!1),[w,T]=(0,c.useState)(null),E=r({mutationFn:e=>i.post(`/api/nextcloud/connect`,e),onSuccess:e=>{T({text:e.message||`Connected`,kind:`ok`}),y(``),t.invalidateQueries({queryKey:[`auth-me`]})},onError:e=>T({text:e.message||`Connection failed`,kind:`err`})}),D=r({mutationFn:()=>i.post(`/api/nextcloud/disconnect`,{}),onSuccess:()=>{T({text:`Disconnected`,kind:`info`}),y(``),t.invalidateQueries({queryKey:[`auth-me`]})},onError:e=>T({text:e.message,kind:`err`})}),O=r({mutationFn:e=>i.post(`/api/user/webdav-path`,{path:e}),onSuccess:()=>{T({text:`Path saved`,kind:`ok`}),t.invalidateQueries({queryKey:[`auth-me`]})},onError:e=>T({text:e.message||`Failed to save`,kind:`err`})});function k(e){e.preventDefault(),T(null);let t=a.trim().replace(/\/+$/,``),n=g.trim(),r=v.trim();if(!t||!n||!r)return T({text:`Fill all Nextcloud fields`,kind:`err`});E.mutate({nextcloudUrl:t,username:n,appPassword:r})}return(0,l.jsxs)(`section`,{className:u,"data-testid":`nextcloud-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Nextcloud Integration`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Export generated documents to your Nextcloud.`}),(0,l.jsx)(`div`,{className:`text-sm`,"data-testid":`nc-status`,children:n?(0,l.jsxs)(l.Fragment,{children:[`✅ Connected to `,(0,l.jsx)(`strong`,{children:e.nextcloud_url}),` as `,e.nextcloud_user]}):(0,l.jsx)(l.Fragment,{children:`Not connected`})}),(0,l.jsxs)(`form`,{onSubmit:k,className:`space-y-2 max-w-md`,children:[(0,l.jsxs)(`label`,{className:`block text-sm`,children:[(0,l.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Nextcloud URL`}),(0,l.jsx)(`input`,{type:`url`,className:d,value:a,onChange:e=>m(e.target.value),placeholder:`https://cloud.example.com`,"data-testid":`nc-url`})]}),(0,l.jsxs)(`label`,{className:`block text-sm`,children:[(0,l.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Username`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:g,onChange:e=>_(e.target.value),placeholder:`your-username`,"data-testid":`nc-user`})]}),(0,l.jsxs)(`label`,{className:`block text-sm`,children:[(0,l.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`App Password`}),(0,l.jsx)(`input`,{type:`password`,className:d,value:v,onChange:e=>y(e.target.value),placeholder:`Generate in Nextcloud → Settings → Security`,"data-testid":`nc-pass`}),(0,l.jsx)(`span`,{className:`block text-xs text-muted-foreground mt-1`,children:`Go to Nextcloud → Settings → Security → Create new app password`})]}),(0,l.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,l.jsx)(`button`,{type:`submit`,className:f,disabled:E.isPending,"data-testid":`btn-nc-connect`,children:E.isPending?`Connecting…`:n?`Reconnect`:`Connect`}),n&&(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive`,onClick:()=>C(!0),"data-testid":`btn-nc-disconnect`,children:`Disconnect`})]})]}),n&&(0,l.jsx)(`div`,{className:`border-t border-border pt-3 space-y-2 max-w-md`,children:(0,l.jsxs)(`label`,{className:`block text-sm`,children:[(0,l.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Learning Hub — Default Browse Path`}),(0,l.jsxs)(`span`,{className:`block text-xs text-muted-foreground mb-2`,children:[`Folder opened first when picking files for AI content generation (e.g. `,(0,l.jsx)(`code`,{children:`/Medical-Resources`}),`)`]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(`input`,{type:`text`,className:d,value:b,onChange:e=>x(e.target.value),placeholder:`/Medical-Resources`,"data-testid":`nc-webdav-path`}),(0,l.jsx)(`button`,{type:`button`,className:f,disabled:O.isPending,onClick:()=>O.mutate(b.trim()),"data-testid":`btn-nc-save-path`,children:O.isPending?`Saving…`:`Save Path`})]})]})}),(0,l.jsx)(h,{msg:w}),(0,l.jsx)(s,{open:S,title:`Disconnect Nextcloud?`,body:`Future exports will fail until you reconnect. Your stored credentials will be cleared.`,confirmText:`Disconnect`,danger:!0,busy:D.isPending,onConfirm:()=>{D.mutate(),C(!1)},onCancel:()=>C(!1)})]})}function C(e){return e<1024?e+` B`:e<1048576?Math.round(e/1024)+` KB`:(e/1048576).toFixed(1)+` MB`}function w({doc:e,onDownload:t,onDelete:n,downloading:r}){return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md bg-muted/40 border border-border`,"data-testid":`doc-row-`+e.id,children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.filename}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[C(e.size_bytes),` · `,new Date(e.created_at).toLocaleDateString(),e.description?` · `+e.description:``]})]}),(0,l.jsx)(`button`,{type:`button`,className:f+` text-xs`,disabled:r,onClick:t,"data-testid":`btn-doc-download-`+e.id,children:r?`…`:`Download`}),(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive text-xs`,onClick:n,"data-testid":`btn-doc-delete-`+e.id,children:`Delete`})]})}function T(){let e=o(),[t,n]=(0,c.useState)(null),[p,m]=(0,c.useState)(``),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(null),{data:b,isLoading:x,error:S}=a({queryKey:[`documents`],queryFn:()=>i.get(`/api/documents`)}),C=r({mutationFn:async e=>{let t=new FormData;t.append(`file`,e.file),t.append(`description`,e.description);let n=await fetch(`/api/documents/upload`,{method:`POST`,credentials:`include`,body:t}),r=(n.headers.get(`content-type`)||``).includes(`application/json`)?await n.json():null;if(!n.ok||r&&r.success===!1)throw Error(r&&r.error||n.statusText);return r},onSuccess:t=>{_({text:`Document uploaded: `+t.filename,kind:`ok`}),n(null),m(``),e.invalidateQueries({queryKey:[`documents`]})},onError:e=>_({text:`Upload failed: `+e.message,kind:`err`})}),T=r({mutationFn:e=>i.delete(`/api/documents/`+e),onSuccess:()=>{_({text:`Document deleted`,kind:`info`}),e.invalidateQueries({queryKey:[`documents`]})},onError:e=>_({text:e.message||`Delete failed`,kind:`err`})}),E=r({mutationFn:e=>i.get(`/api/documents/`+e+`/download`),onSuccess:e=>{e.url?window.open(e.url,`_blank`,`noopener,noreferrer`):_({text:`Download failed`,kind:`err`})},onError:e=>_({text:e.message||`Download failed`,kind:`err`})});function D(e){if(e.preventDefault(),_(null),!t)return _({text:`Select a file first`,kind:`err`});C.mutate({file:t,description:p})}return(0,l.jsxs)(`section`,{className:u,"data-testid":`documents-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Documents`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Upload and manage documents via S3 storage (PDF, images, Word docs, text files). Max 10 MB per file.`}),x&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),S&&(0,l.jsx)(`div`,{className:`text-sm text-destructive`,children:`Failed to load documents.`}),b&&!b.s3_configured&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground italic`,children:`S3 storage not configured. Set S3_BUCKET in server environment.`}),b&&b.s3_configured&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`form`,{onSubmit:D,className:`flex flex-wrap gap-2 items-center`,"data-testid":`doc-upload-area`,children:[(0,l.jsx)(`input`,{type:`file`,className:`text-sm`,accept:`.pdf,.jpg,.jpeg,.png,.gif,.doc,.docx,.txt,.csv`,onChange:e=>n(e.target.files?.[0]??null),"data-testid":`doc-file-input`}),(0,l.jsx)(`input`,{type:`text`,className:d+` max-w-xs`,placeholder:`Description (optional)`,value:p,onChange:e=>m(e.target.value),"data-testid":`doc-description`}),(0,l.jsx)(`button`,{type:`submit`,className:f,disabled:!t||C.isPending,"data-testid":`btn-doc-upload`,children:C.isPending?`Uploading…`:`Upload`})]}),(0,l.jsx)(`div`,{className:`space-y-2`,children:b.documents.length===0?(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No documents uploaded yet.`}):b.documents.map(e=>(0,l.jsx)(w,{doc:e,onDownload:()=>E.mutate(e.id),onDelete:()=>y(e),downloading:E.isPending&&E.variables===e.id},e.id))})]}),(0,l.jsx)(h,{msg:g}),(0,l.jsx)(s,{open:!!v,title:`Delete this document permanently?`,body:v?.filename,confirmText:`Delete`,danger:!0,busy:T.isPending,onConfirm:()=>{v&&T.mutate(v.id),y(null)},onCancel:()=>y(null)})]})}function E(){let e=o(),[t,n]=(0,c.useState)(null),[s,m]=(0,c.useState)(``),[g,_]=(0,c.useState)(``),[v,y]=(0,c.useState)(!1),[b,x]=(0,c.useState)(!1),{data:S}=a({queryKey:[`voice-options`],queryFn:()=>i.get(`/api/user/preferences/options`)}),{data:C}=a({queryKey:[`voice-prefs`],queryFn:()=>i.get(`/api/user/preferences`)});!b&&C&&(m(C.stt_model||``),_(C.tts_voice||``),x(!0));let w=r({mutationFn:e=>i.post(`/api/user/preferences`,e),onSuccess:()=>{n({text:`Voice preferences saved`,kind:`ok`}),e.invalidateQueries({queryKey:[`voice-prefs`]})},onError:e=>n({text:e.message||`Save failed`,kind:`err`})});async function T(){n(null),y(!0);try{await i.post(`/api/user/preferences`,{tts_voice:g||null}),e.invalidateQueries({queryKey:[`voice-prefs`]});let t=`Hello, this is a preview of the `+(g||`server default`)+` voice. This is how your read-aloud feature will sound.`,n=await fetch(`/api/text-to-speech`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t})});if(!n.ok)throw Error(`Preview failed`);let r=await n.blob(),a=URL.createObjectURL(r),o=new Audio(a);o.onended=()=>URL.revokeObjectURL(a),await o.play()}catch(e){n({text:`Preview failed: `+e.message,kind:`err`})}finally{y(!1)}}return(0,l.jsxs)(`section`,{className:u,"data-testid":`voice-preferences-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Voice Preferences`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Customize your speech-to-text model and text-to-speech voice. These settings apply to all recording and read-aloud features.`}),(0,l.jsxs)(`div`,{className:`space-y-2 max-w-md`,children:[(0,l.jsxs)(`label`,{className:`block text-sm`,children:[(0,l.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Speech-to-Text Model (Transcription)`}),(0,l.jsxs)(`select`,{className:d,value:s,onChange:e=>m(e.target.value),"data-testid":`stt-model-select`,children:[(0,l.jsxs)(`option`,{value:``,children:[`Server default`,S?` (`+S.sttProvider+`)`:``]}),S?.sttModels.map(e=>(0,l.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,l.jsxs)(`label`,{className:`block text-sm`,children:[(0,l.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Text-to-Speech Voice (Read Aloud)`}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`select`,{className:d,value:g,onChange:e=>_(e.target.value),"data-testid":`tts-voice-select`,children:[(0,l.jsxs)(`option`,{value:``,children:[`Server default`,S?` (`+S.ttsProvider+`)`:``]}),S?.ttsVoices.map(e=>(0,l.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,l.jsx)(`button`,{type:`button`,className:p,disabled:v,onClick:T,"data-testid":`btn-preview-voice`,children:v?`Loading…`:`Preview`})]})]}),(0,l.jsx)(`button`,{type:`button`,className:f,disabled:w.isPending,onClick:()=>w.mutate({stt_model:s||null,tts_voice:g||null}),"data-testid":`btn-save-voice-prefs`,children:w.isPending?`Saving…`:`Save Voice Preferences`})]}),(0,l.jsx)(h,{msg:t})]})}var D=`ped_browser_whisper_enabled`,O=`ped_browser_whisper_model`,k=[{value:`Xenova/whisper-tiny.en`,label:`Tiny (~39MB) — fastest, ~2-3s`},{value:`Xenova/whisper-base.en`,label:`Base (~74MB) — balanced, ~3-5s`},{value:`Xenova/whisper-small.en`,label:`Small (~244MB) — best quality, ~6-10s`}];function A(e,t=``){try{return window.localStorage.getItem(e)??t}catch{return t}}function j(e,t){try{window.localStorage.setItem(e,t)}catch{}}function M(){let[e,t]=(0,c.useState)(A(D)===`true`),[n,r]=(0,c.useState)(A(O)||k[0].value);function i(e){t(e),j(D,String(e))}function a(e){r(e),j(O,e)}return(0,l.jsxs)(`section`,{className:u,"data-testid":`browser-whisper-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Browser Transcription (Local Whisper)`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Transcribes audio entirely in your browser — no audio sent to any server. Powered by OpenAI Whisper running in WebAssembly. Model is downloaded once and cached locally.`}),(0,l.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,l.jsx)(`label`,{className:`text-sm font-medium`,children:`Enable browser transcription:`}),(0,l.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,l.jsx)(`input`,{type:`checkbox`,className:`accent-primary size-4`,checked:e,onChange:e=>i(e.target.checked),"data-testid":`browser-whisper-enabled`}),(0,l.jsx)(`span`,{className:`text-sm`,"data-testid":`browser-whisper-status`,children:e?`On — audio stays on device`:`Off`})]})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,l.jsx)(`label`,{className:`text-sm font-medium`,children:`Model:`}),(0,l.jsx)(`select`,{className:d+` max-w-md`,value:n,onChange:e=>a(e.target.value),"data-testid":`browser-whisper-model`,children:k.map(e=>(0,l.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`When enabled, overrides server transcription. Falls back to server if browser transcription fails. The actual WASM download runs from the recording components — pre-download will light up when those port to React.`})]})}var N=`ped_web_speech_enabled`;function P(){let[e,t]=(0,c.useState)(A(N)===`true`),[n,r]=(0,c.useState)(!1),i=typeof window<`u`&&(`webkitSpeechRecognition`in window||`SpeechRecognition`in window);function a(){j(D,`false`),t(!0),j(N,`true`)}function o(){t(!1),j(N,`false`)}return(0,l.jsxs)(`section`,{className:u+` border-l-4 border-l-orange-500`,"data-testid":`web-speech-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Real-Time Streaming Transcription`}),(0,l.jsxs)(`div`,{className:`bg-orange-50 dark:bg-orange-950/30 p-3 rounded-md text-sm text-orange-900 dark:text-orange-100`,children:[(0,l.jsx)(`strong`,{children:`Privacy Warning:`}),` Uses your browser's built-in speech recognition, which `,(0,l.jsx)(`strong`,{children:`may send audio to cloud servers`}),` (Chrome/Edge send to Google). Only enable if you accept this trade-off for real-time transcription.`]}),(0,l.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`See words appear as you speak (streaming). Overrides browser and server transcription when enabled. `,(0,l.jsx)(`strong`,{children:`Not HIPAA-compliant`}),` in most browsers.`]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,l.jsx)(`label`,{className:`text-sm font-medium`,children:`Enable real-time streaming:`}),(0,l.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,l.jsx)(`input`,{type:`checkbox`,className:`accent-orange-500 size-4`,checked:e,disabled:!i,onChange:e=>{e.target.checked?r(!0):o()},"data-testid":`web-speech-enabled`}),(0,l.jsx)(`span`,{className:`text-sm`,"data-testid":`web-speech-status`,children:i?e?`On — real-time streaming`:`Off`:`Not supported in this browser`})]})]}),i&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Streaming integration lights up when the recording components port to React.`}),(0,l.jsx)(s,{open:n,title:`Enable real-time streaming transcription?`,body:`Your browser's speech recognition may send audio to cloud servers (e.g. Google). This is NOT HIPAA-compliant. Only enable if you understand and accept this privacy trade-off.`,confirmText:`Enable`,danger:!0,onConfirm:()=>{a(),r(!1)},onCancel:()=>r(!1)})]})}var F=[{value:`physical_exam`,label:`Physical Exam Template`},{value:`ros`,label:`Review of Systems Template`},{value:`encounter_format`,label:`Encounter Note Format`},{value:`family_history`,label:`Family History Format`},{value:`assessment_plan`,label:`Assessment & Plan Format`},{value:`template_soap`,label:`SOAP Note Template`},{value:`template_hpi`,label:`HPI Template`},{value:`template_wellvisit`,label:`Well Visit Template`},{value:`template_sickvisit`,label:`Sick Visit Template`},{value:`custom`,label:`Custom`}],I=Object.fromEntries(F.map(e=>[e.value,e.label.replace(/ Template$| Format$/,``)]));function L(){let e=o(),[t,n]=(0,c.useState)(null),[m,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(F[0].value),[y,b]=(0,c.useState)(``),[x,S]=(0,c.useState)(``),[C,w]=(0,c.useState)(null),{data:T}=a({queryKey:[`memories`],queryFn:()=>i.get(`/api/memories`)}),E=(T?.memories||[]).filter(e=>!e.category.startsWith(`correction_`)),D=r({mutationFn:e=>{let{id:t,...n}=e;return t?i.put(`/api/memories/`+t,n):i.post(`/api/memories`,n)},onSuccess:()=>{n({text:m?`Template updated`:`Template saved`,kind:`ok`}),g(null),b(``),S(``),e.invalidateQueries({queryKey:[`memories`]})},onError:e=>n({text:e.message||`Save failed`,kind:`err`})}),O=r({mutationFn:e=>i.delete(`/api/memories/`+e),onSuccess:()=>{n({text:`Template deleted`,kind:`info`}),e.invalidateQueries({queryKey:[`memories`]})},onError:e=>n({text:e.message||`Delete failed`,kind:`err`})});function k(e){g(e.id),v(e.category),b(e.name),S(e.content)}function A(){g(null),b(``),S(``)}function j(e){if(e.preventDefault(),n(null),!y.trim())return n({text:`Enter a template name`,kind:`err`});if(!x.trim())return n({text:`Enter template content`,kind:`err`});D.mutate({id:m??void 0,category:_,name:y.trim(),content:x.trim()})}return(0,l.jsxs)(`section`,{className:u,"data-testid":`templates-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`My Templates`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Save reusable templates for physical exam, ROS, encounter format, etc. The AI will use these when generating notes.`}),(0,l.jsxs)(`form`,{onSubmit:j,className:`space-y-2`,children:[(0,l.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,l.jsx)(`select`,{className:d+` max-w-xs`,value:_,onChange:e=>v(e.target.value),"data-testid":`mem-category`,children:F.map(e=>(0,l.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,l.jsx)(`input`,{type:`text`,className:d+` flex-1 min-w-[150px]`,placeholder:`Template name (e.g. Normal PE)`,value:y,onChange:e=>b(e.target.value),"data-testid":`mem-name`})]}),(0,l.jsx)(`textarea`,{rows:5,className:d+` resize-y`,placeholder:`Paste your template here. Example: HEENT: Normocephalic, atraumatic. Eyes: PERRL…`,value:x,onChange:e=>S(e.target.value),"data-testid":`mem-content`}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(`button`,{type:`submit`,className:f,disabled:D.isPending,"data-testid":`btn-mem-save`,children:D.isPending?`Saving…`:m?`Update Template`:`Add Template`}),m!==null&&(0,l.jsx)(`button`,{type:`button`,className:p,onClick:A,children:`Cancel`})]})]}),(0,l.jsx)(`div`,{className:`space-y-2`,children:E.length===0?(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No templates saved yet. Add one above.`}):E.map(e=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md bg-muted/40 border border-border`,"data-testid":`mem-row-`+e.id,children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,l.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:I[e.category]||e.category})]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[(e.content||``).slice(0,100).replace(/\n/g,` `),e.content&&e.content.length>100?`…`:``]})]}),(0,l.jsx)(`button`,{type:`button`,className:p+` text-xs`,onClick:()=>k(e),"data-testid":`btn-mem-edit-`+e.id,children:`Edit`}),(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive text-xs`,onClick:()=>w(e),"data-testid":`btn-mem-delete-`+e.id,children:`Delete`})]},e.id))}),(0,l.jsx)(h,{msg:t}),(0,l.jsx)(s,{open:!!C,title:`Delete template "`+(C?.name||``)+`"?`,body:`This cannot be undone.`,confirmText:`Delete`,danger:!0,busy:O.isPending,onConfirm:()=>{C&&O.mutate(C.id),w(null)},onCancel:()=>w(null)})]})}var R={correction_soap:`SOAP Correction`,correction_hpi:`HPI Correction`,correction_encounter:`Encounter Correction`,correction_wellvisit:`Well Visit Correction`,correction_sickvisit:`Sick Visit Correction`};function z(e){let t=e.indexOf(` +CORRECTED TO: `);return t===-1?{original:e.trim(),corrected:``}:{original:e.substring(0,t).replace(/^ORIGINAL:\s*/i,``).trim(),corrected:e.substring(t+15).trim()}}function B(){let e=o(),[t,n]=(0,c.useState)({}),[d,f]=(0,c.useState)(null),[p,m]=(0,c.useState)(null),{data:g}=a({queryKey:[`memories`],queryFn:()=>i.get(`/api/memories`)}),_=(g?.memories||[]).filter(e=>e.category.startsWith(`correction_`)),v=r({mutationFn:e=>i.delete(`/api/memories/`+e),onSuccess:()=>{f({text:`Correction deleted`,kind:`info`}),e.invalidateQueries({queryKey:[`memories`]})},onError:e=>f({text:e.message||`Delete failed`,kind:`err`})});return(0,l.jsxs)(`section`,{className:u,"data-testid":`corrections-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`AI Learning (Corrections)`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The AI automatically learns from your edits. When you modify AI-generated text and save, corrections are stored here and applied to future notes. Latest 20 per section.`}),(0,l.jsx)(`div`,{className:`space-y-2`,children:_.length===0?(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No corrections yet. Edit AI-generated notes and save to start learning.`}):_.map(e=>{let r=t[e.id],i=z(e.content||``),a=e.created_at?new Date(e.created_at).toLocaleDateString():``;return(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 border border-border overflow-hidden`,"data-testid":`corr-row-`+e.id,children:[(0,l.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-2 text-left`,onClick:()=>n({...t,[e.id]:!r}),children:[(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r?`▾`:`▸`}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:R[e.category]||e.category}),(0,l.jsx)(`span`,{className:`flex-1 text-sm truncate`,children:e.name}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a}),(0,l.jsx)(`span`,{role:`button`,className:`text-destructive text-xs px-2`,onClick:t=>{t.stopPropagation(),m(e)},"data-testid":`btn-corr-delete-`+e.id,children:`Delete`})]}),r&&(0,l.jsxs)(`div`,{className:`px-3 py-2 text-sm space-y-2 border-t border-border`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`text-xs font-semibold uppercase text-destructive mb-1`,children:`Original (AI generated):`}),(0,l.jsx)(`div`,{className:`whitespace-pre-wrap text-muted-foreground`,children:i.original})]}),i.corrected&&(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`text-xs font-semibold uppercase text-green-600 mb-1`,children:`Corrected to:`}),(0,l.jsx)(`div`,{className:`whitespace-pre-wrap`,children:i.corrected})]})]})]},e.id)})}),(0,l.jsx)(h,{msg:d}),(0,l.jsx)(s,{open:!!p,title:`Delete this correction?`,body:`The AI will no longer apply this edit in future notes.`,confirmText:`Delete`,danger:!0,busy:v.isPending,onConfirm:()=>{p&&v.mutate(p.id),m(null)},onCancel:()=>m(null)})]})}function V(){let e=o(),[t,n]=(0,c.useState)(null),[d,m]=(0,c.useState)(null),{data:_,isLoading:v}=a({queryKey:[`audio-backups`],queryFn:()=>i.get(`/api/audio-backups`)}),y=r({mutationFn:e=>i.delete(`/api/audio-backups/`+e),onSuccess:()=>{n({text:`Backup deleted`,kind:`info`}),e.invalidateQueries({queryKey:[`audio-backups`]})},onError:e=>n({text:e.message,kind:`err`})});function b(e){window.open(`/api/audio-backups/`+e+`/audio`,`_blank`,`noopener,noreferrer`)}return(0,l.jsxs)(`section`,{className:u,"data-testid":`audio-backups-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Audio Backups`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Recordings are automatically backed up on the server and kept for 24 hours. Retry flow ports with the recording components.`}),v&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),(0,l.jsxs)(`div`,{className:`space-y-2`,children:[_&&_.backups.length===0&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No audio backups.`}),_?.backups.map(e=>{let t=Math.round(e.size_bytes/1024),n=e.compressed_bytes?` (`+Math.round(e.compressed_bytes/1024)+` KB compressed)`:``;return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md bg-muted/40 border border-border`,"data-testid":`audio-backup-row-`+e.id,children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.module,` recording`]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[new Date(e.created_at).toLocaleString(),` · `,t,` KB`,n,` · `,g(e.created_at)]})]}),(0,l.jsx)(`button`,{type:`button`,className:f+` text-xs`,onClick:()=>b(e.id),children:`Play`}),(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive text-xs`,onClick:()=>m(e),"data-testid":`btn-audio-delete-`+e.id,children:`Delete`})]},e.id)})]}),(0,l.jsx)(h,{msg:t}),(0,l.jsx)(s,{open:!!d,title:`Delete this audio backup?`,body:`This cannot be undone.`,confirmText:`Delete`,danger:!0,busy:y.isPending,onConfirm:()=>{d&&y.mutate(d.id),m(null)},onCancel:()=>m(null)})]})}function H(){let e=o(),[t,n]=(0,c.useState)(null),[d,f]=(0,c.useState)(null),{data:m,isLoading:g}=a({queryKey:[`saved-encounters`],queryFn:()=>i.get(`/api/encounters/saved`)}),_=r({mutationFn:e=>i.delete(`/api/encounters/saved/`+e),onSuccess:()=>{n({text:`Deleted`,kind:`info`}),e.invalidateQueries({queryKey:[`saved-encounters`]})},onError:e=>n({text:e.message,kind:`err`})});return(0,l.jsxs)(`section`,{className:u,"data-testid":`saved-encounters-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Saved Encounters`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Encounters are automatically deleted after 7 days per site policy. Resume action ports with the encounter components.`}),g&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),(0,l.jsxs)(`div`,{className:`space-y-2`,children:[m&&m.encounters.length===0&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No saved encounters.`}),m?.encounters.map(e=>{let t=new Date(e.updated_at).toLocaleDateString(),n=new Date(e.expires_at).toLocaleDateString(),r=(e.transcript_preview||``).slice(0,80);return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md bg-muted/40 border border-border`,"data-testid":`enc-row-`+e.id,children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,l.jsx)(`span`,{className:`font-medium truncate`,children:e.label||`Untitled`}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:e.enc_type})]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[t,` · expires `,n,r?` · `+r+`…`:``]})]}),(0,l.jsx)(`button`,{type:`button`,className:p+` text-destructive text-xs`,onClick:()=>f(e),"data-testid":`btn-enc-delete-`+e.id,children:`Delete`})]},e.id)})]}),(0,l.jsx)(h,{msg:t}),(0,l.jsx)(s,{open:!!d,title:`Delete this saved encounter?`,body:d?.label||void 0,confirmText:`Delete`,danger:!0,busy:_.isPending,onConfirm:()=>{d&&_.mutate(d.id),f(null)},onCancel:()=>f(null)})]})}function U(){return(0,l.jsxs)(`section`,{className:u,"data-testid":`compliance-section`,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Compliance & Usage`}),(0,l.jsxs)(`div`,{className:`text-sm space-y-2`,children:[(0,l.jsxs)(`p`,{children:[(0,l.jsx)(`strong`,{children:`AWS Bedrock`}),` is available with a Business Associate Agreement (BAA) for HIPAA-eligible workloads.`]}),(0,l.jsxs)(`ul`,{className:`list-disc pl-5 space-y-1 text-muted-foreground`,children:[(0,l.jsx)(`li`,{children:`All connections use HTTPS/TLS encryption`}),(0,l.jsx)(`li`,{children:`Authentication with optional 2FA`}),(0,l.jsx)(`li`,{children:`No patient data stored on server beyond session`}),(0,l.jsx)(`li`,{children:`AWS Bedrock supports BAA for HIPAA compliance`}),(0,l.jsx)(`li`,{children:`Azure OpenAI supports BAA for HIPAA compliance`})]}),(0,l.jsxs)(`p`,{children:[(0,l.jsx)(`strong`,{children:`Important:`}),` Check with your institution's guidelines and policies before use. This tool is not intended for production clinical use without proper organizational authorization and provider BAAs in place. Use with caution.`]})]})]})}function W(){let{data:e,isLoading:t,error:n}=a({queryKey:[`auth-me`],queryFn:()=>i.get(`/api/auth/me`)}),r=e?.user.canLocalAuth!==!1;return(0,l.jsxs)(`div`,{className:`max-w-3xl mx-auto p-6 space-y-4`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Settings`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account security, integrations, and personal templates. More sub-sections port over in follow-up commits.`})]}),t&&(0,l.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),n&&(0,l.jsxs)(`div`,{className:`text-sm text-destructive`,children:[`Could not load your account: `,n.message]}),e&&r&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{}),(0,l.jsx)(y,{user:e.user}),(0,l.jsx)(x,{})]}),e&&!r&&(0,l.jsxs)(`section`,{className:u,children:[(0,l.jsx)(`h3`,{className:`text-base font-semibold`,children:`Account managed by single sign-on`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your password and two-factor authentication are managed by your identity provider.`})]}),e&&(0,l.jsx)(S,{user:e.user}),e&&(0,l.jsx)(T,{}),e&&(0,l.jsx)(E,{}),e&&(0,l.jsx)(M,{}),e&&(0,l.jsx)(P,{}),e&&(0,l.jsx)(L,{}),e&&(0,l.jsx)(B,{}),e&&(0,l.jsx)(V,{}),e&&(0,l.jsx)(H,{}),(0,l.jsx)(U,{})]})}export{W as default}; \ No newline at end of file diff --git a/public/app/assets/SickVisit-BhmlIsiq.js b/public/app/assets/SickVisit-BhmlIsiq.js new file mode 100644 index 0000000..7403251 --- /dev/null +++ b/public/app/assets/SickVisit-BhmlIsiq.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i,n as a}from"./index-B0uH73Hx.js";var o=e(t(),1),s=n();function c(){let[e,t]=(0,o.useState)(``),[n,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(``),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(null),_=r({mutationFn:e=>i.post(`/api/sick-visit/note`,e),onSuccess:e=>m(e.note)});function v(t){t.preventDefault(),g(null);let r={patientAge:e,patientGender:n,chiefComplaint:l,transcript:d},i=a.safeParse(r);if(!i.success){g(i.error.issues.map(e=>e.message).join(`, `));return}m(null),_.mutate(i.data)}let y=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,s.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,s.jsxs)(`header`,{children:[(0,s.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Sick Visit`}),(0,s.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Chief complaint + transcript → structured sick-visit note.`})]}),(0,s.jsxs)(`form`,{onSubmit:v,className:`space-y-4`,children:[(0,s.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,s.jsx)(`input`,{className:y,placeholder:`e.g. 4 years`,value:e,onChange:e=>t(e.target.value)})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,s.jsxs)(`select`,{className:y,value:n,onChange:e=>c(e.target.value),children:[(0,s.jsx)(`option`,{value:``,children:`Select`}),(0,s.jsx)(`option`,{children:`Male`}),(0,s.jsx)(`option`,{children:`Female`})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1 col-span-3 md:col-span-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Chief complaint`}),(0,s.jsx)(`input`,{className:y,placeholder:`e.g. Fever x 2 days`,value:l,onChange:e=>u(e.target.value)})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Transcript / dictation`}),(0,s.jsx)(`textarea`,{className:y+` min-h-[200px] font-mono text-sm`,placeholder:`Encounter narrative — transcribed or dictated.`,value:d,onChange:e=>f(e.target.value)})]}),h&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:h}),_.error&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:_.error.message}),(0,s.jsx)(`button`,{type:`submit`,disabled:_.isPending||!l.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:_.isPending?`Generating…`:`Generate Note`})]}),p&&(0,s.jsxs)(`section`,{className:`rounded-lg border border-border bg-card`,children:[(0,s.jsxs)(`header`,{className:`px-4 py-2 border-b border-border flex items-center justify-between bg-muted/40`,children:[(0,s.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Sick Visit Note`}),(0,s.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(p),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,s.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:p})]})]})}export{c as default}; \ No newline at end of file diff --git a/public/app/assets/Soap-DWeR8vsk.js b/public/app/assets/Soap-DWeR8vsk.js new file mode 100644 index 0000000..65bb30a --- /dev/null +++ b/public/app/assets/Soap-DWeR8vsk.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i,r as a}from"./index-B0uH73Hx.js";var o=e(t(),1),s=n();function c(){let[e,t]=(0,o.useState)(``),[n,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(`full`),[d,f]=(0,o.useState)(``),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(null),[_,v]=(0,o.useState)(null),y=r({mutationFn:e=>i.post(`/api/generate-soap`,e),onSuccess:e=>g(e.soap)});function b(t){t.preventDefault(),v(null);let r={transcript:d,patientAge:e,patientGender:n,type:l,additionalInstructions:p},i=a.safeParse(r);if(!i.success){v(i.error.issues.map(e=>e.message).join(`, `));return}g(null),y.mutate(i.data)}let x=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,s.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,s.jsxs)(`header`,{children:[(0,s.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`SOAP Note`}),(0,s.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Encounter transcript → full SOAP or subjective-only narrative.`})]}),(0,s.jsxs)(`form`,{onSubmit:b,className:`space-y-4`,children:[(0,s.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,s.jsx)(`input`,{className:x,placeholder:`e.g. 3 years`,value:e,onChange:e=>t(e.target.value)})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,s.jsxs)(`select`,{className:x,value:n,onChange:e=>c(e.target.value),children:[(0,s.jsx)(`option`,{value:``,children:`Select`}),(0,s.jsx)(`option`,{children:`Male`}),(0,s.jsx)(`option`,{children:`Female`})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Output type`}),(0,s.jsxs)(`select`,{className:x,value:l,onChange:e=>u(e.target.value),children:[(0,s.jsx)(`option`,{value:`full`,children:`Full SOAP`}),(0,s.jsx)(`option`,{value:`subjective`,children:`Subjective only`})]})]})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Transcript`}),(0,s.jsx)(`textarea`,{className:x+` min-h-[200px] font-mono text-sm`,placeholder:`Type or paste the encounter transcript.`,value:d,onChange:e=>f(e.target.value)})]}),(0,s.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,s.jsxs)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Additional instructions `,(0,s.jsx)(`span`,{className:`text-muted-foreground normal-case font-normal`,children:`(optional)`})]}),(0,s.jsx)(`textarea`,{className:x+` min-h-[60px] text-sm`,placeholder:`e.g., 'Include return precautions', 'Add differential for otitis media'`,value:p,onChange:e=>m(e.target.value)})]}),_&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:_}),y.error&&(0,s.jsx)(`div`,{className:`text-sm text-destructive`,children:y.error.message}),(0,s.jsx)(`button`,{type:`submit`,disabled:y.isPending||!d.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:y.isPending?`Generating…`:`Generate SOAP`})]}),h&&(0,s.jsxs)(`section`,{className:`rounded-lg border border-border bg-card`,children:[(0,s.jsxs)(`header`,{className:`px-4 py-2 border-b border-border flex items-center justify-between bg-muted/40`,children:[(0,s.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Generated SOAP`}),(0,s.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(h),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,s.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:h})]})]})}export{c as default}; \ No newline at end of file diff --git a/public/app/assets/VaxSchedule-BvmWxXa3.js b/public/app/assets/VaxSchedule-BvmWxXa3.js new file mode 100644 index 0000000..2507b0a --- /dev/null +++ b/public/app/assets/VaxSchedule-BvmWxXa3.js @@ -0,0 +1 @@ +import{t as e}from"./jsx-runtime-ByY1xr43.js";import{i as t,o as n}from"./index-B0uH73Hx.js";var r=e();function i(){let{data:e,isLoading:i,error:a}=n({queryKey:[`schedule-data`],queryFn:()=>t.get(`/api/schedule-data`)});if(i)return(0,r.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading schedule…`});if(a)return(0,r.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:a.message});if(!e)return null;let o=e.visitAges.filter(t=>e.periodicity[t.id]?.vaccines?.length),s=[],c=new Set;return o.forEach(t=>{e.periodicity[t.id].vaccines.forEach(e=>{c.has(e.vaccine)||(c.add(e.vaccine),s.push(e.vaccine))})}),(0,r.jsxs)(`div`,{className:`max-w-full mx-auto p-6 space-y-4`,children:[(0,r.jsxs)(`header`,{children:[(0,r.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Vaccine Schedule`}),(0,r.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`AAP/ACIP 2025 complete immunization schedule (0–18 years).`})]}),(0,r.jsx)(`div`,{className:`rounded-lg border border-border overflow-auto bg-card`,children:(0,r.jsxs)(`table`,{className:`text-xs`,children:[(0,r.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{className:`text-left font-semibold px-3 py-2 border-b border-border min-w-[180px] sticky left-0 bg-muted`,children:`Vaccine`}),o.map(e=>(0,r.jsx)(`th`,{className:`px-2 py-2 border-b border-border text-center whitespace-nowrap`,children:e.label},e.id))]})}),(0,r.jsx)(`tbody`,{children:s.map(t=>(0,r.jsxs)(`tr`,{className:`even:bg-muted/20`,children:[(0,r.jsx)(`td`,{className:`px-3 py-2 border-b border-border font-medium sticky left-0 bg-card`,children:e.vaccineFullNames[t]||t}),o.map(n=>{let i=(e.periodicity[n.id].vaccines||[]).find(e=>e.vaccine===t);if(!i)return(0,r.jsx)(`td`,{className:`border-b border-border`},n.id);let a=typeof i.dose==`number`?`#`+i.dose:i.dose||`•`;return(0,r.jsx)(`td`,{className:`border-b border-border text-center bg-primary/10 font-mono text-[11px]`,title:i.notes||`${t} dose ${i.dose}`,children:a},n.id)})]},t))})]})}),(0,r.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Hover any filled cell for notes. Sources: AAP/Bright Futures (Feb 2025), CDC Child & Adolescent Immunization Schedule (2025).`})]})}export{i as default}; \ No newline at end of file diff --git a/public/app/assets/WellVisit-vt8QwDLr.js b/public/app/assets/WellVisit-vt8QwDLr.js new file mode 100644 index 0000000..86c989b --- /dev/null +++ b/public/app/assets/WellVisit-vt8QwDLr.js @@ -0,0 +1 @@ +import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{a as r,i}from"./index-B0uH73Hx.js";var a=e(t(),1),o=n();function s(){let[e,t]=(0,a.useState)(``),[n,s]=(0,a.useState)(``),[c,l]=(0,a.useState)(``),[u,d]=(0,a.useState)(``),[f,p]=(0,a.useState)(``),[m,h]=(0,a.useState)(``),[g,_]=(0,a.useState)(``),[v,y]=(0,a.useState)(``),[b,x]=(0,a.useState)(``),[S,C]=(0,a.useState)(`full`),[w,T]=(0,a.useState)(null),E=r({mutationFn:e=>i.post(`/api/well-visit/note`,e),onSuccess:e=>T(e.note)});function D(t){t.preventDefault(),T(null),E.mutate({patientAge:e,patientGender:n,visitAge:c,vitals:u,measurements:f,parentConcerns:m,transcript:g,screenings:v,vaccines:b,noteStyle:S})}let O=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,o.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,o.jsxs)(`header`,{children:[(0,o.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Well Visit`}),(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Preventive-care note generation. Milestones and SSHADESS sub-tabs land in a follow-up; this first port covers the Visit Note pane.`})]}),(0,o.jsxs)(`form`,{onSubmit:D,className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,o.jsx)(`input`,{className:O,value:e,onChange:e=>t(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,o.jsxs)(`select`,{className:O,value:n,onChange:e=>s(e.target.value),children:[(0,o.jsx)(`option`,{value:``,children:`Select`}),(0,o.jsx)(`option`,{children:`Male`}),(0,o.jsx)(`option`,{children:`Female`})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Visit age`}),(0,o.jsx)(`input`,{className:O,placeholder:`e.g. 6 months`,value:c,onChange:e=>l(e.target.value)})]})]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Vital signs`}),(0,o.jsx)(`textarea`,{className:O+` min-h-[60px] font-mono text-xs`,value:u,onChange:e=>d(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Measurements / growth`}),(0,o.jsx)(`textarea`,{className:O+` min-h-[60px] font-mono text-xs`,value:f,onChange:e=>p(e.target.value)})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Parent / patient concerns`}),(0,o.jsx)(`textarea`,{className:O+` min-h-[60px] text-sm`,value:m,onChange:e=>h(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Transcript / dictation`}),(0,o.jsx)(`textarea`,{className:O+` min-h-[160px] font-mono text-sm`,value:g,onChange:e=>_(e.target.value)})]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Screenings completed`}),(0,o.jsx)(`textarea`,{className:O+` min-h-[60px] text-xs`,value:v,onChange:e=>y(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Immunizations today`}),(0,o.jsx)(`textarea`,{className:O+` min-h-[60px] text-xs`,value:b,onChange:e=>x(e.target.value)})]})]}),(0,o.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Note style`}),(0,o.jsxs)(`select`,{className:O,value:S,onChange:e=>C(e.target.value),children:[(0,o.jsx)(`option`,{value:`full`,children:`Full encounter note`}),(0,o.jsx)(`option`,{value:`short`,children:`Brief SOAP`})]})]}),E.error&&(0,o.jsx)(`div`,{className:`text-sm text-destructive`,children:E.error.message}),(0,o.jsx)(`button`,{type:`submit`,disabled:E.isPending||!e.trim()&&!c.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:E.isPending?`Generating…`:`Generate Well Visit Note`})]}),w&&(0,o.jsxs)(`section`,{className:`rounded-lg border border-border bg-card`,children:[(0,o.jsxs)(`header`,{className:`px-4 py-2 border-b border-border flex items-center justify-between bg-muted/40`,children:[(0,o.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Well Visit Note`}),(0,o.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(w),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,o.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:w})]})]})}export{s as default}; \ No newline at end of file diff --git a/public/app/assets/fenton-9EKyvVkL.js b/public/app/assets/fenton-9EKyvVkL.js new file mode 100644 index 0000000..4db3ef3 --- /dev/null +++ b/public/app/assets/fenton-9EKyvVkL.js @@ -0,0 +1 @@ +function e(e){if(e==null)return null;let t=String(e).toLowerCase().trim();if(!t)return null;if(/^[\d.]+$/.test(t)){let e=Number.parseFloat(t);return Number.isNaN(e)?null:e}let n=0,r=!1,i=t.match(/([\d.]+)\s*(?:years|year|yrs|yr|y)(?![a-z])/);i&&(n+=Number.parseFloat(i[1])*12,r=!0);let a=t.match(/([\d.]+)\s*(?:months|month|mos|mo|m)(?![a-z])/);a&&(n+=Number.parseFloat(a[1]),r=!0);let o=t.match(/([\d.]+)\s*(?:weeks|week|wks|wk|w)(?![a-z])/);o&&(n+=Number.parseFloat(o[1])*7/30.4375,r=!0);let s=t.match(/([\d.]+)\s*(?:days|day|d)(?![a-z])/);return s&&(n+=Number.parseFloat(s[1])/30.4375,r=!0),r?n:null}function t(e){if(e<1){let t=Math.round(e*30.4375);return`${t} day${t===1?``:`s`} (${e.toFixed(2)} mo)`}if(e<24)return`${n(e,1)} months`;let t=Math.floor(e/12),r=Math.round(e-t*12);return r===12&&(t+=1,r=0),`${t} yr${r?` ${r} mo`:``} (${Math.round(e)} mo total)`}function n(e,t){let n=10**t;return Math.round(e*n)/n}function r(e){if(e==null||Number.isNaN(e)||e<0)return null;let t=e/12,r;r=e<12?.5*e+4:t<=5?2*t+8:3*t+7;let i;i=e<12?(e+9)/2:t<=5?2*(t+5):4*t;let a;return a=t<13?e<12?`APLS 0-12 mo`:t<=5?`APLS 1-5 yr`:`APLS 6-12 yr`:`Best Guess 5-14 yr`,{weight:Math.max(.3,n(t<13?r:i,1)),formulaLabel:a,all:{apls:n(r,1),bestGuess:n(i,1)}}}function i(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?null:Math.sqrt(t*e/3600)}function a(e){let t=e.frequencyPerDay??1,n=e.maxSingleDoseMg??0,r=e.concentrationMgPerMl??0;if(!Number.isFinite(e.weightKg)||!Number.isFinite(e.dosePerKg)||!Number.isFinite(t)||e.weightKg<=0||e.dosePerKg<=0||t<=0)return null;let i=e.weightKg*e.dosePerKg,a=!1;return n>0&&i>n&&(i=n,a=!0),{singleDoseMg:i,dailyDoseMg:i*t,frequencyPerDay:t,capped:a,volumeMl:r>0?i/r:null}}function o(e,t,n,r=`mg`){let i=e*t,a=Math.round(i*100)/100,o=n!=null&&n>0,s=o&&a>n,c=s?n:a,l=`(${t} ${r}/kg`;return o&&(l+=`, max ${n} ${r}`),s&&(l+=` · capped`),l+=`)`,{value:c,unit:r,capped:s,perKg:t,max:o?n:null,label:`${c} ${r} ${l}`}}function s(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||e<1||e>4||t<1||t>5||n<1||n>6)return null;let r=e+t+n,i;return i=r<=8?`Severe (Coma)`:r<=12?`Moderate`:`Mild`,{total:r,severity:i}}var c={male:{22:{L:.21,M:496,S:.17},24:{L:.21,M:660,S:.17},26:{L:.21,M:870,S:.16},28:{L:.2,M:1124,S:.15},30:{L:.18,M:1430,S:.14},32:{L:.15,M:1795,S:.14},34:{L:.12,M:2230,S:.13},36:{L:.08,M:2710,S:.13},38:{L:.04,M:3195,S:.12},40:{L:.01,M:3530,S:.12},42:{L:-.02,M:3820,S:.12},44:{L:-.04,M:4200,S:.12},46:{L:-.06,M:4680,S:.12},48:{L:-.07,M:5200,S:.12},50:{L:-.08,M:5760,S:.12}},female:{22:{L:.23,M:474,S:.17},24:{L:.22,M:610,S:.17},26:{L:.22,M:810,S:.16},28:{L:.21,M:1040,S:.15},30:{L:.19,M:1330,S:.14},32:{L:.16,M:1680,S:.14},34:{L:.12,M:2090,S:.13},36:{L:.08,M:2540,S:.13},38:{L:.04,M:3e3,S:.12},40:{L:.01,M:3340,S:.12},42:{L:-.02,M:3630,S:.12},44:{L:-.04,M:4010,S:.12},46:{L:-.06,M:4470,S:.12},48:{L:-.07,M:4970,S:.12},50:{L:-.08,M:5510,S:.12}}};function l(e,t){let n=Object.keys(e).map(Number).sort((e,t)=>e-t);if(t<=n[0])return e[n[0]];if(t>=n[n.length-1])return e[n[n.length-1]];for(let r=0;r=n[r]&&t<=n[r+1]){let i=(t-n[r])/(n[r+1]-n[r]),a=e[n[r]],o=e[n[r+1]];return{L:a.L+i*(o.L-a.L),M:a.M+i*(o.M-a.M),S:a.S+i*(o.S-a.S)}}return e[n[0]]}function u(e,t,n,r){return t===0?Math.log(e/n)/r:((e/n)**+t-1)/(t*r)}function d(e){let t=1/(1+.2316419*Math.abs(e)),n=.3989423*Math.exp(-e*e/2)*t*(.3193815+t*(-.3565638+t*(1.781478+t*(-1.821256+t*1.330274))));return e>0&&(n=1-n),n*100}function f(e,t,n){let r=l(c[n],e),i=u(t,r.L,r.M,r.S),a=d(i);return{L:r.L,M:r.M,S:r.S,z:i,percentile:a}}function p(e){return e<10?`SGA`:e>90?`LGA`:`AGA`}var m={male:{22:{L:.5885,M:496,S:.12802},23:{L:.7565,M:571,S:.14547},24:{L:.9128,M:651,S:.16235},25:{L:1.0544,M:741,S:.17765},26:{L:1.1862,M:841,S:.19029},27:{L:1.3051,M:953,S:.19989},28:{L:1.3699,M:1079,S:.20777},29:{L:1.4165,M:1223,S:.21163},30:{L:1.4172,M:1388,S:.21185},31:{L:1.3755,M:1578,S:.20785},32:{L:1.2952,M:1790,S:.20112},33:{L:1.1974,M:2018,S:.19143},34:{L:1.0743,M:2255,S:.18119},35:{L:.9583,M:2493,S:.16992},36:{L:.846,M:2726,S:.16001},37:{L:.7543,M:2947,S:.15072},38:{L:.665,M:3156,S:.14304},39:{L:.5881,M:3360,S:.13641},40:{L:.5237,M:3568,S:.13173},41:{L:.4691,M:3785,S:.12863},42:{L:.4216,M:4014,S:.12735}},female:{22:{L:-.0868,M:481,S:.13605},23:{L:.2119,M:537,S:.14635},24:{L:.5281,M:606,S:.16134},25:{L:.8258,M:694,S:.18077},26:{L:1.0501,M:792,S:.19889},27:{L:1.2084,M:899,S:.21323},28:{L:1.2599,M:1017,S:.22437},29:{L:1.2539,M:1152,S:.22982},30:{L:1.2262,M:1306,S:.23082},31:{L:1.1223,M:1482,S:.22733},32:{L:1.0122,M:1681,S:.21846},33:{L:.8746,M:1897,S:.20681},34:{L:.7299,M:2126,S:.19407},35:{L:.5929,M:2362,S:.18059},36:{L:.4534,M:2602,S:.17028},37:{L:.3462,M:2835,S:.16139},38:{L:.2636,M:3050,S:.15513},39:{L:.2069,M:3239,S:.15004},40:{L:.167,M:3415,S:.14649},41:{L:.1517,M:3596,S:.14359},42:{L:.1308,M:3787,S:.14127}}};function h(e,t,n,r){return Math.abs(t)<.001?Math.log(e/n)/r:((e/n)**+t-1)/(t*r)}function g(e){let t=e<0?-1:1,n=Math.abs(e)/Math.sqrt(2),r=1/(1+.3275911*n),i=1-((((1.061405429*r+-1.453152027)*r+1.421413741)*r+-.284496736)*r+.254829592)*r*Math.exp(-n*n);return Math.round((1+t*i)/2*1e3)/10}function _(e,t=0){let n=e+t/7;return n<28?{label:`Extremely Preterm`,color:`#dc2626`,icon:`triangle-exclamation`}:n<32?{label:`Very Preterm`,color:`#ea580c`,icon:`triangle-exclamation`}:n<34?{label:`Moderate Preterm`,color:`#d97706`,icon:`circle-exclamation`}:n<37?{label:`Late Preterm`,color:`#ca8a04`,icon:`circle-info`}:n<39?{label:`Early Term`,color:`#2563eb`,icon:`circle-info`}:n<41?{label:`Full Term`,color:`#16a34a`,icon:`circle-check`}:n<42?{label:`Late Term`,color:`#d97706`,icon:`circle-info`}:{label:`Post Term`,color:`#dc2626`,icon:`triangle-exclamation`}}function v(e){return e<1e3?{label:`Extremely Low Birth Weight (ELBW)`,color:`#dc2626`}:e<1500?{label:`Very Low Birth Weight (VLBW)`,color:`#ea580c`}:e<2500?{label:`Low Birth Weight (LBW)`,color:`#d97706`}:e<=4e3?{label:`Normal Birth Weight`,color:`#16a34a`}:{label:`Macrosomia (>4000g)`,color:`#ea580c`}}function y(e){return e<3?{label:`Severely SGA`,color:`#dc2626`,detail:`<3rd percentile`}:e<10?{label:`SGA`,color:`#ea580c`,detail:`<10th percentile`}:e>97?{label:`Severely LGA`,color:`#dc2626`,detail:`>97th percentile`}:e>90?{label:`LGA`,color:`#ea580c`,detail:`>90th percentile`}:{label:`AGA`,color:`#16a34a`,detail:`10th-90th percentile`}}function b(e,t,n,r){let i=e+t/7,a=l(m[r],i),o=h(n,a.L,a.M,a.S),s=g(o);return{gaDecimal:i,gaClass:_(e,t),bwClass:v(n),weightClass:y(s),expectedWeight:Math.round(a.M),z:o,percentile:s,L:a.L,M:a.M,S:a.S}}export{s as a,r as c,e as d,b as i,t as l,f as n,i as o,l as r,a as s,p as t,o as u}; \ No newline at end of file diff --git a/public/app/assets/index-4IQgLQaQ.js b/public/app/assets/index-4IQgLQaQ.js deleted file mode 100644 index eebb638..0000000 --- a/public/app/assets/index-4IQgLQaQ.js +++ /dev/null @@ -1,52 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function ee(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return ee(e.type,t,e.props)}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function re(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ie=/\/+/g;function ae(e,t){return typeof e==`object`&&e&&e.key!=null?re(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function se(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,se(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ae(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ie,`$&/`)+`/`),se(o,r,i,``,function(e){return e})):o!=null&&(ne(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ie,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,ne());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-Tt&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=te,ne=function(){ie.postMessage(null)}}else ne=function(){_(te,0)};function ae(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1fe||(e.current=de[fe],de[fe]=null,fe--)}function O(e,t){fe++,de[fe]=e.current,e.current=t}var he=pe(null),ge=pe(null),_e=pe(null),ve=pe(null);function ye(e,t){switch(O(_e,t),O(ge,e),O(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qd(t),e=Jd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}me(he),O(he,e)}function be(){me(he),me(ge),me(_e)}function xe(e){e.memoizedState!==null&&O(ve,e);var t=he.current,n=Jd(t,e.type);t!==n&&(O(ge,e),O(he,n))}function Se(e){ge.current===e&&(me(he),me(ge)),ve.current===e&&(me(ve),Qf._currentValue=ue)}var Ce,we;function Te(e){if(Ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ce=t&&t[1]||``,we=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ee=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Te(n):``}function Oe(e,t){switch(e.tag){case 26:case 27:case 5:return Te(e.type);case 16:return Te(`Lazy`);case 13:return e.child!==t&&t!==null?Te(`Suspense Fallback`):Te(`Suspense`);case 19:return Te(`SuspenseList`);case 0:case 15:return De(e.type,!1);case 11:return De(e.type.render,!1);case 1:return De(e.type,!0);case 31:return Te(`Activity`);default:return``}}function ke(e){try{var t=``,n=null;do t+=Oe(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var Ae=Object.prototype.hasOwnProperty,je=t.unstable_scheduleCallback,Me=t.unstable_cancelCallback,Ne=t.unstable_shouldYield,Pe=t.unstable_requestPaint,Fe=t.unstable_now,Ie=t.unstable_getCurrentPriorityLevel,Le=t.unstable_ImmediatePriority,Re=t.unstable_UserBlockingPriority,ze=t.unstable_NormalPriority,Be=t.unstable_LowPriority,Ve=t.unstable_IdlePriority,He=t.log,Ue=t.unstable_setDisableYieldValue,We=null,Ge=null;function Ke(e){if(typeof He==`function`&&Ue(e),Ge&&typeof Ge.setStrictMode==`function`)try{Ge.setStrictMode(We,e)}catch{}}var qe=Math.clz32?Math.clz32:Xe,Je=Math.log,Ye=Math.LN2;function Xe(e){return e>>>=0,e===0?32:31-(Je(e)/Ye|0)|0}var Ze=256,Qe=262144,$e=4194304;function k(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function et(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=k(n))):i=k(o):i=k(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=k(n))):i=k(o)):i=k(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function tt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rt(){var e=$e;return $e<<=1,!($e&62914560)&&($e=4194304),e}function it(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function at(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ot(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),gn=!1;if(hn)try{var _n={};Object.defineProperty(_n,`passive`,{get:function(){gn=!0}}),window.addEventListener(`test`,_n,_n),window.removeEventListener(`test`,_n,_n)}catch{gn=!1}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e=$n),nr=` `,rr=!1;function ir(e,t){switch(e){case`keyup`:return Zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ar(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var or=!1;function sr(e,t){switch(e){case`compositionend`:return ar(t);case`keypress`:return t.which===32?(rr=!0,nr):null;case`textInput`:return e=t.data,e===nr&&rr?null:e;default:return null}}function cr(e,t){if(or)return e===`compositionend`||!Qn&&ir(e,t)?(e=xn(),bn=yn=vn=null,or=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ar(n)}}function Mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ht(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ht(e.document)}return t}function Pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Fr=hn&&`documentMode`in document&&11>=document.documentMode,Ir=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||Ir==null||Ir!==Ht(r)||(r=Ir,`selectionStart`in r&&Pr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&kr(Rr,r)||(Rr=r,r=Md(Lr,`onSelect`),0>=o,i-=o,Ai=1<<32-qe(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),F&&Mi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),F&&Mi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return F&&Mi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),F&&Mi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ne&&ja(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ra(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=yi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=vi(o.type,o.key,o.props,null,e.mode,c),Ra(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=Si(o,e.mode,c),c.return=e,e=c}return s(e);case ne:return o=ja(o),b(e,r,o,c)}if(le(o))return h(e,r,o,c);if(oe(o)){if(l=oe(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,La(o),c);if(o.$$typeof===C)return b(e,r,aa(e,o),c);za(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=bi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ia=0;var i=b(e,t,n,r);return Fa=null,i}catch(t){if(t===Ta||t===Da)throw t;var a=mi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Va=Ba(!0),Ha=Ba(!1),Ua=!1;function Wa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ga(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,B&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=di(e),ui(e,null,n),t}return si(e,r,t,n),di(e)}function Ja(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ct(e,n)}}function Ya(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Xa=!1;function Za(){if(Xa){var e=ga;if(e!==null)throw e}}function Qa(e,t,n,r){Xa=!1;var i=e.updateQueue;Ua=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(H&f)===f:(r&f)===f){f!==0&&f===ha&&(Xa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ua=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ql|=o,e.lanes=o,e.memoizedState=d}}function $a(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function eo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=E.T,s={};E.T=s,zs(e,!1,t,n);try{var c=i(),l=E.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Rs(e,t,ya(c,r),yu(e)):Rs(e,t,r,yu(e))}catch(n){Rs(e,t,{then:function(){},status:`rejected`,reason:n},yu())}finally{D.p=a,o!==null&&s.types!==null&&(o.types=s.types),E.T=o}}function Os(){}function ks(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=As(e).queue;Ds(e,a,t,ue,n===null?Os:function(){return js(e),n(r)})}function As(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:ue},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function js(e){var t=As(e);t.next===null&&(t=e.alternate.memoizedState),Rs(e,t.next.queue,{},yu())}function Ms(){return ia(Qf)}function Ns(){return Fo().memoizedState}function Ps(){return Fo().memoizedState}function Fs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=yu();e=Ka(n);var r=qa(t,e,n);r!==null&&(xu(r,t,n),Ja(r,t,n)),t={cache:da()},e.payload=t;return}t=t.return}}function Is(e,t,n){var r=yu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bs(e)?Vs(t,n):(n=ci(e,t,n,r),n!==null&&(xu(n,e,r),Hs(n,t,r)))}function Ls(e,t,n){Rs(e,t,n,yu())}function Rs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bs(e))Vs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Or(s,o))return si(e,t,i,0),Gl===null&&oi(),!1}catch{}if(n=ci(e,t,i,r),n!==null)return xu(n,e,r),Hs(n,t,r),!0}return!1}function zs(e,t,n,r){if(r={lane:2,revertLane:_d(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Bs(e)){if(t)throw Error(i(479))}else t=ci(e,n,r,2),t!==null&&xu(t,e,2)}function Bs(e){var t=e.alternate;return e===L||t!==null&&t===L}function Vs(e,t){yo=vo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ct(e,n)}}var Us={readContext:ia,use:Ro,useCallback:To,useContext:To,useEffect:To,useImperativeHandle:To,useLayoutEffect:To,useInsertionEffect:To,useMemo:To,useReducer:To,useRef:To,useState:To,useDebugValue:To,useDeferredValue:To,useTransition:To,useSyncExternalStore:To,useId:To,useHostTransitionStatus:To,useFormState:To,useActionState:To,useOptimistic:To,useMemoCache:To,useCacheRefresh:To};Us.useEffectEvent=To;var Ws={readContext:ia,use:Ro,useCallback:function(e,t){return Po().memoizedState=[e,t===void 0?null:t],e},useContext:ia,useEffect:ms,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),fs(4194308,4,bs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fs(4194308,4,e,t)},useInsertionEffect:function(e,t){fs(4,2,e,t)},useMemo:function(e,t){var n=Po();t=t===void 0?null:t;var r=e();if(bo){Ke(!0);try{e()}finally{Ke(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Po();if(n!==void 0){var i=n(t);if(bo){Ke(!0);try{n(t)}finally{Ke(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Is.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=Po();return e={current:e},t.memoizedState=e},useState:function(e){e=Xo(e);var t=e.queue,n=Ls.bind(null,L,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ss,useDeferredValue:function(e,t){return Ts(Po(),e,t)},useTransition:function(){var e=Xo(!1);return e=Ds.bind(null,L,e.queue,!0,!1),Po().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=L,a=Po();if(F){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Gl===null)throw Error(i(349));H&127||Go(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ms(qo.bind(null,r,o,e),[e]),r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,o,n,t),null),n},useId:function(){var e=Po(),t=Gl.identifierPrefix;if(F){var n=ji,r=Ai;n=(r&~(1<<32-qe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=xo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ht]=t,o[A]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Bd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Rc(t)}}return Uc(t),zc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=_e.current,Gi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Li,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ht]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Rd(e.nodeValue,n)),e||Hi(t,!0)}else e=Kd(e).createTextNode(r),e[ht]=t,t.stateNode=e}return Uc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Gi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ht]=t}else Ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),e=!1}else n=qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(po(t),t):(po(t),null);if(t.flags&128)throw Error(i(558))}return Uc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Gi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ht]=t}else Ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),a=!1}else a=qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(po(t),t):(po(t),null)}return po(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Vc(t,t.updateQueue),Uc(t),null);case 4:return be(),e===null&&Od(t.stateNode.containerInfo),Uc(t),null;case 10:return Qi(t.type),Uc(t),null;case 19:if(me(mo),r=t.memoizedState,r===null)return Uc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Hc(r,!1);else{if(Zl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ho(e),o!==null){for(t.flags|=128,Hc(r,!1),e=o.updateQueue,t.updateQueue=e,Vc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)_i(n,e),n=n.sibling;return O(mo,mo.current&1|2),F&&Mi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Fe()>cu&&(t.flags|=128,a=!0,Hc(r,!1),t.lanes=4194304)}else{if(!a)if(e=ho(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Vc(t,e),Hc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!F)return Uc(t),null}else 2*Fe()-r.renderingStartTime>cu&&n!==536870912&&(t.flags|=128,a=!0,Hc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Uc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Fe(),e.sibling=null,n=mo.current,O(mo,a?n&1|2:n&1),F&&Mi(t,r.treeForkCount),e);case 22:case 23:return po(t),ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Uc(t),t.subtreeFlags&6&&(t.flags|=8192)):Uc(t),n=t.updateQueue,n!==null&&Vc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&me(xa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Qi(ua),Uc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Gc(e,t){switch(Fi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(ua),be(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Se(t),null;case 31:if(t.memoizedState!==null){if(po(t),t.alternate===null)throw Error(i(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(po(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return me(mo),null;case 4:return be(),null;case 10:return Qi(t.type),null;case 22:case 23:return po(t),ao(),e!==null&&me(xa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qi(ua),null;case 25:return null;default:return null}}function Kc(e,t){switch(Fi(t),t.tag){case 3:Qi(ua),be();break;case 26:case 27:case 5:Se(t);break;case 4:be();break;case 31:t.memoizedState!==null&&po(t);break;case 13:po(t);break;case 19:me(mo);break;case 10:Qi(t.type);break;case 22:case 23:po(t),ao(),e!==null&&me(xa);break;case 24:Qi(ua)}}function qc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){G(t,t.return,e)}}function Jc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){G(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){G(t,t.return,e)}}function Yc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{eo(t,n)}catch(t){G(e,e.return,t)}}}function Xc(e,t,n){n.props=Zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){G(e,t,n)}}function Zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){G(e,t,n)}}function Qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){G(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){G(e,t,n)}else n.current=null}function $c(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){G(e,e.return,t)}}function el(e,t,n){try{var r=e.stateNode;Vd(r,e.type,n,t),r[A]=t}catch(t){G(e,e.return,t)}}function tl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rf(e.type)||e.tag===4}function nl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||tl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&rf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function rl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=on));else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(rl(e,t,n),e=e.sibling;e!==null;)rl(e,t,n),e=e.sibling}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Bd(t,r,n),t[ht]=e,t[A]=n}catch(t){G(e,e.return,t)}}var ol=!1,sl=!1,cl=!1,ll=typeof WeakSet==`function`?WeakSet:Set,ul=null;function dl(e,t){if(e=e.containerInfo,Wd=sp,e=Nr(e),Pr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Gd={focusedElem:e,selectionRange:n},sp=!1,ul=t;ul!==null;)if(t=ul,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ul=e;else for(;ul!==null;){switch(t=ul,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Bd(o,r,n),o[ht]=e,Tt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=jr(s,h),v=jr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,E.T=null,n=gu,gu=null;var o=fu,s=mu;if(du=0,pu=fu=null,mu=0,B&6)throw Error(i(331));var c=B;if(B|=4,Bl(o.current),Ml(o,o.current,s,n),B=c,ud(0,!1),Ge&&typeof Ge.onPostCommitFiberRoot==`function`)try{Ge.onPostCommitFiberRoot(We,o)}catch{}return!0}finally{D.p=a,E.T=r,qu(e,t)}}function Xu(e,t,n){t=wi(n,t),t=rc(e.stateNode,t,2),e=qa(e,t,2),e!==null&&(at(e,2),ld(e))}function G(e,t,n){if(e.tag===3)Xu(e,e,n);else for(;t!==null;){if(t.tag===3){Xu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(uu===null||!uu.has(r))){e=wi(n,e),n=ic(2),r=qa(t,n,2),r!==null&&(ac(n,r,t,e),at(r,2),ld(r));break}}t=t.return}}function Zu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Wl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Yl=!0,i.add(n),e=Qu.bind(null,e,t,n),t.then(e,e))}function Qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Gl===e&&(H&n)===n&&(Zl===4||Zl===3&&(H&62914560)===H&&300>Fe()-ou?!(B&2)&&Ou(e,0):eu|=n,nu===H&&(nu=0)),ld(e)}function $u(e,t){t===0&&(t=rt()),e=li(e,t),e!==null&&(at(e,t),ld(e))}function ed(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$u(e,n)}function td(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),$u(e,n)}function nd(e,t){return je(e,t)}var rd=null,id=null,ad=!1,od=!1,sd=!1,cd=0;function ld(e){e!==id&&e.next===null&&(id===null?rd=id=e:id=id.next=e),od=!0,ad||(ad=!0,gd())}function ud(e,t){if(!sd&&od){sd=!0;do for(var n=!1,r=rd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-qe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,hd(r,a))}else a=H,a=et(r,r===Gl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||tt(r,a)||(n=!0,hd(r,a));r=r.next}while(n);sd=!1}}function dd(){fd()}function fd(){od=ad=!1;var e=0;cd!==0&&Zd()&&(e=cd);for(var t=Fe(),n=null,r=rd;r!==null;){var i=r.next,a=pd(r,t);a===0?(r.next=null,n===null?rd=i:n.next=i,i===null&&(id=n)):(n=r,(e!==0||a&3)&&(od=!0)),r=i}du!==0&&du!==5||ud(e,!1),cd!==0&&(cd=0)}function pd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function wf(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=Wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bf.has(i)||(bf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Bd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Tf(e){Y.D(e),wf(`dns-prefetch`,e,null)}function Ef(e,t){Y.C(e,t),wf(`preconnect`,e,t)}function Df(e,t,n){Y.L(e,t,n);var r=Cf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Wt(n.imageSizes)+`"]`)):i+=`[href="`+Wt(e)+`"]`;var a=i;switch(t){case`style`:a=Z(e);break;case`script`:a=Ff(e)}J.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),J.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Q(a))||t===`script`&&r.querySelector(If(a))||(t=r.createElement(`link`),Bd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Of(e,t){Y.m(e,t);var n=Cf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Wt(r)+`"][href="`+Wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Ff(e)}if(!J.has(a)&&(e=h({rel:`modulepreload`,href:e},t),J.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(If(a)))return}r=n.createElement(`link`),Bd(r,`link`,e),Tt(r),n.head.appendChild(r)}}}function kf(e,t,n){Y.S(e,t,n);var r=Cf;if(r&&e){var i=wt(r).hoistableStyles,a=Z(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Q(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=J.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);Tt(c),Bd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,$(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Af(e,t){Y.X(e,t);var n=Cf;if(n&&e){var r=wt(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=h({src:e,async:!0},t),(t=J.get(i))&&zf(e,t),a=n.createElement(`script`),Tt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t){Y.M(e,t);var n=Cf;if(n&&e){var r=wt(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=J.get(i))&&zf(e,t),a=n.createElement(`script`),Tt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t,n,r){var a=(a=_e.current)?xf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Z(n.href),n=wt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Z(n.href);var o=wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Q(e)))&&!o._p&&(s.instance=o,s.state.loading=5),J.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},J.set(e,n),o||Pf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Ff(n),n=wt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Z(e){return`href="`+Wt(e)+`"`}function Q(e){return`link[rel="stylesheet"][`+e+`]`}function Nf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Pf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Bd(t,`link`,n),Tt(t),e.head.appendChild(t))}function Ff(e){return`[src="`+Wt(e)+`"]`}function If(e){return`script[async]`+e}function Lf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Wt(n.href)+`"]`);if(r)return t.instance=r,Tt(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Tt(r),Bd(r,`style`,a),$(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Z(n.href);var o=e.querySelector(Q(a));if(o)return t.state.loading|=4,t.instance=o,Tt(o),o;r=Nf(n),(a=J.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),Tt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Bd(o,`link`,r),t.state.loading|=4,$(o,n.precedence,e),t.instance=o;case`script`:return o=Ff(n.src),(a=e.querySelector(If(o)))?(t.instance=a,Tt(a),a):(r=n,(a=J.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Tt(a),Bd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,$(r,n.precedence,e));return t.instance}function $(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Z(r.href),a=t.querySelector(Q(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Tt(a);return}a=t.ownerDocument||t,r=Nf(r),(i=J.get(i))&&Rf(r,i),a=a.createElement(`link`),Tt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Bd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g(),y=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},b=new class extends y{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},x={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},S=new class{#e=x;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function C(e){setTimeout(e,0)}var w=typeof window>`u`||`Deno`in globalThis;function T(){}function ee(e,t){return typeof e==`function`?e(t):e}function te(e){return typeof e==`number`&&e>=0&&e!==1/0}function ne(e,t){return Math.max(e+(t||0)-Date.now(),0)}function re(e,t){return typeof e==`function`?e(t):e}function ie(e,t){return typeof e==`function`?e(t):e}function ae(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==se(o,t.options))return!1}else if(!le(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function oe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ce(t.options.mutationKey)!==ce(a))return!1}else if(!le(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function se(e,t){return(t?.queryKeyHashFn||ce)(e)}function ce(e){return JSON.stringify(e,(e,t)=>fe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function le(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>le(e[n],t[n])):!1}var E=Object.prototype.hasOwnProperty;function D(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=de(e)&&de(t);if(!r&&!(fe(e)&&fe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{S.setTimeout(t,e)})}function O(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:D(e,t)}function he(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ge(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var _e=Symbol();function ve(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===_e?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ye(e,t){return typeof e==`function`?e(...t):!!e}function be(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var xe=(()=>{let e=()=>w;return{isServer(){return e()},setIsServer(t){e=t}}})();function Se(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Ce=C;function we(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ce,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Te=we(),Ee=new class extends y{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function De(e){return Math.min(1e3*2**e,3e4)}function Oe(e){return(e??`online`)===`online`?Ee.isOnline():!0}var ke=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ae(e){let t=!1,n=0,r,i=Se(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ke(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>b.isFocused()&&(e.networkMode===`always`||Ee.isOnline())&&e.canRun(),u=()=>Oe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(xe.isServer()?0:3),o=e.retryDelay??De,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var je=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),te(this.gcTime)&&(this.#e=S.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(xe.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(S.clearTimeout(this.#e),this.#e=void 0)}},Me=class extends je{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Fe(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Fe(this.options);e.data!==void 0&&(this.setState(Pe(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=O(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(T).catch(T):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>ie(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_e||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>re(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ne(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=ve(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=Ae({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ke&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ke){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ne(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Pe(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Te.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Ne(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Oe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Pe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Fe(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ie=class extends y{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Se(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Re(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ze(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ze(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof ie(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ue(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Be(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||ie(this.options.enabled,this.#t)!==ie(t.enabled,this.#t)||re(this.options.staleTime,this.#t)!==re(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||ie(this.options.enabled,this.#t)!==ie(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return He(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(T)),t}#g(){this.#b();let e=re(this.options.staleTime,this.#t);if(xe.isServer()||this.#r.isStale||!te(e))return;let t=ne(this.#r.dataUpdatedAt,e)+1;this.#d=S.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(xe.isServer()||ie(this.options.enabled,this.#t)===!1||!te(this.#p)||this.#p===0)&&(this.#f=S.setInterval(()=>{(this.options.refetchIntervalInBackground||b.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(S.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(S.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Re(e,t),o=i&&Be(e,n,t,r);(a||o)&&(l={...l,...Ne(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=O(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=O(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ve(e,t),refetch:this.refetch,promise:this.#o,isEnabled:ie(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Se())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!ue(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){Te.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Le(e,t){return ie(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&ie(t.retryOnMount,e)===!1)}function Re(e,t){return Le(e,t)||e.state.data!==void 0&&ze(e,t,t.refetchOnMount)}function ze(e,t,n){if(ie(t.enabled,e)!==!1&&re(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ve(e,t)}return!1}function Be(e,t,n,r){return(e!==t||ie(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ve(e,n)}function Ve(e,t){return ie(t.enabled,e)!==!1&&e.isStaleByTime(re(t.staleTime,e))}function He(e,t){return!ue(e.getCurrentResult(),t)}function Ue(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{be(e,()=>t.signal,()=>n=!0)},u=ve(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ge:he;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ge:We,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:We(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function We(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ge(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ke=class extends je{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||qe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Ae({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Te.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function qe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Je=class extends y{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ke({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ye(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ye(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ye(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ye(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Te.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>oe(t,e))}findAll(e={}){return this.getAll().filter(t=>oe(e,t))}notify(e){Te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Te.batch(()=>Promise.all(e.map(e=>e.continue().catch(T))))}};function Ye(e){return e.options.scope?.id}var Xe=class extends y{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),ue(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ce(t.mutationKey)!==ce(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??qe();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Te.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Ze=class extends y{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??se(r,t),a=this.get(i);return a||(a=new Me({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Te.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ae(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ae(e,t)):t}notify(e){Te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Te.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Te.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Qe=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ze,this.#t=e.mutationCache||new Je,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=b.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ee.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(re(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Te.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Te.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Te.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Te.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(T).catch(T)}invalidateQueries(e,t={}){return Te.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Te.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(T)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(T)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(re(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(T).catch(T)}fetchInfiniteQuery(e){return e.behavior=Ue(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(T).catch(T)}ensureInfiniteQueryData(e){return e.behavior=Ue(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ee.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ce(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{le(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ce(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{le(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=se(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===_e&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},$e=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),k=o(((e,t)=>{t.exports=$e()}))(),et=_.createContext(void 0),tt=e=>{let t=_.useContext(et);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},nt=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(et.Provider,{value:e,children:t})),rt=_.createContext(!1),it=()=>_.useContext(rt);rt.Provider;function at(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ot=_.createContext(at()),st=()=>_.useContext(ot),ct=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ye(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},lt=e=>{_.useEffect(()=>{e.clearReset()},[e])},ut=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ye(n,[e.error,r])),dt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ft=(e,t)=>e.isLoading&&e.isFetching&&!t,pt=(e,t)=>e?.suspense&&t.isPending,mt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ht(e,t,n){let r=it(),i=st(),a=tt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,dt(o),ct(o,i,s),lt(i);let c=!a.getQueryCache().get(o.queryHash),[l]=_.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(e=>{let t=d?l.subscribe(Te.batchCalls(e)):T;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),_.useEffect(()=>{l.setOptions(o)},[o,l]),pt(o,u))throw mt(o,l,i);if(ut({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!xe.isServer()&&ft(u,r)&&(c?mt(o,l,i):s?.promise)?.catch(T).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function A(e,t){return ht(e,Ie,t)}function j(e,t){let n=tt(t),[r]=_.useState(()=>new Xe(n,e));_.useEffect(()=>{r.setOptions(e)},[r,e]);let i=_.useSyncExternalStore(_.useCallback(e=>r.subscribe(Te.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=_.useCallback((e,t)=>{r.mutate(e,t).catch(T)},[r]);if(i.error&&ye(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var gt=`modulepreload`,_t=function(e){return`/app/`+e},vt={},yt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=_t(t,n),t in vt)return;vt[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:gt,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},bt=`popstate`;function xt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function St(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Et(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Dt(t)}return kt(t,n,null,e)}function M(e,t){if(e===!1||e==null)throw Error(t)}function Ct(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function wt(){return Math.random().toString(36).substring(2,10)}function Tt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Et(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ot(t):t,state:n,key:t&&t.key||r||wt(),unstable_mask:i}}function Dt({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Ot(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function kt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=xt(e)?e:Et(h.location,e,t);n&&n(r,e),l=u()+1;let d=Tt(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=xt(e)?e:Et(h.location,e,t);n&&n(r,e),l=u();let i=Tt(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return At(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(bt,d),c=e,()=>{i.removeEventListener(bt,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function At(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),M(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Dt(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function jt(e,t,n=`/`){return Mt(e,t,n,!1)}function Mt(e,t,n,r){let i=Xt((typeof t==`string`?Ot(t):t).pathname||`/`,n);if(i==null)return null;let a=Pt(e);It(a);let o=null;for(let e=0;o==null&&e{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;M(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=on([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(M(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Pt(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Wt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Ft(e.path))a(e,t,!0,n)}),t}function Ft(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Ft(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function It(e){e.sort((e,t)=>e.score===t.score?Gt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Lt=/^:[\w-]+$/,Rt=3,zt=2,Bt=1,Vt=10,Ht=-2,Ut=e=>e===`*`;function Wt(e,t){let n=e.split(`/`),r=n.length;return n.some(Ut)&&(r+=Ht),t&&(r+=zt),n.filter(e=>!Ut(e)).reduce((e,t)=>e+(Lt.test(t)?Rt:t===``?Bt:Vt),r)}function Gt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Kt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Jt(e,t=!1,n=!0){Ct(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Yt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Ct(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Xt(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Zt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Qt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ot(e):e,a;return n?(n=an(n),a=n.startsWith(`/`)?$t(n.substring(1),`/`):$t(n,t)):a=t,{pathname:a,search:ln(r),hash:un(i)}}function $t(e,t){let n=sn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function en(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function tn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function nn(e){let t=tn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function rn(e,t,n,r=!1){let i;typeof e==`string`?i=Ot(e):(i={...e},M(!i.pathname||!i.pathname.includes(`?`),en(`?`,`pathname`,`search`,i)),M(!i.pathname||!i.pathname.includes(`#`),en(`#`,`pathname`,`hash`,i)),M(!i.search||!i.search.includes(`#`),en(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Qt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var an=e=>e.replace(/\/\/+/g,`/`),on=e=>an(e.join(`/`)),sn=e=>e.replace(/\/+$/,``),cn=e=>sn(e).replace(/^\/*/,`/`),ln=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,un=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,dn=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function fn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function pn(e){return on(e.map(e=>e.route.path).filter(Boolean))||`/`}var mn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function hn(e,t){let n=e;if(typeof n!=`string`||!Zt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(mn)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Xt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Ct(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var gn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(gn);var _n=[`GET`,...gn];new Set(_n);var vn=_.createContext(null);vn.displayName=`DataRouter`;var yn=_.createContext(null);yn.displayName=`DataRouterState`;var bn=_.createContext(!1);function xn(){return _.useContext(bn)}var Sn=_.createContext({isTransitioning:!1});Sn.displayName=`ViewTransition`;var Cn=_.createContext(new Map);Cn.displayName=`Fetchers`;var wn=_.createContext(null);wn.displayName=`Await`;var Tn=_.createContext(null);Tn.displayName=`Navigation`;var En=_.createContext(null);En.displayName=`Location`;var Dn=_.createContext({outlet:null,matches:[],isDataRoute:!1});Dn.displayName=`Route`;var On=_.createContext(null);On.displayName=`RouteError`;var kn=`REACT_ROUTER_ERROR`,An=`REDIRECT`,jn=`ROUTE_ERROR_RESPONSE`;function Mn(e){if(e.startsWith(`${kn}:${An}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Nn(e){if(e.startsWith(`${kn}:${jn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new dn(t.status,t.statusText,t.data)}catch{}}function Pn(e,{relative:t}={}){M(Fn(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=_.useContext(Tn),{hash:i,pathname:a,search:o}=Un(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:on([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Fn(){return _.useContext(En)!=null}function In(){return M(Fn(),`useLocation() may be used only in the context of a component.`),_.useContext(En).location}var Ln=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Rn(e){_.useContext(Tn).static||_.useLayoutEffect(e)}function zn(){let{isDataRoute:e}=_.useContext(Dn);return e?cr():Bn()}function Bn(){M(Fn(),`useNavigate() may be used only in the context of a component.`);let e=_.useContext(vn),{basename:t,navigator:n}=_.useContext(Tn),{matches:r}=_.useContext(Dn),{pathname:i}=In(),a=JSON.stringify(nn(r)),o=_.useRef(!1);return Rn(()=>{o.current=!0}),_.useCallback((r,s={})=>{if(Ct(o.current,Ln),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=rn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:on([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Vn=_.createContext(null);function Hn(e){let t=_.useContext(Dn).outlet;return _.useMemo(()=>t&&_.createElement(Vn.Provider,{value:e},t),[t,e])}function Un(e,{relative:t}={}){let{matches:n}=_.useContext(Dn),{pathname:r}=In(),i=JSON.stringify(nn(n));return _.useMemo(()=>rn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Wn(e,t){return Gn(e,t)}function Gn(e,t,n){M(Fn(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=_.useContext(Tn),{matches:i}=_.useContext(Dn),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;ur(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. - -Please change the parent to .`)}let u=In(),d;if(t){let e=typeof t==`string`?Ot(t):t;M(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=jt(e,{pathname:p});Ct(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),Ct(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let h=Qn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:on([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:on([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?_.createElement(En.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function Kn(){let e=sr(),t=fn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=_.createElement(_.Fragment,null,_.createElement(`p`,null,`💿 Hey developer 👋`),_.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,_.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,_.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),_.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:i},n):null,o)}var qn=_.createElement(Kn,null),Jn=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Nn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:_.createElement(Dn.Provider,{value:this.props.routeContext},_.createElement(On.Provider,{value:e,children:this.props.component}));return this.context?_.createElement(Xn,{error:e},t):t}};Jn.contextType=bn;var Yn=new WeakMap;function Xn({children:e,error:t}){let{basename:n}=_.useContext(Tn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Mn(t.digest);if(e){let r=Yn.get(t);if(r)throw r;let i=hn(e.location,n);if(mn&&!Yn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Yn.set(t,n),n}return _.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Zn({routeContext:e,match:t,children:n}){let r=_.useContext(vn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Dn.Provider,{value:e},n)}function Qn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);M(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:pn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||qn,o&&(s<0&&c===0?(ur(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?_.createElement(n.route.Component,null):n.route.element?n.route.element:e,_.createElement(Zn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?_.createElement(Jn,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function $n(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function er(e){let t=_.useContext(vn);return M(t,$n(e)),t}function tr(e){let t=_.useContext(yn);return M(t,$n(e)),t}function nr(e){let t=_.useContext(Dn);return M(t,$n(e)),t}function rr(e){let t=nr(e),n=t.matches[t.matches.length-1];return M(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ir(){return rr(`useRouteId`)}function ar(){return tr(`useNavigation`).navigation}function or(){let{matches:e,loaderData:t}=tr(`useMatches`);return _.useMemo(()=>e.map(e=>Nt(e,t)),[e,t])}function sr(){let e=_.useContext(On),t=tr(`useRouteError`),n=rr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function cr(){let{router:e}=er(`useNavigate`),t=rr(`useNavigate`),n=_.useRef(!1);return Rn(()=>{n.current=!0}),_.useCallback(async(r,i={})=>{Ct(n.current,Ln),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var lr={};function ur(e,t,n){!t&&!lr[e]&&(lr[e]=!0,Ct(!1,n))}_.memo(dr);function dr({routes:e,future:t,state:n,isStatic:r,onError:i}){return Gn(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function fr({to:e,replace:t,state:n,relative:r}){M(Fn(),` may be used only in the context of a component.`);let{static:i}=_.useContext(Tn);Ct(!i,` must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.`);let{matches:a}=_.useContext(Dn),{pathname:o}=In(),s=zn(),c=rn(e,nn(a),o,r===`path`),l=JSON.stringify(c);return _.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function pr(e){return Hn(e.context)}function mr(e){M(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function hr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){M(!Fn(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=_.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Ot(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=_.useMemo(()=>{let e=Xt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Ct(h!=null,` is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the won't render anything.`),h==null?null:_.createElement(Tn.Provider,{value:c},_.createElement(En.Provider,{children:t,value:h}))}function gr({children:e,location:t}){return Wn(_r(e),t)}_.Component;function _r(e,t=[]){let n=[];return _.Children.forEach(e,(e,r)=>{if(!_.isValidElement(e))return;let i=[...t,r];if(e.type===_.Fragment){n.push.apply(n,_r(e.props.children,i));return}M(e.type===mr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),M(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=_r(e.props.children,i)),n.push(a)}),n}var vr=`get`,yr=`application/x-www-form-urlencoded`;function br(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function xr(e){return br(e)&&e.tagName.toLowerCase()===`button`}function Sr(e){return br(e)&&e.tagName.toLowerCase()===`form`}function Cr(e){return br(e)&&e.tagName.toLowerCase()===`input`}function wr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tr(e,t){return e.button===0&&(!t||t===`_self`)&&!wr(e)}var Er=null;function Dr(){if(Er===null)try{new FormData(document.createElement(`form`),0),Er=!1}catch{Er=!0}return Er}var Or=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function kr(e){return e!=null&&!Or.has(e)?(Ct(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${yr}"`),null):e}function Ar(e,t){let n,r,i,a,o;if(Sr(e)){let o=e.getAttribute(`action`);r=o?Xt(o,t):null,n=e.getAttribute(`method`)||vr,i=kr(e.getAttribute(`enctype`))||yr,a=new FormData(e)}else if(xr(e)||Cr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a