Nine of the ten Calculator pills now run in React. Only BP Percentile
(Rosner quantile splines, ~3,000 hand-transcribed coefficients across
6 LMS arrays and 4 spline matrices) remains legacy-linked; that port
deserves its own dedicated session with extra care.
shared/clinical/bmi.ts — CDC 2000 BMI-for-age
• bmiLMS table ported byte-for-byte from calculators.js:739
(74 LMS triples = 37 age points × 2 sexes, 24-240 months).
• normalCDF (Abramowitz & Stegun), calcBmiPercentile, classifyBMI
(including the %-of-95th severe-obesity split), and a top-level
computeBmi helper — all verbatim translations of the vanilla math.
• classification labels preserved exactly so existing e2e screenshots
or reporting continue to read the same text ('Class 2 Severe
Obesity', 'Healthy Weight', etc.).
shared/clinical/bmi.test.ts — 12 captured vectors covering:
both sexes, edges (2y + 20y), interpolated-between-keys (13m),
each classification cliff (underweight / healthy / overweight /
obese / severe class 2 / severe class 3), and the age-clamping
branches (<24 mo and >240 mo). All 12 pass at 10-decimal precision
(percentile to 6 places since the vanilla rounds to 2).
scripts/capture-calc-vectors.js — BMI section added
Same pattern as bilirubin / Fenton: the vanilla data + math are
inlined verbatim, the script runs 12 chosen cases, and writes to
e2e/fixtures/calc-vectors.json. Re-run after any upstream change.
client/src/pages/CalculatorPanels.tsx (new)
• BmiPanel — age/sex/weight/height inputs, calls computeBmi,
renders color-coded classification badge with BMI, percentile,
Z, and % of 95th when percentile ≥85.
• VitalsPanel — 8-band age selector (premie → >12 yr).
VITALS_DATA ported verbatim from calculators.js:1703-1831 with
every HR/RR/SBP/DBP/temp/weight/SpO₂ range and clinical notes
preserved entry-for-entry.
• ResusPanel — weight input drives all 14 drugs (Adenosine,
Amiodarone, Atropine, CaCl, Ca-gluconate, Dextrose, Epi,
Hydrocortisone, Insulin, Lidocaine, Mg, Naloxone, NaHCO₃) with
calc() closures ported verbatim from RESUS_MEDS lines 1873-2050.
Category colors + labels preserved.
• EquipmentPanel — 9-band age selector (premie → 16+ yr).
EQUIP_DATA ported verbatim from calculators.js:2173-2228 with
12 equipment sizes per band (BVM, NPA, OPA, blade, ETT, LMA,
Glidescope, IV, CVL, NGT, chest tube, Foley).
client/src/pages/Calculators.tsx
Dispatch wires bmi → BmiPanel, vitals → VitalsPanel, resus →
ResusPanel, equipment → EquipmentPanel. PILLS flags all four as
ported: true. Only bp remains on LegacyPanel.
Backend tsc + client tsc + vite build + 122/122 vitest (19 calc +
70 bili + 21 fenton/neonatal + 12 bmi) all green.
52 lines
No EOL
741 KiB
JavaScript
52 lines
No EOL
741 KiB
JavaScript
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;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[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<e.length;u++)a=e[u],s=l+ae(a,u),c+=se(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ae(a,u++),c+=se(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return se(oe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ce(e,t,n){if(e==null)return e;var r=[],i=0;return se(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function le(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var E=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},D={map:ce,forEach:function(e,t,n){ce(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ce(e,function(){t++}),t},toArray:function(e){return ce(e,function(e){return e})||[]},only:function(e){if(!ne(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=D,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return ee(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return ee(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ne,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:le}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,E)}catch(e){E(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(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()-T<w)}function te(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&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||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(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<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),m=o(((e,t)=>{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(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),ee=Symbol.for(`react.suspense_list`),te=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),re=Symbol.for(`react.activity`),ie=Symbol.for(`react.memo_cache_sentinel`),ae=Symbol.iterator;function oe(e){return typeof e!=`object`||!e?null:(e=ae&&e[ae]||e[`@@iterator`],typeof e==`function`?e:null)}var se=Symbol.for(`react.client.reference`);function ce(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case ee:return`SuspenseList`;case re:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case te:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}var le=Array.isArray,E=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},de=[],fe=-1;function pe(e){return{current:e}}function me(e){0>fe||(e.current=de[fe],de[fe]=null,fe--)}function he(e,t){fe++,de[fe]=e.current,e.current=t}var ge=pe(null),_e=pe(null),ve=pe(null),ye=pe(null);function be(e,t){switch(he(ve,t),he(_e,e),he(ge,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(ge),he(ge,e)}function xe(){me(ge),me(_e),me(ve)}function Se(e){e.memoizedState!==null&&he(ye,e);var t=ge.current,n=Jd(t,e.type);t!==n&&(he(_e,e),he(ge,n))}function Ce(e){_e.current===e&&(me(ge),me(_e)),ye.current===e&&(me(ye),Qf._currentValue=ue)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1<e.stack.indexOf(`
|
||
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
||
`+we+e+Te}var De=!1;function Oe(e,t){if(!e||De)return``;De=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
||
`),l=s.split(`
|
||
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
||
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{De=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ee(n):``}function ke(e,t){switch(e.tag){case 26:case 27:case 5:return Ee(e.type);case 16:return Ee(`Lazy`);case 13:return e.child!==t&&t!==null?Ee(`Suspense Fallback`):Ee(`Suspense`);case 19:return Ee(`SuspenseList`);case 0:case 15:return Oe(e.type,!1);case 11:return Oe(e.type.render,!1);case 1:return Oe(e.type,!0);case 31:return Ee(`Activity`);default:return``}}function Ae(e){try{var t=``,n=null;do t+=ke(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
||
Error generating stack: `+e.message+`
|
||
`+e.stack}}var je=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,Ne=t.unstable_cancelCallback,Pe=t.unstable_shouldYield,Fe=t.unstable_requestPaint,Ie=t.unstable_now,Le=t.unstable_getCurrentPriorityLevel,Re=t.unstable_ImmediatePriority,ze=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,Ve=t.unstable_LowPriority,He=t.unstable_IdlePriority,Ue=t.log,We=t.unstable_setDisableYieldValue,Ge=null,Ke=null;function qe(e){if(typeof Ue==`function`&&We(e),Ke&&typeof Ke.setStrictMode==`function`)try{Ke.setStrictMode(Ge,e)}catch{}}var Je=Math.clz32?Math.clz32:Ze,Ye=Math.log,Xe=Math.LN2;function Ze(e){return e>>>=0,e===0?32:31-(Ye(e)/Xe|0)|0}var Qe=256,$e=262144,et=4194304;function O(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 tt(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=O(n))):i=O(o):i=O(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=O(n))):i=O(o)):i=O(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 nt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function rt(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 it(){var e=et;return et<<=1,!(et&62914560)&&(et=4194304),e}function at(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ot(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function st(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<n;){var u=31-Je(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&ct(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ct(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function lt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ut(e,t){var n=t&-t;return n=n&42?1:dt(n),(n&(e.suspendedLanes|t))===0?n:0}function dt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ft(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function pt(){var e=D.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function mt(e,t){var n=D.p;try{return D.p=e,t()}finally{D.p=n}}var ht=Math.random().toString(36).slice(2),gt=`__reactFiber$`+ht,k=`__reactProps$`+ht,A=`__reactContainer$`+ht,_t=`__reactEvents$`+ht,vt=`__reactListeners$`+ht,yt=`__reactHandles$`+ht,bt=`__reactResources$`+ht,xt=`__reactMarker$`+ht;function St(e){delete e[gt],delete e[k],delete e[_t],delete e[vt],delete e[yt]}function Ct(e){var t=e[gt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[A]||n[gt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_f(e);e!==null;){if(n=e[gt])return n;e=_f(e)}return t}e=n,n=e.parentNode}return null}function j(e){if(e=e[gt]||e[A]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Tt(e){var t=e[bt];return t||=e[bt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Et(e){e[xt]=!0}var Dt=new Set,Ot={};function kt(e,t){At(e,t),At(e+`Capture`,t)}function At(e,t){for(Ot[e]=t,e=0;e<t.length;e++)Dt.add(t[e])}var jt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Mt={},Nt={};function Pt(e){return je.call(Nt,e)?!0:je.call(Mt,e)?!1:jt.test(e)?Nt[e]=!0:(Mt[e]=!0,!1)}function Ft(e,t,n){if(Pt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function It(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Lt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Rt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function zt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Bt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Vt(e){if(!e._valueTracker){var t=zt(e)?`checked`:`value`;e._valueTracker=Bt(e,t,``+e[t])}}function Ht(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=zt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ut(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Wt=/[\n"\\]/g;function Gt(e){return e.replace(Wt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Kt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Rt(t)):e.value!==``+Rt(t)&&(e.value=``+Rt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Jt(e,o,Rt(n)):Jt(e,o,Rt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Rt(s):e.removeAttribute(`name`)}function qt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Vt(e);return}n=n==null?``:``+Rt(n),t=t==null?n:``+Rt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Vt(e)}function Jt(e,t,n){t===`number`&&Ut(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Yt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Rt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Xt(e,t,n){if(t!=null&&(t=``+Rt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Rt(n)}function Zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(le(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Rt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Vt(e)}function Qt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $t=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function en(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||$t.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function tn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&en(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&en(e,o,t[o])}function nn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var rn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),an=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function on(e){return an.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function sn(){}var cn=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var un=null,dn=null;function fn(e){var t=j(e);if(t&&(e=t.stateNode)){var n=e[k]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Kt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Gt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[k]||null;if(!a)throw Error(i(90));Kt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ht(r)}break a;case`textarea`:Xt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Yt(e,!!n.multiple,t,!1)}}}var pn=!1;function mn(e,t,n){if(pn)return e(t,n);pn=!0;try{return e(t)}finally{if(pn=!1,(un!==null||dn!==null)&&(Eu(),un&&(t=un,e=dn,dn=un=null,fn(t),e)))for(t=0;t<e.length;t++)fn(e[t])}}function hn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[k]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var gn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),_n=!1;if(gn)try{var vn={};Object.defineProperty(vn,`passive`,{get:function(){_n=!0}}),window.addEventListener(`test`,vn,vn),window.removeEventListener(`test`,vn,vn)}catch{_n=!1}var yn=null,bn=null,xn=null;function Sn(){if(xn)return xn;var e,t=bn,n=t.length,r,i=`value`in yn?yn.value:yn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return xn=i.slice(e,1<r?1-r:void 0)}function Cn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function wn(){return!0}function Tn(){return!1}function M(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?wn:Tn,this.isPropagationStopped=Tn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=wn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=wn)},persist:function(){},isPersistent:wn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=M(En),On=h({},En,{view:0,detail:0}),kn=M(On),An,jn,Mn,Nn=h({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=M(Nn),Fn=M(h({},Nn,{dataTransfer:0})),In=M(h({},On,{relatedTarget:0})),Ln=M(h({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Rn=M(h({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),zn=M(h({},En,{data:0})),Bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Vn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Hn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Un(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hn[e])?!!t[e]:!1}function Wn(){return Un}var Gn=M(h({},On,{key:function(e){if(e.key){var t=Bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Cn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Vn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wn,charCode:function(e){return e.type===`keypress`?Cn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Cn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Kn=M(h({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qn=M(h({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wn})),Jn=M(h({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),Yn=M(h({},Nn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Xn=M(h({},En,{newState:0,oldState:0})),Zn=[9,13,27,32],Qn=gn&&`CompositionEvent`in window,$n=null;gn&&`documentMode`in document&&($n=document.documentMode);var er=gn&&`TextEvent`in window&&!$n,tr=gn&&(!Qn||$n&&8<$n&&11>=$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=Sn(),xn=bn=yn=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.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return tr&&t.locale!==`ko`?null:t.data;default:return null}}var lr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!lr[e.type]:t===`textarea`}function dr(e,t,n,r){un?dn?dn.push(r):dn=[r]:un=r,t=Md(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var fr=null,pr=null;function mr(e){Td(e,0)}function hr(e){if(Ht(wt(e)))return e}function gr(e,t){if(e===`change`)return t}var _r=!1;if(gn){var vr;if(gn){var yr=`oninput`in document;if(!yr){var br=document.createElement(`div`);br.setAttribute(`oninput`,`return;`),yr=typeof br.oninput==`function`}vr=yr}else vr=!1;_r=vr&&(!document.documentMode||9<document.documentMode)}function xr(){fr&&(fr.detachEvent(`onpropertychange`,Sr),pr=fr=null)}function Sr(e){if(e.propertyName===`value`&&hr(pr)){var t=[];dr(t,pr,e,ln(e)),mn(mr,t)}}function Cr(e,t,n){e===`focusin`?(xr(),fr=t,pr=n,fr.attachEvent(`onpropertychange`,Sr)):e===`focusout`&&xr()}function wr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return hr(pr)}function Tr(e,t){if(e===`click`)return hr(t)}function Er(e,t){if(e===`input`||e===`change`)return hr(t)}function Dr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Or=typeof Object.is==`function`?Object.is:Dr;function kr(e,t){if(Or(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!je.call(t,i)||!Or(e[i],t[i]))return!1}return!0}function Ar(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jr(e,t){var n=Ar(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=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=Ut(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=Ut(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=gn&&`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!==Ut(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<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ir)))}function Vr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Hr={animationend:Vr(`Animation`,`AnimationEnd`),animationiteration:Vr(`Animation`,`AnimationIteration`),animationstart:Vr(`Animation`,`AnimationStart`),transitionrun:Vr(`Transition`,`TransitionRun`),transitionstart:Vr(`Transition`,`TransitionStart`),transitioncancel:Vr(`Transition`,`TransitionCancel`),transitionend:Vr(`Transition`,`TransitionEnd`)},Ur={},Wr={};gn&&(Wr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Hr.animationend.animation,delete Hr.animationiteration.animation,delete Hr.animationstart.animation),`TransitionEvent`in window||delete Hr.transitionend.transition);function Gr(e){if(Ur[e])return Ur[e];if(!Hr[e])return e;var t=Hr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wr)return Ur[e]=t[n];return e}var Kr=Gr(`animationend`),qr=Gr(`animationiteration`),Jr=Gr(`animationstart`),Yr=Gr(`transitionrun`),Xr=Gr(`transitionstart`),Zr=Gr(`transitioncancel`),Qr=Gr(`transitionend`),$r=new Map,ei=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);ei.push(`scrollEnd`);function ti(e,t){$r.set(e,t),kt(t,[e])}var ni=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ri=[],ii=0,ai=0;function oi(){for(var e=ii,t=ai=ii=0;t<e;){var n=ri[t];ri[t++]=null;var r=ri[t];ri[t++]=null;var i=ri[t];ri[t++]=null;var a=ri[t];if(ri[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ui(n,i,a)}}function si(e,t,n,r){ri[ii++]=e,ri[ii++]=t,ri[ii++]=n,ri[ii++]=r,ai|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ci(e,t,n,r){return si(e,t,n,r),di(e)}function li(e,t){return si(e,null,null,t),di(e)}function ui(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function di(e){if(50<_u)throw _u=0,vu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var fi={};function pi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mi(e,t,n,r){return new pi(e,t,n,r)}function hi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gi(e,t){var n=e.alternate;return n===null?(n=mi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function _i(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function vi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)hi(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ge.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case re:return e=mi(31,n,t,a),e.elementType=re,e.lanes=o,e;case y:return yi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=mi(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=mi(13,n,t,a),e.elementType=T,e.lanes=o,e;case ee:return e=mi(19,n,t,a),e.elementType=ee,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case te:s=14;break a;case ne:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=mi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function yi(e,t,n,r){return e=mi(7,e,r,t),e.lanes=n,e}function bi(e,t,n){return e=mi(6,e,null,t),e.lanes=n,e}function xi(e){var t=mi(18,null,null,0);return t.stateNode=e,t}function Si(e,t,n){return t=mi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ci=new WeakMap;function wi(e,t){if(typeof e==`object`&&e){var n=Ci.get(e);return n===void 0?(t={value:e,source:t,stack:Ae(t)},Ci.set(e,t),t):n}return{value:e,source:t,stack:Ae(t)}}var Ti=[],N=0,Ei=null,Di=0,Oi=[],P=0,ki=null,Ai=1,ji=``;function Mi(e,t){Ti[N++]=Di,Ti[N++]=Ei,Ei=e,Di=t}function Ni(e,t,n){Oi[P++]=Ai,Oi[P++]=ji,Oi[P++]=ki,ki=e;var r=Ai;e=ji;var i=32-Je(r)-1;r&=~(1<<i),n+=1;var a=32-Je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ai=1<<32-Je(t)+i|n<<i|r,ji=a+e}else Ai=1<<a|n<<i|r,ji=e}function Pi(e){e.return!==null&&(Mi(e,1),Ni(e,1,0))}function Fi(e){for(;e===Ei;)Ei=Ti[--N],Ti[N]=null,Di=Ti[--N],Ti[N]=null;for(;e===ki;)ki=Oi[--P],Oi[P]=null,ji=Oi[--P],Oi[P]=null,Ai=Oi[--P],Oi[P]=null}function Ii(e,t){Oi[P++]=Ai,Oi[P++]=ji,Oi[P++]=ki,Ai=t.id,ji=t.overflow,ki=e}var Li=null,Ri=null,F=!1,zi=null,Bi=!1,Vi=Error(i(519));function Hi(e){throw Ji(wi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Vi}function Ui(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[gt]=e,t[k]=r,n){case`dialog`:K(`cancel`,t),K(`close`,t);break;case`iframe`:case`object`:case`embed`:K(`load`,t);break;case`video`:case`audio`:for(n=0;n<Cd.length;n++)K(Cd[n],t);break;case`source`:K(`error`,t);break;case`img`:case`image`:case`link`:K(`error`,t),K(`load`,t);break;case`details`:K(`toggle`,t);break;case`input`:K(`invalid`,t),qt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:K(`invalid`,t);break;case`textarea`:K(`invalid`,t),Zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Rd(t.textContent,n)?(r.popover!=null&&(K(`beforetoggle`,t),K(`toggle`,t)),r.onScroll!=null&&K(`scroll`,t),r.onScrollEnd!=null&&K(`scrollend`,t),r.onClick!=null&&(t.onclick=sn),t=!0):t=!1,t||Hi(e,!0)}function Wi(e){for(Li=e.return;Li;)switch(Li.tag){case 5:case 31:case 13:Bi=!1;return;case 27:case 3:Bi=!0;return;default:Li=Li.return}}function Gi(e){if(e!==Li)return!1;if(!F)return Wi(e),F=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Yd(e.type,e.memoizedProps)),n=!n),n&&Ri&&Hi(e),Wi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ri=gf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ri=gf(e)}else t===27?(t=Ri,rf(e.type)?(e=hf,hf=null,Ri=e):Ri=t):Ri=Li?mf(e.stateNode.nextSibling):null;return!0}function Ki(){Ri=Li=null,F=!1}function qi(){var e=zi;return e!==null&&(iu===null?iu=e:iu.push.apply(iu,e),zi=null),e}function Ji(e){zi===null?zi=[e]:zi.push(e)}var Yi=pe(null),Xi=null,I=null;function Zi(e,t,n){he(Yi,t._currentValue),t._currentValue=n}function Qi(e){e._currentValue=Yi.current,me(Yi)}function $i(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ea(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),$i(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),$i(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ta(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Or(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ye.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&ea(t,e,n,r),t.flags|=262144}function na(e){for(e=e.firstContext;e!==null;){if(!Or(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ra(e){Xi=e,I=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ia(e){return oa(Xi,e)}function aa(e,t){return Xi===null&&ra(e),oa(e,t)}function oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},I===null){if(e===null)throw Error(i(308));I=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else I=I.next=t;return n}var sa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ca=t.unstable_scheduleCallback,la=t.unstable_NormalPriority,ua={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function da(){return{controller:new sa,data:new Map,refCount:0}}function fa(e){e.refCount--,e.refCount===0&&ca(la,function(){e.controller.abort()})}var pa=null,ma=0,ha=0,ga=null;function _a(e,t){if(pa===null){var n=pa=[];ma=0,ha=_d(),ga={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ma++,t.then(va,va),t}function va(){if(--ma===0&&pa!==null){ga!==null&&(ga.status=`fulfilled`);var e=pa;pa=null,ha=0,ga=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ya(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ba=E.S;E.S=function(e,t){su=Ie(),typeof t==`object`&&t&&typeof t.then==`function`&&_a(e,t),ba!==null&&ba(e,t)};var xa=pe(null);function Sa(){var e=xa.current;return e===null?Gl.pooledCache:e}function Ca(e,t){t===null?he(xa,xa.current):he(xa,t.pool)}function wa(){var e=Sa();return e===null?null:{parent:ua._currentValue,pool:e}}var Ta=Error(i(460)),Ea=Error(i(474)),Da=Error(i(542)),Oa={then:function(){}};function ka(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Aa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(sn,sn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Pa(e),e;default:if(typeof t.status==`string`)t.then(sn,sn);else{if(e=Gl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Pa(e),e}throw Ma=t,Ta}}function ja(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ma=e,Ta):e}}var Ma=null;function Na(){if(Ma===null)throw Error(i(459));var e=Ma;return Ma=null,e}function Pa(e){if(e===Ta||e===Da)throw Error(i(483))}var Fa=null,Ia=0;function La(e){var t=Ia;return Ia+=1,Fa===null&&(Fa=[]),Aa(Fa,e,t)}function Ra(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function za(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ba(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=gi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=bi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ne&&ja(i)===t.type)?(t=a(t,n.props),Ra(t,n),t.return=e,t):(t=vi(n.type,n.key,n.props,null,e.mode,r),Ra(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Si(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=yi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=bi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=vi(t.type,t.key,t.props,null,e.mode,n),Ra(n,t),n.return=e,n;case v:return t=Si(t,e.mode,n),t.return=e,t;case ne:return t=ja(t),f(e,t,n)}if(le(t)||oe(t))return t=yi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,La(t),n);if(t.$$typeof===C)return f(e,aa(e,t),n);za(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case ne:return n=ja(n),p(e,t,n,r)}if(le(n)||oe(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,La(n),r);if(n.$$typeof===C)return p(e,t,aa(e,n),r);za(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ne:return r=ja(r),m(e,t,n,r,i)}if(le(r)||oe(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,La(r),i);if(r.$$typeof===C)return m(e,t,n,aa(t,r),i);za(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>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(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return F&&Mi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),F&&Mi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=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,lt(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;e<n.length;e++)$a(n[e],t)}var to=pe(null),no=pe(0);function ro(e,t){e=Xl,he(no,e),he(to,t),Xl=e|t.baseLanes}function io(){he(no,Xl),he(to,to.current)}function ao(){Xl=no.current,me(to),me(no)}var oo=pe(null),so=null;function co(e){var t=e.alternate;he(mo,mo.current&1),he(oo,e),so===null&&(t===null||to.current!==null||t.memoizedState!==null)&&(so=e)}function lo(e){he(mo,mo.current),he(oo,e),so===null&&(so=e)}function uo(e){e.tag===22?(he(mo,mo.current),he(oo,e),so===null&&(so=e)):fo(e)}function fo(){he(mo,mo.current),he(oo,oo.current)}function po(e){me(oo),so===e&&(so=null),me(mo)}var mo=pe(0);function ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||df(n)||ff(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var go=0,L=null,R=null,_o=null,vo=!1,yo=!1,bo=!1,xo=0,So=0,Co=null,wo=0;function To(){throw Error(i(321))}function Eo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Or(e[n],t[n]))return!1;return!0}function Do(e,t,n,r,i,a){return go=a,L=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Ws:Gs,bo=!1,a=n(r,i),bo=!1,yo&&(a=ko(t,n,r,i)),Oo(e),a}function Oo(e){E.H=Us;var t=R!==null&&R.next!==null;if(go=0,_o=R=L=null,vo=!1,So=0,Co=null,t)throw Error(i(300));e===null||cc||(e=e.dependencies,e!==null&&na(e)&&(cc=!0))}function ko(e,t,n,r){L=e;var a=0;do{if(yo&&(Co=null),So=0,yo=!1,25<=a)throw Error(i(301));if(a+=1,_o=R=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}E.H=Ks,o=t(n,r)}while(yo);return o}function Ao(){var e=E.H,t=e.useState()[0];return t=typeof t.then==`function`?Lo(t):t,e=e.useState()[0],(R===null?null:R.memoizedState)!==e&&(L.flags|=1024),t}function jo(){var e=xo!==0;return xo=0,e}function Mo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function No(e){if(vo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}vo=!1}go=0,_o=R=L=null,yo=!1,So=xo=0,Co=null}function Po(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _o===null?L.memoizedState=_o=e:_o=_o.next=e,_o}function Fo(){if(R===null){var e=L.alternate;e=e===null?null:e.memoizedState}else e=R.next;var t=_o===null?L.memoizedState:_o.next;if(t!==null)_o=t,R=e;else{if(e===null)throw L.alternate===null?Error(i(467)):Error(i(310));R=e,e={memoizedState:R.memoizedState,baseState:R.baseState,baseQueue:R.baseQueue,queue:R.queue,next:null},_o===null?L.memoizedState=_o=e:_o=_o.next=e}return _o}function Io(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lo(e){var t=So;return So+=1,Co===null&&(Co=[]),e=Aa(Co,e,t),t=L,(_o===null?t.memoizedState:_o.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Ws:Gs),e}function Ro(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Lo(e);if(e.$$typeof===C)return ia(e)}throw Error(i(438,String(e)))}function zo(e){var t=null,n=L.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=L.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Io(),L.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ie;return t.index++,n}function Bo(e,t){return typeof t==`function`?t(e):t}function Vo(e){return Ho(Fo(),R,e)}function Ho(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(go&f)===f:(H&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ha&&(d=!0);else if((go&p)===p){u=u.next,p===ha&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,L.lanes|=p,Ql|=p;f=u.action,bo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,L.lanes|=f,Ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Or(o,e.memoizedState)&&(cc=!0,d&&(n=ga,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Uo(e){var t=Fo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Or(o,t.memoizedState)||(cc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Wo(e,t,n){var r=L,a=Fo(),o=F;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Or((R||a).memoizedState,n);if(s&&(a.memoizedState=n,cc=!0),a=a.queue,hs(qo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||_o!==null&&_o.memoizedState.tag&1){if(r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,a,n,t),null),Gl===null)throw Error(i(349));o||go&127||Go(r,t,n)}return n}function Go(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=L.updateQueue,t===null?(t=Io(),L.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ko(e,t,n,r){t.value=n,t.getSnapshot=r,Jo(t)&&Yo(e)}function qo(e,t,n){return n(function(){Jo(t)&&Yo(e)})}function Jo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Or(e,n)}catch{return!0}}function Yo(e){var t=li(e,2);t!==null&&xu(t,e,2)}function Xo(e){var t=Po();if(typeof e==`function`){var n=e;if(e=n(),bo){qe(!0);try{n()}finally{qe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:e},t}function Zo(e,t,n,r){return e.baseState=n,Ho(e,R,typeof r==`function`?r:Bo)}function Qo(e,t,n,r,a){if(Bs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};E.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,$o(t,o)):(o.next=n.next,t.pending=n.next=o)}}function $o(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=E.T,o={};E.T=o;try{var s=n(i,r),c=E.S;c!==null&&c(o,s),es(e,t,s)}catch(n){ns(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),E.T=a}}else try{a=n(i,r),es(e,t,a)}catch(n){ns(e,t,n)}}function es(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ts(e,t,n)},function(n){return ns(e,t,n)}):ts(e,t,n)}function ts(e,t,n){t.status=`fulfilled`,t.value=n,rs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$o(e,n)))}function ns(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,rs(t),t=t.next;while(t!==r)}e.action=null}function rs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function is(e,t){return t}function as(e,t){if(F){var n=Gl.formState;if(n!==null){a:{var r=L;if(F){if(Ri){b:{for(var i=Ri,a=Bi;i.nodeType!==8;){if(!a){i=null;break b}if(i=mf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ri=mf(i.nextSibling),r=i.data===`F!`;break a}}Hi(r)}r=!1}r&&(t=n[0])}}return n=Po(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:t},n.queue=r,n=Ls.bind(null,L,r),r.dispatch=n,r=Xo(!1),a=zs.bind(null,L,!1,r.queue),r=Po(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Qo.bind(null,L,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function os(e){return ss(Fo(),R,e)}function ss(e,t,n){if(t=Ho(e,t,is)[0],e=Vo(Bo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Lo(t)}catch(e){throw e===Ta?Da:e}else r=t;t=Fo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(L.flags|=2048,us(9,{destroy:void 0},cs.bind(null,i,n),null)),[r,a,e]}function cs(e,t){e.action=t}function ls(e){var t=Fo(),n=R;if(n!==null)return ss(t,n,e);Fo(),t=t.memoizedState,n=Fo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function us(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=L.updateQueue,t===null&&(t=Io(),L.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ds(){return Fo().memoizedState}function fs(e,t,n,r){var i=Po();L.flags|=e,i.memoizedState=us(1|t,{destroy:void 0},n,r===void 0?null:r)}function ps(e,t,n,r){var i=Fo();r=r===void 0?null:r;var a=i.memoizedState.inst;R!==null&&r!==null&&Eo(r,R.memoizedState.deps)?i.memoizedState=us(t,a,n,r):(L.flags|=e,i.memoizedState=us(1|t,a,n,r))}function ms(e,t){fs(8390656,8,e,t)}function hs(e,t){ps(2048,8,e,t)}function gs(e){L.flags|=4;var t=L.updateQueue;if(t===null)t=Io(),L.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function _s(e){var t=Fo().memoizedState;return gs({ref:t,nextImpl:e}),function(){if(B&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function vs(e,t){return ps(4,2,e,t)}function ys(e,t){return ps(4,4,e,t)}function bs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xs(e,t,n){n=n==null?null:n.concat([e]),ps(4,4,bs.bind(null,t,e),n)}function Ss(){}function Cs(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Eo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ws(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Eo(t,r[1]))return r[0];if(r=e(),bo){qe(!0);try{e()}finally{qe(!1)}}return n.memoizedState=[r,t],r}function Ts(e,t,n){return n===void 0||go&1073741824&&!(H&261930)?e.memoizedState=t:(e.memoizedState=n,e=bu(),L.lanes|=e,Ql|=e,n)}function Es(e,t,n,r){return Or(n,t)?n:to.current===null?!(go&42)||go&1073741824&&!(H&261930)?(cc=!0,e.memoizedState=n):(e=bu(),L.lanes|=e,Ql|=e,t):(e=Ts(e,n,r),Or(e,t)||(cc=!0),e)}function Ds(e,t,n,r,i){var a=D.p;D.p=a!==0&&8>a?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,lt(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){qe(!0);try{e()}finally{qe(!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){qe(!0);try{n(t)}finally{qe(!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-Je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=wo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ms,useFormState:as,useActionState:as,useOptimistic:function(e){var t=Po();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=zs.bind(null,L,!0,n),n.dispatch=t,[e,t]},useMemoCache:zo,useCacheRefresh:function(){return Po().memoizedState=Fs.bind(null,L)},useEffectEvent:function(e){var t=Po(),n={impl:e};return t.memoizedState=n,function(){if(B&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Gs={readContext:ia,use:Ro,useCallback:Cs,useContext:ia,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Vo,useRef:ds,useState:function(){return Vo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){return Es(Fo(),R.memoizedState,e,t)},useTransition:function(){var e=Vo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:os,useActionState:os,useOptimistic:function(e,t){return Zo(Fo(),R,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Gs.useEffectEvent=_s;var Ks={readContext:ia,use:Ro,useCallback:Cs,useContext:ia,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Uo,useRef:ds,useState:function(){return Uo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){var n=Fo();return R===null?Ts(n,e,t):Es(n,R.memoizedState,e,t)},useTransition:function(){var e=Uo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:ls,useActionState:ls,useOptimistic:function(e,t){var n=Fo();return R===null?(n.baseState=e,[e,n.queue.dispatch]):Zo(n,R,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Ks.useEffectEvent=_s;function qs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Js={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ka(r);i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(xu(t,e,r),Ja(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ka(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(xu(t,e,r),Ja(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=yu(),r=Ka(n);r.tag=2,t!=null&&(r.callback=t),t=qa(e,r,n),t!==null&&(xu(t,e,n),Ja(t,e,n))}};function Ys(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!kr(n,r)||!kr(i,a):!0}function Xs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Js.enqueueReplaceState(t,t.state,null)}function Zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Qs(e){ni(e)}function $s(e){console.error(e)}function ec(e){ni(e)}function tc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function nc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function rc(e,t,n){return n=Ka(n),n.tag=3,n.payload={element:null},n.callback=function(){tc(e,t)},n}function ic(e){return e=Ka(e),e.tag=3,e}function ac(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){nc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){nc(t,n,r),typeof i!=`function`&&(uu===null?uu=new Set([this]):uu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function oc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ta(t,n,a,!0),n=oo.current,n!==null){switch(n.tag){case 31:case 13:return so===null?Nu():n.alternate===null&&Zl===0&&(Zl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Oa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Zu(e,r,a)),!1;case 22:return n.flags|=65536,r===Oa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Zu(e,r,a)),!1}throw Error(i(435,n.tag))}return Zu(e,r,a),Nu(),!1}if(F)return t=oo.current,t===null?(r!==Vi&&(t=Error(i(423),{cause:r}),Ji(wi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=wi(r,n),a=rc(e.stateNode,r,a),Ya(e,a),Zl!==4&&(Zl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Vi&&(e=Error(i(422),{cause:r}),Ji(wi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=wi(o,n),ru===null?ru=[o]:ru.push(o),Zl!==4&&(Zl=2),t===null)return!0;r=wi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=rc(n.stateNode,r,e),Ya(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(uu===null||!uu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ic(a),ac(a,e,n,r),Ya(n,a),!1}n=n.return}while(n!==null);return!1}var sc=Error(i(461)),cc=!1;function lc(e,t,n,r){t.child=e===null?Ha(t,null,n,r):Va(t,e.child,n,r)}function uc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ra(t),r=Do(e,t,n,o,a,i),s=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(F&&s&&Pi(t),t.flags|=1,lc(e,t,r,i),t.child)}function dc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!hi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,fc(e,t,a,r,i)):(e=vi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Fc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?kr:n,n(o,r)&&e.ref===t.ref)return Pc(e,t,i)}return t.flags|=1,e=gi(a,r),e.ref=t.ref,e.return=t,t.child=e}function fc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(kr(a,r)&&e.ref===t.ref)if(cc=!1,t.pendingProps=r=a,Fc(e,i))e.flags&131072&&(cc=!0);else return t.lanes=e.lanes,Pc(e,t,i)}return bc(e,t,n,r,i)}function pc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ca(t,a===null?null:a.cachePool),a===null?io():ro(t,a),uo(t);else return r=t.lanes=536870912,hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ca(t,null),io(),fo(t)):(Ca(t,a.cachePool),ro(t,a),fo(t),t.memoizedState=null);return lc(e,t,i,n),t.child}function mc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function hc(e,t,n,r,i){var a=Sa();return a=a===null?null:{parent:ua._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ca(t,null),io(),uo(t),e!==null&&ta(e,t,r,!0),t.childLanes=i,null}function gc(e,t){return t=kc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function _c(e,t,n){return Va(t,e.child,null,n),e=gc(t,t.pendingProps),e.flags|=2,po(t),t.memoizedState=null,e}function vc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(F){if(r.mode===`hidden`)return e=gc(t,r),t.lanes=536870912,mc(null,e);if(lo(t),(e=Ri)?(e=uf(e,Bi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ki===null?null:{id:Ai,overflow:ji},retryLane:536870912,hydrationErrors:null},n=xi(e),n.return=t,t.child=n,Li=t,Ri=null)):e=null,e===null)throw Hi(t);return t.lanes=536870912,null}return gc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(lo(t),a)if(t.flags&256)t.flags&=-257,t=_c(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(cc||ta(e,t,n,!1),a=(n&e.childLanes)!==0,cc||a){if(r=Gl,r!==null&&(s=ut(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,li(e,s),xu(r,e,s),sc;Nu(),t=_c(e,t,n)}else e=o.treeContext,Ri=mf(s.nextSibling),Li=t,F=!0,zi=null,Bi=!1,e!==null&&Ii(t,e),t=gc(t,r),t.flags|=4096;return t}return e=gi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function yc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function bc(e,t,n,r,i){return ra(t),n=Do(e,t,n,r,void 0,i),r=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(F&&r&&Pi(t),t.flags|=1,lc(e,t,n,i),t.child)}function xc(e,t,n,r,i,a){return ra(t),t.updateQueue=null,n=ko(t,r,n,i),Oo(e),r=jo(),e!==null&&!cc?(Mo(e,t,a),Pc(e,t,a)):(F&&r&&Pi(t),t.flags|=1,lc(e,t,n,a),t.child)}function Sc(e,t,n,r,i){if(ra(t),t.stateNode===null){var a=fi,o=n.contextType;typeof o==`object`&&o&&(a=ia(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Js,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Wa(t),o=n.contextType,a.context=typeof o==`object`&&o?ia(o):fi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(qs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Js.enqueueReplaceState(a,a.state,null),Qa(t,r,a,i),Za(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=fi,typeof u==`object`&&u&&(o=ia(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Xs(t,a,r,o),Ua=!1;var f=t.memoizedState;a.state=f,Qa(t,r,a,i),Za(),l=t.memoizedState,s||f!==l||Ua?(typeof d==`function`&&(qs(t,n,d,r),l=t.memoizedState),(c=Ua||Ys(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ga(e,t),o=t.memoizedProps,u=Zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=fi,typeof l==`object`&&l&&(c=ia(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Xs(t,a,r,c),Ua=!1,f=t.memoizedState,a.state=f,Qa(t,r,a,i),Za();var p=t.memoizedState;o!==d||f!==p||Ua||e!==null&&e.dependencies!==null&&na(e.dependencies)?(typeof s==`function`&&(qs(t,n,s,r),p=t.memoizedState),(u=Ua||Ys(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&na(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,yc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Va(t,e.child,null,i),t.child=Va(t,null,n,i)):lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Pc(e,t,i),e}function Cc(e,t,n,r){return Ki(),t.flags|=256,lc(e,t,n,r),t.child}var wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tc(e){return{baseLanes:e,cachePool:wa()}}function Ec(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=tu),e}function Dc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(mo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(F){if(a?co(t):fo(t),(e=Ri)?(e=uf(e,Bi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ki===null?null:{id:Ai,overflow:ji},retryLane:536870912,hydrationErrors:null},n=xi(e),n.return=t,t.child=n,Li=t,Ri=null)):e=null,e===null)throw Hi(t);return ff(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(fo(t),a=t.mode,c=kc({mode:`hidden`,children:c},a),r=yi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(null,r)):(co(t),Oc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(co(t),t.flags&=-257,t=Ac(e,t,n)):t.memoizedState===null?(fo(t),c=r.fallback,a=t.mode,r=kc({mode:`visible`,children:r.children},a),c=yi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Va(t,e.child,null,n),r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,t=mc(null,r)):(fo(t),t.child=e.child,t.flags|=128,t=null);else if(co(t),ff(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ji({value:r,source:null,stack:null}),t=Ac(e,t,n)}else if(cc||ta(e,t,n,!1),s=(n&e.childLanes)!==0,cc||s){if(s=Gl,s!==null&&(r=ut(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,li(e,r),xu(s,e,r),sc;df(c)||Nu(),t=Ac(e,t,n)}else df(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ri=mf(c.nextSibling),Li=t,F=!0,zi=null,Bi=!1,e!==null&&Ii(t,e),t=Oc(t,r.children),t.flags|=4096);return t}return a?(fo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=gi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=yi(c,a,n,null),c.flags|=2):c=gi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,mc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Tc(n):(a=c.cachePool,a===null?a=wa():(l=ua._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(e.child,r)):(co(t),n=e.child,e=n.sibling,n=gi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Oc(e,t){return t=kc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function kc(e,t){return e=mi(22,e,null,t),e.lanes=0,e}function Ac(e,t,n){return Va(t,e.child,null,n),e=Oc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$i(e.return,t,n)}function Mc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Nc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=mo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,he(mo,o),lc(e,t,r,n),r=F?Di:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jc(e,n,t);else if(e.tag===19)jc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ho(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Mc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Mc(t,!0,n,null,a,r);break;case`together`:Mc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Pc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ql|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ta(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=gi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=gi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&na(e))):!0}function Ic(e,t,n){switch(t.tag){case 3:be(t,t.stateNode.containerInfo),Zi(t,ua,e.memoizedState.cache),Ki();break;case 27:case 5:Se(t);break;case 4:be(t,t.stateNode.containerInfo);break;case 10:Zi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,lo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(co(t),e=Pc(e,t,n),e===null?null:e.sibling):Dc(e,t,n):(co(t),t.flags|=128,null);co(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(ta(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Nc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),he(mo,mo.current),r)break;return null;case 22:return t.lanes=0,pc(e,t,n,t.pendingProps);case 24:Zi(t,ua,e.memoizedState.cache)}return Pc(e,t,n)}function Lc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)cc=!0;else{if(!Fc(e,n)&&!(t.flags&128))return cc=!1,Ic(e,t,n);cc=!!(e.flags&131072)}else cc=!1,F&&t.flags&1048576&&Ni(t,Di,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ja(t.elementType),t.type=e,typeof e==`function`)hi(e)?(r=Zs(e,r),t.tag=1,t=Sc(null,t,e,r,n)):(t.tag=0,t=bc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=uc(null,t,e,r,n);break a}else if(a===te){t.tag=14,t=dc(null,t,e,r,n);break a}}throw t=ce(e)||e,Error(i(306,t,``))}}return t;case 0:return bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Zs(r,t.pendingProps),Sc(e,t,r,a,n);case 3:a:{if(be(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ga(e,t),Qa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Zi(t,ua,r),r!==o.cache&&ea(t,[ua],n,!0),Za(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Cc(e,t,r,n);break a}else if(r!==a){a=wi(Error(i(424)),t),Ji(a),t=Cc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ri=mf(e.firstChild),Li=t,F=!0,zi=null,Bi=!0,n=Ha(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ki(),r===a){t=Pc(e,t,n);break a}lc(e,t,r,n)}t=t.child}return t;case 26:return yc(e,t),e===null?(n=Mf(t.type,null,t.pendingProps,null))?t.memoizedState=n:F||(n=t.type,e=t.pendingProps,r=Kd(ve.current).createElement(n),r[gt]=t,r[k]=e,Bd(r,n,e),Et(r),t.stateNode=r):t.memoizedState=Mf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Se(t),e===null&&F&&(r=t.stateNode=vf(t.type,t.pendingProps,ve.current),Li=t,Bi=!0,a=Ri,rf(t.type)?(hf=a,Ri=mf(r.firstChild)):Ri=a),lc(e,t,t.pendingProps.children,n),yc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&F&&((a=r=Ri)&&(r=cf(r,t.type,t.pendingProps,Bi),r===null?a=!1:(t.stateNode=r,Li=t,Ri=mf(r.firstChild),Bi=!1,a=!0)),a||Hi(t)),Se(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Yd(a,o)?r=null:s!==null&&Yd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Do(e,t,Ao,null,null,n),Qf._currentValue=a),yc(e,t),lc(e,t,r,n),t.child;case 6:return e===null&&F&&((e=n=Ri)&&(n=lf(n,t.pendingProps,Bi),n===null?e=!1:(t.stateNode=n,Li=t,Ri=null,e=!0)),e||Hi(t)),null;case 13:return Dc(e,t,n);case 4:return be(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Va(t,null,r,n):lc(e,t,r,n),t.child;case 11:return uc(e,t,t.type,t.pendingProps,n);case 7:return lc(e,t,t.pendingProps,n),t.child;case 8:return lc(e,t,t.pendingProps.children,n),t.child;case 12:return lc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Zi(t,t.type,r.value),lc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ra(t),a=ia(a),r=r(a),t.flags|=1,lc(e,t,r,n),t.child;case 14:return dc(e,t,t.type,t.pendingProps,n);case 15:return fc(e,t,t.type,t.pendingProps,n);case 19:return Nc(e,t,n);case 31:return vc(e,t,n);case 22:return pc(e,t,n,t.pendingProps);case 24:return ra(t),r=ia(ua),e===null?(a=Sa(),a===null&&(a=Gl,o=da(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Wa(t),Zi(t,ua,a)):((e.lanes&n)!==0&&(Ga(e,t),Qa(t,null,null,n),Za()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Zi(t,ua,r),r!==a.cache&&ea(t,[ua],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Zi(t,ua,r))),lc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Rc(e){e.flags|=4}function zc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Au())e.flags|=8192;else throw Ma=Oa,Ea}else e.flags&=-16777217}function Bc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Au())e.flags|=8192;else throw Ma=Oa,Ea}function Vc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:it(),e.lanes|=t,nu|=t)}function Hc(e,t){if(!F)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Uc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Wc(e,t,n){var r=t.pendingProps;switch(Fi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Uc(t),null;case 1:return Uc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Qi(ua),xe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Gi(t)?Rc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,qi())),Uc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Rc(t),o===null?(Uc(t),zc(t,a,null,r,n)):(Uc(t),Bc(t,o))):o?o===e.memoizedState?(Uc(t),t.flags&=-16777217):(Rc(t),Uc(t),Bc(t,o)):(e=e.memoizedProps,e!==r&&Rc(t),Uc(t),zc(t,a,e,r,n)),null;case 27:if(Ce(t),n=ve.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}e=ge.current,Gi(t)?Ui(t,e):(e=vf(a,r,n),t.stateNode=e,Rc(t))}return Uc(t),null;case 5:if(Ce(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}if(o=ge.current,Gi(t))Ui(t,o);else{var s=Kd(ve.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/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[gt]=t,o[k]=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=ve.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[gt]=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[gt]=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[gt]=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[gt]=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 xe(),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 he(mo,mo.current&1|2),F&&Mi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ie()>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*Ie()-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=Ie(),e.sibling=null,n=mo.current,he(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),xe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ce(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 xe(),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),xe();break;case 26:case 27:case 5:Ce(t);break;case 4:xe();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[k]=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=sn));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[gt]=e,t[k]=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<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){G(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)sf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:sf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ul=e;break}ul=t.return}}function fl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:El(e,n),r&4&&qc(5,n);break;case 1:if(El(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){G(n,n.return,e)}else{var i=Zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){G(n,n.return,e)}}r&64&&Yc(n),r&512&&Zc(n,n.return);break;case 3:if(El(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{eo(e,t)}catch(e){G(n,n.return,e)}}break;case 27:t===null&&r&4&&al(n);case 26:case 5:El(e,n),t===null&&r&4&&$c(n),r&512&&Zc(n,n.return);break;case 12:El(e,n);break;case 31:El(e,n),r&4&&_l(e,n);break;case 13:El(e,n),r&4&&vl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ed.bind(null,n),pf(e,n))));break;case 22:if(r=n.memoizedState!==null||ol,!r){t=t!==null&&t.memoizedState!==null||sl,i=ol;var a=sl;ol=r,(sl=t)&&!a?Ol(e,n,(n.subtreeFlags&8772)!=0):El(e,n),ol=i,sl=a}break;case 30:break;default:El(e,n)}}function pl(e){var t=e.alternate;t!==null&&(e.alternate=null,pl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&St(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var z=null,ml=!1;function hl(e,t,n){for(n=n.child;n!==null;)gl(e,t,n),n=n.sibling}function gl(e,t,n){if(Ke&&typeof Ke.onCommitFiberUnmount==`function`)try{Ke.onCommitFiberUnmount(Ge,n)}catch{}switch(n.tag){case 26:sl||Qc(n,t),hl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:sl||Qc(n,t);var r=z,i=ml;rf(n.type)&&(z=n.stateNode,ml=!1),hl(e,t,n),yf(n.stateNode),z=r,ml=i;break;case 5:sl||Qc(n,t);case 6:if(r=z,i=ml,z=null,hl(e,t,n),z=r,ml=i,z!==null)if(ml)try{(z.nodeType===9?z.body:z.nodeName===`HTML`?z.ownerDocument.body:z).removeChild(n.stateNode)}catch(e){G(n,t,e)}else try{z.removeChild(n.stateNode)}catch(e){G(n,t,e)}break;case 18:z!==null&&(ml?(e=z,af(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):af(z,n.stateNode));break;case 4:r=z,i=ml,z=n.stateNode.containerInfo,ml=!0,hl(e,t,n),z=r,ml=i;break;case 0:case 11:case 14:case 15:Jc(2,n,t),sl||Jc(4,n,t),hl(e,t,n);break;case 1:sl||(Qc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Xc(n,t,r)),hl(e,t,n);break;case 21:hl(e,t,n);break;case 22:sl=(r=sl)||n.memoizedState!==null,hl(e,t,n),sl=r;break;default:hl(e,t,n)}}function _l(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){G(t,t.return,e)}}}function vl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){G(t,t.return,e)}}function yl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ll),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ll),t;default:throw Error(i(435,e.tag))}}function bl(e,t){var n=yl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=td.bind(null,e,t);t.then(r,r)}})}function xl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(rf(c.type)){z=c.stateNode,ml=!1;break a}break;case 5:z=c.stateNode,ml=!1;break a;case 3:case 4:z=c.stateNode.containerInfo,ml=!0;break a}c=c.return}if(z===null)throw Error(i(160));gl(o,s,a),z=null,ml=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Cl(t,e),t=t.sibling}var Sl=null;function Cl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:xl(t,e),wl(e),r&4&&(Jc(3,e,e.return),qc(3,e),Jc(5,e,e.return));break;case 1:xl(t,e),wl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&64&&ol&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=Sl;if(xl(t,e),wl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[xt]||o[gt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Bd(o,r,n),o[gt]=e,Et(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[gt]=e,Et(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=Lf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&el(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):Lf(a,r,e.memoizedProps))}break;case 27:xl(t,e),wl(e),r&512&&(sl||n===null||Qc(n,n.return)),n!==null&&r&4&&el(e,e.memoizedProps,n.memoizedProps);break;case 5:if(xl(t,e),wl(e),r&512&&(sl||n===null||Qc(n,n.return)),e.flags&32){a=e.stateNode;try{Qt(a,``)}catch(t){G(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,el(e,a,n===null?a:n.memoizedProps)),r&1024&&(cl=!0);break;case 6:if(xl(t,e),wl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){G(e,e.return,t)}}break;case 3:if(Bf=null,a=Sl,Sl=xf(t.containerInfo),xl(t,e),Sl=a,wl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){G(e,e.return,t)}cl&&(cl=!1,Tl(e));break;case 4:r=Sl,Sl=xf(e.stateNode.containerInfo),xl(t,e),wl(e),Sl=r;break;case 12:xl(t,e),wl(e);break;case 31:xl(t,e),wl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,bl(e,r)));break;case 13:xl(t,e),wl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(ou=Ie()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,bl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=ol,d=sl;if(ol=u||a,sl=d||l,xl(t,e),sl=d,ol=u,wl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||ol||sl||Dl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){G(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){G(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?of(m,!0):of(l.stateNode,!1)}catch(e){G(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,bl(e,n))));break;case 19:xl(t,e),wl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,bl(e,r)));break;case 30:break;case 21:break;default:xl(t,e),wl(e)}}function wl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(tl(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;il(e,nl(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Qt(o,``),n.flags&=-33),il(e,nl(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;rl(e,nl(e),s);break;default:throw Error(i(161))}}catch(t){G(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Tl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Tl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function El(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fl(e,t.alternate,t),t=t.sibling}function Dl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jc(4,t,t.return),Dl(t);break;case 1:Qc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Xc(t,t.return,n),Dl(t);break;case 27:yf(t.stateNode);case 26:case 5:Qc(t,t.return),Dl(t);break;case 22:t.memoizedState===null&&Dl(t);break;case 30:Dl(t);break;default:Dl(t)}e=e.sibling}}function Ol(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Ol(i,a,n),qc(4,a);break;case 1:if(Ol(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){G(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)$a(c[i],s)}catch(e){G(r,r.return,e)}}n&&o&64&&Yc(a),Zc(a,a.return);break;case 27:al(a);case 26:case 5:Ol(i,a,n),n&&r===null&&o&4&&$c(a),Zc(a,a.return);break;case 12:Ol(i,a,n);break;case 31:Ol(i,a,n),n&&o&4&&_l(i,a);break;case 13:Ol(i,a,n),n&&o&4&&vl(i,a);break;case 22:a.memoizedState===null&&Ol(i,a,n),Zc(a,a.return);break;case 30:break;default:Ol(i,a,n)}t=t.sibling}}function kl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&fa(n))}function Al(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e))}function jl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ml(e,t,n,r),t=t.sibling}function Ml(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:jl(e,t,n,r),i&2048&&qc(9,t);break;case 1:jl(e,t,n,r);break;case 3:jl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e)));break;case 12:if(i&2048){jl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){G(t,t.return,e)}}else jl(e,t,n,r);break;case 31:jl(e,t,n,r);break;case 13:jl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?jl(e,t,n,r):(a._visibility|=2,Nl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?jl(e,t,n,r):Pl(e,t),i&2048&&kl(o,t);break;case 24:jl(e,t,n,r),i&2048&&Al(t.alternate,t);break;default:jl(e,t,n,r)}}function Nl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Nl(a,o,s,c,i),qc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Nl(a,o,s,c,i)):u._visibility&2?Nl(a,o,s,c,i):Pl(a,o),i&&l&2048&&kl(o.alternate,o);break;case 24:Nl(a,o,s,c,i),i&&l&2048&&Al(o.alternate,o);break;default:Nl(a,o,s,c,i)}t=t.sibling}}function Pl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Pl(n,r),i&2048&&kl(r.alternate,r);break;case 24:Pl(n,r),i&2048&&Al(r.alternate,r);break;default:Pl(n,r)}t=t.sibling}}var Fl=8192;function Il(e,t,n){if(e.subtreeFlags&Fl)for(e=e.child;e!==null;)Ll(e,t,n),e=e.sibling}function Ll(e,t,n){switch(e.tag){case 26:Il(e,t,n),e.flags&Fl&&e.memoizedState!==null&&Gf(n,Sl,e.memoizedState,e.memoizedProps);break;case 5:Il(e,t,n);break;case 3:case 4:var r=Sl;Sl=xf(e.stateNode.containerInfo),Il(e,t,n),Sl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Fl,Fl=16777216,Il(e,t,n),Fl=r):Il(e,t,n));break;default:Il(e,t,n)}}function Rl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function zl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Hl(r,e)}Rl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Bl(e),e=e.sibling}function Bl(e){switch(e.tag){case 0:case 11:case 15:zl(e),e.flags&2048&&Jc(9,e,e.return);break;case 3:zl(e);break;case 12:zl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Vl(e)):zl(e);break;default:zl(e)}}function Vl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Hl(r,e)}Rl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jc(8,t,t.return),Vl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Vl(t));break;default:Vl(t)}e=e.sibling}}function Hl(e,t){for(;ul!==null;){var n=ul;switch(n.tag){case 0:case 11:case 15:Jc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:fa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ul=r;else a:for(n=e;ul!==null;){r=ul;var i=r.sibling,a=r.return;if(pl(r),r===n){ul=null;break a}if(i!==null){i.return=a,ul=i;break a}ul=a}}}var Ul={getCacheForType:function(e){var t=ia(ua),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ia(ua).controller.signal}},Wl=typeof WeakMap==`function`?WeakMap:Map,B=0,Gl=null,V=null,H=0,U=0,Kl=null,ql=!1,Jl=!1,Yl=!1,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=null,iu=null,au=!1,ou=0,su=0,cu=1/0,lu=null,uu=null,du=0,fu=null,pu=null,mu=0,hu=0,gu=null,W=null,_u=0,vu=null;function yu(){return B&2&&H!==0?H&-H:E.T===null?pt():_d()}function bu(){if(tu===0)if(!(H&536870912)||F){var e=$e;$e<<=1,!($e&3932160)&&($e=262144),tu=e}else tu=536870912;return e=oo.current,e!==null&&(e.flags|=32),tu}function xu(e,t,n){(e===Gl&&(U===2||U===9)||e.cancelPendingCommit!==null)&&(Ou(e,0),Tu(e,H,tu,!1)),ot(e,n),(!(B&2)||e!==Gl)&&(e===Gl&&(!(B&2)&&($l|=n),Zl===4&&Tu(e,H,tu,!1)),ld(e))}function Su(e,t,n){if(B&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||nt(e,t),a=r?Iu(e,t):Pu(e,t,!0),o=r;do{if(a===0){Jl&&!r&&Tu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!wu(n)){a=Pu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ru;var l=c.current.memoizedState.isDehydrated;if(l&&(Ou(c,s).flags|=256),s=Pu(c,s,!1),s!==2){if(Yl&&!l){c.errorRecoveryDisabledLanes|=o,$l|=o,a=4;break a}o=iu,iu=a,o!==null&&(iu===null?iu=o:iu.push.apply(iu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ou(e,0),Tu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Tu(r,t,tu,!ql);break a;case 2:iu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=ou+300-Ie(),10<a)){if(Tu(r,t,tu,!ql),tt(r,0,!0)!==0)break a;mu=t,r.timeoutHandle=Qd(Cu.bind(null,r,n,iu,lu,au,t,tu,$l,nu,ql,o,`Throttled`,-0,0),a);break a}Cu(r,n,iu,lu,au,t,tu,$l,nu,ql,o,null,-0,0)}}break}while(1);ld(e)}function Cu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sn},Ll(t,a,d);var m=(a&62914560)===a?ou-Ie():(a&4194048)===a?su-Ie():0;if(m=qf(d,m),m!==null){mu=a,e.cancelPendingCommit=m(Uu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Tu(e,a,o,!l);return}}Uu(e,t,a,n,r,i,o,s,c)}function wu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Or(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Tu(e,t,n,r){t&=~eu,t&=~$l,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ct(e,n,t)}function Eu(){return B&6?!0:(ud(0,!1),!1)}function Du(){if(V!==null){if(U===0)var e=V.return;else e=V,I=Xi=null,No(e),Fa=null,Ia=0,e=V;for(;e!==null;)Kc(e.alternate,e),e=e.return;V=null}}function Ou(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,$d(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),mu=0,Du(),Gl=e,V=n=gi(e.current,null),H=t,U=0,Kl=null,ql=!1,Jl=nt(e,t),Yl=!1,nu=tu=eu=$l=Ql=Zl=0,iu=ru=null,au=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Je(r),a=1<<i;t|=e[i],r&=~a}return Xl=t,oi(),n}function ku(e,t){L=null,E.H=Us,t===Ta||t===Da?(t=Na(),U=3):t===Ea?(t=Na(),U=4):U=t===sc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Kl=t,V===null&&(Zl=1,tc(e,wi(t,e.current)))}function Au(){var e=oo.current;return e===null?!0:(H&4194048)===H?so===null:(H&62914560)===H||H&536870912?e===so:!1}function ju(){var e=E.H;return E.H=Us,e===null?Us:e}function Mu(){var e=E.A;return E.A=Ul,e}function Nu(){Zl=4,ql||(H&4194048)!==H&&oo.current!==null||(Jl=!0),!(Ql&134217727)&&!($l&134217727)||Gl===null||Tu(Gl,H,tu,!1)}function Pu(e,t,n){var r=B;B|=2;var i=ju(),a=Mu();(Gl!==e||H!==t)&&(lu=null,Ou(e,t)),t=!1;var o=Zl;a:do try{if(U!==0&&V!==null){var s=V,c=Kl;switch(U){case 8:Du(),o=6;break a;case 3:case 2:case 9:case 6:oo.current===null&&(t=!0);var l=U;if(U=0,Kl=null,Bu(e,s,c,l),n&&Jl){o=0;break a}break;default:l=U,U=0,Kl=null,Bu(e,s,c,l)}}Fu(),o=Zl;break}catch(t){ku(e,t)}while(1);return t&&e.shellSuspendCounter++,I=Xi=null,B=r,E.H=i,E.A=a,V===null&&(Gl=null,H=0,oi()),o}function Fu(){for(;V!==null;)Ru(V)}function Iu(e,t){var n=B;B|=2;var r=ju(),a=Mu();Gl!==e||H!==t?(lu=null,cu=Ie()+500,Ou(e,t)):Jl=nt(e,t);a:do try{if(U!==0&&V!==null){t=V;var o=Kl;b:switch(U){case 1:U=0,Kl=null,Bu(e,t,o,1);break;case 2:case 9:if(ka(o)){U=0,Kl=null,zu(t);break}t=function(){U!==2&&U!==9||Gl!==e||(U=7),ld(e)},o.then(t,t);break a;case 3:U=7;break a;case 4:U=5;break a;case 7:ka(o)?(U=0,Kl=null,zu(t)):(U=0,Kl=null,Bu(e,t,o,7));break;case 5:var s=null;switch(V.tag){case 26:s=V.memoizedState;case 5:case 27:var c=V;if(s?Wf(s):c.stateNode.complete){U=0,Kl=null;var l=c.sibling;if(l!==null)V=l;else{var u=c.return;u===null?V=null:(V=u,Vu(u))}break b}}U=0,Kl=null,Bu(e,t,o,5);break;case 6:U=0,Kl=null,Bu(e,t,o,6);break;case 8:Du(),Zl=6;break a;default:throw Error(i(462))}}Lu();break}catch(t){ku(e,t)}while(1);return I=Xi=null,E.H=r,E.A=a,B=n,V===null?(Gl=null,H=0,oi(),Zl):0}function Lu(){for(;V!==null&&!Pe();)Ru(V)}function Ru(e){var t=Lc(e.alternate,e,Xl);e.memoizedProps=e.pendingProps,t===null?Vu(e):V=t}function zu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=xc(n,t,t.pendingProps,t.type,void 0,H);break;case 11:t=xc(n,t,t.pendingProps,t.type.render,t.ref,H);break;case 5:No(t);default:Kc(n,t),t=V=_i(t,Xl),t=Lc(n,t,Xl)}e.memoizedProps=e.pendingProps,t===null?Vu(e):V=t}function Bu(e,t,n,r){I=Xi=null,No(t),Fa=null,Ia=0;var i=t.return;try{if(oc(e,i,t,n,H)){Zl=1,tc(e,wi(n,e.current)),V=null;return}}catch(t){if(i!==null)throw V=i,t;Zl=1,tc(e,wi(n,e.current)),V=null;return}t.flags&32768?(F||r===1?e=!0:Jl||H&536870912?e=!1:(ql=e=!0,(r===2||r===9||r===3||r===6)&&(r=oo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Hu(t,e)):Vu(t)}function Vu(e){var t=e;do{if(t.flags&32768){Hu(t,ql);return}e=t.return;var n=Wc(t.alternate,t,Xl);if(n!==null){V=n;return}if(t=t.sibling,t!==null){V=t;return}V=t=e}while(t!==null);Zl===0&&(Zl=5)}function Hu(e,t){do{var n=Gc(e.alternate,e);if(n!==null){n.flags&=32767,V=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){V=e;return}V=e=n}while(e!==null);Zl=6,V=null}function Uu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Ju();while(du!==0);if(B&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=ai,st(e,n,o,s,c,l),e===Gl&&(V=Gl=null,H=0),pu=t,fu=e,mu=n,hu=o,gu=a,W=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,nd(Be,function(){return Yu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=E.T,E.T=null,a=D.p,D.p=2,s=B,B|=4;try{dl(e,t,n)}finally{B=s,D.p=a,E.T=r}}du=1,Wu(),Gu(),Ku()}}function Wu(){if(du===1){du=0;var e=fu,t=pu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=E.T,E.T=null;var r=D.p;D.p=2;var i=B;B|=4;try{Cl(t,e);var a=Gd,o=Nr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Mr(s.ownerDocument.documentElement,s)){if(c!==null&&Pr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(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;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Wd,Gd=Wd=null}finally{B=i,D.p=r,E.T=n}}e.current=t,du=2}}function Gu(){if(du===2){du=0;var e=fu,t=pu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=E.T,E.T=null;var r=D.p;D.p=2;var i=B;B|=4;try{fl(e,t.alternate,t)}finally{B=i,D.p=r,E.T=n}}du=3}}function Ku(){if(du===4||du===3){du=0,Fe();var e=fu,t=pu,n=mu,r=W;t.subtreeFlags&10256||t.flags&10256?du=5:(du=0,pu=fu=null,qu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(uu=null),ft(n),t=t.stateNode,Ke&&typeof Ke.onCommitFiberRoot==`function`)try{Ke.onCommitFiberRoot(Ge,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=E.T,i=D.p,D.p=2,E.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{E.T=t,D.p=i}}mu&3&&Ju(),ld(e),i=e.pendingLanes,n&261930&&i&42?e===vu?_u++:(_u=0,vu=e):_u=0,ud(0,!1)}}function qu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,fa(t)))}function Ju(){return Wu(),Gu(),Ku(),Yu()}function Yu(){if(du!==5)return!1;var e=fu,t=hu;hu=0;var n=ft(mu),r=E.T,a=D.p;try{D.p=32>n?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),Ke&&typeof Ke.onPostCommitFiberRoot==`function`)try{Ke.onPostCommitFiberRoot(Ge,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&&(ot(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),ot(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>Ie()-ou?!(B&2)&&Ou(e,0):eu|=n,nu===H&&(nu=0)),ld(e)}function $u(e,t){t===0&&(t=it()),e=li(e,t),e!==null&&(ot(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 Me(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-Je(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=tt(r,r===Gl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||nt(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=Ie(),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;0<a;){var o=31-Je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=rt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Gl,n=H,n=tt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(U===2||U===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ne(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||nt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ne(r),ft(n)){case 2:case 8:n=ze;break;case 32:n=Be;break;case 268435456:n=He;break;default:n=Be}return r=md.bind(null,e),n=Me(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ne(r),e.callbackPriority=2,e.callbackNode=null,2}function md(e,t){if(du!==0&&du!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ju()&&e.callbackNode!==n)return null;var r=H;return r=tt(e,e===Gl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Su(e,r,t),pd(e,Ie()),e.callbackNode!=null&&e.callbackNode===n?md.bind(null,e):null)}function hd(e,t){if(Ju())return null;Su(e,t,!0)}function gd(){tf(function(){B&6?Me(Re,dd):fd()})}function _d(){if(cd===0){var e=ha;e===0&&(e=Qe,Qe<<=1,!(Qe&261888)&&(Qe=256)),cd=e}return cd}function vd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:on(``+e)}function yd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function bd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=vd((i[k]||null).action),o=r.submitter;o&&(t=(t=o[k]||null)?vd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Dn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(cd!==0){var e=o?yd(i,o):new FormData(i);ks(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?yd(i,o):new FormData(i),ks(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var xd=0;xd<ei.length;xd++){var Sd=ei[xd];ti(Sd.toLowerCase(),`on`+(Sd[0].toUpperCase()+Sd.slice(1)))}ti(Kr,`onAnimationEnd`),ti(qr,`onAnimationIteration`),ti(Jr,`onAnimationStart`),ti(`dblclick`,`onDoubleClick`),ti(`focusin`,`onFocus`),ti(`focusout`,`onBlur`),ti(Yr,`onTransitionRun`),ti(Xr,`onTransitionStart`),ti(Zr,`onTransitionCancel`),ti(Qr,`onTransitionEnd`),At(`onMouseEnter`,[`mouseout`,`mouseover`]),At(`onMouseLeave`,[`mouseout`,`mouseover`]),At(`onPointerEnter`,[`pointerout`,`pointerover`]),At(`onPointerLeave`,[`pointerout`,`pointerover`]),kt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),kt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),kt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),kt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),kt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),kt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Cd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),wd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Cd));function Td(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){ni(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){ni(e)}i.currentTarget=null,a=c}}}}function K(e,t){var n=t[_t];n===void 0&&(n=t[_t]=new Set);var r=e+`__bubble`;n.has(r)||(kd(t,e,2,!1),n.add(r))}function Ed(e,t,n){var r=0;t&&(r|=4),kd(n,e,r,t)}var Dd=`_reactListening`+Math.random().toString(36).slice(2);function Od(e){if(!e[Dd]){e[Dd]=!0,Dt.forEach(function(t){t!==`selectionchange`&&(wd.has(t)||Ed(t,!1,e),Ed(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Dd]||(t[Dd]=!0,Ed(`selectionchange`,!1,t))}}function kd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!_n||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Ad(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Ct(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}mn(function(){var r=a,i=ln(n),s=[];a:{var c=$r.get(e);if(c!==void 0){var l=Dn,u=e;switch(e){case`keypress`:if(Cn(n)===0)break a;case`keydown`:case`keyup`:l=Gn;break;case`focusin`:u=`focus`,l=In;break;case`focusout`:u=`blur`,l=In;break;case`beforeblur`:case`afterblur`:l=In;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=qn;break;case Kr:case qr:case Jr:l=Ln;break;case Qr:l=Jn;break;case`scroll`:case`scrollend`:l=kn;break;case`wheel`:l=Yn;break;case`copy`:case`cut`:case`paste`:l=Rn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Kn;break;case`toggle`:case`beforetoggle`:l=Xn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=hn(m,p),g!=null&&d.push(jd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==cn&&(u=n.relatedTarget||n.fromElement)&&(Ct(u)||u[A]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?Ct(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Pn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Kn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:wt(l),h=u==null?c:wt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,Ct(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Nd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Pd(s,c,l,d,!1),u!==null&&f!==null&&Pd(s,f,u,d,!0)}}a:{if(c=r?wt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=gr;else if(ur(c))if(_r)v=Er;else{v=wr;var y=Cr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&nn(r.elementType)&&(v=gr):v=Tr;if(v&&=v(e,r)){dr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Jt(c,`number`,c.value)}switch(y=r?wt(r):window,e){case`focusin`:(ur(y)||y.contentEditable===`true`)&&(Ir=y,Lr=r,Rr=null);break;case`focusout`:Rr=Lr=Ir=null;break;case`mousedown`:zr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:zr=!1,Br(s,n,i);break;case`selectionchange`:if(Fr)break;case`keydown`:case`keyup`:Br(s,n,i)}var b;if(Qn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else or?ir(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(tr&&n.locale!==`ko`&&(or||x!==`onCompositionStart`?x===`onCompositionEnd`&&or&&(b=Sn()):(yn=i,bn=`value`in yn?yn.value:yn.textContent,or=!0)),y=Md(r,x),0<y.length&&(x=new zn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=ar(n),b!==null&&(x.data=b)))),(b=er?sr(e,n):cr(e,n))&&(x=Md(r,`onBeforeInput`),0<x.length&&(y=new zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),bd(s,e,r,n,i)}Td(s,t)})}function jd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Md(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=hn(e,n),i!=null&&r.unshift(jd(e,i,a)),i=hn(e,t),i!=null&&r.push(jd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Nd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Pd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=hn(n,a),l!=null&&o.unshift(jd(n,l,c))):i||(l=hn(n,a),l!=null&&o.push(jd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Fd=/\r\n?/g,Id=/\u0000|\uFFFD/g;function Ld(e){return(typeof e==`string`?e:``+e).replace(Fd,`
|
||
`).replace(Id,``)}function Rd(e,t){return t=Ld(t),Ld(e)===t}function q(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Qt(e,``+r);break;case`className`:It(e,`class`,r);break;case`tabIndex`:It(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:It(e,n,r);break;case`style`:tn(e,r,o);break;case`data`:if(t!==`object`){It(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&q(e,t,`name`,a.name,a,null),q(e,t,`formEncType`,a.formEncType,a,null),q(e,t,`formMethod`,a.formMethod,a,null),q(e,t,`formTarget`,a.formTarget,a,null)):(q(e,t,`encType`,a.encType,a,null),q(e,t,`method`,a.method,a,null),q(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=sn);break;case`onScroll`:r!=null&&K(`scroll`,e);break;case`onScrollEnd`:r!=null&&K(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=on(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:K(`beforetoggle`,e),K(`toggle`,e),Ft(e,`popover`,r);break;case`xlinkActuate`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ft(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=rn.get(n)||n,Ft(e,n,r))}}function zd(e,t,n,r,a,o){switch(n){case`style`:tn(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Qt(e,``+r);break;case`onScroll`:r!=null&&K(`scroll`,e);break;case`onScrollEnd`:r!=null&&K(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=sn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Ot.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[k]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ft(e,n,r)}}}function Bd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:K(`error`,e),K(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:q(e,t,o,s,n,null)}}a&&q(e,t,`srcSet`,n.srcSet,n,null),r&&q(e,t,`src`,n.src,n,null);return;case`input`:K(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:q(e,t,r,d,n,null)}}qt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in K(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:q(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Yt(e,!!r,n,!0):Yt(e,!!r,t,!1);return;case`textarea`:for(s in K(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:q(e,t,s,c,n,null)}Zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:q(e,t,l,r,n,null)}return;case`dialog`:K(`beforetoggle`,e),K(`toggle`,e),K(`cancel`,e),K(`close`,e);break;case`iframe`:case`object`:K(`load`,e);break;case`video`:case`audio`:for(r=0;r<Cd.length;r++)K(Cd[r],e);break;case`image`:K(`error`,e),K(`load`,e);break;case`details`:K(`toggle`,e);break;case`embed`:case`source`:case`link`:K(`error`,e),K(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:q(e,t,u,r,n,null)}return;default:if(nn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&zd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&q(e,t,c,r,n,null))}function Vd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||q(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&q(e,t,p,m,r,f)}}Kt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||q(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&q(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Yt(e,!!n,n?[]:``,!1):Yt(e,!!n,t,!0)):Yt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:q(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&q(e,t,s,a,r,o)}Xt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:q(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:q(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&q(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:q(e,t,u,p,r,m)}return;default:if(nn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&zd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||zd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&q(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||q(e,t,f,p,r,m)}function Hd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ud(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Hd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Wd=null,Gd=null;function Kd(e){return e.nodeType===9?e:e.ownerDocument}function qd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Jd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Yd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xd=null;function Zd(){var e=window.event;return e&&e.type===`popstate`?e===Xd?!1:(Xd=e,!0):(Xd=null,!1)}var Qd=typeof setTimeout==`function`?setTimeout:void 0,$d=typeof clearTimeout==`function`?clearTimeout:void 0,ef=typeof Promise==`function`?Promise:void 0,tf=typeof queueMicrotask==`function`?queueMicrotask:ef===void 0?Qd:function(e){return ef.resolve(null).then(e).catch(nf)};function nf(e){setTimeout(function(){throw e})}function rf(e){return e===`head`}function af(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)yf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,yf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[xt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&yf(e.ownerDocument.body);n=i}while(n);Np(t)}function of(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:sf(n),St(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function cf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[xt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=mf(e.nextSibling),e===null)break}return null}function lf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=mf(e.nextSibling),e===null))return null;return e}function uf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=mf(e.nextSibling),e===null))return null;return e}function df(e){return e.data===`$?`||e.data===`$~`}function ff(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function pf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function mf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var hf=null;function gf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return mf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function _f(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function vf(e,t,n){switch(t=Kd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function yf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);St(e)}var J=new Map,bf=new Set;function xf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Y=D.d;D.d={f:Sf,r:X,D:Tf,C:Ef,L:Df,m:Of,X:Af,S:kf,M:jf};function Sf(){var e=Y.f(),t=Eu();return e||t}function X(e){var t=j(e);t!==null&&t.tag===5&&t.type===`form`?js(t):Y.r(e)}var Cf=typeof document>`u`?null:document;function wf(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=Gt(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),Et(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="`+Gt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Gt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Gt(n.imageSizes)+`"]`)):i+=`[href="`+Gt(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),Et(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="`+Gt(r)+`"][href="`+Gt(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),Et(r),n.head.appendChild(r)}}}function kf(e,t,n){Y.S(e,t,n);var r=Cf;if(r&&e){var i=Tt(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`);Et(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=Tt(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`),Et(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=Tt(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`),Et(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=ve.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=Tt(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=Tt(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=Tt(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="`+Gt(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),Et(t),e.head.appendChild(t))}function Ff(e){return`[src="`+Gt(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~="`+Gt(n.href)+`"]`);if(r)return t.instance=r,Et(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`),Et(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,Et(o),o;r=Nf(n),(a=J.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),Et(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,Et(a),a):(r=n,(a=J.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Et(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<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[xt]||a[gt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > 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,Et(a);return}a=t.ownerDocument||t,r=Nf(r),(i=J.get(i))&&Rf(r,i),a=a.createElement(`link`),Et(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),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ud());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?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<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=at(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=at(0),this.hiddenUpdates=at(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=mi(3,null,null,t),e.current=a,a.stateNode=e,t=da(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Wa(a),e}function tp(e){return e?(e=fi,e):fi}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ka(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=qa(e,r,t),n!==null&&(xu(n,e,t),Ja(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=li(e,67108864);t!==null&&xu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=yu();t=dt(t);var n=li(e,t);n!==null&&xu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=E.T;E.T=null;var a=D.p;try{D.p=2,up(e,t,n,r)}finally{D.p=a,E.T=i}}function lp(e,t,n,r){var i=E.T;E.T=null;var a=D.p;try{D.p=8,up(e,t,n,r)}finally{D.p=a,E.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Ad(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=j(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=O(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Je(o);s.entanglements[1]|=c,o&=~c}ld(a),!(B&6)&&(cu=Ie()+500,ud(0,!1))}}break;case 31:case 13:s=li(a,2),s!==null&&xu(s,a,2),Eu(),ip(a,2)}if(a=dp(r),a===null&&Ad(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ad(e,t,r,null,n)}}function dp(e){return e=ln(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=Ct(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Le()){case Re:return 2;case ze:return 8;case Be:case Ve:return 32;case He:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=j(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=Ct(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,mt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,mt(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);cn=r,n.target.dispatchEvent(r),cn=null}else return t=j(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=j(n);a!==null&&(e.splice(t,3),t-=3,ks(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[k]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[k]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,yu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),Eu(),t[A]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=pt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(i(527,Lp,`19.2.5`));D.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:E,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ge=zp.inject(Rp),Ke=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Qs,s=$s,c=ec;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[A]=t.current,Od(e),new Fp(t)}})),g=o(((e,t)=>{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<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:E.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=D(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ue(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function de(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function fe(e){if(!pe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!pe(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function pe(e){return Object.prototype.toString.call(e)===`[object Object]`}function me(e){return new Promise(t=>{S.setTimeout(t,e)})}function he(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:D(e,t)}function ge(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function _e(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ve=Symbol();function ye(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ve?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function be(e,t){return typeof e==`function`?e(...t):!!e}function xe(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 Se=(()=>{let e=()=>w;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ce(){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 we=C;function Te(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=we,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 Ee=Te(),De=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 Oe(e){return Math.min(1e3*2**e,3e4)}function ke(e){return(e??`online`)===`online`?De.isOnline():!0}var Ae=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function je(e){let t=!1,n=0,r,i=Ce(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ae(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>b.isFocused()&&(e.networkMode===`always`||De.isOnline())&&e.canRun(),u=()=>ke(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??(Se.isServer()?0:3),o=e.retryDelay??Oe,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),me(s).then(()=>l()?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 Me=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??(Se.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(S.clearTimeout(this.#e),this.#e=void 0)}},Ne=class extends Me{#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=Ie(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=Ie(this.options);e.data!==void 0&&(this.setState(Fe(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=he(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===ve||!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=ye(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=je({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ae&&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 Ae){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,...Pe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Fe(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),Ee.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Pe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ke(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Fe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ie(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 Le=class extends y{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ce(),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),ze(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Be(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Be(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&&Ve(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 Ue(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(Se.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,!(Se.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&&ze(e,t),o=i&&Ve(e,n,t,r);(a||o)&&(l={...l,...Pe(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=he(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=he(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:He(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=Ce())},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){Ee.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Re(e,t){return ie(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&ie(t.retryOnMount,e)===!1)}function ze(e,t){return Re(e,t)||e.state.data!==void 0&&Be(e,t,t.refetchOnMount)}function Be(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&&He(e,t)}return!1}function Ve(e,t,n,r){return(e!==t||ie(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&He(e,n)}function He(e,t){return ie(t.enabled,e)!==!1&&e.isStaleByTime(re(t.staleTime,e))}function Ue(e,t){return!ue(e.getCurrentResult(),t)}function We(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=>{xe(e,()=>t.signal,()=>n=!0)},u=ye(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?_e:ge;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ke:Ge,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:Ge(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ge(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 Ke(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var qe=class extends Me{#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||Je(),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=je({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),Ee.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Je(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ye=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 qe({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=Xe(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=Xe(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=Xe(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=Xe(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Ee.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){Ee.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Ee.batch(()=>Promise.all(e.map(e=>e.continue().catch(T))))}};function Xe(e){return e.options.scope?.id}var Ze=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??Je();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){Ee.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)})})}},Qe=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 Ne({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(){Ee.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){Ee.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ee.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ee.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$e=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Qe,this.#t=e.mutationCache||new Ye,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=De.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 Ee.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;Ee.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Ee.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Ee.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(T).catch(T)}invalidateQueries(e,t={}){return Ee.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=Ee.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=We(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(T).catch(T)}ensureInfiniteQueryData(e){return e.behavior=We(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return De.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===ve&&(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()}},et=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})),O=o(((e,t)=>{t.exports=et()}))(),tt=_.createContext(void 0),nt=e=>{let t=_.useContext(tt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},rt=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,O.jsx)(tt.Provider,{value:e,children:t})),it=_.createContext(!1),at=()=>_.useContext(it);it.Provider;function ot(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var st=_.createContext(ot()),ct=()=>_.useContext(st),lt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?be(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ut=e=>{_.useEffect(()=>{e.clearReset()},[e])},dt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||be(n,[e.error,r])),ft=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))}},pt=(e,t)=>e.isLoading&&e.isFetching&&!t,mt=(e,t)=>e?.suspense&&t.isPending,ht=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function gt(e,t,n){let r=at(),i=ct(),a=nt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,ft(o),lt(o,i,s),ut(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(Ee.batchCalls(e)):T;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),_.useEffect(()=>{l.setOptions(o)},[o,l]),mt(o,u))throw ht(o,l,i);if(dt({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&&!Se.isServer()&&pt(u,r)&&(c?ht(o,l,i):s?.promise)?.catch(T).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function k(e,t){return gt(e,Le,t)}function A(e,t){let n=nt(t),[r]=_.useState(()=>new Ze(n,e));_.useEffect(()=>{r.setOptions(e)},[r,e]);let i=_.useSyncExternalStore(_.useCallback(e=>r.subscribe(Ee.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=_.useCallback((e,t)=>{r.mutate(e,t).catch(T)},[r]);if(i.error&&be(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var _t=`modulepreload`,vt=function(e){return`/app/`+e},yt={},bt=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=vt(t,n),t in yt)return;yt[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`:_t,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)})},xt=`popstate`;function St(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Ct(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Dt(``,{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:Ot(t)}return At(t,n,null,e)}function j(e,t){if(e===!1||e==null)throw Error(t)}function wt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Tt(){return Math.random().toString(36).substring(2,10)}function Et(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 Dt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?kt(t):t,state:n,key:t&&t.key||r||Tt(),unstable_mask:i}}function Ot({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 kt(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 At(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=St(e)?e:Dt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Et(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=St(e)?e:Dt(h.location,e,t);n&&n(r,e),l=u();let i=Et(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 jt(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(xt,d),c=e,()=>{i.removeEventListener(xt,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 jt(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),j(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Ot(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function Mt(e,t,n=`/`){return Nt(e,t,n,!1)}function Nt(e,t,n,r){let i=Zt((typeof t==`string`?kt(t):t).pathname||`/`,n);if(i==null)return null;let a=Ft(e);Lt(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Xt(i);o=qt(a[e],t,r)}return o}function Pt(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Ft(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{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;j(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=sn([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(j(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ft(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Gt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of It(e.path))a(e,t,!0,n)}),t}function It(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=It(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 Lt(e){e.sort((e,t)=>e.score===t.score?Kt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Rt=/^:[\w-]+$/,zt=3,Bt=2,Vt=1,Ht=10,Ut=-2,Wt=e=>e===`*`;function Gt(e,t){let n=e.split(`/`),r=n.length;return n.some(Wt)&&(r+=Ut),t&&(r+=Bt),n.filter(e=>!Wt(e)).reduce((e,t)=>e+(Rt.test(t)?zt:t===``?Vt:Ht),r)}function Kt(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 qt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Jt({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Jt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:sn([a,u.pathname]),pathnameBase:ln(sn([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=sn([a,u.pathnameBase]))}return o}function Jt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Yt(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{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 Yt(e,t=!1,n=!0){wt(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 Xt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return wt(!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 Zt(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 Qt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $t(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?kt(e):e,a;return n?(n=on(n),a=n.startsWith(`/`)?en(n.substring(1),`/`):en(n,t)):a=t,{pathname:a,search:un(r),hash:dn(i)}}function en(e,t){let n=cn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function tn(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 <Link to="..."> and the router will parse it for you.`}function nn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function rn(e){let t=nn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function an(e,t,n,r=!1){let i;typeof e==`string`?i=kt(e):(i={...e},j(!i.pathname||!i.pathname.includes(`?`),tn(`?`,`pathname`,`search`,i)),j(!i.pathname||!i.pathname.includes(`#`),tn(`#`,`pathname`,`hash`,i)),j(!i.search||!i.search.includes(`#`),tn(`#`,`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=$t(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var on=e=>e.replace(/\/\/+/g,`/`),sn=e=>on(e.join(`/`)),cn=e=>e.replace(/\/+$/,``),ln=e=>cn(e).replace(/^\/*/,`/`),un=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,dn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,fn=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 pn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function mn(e){return sn(e.map(e=>e.route.path).filter(Boolean))||`/`}var hn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function gn(e,t){let n=e;if(typeof n!=`string`||!Qt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(hn)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Zt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{wt(!1,`<Link to="${n}"> 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 _n=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(_n);var vn=[`GET`,..._n];new Set(vn);var yn=_.createContext(null);yn.displayName=`DataRouter`;var bn=_.createContext(null);bn.displayName=`DataRouterState`;var xn=_.createContext(!1);function Sn(){return _.useContext(xn)}var Cn=_.createContext({isTransitioning:!1});Cn.displayName=`ViewTransition`;var wn=_.createContext(new Map);wn.displayName=`Fetchers`;var Tn=_.createContext(null);Tn.displayName=`Await`;var M=_.createContext(null);M.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 fn(t.status,t.statusText,t.data)}catch{}}function Pn(e,{relative:t}={}){j(Fn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=_.useContext(M),{hash:i,pathname:a,search:o}=Un(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:sn([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Fn(){return _.useContext(En)!=null}function In(){return j(Fn(),`useLocation() may be used only in the context of a <Router> 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(M).static||_.useLayoutEffect(e)}function zn(){let{isDataRoute:e}=_.useContext(Dn);return e?cr():Bn()}function Bn(){j(Fn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=_.useContext(yn),{basename:t,navigator:n}=_.useContext(M),{matches:r}=_.useContext(Dn),{pathname:i}=In(),a=JSON.stringify(rn(r)),o=_.useRef(!1);return Rn(()=>{o.current=!0}),_.useCallback((r,s={})=>{if(wt(o.current,Ln),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=an(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:sn([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(rn(n));return _.useMemo(()=>an(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Wn(e,t){return Gn(e,t)}function Gn(e,t,n){j(Fn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=_.useContext(M),{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 <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) 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 <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=In(),d;if(t){let e=typeof t==`string`?kt(t):t;j(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` 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=Mt(e,{pathname:p});wt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),wt(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 <Outlet /> 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:sn([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:sn([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=pn(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=xn;var Yn=new WeakMap;function Xn({children:e,error:t}){let{basename:n}=_.useContext(M);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=gn(e.location,n);if(hn&&!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(yn);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);j(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<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=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:mn(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(yn);return j(t,$n(e)),t}function tr(e){let t=_.useContext(bn);return j(t,$n(e)),t}function nr(e){let t=_.useContext(Dn);return j(t,$n(e)),t}function rr(e){let t=nr(e),n=t.matches[t.matches.length-1];return j(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=>Pt(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={})=>{wt(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,wt(!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}){j(Fn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=_.useContext(M);wt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=_.useContext(Dn),{pathname:o}=In(),s=zn(),c=an(e,rn(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){j(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function hr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){j(!Fn(),`You cannot render a <Router> inside another <Router>. 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=kt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=_.useMemo(()=>{let e=Zt(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 wt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:_.createElement(M.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}j(e.type===mr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),j(!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)?(wt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` 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?Zt(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 <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Zt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||vr,i=kr(e.getAttribute(`formenctype`))||kr(o.getAttribute(`enctype`))||yr,a=new FormData(o,e),!Dr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(br(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=vr,r=null,i=yr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var jr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Mr=/[&><\u2028\u2029]/g;function Nr(e){return e.replace(Mr,e=>jr[e])}function Pr(e,t){if(e===!1||e==null)throw Error(t)}function Fr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Zt(i.pathname,t)===`/`?i.pathname=`${cn(t)}/_root.${r}`:i.pathname=`${cn(i.pathname)}.${r}`,i}async function Ir(e,t){if(e.id in t)return t[e.id];try{let n=await bt(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Lr(e){return e!=null&&typeof e.page==`string`}function Rr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function zr(e,t,n){return Wr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ir(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Rr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Br(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Vr(e,t,{includeHydrateFallback:n}={}){return Hr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Hr(e){return[...new Set(e)]}function Ur(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Wr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Lr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ur(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Gr(){let e=_.useContext(yn);return Pr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Kr(){let e=_.useContext(bn);return Pr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var qr=_.createContext(void 0);qr.displayName=`FrameworkContext`;function Jr(){let e=_.useContext(qr);return Pr(e,`You must render this element inside a <HydratedRouter> element`),e}function Yr(e,t){let n=_.useContext(qr),[r,i]=_.useState(!1),[a,o]=_.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=_.useRef(null);_.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),_.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Xr(s,p),onBlur:Xr(c,m),onMouseEnter:Xr(l,p),onMouseLeave:Xr(u,m),onTouchStart:Xr(d,p)}]:[a,f,{}]:[!1,f,{}]}function Xr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Zr({page:e,...t}){let n=Sn(),{router:r}=Gr(),i=_.useMemo(()=>Mt(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?_.createElement($r,{page:e,matches:i,...t}):_.createElement(ei,{page:e,matches:i,...t}):null}function Qr(e){let{manifest:t,routeModules:n}=Jr(),[r,i]=_.useState([]);return _.useEffect(()=>{let r=!1;return zr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function $r({page:e,matches:t,...n}){let r=In(),{future:i}=Jr(),{basename:a}=Gr(),o=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Fr(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return _.createElement(_.Fragment,null,o.map(e=>_.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ei({page:e,matches:t,...n}){let r=In(),{future:i,manifest:a,routeModules:o}=Jr(),{basename:s}=Gr(),{loaderData:c,matches:l}=Kr(),u=_.useMemo(()=>Br(e,t,l,a,r,`data`),[e,t,l,a,r]),d=_.useMemo(()=>Br(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Fr(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=_.useMemo(()=>Vr(d,a),[d,a]),m=Qr(d);return _.createElement(_.Fragment,null,f.map(e=>_.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>_.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>_.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ti(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}_.Component;var ni=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ni&&(window.__reactRouterVersion=`7.14.2`)}catch{}function ri({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=_.useRef();i.current??=Ct({window:r,v5Compat:!0});let a=i.current,[o,s]=_.useState({action:a.action,location:a.location}),c=_.useCallback(e=>{n===!1?s(e):_.startTransition(()=>s(e))},[n]);return _.useLayoutEffect(()=>a.listen(c),[a,c]),_.createElement(hr,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function ii({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=_.useState({action:n.action,location:n.location}),o=_.useCallback(e=>{r===!1?a(e):_.startTransition(()=>a(e))},[r]);return _.useLayoutEffect(()=>n.listen(o),[n,o]),_.createElement(hr,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}ii.displayName=`unstable_HistoryRouter`;var ai=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oi=_.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:v}=_.useContext(M),y=typeof l==`string`&&ai.test(l),b=gn(l,h);l=b.to;let x=Pn(l,{relative:r}),S=In(),C=null;if(o){let e=an(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:sn([h,e.pathname])),C=g.createHref(e)}let[w,T,ee]=Yr(n,p),te=pi(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:v});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let re=!(b.isExternal||i),ie=_.createElement(`a`,{...p,...ee,href:(re?C:void 0)||b.absoluteURL||x,onClick:re?ne:e,ref:ti(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?_.createElement(_.Fragment,null,ie,_.createElement(Zr,{page:x})):ie});oi.displayName=`Link`;var si=_.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Un(a,{relative:c.relative}),d=In(),f=_.useContext(bn),{navigator:p,basename:m}=_.useContext(M),h=f!=null&&Ci(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=Zt(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=v===g||!r&&v.startsWith(g)&&v.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof i==`function`?i(C):i;return _.createElement(oi,{...c,"aria-current":w,className:T,ref:l,style:ee,to:a,viewTransition:o},typeof s==`function`?s(C):s)});si.displayName=`NavLink`;var ci=_.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=vr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=_.useContext(M),g=gi(),v=_i(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&ai.test(s);return _.createElement(`form`,{ref:m,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?_.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});ci.displayName=`Form`;function li({getKey:e,storageKey:t,...n}){let r=_.useContext(qr),{basename:i}=_.useContext(M),a=In(),o=or();xi({getKey:e,storageKey:t});let s=_.useMemo(()=>{if(!r||!e)return null;let t=bi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return _.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Nr(JSON.stringify(t||vi))}, ${Nr(JSON.stringify(s))})`}})}li.displayName=`ScrollRestoration`;function ui(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function di(e){let t=_.useContext(yn);return j(t,ui(e)),t}function fi(e){let t=_.useContext(bn);return j(t,ui(e)),t}function pi(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=zn(),d=In(),f=Un(e,{relative:o});return _.useCallback(p=>{if(Tr(p,t)){p.preventDefault();let t=n===void 0?Ot(d)===Ot(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?_.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var mi=0,hi=()=>`__${String(++mi)}__`;function gi(){let{router:e}=di(`useSubmit`),{basename:t}=_.useContext(M),n=ir(),r=e.fetch,i=e.navigate;return _.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ar(e,t);a.navigate===!1?await r(a.fetcherKey||hi(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function _i(e,{relative:t}={}){let{basename:n}=_.useContext(M),r=_.useContext(Dn);j(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Un(e||`.`,{relative:t})},o=In();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:sn([n,a.pathname])),Ot(a)}var vi=`react-router-scroll-positions`,yi={};function bi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Zt(e.pathname,n)||e.pathname},t)),i??=e.key,i}function xi({getKey:e,storageKey:t}={}){let{router:n}=di(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=fi(`useScrollRestoration`),{basename:a}=_.useContext(M),o=In(),s=or(),c=ar();_.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Si(_.useCallback(()=>{if(c.state===`idle`){let t=bi(o,s,a,e);yi[t]=window.scrollY}try{sessionStorage.setItem(t||vi,JSON.stringify(yi))}catch(e){wt(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(_.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||vi);e&&(yi=JSON.parse(e))}catch{}},[t]),_.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(yi,()=>window.scrollY,e?(t,n)=>bi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),_.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{wt(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Si(e,t){let{capture:n}=t||{};_.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Ci(e,{relative:t}={}){let n=_.useContext(Cn);j(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=di(`useViewTransitionState`),i=Un(e,{relative:t});if(!n.isTransitioning)return!1;let a=Zt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Zt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Jt(i.pathname,o)!=null||Jt(i.pathname,a)!=null}var wi=class extends Error{constructor(e,t){super(t),this.status=e}};async function Ti(e,t={}){let n=await fetch(e,{credentials:`include`,headers:{"Content-Type":`application/json`,...t.headers||{}},...t});if(!(n.headers.get(`content-type`)||``).includes(`application/json`)){if(!n.ok)throw new wi(n.status,n.statusText);return await n.blob()}let r=await n.json();if(!n.ok||r.success===!1)throw new wi(n.status,r.error||n.statusText);return r}var N={get:e=>Ti(e),post:(e,t)=>Ti(e,{method:`POST`,body:JSON.stringify(t)}),put:(e,t)=>Ti(e,{method:`PUT`,body:JSON.stringify(t)}),delete:e=>Ti(e,{method:`DELETE`})},Ei=[{label:`Encounters`,items:[{to:`/encounter`,label:`Encounter HPI`,available:!0},{to:`/dictation`,label:`Dictation HPI`,available:!0}]},{label:`Notes`,items:[{to:`/hospital`,label:`Hospital Course`,available:!0},{to:`/chart`,label:`Chart Review`,available:!0},{to:`/soap`,label:`SOAP Note`,available:!0},{to:`/wellvisit`,label:`Well Visit`,available:!0},{to:`/sickvisit`,label:`Sick Visit`,available:!0}]},{label:`Clinical Tools`,items:[{to:`/vaxschedule`,label:`Vaccine Schedule`,available:!0},{to:`/catchup`,label:`Catch-Up Schedule`,available:!0},{to:`/peguide`,label:`Physical Exam Guide`,available:!0},{to:`/bedside`,label:`Bedside`,available:!0},{to:`/calculators`,label:`Calculators`,available:!0},{to:`/extensions`,label:`Pagers & Extensions`,available:!0},{to:`/learning`,label:`Learning Hub`,available:!0}]},{label:`Account`,items:[{to:`/settings`,label:`Settings`,available:!0},{to:`/faq`,label:`FAQ`,available:!0}]},{label:`Admin`,items:[{to:`/admin`,label:`Admin Panel`,available:!0,adminOnly:!0}]}];function Di({item:e}){return e.available?(0,O.jsx)(si,{to:e.to,className:({isActive:e})=>`block px-3 py-2 text-sm rounded-md transition-colors `+(e?`bg-primary text-primary-foreground`:`hover:bg-muted text-foreground`),children:e.label}):(0,O.jsxs)(`div`,{className:`px-3 py-2 text-sm rounded-md text-muted-foreground italic cursor-not-allowed opacity-60`,title:`Not yet ported to React — still available in the vanilla app at /`,children:[e.label,` `,(0,O.jsx)(`span`,{className:`text-[10px]`,children:`· pending`})]})}function Oi({children:e}){let{data:t}=k({queryKey:[`auth-me`],queryFn:()=>N.get(`/api/auth/me`),staleTime:5*6e4}),n=t?.user.role===`admin`;return(0,O.jsxs)(`div`,{className:`min-h-screen bg-background text-foreground flex`,children:[(0,O.jsxs)(`aside`,{className:`w-64 border-r border-border bg-muted/30 flex-shrink-0 p-3 space-y-4 sticky top-0 h-screen overflow-y-auto`,children:[(0,O.jsxs)(`div`,{className:`px-2 py-1 border-b border-border pb-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`Pediatric AI Scribe`}),(0,O.jsx)(`a`,{href:`/`,className:`text-[11px] text-muted-foreground underline`,children:`← back to legacy app`})]}),Ei.map(e=>{let t=e.items.filter(e=>!e.adminOnly||n);return t.length===0?null:(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(`div`,{className:`px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.label}),t.map(e=>(0,O.jsx)(Di,{item:e},e.to))]},e.label)})]}),(0,O.jsx)(`main`,{className:`flex-1 min-w-0`,children:e??(0,O.jsx)(pr,{})})]})}Object.freeze({status:`aborted`});function P(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var ki=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ai=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},ji={};function Mi(e){return e&&Object.assign(ji,e),ji}function Ni(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Pi(e,t){return typeof t==`bigint`?t.toString():t}function Fi(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Ii(e){return e==null}function Li(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var Ri=Symbol(`evaluating`);function F(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ri)return r===void 0&&(r=Ri,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function zi(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Bi(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Vi(e){return JSON.stringify(e)}function Hi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Ui=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Wi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Gi=Fi(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ki(e){if(Wi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Wi(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function qi(e){return Ki(e)?{...e}:Array.isArray(e)?[...e]:e}var Ji=new Set([`string`,`number`,`symbol`]);function Yi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xi(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function I(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Zi(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Qi(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Xi(e,Bi(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return zi(this,`shape`,e),e},checks:[]}))}function $i(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Xi(e,Bi(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return zi(this,`shape`,r),r},checks:[]}))}function ea(e,t){if(!Ki(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Xi(e,Bi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return zi(this,`shape`,n),n}}))}function ta(e,t){if(!Ki(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Xi(e,Bi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return zi(this,`shape`,n),n}}))}function na(e,t){return Xi(e,Bi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return zi(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function ra(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Xi(t,Bi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return zi(this,`shape`,i),i},checks:[]}))}function ia(e,t,n){return Xi(t,Bi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return zi(this,`shape`,i),i}}))}function aa(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function oa(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function sa(e){return typeof e==`string`?e:e?.message}function ca(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=sa(e.inst?._zod.def?.error?.(e))??sa(t?.error?.(e))??sa(n.customError?.(e))??sa(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function la(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ua(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var da=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pi,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},fa=P(`$ZodError`,da),pa=P(`$ZodError`,da,{Parent:Error});function ma(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ha(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var ga=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new ki;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ca(e,a,Mi())));throw Ui(t,i?.callee),t}return o.value},_a=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ca(e,a,Mi())));throw Ui(t,i?.callee),t}return o.value},va=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ki;return a.issues.length?{success:!1,error:new(e??fa)(a.issues.map(e=>ca(e,i,Mi())))}:{success:!0,data:a.value}},ya=va(pa),ba=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ca(e,i,Mi())))}:{success:!0,data:a.value}},xa=ba(pa),Sa=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ga(e)(t,n,i)},Ca=e=>(t,n,r)=>ga(e)(t,n,r),wa=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _a(e)(t,n,i)},Ta=e=>async(t,n,r)=>_a(e)(t,n,r),Ea=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return va(e)(t,n,i)},Da=e=>(t,n,r)=>va(e)(t,n,r),Oa=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ba(e)(t,n,i)},ka=e=>async(t,n,r)=>ba(e)(t,n,r),Aa=/^[cC][^\s-]{8,}$/,ja=/^[0-9a-z]+$/,Ma=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Na=/^[0-9a-vA-V]{20}$/,Pa=/^[A-Za-z0-9]{27}$/,Fa=/^[a-zA-Z0-9_-]{21}$/,Ia=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,La=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ra=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,za=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ba=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Va(){return new RegExp(Ba,`u`)}var Ha=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ua=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Wa=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ga=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ka=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qa=/^[A-Za-z0-9_-]*$/,Ja=/^\+[1-9]\d{6,14}$/,Ya=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Xa=RegExp(`^${Ya}$`);function Za(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Qa(e){return RegExp(`^${Za(e)}$`)}function $a(e){let t=Za({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Ya}T(?:${r})$`)}var eo=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},to=/^[^A-Z]*$/,no=/^[^a-z]*$/,ro=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),io=P(`$ZodCheckMaxLength`,(e,t)=>{var n;ro.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ii(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=la(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ao=P(`$ZodCheckMinLength`,(e,t)=>{var n;ro.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ii(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=la(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),oo=P(`$ZodCheckLengthEquals`,(e,t)=>{var n;ro.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ii(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=la(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),so=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ro.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),co=P(`$ZodCheckRegex`,(e,t)=>{so.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),lo=P(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=to,so.init(e,t)}),uo=P(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=no,so.init(e,t)}),fo=P(`$ZodCheckIncludes`,(e,t)=>{ro.init(e,t);let n=Yi(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),po=P(`$ZodCheckStartsWith`,(e,t)=>{ro.init(e,t);let n=RegExp(`^${Yi(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),mo=P(`$ZodCheckEndsWith`,(e,t)=>{ro.init(e,t);let n=RegExp(`.*${Yi(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ho=P(`$ZodCheckOverwrite`,(e,t)=>{ro.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),go=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
||
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
||
`))}},L={major:4,minor:3,patch:6},R=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=L;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=aa(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new ki;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=aa(e,t))});else{if(e.issues.length===t)continue;r||=aa(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(aa(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new ki;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new ki;return o.then(e=>t(e,r,a))}return t(o,r,a)}}F(e,`~standard`,()=>({validate:t=>{try{let n=ya(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xa(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),_o=P(`$ZodString`,(e,t)=>{R.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??eo(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),vo=P(`$ZodStringFormat`,(e,t)=>{so.init(e,t),_o.init(e,t)}),yo=P(`$ZodGUID`,(e,t)=>{t.pattern??=La,vo.init(e,t)}),bo=P(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ra(e)}else t.pattern??=Ra();vo.init(e,t)}),xo=P(`$ZodEmail`,(e,t)=>{t.pattern??=za,vo.init(e,t)}),So=P(`$ZodURL`,(e,t)=>{vo.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Co=P(`$ZodEmoji`,(e,t)=>{t.pattern??=Va(),vo.init(e,t)}),wo=P(`$ZodNanoID`,(e,t)=>{t.pattern??=Fa,vo.init(e,t)}),To=P(`$ZodCUID`,(e,t)=>{t.pattern??=Aa,vo.init(e,t)}),Eo=P(`$ZodCUID2`,(e,t)=>{t.pattern??=ja,vo.init(e,t)}),Do=P(`$ZodULID`,(e,t)=>{t.pattern??=Ma,vo.init(e,t)}),Oo=P(`$ZodXID`,(e,t)=>{t.pattern??=Na,vo.init(e,t)}),ko=P(`$ZodKSUID`,(e,t)=>{t.pattern??=Pa,vo.init(e,t)}),Ao=P(`$ZodISODateTime`,(e,t)=>{t.pattern??=$a(t),vo.init(e,t)}),jo=P(`$ZodISODate`,(e,t)=>{t.pattern??=Xa,vo.init(e,t)}),Mo=P(`$ZodISOTime`,(e,t)=>{t.pattern??=Qa(t),vo.init(e,t)}),No=P(`$ZodISODuration`,(e,t)=>{t.pattern??=Ia,vo.init(e,t)}),Po=P(`$ZodIPv4`,(e,t)=>{t.pattern??=Ha,vo.init(e,t),e._zod.bag.format=`ipv4`}),Fo=P(`$ZodIPv6`,(e,t)=>{t.pattern??=Ua,vo.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Io=P(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Wa,vo.init(e,t)}),Lo=P(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ga,vo.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Ro(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var zo=P(`$ZodBase64`,(e,t)=>{t.pattern??=Ka,vo.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Ro(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Bo(e){if(!qa.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ro(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Vo=P(`$ZodBase64URL`,(e,t)=>{t.pattern??=qa,vo.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Bo(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ho=P(`$ZodE164`,(e,t)=>{t.pattern??=Ja,vo.init(e,t)});function Uo(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Wo=P(`$ZodJWT`,(e,t)=>{vo.init(e,t),e._zod.check=n=>{Uo(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Go=P(`$ZodUnknown`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),Ko=P(`$ZodNever`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function qo(e,t,n){e.issues.length&&t.issues.push(...oa(n,e.issues)),t.value[n]=e.value}var Jo=P(`$ZodArray`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>qo(t,n,e))):qo(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Yo(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...oa(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Xo(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Zi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Zo(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Yo(e,n,i,t,u))):Yo(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Qo=P(`$ZodObject`,(e,t)=>{if(R.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Fi(()=>Xo(t));F(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Wi,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Yo(n,t,e,s,r))):Yo(i,t,e,s,r)}return i?Zo(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),$o=P(`$ZodObjectJIT`,(e,t)=>{Qo.init(e,t);let n=e._zod.parse,r=Fi(()=>Xo(t)),i=e=>{let t=new go([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Vi(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Vi(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
||
if (${n}.issues.length) {
|
||
if (${o} in input) {
|
||
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
||
})));
|
||
}
|
||
}
|
||
|
||
if (${n}.value === undefined) {
|
||
if (${o} in input) {
|
||
newResult[${o}] = undefined;
|
||
}
|
||
} else {
|
||
newResult[${o}] = ${n}.value;
|
||
}
|
||
|
||
`):t.write(`
|
||
if (${n}.issues.length) {
|
||
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
||
})));
|
||
}
|
||
|
||
if (${n}.value === undefined) {
|
||
if (${o} in input) {
|
||
newResult[${o}] = undefined;
|
||
}
|
||
} else {
|
||
newResult[${o}] = ${n}.value;
|
||
}
|
||
|
||
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Wi,s=!ji.jitless,c=s&&Gi.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Zo([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function es(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!aa(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ca(e,r,Mi())))}),t)}var ts=P(`$ZodUnion`,(e,t)=>{R.init(e,t),F(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),F(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),F(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),F(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Li(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>es(t,i,e,a)):es(s,i,e,a)}}),ns=P(`$ZodIntersection`,(e,t)=>{R.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>is(e,t,n)):is(e,i,a)}});function rs(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ki(e)&&Ki(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=rs(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=rs(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function is(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),aa(e))return e;let o=rs(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var as=P(`$ZodEnum`,(e,t)=>{R.init(e,t);let n=Ni(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ji.has(typeof e)).map(e=>typeof e==`string`?Yi(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),os=P(`$ZodTransform`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ai(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new ki;return n.value=i,n}});function ss(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var cs=P(`$ZodOptional`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,F(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),F(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Li(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>ss(t,e.value)):ss(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ls=P(`$ZodExactOptional`,(e,t)=>{cs.init(e,t),F(e._zod,`values`,()=>t.innerType._zod.values),F(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),us=P(`$ZodNullable`,(e,t)=>{R.init(e,t),F(e._zod,`optin`,()=>t.innerType._zod.optin),F(e._zod,`optout`,()=>t.innerType._zod.optout),F(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Li(e.source)}|null)$`):void 0}),F(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ds=P(`$ZodDefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,F(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>fs(e,t)):fs(r,t)}});function fs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ps=P(`$ZodPrefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,F(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ms=P(`$ZodNonOptional`,(e,t)=>{R.init(e,t),F(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>hs(t,e)):hs(i,e)}});function hs(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var gs=P(`$ZodCatch`,(e,t)=>{R.init(e,t),F(e._zod,`optin`,()=>t.innerType._zod.optin),F(e._zod,`optout`,()=>t.innerType._zod.optout),F(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ca(e,n,Mi()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ca(e,n,Mi()))},input:e.value}),e.issues=[]),e)}}),_s=P(`$ZodPipe`,(e,t)=>{R.init(e,t),F(e._zod,`values`,()=>t.in._zod.values),F(e._zod,`optin`,()=>t.in._zod.optin),F(e._zod,`optout`,()=>t.out._zod.optout),F(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>vs(e,t.in,n)):vs(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>vs(e,t.out,n)):vs(r,t.out,n)}});function vs(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ys=P(`$ZodReadonly`,(e,t)=>{R.init(e,t),F(e._zod,`propValues`,()=>t.innerType._zod.propValues),F(e._zod,`values`,()=>t.innerType._zod.values),F(e._zod,`optin`,()=>t.innerType?._zod?.optin),F(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(bs):bs(r)}});function bs(e){return e.value=Object.freeze(e.value),e}var xs=P(`$ZodCustom`,(e,t)=>{ro.init(e,t),R.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ss(t,n,r,e));Ss(i,n,r,e)}});function Ss(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ua(e))}}var Cs,ws=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ts(){return new ws}(Cs=globalThis).__zod_globalRegistry??(Cs.__zod_globalRegistry=Ts());var Es=globalThis.__zod_globalRegistry;function Ds(e,t){return new e({type:`string`,...I(t)})}function Os(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...I(t)})}function ks(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...I(t)})}function As(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...I(t)})}function js(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...I(t)})}function Ms(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...I(t)})}function Ns(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...I(t)})}function Ps(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...I(t)})}function Fs(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...I(t)})}function Is(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...I(t)})}function Ls(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...I(t)})}function Rs(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...I(t)})}function zs(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...I(t)})}function Bs(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...I(t)})}function Vs(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...I(t)})}function Hs(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...I(t)})}function Us(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...I(t)})}function Ws(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...I(t)})}function Gs(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...I(t)})}function Ks(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...I(t)})}function qs(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...I(t)})}function Js(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...I(t)})}function Ys(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...I(t)})}function Xs(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...I(t)})}function Zs(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...I(t)})}function Qs(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...I(t)})}function $s(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...I(t)})}function ec(e){return new e({type:`unknown`})}function tc(e,t){return new e({type:`never`,...I(t)})}function nc(e,t){return new io({check:`max_length`,...I(t),maximum:e})}function rc(e,t){return new ao({check:`min_length`,...I(t),minimum:e})}function ic(e,t){return new oo({check:`length_equals`,...I(t),length:e})}function ac(e,t){return new co({check:`string_format`,format:`regex`,...I(t),pattern:e})}function oc(e){return new lo({check:`string_format`,format:`lowercase`,...I(e)})}function sc(e){return new uo({check:`string_format`,format:`uppercase`,...I(e)})}function cc(e,t){return new fo({check:`string_format`,format:`includes`,...I(t),includes:e})}function lc(e,t){return new po({check:`string_format`,format:`starts_with`,...I(t),prefix:e})}function uc(e,t){return new mo({check:`string_format`,format:`ends_with`,...I(t),suffix:e})}function dc(e){return new ho({check:`overwrite`,tx:e})}function fc(e){return dc(t=>t.normalize(e))}function pc(){return dc(e=>e.trim())}function mc(){return dc(e=>e.toLowerCase())}function hc(){return dc(e=>e.toUpperCase())}function gc(){return dc(e=>Hi(e))}function _c(e,t,n){return new e({type:`array`,element:t,...I(n)})}function vc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...I(n)})}function yc(e){let t=bc(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(ua(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(ua(r))}},e(n.value,n)));return t}function bc(e,t){let n=new ro({check:`custom`,...I(t)});return n._zod.check=e,n}function xc(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Es,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Sc(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Sc(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Tc(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Cc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
||
|
||
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function wc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Dc(t,`input`,e.processors),output:Dc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Tc(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Tc(r.element,n);if(r.type===`set`)return Tc(r.valueType,n);if(r.type===`lazy`)return Tc(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Tc(r.innerType,n);if(r.type===`intersection`)return Tc(r.left,n)||Tc(r.right,n);if(r.type===`record`||r.type===`map`)return Tc(r.keyType,n)||Tc(r.valueType,n);if(r.type===`pipe`)return Tc(r.in,n)||Tc(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Tc(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Tc(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Tc(e,n))return!0;return!!(r.rest&&Tc(r.rest,n))}return!1}var Ec=(e,t={})=>n=>{let r=xc({...n,processors:t});return Sc(e,r),Cc(r,e),wc(r,e)},Dc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=xc({...i??{},target:a,io:t,processors:n});return Sc(e,o),Cc(o,e),wc(o,e)},Oc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},kc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Oc[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ac=(e,t,n,r)=>{n.not={}},jc=(e,t,n,r)=>{let i=e._zod.def,a=Ni(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Mc=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Nc=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Pc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Sc(a.element,t,{...r,path:[...r.path,`items`]})},Fc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Sc(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Sc(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ic=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Sc(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Lc=(e,t,n,r)=>{let i=e._zod.def,a=Sc(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Sc(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Rc=(e,t,n,r)=>{let i=e._zod.def,a=Sc(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},zc=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bc=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Vc=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Hc=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Uc=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Sc(a,t,r);let o=t.seen.get(e);o.ref=a},Wc=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Gc=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Kc=P(`ZodISODateTime`,(e,t)=>{Ao.init(e,t),_l.init(e,t)});function qc(e){return Xs(Kc,e)}var Jc=P(`ZodISODate`,(e,t)=>{jo.init(e,t),_l.init(e,t)});function Yc(e){return Zs(Jc,e)}var Xc=P(`ZodISOTime`,(e,t)=>{Mo.init(e,t),_l.init(e,t)});function Zc(e){return Qs(Xc,e)}var Qc=P(`ZodISODuration`,(e,t)=>{No.init(e,t),_l.init(e,t)});function $c(e){return $s(Qc,e)}var el=(e,t)=>{fa.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ha(e,t)},flatten:{value:t=>ma(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Pi,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Pi,2)}},isEmpty:{get(){return e.issues.length===0}}})};P(`ZodError`,el);var tl=P(`ZodError`,el,{Parent:Error}),nl=ga(tl),rl=_a(tl),il=va(tl),al=ba(tl),ol=Sa(tl),sl=Ca(tl),cl=wa(tl),ll=Ta(tl),ul=Ea(tl),dl=Da(tl),fl=Oa(tl),pl=ka(tl),z=P(`ZodType`,(e,t)=>(R.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Dc(e,`input`),output:Dc(e,`output`)}}),e.toJSONSchema=Ec(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Bi(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Xi(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>nl(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>il(e,t,n),e.parseAsync=async(t,n)=>rl(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>al(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ol(e,t,n),e.decode=(t,n)=>sl(e,t,n),e.encodeAsync=async(t,n)=>cl(e,t,n),e.decodeAsync=async(t,n)=>ll(e,t,n),e.safeEncode=(t,n)=>ul(e,t,n),e.safeDecode=(t,n)=>dl(e,t,n),e.safeEncodeAsync=async(t,n)=>fl(e,t,n),e.safeDecodeAsync=async(t,n)=>pl(e,t,n),e.refine=(t,n)=>e.check(mu(t,n)),e.superRefine=t=>e.check(hu(t)),e.overwrite=t=>e.check(dc(t)),e.optional=()=>Xl(e),e.exactOptional=()=>Ql(e),e.nullable=()=>eu(e),e.nullish=()=>Xl(eu(e)),e.nonoptional=t=>ou(e,t),e.array=()=>Hl(e),e.or=t=>Gl([e,t]),e.and=t=>H(e,t),e.transform=t=>uu(e,Jl(t)),e.default=t=>nu(e,t),e.prefault=t=>iu(e,t),e.catch=t=>cu(e,t),e.pipe=t=>uu(e,t),e.readonly=()=>fu(e),e.describe=t=>{let n=e.clone();return Es.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Es.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Es.get(e);let n=e.clone();return Es.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ml=P(`_ZodString`,(e,t)=>{_o.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kc(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ac(...t)),e.includes=(...t)=>e.check(cc(...t)),e.startsWith=(...t)=>e.check(lc(...t)),e.endsWith=(...t)=>e.check(uc(...t)),e.min=(...t)=>e.check(rc(...t)),e.max=(...t)=>e.check(nc(...t)),e.length=(...t)=>e.check(ic(...t)),e.nonempty=(...t)=>e.check(rc(1,...t)),e.lowercase=t=>e.check(oc(t)),e.uppercase=t=>e.check(sc(t)),e.trim=()=>e.check(pc()),e.normalize=(...t)=>e.check(fc(...t)),e.toLowerCase=()=>e.check(mc()),e.toUpperCase=()=>e.check(hc()),e.slugify=()=>e.check(gc())}),hl=P(`ZodString`,(e,t)=>{_o.init(e,t),ml.init(e,t),e.email=t=>e.check(Os(vl,t)),e.url=t=>e.check(Ps(xl,t)),e.jwt=t=>e.check(Ys(Il,t)),e.emoji=t=>e.check(Fs(Sl,t)),e.guid=t=>e.check(ks(yl,t)),e.uuid=t=>e.check(As(bl,t)),e.uuidv4=t=>e.check(js(bl,t)),e.uuidv6=t=>e.check(Ms(bl,t)),e.uuidv7=t=>e.check(Ns(bl,t)),e.nanoid=t=>e.check(Is(Cl,t)),e.guid=t=>e.check(ks(yl,t)),e.cuid=t=>e.check(Ls(wl,t)),e.cuid2=t=>e.check(Rs(Tl,t)),e.ulid=t=>e.check(zs(El,t)),e.base64=t=>e.check(Ks(Nl,t)),e.base64url=t=>e.check(qs(Pl,t)),e.xid=t=>e.check(Bs(Dl,t)),e.ksuid=t=>e.check(Vs(Ol,t)),e.ipv4=t=>e.check(Hs(kl,t)),e.ipv6=t=>e.check(Us(Al,t)),e.cidrv4=t=>e.check(Ws(jl,t)),e.cidrv6=t=>e.check(Gs(Ml,t)),e.e164=t=>e.check(Js(Fl,t)),e.datetime=t=>e.check(qc(t)),e.date=t=>e.check(Yc(t)),e.time=t=>e.check(Zc(t)),e.duration=t=>e.check($c(t))});function gl(e){return Ds(hl,e)}var _l=P(`ZodStringFormat`,(e,t)=>{vo.init(e,t),ml.init(e,t)}),vl=P(`ZodEmail`,(e,t)=>{xo.init(e,t),_l.init(e,t)}),yl=P(`ZodGUID`,(e,t)=>{yo.init(e,t),_l.init(e,t)}),bl=P(`ZodUUID`,(e,t)=>{bo.init(e,t),_l.init(e,t)}),xl=P(`ZodURL`,(e,t)=>{So.init(e,t),_l.init(e,t)}),Sl=P(`ZodEmoji`,(e,t)=>{Co.init(e,t),_l.init(e,t)}),Cl=P(`ZodNanoID`,(e,t)=>{wo.init(e,t),_l.init(e,t)}),wl=P(`ZodCUID`,(e,t)=>{To.init(e,t),_l.init(e,t)}),Tl=P(`ZodCUID2`,(e,t)=>{Eo.init(e,t),_l.init(e,t)}),El=P(`ZodULID`,(e,t)=>{Do.init(e,t),_l.init(e,t)}),Dl=P(`ZodXID`,(e,t)=>{Oo.init(e,t),_l.init(e,t)}),Ol=P(`ZodKSUID`,(e,t)=>{ko.init(e,t),_l.init(e,t)}),kl=P(`ZodIPv4`,(e,t)=>{Po.init(e,t),_l.init(e,t)}),Al=P(`ZodIPv6`,(e,t)=>{Fo.init(e,t),_l.init(e,t)}),jl=P(`ZodCIDRv4`,(e,t)=>{Io.init(e,t),_l.init(e,t)}),Ml=P(`ZodCIDRv6`,(e,t)=>{Lo.init(e,t),_l.init(e,t)}),Nl=P(`ZodBase64`,(e,t)=>{zo.init(e,t),_l.init(e,t)}),Pl=P(`ZodBase64URL`,(e,t)=>{Vo.init(e,t),_l.init(e,t)}),Fl=P(`ZodE164`,(e,t)=>{Ho.init(e,t),_l.init(e,t)}),Il=P(`ZodJWT`,(e,t)=>{Wo.init(e,t),_l.init(e,t)}),Ll=P(`ZodUnknown`,(e,t)=>{Go.init(e,t),z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Rl(){return ec(Ll)}var zl=P(`ZodNever`,(e,t)=>{Ko.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ac(e,t,n,r)});function Bl(e){return tc(zl,e)}var Vl=P(`ZodArray`,(e,t)=>{Jo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pc(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(rc(t,n)),e.nonempty=t=>e.check(rc(1,t)),e.max=(t,n)=>e.check(nc(t,n)),e.length=(t,n)=>e.check(ic(t,n)),e.unwrap=()=>e.element});function Hl(e,t){return _c(Vl,e,t)}var Ul=P(`ZodObject`,(e,t)=>{$o.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fc(e,t,n,r),F(e,`shape`,()=>t.shape),e.keyof=()=>Kl(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Rl()}),e.loose=()=>e.clone({...e._zod.def,catchall:Rl()}),e.strict=()=>e.clone({...e._zod.def,catchall:Bl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ea(e,t),e.safeExtend=t=>ta(e,t),e.merge=t=>na(e,t),e.pick=t=>Qi(e,t),e.omit=t=>$i(e,t),e.partial=(...t)=>ra(Yl,e,t[0]),e.required=(...t)=>ia(au,e,t[0])});function Wl(e,t){return new Ul({type:`object`,shape:e??{},...I(t)})}var B=P(`ZodUnion`,(e,t)=>{ts.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r),e.options=t.options});function Gl(e,t){return new B({type:`union`,options:e,...I(t)})}var V=P(`ZodIntersection`,(e,t)=>{ns.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r)});function H(e,t){return new V({type:`intersection`,left:e,right:t})}var U=P(`ZodEnum`,(e,t)=>{as.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jc(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new U({...t,checks:[],...I(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new U({...t,checks:[],...I(r),entries:i})}});function Kl(e,t){return new U({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...I(t)})}var ql=P(`ZodTransform`,(e,t)=>{os.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ai(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ua(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ua(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Jl(e){return new ql({type:`transform`,transform:e})}var Yl=P(`ZodOptional`,(e,t)=>{cs.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xl(e){return new Yl({type:`optional`,innerType:e})}var Zl=P(`ZodExactOptional`,(e,t)=>{ls.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ql(e){return new Zl({type:`optional`,innerType:e})}var $l=P(`ZodNullable`,(e,t)=>{us.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function eu(e){return new $l({type:`nullable`,innerType:e})}var tu=P(`ZodDefault`,(e,t)=>{ds.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nu(e,t){return new tu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():qi(t)}})}var ru=P(`ZodPrefault`,(e,t)=>{ps.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function iu(e,t){return new ru({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():qi(t)}})}var au=P(`ZodNonOptional`,(e,t)=>{ms.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ou(e,t){return new au({type:`nonoptional`,innerType:e,...I(t)})}var su=P(`ZodCatch`,(e,t)=>{gs.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cu(e,t){return new su({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var lu=P(`ZodPipe`,(e,t)=>{_s.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r),e.in=t.in,e.out=t.out});function uu(e,t){return new lu({type:`pipe`,in:e,out:t})}var du=P(`ZodReadonly`,(e,t)=>{ys.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fu(e){return new du({type:`readonly`,innerType:e})}var pu=P(`ZodCustom`,(e,t)=>{xs.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mc(e,t,n,r)});function mu(e,t={}){return vc(pu,e,t)}function hu(e){return yc(e)}var gu=gl().min(1),W=gl().optional(),_u=gl().optional();Wl({email:gl().email(),password:gu,turnstileToken:W,totpCode:W}),Wl({email:gl().email(),password:gl().min(8,`Password must be at least 8 characters`),name:gu,turnstileToken:W}),Wl({email:gl().email(),turnstileToken:W});var vu=Wl({transcript:gu,patientAge:W,patientGender:W,model:_u,setting:Kl([`outpatient`,`inpatient`]).optional(),physicianMemories:W}),yu=Wl({transcript:gu,patientAge:W,patientGender:W,model:_u,type:Kl([`full`,`subjective`]).optional(),additionalInstructions:W,physicianMemories:W}),bu=Wl({patientAge:W,patientGender:W,chiefComplaint:gu,transcript:W,dictation:W,ros:W,physicalExam:W,diagnoses:W,physicianMemories:W,model:_u});Wl({currentDocument:gu,instructions:gu,sourceContext:W,model:_u}),Wl({steps:Hl(Wl({component:W,label:gu,method:W,normal:W,status:Kl([`normal`,`abnormal`]).nullable().optional(),note:W})).min(1),ageGroup:W,system:W,patientAge:W,patientGender:W,model:_u,format:Kl([`narrative`,`list`]).optional()});var xu=Wl({location:gl().min(1).max(120),name:gl().min(1).max(120),number:gl().min(1).max(40),type:Kl([`extension`,`pager`]).optional(),notes:gl().max(500).optional()});function Su({ext:e}){return(0,O.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 border-b border-border`,children:[(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.location})]}),(0,O.jsx)(`div`,{className:`font-mono text-sm`,children:e.number}),(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground w-20 text-right`,children:e.type})]})}function Cu({onDone:e}){let t=nt(),[n,r]=(0,_.useState)({location:``,name:``,number:``,type:`extension`,notes:``}),[i,a]=(0,_.useState)(null),o=A({mutationFn:e=>N.post(`/api/extensions`,e),onSuccess:()=>{t.invalidateQueries({queryKey:[`extensions`]}),e()},onError:e=>a(e.message)});function s(e){e.preventDefault(),a(null);let t=xu.safeParse(n);if(!t.success){a(t.error.issues.map(e=>e.message).join(`, `));return}o.mutate(t.data)}let c=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`;return(0,O.jsxs)(`form`,{onSubmit:s,className:`space-y-3 p-4 bg-muted/40 rounded-lg border border-border`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsx)(`input`,{className:c,placeholder:`Location (e.g. Main Hospital)`,value:n.location,onChange:e=>r({...n,location:e.target.value})}),(0,O.jsx)(`input`,{className:c,placeholder:`Name / department`,value:n.name,onChange:e=>r({...n,name:e.target.value})}),(0,O.jsx)(`input`,{className:c,placeholder:`Number`,value:n.number,onChange:e=>r({...n,number:e.target.value})}),(0,O.jsxs)(`select`,{className:c,value:n.type,onChange:e=>r({...n,type:e.target.value}),children:[(0,O.jsx)(`option`,{value:`extension`,children:`Extension`}),(0,O.jsx)(`option`,{value:`pager`,children:`Pager`})]})]}),i&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:i}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`submit`,disabled:o.isPending,className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:o.isPending?`Saving…`:`Save`}),(0,O.jsx)(`button`,{type:`button`,onClick:e,className:`rounded-md border border-border px-4 py-2 text-sm`,children:`Cancel`})]})]})}function wu(){let[e,t]=(0,_.useState)(!1),{data:n,isLoading:r,error:i}=k({queryKey:[`extensions`],queryFn:()=>N.get(`/api/extensions`)});return(0,O.jsxs)(`div`,{className:`max-w-3xl mx-auto p-6 space-y-4`,children:[(0,O.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Pagers & Extensions`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Per-user directory. This React port is the migration proof-of-life.`})]}),!e&&(0,O.jsx)(`button`,{onClick:()=>t(!0),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,children:`+ Add`})]}),e&&(0,O.jsx)(Cu,{onDone:()=>t(!1)}),r&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),i&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:i.message}),n&&n.items.length===0&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground italic py-8 text-center`,children:`No extensions yet. Click Add to create the first one.`}),n&&n.items.length>0&&(0,O.jsx)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:n.items.map(e=>(0,O.jsx)(Su,{ext:e},e.id))})]})}var Tu=[{section:`Getting Started`,items:[{q:`What is Pediatric AI Scribe?`,a:`Pediatric AI Scribe is an AI-powered clinical documentation tool designed specifically for pediatric medicine. It helps physicians generate structured clinical notes from voice recordings or typed text, saving time on documentation so you can focus on patient care. It supports HPIs, SOAP notes, hospital courses, chart reviews, well visits, sick visits, developmental milestone assessments, and more.`},{q:`How do I create my first note?`,a:`The easiest way to start is with Live Encounter: Go to the Encounter tab Enter the patient's age and gender Click Start Recording and speak naturally during your patient encounter Click Stop when done — the audio is transcribed automatically Click Generate HPI to create a structured note Edit the note as needed, then Copy to paste into your EHR`},{q:`Can I type or paste notes instead of recording?`,a:`Yes. Every transcript box is editable. You can type directly, paste from another source, or combine typed text with a recording. The AI works with whatever text is in the transcript area when you click Generate.`},{q:`What types of notes can I generate?`,a:`HPI — from live encounters or dictation, with OLDCARTS structure SOAP Notes — full SOAP or subjective-only from dictation Hospital Course — from progress notes, in prose, day-by-day, or organ-system format Chart Review — summarize outpatient, subspecialty, or ED visits for precharting Well Visit — complete preventive care notes with SSHADESS, milestones, and vaccines Sick Visit — quick documentation with auto-suggested ROS and PE Milestone Assessment — developmental narrative from selected milestones`}]},{section:`AI & Models`,items:[{q:`What AI model should I use?`,a:`Each tab has a model selector dropdown. All available models have been tested and configured by your administrator for clinical documentation quality. They are routed through HIPAA-compliant providers with signed Business Associate Agreements (BAAs). All models are capable of generating accurate clinical notes. If you are unsure which to pick, start with the default. You can experiment with different models and see which output style you prefer — some may be faster, some more detailed, some more concise. You can choose a different model per tab depending on the task.`},{q:`Does the AI learn from my edits?`,a:`Yes. The app uses a correction tracking system inspired by Dragon Medical's adaptive learning. Here is how it works: When the AI generates a note, the original output is stored in memory You edit the note to match your preferred style — fix phrasing, add details, restructure sections When you click Save, the app detects what you changed and stores the correction On future notes, your past corrections are included as style hints so the AI adapts to your documentation preferences The more you use the app and save your edits, the better the AI gets at matching your style. You can view and manage your stored corrections in Settings > AI Corrections. Note: Corrections are applied as gentle suggestions, not strict rules. The AI prioritizes clinical accuracy over style matching.`},{q:`Can I customize the AI's prompts?`,a:`Administrators can edit all AI prompts from the Admin Panel > Settings > Prompts section. This lets you adjust the instructions the AI follows for each note type without changing any code. Changes take effect immediately.`},{q:`What does the "Refine" button do?`,a:`After generating a note, you can give the AI plain-language instructions to modify it. For example: "Make it shorter" "Add that the patient has a history of asthma" "Summarize the labs" "Change the assessment to include bronchiolitis" The AI references both its current output and your original source material (transcript, pasted notes, labs) when refining, so it can look up details from the original input.`}]},{section:`Voice & Transcription`,items:[{q:`How does voice transcription work?`,a:`When you stop recording, the audio is sent to a speech-to-text service that converts it to text. The app supports multiple transcription providers including Whisper, Deepgram, and Google Gemini. Your administrator configures which provider is used. You will see a blue status bar at the top while transcription is in progress. You can continue working on the page while it processes.`},{q:`What is Browser Whisper?`,a:`Browser Whisper runs the Whisper AI model entirely in your browser using WebAssembly. Your audio never leaves your device, making it the most private transcription option. You can enable it in Settings > Browser Whisper. It works offline and is HIPAA-safe since no data is transmitted. The tradeoff is that it is slower than cloud-based transcription and requires downloading the model (~40–240 MB) on first use.`},{q:`Can I use the app on my phone?`,a:`Yes. The app is a Progressive Web App (PWA) that works in any modern browser. On mobile: Open the app in Chrome or Safari Tap "Add to Home Screen" to install it as a standalone app Recording works in the foreground, but audio stops if you lock the screen or switch apps on iOS and most Android devices — this is a browser limitation, not specific to this app On desktop, recording continues normally when the browser is minimized or in the background.`},{q:`What happens if transcription fails?`,a:`If transcription fails, your audio is automatically backed up to the server for 24 hours. You can retry transcription from Settings > Audio Backups. If browser speech recognition was active during recording, the live transcript is preserved as a fallback.`},{q:`Can the AI read my notes aloud?`,a:`Yes. Click the Read button on any generated note to hear it spoken aloud. This uses text-to-speech (TTS) powered by Google, OpenAI, or ElevenLabs depending on your setup. You can choose your preferred voice in Settings > Voice Preferences.`}]},{section:`Saving & Export`,items:[{q:`Are my encounters saved?`,a:`You can save encounters using the Save button at the top of each tab. Saved encounters include the transcript, generated note, and patient label. You can reload them later using the Load button. Saved encounters are automatically deleted after 7 days (configurable by your administrator). This is intentional — the app is a documentation tool, not a medical record system. Copy your final notes to your EHR for permanent storage.`},{q:`How do I export notes?`,a:`Copy — one-click copy to clipboard, ready to paste into any EHR Nextcloud — export directly to your Nextcloud instance (configure in Settings) Documents — upload files to S3-compatible storage from Settings All generated text is plain text with no markdown formatting, designed to paste cleanly into any EHR system.`}]},{section:`Privacy & Security`,items:[{q:`Is my patient data safe?`,a:`The app is designed with clinical privacy in mind: All connections use HTTPS/TLS encryption Audio and encounter data are temporary — auto-deleted within hours or days No patient data is stored long-term on the server Every action is audit-logged (who accessed what, when) Two-factor authentication (2FA) and session management are available Browser Whisper keeps audio entirely on your device For HIPAA compliance, ensure your administrator has configured a BAA-covered AI provider (such as AWS Bedrock, Google Vertex AI, or Azure OpenAI).`},{q:`What is two-factor authentication (2FA)?`,a:`2FA adds an extra layer of security to your account. After entering your password, you also enter a 6-digit code from an authenticator app (like Google Authenticator or Authy). Enable it in Settings > Two-Factor Authentication.`},{q:`How do I manage my active sessions?`,a:`Go to Settings > Active Sessions to see all devices where you are logged in. You can revoke any session individually or click Revoke All Other Sessions to log out every other device. Your current session is highlighted and cannot be revoked from this screen — use the Logout button instead.`},{q:`What happens when I change my password?`,a:`When you change your password in Settings > Change Password, all other active sessions are automatically logged out for security. Only your current session remains active. The app also checks if your new password has appeared in known data breaches and warns you (but does not prevent you from using it).`}]},{section:`Well Visit & Sick Visit`,items:[{q:`How does the Well Visit tab work?`,a:`The Well Visit tab follows the AAP Bright Futures periodicity schedule. It includes: Visit by Age — recommended screenings, vaccines, and anticipatory guidance for each visit age Milestones — developmental milestone tracker from birth through 11 years across multiple domains SSHADESS — adolescent psychosocial assessment (Strengths, School, Home, Activities, Drugs, Emotions, Sexuality, Safety) for ages 12+ Visit Note — generates a complete well visit note combining ROS, PE, milestones, and SSHADESS data`},{q:`What do the WNL / Abnormal / Not Reviewed buttons do?`,a:`In the ROS and Physical Exam sections, each system has three options: WNL / Normal — within normal limits, no concerns Abnormal — a text box appears so you can describe the finding Not Reviewed / Not Examined — explicitly not assessed Use All WNL to quickly mark everything normal, then click individual systems to change specific ones. Use Clear to reset all selections.`}]},{section:`Learning Hub`,items:[{q:`What is the Learning Hub?`,a:`The Learning Hub is an educational platform integrated into the app. It contains articles, clinical pearls, quizzes, and slide presentations created by moderators and administrators. You can browse by category, search content, and take quizzes to test your knowledge.`},{q:`How do quizzes work?`,a:`Quizzes include multiple-choice, multi-select, and true/false questions. After submitting your answers, you see your score along with explanations for each question. Your past attempts and scores are tracked so you can monitor your progress over time.`},{q:`Can I create Learning Hub content?`,a:`Moderators and administrators can create content using the CMS tab. You can write articles manually, or use AI to generate content from a topic description, uploaded PDFs, or files from Nextcloud. The CMS also supports Marp-based slide presentations with PPTX export.`}]},{section:`Pediatric Calculators`,items:[{q:`What calculators are available?`,a:`The Calculators tab includes clinical tools commonly used in pediatric practice: Blood Pressure Percentile — AAP 2017 guidelines using the Rosner quantile spline regression method. Requires age, sex, height, and BP. Provides exact systolic and diastolic percentiles adjusted for height, with AAP classification (Normal, Elevated, Stage 1, Stage 2). Includes definitions of hypertension and hypotension. BMI Percentile — CDC 2000 growth reference with extended obesity classification (Class 1, 2, 3 using % of 95th percentile). Shows BMI chart with percentile curves. Growth Charts — Visual percentile curves (3rd through 97th) with your patient plotted. Includes Weight-for-Age, Length/Height-for-Age (with mid-parental height), Head Circumference, Weight-for-Length, and Fenton preterm charts. Bilirubin — AAP 2022 phototherapy threshold calculator and Bhutani hour-specific nomogram with risk zone classification. Includes Nelson Table 137.1 risk factors. Vital Signs by Age — Harriet Lane reference table for HR, RR, BP, and weight by age from preterm through 18 years. Includes quick formulas for estimated weight, minimum SBP, ETT size, and maintenance fluids. Body Surface Area — Mosteller formula for BSA calculation. Weight-Based Dosing — Dose per kg with frequency, max dose cap, and volume calculation from concentration.`},{q:`How accurate is the BP calculator?`,a:`The BP calculator uses the same Rosner quantile spline regression method as the Baylor College of Medicine reference calculator. It computes exact percentiles (1st-99th) based on your patient's age, sex, and height using published regression coefficients. This is the same methodology underlying the AAP 2017 normative tables. Results are height-adjusted and clinically accurate.`},{q:`What are the growth chart curves?`,a:`The growth charts display WHO/CDC percentile curves (3rd, 5th, 10th, 25th, 50th, 75th, 90th, 95th, 97th percentiles) with your patient's measurement plotted as a blue dot. The 50th percentile is shown as a bold green line. Shaded bands show the normal range between symmetric percentiles. For Length/Height-for-Age, you can optionally enter both parents' heights to see the mid-parental target height range plotted on the chart.`}]}];function Eu({q:e,a:t}){let[n,r]=(0,_.useState)(!1);return(0,O.jsxs)(`div`,{className:`border-b border-border last:border-0`,children:[(0,O.jsxs)(`button`,{onClick:()=>r(!n),className:`w-full text-left py-3 px-4 flex items-center justify-between hover:bg-muted/40 transition-colors`,"aria-expanded":n,children:[(0,O.jsx)(`span`,{className:`font-medium text-sm`,children:e}),(0,O.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:n?`−`:`+`})]}),n&&(0,O.jsx)(`div`,{className:`px-4 pb-4 text-sm text-muted-foreground leading-relaxed whitespace-pre-line`,children:t})]})}function Du(){return(0,O.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-6`,children:[(0,O.jsxs)(`header`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Frequently Asked Questions`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Learn how Pediatric AI Scribe works and get the most out of it.`})]}),Tu.map(e=>(0,O.jsxs)(`section`,{className:`rounded-lg border border-border overflow-hidden`,children:[(0,O.jsx)(`h2`,{className:`bg-muted/40 px-4 py-2 text-sm font-semibold`,children:e.section}),(0,O.jsx)(`div`,{className:`bg-card`,children:e.items.map(e=>(0,O.jsx)(Eu,{q:e.q,a:e.a},e.q))})]},e.section))]})}function Ou(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(`outpatient`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),f=A({mutationFn:e=>N.post(`/api/generate-hpi-dictation`,e),onSuccess:e=>l(e.hpi),onError:()=>l(null)});function p(t){t.preventDefault(),d(null);let r={transcript:o,patientAge:e,patientGender:n,setting:i},a=vu.safeParse(r);if(!a.success){d(a.error.issues.map(e=>e.message).join(`, `));return}l(null),f.mutate(a.data)}function m(){s(``),l(null),d(null)}let h=`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:`Voice Dictation → HPI`}),(0,O.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,O.jsxs)(`form`,{onSubmit:p,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:h,placeholder:`e.g. 8 months`,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:h,value:n,onChange:e=>r(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:h,value:i,onChange:e=>a(e.target.value),children:[(0,O.jsx)(`option`,{value:`outpatient`,children:`Outpatient`}),(0,O.jsx)(`option`,{value:`inpatient`,children:`Inpatient / Floors`})]})]})]}),(0,O.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Transcript / dictation`}),(0,O.jsx)(`button`,{type:`button`,onClick:m,className:`text-xs text-muted-foreground underline`,children:`Clear`})]}),(0,O.jsx)(`textarea`,{className:h+` min-h-[200px] font-mono text-sm`,placeholder:`Type or paste your dictation here, then click Generate.`,value:o,onChange:e=>s(e.target.value)})]}),u&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:u}),f.error&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:f.error.message}),(0,O.jsx)(`div`,{className:`flex gap-2`,children:(0,O.jsx)(`button`,{type:`submit`,disabled:f.isPending||!o.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:f.isPending?`Generating…`:`Generate HPI`})})]}),c&&(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:`Generated HPI`}),(0,O.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(c),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,O.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:c})]})]})}function ku(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(`outpatient`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),f=A({mutationFn:e=>N.post(`/api/generate-hpi-encounter`,e),onSuccess:e=>l(e.hpi)});function p(t){t.preventDefault(),d(null);let r={transcript:o,patientAge:e,patientGender:n,setting:i},a=vu.safeParse(r);if(!a.success){d(a.error.issues.map(e=>e.message).join(`, `));return}l(null),f.mutate(a.data)}let m=`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:`Live Encounter → HPI`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Record or paste an encounter transcript; generate a structured HPI.`})]}),(0,O.jsxs)(`form`,{onSubmit:p,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:m,placeholder:`e.g. 5 years`,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:m,value:n,onChange:e=>r(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:m,value:i,onChange:e=>a(e.target.value),children:[(0,O.jsx)(`option`,{value:`outpatient`,children:`Outpatient`}),(0,O.jsx)(`option`,{value:`inpatient`,children:`Inpatient / Floors`})]})]})]}),(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`}),(0,O.jsx)(`textarea`,{className:m+` min-h-[220px] font-mono text-sm`,placeholder:`Type or paste an encounter transcript, then click Generate.`,value:o,onChange:e=>s(e.target.value)})]}),u&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:u}),f.error&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:f.error.message}),(0,O.jsx)(`button`,{type:`submit`,disabled:f.isPending||!o.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:f.isPending?`Generating…`:`Generate HPI`})]}),c&&(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:`Generated HPI`}),(0,O.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(c),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,O.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:c})]})]})}function Au(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(`full`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=A({mutationFn:e=>N.post(`/api/generate-soap`,e),onSuccess:e=>d(e.soap)});function h(t){t.preventDefault(),p(null);let r={transcript:o,patientAge:e,patientGender:n,type:i,additionalInstructions:c},a=yu.safeParse(r);if(!a.success){p(a.error.issues.map(e=>e.message).join(`, `));return}d(null),m.mutate(a.data)}let g=`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:`SOAP Note`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Encounter transcript → full SOAP or subjective-only narrative.`})]}),(0,O.jsxs)(`form`,{onSubmit:h,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:g,placeholder:`e.g. 3 years`,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:g,value:n,onChange:e=>r(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:`Output type`}),(0,O.jsxs)(`select`,{className:g,value:i,onChange:e=>a(e.target.value),children:[(0,O.jsx)(`option`,{value:`full`,children:`Full SOAP`}),(0,O.jsx)(`option`,{value:`subjective`,children:`Subjective only`})]})]})]}),(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`}),(0,O.jsx)(`textarea`,{className:g+` min-h-[200px] font-mono text-sm`,placeholder:`Type or paste the encounter transcript.`,value:o,onChange:e=>s(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:[`Additional instructions `,(0,O.jsx)(`span`,{className:`text-muted-foreground normal-case font-normal`,children:`(optional)`})]}),(0,O.jsx)(`textarea`,{className:g+` min-h-[60px] text-sm`,placeholder:`e.g., 'Include return precautions', 'Add differential for otitis media'`,value:c,onChange:e=>l(e.target.value)})]}),f&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:f}),m.error&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:m.error.message}),(0,O.jsx)(`button`,{type:`submit`,disabled:m.isPending||!o.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:m.isPending?`Generating…`:`Generate SOAP`})]}),u&&(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:`Generated SOAP`}),(0,O.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(u),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,O.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:u})]})]})}function ju(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),f=A({mutationFn:e=>N.post(`/api/sick-visit/note`,e),onSuccess:e=>l(e.note)});function p(t){t.preventDefault(),d(null);let r={patientAge:e,patientGender:n,chiefComplaint:i,transcript:o},a=bu.safeParse(r);if(!a.success){d(a.error.issues.map(e=>e.message).join(`, `));return}l(null),f.mutate(a.data)}let m=`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:`Sick Visit`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Chief complaint + transcript → structured sick-visit note.`})]}),(0,O.jsxs)(`form`,{onSubmit:p,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:m,placeholder:`e.g. 4 years`,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:m,value:n,onChange:e=>r(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 col-span-3 md:col-span-1`,children:[(0,O.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Chief complaint`}),(0,O.jsx)(`input`,{className:m,placeholder:`e.g. Fever x 2 days`,value:i,onChange:e=>a(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:m+` min-h-[200px] font-mono text-sm`,placeholder:`Encounter narrative — transcribed or dictated.`,value:o,onChange:e=>s(e.target.value)})]}),u&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:u}),f.error&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:f.error.message}),(0,O.jsx)(`button`,{type:`submit`,disabled:f.isPending||!i.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:f.isPending?`Generating…`:`Generate Note`})]}),c&&(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:`Sick Visit Note`}),(0,O.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(c),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,O.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:c})]})]})}function Mu(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(`floor`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(`auto`),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(null),x=A({mutationFn:e=>N.post(`/api/generate-hospital-course`,e),onSuccess:e=>b({hospitalCourse:e.hospitalCourse,format:e.format||`auto`})});function S(t){t.preventDefault(),b(null);let r=m.split(/\n\s*\n/).map(e=>e.trim()).filter(Boolean).map((e,t)=>({date:`Day ${t+1}`,type:`Progress Note`,content:e}));x.mutate({notes:r,hAndP:f?{date:`Admission`,content:f}:void 0,patientAge:e,patientGender:n,pmh:i,setting:o,los:c?parseInt(c):void 0,formatPreference:u,additionalInstructions:g||void 0})}let C=`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:S,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:C,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:C,value:n,onChange:e=>r(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:C,value:o,onChange:e=>s(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:C,placeholder:`e.g. Asthma, hypothyroidism`,value:i,onChange:e=>a(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:C,type:`number`,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:`Format`}),(0,O.jsxs)(`select`,{className:C,value:u,onChange:e=>d(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:C+` min-h-[120px] font-mono text-sm`,value:f,onChange:e=>p(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:C+` min-h-[200px] font-mono 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:`Additional instructions`}),(0,O.jsx)(`textarea`,{className:C+` min-h-[60px] text-sm`,value:g,onChange:e=>v(e.target.value)})]}),x.error&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:x.error.message}),(0,O.jsx)(`button`,{type:`submit`,disabled:x.isPending||!m.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:x.isPending?`Generating…`:`Generate Hospital Course`})]}),y&&(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:[`(`,y.format,`)`]})]}),(0,O.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(y.hospitalCourse),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,O.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:y.hospitalCourse})]})]})}function Nu(){return{date:``,content:``,labs:``}}function Pu(){let[e,t]=(0,_.useState)(`outpatient`),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)([Nu()]),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(null),m=A({mutationFn:e=>N.post(`/api/generate-chart-review`,e),onSuccess:e=>p(e.review)});function h(e,t){l(n=>n.map((n,r)=>r===e?{...n,...t}:n))}function g(t){t.preventDefault(),p(null);let r=c.filter(e=>e.content.trim());m.mutate({type:e,patientAge:n,patientGender:i,pmh:o,visits:e===`outpatient`?r:void 0,subspecialty:e===`subspecialty`?r:void 0,edVisits:e===`ed`?r:void 0,additionalInstructions:u||void 0})}let v=`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:g,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:v,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:v,value:n,onChange:e=>r(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:v,value:i,onChange:e=>a(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:v,value:o,onChange:e=>s(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:()=>l(e=>[...e,Nu()]),className:`text-xs rounded-md border border-border px-2 py-1`,children:`+ Add visit`})]}),c.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:v+` max-w-xs`,value:e.date,onChange:e=>h(t,{date:e.target.value})}),c.length>1&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>l(e=>e.filter((e,n)=>n!==t)),className:`text-xs text-destructive`,children:`Remove`})]}),(0,O.jsx)(`textarea`,{className:v+` min-h-[100px] font-mono text-sm`,placeholder:`Visit note content — paste here.`,value:e.content,onChange:e=>h(t,{content:e.target.value})}),(0,O.jsx)(`textarea`,{className:v+` min-h-[60px] font-mono text-xs`,placeholder:`Labs from this visit (optional)`,value:e.labs,onChange:e=>h(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:v+` min-h-[60px] text-sm`,placeholder:`e.g. 'Focus on thyroid management', 'Highlight medication changes'`,value:u,onChange:e=>d(e.target.value)})]}),m.error&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:m.error.message}),(0,O.jsx)(`button`,{type:`submit`,disabled:m.isPending||!c.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:m.isPending?`Generating…`:`Generate Chart Review`})]}),f&&(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(f),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,O.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:f})]})]})}function Fu(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(`full`),[x,S]=(0,_.useState)(null),C=A({mutationFn:e=>N.post(`/api/well-visit/note`,e),onSuccess:e=>S(e.note)});function w(t){t.preventDefault(),S(null),C.mutate({patientAge:e,patientGender:n,visitAge:i,vitals:o,measurements:c,parentConcerns:u,transcript:f,screenings:m,vaccines:g,noteStyle:y})}let T=`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:w,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:T,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:T,value:n,onChange:e=>r(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:T,placeholder:`e.g. 6 months`,value:i,onChange:e=>a(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:T+` min-h-[60px] font-mono text-xs`,value:o,onChange:e=>s(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:T+` min-h-[60px] font-mono text-xs`,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:`Parent / patient concerns`}),(0,O.jsx)(`textarea`,{className:T+` min-h-[60px] text-sm`,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:`Transcript / dictation`}),(0,O.jsx)(`textarea`,{className:T+` min-h-[160px] font-mono text-sm`,value:f,onChange:e=>p(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:T+` min-h-[60px] text-xs`,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:`Immunizations today`}),(0,O.jsx)(`textarea`,{className:T+` min-h-[60px] text-xs`,value:g,onChange:e=>v(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:T,value:y,onChange:e=>b(e.target.value),children:[(0,O.jsx)(`option`,{value:`full`,children:`Full encounter note`}),(0,O.jsx)(`option`,{value:`short`,children:`Brief SOAP`})]})]}),C.error&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:C.error.message}),(0,O.jsx)(`button`,{type:`submit`,disabled:C.isPending||!e.trim()&&!i.trim(),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:C.isPending?`Generating…`:`Generate Well Visit Note`})]}),x&&(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(x),className:`text-xs text-muted-foreground underline`,children:`Copy`})]}),(0,O.jsx)(`div`,{className:`p-4 whitespace-pre-wrap text-sm`,children:x})]})]})}function Iu(){let{data:e,isLoading:t,error:n}=k({queryKey:[`schedule-data`],queryFn:()=>N.get(`/api/schedule-data`)});if(t)return(0,O.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading schedule…`});if(n)return(0,O.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:n.message});if(!e)return null;let r=e.visitAges.filter(t=>e.periodicity[t.id]?.vaccines?.length),i=[],a=new Set;return r.forEach(t=>{e.periodicity[t.id].vaccines.forEach(e=>{a.has(e.vaccine)||(a.add(e.vaccine),i.push(e.vaccine))})}),(0,O.jsxs)(`div`,{className:`max-w-full mx-auto p-6 space-y-4`,children:[(0,O.jsxs)(`header`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Vaccine Schedule`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`AAP/ACIP 2025 complete immunization schedule (0–18 years).`})]}),(0,O.jsx)(`div`,{className:`rounded-lg border border-border overflow-auto bg-card`,children:(0,O.jsxs)(`table`,{className:`text-xs`,children:[(0,O.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,O.jsxs)(`tr`,{children:[(0,O.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`}),r.map(e=>(0,O.jsx)(`th`,{className:`px-2 py-2 border-b border-border text-center whitespace-nowrap`,children:e.label},e.id))]})}),(0,O.jsx)(`tbody`,{children:i.map(t=>(0,O.jsxs)(`tr`,{className:`even:bg-muted/20`,children:[(0,O.jsx)(`td`,{className:`px-3 py-2 border-b border-border font-medium sticky left-0 bg-card`,children:e.vaccineFullNames[t]||t}),r.map(n=>{let r=(e.periodicity[n.id].vaccines||[]).find(e=>e.vaccine===t);if(!r)return(0,O.jsx)(`td`,{className:`border-b border-border`},n.id);let i=typeof r.dose==`number`?`#`+r.dose:r.dose||`•`;return(0,O.jsx)(`td`,{className:`border-b border-border text-center bg-primary/10 font-mono text-[11px]`,title:r.notes||`${t} dose ${r.dose}`,children:i},n.id)})]},t))})]})}),(0,O.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).`})]})}function Lu(){let{data:e,isLoading:t,error:n}=k({queryKey:[`schedule-data`],queryFn:()=>N.get(`/api/schedule-data`)});return t?(0,O.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading…`}):n?(0,O.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:n.message}):e?(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:`Catch-Up Schedule`}),(0,O.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 r=e.vaccineFullNames[t]||t,i=n.catchUpNotes?Array.isArray(n.catchUpNotes)?n.catchUpNotes:[n.catchUpNotes]:[];return(0,O.jsxs)(`section`,{className:`rounded-lg border border-border bg-card overflow-hidden`,children:[(0,O.jsxs)(`header`,{className:`px-4 py-2 border-b border-border bg-muted/40 flex items-center justify-between`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold`,children:r}),n.minimumAgeForDose1&&(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Min age dose 1: `,(0,O.jsx)(`strong`,{children:n.minimumAgeForDose1})]})]}),n.series&&n.series.length>0&&(0,O.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,O.jsx)(`thead`,{className:`bg-muted/20`,children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Dose`}),(0,O.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Min age`}),(0,O.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Min interval from prev`}),(0,O.jsx)(`th`,{className:`text-left px-3 py-2`,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:n.series.map(e=>(0,O.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,O.jsxs)(`td`,{className:`px-3 py-2 font-semibold`,children:[`Dose `,e.dose]}),(0,O.jsx)(`td`,{className:`px-3 py-2`,children:e.minimumAge||`—`}),(0,O.jsx)(`td`,{className:`px-3 py-2`,children:e.minimumIntervalToPrev||`—`}),(0,O.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.notes||``})]},String(e.dose)))})]}),i.length>0&&(0,O.jsx)(`ul`,{className:`list-disc pl-8 py-2 text-xs text-muted-foreground space-y-1`,children:i.map((e,t)=>(0,O.jsx)(`li`,{children:e},t))})]},t)})]}):null}function Ru({open:e,title:t,body:n,confirmText:r=`Confirm`,cancelText:i=`Cancel`,danger:a=!1,requirePassword:o=!1,passwordPlaceholder:s=`Password`,onConfirm:c,onCancel:l,busy:u=!1}){let[d,f]=(0,_.useState)(``);if((0,_.useEffect)(()=>{e||f(``)},[e]),(0,_.useEffect)(()=>{function t(t){e&&t.key===`Escape`&&l()}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,l]),!e)return null;let p=u||o&&!d;return(0,O.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:l,children:(0,O.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,O.jsx)(`h3`,{id:`confirm-modal-title`,className:`text-base font-semibold`,children:t}),n&&(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),o&&(0,O.jsx)(`input`,{type:`password`,autoFocus:!0,value:d,onChange:e=>f(e.target.value),placeholder:s,className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,onKeyDown:e=>{e.key===`Enter`&&!p&&c(d)}}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:l,className:`rounded-md border border-border px-3 py-2 text-sm`,"data-testid":`confirm-modal-cancel`,children:i}),(0,O.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>c(o?d:void 0),className:`rounded-md px-3 py-2 text-sm font-medium text-white disabled:opacity-50 `+(a?`bg-destructive`:`bg-primary`),"data-testid":`confirm-modal-ok`,children:u?`Working…`:r})]})]})})}var zu=`rounded-lg border border-border bg-card p-5 space-y-3`,Bu=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,Vu=`rounded-md bg-primary text-primary-foreground px-3 py-2 text-sm font-medium disabled:opacity-50`,Hu=`rounded-md border border-border px-3 py-2 text-sm disabled:opacity-50`,Uu=`rounded-md bg-destructive text-white px-3 py-2 text-sm font-medium disabled:opacity-50`;function Wu({msg:e}){return e?(0,O.jsx)(`div`,{className:`text-sm `+(e.kind===`ok`?`text-green-600`:e.kind===`err`?`text-destructive`:`text-muted-foreground`),children:e.text}):null}function Gu(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 Ku(){let e=nt(),[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(null),l=A({mutationFn:e=>N.post(`/api/auth/change-password`,e),onSuccess:t=>{c({text:t.message||`Password changed`,kind:`ok`}),n(``),i(``),o(``),e.invalidateQueries({queryKey:[`sessions`]}),t.passwordWarning&&setTimeout(()=>c({text:t.passwordWarning,kind:`info`}),2e3)},onError:e=>c({text:e.message,kind:`err`})});function u(e){if(e.preventDefault(),c(null),!t||!r)return c({text:`Fill in all fields`,kind:`err`});if(r.length<8)return c({text:`New password must be 8+ characters`,kind:`err`});if(r!==a)return c({text:`Passwords do not match`,kind:`err`});l.mutate({currentPassword:t,newPassword:r})}return(0,O.jsxs)(`section`,{className:zu,"data-testid":`change-password-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Change Password`}),(0,O.jsxs)(`form`,{onSubmit:u,className:`space-y-2 max-w-sm`,children:[(0,O.jsx)(`input`,{type:`password`,className:Bu,placeholder:`Current password`,value:t,onChange:e=>n(e.target.value),"data-testid":`pw-current`}),(0,O.jsx)(`input`,{type:`password`,className:Bu,placeholder:`New password (8+ characters)`,minLength:8,value:r,onChange:e=>i(e.target.value),"data-testid":`pw-new`}),(0,O.jsx)(`input`,{type:`password`,className:Bu,placeholder:`Confirm new password`,minLength:8,value:a,onChange:e=>o(e.target.value),"data-testid":`pw-confirm`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`button`,{type:`submit`,disabled:l.isPending,className:Vu,"data-testid":`btn-change-password`,children:l.isPending?`Changing…`:`Change Password`}),(0,O.jsx)(Wu,{msg:s})]})]})]})}function qu({codes:e,onClose:t}){return(0,O.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,O.jsxs)(`div`,{className:`w-full max-w-md rounded-lg border border-border bg-background p-5 shadow-lg space-y-3`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Save your backup codes`}),(0,O.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,O.jsx)(`pre`,{className:`bg-muted p-3 rounded text-sm font-mono whitespace-pre-wrap break-all`,children:e.join(`
|
||
`)}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>navigator.clipboard?.writeText(e.join(`
|
||
`)),className:Hu,children:`Copy`}),(0,O.jsx)(`button`,{type:`button`,onClick:t,className:Vu,children:`I've saved them`})]})]})})}function Ju({user:e}){let t=nt(),n=e.totp_enabled===!0,[r,i]=(0,_.useState)(`idle`),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null),{data:v}=k({queryKey:[`2fa-backup-count`],queryFn:()=>N.get(`/api/auth/2fa/backup-codes/count`),enabled:n}),y=A({mutationFn:()=>N.post(`/api/auth/setup-2fa`,{}),onSuccess:e=>{o(e),i(`setup`),g(null)},onError:e=>g({text:e.message,kind:`err`})}),b=A({mutationFn:e=>N.post(`/api/auth/verify-2fa`,{code:e}),onSuccess:e=>{i(`idle`),c(``),o(null),e.backupCodes&&e.backupCodes.length&&f(e.backupCodes),t.invalidateQueries({queryKey:[`auth-me`]}),t.invalidateQueries({queryKey:[`2fa-backup-count`]}),g({text:`2FA enabled`,kind:`ok`})},onError:e=>g({text:e.message||`Invalid code`,kind:`err`})}),x=A({mutationFn:e=>N.post(`/api/auth/disable-2fa`,{password:e}),onSuccess:()=>{i(`idle`),u(``),t.invalidateQueries({queryKey:[`auth-me`]}),t.invalidateQueries({queryKey:[`2fa-backup-count`]}),g({text:`2FA disabled`,kind:`info`})},onError:e=>g({text:e.message||`Failed`,kind:`err`})}),S=A({mutationFn:e=>N.post(`/api/auth/2fa/backup-codes`,{password:e}),onSuccess:e=>{m(!1),e.codes&&e.codes.length&&f(e.codes),t.invalidateQueries({queryKey:[`2fa-backup-count`]})},onError:e=>{m(!1),g({text:e.message||`Failed to regenerate codes`,kind:`err`})}});return(0,O.jsxs)(`section`,{className:zu,"data-testid":`2fa-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Two-Factor Authentication`}),(0,O.jsxs)(`p`,{className:`text-sm`,"data-testid":`2fa-status`,children:[`Status:`,` `,(0,O.jsx)(`span`,{className:n?`text-green-600 font-medium`:`text-destructive font-medium`,children:n?`✅ Enabled`:`❌ Not enabled`})]}),!n&&r===`idle`&&(0,O.jsx)(`button`,{type:`button`,className:Vu,onClick:()=>y.mutate(),disabled:y.isPending,"data-testid":`btn-setup-2fa`,children:y.isPending?`Setting up…`:`Enable 2FA`}),n&&r===`idle`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive`,onClick:()=>i(`disabling`),"data-testid":`btn-disable-2fa`,children:`Disable 2FA`}),v&&(0,O.jsxs)(`span`,{className:`text-sm `+(v.remaining<=2?`text-orange-500`:`text-muted-foreground`),children:[v.remaining,` backup codes remaining.`]}),v&&(0,O.jsx)(`button`,{type:`button`,className:Hu,onClick:()=>m(!0),"data-testid":`btn-regen-backup-codes`,children:`Regenerate`})]}),r===`setup`&&a&&(0,O.jsxs)(`div`,{className:`space-y-3 p-3 bg-muted/40 rounded-md`,children:[(0,O.jsx)(`p`,{className:`text-sm`,children:`Scan this QR code with your authenticator app:`}),(0,O.jsx)(`img`,{src:a.qrCode,alt:`2FA QR code`,className:`bg-white p-2 rounded max-w-[240px]`}),(0,O.jsxs)(`p`,{className:`text-sm`,children:[`Or enter manually: `,(0,O.jsx)(`code`,{className:`bg-muted px-2 py-0.5 rounded text-xs`,children:a.secret})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,O.jsx)(`input`,{type:`text`,maxLength:6,className:Bu+` max-w-[140px] font-mono tracking-widest`,placeholder:`123456`,value:s,onChange:e=>c(e.target.value.replace(/\D/g,``)),"data-testid":`2fa-verify-code`}),(0,O.jsx)(`button`,{type:`button`,className:Vu,disabled:s.length!==6||b.isPending,onClick:()=>b.mutate(s),"data-testid":`btn-verify-2fa`,children:b.isPending?`Verifying…`:`Verify & Enable`}),(0,O.jsx)(`button`,{type:`button`,className:Hu,onClick:()=>{i(`idle`),o(null),c(``)},children:`Cancel`})]})]}),r===`disabling`&&(0,O.jsxs)(`div`,{className:`space-y-2 p-3 bg-muted/40 rounded-md max-w-sm`,children:[(0,O.jsx)(`label`,{className:`block text-sm font-medium`,children:`Enter your password to confirm:`}),(0,O.jsx)(`input`,{type:`password`,className:Bu,value:l,onChange:e=>u(e.target.value),placeholder:`Password`,"data-testid":`2fa-disable-password`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,className:Uu,disabled:!l||x.isPending,onClick:()=>x.mutate(l),"data-testid":`btn-disable-2fa-confirm`,children:x.isPending?`Disabling…`:`Confirm Disable`}),(0,O.jsx)(`button`,{type:`button`,className:Hu,onClick:()=>{i(`idle`),u(``)},"data-testid":`btn-disable-2fa-cancel`,children:`Cancel`})]})]}),(0,O.jsx)(Wu,{msg:h}),(0,O.jsx)(Ru,{open:p,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:S.isPending,onConfirm:e=>e&&S.mutate(e),onCancel:()=>m(!1)}),d&&(0,O.jsx)(qu,{codes:d,onClose:()=>f(null)})]})}function Yu({s:e,isCurrent:t,onRevoke:n}){return(0,O.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,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`text-sm font-medium truncate`,children:[e.device_label||`Unknown device`,t&&(0,O.jsx)(`span`,{className:`ml-2 text-xs text-primary font-medium`,children:`(this device)`})]}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.ip_address||`—`,` · Created `,new Date(e.created_at).toLocaleDateString(),` · Active `,Gu(e.last_activity)]})]}),!t&&(0,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive text-xs`,onClick:n,"data-testid":`btn-revoke-session-`+e.id,children:`Revoke`})]})}function Xu(){let e=nt(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),{data:a,isLoading:o,error:s}=k({queryKey:[`sessions`],queryFn:()=>N.get(`/api/sessions`)}),c=A({mutationFn:e=>N.delete(`/api/sessions/`+e),onSuccess:()=>{i({text:`Session revoked`,kind:`info`}),e.invalidateQueries({queryKey:[`sessions`]})},onError:e=>i({text:e.message,kind:`err`})}),l=A({mutationFn:()=>N.delete(`/api/sessions`),onSuccess:t=>{i({text:`All other sessions revoked (`+(t.revoked||0)+` removed)`,kind:`info`}),e.invalidateQueries({queryKey:[`sessions`]})},onError:e=>i({text:e.message,kind:`err`})}),u=c.isPending||l.isPending;return(0,O.jsxs)(`section`,{className:zu,"data-testid":`sessions-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Active Sessions`}),(0,O.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,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive text-xs`,onClick:()=>n({kind:`all`}),"data-testid":`btn-revoke-all-sessions`,children:`Revoke All Other Sessions`}),o&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading sessions…`}),s&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:`Could not load sessions.`}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[a?.sessions.map(e=>(0,O.jsx)(Yu,{s:e,isCurrent:e.id===a.currentSessionId,onRevoke:()=>n({kind:`one`,id:e.id})},e.id)),a&&a.sessions.length===0&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No active sessions found.`})]}),(0,O.jsx)(Wu,{msg:r}),(0,O.jsx)(Ru,{open:t?.kind===`one`,title:`Revoke this session?`,body:`That device will be logged out.`,confirmText:`Revoke`,danger:!0,busy:u,onConfirm:()=>{t?.kind===`one`&&c.mutate(t.id),n(null)},onCancel:()=>n(null)}),(0,O.jsx)(Ru,{open:t?.kind===`all`,title:`Revoke all other sessions?`,body:`All other devices will be logged out.`,confirmText:`Revoke All`,danger:!0,busy:u,onConfirm:()=>{l.mutate(),n(null)},onCancel:()=>n(null)})]})}function G({user:e}){let t=nt(),n=!!e.nextcloud_url,[r,i]=(0,_.useState)(e.nextcloud_url||``),[a,o]=(0,_.useState)(e.nextcloud_user||``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(e.webdav_learning_path||``),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null),h=A({mutationFn:e=>N.post(`/api/nextcloud/connect`,e),onSuccess:e=>{m({text:e.message||`Connected`,kind:`ok`}),c(``),t.invalidateQueries({queryKey:[`auth-me`]})},onError:e=>m({text:e.message||`Connection failed`,kind:`err`})}),g=A({mutationFn:()=>N.post(`/api/nextcloud/disconnect`,{}),onSuccess:()=>{m({text:`Disconnected`,kind:`info`}),c(``),t.invalidateQueries({queryKey:[`auth-me`]})},onError:e=>m({text:e.message,kind:`err`})}),v=A({mutationFn:e=>N.post(`/api/user/webdav-path`,{path:e}),onSuccess:()=>{m({text:`Path saved`,kind:`ok`}),t.invalidateQueries({queryKey:[`auth-me`]})},onError:e=>m({text:e.message||`Failed to save`,kind:`err`})});function y(e){e.preventDefault(),m(null);let t=r.trim().replace(/\/+$/,``),n=a.trim(),i=s.trim();if(!t||!n||!i)return m({text:`Fill all Nextcloud fields`,kind:`err`});h.mutate({nextcloudUrl:t,username:n,appPassword:i})}return(0,O.jsxs)(`section`,{className:zu,"data-testid":`nextcloud-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Nextcloud Integration`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Export generated documents to your Nextcloud.`}),(0,O.jsx)(`div`,{className:`text-sm`,"data-testid":`nc-status`,children:n?(0,O.jsxs)(O.Fragment,{children:[`✅ Connected to `,(0,O.jsx)(`strong`,{children:e.nextcloud_url}),` as `,e.nextcloud_user]}):(0,O.jsx)(O.Fragment,{children:`Not connected`})}),(0,O.jsxs)(`form`,{onSubmit:y,className:`space-y-2 max-w-md`,children:[(0,O.jsxs)(`label`,{className:`block text-sm`,children:[(0,O.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Nextcloud URL`}),(0,O.jsx)(`input`,{type:`url`,className:Bu,value:r,onChange:e=>i(e.target.value),placeholder:`https://cloud.example.com`,"data-testid":`nc-url`})]}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[(0,O.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Username`}),(0,O.jsx)(`input`,{type:`text`,className:Bu,value:a,onChange:e=>o(e.target.value),placeholder:`your-username`,"data-testid":`nc-user`})]}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[(0,O.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`App Password`}),(0,O.jsx)(`input`,{type:`password`,className:Bu,value:s,onChange:e=>c(e.target.value),placeholder:`Generate in Nextcloud → Settings → Security`,"data-testid":`nc-pass`}),(0,O.jsx)(`span`,{className:`block text-xs text-muted-foreground mt-1`,children:`Go to Nextcloud → Settings → Security → Create new app password`})]}),(0,O.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,O.jsx)(`button`,{type:`submit`,className:Vu,disabled:h.isPending,"data-testid":`btn-nc-connect`,children:h.isPending?`Connecting…`:n?`Reconnect`:`Connect`}),n&&(0,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive`,onClick:()=>f(!0),"data-testid":`btn-nc-disconnect`,children:`Disconnect`})]})]}),n&&(0,O.jsx)(`div`,{className:`border-t border-border pt-3 space-y-2 max-w-md`,children:(0,O.jsxs)(`label`,{className:`block text-sm`,children:[(0,O.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Learning Hub — Default Browse Path`}),(0,O.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,O.jsx)(`code`,{children:`/Medical-Resources`}),`)`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{type:`text`,className:Bu,value:l,onChange:e=>u(e.target.value),placeholder:`/Medical-Resources`,"data-testid":`nc-webdav-path`}),(0,O.jsx)(`button`,{type:`button`,className:Vu,disabled:v.isPending,onClick:()=>v.mutate(l.trim()),"data-testid":`btn-nc-save-path`,children:v.isPending?`Saving…`:`Save Path`})]})]})}),(0,O.jsx)(Wu,{msg:p}),(0,O.jsx)(Ru,{open:d,title:`Disconnect Nextcloud?`,body:`Future exports will fail until you reconnect. Your stored credentials will be cleared.`,confirmText:`Disconnect`,danger:!0,busy:g.isPending,onConfirm:()=>{g.mutate(),f(!1)},onCancel:()=>f(!1)})]})}function Zu(e){return e<1024?e+` B`:e<1048576?Math.round(e/1024)+` KB`:(e/1048576).toFixed(1)+` MB`}function Qu({doc:e,onDownload:t,onDelete:n,downloading:r}){return(0,O.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,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.filename}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[Zu(e.size_bytes),` · `,new Date(e.created_at).toLocaleDateString(),e.description?` · `+e.description:``]})]}),(0,O.jsx)(`button`,{type:`button`,className:Vu+` text-xs`,disabled:r,onClick:t,"data-testid":`btn-doc-download-`+e.id,children:r?`…`:`Download`}),(0,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive text-xs`,onClick:n,"data-testid":`btn-doc-delete-`+e.id,children:`Delete`})]})}function $u(){let e=nt(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),{data:l,isLoading:u,error:d}=k({queryKey:[`documents`],queryFn:()=>N.get(`/api/documents`)}),f=A({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=>{o({text:`Document uploaded: `+t.filename,kind:`ok`}),n(null),i(``),e.invalidateQueries({queryKey:[`documents`]})},onError:e=>o({text:`Upload failed: `+e.message,kind:`err`})}),p=A({mutationFn:e=>N.delete(`/api/documents/`+e),onSuccess:()=>{o({text:`Document deleted`,kind:`info`}),e.invalidateQueries({queryKey:[`documents`]})},onError:e=>o({text:e.message||`Delete failed`,kind:`err`})}),m=A({mutationFn:e=>N.get(`/api/documents/`+e+`/download`),onSuccess:e=>{e.url?window.open(e.url,`_blank`,`noopener,noreferrer`):o({text:`Download failed`,kind:`err`})},onError:e=>o({text:e.message||`Download failed`,kind:`err`})});function h(e){if(e.preventDefault(),o(null),!t)return o({text:`Select a file first`,kind:`err`});f.mutate({file:t,description:r})}return(0,O.jsxs)(`section`,{className:zu,"data-testid":`documents-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Documents`}),(0,O.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.`}),u&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),d&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:`Failed to load documents.`}),l&&!l.s3_configured&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground italic`,children:`S3 storage not configured. Set S3_BUCKET in server environment.`}),l&&l.s3_configured&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`form`,{onSubmit:h,className:`flex flex-wrap gap-2 items-center`,"data-testid":`doc-upload-area`,children:[(0,O.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,O.jsx)(`input`,{type:`text`,className:Bu+` max-w-xs`,placeholder:`Description (optional)`,value:r,onChange:e=>i(e.target.value),"data-testid":`doc-description`}),(0,O.jsx)(`button`,{type:`submit`,className:Vu,disabled:!t||f.isPending,"data-testid":`btn-doc-upload`,children:f.isPending?`Uploading…`:`Upload`})]}),(0,O.jsx)(`div`,{className:`space-y-2`,children:l.documents.length===0?(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No documents uploaded yet.`}):l.documents.map(e=>(0,O.jsx)(Qu,{doc:e,onDownload:()=>m.mutate(e.id),onDelete:()=>c(e),downloading:m.isPending&&m.variables===e.id},e.id))})]}),(0,O.jsx)(Wu,{msg:a}),(0,O.jsx)(Ru,{open:!!s,title:`Delete this document permanently?`,body:s?.filename,confirmText:`Delete`,danger:!0,busy:p.isPending,onConfirm:()=>{s&&p.mutate(s.id),c(null)},onCancel:()=>c(null)})]})}function ed(){let e=nt(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),{data:d}=k({queryKey:[`voice-options`],queryFn:()=>N.get(`/api/user/preferences/options`)}),{data:f}=k({queryKey:[`voice-prefs`],queryFn:()=>N.get(`/api/user/preferences`)});!l&&f&&(i(f.stt_model||``),o(f.tts_voice||``),u(!0));let p=A({mutationFn:e=>N.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 m(){n(null),c(!0);try{await N.post(`/api/user/preferences`,{tts_voice:a||null}),e.invalidateQueries({queryKey:[`voice-prefs`]});let t=`Hello, this is a preview of the `+(a||`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(),i=URL.createObjectURL(r),o=new Audio(i);o.onended=()=>URL.revokeObjectURL(i),await o.play()}catch(e){n({text:`Preview failed: `+e.message,kind:`err`})}finally{c(!1)}}return(0,O.jsxs)(`section`,{className:zu,"data-testid":`voice-preferences-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Voice Preferences`}),(0,O.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,O.jsxs)(`div`,{className:`space-y-2 max-w-md`,children:[(0,O.jsxs)(`label`,{className:`block text-sm`,children:[(0,O.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Speech-to-Text Model (Transcription)`}),(0,O.jsxs)(`select`,{className:Bu,value:r,onChange:e=>i(e.target.value),"data-testid":`stt-model-select`,children:[(0,O.jsxs)(`option`,{value:``,children:[`Server default`,d?` (`+d.sttProvider+`)`:``]}),d?.sttModels.map(e=>(0,O.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[(0,O.jsx)(`span`,{className:`block text-xs font-semibold text-muted-foreground mb-1`,children:`Text-to-Speech Voice (Read Aloud)`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsxs)(`select`,{className:Bu,value:a,onChange:e=>o(e.target.value),"data-testid":`tts-voice-select`,children:[(0,O.jsxs)(`option`,{value:``,children:[`Server default`,d?` (`+d.ttsProvider+`)`:``]}),d?.ttsVoices.map(e=>(0,O.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,O.jsx)(`button`,{type:`button`,className:Hu,disabled:s,onClick:m,"data-testid":`btn-preview-voice`,children:s?`Loading…`:`Preview`})]})]}),(0,O.jsx)(`button`,{type:`button`,className:Vu,disabled:p.isPending,onClick:()=>p.mutate({stt_model:r||null,tts_voice:a||null}),"data-testid":`btn-save-voice-prefs`,children:p.isPending?`Saving…`:`Save Voice Preferences`})]}),(0,O.jsx)(Wu,{msg:t})]})}var td=`ped_browser_whisper_enabled`,nd=`ped_browser_whisper_model`,rd=[{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 id(e,t=``){try{return window.localStorage.getItem(e)??t}catch{return t}}function ad(e,t){try{window.localStorage.setItem(e,t)}catch{}}function od(){let[e,t]=(0,_.useState)(id(td)===`true`),[n,r]=(0,_.useState)(id(nd)||rd[0].value);function i(e){t(e),ad(td,String(e))}function a(e){r(e),ad(nd,e)}return(0,O.jsxs)(`section`,{className:zu,"data-testid":`browser-whisper-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Browser Transcription (Local Whisper)`}),(0,O.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,O.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,O.jsx)(`label`,{className:`text-sm font-medium`,children:`Enable browser transcription:`}),(0,O.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,O.jsx)(`input`,{type:`checkbox`,className:`accent-primary size-4`,checked:e,onChange:e=>i(e.target.checked),"data-testid":`browser-whisper-enabled`}),(0,O.jsx)(`span`,{className:`text-sm`,"data-testid":`browser-whisper-status`,children:e?`On — audio stays on device`:`Off`})]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,O.jsx)(`label`,{className:`text-sm font-medium`,children:`Model:`}),(0,O.jsx)(`select`,{className:Bu+` max-w-md`,value:n,onChange:e=>a(e.target.value),"data-testid":`browser-whisper-model`,children:rd.map(e=>(0,O.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,O.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 sd=`ped_web_speech_enabled`;function cd(){let[e,t]=(0,_.useState)(id(sd)===`true`),[n,r]=(0,_.useState)(!1),i=typeof window<`u`&&(`webkitSpeechRecognition`in window||`SpeechRecognition`in window);function a(){ad(td,`false`),t(!0),ad(sd,`true`)}function o(){t(!1),ad(sd,`false`)}return(0,O.jsxs)(`section`,{className:zu+` border-l-4 border-l-orange-500`,"data-testid":`web-speech-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Real-Time Streaming Transcription`}),(0,O.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,O.jsx)(`strong`,{children:`Privacy Warning:`}),` Uses your browser's built-in speech recognition, which `,(0,O.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,O.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`See words appear as you speak (streaming). Overrides browser and server transcription when enabled. `,(0,O.jsx)(`strong`,{children:`Not HIPAA-compliant`}),` in most browsers.`]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,O.jsx)(`label`,{className:`text-sm font-medium`,children:`Enable real-time streaming:`}),(0,O.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,O.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,O.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,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Streaming integration lights up when the recording components port to React.`}),(0,O.jsx)(Ru,{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 ld=[{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`}],ud=Object.fromEntries(ld.map(e=>[e.value,e.label.replace(/ Template$| Format$/,``)]));function dd(){let e=nt(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(ld[0].value),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(null),{data:p}=k({queryKey:[`memories`],queryFn:()=>N.get(`/api/memories`)}),m=(p?.memories||[]).filter(e=>!e.category.startsWith(`correction_`)),h=A({mutationFn:e=>{let{id:t,...n}=e;return t?N.put(`/api/memories/`+t,n):N.post(`/api/memories`,n)},onSuccess:()=>{n({text:r?`Template updated`:`Template saved`,kind:`ok`}),i(null),c(``),u(``),e.invalidateQueries({queryKey:[`memories`]})},onError:e=>n({text:e.message||`Save failed`,kind:`err`})}),g=A({mutationFn:e=>N.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 v(e){i(e.id),o(e.category),c(e.name),u(e.content)}function y(){i(null),c(``),u(``)}function b(e){if(e.preventDefault(),n(null),!s.trim())return n({text:`Enter a template name`,kind:`err`});if(!l.trim())return n({text:`Enter template content`,kind:`err`});h.mutate({id:r??void 0,category:a,name:s.trim(),content:l.trim()})}return(0,O.jsxs)(`section`,{className:zu,"data-testid":`templates-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`My Templates`}),(0,O.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,O.jsxs)(`form`,{onSubmit:b,className:`space-y-2`,children:[(0,O.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,O.jsx)(`select`,{className:Bu+` max-w-xs`,value:a,onChange:e=>o(e.target.value),"data-testid":`mem-category`,children:ld.map(e=>(0,O.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,O.jsx)(`input`,{type:`text`,className:Bu+` flex-1 min-w-[150px]`,placeholder:`Template name (e.g. Normal PE)`,value:s,onChange:e=>c(e.target.value),"data-testid":`mem-name`})]}),(0,O.jsx)(`textarea`,{rows:5,className:Bu+` resize-y`,placeholder:`Paste your template here. Example: HEENT: Normocephalic, atraumatic. Eyes: PERRL…`,value:l,onChange:e=>u(e.target.value),"data-testid":`mem-content`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`submit`,className:Vu,disabled:h.isPending,"data-testid":`btn-mem-save`,children:h.isPending?`Saving…`:r?`Update Template`:`Add Template`}),r!==null&&(0,O.jsx)(`button`,{type:`button`,className:Hu,onClick:y,children:`Cancel`})]})]}),(0,O.jsx)(`div`,{className:`space-y-2`,children:m.length===0?(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No templates saved yet. Add one above.`}):m.map(e=>(0,O.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,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:ud[e.category]||e.category})]}),(0,O.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,O.jsx)(`button`,{type:`button`,className:Hu+` text-xs`,onClick:()=>v(e),"data-testid":`btn-mem-edit-`+e.id,children:`Edit`}),(0,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive text-xs`,onClick:()=>f(e),"data-testid":`btn-mem-delete-`+e.id,children:`Delete`})]},e.id))}),(0,O.jsx)(Wu,{msg:t}),(0,O.jsx)(Ru,{open:!!d,title:`Delete template "`+(d?.name||``)+`"?`,body:`This cannot be undone.`,confirmText:`Delete`,danger:!0,busy:g.isPending,onConfirm:()=>{d&&g.mutate(d.id),f(null)},onCancel:()=>f(null)})]})}var fd={correction_soap:`SOAP Correction`,correction_hpi:`HPI Correction`,correction_encounter:`Encounter Correction`,correction_wellvisit:`Well Visit Correction`,correction_sickvisit:`Sick Visit Correction`};function pd(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 md(){let e=nt(),[t,n]=(0,_.useState)({}),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),{data:s}=k({queryKey:[`memories`],queryFn:()=>N.get(`/api/memories`)}),c=(s?.memories||[]).filter(e=>e.category.startsWith(`correction_`)),l=A({mutationFn:e=>N.delete(`/api/memories/`+e),onSuccess:()=>{i({text:`Correction deleted`,kind:`info`}),e.invalidateQueries({queryKey:[`memories`]})},onError:e=>i({text:e.message||`Delete failed`,kind:`err`})});return(0,O.jsxs)(`section`,{className:zu,"data-testid":`corrections-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`AI Learning (Corrections)`}),(0,O.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,O.jsx)(`div`,{className:`space-y-2`,children:c.length===0?(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No corrections yet. Edit AI-generated notes and save to start learning.`}):c.map(e=>{let r=t[e.id],i=pd(e.content||``),a=e.created_at?new Date(e.created_at).toLocaleDateString():``;return(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 border border-border overflow-hidden`,"data-testid":`corr-row-`+e.id,children:[(0,O.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,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r?`▾`:`▸`}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:fd[e.category]||e.category}),(0,O.jsx)(`span`,{className:`flex-1 text-sm truncate`,children:e.name}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a}),(0,O.jsx)(`span`,{role:`button`,className:`text-destructive text-xs px-2`,onClick:t=>{t.stopPropagation(),o(e)},"data-testid":`btn-corr-delete-`+e.id,children:`Delete`})]}),r&&(0,O.jsxs)(`div`,{className:`px-3 py-2 text-sm space-y-2 border-t border-border`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs font-semibold uppercase text-destructive mb-1`,children:`Original (AI generated):`}),(0,O.jsx)(`div`,{className:`whitespace-pre-wrap text-muted-foreground`,children:i.original})]}),i.corrected&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs font-semibold uppercase text-green-600 mb-1`,children:`Corrected to:`}),(0,O.jsx)(`div`,{className:`whitespace-pre-wrap`,children:i.corrected})]})]})]},e.id)})}),(0,O.jsx)(Wu,{msg:r}),(0,O.jsx)(Ru,{open:!!a,title:`Delete this correction?`,body:`The AI will no longer apply this edit in future notes.`,confirmText:`Delete`,danger:!0,busy:l.isPending,onConfirm:()=>{a&&l.mutate(a.id),o(null)},onCancel:()=>o(null)})]})}function hd(){let e=nt(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),{data:a,isLoading:o}=k({queryKey:[`audio-backups`],queryFn:()=>N.get(`/api/audio-backups`)}),s=A({mutationFn:e=>N.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 c(e){window.open(`/api/audio-backups/`+e+`/audio`,`_blank`,`noopener,noreferrer`)}return(0,O.jsxs)(`section`,{className:zu,"data-testid":`audio-backups-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Audio Backups`}),(0,O.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.`}),o&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[a&&a.backups.length===0&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No audio backups.`}),a?.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,O.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,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.module,` recording`]}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[new Date(e.created_at).toLocaleString(),` · `,t,` KB`,n,` · `,Gu(e.created_at)]})]}),(0,O.jsx)(`button`,{type:`button`,className:Vu+` text-xs`,onClick:()=>c(e.id),children:`Play`}),(0,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive text-xs`,onClick:()=>i(e),"data-testid":`btn-audio-delete-`+e.id,children:`Delete`})]},e.id)})]}),(0,O.jsx)(Wu,{msg:t}),(0,O.jsx)(Ru,{open:!!r,title:`Delete this audio backup?`,body:`This cannot be undone.`,confirmText:`Delete`,danger:!0,busy:s.isPending,onConfirm:()=>{r&&s.mutate(r.id),i(null)},onCancel:()=>i(null)})]})}function gd(){let e=nt(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),{data:a,isLoading:o}=k({queryKey:[`saved-encounters`],queryFn:()=>N.get(`/api/encounters/saved`)}),s=A({mutationFn:e=>N.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,O.jsxs)(`section`,{className:zu,"data-testid":`saved-encounters-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Saved Encounters`}),(0,O.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.`}),o&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[a&&a.encounters.length===0&&(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No saved encounters.`}),a?.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,O.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,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-medium truncate`,children:e.label||`Untitled`}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:e.enc_type})]}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[t,` · expires `,n,r?` · `+r+`…`:``]})]}),(0,O.jsx)(`button`,{type:`button`,className:Hu+` text-destructive text-xs`,onClick:()=>i(e),"data-testid":`btn-enc-delete-`+e.id,children:`Delete`})]},e.id)})]}),(0,O.jsx)(Wu,{msg:t}),(0,O.jsx)(Ru,{open:!!r,title:`Delete this saved encounter?`,body:r?.label||void 0,confirmText:`Delete`,danger:!0,busy:s.isPending,onConfirm:()=>{r&&s.mutate(r.id),i(null)},onCancel:()=>i(null)})]})}function _d(){return(0,O.jsxs)(`section`,{className:zu,"data-testid":`compliance-section`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Compliance & Usage`}),(0,O.jsxs)(`div`,{className:`text-sm space-y-2`,children:[(0,O.jsxs)(`p`,{children:[(0,O.jsx)(`strong`,{children:`AWS Bedrock`}),` is available with a Business Associate Agreement (BAA) for HIPAA-eligible workloads.`]}),(0,O.jsxs)(`ul`,{className:`list-disc pl-5 space-y-1 text-muted-foreground`,children:[(0,O.jsx)(`li`,{children:`All connections use HTTPS/TLS encryption`}),(0,O.jsx)(`li`,{children:`Authentication with optional 2FA`}),(0,O.jsx)(`li`,{children:`No patient data stored on server beyond session`}),(0,O.jsx)(`li`,{children:`AWS Bedrock supports BAA for HIPAA compliance`}),(0,O.jsx)(`li`,{children:`Azure OpenAI supports BAA for HIPAA compliance`})]}),(0,O.jsxs)(`p`,{children:[(0,O.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 vd(){let{data:e,isLoading:t,error:n}=k({queryKey:[`auth-me`],queryFn:()=>N.get(`/api/auth/me`)}),r=e?.user.canLocalAuth!==!1;return(0,O.jsxs)(`div`,{className:`max-w-3xl mx-auto p-6 space-y-4`,children:[(0,O.jsxs)(`header`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Settings`}),(0,O.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,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`}),n&&(0,O.jsxs)(`div`,{className:`text-sm text-destructive`,children:[`Could not load your account: `,n.message]}),e&&r&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Ku,{}),(0,O.jsx)(Ju,{user:e.user}),(0,O.jsx)(Xu,{})]}),e&&!r&&(0,O.jsxs)(`section`,{className:zu,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Account managed by single sign-on`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your password and two-factor authentication are managed by your identity provider.`})]}),e&&(0,O.jsx)(G,{user:e.user}),e&&(0,O.jsx)($u,{}),e&&(0,O.jsx)(ed,{}),e&&(0,O.jsx)(od,{}),e&&(0,O.jsx)(cd,{}),e&&(0,O.jsx)(dd,{}),e&&(0,O.jsx)(md,{}),e&&(0,O.jsx)(hd,{}),e&&(0,O.jsx)(gd,{}),(0,O.jsx)(_d,{})]})}var yd=`rounded-lg border border-border bg-card p-5 space-y-3`,bd=`px-3 py-1 rounded-full text-xs font-medium border transition-colors cursor-pointer`,xd=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,Sd=`rounded-md bg-primary text-primary-foreground px-3 py-2 text-sm font-medium disabled:opacity-50`,Cd=`rounded-md border border-border px-3 py-2 text-sm disabled:opacity-50`;function wd(e){switch(e){case`quiz`:return`Quiz`;case`pearl`:return`Pearl`;case`presentation`:return`Slides`;default:return`Article`}}function Td({row:e,onOpen:t}){return(0,O.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,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground uppercase tracking-wide mb-1`,children:[(0,O.jsx)(`span`,{className:`font-semibold`,children:wd(e.content_type)}),e.category_name&&(0,O.jsxs)(`span`,{children:[`· `,e.category_name]}),e.question_count?(0,O.jsxs)(`span`,{children:[`· `,e.question_count,` Q`]}):null]}),(0,O.jsx)(`div`,{className:`text-sm font-semibold`,children:e.title}),e.subject&&(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5 truncate`,children:e.subject})]})}function K({filter:e,query:t,onOpen:n}){let{data:r,isLoading:i,error:a}=k({queryKey:t?[`learning-search`,t]:e?[`learning-category`,e]:[`learning-feed`],queryFn:()=>t?N.get(`/api/learning/search?q=`+encodeURIComponent(t)):e?N.get(`/api/learning/category/`+encodeURIComponent(e)):N.get(`/api/learning/feed?limit=30`)});if(i)return(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`});if(a)return(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:a.message});let o=r?.content||[];return o.length===0?(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground italic py-4`,children:`No content found.`}):(0,O.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,"data-testid":`lh-feed`,children:o.map(e=>(0,O.jsx)(Td,{row:e,onOpen:()=>n(e.slug)},e.id))})}function Ed(e){let t={};for(let n of e)t[n.id]={optionIds:new Set};return t}function Dd({content:e,onReset:t}){let n=nt(),[r,i]=(0,_.useState)(()=>Ed(e.questions)),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),l=A({mutationFn:e=>N.post(`/api/learning/submit-quiz`,e),onSuccess:t=>{o(t),n.invalidateQueries({queryKey:[`learning-content`,e.slug]})},onError:e=>c(e.message||`Submit failed`)});function u(t){t.preventDefault(),c(null);let n=e.questions.map(e=>{let t=r[e.id];return e.question_type===`multi`?{questionId:e.id,optionIds:Array.from(t?.optionIds||[])}:{questionId:e.id,optionId:t?.optionId??null}});l.mutate({contentId:e.id,answers:n})}function d(e,t){i(n=>({...n,[e.id]:{optionId:t,optionIds:new Set}}))}function f(e,t){i(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(a){let n=a.percentage>=80?`bg-green-600`:a.percentage>=50?`bg-amber-500`:`bg-destructive`;return(0,O.jsxs)(`section`,{className:yd,"data-testid":`lh-quiz-results`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Results`}),(0,O.jsxs)(`span`,{className:`px-2 py-0.5 rounded text-xs font-semibold text-white `+n,"data-testid":`lh-quiz-score`,children:[a.score,`/`,a.total,` (`,a.percentage,`%)`]})]}),(0,O.jsx)(`div`,{className:`space-y-3`,children:a.results.map((e,t)=>(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3 bg-muted/30`,children:[(0,O.jsxs)(`div`,{className:`text-sm font-medium`,children:[(0,O.jsx)(`span`,{className:e.isCorrect?`text-green-600`:`text-destructive`,children:e.isCorrect?`✓`:`✗`}),` `,`Q`,t+1,`: `,e.questionText]}),!e.isCorrect&&e.correctOptionText&&(0,O.jsxs)(`div`,{className:`text-xs text-green-700 mt-1`,children:[(0,O.jsx)(`strong`,{children:`Correct:`}),` `,e.correctOptionText]}),!e.isCorrect&&e.selectedExplanation&&(0,O.jsxs)(`div`,{className:`text-xs text-destructive mt-1`,children:[(0,O.jsx)(`strong`,{children:`Why incorrect:`}),` `,e.selectedExplanation]}),e.generalExplanation&&(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.generalExplanation})]},e.questionId))}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,className:Cd,onClick:()=>{o(null),i(Ed(e.questions))},children:`Retake`}),(0,O.jsx)(`button`,{type:`button`,className:Sd,onClick:t,children:`Back to Feed`})]})]})}return(0,O.jsxs)(`section`,{className:yd,"data-testid":`lh-quiz`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Quiz`}),(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.questions.length,` question`,e.questions.length===1?``:`s`]})]}),(0,O.jsxs)(`form`,{onSubmit:u,className:`space-y-4`,children:[e.questions.map((e,t)=>{let n=e.question_type===`multi`,i=e.question_type===`true_false`?`True / False`:n?`Multiple Select`:`Single Choice`;return(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-2 bg-muted/30`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,O.jsxs)(`span`,{className:`font-semibold`,children:[`Q`,t+1]}),(0,O.jsx)(`span`,{children:i})]}),(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.question_text}),n&&(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Select all that apply`}),(0,O.jsx)(`div`,{className:`space-y-1`,children:e.options.map(t=>{let i=r[e.id],a=n?i?.optionIds.has(t.id)===!0:i?.optionId===t.id;return(0,O.jsxs)(`label`,{className:`flex items-start gap-2 text-sm cursor-pointer hover:bg-muted/50 rounded px-2 py-1`,children:[(0,O.jsx)(`input`,{type:n?`checkbox`:`radio`,name:`q-`+e.id,checked:a,onChange:()=>n?f(e,t.id):d(e,t.id),className:`mt-0.5`}),(0,O.jsx)(`span`,{children:t.option_text})]},t.id)})})]},e.id)}),s&&(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:s}),(0,O.jsx)(`button`,{type:`submit`,className:Sd,disabled:l.isPending,"data-testid":`btn-lh-submit-quiz`,children:l.isPending?`Submitting…`:`Submit Answers`})]})]})}function Od({slug:e,onBack:t}){let{data:n,isLoading:r,error:i}=k({queryKey:[`learning-content`,e],queryFn:()=>N.get(`/api/learning/content/`+encodeURIComponent(e))});if(r)return(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`});if(i)return(0,O.jsx)(`div`,{className:`text-sm text-destructive`,children:i.message});if(!n)return null;let a=n.content;return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(`button`,{type:`button`,className:Cd,onClick:t,"data-testid":`btn-lh-back`,children:`← Back to Feed`}),(0,O.jsxs)(`section`,{className:yd,"data-testid":`lh-viewer`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,O.jsx)(`h2`,{className:`text-xl font-semibold`,"data-testid":`lh-viewer-title`,children:a.title}),(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[wd(a.content_type),a.category_name?` · `+a.category_name:``,a.author_name?` · `+a.author_name:``]})]}),a.content_type===`presentation`?(0,O.jsxs)(`div`,{className:`text-center py-8 space-y-3 bg-muted/30 rounded-md`,children:[(0,O.jsx)(`div`,{className:`text-4xl`,children:`📊`}),(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:a.title}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Slide rendering lives in the legacy viewer.`}),(0,O.jsx)(`a`,{href:`/#learning/`+encodeURIComponent(a.slug),className:Sd+` inline-block`,rel:`noreferrer`,children:`Open in legacy viewer`})]}):(0,O.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed`,"data-testid":`lh-viewer-body`,children:a.body||``})]}),a.progress&&a.progress.length>0&&(0,O.jsxs)(`section`,{className:yd,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Your past attempts`}),(0,O.jsx)(`div`,{className:`space-y-1 text-sm`,children:a.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,O.jsxs)(`div`,{className:`flex justify-between border-b border-border py-1`,children:[(0,O.jsx)(`span`,{children:new Date(e.completed_at).toLocaleDateString()}),(0,O.jsxs)(`span`,{className:`font-semibold `+r,children:[e.score,`/`,e.total,` (`,n,`%)`]})]},t)})})]}),a.questions&&a.questions.length>0&&(0,O.jsx)(Dd,{content:a,onReset:t})]})}function kd(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(null),{data:o}=k({queryKey:[`learning-categories`],queryFn:()=>N.get(`/api/learning/categories`)});return i?(0,O.jsx)(`div`,{className:`max-w-4xl mx-auto p-6`,children:(0,O.jsx)(Od,{slug:i,onBack:()=>a(null)})}):(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:`Learning Hub`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pediatric education, clinical pearls, and self-assessment quizzes.`})]}),(0,O.jsx)(`div`,{className:yd,children:(0,O.jsx)(`input`,{type:`search`,className:xd,placeholder:`Search topics, subjects…`,value:e,onChange:e=>t(e.target.value),"data-testid":`lh-search`})}),(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`lh-categories`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:bd+(n===``?` bg-primary text-primary-foreground border-primary`:` bg-muted hover:bg-muted/80`),children:`All`}),o?.categories.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>r(e.slug),className:bd+(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,O.jsx)(K,{filter:n,query:e.trim(),onOpen:e=>a(e)})]})}var Ad=[`newborn`,`infant`,`toddler`,`preschool`,`school`,`adolescent`],jd=[`msk`,`neuro`,`resp`,`cv`],Md={msk:`Musculoskeletal`,neuro:`Neuro`,resp:`Respiratory`,cv:`Cardiovascular`},Nd={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`]}]}}},Pd={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`]]}},Fd={msk:[`atr`,`beighton`],neuro:[`mrc`,`dtr`,`plantar`],resp:[`rr`,`spo2`,`silverman`,`westley`],cv:[`murmurGrade`,`pulseAmp`,`capRefill`]},Id=[{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)`}],Ld=[{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.`}],Rd=[{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.`}],q=[{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.`}],zd=`rounded-lg border border-border bg-card p-5 space-y-3`,Bd=`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors cursor-pointer`,Vd=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,Hd=`rounded-md border border-border bg-background px-3 py-2 text-sm font-medium hover:bg-muted disabled:opacity-50`,Ud=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`;function Wd(e,t,n,r){return`${e}/${t}/${n}/${r}`}function Gd({id:e,scale:t}){return(0,O.jsxs)(`section`,{className:`rounded-md border border-border bg-background p-3`,"data-testid":`scale-`+e,children:[(0,O.jsx)(`h4`,{className:`text-sm font-semibold mb-2`,children:t.title}),(0,O.jsx)(`table`,{className:`w-full text-xs`,children:(0,O.jsx)(`tbody`,{children:t.rows.map(([e,t],n)=>(0,O.jsxs)(`tr`,{className:`border-b border-border last:border-0`,children:[(0,O.jsx)(`td`,{className:`py-1 pr-3 font-mono font-semibold whitespace-nowrap`,children:e}),(0,O.jsx)(`td`,{className:`py-1 text-muted-foreground`,children:t})]},n))})})]})}function Kd({entry:e}){return(0,O.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3 space-y-2`,"data-testid":`sound-`+e.key,children:[(0,O.jsx)(`div`,{className:`text-sm font-semibold`,children:e.title}),(0,O.jsx)(`audio`,{controls:!0,preload:`none`,className:`w-full`,children:(0,O.jsx)(`source`,{src:e.src})}),(0,O.jsxs)(`div`,{className:`text-xs space-y-0.5 text-muted-foreground`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`font-semibold`,children:`Where:`}),` `,e.where]}),e.rate&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`font-semibold`,children:`Rate:`}),` `,e.rate]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`font-semibold`,children:`Features:`}),` `,e.features]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`font-semibold`,children:`Clinical:`}),` `,e.clinical]})]})]})}function qd({step:e,status:t,onStatus:n}){let r=`text-xs font-medium px-2 py-1 rounded border`;return(0,O.jsxs)(`div`,{className:`flex items-start gap-2 py-2 border-b border-border last:border-0`,children:[(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[(0,O.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Method:`}),` `,e.method]}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Normal:`}),` `,e.normal]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-1 flex-shrink-0`,children:[(0,O.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,O.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 Jd({age:e,sys:t,idx:n,comp:r,getStatus:i,setStatus:a}){return(0,O.jsxs)(`div`,{className:zd,"data-testid":`pe-component-${e}-${t}-${n}`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:r.name}),(0,O.jsx)(`div`,{children:r.steps.map((r,o)=>{let s=Wd(e,t,n,o);return(0,O.jsx)(qd,{step:r,status:i(s),onStatus:e=>a(s,e)},o)})}),r.abnormalHints.length>0&&(0,O.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,O.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-destructive mb-1`,children:`Watch for`}),(0,O.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,O.jsx)(`li`,{children:e},t))})]}),r.pearl&&(0,O.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,O.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Pearl:`}),` `,r.pearl]}),r.significance&&(0,O.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,O.jsx)(`span`,{className:`font-semibold uppercase tracking-wide`,children:`Significance:`}),` `,r.significance]})]})}function Yd(){let[e,t]=(0,_.useState)(`toddler`),[n,r]=(0,_.useState)(`msk`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(`narrative`),[u,d]=(0,_.useState)({}),[f,p]=(0,_.useState)(null),m=Nd[e],h=m[n],g=A({mutationFn:e=>N.post(`/api/generate-pe-narrative`,e),onSuccess:e=>p(e.narrative),onError:e=>p(`Generation failed: `+e.message)}),v=(0,_.useMemo)(()=>{let t=0,r=0,i=0;return h.components.forEach((a,o)=>a.steps.forEach((a,s)=>{let c=u[Wd(e,n,o,s)]??null;c===`normal`?t++:c===`abnormal`?r++:i++})),{normal:t,abnormal:r,notAssessed:i}},[e,n,h,u]);function y(){d(t=>{let r={...t};return h.components.forEach((t,i)=>t.steps.forEach((t,a)=>{delete r[Wd(e,n,i,a)]})),r}),p(null)}function b(){d(t=>{let r={...t};return h.components.forEach((t,i)=>t.steps.forEach((t,a)=>{r[Wd(e,n,i,a)]=`normal`})),r})}function x(){p(null);let t=[];h.components.forEach((r,i)=>r.steps.forEach((a,o)=>{t.push({component:r.name,label:a.label,method:a.method,normal:a.normal,status:u[Wd(e,n,i,o)]??null})})),g.mutate({steps:t,ageGroup:e,system:n,patientAge:i||void 0,patientGender:o||void 0,format:c})}let S=v.normal+v.abnormal;return(0,O.jsxs)(`div`,{className:`max-w-5xl mx-auto p-6 space-y-5`,children:[(0,O.jsxs)(`header`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Physical Exam Guide`}),(0,O.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,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Age group`}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`pe-age-group-pills`,children:Ad.map(n=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:Bd+(e===n?` bg-primary text-primary-foreground border-primary`:` bg-muted hover:bg-muted/80 border-border`),"data-testid":`pe-age-`+n,children:Nd[n].label},n))})]}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`System`}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`pe-system-pills`,children:jd.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:Bd+(n===e?` bg-primary text-primary-foreground border-primary`:` bg-muted hover:bg-muted/80 border-border`),"data-testid":`pe-system-`+e,children:Md[e]},e))})]}),(0,O.jsxs)(`section`,{className:zd+` border-l-4 border-l-primary`,"data-testid":`pe-overview`,children:[(0,O.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[m.label,` — `,Md[n]]}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:h.overview})]}),n===`cv`&&(0,O.jsxs)(`section`,{className:zd,"data-testid":`pe-cv-aptm`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Auscultation landmarks (APTM + Erb's)`}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:Id.map(e=>(0,O.jsxs)(`div`,{className:`flex gap-3 items-start rounded-md border border-border p-3`,children:[(0,O.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,O.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:e.title}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.location}),(0,O.jsxs)(`div`,{className:`text-xs mt-1`,children:[(0,O.jsx)(`strong`,{children:`Listen for:`}),` `,e.listen]}),e.innocent&&(0,O.jsxs)(`div`,{className:`text-xs text-green-700 dark:text-green-300 mt-1`,children:[(0,O.jsx)(`em`,{children:`Innocent:`}),` `,e.innocent]})]})]},e.letter))}),(0,O.jsx)(`h3`,{className:`text-base font-semibold mt-3`,children:`Cardiac sounds library`}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:q.map(e=>(0,O.jsx)(Kd,{entry:e},e.key))}),(0,O.jsx)(`h3`,{className:`text-base font-semibold mt-3`,children:`Classic innocent murmurs`}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:Ld.map(e=>(0,O.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,O.jsx)(`div`,{className:`font-semibold`,children:e.name}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Age: `,e.age,` · Location: `,e.location]}),(0,O.jsxs)(`div`,{className:`text-xs`,children:[(0,O.jsx)(`strong`,{children:`Sound:`}),` `,e.character]}),(0,O.jsxs)(`div`,{className:`text-xs`,children:[(0,O.jsx)(`strong`,{children:`Confirm innocent:`}),` `,e.confirm]})]},e.name))})]}),n===`resp`&&(0,O.jsxs)(`section`,{className:zd,"data-testid":`pe-resp-sounds`,children:[(0,O.jsx)(`h3`,{className:`text-base font-semibold`,children:`Respiratory sounds library`}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:Rd.map(e=>(0,O.jsx)(Kd,{entry:e},e.key))})]}),Fd[n]&&Fd[n].length>0&&(0,O.jsxs)(`details`,{className:zd,"data-testid":`pe-scales`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer font-semibold text-sm`,children:`Grading scales & reference`}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3 mt-3`,children:Fd[n].map(e=>{let t=Pd[e];return t?(0,O.jsx)(Gd,{id:e,scale:t},e):null})})]}),(0,O.jsxs)(`section`,{className:`space-y-3`,"data-testid":`pe-checklist`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Exam checklist`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground flex items-center gap-3`,children:[(0,O.jsxs)(`span`,{className:`text-green-600`,children:[v.normal,` normal`]}),(0,O.jsxs)(`span`,{className:`text-destructive`,children:[v.abnormal,` abnormal`]}),(0,O.jsxs)(`span`,{children:[v.notAssessed,` not assessed`]})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:b,className:Hd,"data-testid":`btn-pe-all-normal`,children:`Mark all normal`}),(0,O.jsx)(`button`,{type:`button`,onClick:y,className:Hd,"data-testid":`btn-pe-reset`,children:`Reset`})]}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 gap-3`,children:h.components.map((t,r)=>(0,O.jsx)(Jd,{age:e,sys:n,idx:r,comp:t,getStatus:e=>u[e]??null,setStatus:(e,t)=>d(n=>({...n,[e]:t}))},r))})]}),(0,O.jsxs)(`section`,{className:zd,"data-testid":`pe-generate`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Generate Exam Report`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Uses the statuses above + optional patient context.`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-3`,children:[(0,O.jsx)(`input`,{className:Ud,placeholder:`Patient age (e.g. 3y)`,value:i,onChange:e=>a(e.target.value)}),(0,O.jsx)(`input`,{className:Ud,placeholder:`Patient gender (optional)`,value:o,onChange:e=>s(e.target.value)}),(0,O.jsxs)(`select`,{className:Ud,value:c,onChange:e=>l(e.target.value),children:[(0,O.jsx)(`option`,{value:`narrative`,children:`Narrative`}),(0,O.jsx)(`option`,{value:`list`,children:`List`})]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`button`,{type:`button`,className:Vd,onClick:x,disabled:g.isPending||S===0,"data-testid":`btn-pe-generate`,children:g.isPending?`Generating…`:`Generate Exam Report`}),S===0&&(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Mark at least one step before generating.`})]}),f&&(0,O.jsx)(`div`,{className:`rounded-md border border-border bg-muted/40 p-3 whitespace-pre-wrap text-sm`,"data-testid":`pe-narrative`,children:f})]})]})}function Xd(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 Zd(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`${Qd(e,1)} months`;let t=Math.floor(e/12),n=Math.round(e-t*12);return n===12&&(t+=1,n=0),`${t} yr${n?` ${n} mo`:``} (${Math.round(e)} mo total)`}function Qd(e,t){let n=10**t;return Math.round(e*n)/n}function $d(e){if(e==null||Number.isNaN(e)||e<0)return null;let t=e/12,n;n=e<12?.5*e+4:t<=5?2*t+8:3*t+7;let r;r=e<12?(e+9)/2:t<=5?2*(t+5):4*t;let i;return i=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,Qd(t<13?n:r,1)),formulaLabel:i,all:{apls:Qd(n,1),bestGuess:Qd(r,1)}}}function ef(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?null:Math.sqrt(t*e/3600)}function tf(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 nf(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 rf(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 af={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 of(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.length-1;r++)if(t>=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 sf(e,t,n,r){return t===0?Math.log(e/n)/r:((e/n)**+t-1)/(t*r)}function cf(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 lf(e,t,n){let r=of(af[n],e),i=sf(t,r.L,r.M,r.S),a=cf(i);return{L:r.L,M:r.M,S:r.S,z:i,percentile:a}}function uf(e){return e<10?`SGA`:e>90?`LGA`:`AGA`}var df={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 ff(e,t,n,r){return Math.abs(t)<.001?Math.log(e/n)/r:((e/n)**+t-1)/(t*r)}function pf(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 mf(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 hf(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 gf(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 _f(e,t,n,r){let i=e+t/7,a=of(df[r],i),o=ff(n,a.L,a.M,a.S),s=pf(o);return{gaDecimal:i,gaClass:mf(e,t),bwClass:hf(n),weightClass:gf(s),expectedWeight:Math.round(a.M),z:o,percentile:s,L:a.L,M:a.M,S:a.S}}var vf=`rounded-lg border border-border bg-card p-5 space-y-3`,yf=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,J=`block text-xs font-medium text-muted-foreground`,bf=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,xf=`px-2 py-1.5 border-b border-border align-top text-sm`;function Y({label:e}){let t=e.indexOf(`(`);return t<0?(0,O.jsx)(`span`,{className:`font-semibold`,children:e}):(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`font-semibold`,children:e.slice(0,t).trim()}),` `,(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.slice(t)})]})}function Sf({children:e,notes:t=!0}){return(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:bf,children:`Drug`}),(0,O.jsx)(`th`,{className:bf,children:`Dose`}),(0,O.jsx)(`th`,{className:bf,children:`Route`}),t&&(0,O.jsx)(`th`,{className:bf,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:e})]})})}function X({name:e,dose:t,route:n,notes:r}){return(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:xf+` font-semibold`,dangerouslySetInnerHTML:{__html:e}}),(0,O.jsx)(`td`,{className:xf,children:t}),(0,O.jsx)(`td`,{className:xf+` text-xs`,children:n}),r!==void 0&&(0,O.jsx)(`td`,{className:xf+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}function Cf(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`0`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(`male`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)({appearance:2,pulse:2,grimace:2,activity:2,respiration:2}),f=Number.parseInt(e,10),p=Number.parseInt(n,10)||0,m=Number.parseFloat(i),h=Number.isFinite(f)&&f>=22&&f<=44&&Number.isFinite(m)&&m>0?_f(f,p,m,o):null,g=Number.parseFloat(c),v=Number.isFinite(g)&&g>0,y=v?Math.round(g*.01*100)/100:0,b=v?Math.round(g*.03*100)/100:0,x=v?Math.round(g*.05*100)/100:0,S=v?Math.round(g*.1*100)/100:0,C=v?Math.round(g*10):0,w=v?Math.round(g*2*10)/10:0,T=Object.values(u).reduce((e,t)=>e+t,0),ee=T>=7?`Reassuring`:T>=4?`Moderately depressed`:`Severely depressed`,te=T>=7?`text-green-600 bg-green-50`:T>=4?`text-amber-600 bg-amber-50`:`text-destructive bg-red-50`,ne=T>=7?`Routine newborn care. Continue reassessment. Repeat at 5 min.`:T>=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,O.jsxs)(`section`,{className:vf,"data-testid":`bedside-panel-neonatal`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Neonatal Assessment + NRP + Apgar`}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Gestational age + size assessment (Fenton 2013)`}),(0,O.jsxs)(`div`,{className:`grid gap-2 grid-cols-2 sm:grid-cols-4 max-w-xl`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`GA weeks`}),(0,O.jsx)(`input`,{type:`number`,min:`22`,max:`44`,className:yf,value:e,onChange:e=>t(e.target.value),"data-testid":`neo-weeks`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`GA days (0-6)`}),(0,O.jsx)(`input`,{type:`number`,min:`0`,max:`6`,className:yf,value:n,onChange:e=>r(e.target.value),"data-testid":`neo-days`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Birth wt (g)`}),(0,O.jsx)(`input`,{type:`number`,min:`200`,max:`7000`,className:yf,value:i,onChange:e=>a(e.target.value),"data-testid":`neo-weight`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Sex`}),(0,O.jsxs)(`select`,{className:yf,value:o,onChange:e=>s(e.target.value),"data-testid":`neo-sex`,children:[(0,O.jsx)(`option`,{value:`male`,children:`Male`}),(0,O.jsx)(`option`,{value:`female`,children:`Female`})]})]})]}),h&&(0,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,"data-testid":`neo-result`,children:[(0,O.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:h.gaClass.color+`55`,background:h.gaClass.color+`10`},children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Gestational Age`}),(0,O.jsx)(`div`,{className:`text-base font-bold`,style:{color:h.gaClass.color},children:h.gaClass.label}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[f,` wk `,p,` d (`,h.gaDecimal.toFixed(1),` wk)`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:h.weightClass.color+`55`,background:h.weightClass.color+`10`},children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Weight for Gestational Age`}),(0,O.jsx)(`div`,{className:`text-base font-bold`,style:{color:h.weightClass.color},children:h.weightClass.label}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[h.percentile.toFixed(1),`th percentile · `,h.weightClass.detail]})]}),(0,O.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:h.bwClass.color+`55`,background:h.bwClass.color+`10`},children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Birth Weight Category`}),(0,O.jsx)(`div`,{className:`text-base font-bold`,style:{color:h.bwClass.color},children:h.bwClass.label}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[m,` g (`,(m/1e3).toFixed(2),` kg)`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/40 p-3 text-xs`,children:[(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:[`Fenton (`,o,`)`]}),(0,O.jsxs)(`div`,{className:`space-y-0.5 mt-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Expected weight (M):`}),` `,h.expectedWeight,` g`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Z-score:`}),` `,h.z.toFixed(2)]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Percentile:`}),` `,h.percentile.toFixed(1),`%`]})]})]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`NRP pathway (AHA/AAP 8th ed 2020)`}),(0,O.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`BIRTH — ASSESS (first 30 sec)`}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`HR <100 OR apneic/gasping (60 s)`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`HR <100 after 30 s effective PPV`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Reassess ventilation — ensure chest rise. Consider increasing FiO₂, intubation, or LMA. Continue PPV.`})]}),(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-red-500 bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`HR <60 after 30 s effective PPV`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-100 dark:bg-red-950/40 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`HR <60 despite compressions + PPV × 60 s`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.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,O.jsx)(`strong`,{children:`NS 10 mL/kg IV/IO over 5-10 min`}),`.`]})]})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2 text-xs`,children:[(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,O.jsx)(`strong`,{children:`Target SpO₂ (preductal):`}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,O.jsx)(`strong`,{children:`Initial ETT size:`}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,O.jsx)(`strong`,{children:`ETT depth (lip):`}),` ~6 + weight(kg) cm`]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`NRP drug doses`}),(0,O.jsxs)(`div`,{className:`max-w-xs`,children:[(0,O.jsx)(`label`,{className:J,children:`Weight (kg)`}),(0,O.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:yf,value:c,onChange:e=>l(e.target.value),"data-testid":`nrp-weight`})]}),v?(0,O.jsxs)(Sf,{children:[(0,O.jsx)(X,{name:`Epinephrine 1:10,000`,dose:(0,O.jsx)(Y,{label:`${y}-${b} mg, ${Math.round(y*10)/10}-${Math.round(b*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,O.jsx)(X,{name:`Epinephrine 1:10,000`,dose:(0,O.jsx)(Y,{label:`${x}-${S} mg, ${Math.round(x*10)/10}-${Math.round(S*10)/10} mL (0.05-0.1 mg/kg = 0.5-1 mL/kg)`}),route:`ETT`,notes:`While IV being placed.`}),(0,O.jsx)(X,{name:`Normal saline`,dose:(0,O.jsx)(Y,{label:`${C} mL (10 mL/kg)`}),route:`IV / IO`,notes:`Over 5-10 min for volume. Repeat PRN.`}),(0,O.jsx)(X,{name:`Dextrose 10%`,dose:(0,O.jsx)(Y,{label:`${w} 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,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see NRP doses.`}),(0,O.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,O.jsx)(`strong`,{children:`Concentration note:`}),` NRP uses epinephrine `,(0,O.jsx)(`strong`,{children:`1:10,000`}),` (0.1 mg/mL). NOT 1:1000 (1 mg/mL) — that is IM for anaphylaxis / older patients.`]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Apgar score`}),(0,O.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,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:t}),(0,O.jsx)(`select`,{className:yf,value:u[e],onChange:t=>d({...u,[e]:Number(t.target.value)}),"data-testid":`apgar-`+e,children:n.map((e,t)=>(0,O.jsxs)(`option`,{value:t,children:[t,` — `,e]},t))})]},e))}),(0,O.jsxs)(`div`,{className:`rounded-md p-3 `+te,"data-testid":`apgar-result`,children:[(0,O.jsxs)(`div`,{className:`text-base font-bold`,children:[`Apgar: `,T,`/10 — `,ee]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:ne})]}),(0,O.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,O.jsx)(`strong`,{children:`never`}),` delay resuscitation while scoring.`]})]})}function wf(){let[e,t]=(0,_.useState)(`asthma`),[n,r]=(0,_.useState)(``),i=Number.parseFloat(n),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?nf(i,e,t,n):null,[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)({spo2:0,retractions:0,scalene:0,air:0,wheeze:0}),d=Object.values(l).reduce((e,t)=>e+t,0),f=d<=3?`Mild`:d<=7?`Moderate`:`Severe`,p=d<=3?`text-green-600 bg-green-50`:d<=7?`text-amber-600 bg-amber-50`:`text-destructive bg-red-50`,[m,h]=(0,_.useState)({conscious:0,cyanosis:0,stridor:0,air:0,retractions:0}),g=Object.values(m).reduce((e,t)=>e+t,0),v=g<=2?`Mild`:g<=5?`Moderate`:g<=11?`Severe`:`Impending Respiratory Failure`,y=g<=2?`text-green-600 bg-green-50`:g<=5?`text-amber-600 bg-amber-50`:g<=11?`text-destructive bg-red-50`:`text-red-900 bg-red-100`,[b,x]=(0,_.useState)({age:`gte12w`,spo2:`ok`,hydration:`ok`,distress:`mild`}),S=b.distress===`severe`||b.spo2===`low`||b.hydration===`poor`||b.age===`lt12w`;return(0,O.jsxs)(`section`,{className:vf,"data-testid":`bedside-panel-respiratory`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Respiratory`}),(0,O.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:[`asthma`,`pram`,`croup`,`bronch`].map(n=>(0,O.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,O.jsxs)(`div`,{className:`max-w-xs`,children:[(0,O.jsx)(`label`,{className:J,children:`Weight (kg)`}),(0,O.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:yf,value:n,onChange:e=>r(e.target.value),"data-testid":`resp-weight`})]}),e===`asthma`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`flex gap-2`,children:[`mild`,`moderate`,`severe`].map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>c(e),className:`px-3 py-1 rounded text-xs font-medium border `+(s===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))}),s&&!a&&(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`}),s===`mild`&&a&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in sentences, no accessory muscle use, SpO₂ ≥94%`}),(0,O.jsxs)(Sf,{children:[(0,O.jsx)(X,{name:`Albuterol (MDI)`,dose:`4-8 puffs via spacer`,route:`Inhaled`,notes:`q20min × 3 doses, then q1-4h`}),(0,O.jsx)(X,{name:`Albuterol (neb)`,dose:(0,O.jsx)(Y,{label:`${o(.15,5,`mg`).label} (min 2.5 mg)`}),route:`Nebulized`,notes:`q20min × 3 doses`}),(0,O.jsx)(X,{name:`Dexamethasone`,dose:(0,O.jsx)(Y,{label:o(.6,16).label}),route:`PO/IV`,notes:`Single dose, or 2 days`}),(0,O.jsx)(X,{name:`Prednisolone`,dose:(0,O.jsx)(Y,{label:`${o(1,60).label}/day`}),route:`PO`,notes:`Alternative: 3-5 day course`})]})]}),s===`moderate`&&a&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in phrases, some accessory muscle use, SpO₂ 90-93%`}),(0,O.jsxs)(Sf,{children:[(0,O.jsx)(X,{name:`Albuterol (neb)`,dose:(0,O.jsx)(Y,{label:`${o(.15,5,`mg`).label} (min 2.5 mg)`}),route:`Nebulized`,notes:`q20min × 3 doses, then continuous if needed`}),(0,O.jsx)(X,{name:`Ipratropium`,dose:i<20?`250 mcg`:`500 mcg`,route:`Nebulized`,notes:`q20min × 3 doses with albuterol`}),(0,O.jsx)(X,{name:`Dexamethasone`,dose:(0,O.jsx)(Y,{label:o(.6,16).label}),route:`PO/IV/IM`,notes:`Single dose`}),(0,O.jsx)(X,{name:`O₂ supplemental`,dose:`Target SpO₂ ≥94%`,route:`NC/mask`,notes:`Titrate to effect`})]})]}),s===`severe`&&a&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in words only, significant accessory muscle use, SpO₂ <90%. Consider ICU.`}),(0,O.jsxs)(Sf,{children:[(0,O.jsx)(X,{name:`Albuterol continuous`,dose:(0,O.jsx)(Y,{label:`${o(.5,20,`mg`).label}/hr`}),route:`Continuous neb`,notes:`Or 0.15-0.3 mg/kg q20min`}),(0,O.jsx)(X,{name:`Ipratropium`,dose:i<20?`250 mcg`:`500 mcg`,route:`Nebulized`,notes:`q20min × 3 doses with albuterol`}),(0,O.jsx)(X,{name:`Dexamethasone`,dose:(0,O.jsx)(Y,{label:o(.6,16).label}),route:`IV`,notes:`Or methylprednisolone 2 mg/kg IV (max 60 mg)`}),(0,O.jsx)(X,{name:`Magnesium sulfate`,dose:(0,O.jsx)(Y,{label:`${o(50,2e3).label} IV over 20 min`}),route:`IV`,notes:`Single dose, monitor BP`}),(0,O.jsx)(X,{name:`Epinephrine (IM)`,dose:(0,O.jsx)(Y,{label:`${o(.01,.5).label} (1:1000)`}),route:`IM`,notes:`If impending arrest / no IV access`}),(0,O.jsx)(X,{name:`Terbutaline`,dose:(0,O.jsx)(Y,{label:`${o(.01,.4).label} SC/IV`}),route:`SC/IV`,notes:`Then 0.1-10 mcg/kg/min infusion`}),(0,O.jsx)(X,{name:`O₂ supplemental`,dose:`Target SpO₂ ≥94%`,route:`High flow / NIPPV`,notes:`Consider BiPAP/CPAP`})]}),(0,O.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,O.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,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`NAEPP/GINA guidelines. Always use clinical judgment.`})]}),e===`pram`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pediatric Respiratory Assessment Measure (PRAM) — for asthma exacerbation severity (0-12).`}),(0,O.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,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:t}),(0,O.jsx)(`select`,{className:yf,value:l[e],onChange:t=>u({...l,[e]:Number(t.target.value)}),"data-testid":`pram-`+e,children:n.map((e,t)=>(0,O.jsx)(`option`,{value:t,children:e},t))})]},e))}),(0,O.jsxs)(`div`,{className:`rounded-md p-3 `+p,"data-testid":`pram-result`,children:[(0,O.jsxs)(`div`,{className:`text-base font-bold`,children:[`PRAM Score: `,d,`/12 — `,f]}),(0,O.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,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Westley croup score (0-17).`}),(0,O.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,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:t}),(0,O.jsx)(`select`,{className:yf,value:m[e],onChange:t=>h({...m,[e]:Number(t.target.value)}),"data-testid":`croup-`+e,children:n.map((e,t)=>(0,O.jsx)(`option`,{value:t,children:e},t))})]},e))}),(0,O.jsxs)(`div`,{className:`rounded-md p-3 `+y,"data-testid":`croup-result`,children:[(0,O.jsxs)(`div`,{className:`text-base font-bold`,children:[`Westley: `,g,`/17 — `,v]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Mild ≤2 · Moderate 3-5 · Severe 6-11 · Impending failure ≥12.`})]}),a&&(0,O.jsxs)(Sf,{children:[(0,O.jsx)(X,{name:`Dexamethasone`,dose:(0,O.jsx)(Y,{label:o(.6,16).label}),route:g<=2?`PO`:g<=5?`PO/IM`:`IV/IM`,notes:`Preferred corticosteroid; single dose`}),g>2&&(0,O.jsx)(X,{name:`Racemic epinephrine`,dose:`0.5 mL of 2.25% solution`,route:`Nebulized`,notes:`May repeat q15-20min, observe 2-4 h`}),g>2&&(0,O.jsx)(X,{name:`Nebulized epinephrine`,dose:`0.5 mL/kg of 1:1000 (max 5 mL)`,route:`Nebulized`,notes:`Alternative to racemic`}),g>5&&(0,O.jsx)(X,{name:`Heliox`,dose:`70:30 or 80:20`,route:`Face mask`,notes:`Consider if not responding`})]})]}),e===`bronch`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2 max-w-xl`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Age`}),(0,O.jsxs)(`select`,{className:yf,value:b.age,onChange:e=>x({...b,age:e.target.value}),children:[(0,O.jsx)(`option`,{value:`lt12w`,children:`<12 weeks (high risk)`}),(0,O.jsx)(`option`,{value:`gte12w`,children:`≥12 weeks`})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`SpO₂`}),(0,O.jsxs)(`select`,{className:yf,value:b.spo2,onChange:e=>x({...b,spo2:e.target.value}),children:[(0,O.jsx)(`option`,{value:`ok`,children:`≥90%`}),(0,O.jsx)(`option`,{value:`low`,children:`<90%`})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Hydration`}),(0,O.jsxs)(`select`,{className:yf,value:b.hydration,onChange:e=>x({...b,hydration:e.target.value}),children:[(0,O.jsx)(`option`,{value:`ok`,children:`Adequate`}),(0,O.jsx)(`option`,{value:`poor`,children:`Poor oral intake`})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Distress`}),(0,O.jsxs)(`select`,{className:yf,value:b.distress,onChange:e=>x({...b,distress:e.target.value}),children:[(0,O.jsx)(`option`,{value:`mild`,children:`Mild`}),(0,O.jsx)(`option`,{value:`moderate`,children:`Moderate`}),(0,O.jsx)(`option`,{value:`severe`,children:`Severe`})]})]})]}),(0,O.jsxs)(`div`,{className:`rounded-md p-3 `+(S?`text-destructive bg-red-50`:`text-green-600 bg-green-50`),"data-testid":`bronch-result`,children:[(0,O.jsx)(`div`,{className:`text-base font-bold`,children:S?`Admit / Observe`:`Likely Safe for Discharge`}),b.age===`lt12w`&&(0,O.jsx)(`div`,{className:`text-xs text-destructive mt-1`,children:`⚠ Age <12 weeks — high risk for apnea. Monitor closely.`})]}),(0,O.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,O.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,O.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 Tf(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),i=Number.parseFloat(e),a=Number.parseFloat(n),o=Number.isFinite(i)&&i>0,s=o?Math.round(i*1*10)/10:0,c=o?Math.round(i*2*10)/10:0,l=o?Math.round(i*6*10)/10:0,u=o?Math.round(i*8*10)/10:0,d=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,O.jsxs)(`section`,{className:vf,"data-testid":`bedside-panel-ventilation`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`O₂ & Ventilation`}),(0,O.jsxs)(`div`,{className:`grid gap-2 grid-cols-2 max-w-md`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Weight (kg)`}),(0,O.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:yf,value:e,onChange:e=>t(e.target.value),"data-testid":`vent-weight`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Age (years)`}),(0,O.jsx)(`input`,{type:`number`,min:`0`,step:`0.5`,className:yf,value:n,onChange:e=>r(e.target.value),"data-testid":`vent-age`})]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Target SpO₂`}),(0,O.jsxs)(Sf,{notes:!0,children:[(0,O.jsx)(X,{name:`Most children`,dose:`94-98%`,route:`—`,notes:`Normal`}),(0,O.jsx)(X,{name:`Bronchiolitis (AAP 2014/2023)`,dose:`≥90%`,route:`—`,notes:`Don't chase higher saturations`}),(0,O.jsx)(X,{name:`Chronic lung disease / CF`,dose:`90-94%`,route:`—`,notes:`Avoid hyperoxia in CO₂ retainers`}),(0,O.jsx)(X,{name:`Preterm neonate`,dose:`90-95%`,route:`—`,notes:`Minimize ROP risk`}),(0,O.jsx)(X,{name:`Term neonate (min of life)`,dose:`Per NRP ladder`,route:`—`,notes:`1 min 60-65% · 10 min 85-95%`})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Escalation ladder`}),(0,O.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`1. Nasal cannula (low-flow)`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.jsx)(`strong`,{children:`0.5-6 L/min`}),` · FiO₂ ~24-40% · comfortable, no humidification. Good for mild hypoxia.`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`2. Simple face mask`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.jsx)(`strong`,{children:`6-10 L/min`}),` · FiO₂ 35-60%. Must keep flow >6 L/min to flush CO₂.`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`3. Non-rebreather mask`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.jsx)(`strong`,{children:`10-15 L/min`}),` · FiO₂ 60-90%. Reservoir bag must stay inflated.`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`4. High-flow nasal cannula (HFNC)`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.jsx)(`strong`,{children:o?`1-2 L/kg/min = ${s}-${c} 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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-red-500 bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`5. Non-invasive (CPAP / BiPAP)`}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-100 dark:bg-red-950/40 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`6. Intubate + mechanical ventilation`}),(0,O.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,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Bag-Valve-Mask (BVM)`}),(0,O.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs space-y-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`When:`}),` apnea, bradycardia (HR <60 neonate; inadequate breathing at any age), during resuscitation.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Rate:`}),` Newborn 40-60/min · Infant-child 20-30/min · Adolescent 10-12/min (1 breath q5-6 sec).`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Tidal volume:`}),` 6-8 mL/kg — gentle chest rise only. Avoid over-ventilation.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Technique:`}),` head tilt / jaw thrust, E-C or 2-thumb mask seal, squeeze 1 sec, release fully.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Not ventilating?`}),` MR SOPA — Mask reseal, Reposition airway, Suction, Open mouth, Pressure ↑, Alternative airway.`]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Mechanical vent — starting settings`}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Mode:`}),` Volume-control OR Pressure-control. PRVC / SIMV-PS hybrids.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Tidal volume:`}),` `,(0,O.jsx)(`strong`,{children:o?`${l}-${u} mL`:`6-8 mL/kg`}),` (6-8 mL/kg). Use 4-6 mL/kg for ARDS.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Rate:`}),` `,d?`${d}/min (age ${a} yr)`:`Newborn 30-40 · Infant 25-35 · Child 16-20 · Adolescent 12-16`,`.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`PEEP:`}),` start 5 cmH₂O. Increase to 8-12+ for refractory hypoxia.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`FiO₂:`}),` start 100%, wean rapidly to lowest that maintains target SpO₂.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`I:E ratio:`}),` 1:2 normally; 1:3-4 for obstructive disease.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Plateau pressure:`}),` keep <30 cmH₂O (ideally <28).`]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Adjusting for gas exchange`}),(0,O.jsxs)(Sf,{notes:!0,children:[(0,O.jsx)(X,{name:`Low SpO₂ (oxygenation)`,dose:`↑ FiO₂`,route:`—`,notes:`Then ↑ PEEP (recruits collapsed alveoli)`}),(0,O.jsx)(X,{name:`↑ PCO₂ (ventilation)`,dose:`↑ Rate`,route:`—`,notes:`Then ↑ Tidal volume`}),(0,O.jsx)(X,{name:`↓ PCO₂ (over-ventilating)`,dose:`↓ Rate`,route:`—`,notes:`Then ↓ Tidal volume`}),(0,O.jsx)(X,{name:`High peak pressure`,dose:`Check tube / compliance`,route:`—`,notes:`Suction, bronchodilator, lower TV`}),(0,O.jsx)(X,{name:`Auto-PEEP (asthma, bronch)`,dose:`↓ Rate, ↑ Te`,route:`—`,notes:`Disconnect + bag briefly if critical`})]}),(0,O.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,O.jsx)(`strong`,{children:`Mental model:`}),` Oxygenation is mostly `,(0,O.jsx)(`strong`,{children:`FiO₂ + PEEP`}),`. Ventilation (CO₂) is mostly `,(0,O.jsx)(`strong`,{children:`rate + tidal volume`}),`. Obstructive (asthma, bronchiolitis) → long expiratory time, permissive hypercapnia. Restrictive (ARDS) → low TV, high PEEP, permissive hypercapnia + hypoxia.`]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP / PALS / AARC guidance.`})]})}function Ef(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`child`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?nf(i,e,t,n):null,s=n===`neonate`?`Neonate (0-28 d)`:n===`infant`?`Young infant (29 d - 3 mo)`:`Older child / adolescent`,c=a?Math.round(i*20):null;return(0,O.jsxs)(`section`,{className:vf,"data-testid":`bedside-panel-sepsis`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Sepsis & Fever`}),(0,O.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2 max-w-md`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Weight (kg)`}),(0,O.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:yf,value:e,onChange:e=>t(e.target.value),"data-testid":`sepsis-weight`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Age band`}),(0,O.jsxs)(`select`,{className:yf,value:n,onChange:e=>r(e.target.value),"data-testid":`sepsis-age`,children:[(0,O.jsx)(`option`,{value:`neonate`,children:`Neonate (0-28 d)`}),(0,O.jsx)(`option`,{value:`infant`,children:`Infant (29 d - 3 mo)`}),(0,O.jsx)(`option`,{value:`child`,children:`Older child / adolescent`})]})]})]}),(0,O.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 — `,s,a?`, ${i} kg`:``]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Definition — Phoenix Sepsis Criteria (JAMA 2024)`}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Sepsis`}),` = suspected or confirmed infection + Phoenix Score ≥2 (organ dysfunction across respiratory, cardiovascular, coagulation, neurological).`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Septic shock`}),` = sepsis + cardiovascular dysfunction (vasoactive support, or ↑lactate ≥5, or ↓MAP for age).`]}),(0,O.jsx)(`div`,{className:`text-muted-foreground italic`,children:`Previous SIRS-based criteria (Goldstein 2005) are now superseded.`})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Red flags`}),(0,O.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,O.jsx)(`strong`,{children:`LATE`}),` sign · Any immune compromise / indwelling line.`]}),(0,O.jsxs)(`h3`,{className:`text-sm font-semibold mt-2`,children:[`Empirical therapy — `,s]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[n===`neonate`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`strong`,{children:`Workup (full sepsis eval):`}),` CBC+diff, CRP, blood culture, UA+urine culture (cath), `,(0,O.jsx)(`strong`,{children:`LP`}),` (CSF+HSV PCR), CXR if respiratory sx, procalcitonin. `,(0,O.jsx)(`strong`,{children:`Early-onset`}),` (<72 h): GBS, E. coli, Listeria. `,(0,O.jsx)(`strong`,{children:`Late-onset`}),` (>72 h): CoNS, S. aureus, gram-negs, Candida.`]}),n===`infant`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`strong`,{children:`Coverage:`}),` GBS, E. coli, Listeria (up to ~6 wk), S. pneumo, N. meningitidis, H. flu, Salmonella.`]}),n===`child`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`strong`,{children:`Recognition:`}),` Phoenix score or clinical concern + suspected infection. `,(0,O.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,O.jsxs)(Sf,{children:[n===`neonate`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(X,{name:`Ampicillin`,dose:(0,O.jsx)(Y,{label:o(100,2e3).label}),route:`IV`,notes:`q8-12h. Covers GBS, Listeria, Enterococcus.`}),(0,O.jsx)(X,{name:`Gentamicin`,dose:(0,O.jsx)(Y,{label:o(4,120).label}),route:`IV`,notes:`q24-48h. Monitor levels.`}),(0,O.jsx)(X,{name:`Cefotaxime (add)`,dose:(0,O.jsx)(Y,{label:o(50,2e3).label}),route:`IV`,notes:`If meningitis or gram-neg concern.`}),(0,O.jsx)(X,{name:`Acyclovir`,dose:(0,O.jsx)(Y,{label:o(20,1200).label}),route:`IV q8h`,notes:`HSV risk: maternal lesions, vesicles, seizures, CSF pleocytosis.`})]}),n===`infant`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(X,{name:`Ceftriaxone`,dose:(0,O.jsx)(Y,{label:o(75,2e3).label}),route:`IV / IM`,notes:`q24h (100 mg/kg/day divided q12h for meningitis). <strong>Avoid <28 d</strong> if hyperbilirubinemia.`}),(0,O.jsx)(X,{name:`Ampicillin`,dose:(0,O.jsx)(Y,{label:o(100,2e3).label}),route:`IV`,notes:`If <6 wk: add for Listeria coverage.`}),(0,O.jsx)(X,{name:`Vancomycin`,dose:(0,O.jsx)(Y,{label:o(15,1e3).label}),route:`IV`,notes:`If severe / MRSA risk / meningitis.`}),(0,O.jsx)(X,{name:`Acyclovir`,dose:(0,O.jsx)(Y,{label:o(20,1200).label}),route:`IV q8h`,notes:`<6 wk with suspicion of HSV.`})]}),n===`child`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(X,{name:`Ceftriaxone`,dose:(0,O.jsx)(Y,{label:o(50,2e3).label}),route:`IV`,notes:`q24h (100 mg/kg/day divided for meningitis).`}),(0,O.jsx)(X,{name:`Vancomycin`,dose:(0,O.jsx)(Y,{label:o(15,1e3).label}),route:`IV`,notes:`q6h. If severe, indwelling line, or MRSA prevalence >10%.`}),(0,O.jsx)(X,{name:`Piperacillin-tazobactam`,dose:(0,O.jsx)(Y,{label:o(100,4500).label}),route:`IV`,notes:`If intra-abdominal / neutropenic.`}),(0,O.jsx)(X,{name:`Clindamycin`,dose:(0,O.jsx)(Y,{label:o(10,900).label}),route:`IV`,notes:`Adjunct for toxic shock syndrome (toxin suppression).`}),(0,O.jsx)(X,{name:`Acyclovir`,dose:(0,O.jsx)(Y,{label:o(20,1200).label}),route:`IV q8h`,notes:`If HSV CNS concern.`})]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`First-hour bundle (SSC Peds 2020)`}),(0,O.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`0-5 min — Recognize`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Screen, sepsis huddle/activation, ABCs, O₂ to SpO₂ >94%, warm.`})]}),(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`5-15 min — Access & labs`}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`15-30 min — Fluids`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[a?(0,O.jsxs)(O.Fragment,{children:[`NS or LR `,(0,O.jsxs)(`strong`,{children:[c,` mL`]}),` bolus (20 mL/kg) over 5-10 min.`]}):(0,O.jsx)(O.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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`30-60 min — Antibiotics + reassess`}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,O.jsx)(`div`,{className:`font-semibold`,children:`>60 min — Fluid-refractory shock`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Start vasoactive (`,(0,O.jsx)(`strong`,{children:`epinephrine 0.05-0.3 mcg/kg/min`}),` cold / `,(0,O.jsx)(`strong`,{children:`norepinephrine 0.05-0.3 mcg/kg/min`}),` warm). Central/IO access. Stress-dose hydrocortisone `,a?(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Resuscitation targets`}),(0,O.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,O.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 Df=[{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]}],Of=[{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 kf(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`young`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)({}),c=Of.findIndex(e=>e.id===n),l=Df.reduce((e,t)=>e+t.vals[c]*Math.min(100,Math.max(0,o[t.key]??0))/100,0),u=i.trim()?Number(i):Math.round(l*10)/10,d=Number.parseFloat(e),f=Number.isFinite(d)&&d>0,p=Number.isFinite(u)&&u>0,m=f&&p?Math.round(4*d*u):0,h=Math.round(m/2),g=Math.round(h/8),v=m-h,y=Math.round(v/16),b=f?Math.round(d<=10?d*4:d<=20?40+(d-10)*2:60+(d-20)):0;return(0,O.jsxs)(`section`,{className:vf,"data-testid":`bedside-panel-burns`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Burns — Lund-Browder + Parkland`}),(0,O.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-3 max-w-xl`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Weight (kg)`}),(0,O.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:yf,value:e,onChange:e=>t(e.target.value),"data-testid":`burn-weight`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`Age band`}),(0,O.jsx)(`select`,{className:yf,value:n,onChange:e=>r(e.target.value),"data-testid":`burn-age`,children:Of.map(e=>(0,O.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:J,children:`TBSA override (%)`}),(0,O.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`1`,className:yf,value:i,onChange:e=>a(e.target.value),placeholder:p?String(u):`auto`,"data-testid":`burn-tbsa`})]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Body parts — % of each region burned (2° or deeper)`}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2`,children:Df.map(e=>{let t=e.vals[c];return(0,O.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/30 rounded p-2`,children:[(0,O.jsxs)(`label`,{className:`flex-1 text-xs`,children:[e.label,` `,(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t,`%`,e.ageSensitive?`*`:``,`)`]})]}),(0,O.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,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`%`})]},e.key)})}),p&&(0,O.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Computed TBSA: `,(0,O.jsxs)(`strong`,{children:[u,`%`]})]}),!f&&(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see Parkland + maintenance fluids.`}),!p&&f&&(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter % per region or override TBSA to compute fluids.`}),f&&p&&(0,O.jsxs)(O.Fragment,{children:[(0,O.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 — `,d,` kg, `,u,`% TBSA (2° or deeper)`]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm space-y-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Parkland formula:`}),` 4 mL × kg × %TBSA = `,(0,O.jsxs)(`strong`,{children:[m,` mL LR over 24 hours`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`First 8 h`}),` (from time of burn): `,h,` mL (~`,(0,O.jsxs)(`strong`,{children:[g,` mL/hr`]}),`)`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Next 16 h:`}),` `,v,` mL (~`,(0,O.jsxs)(`strong`,{children:[y,` mL/hr`]}),`)`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,O.jsx)(`strong`,{children:`Plus maintenance (4-2-1):`}),` `,b,` mL/hr (D5 ½NS ± 20 mEq KCl/L once UOP established). Consider dextrose in children <30 kg.`]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,O.jsx)(`strong`,{children:`Titrate to UOP:`}),` target 1-2 mL/kg/hr (infants / children), 0.5-1 mL/kg/hr (adolescents). `,(0,O.jsx)(`strong`,{children:`Clinical response trumps formula.`})]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Other pearls`}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Rule of palm:`}),` Patient's palm + fingers ≈ 1% TBSA — good for scattered burns.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`First-degree burns DO NOT count`}),` toward TBSA or Parkland.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Analgesia:`}),` Morphine 0.05-0.1 mg/kg IV q2h, or fentanyl 1-2 mcg/kg IV q30-60 min.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Tetanus`}),` prophylaxis if indicated. Tdap/Td ± TIG.`]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Burn center referral (ABA)`}),(0,O.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,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ABA Advanced Burn Life Support 2018 · Parkland formula: Baxter 1968 · Lund-Browder 1944.`})]})}var Af=`rounded-lg border border-border bg-card p-5 space-y-3`,jf=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,Mf=`block text-xs font-medium text-muted-foreground`,Z=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,Q=`px-2 py-1.5 border-b border-border align-top text-sm`;function Nf({id:e,value:t,onChange:n,testid:r}){return(0,O.jsxs)(`div`,{className:`max-w-xs`,children:[(0,O.jsx)(`label`,{htmlFor:e,className:Mf,children:`Weight (kg)`}),(0,O.jsx)(`input`,{id:e,type:`number`,min:`0.3`,step:`0.1`,className:jf,value:t,onChange:e=>n(e.target.value),"data-testid":r})]})}function Pf({label:e}){let t=e.indexOf(`(`);if(t<0)return(0,O.jsx)(`span`,{className:`font-semibold`,children:e});let n=e.slice(0,t).trim(),r=e.slice(t);return(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`font-semibold`,children:n}),` `,(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})}var Ff={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 If(){let[e,t]=(0,_.useState)(``),n=Number.parseFloat(e);if(!Number.isFinite(n)||n<=0)return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-anaphylaxis`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Anaphylaxis`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Emergency management. Epinephrine IM is the immediate and only proven lifesaving step.`}),(0,O.jsx)(Nf,{id:`anaph-wt`,value:e,onChange:t,testid:`anaph-weight`}),(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]});let r=nf(n,Ff.epi.perKg,Ff.epi.max,Ff.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=nf(n,Ff.fluids.perKg,Ff.fluids.max,Ff.fluids.unit),s=nf(n,Ff.dph.perKg,Ff.dph.max),c=nf(n,Ff.ranitidine.perKg,Ff.ranitidine.max),l=nf(n,Ff.dex.perKg,Ff.dex.max),u=nf(n,Ff.mpn.perKg,Ff.mpn.max),d=nf(n,Ff.glucagon.perKg,Ff.glucagon.max),f=[[`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`,s.label,`IV/IM/PO`,`H1 blocker. NOT first-line — adjunct only`],[``,`Ranitidine`,c.label,`IV over 5 min`,`H2 blocker. Optional adjunct`],[`STEP 6`,`Dexamethasone`,l.label,`IV/IM/PO`,`Prevents biphasic reaction (4-6 hrs later)`],[``,`Methylprednisolone`,u.label,`IV`,`Alternative steroid`],[`REFRACTORY`,`Epinephrine gtt`,`0.1-1 mcg/kg/min`,`IV infusion`,`For persistent hypotension despite fluids + IM epi`],[``,`Glucagon`,d.label,`IV/IM`,`For patients on beta-blockers not responding to epi`]];return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-anaphylaxis`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Anaphylaxis`}),(0,O.jsx)(Nf,{id:`anaph-wt`,value:e,onChange:t,testid:`anaph-weight`}),(0,O.jsxs)(`div`,{className:`rounded-lg border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-4 space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-base font-bold text-destructive`,children:`STEP 1: Epinephrine IM — GIVE IMMEDIATELY`}),(0,O.jsxs)(`div`,{className:`text-sm font-semibold`,children:[`Epinephrine 1:1000 (1 mg/mL): `,(0,O.jsxs)(`span`,{className:`text-destructive`,children:[r.value,` mg (`,i,` mL)`]}),` IM to lateral thigh`]}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[Ff.epi.perKg,` mg/kg (max `,Ff.epi.max,` mg) · Auto-injector: `,a]}),(0,O.jsx)(`div`,{className:`text-xs text-destructive`,children:`May repeat every 5-15 minutes if symptoms persist. No contraindications in anaphylaxis.`})]}),(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`anaph-table`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Step`}),(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:f.map((e,t)=>(0,O.jsxs)(`tr`,{className:e[0]===`REFRACTORY`||t>0&&f[t-1][0]===`REFRACTORY`&&e[0]===``?`bg-amber-50 dark:bg-amber-950/30`:``,children:[(0,O.jsx)(`td`,{className:Q+` font-semibold text-primary text-xs`,children:e[0]}),(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:e[1]}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:e[2]})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:e[3]}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:e[4]})]},t))})]})}),(0,O.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,O.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,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ASCIA Anaphylaxis Guidelines 2021 · WAO Anaphylaxis Guidance 2020 · AAP/ACAAI Practice Parameters.`})]})}function Lf(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`general`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?nf(i,e,t,n):null,s=[{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 c({name:e,dose:t,route:n,notes:r}){return(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:e}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:t})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:n}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:r})]})}function l({children:e}){return(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:e})]})})}function u(){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`),u=o(.1,6,`mg`),d=o(.2,12,`mg`),f=o(1,50,`mEq`),p=o(20,1e3,`mg`),m=o(.2,10,`mL`),h=o(60,3e3,`mg`),g=o(.6,30,`mL`),_=o(50,2e3,`mg`),v=o(2,null,`mL`);return(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{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,O.jsx)(c,{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,O.jsx)(c,{name:`Lidocaine`,dose:i.label,route:`IV / IO bolus`,notes:`1 mg/kg. Alternative to amiodarone for VF/VT.`}),(0,O.jsx)(c,{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,O.jsx)(c,{name:`Adenosine (1st)`,dose:u.label,route:`IV push + flush`,notes:`0.1 mg/kg (max 6 mg). For SVT. Rapid push, double flush.`}),(0,O.jsx)(c,{name:`Adenosine (2nd)`,dose:d.label,route:`IV push + flush`,notes:`0.2 mg/kg (max 12 mg). Second dose if first unsuccessful.`}),(0,O.jsx)(c,{name:`Sodium bicarb 8.4%`,dose:f.label,route:`IV / IO`,notes:`1 mEq/kg. ONLY if severe metabolic acidosis, hyperK, or TCA OD. Not routine.`}),(0,O.jsx)(c,{name:`Calcium chloride 10%`,dose:`${p.label} (${m.label})`,route:`IV / IO (central preferred)`,notes:`For hyperK, hypoCa, Mg OD, CCB OD. 20 mg/kg = 0.2 mL/kg.`}),(0,O.jsx)(c,{name:`Calcium gluconate 10%`,dose:`${h.label} (${g.label})`,route:`IV / IO (peripheral OK)`,notes:`60 mg/kg = 0.6 mL/kg. Preferred peripherally.`}),(0,O.jsx)(c,{name:`Magnesium sulfate`,dose:_.label,route:`IV over 10-20 min`,notes:`25-50 mg/kg. Torsades, severe asthma. Max 2 g.`}),(0,O.jsx)(c,{name:`Dextrose 10%`,dose:`${v.label} (0.2 g/kg)`,route:`IV push`,notes:`For documented hypoglycemia`}),(0,O.jsx)(c,{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,O.jsx)(c,{name:`Cardioversion (sync)`,dose:`0.5-1 J/kg → 2 J/kg`,route:`Pad`,notes:`For unstable SVT/VT. Sedate if possible.`})]})}function d(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.1,2.5,`mg`);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{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,O.jsx)(c,{name:`Epinephrine ETT`,dose:t.label,route:`ETT`,notes:`0.1 mg/kg if no IV access`})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Reversible causes (H's & T's)`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2 text-xs`,children:[(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,O.jsx)(`strong`,{children:`H's`}),` — Hypoxia, Hypovolemia, H+ (acidosis), Hypo/hyperK, Hypoglycemia, Hypothermia`]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,O.jsx)(`strong`,{children:`T's`}),` — Tension PTX, Tamponade, Toxins, Thrombosis (MI/PE), Trauma`]})]})]})}function f(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.02,.5,`mg`);return(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Bradycardia with poor perfusion (HR < 60)`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Start CPR if HR < 60 with poor perfusion despite oxygenation and ventilation.`})]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`First-line. Q3-5 min.`}),(0,O.jsx)(c,{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,O.jsx)(c,{name:`Transcutaneous pacing`,dose:`—`,route:`Pad`,notes:`For refractory bradycardia not responsive to drugs.`}),(0,O.jsx)(c,{name:`Consider`,dose:`—`,route:`—`,notes:`Hypoxia, tension pneumothorax, ↑ICP, toxic ingestion (organo, CCB, BB), heart block`})]})]})}function p(){if(!a)return null;let e=o(.1,6,`mg`),t=o(.2,12,`mg`);return(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`SVT — narrow complex, rate usually >220 infant / >180 child`}),(0,O.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,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`If STABLE`}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{name:`Vagal maneuvers`,dose:`Ice to face, blow into syringe, Valsalva`,route:`—`,notes:`Try first in stable patient`}),(0,O.jsx)(c,{name:`Adenosine (1st)`,dose:e.label,route:`IV push (proximal) + flush`,notes:`Rapid push, 3-way stopcock with NS flush`}),(0,O.jsx)(c,{name:`Adenosine (2nd)`,dose:t.label,route:`IV push + flush`,notes:`If first dose unsuccessful`}),(0,O.jsx)(c,{name:`Procainamide`,dose:`15 mg/kg over 30-60 min`,route:`IV`,notes:`Expert consult. Avoid with amiodarone.`}),(0,O.jsx)(c,{name:`Amiodarone`,dose:`5 mg/kg over 20-60 min`,route:`IV`,notes:`Expert consult.`})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`If UNSTABLE`}),(0,O.jsx)(l,{children:(0,O.jsx)(c,{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 m(){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,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm`,children:[(0,O.jsx)(`div`,{className:`font-semibold text-destructive`,children:`VF / Pulseless VT`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`High-quality CPR + defibrillation are key. Minimize interruptions.`})]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{name:`Defibrillation (1st)`,dose:`2 J/kg`,route:`Pad`,notes:`Resume CPR immediately after shock.`}),(0,O.jsx)(c,{name:`Defibrillation (2nd)`,dose:`4 J/kg`,route:`Pad`,notes:`After 2 min CPR.`}),(0,O.jsx)(c,{name:`Defibrillation (3rd+)`,dose:`≥4 J/kg (max 10 J/kg or adult dose)`,route:`Pad`,notes:``}),(0,O.jsx)(c,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`After 2nd shock. Q3-5 min.`}),(0,O.jsx)(c,{name:`Amiodarone`,dose:t.label,route:`IV / IO bolus`,notes:`Refractory VF/VT. Max 15 mg/kg/day.`}),(0,O.jsx)(c,{name:`Lidocaine`,dose:n.label,route:`IV / IO`,notes:`Alternative to amiodarone. Then 20-50 mcg/kg/min gtt.`}),(0,O.jsx)(c,{name:`Mg sulfate`,dose:r.label,route:`IV over 1-2 min`,notes:`For torsades or hypoMg.`})]})]})}function h(){if(!a)return null;let e=o(5,300,`mg`);return(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Stable monomorphic VT`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Expert consult. Avoid combining QT-prolonging agents.`})]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{name:`Amiodarone`,dose:`5 mg/kg over 20-60 min = ${e.value} mg over 20-60 min`,route:`IV`,notes:``}),(0,O.jsx)(c,{name:`Procainamide`,dose:`15 mg/kg over 30-60 min`,route:`IV`,notes:`Do not combine with amiodarone`}),(0,O.jsx)(c,{name:`Sync cardioversion`,dose:`0.5-1 → 2 J/kg`,route:`Pad`,notes:`If becomes unstable. Sedate.`})]})]})}return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-cardiac`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Cardiac Arrest / PALS`}),(0,O.jsx)(Nf,{id:`cardiac-wt`,value:e,onChange:t,testid:`cardiac-weight`}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map(e=>(0,O.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,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.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:[s.find(e=>e.id===n)?.label,` — `,i,` kg`]}),n===`general`&&(0,O.jsx)(u,{}),n===`asystole`&&(0,O.jsx)(d,{}),n===`brady`&&(0,O.jsx)(f,{}),n===`svt`&&(0,O.jsx)(p,{}),n===`vfib`&&(0,O.jsx)(m,{}),n===`vt`&&(0,O.jsx)(h,{}),(0,O.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,O.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,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AHA PALS Guidelines 2020 · Always verify against institutional protocols.`})]}):(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var $={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 Rf(){let[e,t]=(0,_.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=(e,t,i=`mg`)=>r?nf(n,e,t,i):null,a=r?Math.round(n*2*10)/10:0,o=r?Math.round(n*5*10)/10:0;function s({time:e,color:t,title:n,children:r,last:i=!1}){return(0,O.jsxs)(`div`,{className:`flex gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center flex-shrink-0`,children:[(0,O.jsx)(`div`,{className:`w-16 py-1.5 rounded-full text-white text-xs font-bold text-center ${t}`,children:e}),!i&&(0,O.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-1`})]}),(0,O.jsxs)(`div`,{className:`flex-1 rounded-r-md border-l-4 p-3 bg-muted/30`,style:{borderLeftColor:`currentColor`},children:[(0,O.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wide mb-2`,children:n}),(0,O.jsx)(`div`,{className:`text-sm space-y-2`,children:r})]})]})}function c({name:e,f:t,route:n,notes:r,suffix:i}){return(0,O.jsxs)(`tr`,{children:[(0,O.jsxs)(`td`,{className:Q+` font-semibold`,children:[e,i&&(0,O.jsx)(`span`,{className:`text-xs text-green-700 ml-1`,children:i})]}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:t.label})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:n}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-seizure`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Seizures — Status Epilepticus Pathway`}),(0,O.jsx)(Nf,{id:`seizure-wt`,value:e,onChange:t,testid:`seizure-weight`}),r?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,O.jsxs)(`div`,{className:`font-bold text-destructive text-sm`,children:[`Status Epilepticus Pathway — `,n,` kg`]}),(0,O.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,O.jsxs)(`div`,{className:`space-y-0`,children:[(0,O.jsxs)(s,{time:`0 min`,color:`bg-blue-500 text-white`,title:`Stabilize`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`ABCs`}),` — position, 100% O₂ via NC / NRB, suction. `,(0,O.jsx)(`strong`,{children:`IV or IO`}),` × 2. Continuous SpO₂, ECG, BP.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`POC glucose`}),` — if <60 mg/dL: `,(0,O.jsxs)(`strong`,{children:[`D10W `,a,`-`,o,` mL IV`]}),` (2-5 mL/kg).`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Labs`}),`: CBC, CMP, Mg, Ca, Phos, VBG, lactate, AED levels, toxicology if unclear etiology.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Consider pyridoxine`}),` 100 mg IV in infants <18 mo or INH ingestion. Temperature: treat hyperthermia aggressively.`]})]}),(0,O.jsx)(s,{time:`5 min`,color:`bg-purple-500 text-white`,title:`1st benzodiazepine (give once, pick by access)`,children:(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsxs)(`tbody`,{children:[(0,O.jsx)(c,{name:`Lorazepam`,f:i($.lorazepam.perKg,$.lorazepam.max),route:`IV / IO`,notes:`Slow push over 1-2 min.`,suffix:` (IV preferred)`}),(0,O.jsx)(c,{name:`Midazolam`,f:i($.midazolam.perKg,$.midazolam.max),route:`IM / IN / buccal`,notes:`Use 5 mg/mL concentrate for IN; split between nares.`}),(0,O.jsx)(c,{name:`Diazepam`,f:i($.diazepam.perKg,$.diazepam.max),route:`PR`,notes:`Only if no IV/IM/IN access.`})]})]})})}),(0,O.jsxs)(s,{time:`10 min`,color:`bg-violet-500 text-white`,title:`2nd benzodiazepine — if still seizing`,children:[`Repeat same agent + dose `,(0,O.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,O.jsx)(s,{time:`20 min`,color:`bg-amber-500 text-white`,title:`2nd-line anti-epileptic — pick one (ESETT: equivalent efficacy)`,children:(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsxs)(`tbody`,{children:[(0,O.jsx)(c,{name:`Levetiracetam`,f:i($.levetiracetam.perKg,$.levetiracetam.max),route:`IV over 5-15 min`,notes:`Best tolerability. No ECG monitoring needed.`,suffix:` (preferred)`}),(0,O.jsx)(c,{name:`Fosphenytoin`,f:i($.fosphenytoin.perKg,$.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,O.jsx)(c,{name:`Valproic acid`,f:i($.valproate.perKg,$.valproate.max),route:`IV over 10 min`,notes:`<strong>Avoid <2 yr, hepatic / mitochondrial disease, pregnancy.</strong>`}),(0,O.jsx)(c,{name:`Phenobarbital`,f:i($.phenobarb.perKg,$.phenobarb.max),route:`IV over 20 min`,notes:`Last-choice 2nd line. High risk of resp depression + hypotension.`})]})]})})}),(0,O.jsxs)(s,{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,O.jsx)(`strong`,{children:`OR`}),` move directly to refractory therapy. Activate ICU, prepare for intubation. Confirm etiology not reversible (electrolytes, glucose, fever, toxin).`]}),(0,O.jsxs)(s,{time:`40 min`,color:`bg-destructive text-white`,title:`Refractory status — intubate + continuous infusion + continuous EEG`,last:!0,children:[(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsxs)(`tbody`,{children:[(0,O.jsxs)(`tr`,{children:[(0,O.jsxs)(`td`,{className:Q+` font-semibold`,children:[`Midazolam `,(0,O.jsx)(`span`,{className:`text-xs text-green-700`,children:`(1st-line infusion)`})]}),(0,O.jsxs)(`td`,{className:Q+` text-sm`,children:[`Bolus `,i($.midazGttBolus.perKg,$.midazGttBolus.max).value,` mg → gtt `,i($.midazGttLow.perKg,$.midazGttLow.max,`mg/hr`).value,`–`,i($.midazGttHigh.perKg,$.midazGttHigh.max,`mg/hr`).value,` mg/hr `,(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 0.2 mg/kg, gtt 0.05-0.5 mg/kg/hr)`})]}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`Titrate to seizure control / burst suppression.`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Pentobarbital`}),(0,O.jsxs)(`td`,{className:Q+` text-sm`,children:[`Bolus `,i($.pentobarbBolus.perKg,$.pentobarbBolus.max).value,` mg → gtt `,i($.pentobarbGttLow.perKg,null,`mg/hr`).value,`–`,i($.pentobarbGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 5 mg/kg, gtt 1-5 mg/kg/hr)`})]}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`Causes hypotension — often need pressors.`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Propofol`}),(0,O.jsxs)(`td`,{className:Q+` text-sm`,children:[`Bolus `,i($.propofolBolus.perKg,$.propofolBolus.max).value,` mg → gtt `,i($.propofolGttLow.perKg,null,`mg/hr`).value,`–`,i($.propofolGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 2 mg/kg, gtt 2-5 mg/kg/hr)`})]}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV`}),(0,O.jsxs)(`td`,{className:Q+` text-xs text-muted-foreground`,children:[(0,O.jsx)(`strong`,{children:`PRIS risk in children`}),` — limit to <4 mg/kg/hr and duration <48 h.`]})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Ketamine`}),(0,O.jsxs)(`td`,{className:Q+` text-sm`,children:[`Bolus `,i($.ketamineBolus.perKg,$.ketamineBolus.max).value,` mg → gtt `,i($.ketamineGttLow.perKg,null,`mg/hr`).value,`–`,i($.ketamineGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 2 mg/kg, gtt 1-5 mg/kg/hr)`})]}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`NMDA antagonist — rescue. Good BP profile; useful if refractory to GABAergics.`})]})]})]})}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-2`,children:[(0,O.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,O.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,O.jsx)(`div`,{className:`font-semibold`,children:`Key points`}),(0,O.jsxs)(`div`,{children:[`• Do `,(0,O.jsx)(`strong`,{children:`NOT`}),` wait for benzo response before starting the 2nd-line — parallel preparation.`]}),(0,O.jsxs)(`div`,{children:[`• Maximum `,(0,O.jsx)(`strong`,{children:`2 benzo doses`}),` total (1 pre-hospital + 1 in ED, or 2 in ED).`]}),(0,O.jsx)(`div`,{children:`• Respiratory depression is common — have BVM, airway equipment, naloxone, flumazenil accessible (but avoid flumazenil here).`}),(0,O.jsx)(`div`,{children:`• ESETT trial: levetiracetam = fosphenytoin = valproate for efficacy. Pick by tolerability / contraindications.`}),(0,O.jsx)(`div`,{children:`• Always reassess: ongoing seizure? Non-convulsive status? Pseudo-seizure? → continuous EEG if any doubt.`})]}),(0,O.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,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function zf(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),i=Number.parseFloat(e),a=Number.parseFloat(n),o=Number.isFinite(i)&&i>0,s=(e,t,n=`mg`)=>o?nf(i,e,t,n):null,c=Number.isFinite(a)&&a>=0,l=c?Math.round((a/4+4)*2)/2:null,u=c?Math.round((a/4+3.5)*2)/2:null,d=l?Math.round(l*3*10)/10:null,f=c?a<1?`Miller 0-1`:a<2?`Miller 1 / Mac 1`:a<8?`Miller 2 / Mac 2`:`Miller/Mac 3`:`—`,p=o?i<5?`1`:i<10?`1.5`:i<20?`2`:i<30?`2.5`:i<50?`3`:i<70?`4`:`5`:`—`,m=o&&i<10?2:1.5,h=s(6,null,`mL`),g=s(8,null,`mL`);function v({title:e,rows:t}){return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:e}),(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:t.map((e,t)=>(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:e[0]}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:e[1]})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:e[2]}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:e[3]})]},t))})]})})]})}return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-airway`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Airway / RSI`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-md`,children:[(0,O.jsx)(Nf,{id:`airway-wt`,value:e,onChange:t,testid:`airway-weight`}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`airway-age`,className:Mf,children:`Age (years)`}),(0,O.jsx)(`input`,{id:`airway-age`,type:`number`,min:`0`,step:`0.5`,className:jf,value:n,onChange:e=>r(e.target.value),"data-testid":`airway-age`})]})]}),o?(0,O.jsxs)(O.Fragment,{children:[(0,O.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`,c?`, ~${a} yr`:``]}),(0,O.jsx)(v,{title:`Pre-medication (optional)`,rows:[[`Atropine`,`${s(.02,1,`mg`).label} (min 0.1 mg)`,`IV`,`Consider <1 yr or if using succinylcholine, or bradycardia risk`],[`Lidocaine 2%`,s(1.5,100,`mg`).label,`IV over 1 min`,`For ↑ICP, asthma; give 2-3 min pre-induction`],[`Fentanyl`,`${s(2,150,`mcg`).label} (2-3 mcg/kg)`,`IV over 1 min`,`Blunts sympathetic response; avoid if hypotensive`]]}),(0,O.jsx)(v,{title:`Induction`,rows:[[`Ketamine`,`${s(1.5,150,`mg`).label} (1-2 mg/kg)`,`IV`,`Preserves BP. First-line for shock, asthma, sepsis`],[`Etomidate`,s(.3,30,`mg`).label,`IV`,`Hemodynamically neutral. Avoid in septic shock (adrenal suppression)`],[`Propofol`,`${s(2,200,`mg`).label} (1-2 mg/kg)`,`IV`,`Causes hypotension. Avoid in shock`],[`Midazolam`,s(.2,10,`mg`).label,`IV`,`Less optimal induction — slower onset`]]}),(0,O.jsx)(v,{title:`Paralytics`,rows:[[`Rocuronium`,`${s(1.2,100,`mg`).label} (1-1.2 mg/kg)`,`IV`,`30-60 sec onset; 30-45 min duration. First-line non-depolarizing.`],[`Succinylcholine`,s(m,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`,s(.1,10,`mg`).label,`IV`,`2-3 min onset; longer duration than roc`]]}),(0,O.jsx)(v,{title:`Maintenance sedation / analgesia`,rows:[[`Midazolam gtt`,`${s(.05,2,`mg`).label}–${s(.2,10,`mg`).label}/hr`,`IV infusion`,`0.05-0.2 mg/kg/hr`],[`Fentanyl gtt`,`${s(1,100,`mcg`).label}–${s(4,200,`mcg`).label}/hr`,`IV infusion`,`1-4 mcg/kg/hr`],[`Ketamine gtt`,`${s(.5,30,`mg`).label}–${s(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,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Equipment sizing`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3 text-xs`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:c?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`ETT (uncuffed):`}),` `,l,` mm`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`ETT (cuffed):`}),` `,u,` mm`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Depth at lip:`}),` ~`,d,` cm`]})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{children:(0,O.jsx)(`em`,{children:`Enter age for ETT / blade sizing.`})}),(0,O.jsx)(`div`,{children:`ETT (uncuffed) = (age/4) + 4`}),(0,O.jsx)(`div`,{children:`ETT (cuffed) = (age/4) + 3.5`}),(0,O.jsx)(`div`,{children:`Depth = ETT size × 3`})]})}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Laryngoscope blade:`}),` `,f]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`LMA size:`}),` `,p]}),(0,O.jsx)(`div`,{children:`OPA = corner mouth → angle mandible`}),(0,O.jsx)(`div`,{children:`NPA = tip nose → tragus`})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 md:col-span-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Suction catheter (Fr):`}),` ETT size × 2`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`NG tube:`}),` ETT × 2`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Chest tube:`}),` 4 × ETT`]})]})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Ventilator — starting settings`}),(0,O.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs space-y-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Mode:`}),` Volume or pressure control`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Tidal volume:`}),` 6-8 mL/kg (= `,h.value,`-`,g.value,` mL). Use lower (4-6 mL/kg) for ARDS.`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Rate:`}),` Infant 25-30, Child 15-25, Adolescent 12-16`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`PEEP:`}),` 5 cmH₂O (↑ for oxygenation problems)`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`FiO₂:`}),` Start 100%, wean to SpO₂ 92-97%`]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`I:E ratio:`}),` 1:2 (1:3-4 for obstructive disease)`]})]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Harriet Lane Handbook 23rd ed · PALS 2020. Always confirm doses against institutional protocols.`})]}):(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function Bf(){let[e,t]=(0,_.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0;function i(e,t,n,r){return(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:e}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:t})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:n}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}let a=r?[i(`Lorazepam`,nf(n,.05,2).label,`PO`,`0.05 mg/kg. May repeat in 30 min.`),i(`Midazolam`,nf(n,.5,10).label,`PO`,`0.5 mg/kg (max 10 mg)`),i(`Midazolam`,nf(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`,nf(n,1,50).label,`PO`,`1 mg/kg. Adjunct only; sedating.`)]:null,o=r?[i(`Midazolam`,nf(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`,nf(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`,nf(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,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-agitation`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Agitation`}),(0,O.jsx)(Nf,{id:`agit-wt`,value:e,onChange:t,testid:`agit-weight`}),r?(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.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,O.jsx)(`div`,{className:`font-semibold text-green-800 dark:text-green-200`,children:`Step 1 — Non-pharmacologic`}),(0,O.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,O.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,O.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`Step 2 — Oral / intranasal (cooperative)`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`First-line for moderate agitation if the patient will accept PO/IN.`})]}),(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:a})]})}),(0,O.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,O.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Step 3 — IM / IV (severe, uncooperative, or safety risk)`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Require continuous monitoring. Consider restraints only as last resort.`})]}),(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:o})]})}),(0,O.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,O.jsx)(`strong`,{children:`Monitoring:`}),` Continuous SpO₂ + HR after parenteral sedation. Have airway equipment, flumazenil, naloxone, and IV access ready.`]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Clinical Report on Pediatric Agitation · ACEP Guidelines for Acute Agitation.`})]}):(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function Vf(){let[e,t]=(0,_.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=(e,t,i=`mg`)=>r?nf(n,e,t,i):null,a=r?n<15?`2 mg`:n<30?`4 mg`:`8 mg`:null;return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-antiemetics`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Antiemetics`}),(0,O.jsx)(Nf,{id:`emet-wt`,value:e,onChange:t,testid:`emet-weight`}),r?(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsxs)(`tbody`,{children:[(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Ondansetron`}),(0,O.jsxs)(`td`,{className:Q+` text-xs`,children:[a,` (weight band) OR `,(0,O.jsx)(Pf,{label:i(.15,8).label})]}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`PO / ODT / IV`}),(0,O.jsx)(`td`,{className:Q+` 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,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Metoclopramide`}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:i(.15,10).label})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV / IM / PO`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`0.1-0.15 mg/kg (max 10 mg). Give with diphenhydramine to prevent EPS / dystonia.`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Dimenhydrinate`}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:i(1.25,50).label})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`PO / IV / IM / PR`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`1.25 mg/kg (max 50 mg) q6h. ≥2 yr.`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Diphenhydramine`}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:i(1,50).label})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`PO / IV / IM`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`1 mg/kg (max 50 mg) q6h. Adjunct, sedating.`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Promethazine`}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:i(.25,25).label})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`PO / IV / IM`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:`0.25-1 mg/kg. <strong>CONTRAINDICATED <2 yr</strong> (resp depression). Tissue injury if IV extrav.`}})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Dexamethasone`}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:i(.15,10).label})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV / PO`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`Adjunct, esp. chemo-induced. 0.15 mg/kg (max 10 mg).`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Scopolamine patch`}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`1.5 mg patch`}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`Transdermal`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`≥12 yr. Motion sickness. Apply 4h before exposure.`})]})]})]})}),(0,O.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,O.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,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP gastroenteritis guidance · WHO essential medicines · Lexicomp.`})]}):(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var Hf={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.`}}},Uf={neonate:`Neonate (0-28 d)`,infant:`Infant (1-3 mo)`,child:`Child (>3 mo)`},Wf=[[`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 Gf(){let[e,t]=(0,_.useState)(`child`),[n,r]=(0,_.useState)(`sepsis`),i=Hf[e][n];return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-antimicrobials`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Antimicrobials (empirical)`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-xl`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`abx-age`,className:Mf,children:`Age band`}),(0,O.jsx)(`select`,{id:`abx-age`,className:jf,value:e,onChange:e=>t(e.target.value),"data-testid":`abx-age`,children:Object.entries(Uf).map(([e,t])=>(0,O.jsx)(`option`,{value:e,children:t},e))})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`abx-infection`,className:Mf,children:`Infection`}),(0,O.jsx)(`select`,{id:`abx-infection`,className:jf,value:n,onChange:e=>r(e.target.value),"data-testid":`abx-infection`,children:Wf.map(([e,t])=>(0,O.jsx)(`option`,{value:e,children:t},e))})]})]}),(0,O.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:[Uf[e],` — `,Wf.find(([e])=>e===n)?.[1]]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm`,children:[(0,O.jsx)(`strong`,{className:`text-green-800 dark:text-green-200`,children:`First-line:`}),` `,i.first]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,O.jsx)(`strong`,{children:`Alternative / add:`}),` `,i.alt]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,O.jsx)(`strong`,{children:`Duration:`}),` `,i.duration]}),(0,O.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,O.jsx)(`strong`,{children:`Notes:`}),` `,i.notes]}),(0,O.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 Kf(){let[e,t]=(0,_.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=r?Math.round(n*20):null;return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-trauma`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Trauma — primary survey + MTP`}),(0,O.jsx)(Nf,{id:`trauma-wt`,value:e,onChange:t,testid:`trauma-weight`}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Primary Survey — ABCDE`}),(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm`,children:[(0,O.jsx)(`div`,{className:`font-semibold text-destructive`,children:`A — Airway + c-spine`}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Maintain airway (jaw thrust, suction). `,(0,O.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,O.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,O.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`B — Breathing`}),(0,O.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,O.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,O.jsx)(`div`,{className:`font-semibold text-green-800 dark:text-green-200`,children:`C — Circulation`}),(0,O.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,O.jsxs)(O.Fragment,{children:[`NS or LR 20 mL/kg = `,(0,O.jsxs)(`strong`,{children:[i,` mL`]}),` bolus.`]}):(0,O.jsx)(O.Fragment,{children:`NS/LR 20 mL/kg bolus.`}),` `,`Consider blood after 40-60 mL/kg crystalloid or in Class III shock.`]})]}),(0,O.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,O.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`D — Disability`}),(0,O.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,O.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,O.jsx)(`div`,{className:`font-semibold text-violet-800 dark:text-violet-200`,children:`E — Exposure + environment`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Fully expose; prevent hypothermia (warm blankets, fluids).`})]}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Massive Transfusion Protocol (MTP)`}),(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsxs)(`tbody`,{children:[(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Ratio`}),(0,O.jsx)(`td`,{className:Q,children:`1:1:1 (pRBC : FFP : platelets)`}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`—`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`Activate early if ≥40 mL/kg transfused or ongoing hemorrhage. Avoid excessive crystalloid.`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Tranexamic acid (TXA)`}),(0,O.jsx)(`td`,{className:Q,children:`15 mg/kg IV (max 1 g) over 10 min → 2 mg/kg/hr × 8h`}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`Within 3 hr of injury. CRASH-2 / MATIC.`})]}),(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:`Calcium`}),(0,O.jsx)(`td`,{className:Q,children:`20 mg/kg CaCl or 60 mg/kg Ca-gluconate IV per unit citrated blood`}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:`IV`}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:`Citrated blood chelates calcium.`})]})]})]})}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`C-spine clearance (NEXUS / CCR)`}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[`Pediatric c-spine decision tools are imperfect. `,(0,O.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,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Pediatric shock — signs`}),(0,O.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,O.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,O.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Secondary survey — AMPLE + head-to-toe`}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[(0,O.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,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ATLS 10th ed · PALS 2020 · PECARN c-spine rule · CRASH-2 trial (TXA).`})]})}var qf=[{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 Jf(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=nf(e,t.perKgLow,t.maxLow??null).value;return t.perKgHigh==null?`${i}${n} (${t.perKgLow} ${r}/kg)`:`${i}-${nf(e,t.perKgHigh,t.maxHigh??null).value}${n} (${t.perKgLow}-${t.perKgHigh} ${r}/kg)`}return t.perKg==null?``:`${nf(e,t.perKg,t.max??null).value}${n} (${t.perKg} ${r}/kg)`}function Yf(){let[e,t]=(0,_.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=qf.filter(e=>!e.reverses),a=qf.filter(e=>e.reverses);function o({dg:e}){return(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:e.display??``}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:Jf(n,e)})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:e.route}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:e.onset??``}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:e.duration??``}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:e.notes})]})}function s({dg:e}){return(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:e.display}),(0,O.jsx)(`td`,{className:Q,children:(0,O.jsx)(Pf,{label:Jf(n,e)})}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:e.route}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:e.reverses}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,children:e.notes})]})}return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-sedation`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Procedural Sedation`}),(0,O.jsx)(Nf,{id:`sed-wt`,value:e,onChange:t,testid:`sed-weight`}),r?(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Sedation Agents`}),(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Onset`}),(0,O.jsx)(`th`,{className:Z,children:`Duration`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:i.map(e=>(0,O.jsx)(o,{dg:e},e.name))})]})}),(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-destructive`,children:`Reversal Agents`}),(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{className:`bg-red-50 dark:bg-red-950/30`,children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Reverses`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:a.map(e=>(0,O.jsx)(s,{dg:e},e.name))})]})}),(0,O.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,O.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,O.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,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var Xf=[[`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 Zf(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`approach`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?nf(i,e,t,n).value:null;function s({color:e,title:t,body:n}){return(0,O.jsxs)(`div`,{className:`rounded-md border-l-4 ${e} p-3 text-sm`,children:[(0,O.jsx)(`div`,{className:`font-semibold mb-1`,children:t}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:n})]})}function c({drug:e,dose:t,route:n,notes:r}){return(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{className:Q+` font-semibold`,children:e}),(0,O.jsx)(`td`,{className:Q,children:t}),(0,O.jsx)(`td`,{className:Q+` text-xs`,children:n}),(0,O.jsx)(`td`,{className:Q+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}function l({children:e}){return(0,O.jsx)(`div`,{className:`overflow-x-auto`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:Z,children:`Drug`}),(0,O.jsx)(`th`,{className:Z,children:`Dose`}),(0,O.jsx)(`th`,{className:Z,children:`Route`}),(0,O.jsx)(`th`,{className:Z,children:`Notes`})]})}),(0,O.jsx)(`tbody`,{children:e})]})})}return(0,O.jsxs)(`section`,{className:Af,"data-testid":`bedside-panel-toxicology`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Toxicology`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-xl`,children:[(0,O.jsx)(Nf,{id:`tox-wt`,value:e,onChange:t,testid:`tox-weight`}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`tox-topic`,className:Mf,children:`Topic`}),(0,O.jsx)(`select`,{id:`tox-topic`,className:jf,value:n,onChange:e=>r(e.target.value),"data-testid":`tox-topic`,children:Xf.map(([e,t])=>(0,O.jsx)(`option`,{value:e,children:t},e))})]})]}),n===`approach`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(s,{color:`border-blue-500 bg-blue-50 dark:bg-blue-950/30`,title:`1. Stabilize (ABCDE)`,body:(0,O.jsx)(O.Fragment,{children:`Airway, breathing, circulation, disability (glucose, pupils, GCS), exposure. Naloxone if depressed LOC + resp depression. Dextrose if hypoglycemic. Thiamine in select cases.`})}),(0,O.jsx)(s,{color:`border-purple-500 bg-purple-50 dark:bg-purple-950/30`,title:`2. Identify toxidrome`,body:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`strong`,{children:`Sympathomimetic:`}),` HTN, tachy, mydriasis, diaphoresis (cocaine, meth). `,(0,O.jsx)(`strong`,{children:`Anticholinergic:`}),` hot/dry, mydriasis, tachy, delirium (antihistamines, TCAs). `,(0,O.jsx)(`strong`,{children:`Cholinergic:`}),` SLUDGE-M, miosis (organophosphates). `,(0,O.jsx)(`strong`,{children:`Opioid:`}),` miosis, resp depression, ↓LOC. `,(0,O.jsx)(`strong`,{children:`Sedative-hypnotic:`}),` ↓LOC, normal/low vitals.`]})}),(0,O.jsx)(s,{color:`border-amber-500 bg-amber-50 dark:bg-amber-950/30`,title:`3. Decontamination`,body:(0,O.jsxs)(O.Fragment,{children:[(0,O.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,O.jsx)(`strong`,{children:`Whole bowel irrigation:`}),` PEG for metals/iron/lithium/sustained release. `,(0,O.jsx)(`strong`,{children:`Gastric lavage:`}),` rarely indicated. `,(0,O.jsx)(`strong`,{children:`Ipecac:`}),` no longer recommended.`]})}),(0,O.jsx)(s,{color:`border-green-500 bg-green-50 dark:bg-green-950/30`,title:`4. Enhance elimination`,body:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`strong`,{children:`Urinary alkalinization`}),` (salicylates, phenobarbital). `,(0,O.jsx)(`strong`,{children:`Hemodialysis`}),` (see ISTUMBLE). `,(0,O.jsx)(`strong`,{children:`Lipid emulsion`}),` for lipid-soluble drug toxicity (LA, CCB, TCA).`]})}),(0,O.jsx)(s,{color:`border-destructive bg-red-50 dark:bg-red-950/30`,title:`5. Antidotes`,body:(0,O.jsxs)(O.Fragment,{children:[`See topic list. `,(0,O.jsx)(`strong`,{children:`Contact Poison Center`}),` (US: 1-800-222-1222) early for any significant exposure.`]})})]}),n===`acetaminophen`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Acetaminophen overdose`}),(0,O.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,O.jsxs)(`p`,{className:`text-sm`,children:[(0,O.jsx)(`strong`,{children:`Diagnosis:`}),` Draw level at 4h post-ingestion (or on arrival if >4h). Plot on `,(0,O.jsx)(`strong`,{children:`Rumack-Matthew nomogram`}),` (treatment line at 150 mcg/mL at 4h).`]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{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,O.jsx)(c,{drug:`Activated charcoal`,dose:`1 g/kg (max 50 g)`,route:`PO`,notes:`If within 1-2h of ingestion and airway protected.`})]}),a&&(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[(0,O.jsxs)(`strong`,{children:[`For `,i,` kg:`]}),` IV loading = `,o(150,null),` mg over 1h `,(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`(150 mg/kg)`}),`; 2nd bag = `,o(50,null),` mg over 4h `,(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`(50 mg/kg)`}),`; 3rd bag = `,o(100,null),` mg over 16h `,(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`(100 mg/kg)`}),`. `,(0,O.jsx)(`em`,{children:`Total 300 mg/kg.`})]})]}),n===`opioids`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Opioid overdose`}),(0,O.jsxs)(`p`,{className:`text-sm`,children:[`Triad: `,(0,O.jsx)(`strong`,{children:`miosis + respiratory depression + ↓ LOC`}),`. Fentanyl / synthetics may require repeated/higher doses.`]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{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,O.jsx)(c,{drug:`Naloxone infusion`,dose:`2/3 of effective bolus per hour`,route:`IV`,notes:`For long-acting opioids (methadone, fentanyl patch, sustained release)`})]}),(0,O.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,O.jsx)(`strong`,{children:`re-sedation is common`}),`.`]})]}),n===`iron`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Iron overdose`}),(0,O.jsxs)(`p`,{className:`text-sm`,children:[`Toxic dose: elemental Fe ≥20 mg/kg. Severe ≥60 mg/kg. `,(0,O.jsx)(`strong`,{children:`Charcoal does NOT bind iron.`})]}),(0,O.jsxs)(`p`,{className:`text-sm`,children:[(0,O.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,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{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,O.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,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`TCA overdose`}),(0,O.jsxs)(`p`,{className:`text-sm`,children:[`Anticholinergic + Na-channel blockade. `,(0,O.jsx)(`strong`,{children:`Risks:`}),` seizure, VT/VF, hypotension, coma. ECG: QRS >100 ms or R in aVR >3 mm predicts toxicity.`]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{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,O.jsx)(c,{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,O.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,O.jsx)(`strong`,{children:`Avoid`}),` Class IA/IC antiarrhythmics, beta-blockers, physostigmine (risk of asystole with TCAs).`]})]}),n===`bbccb`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.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,O.jsx)(`p`,{className:`text-sm`,children:`Bradycardia + hypotension. CCBs (esp. verapamil, diltiazem, amlodipine) can be lethal in small pediatric doses.`}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{drug:`IV fluids`,dose:`20 mL/kg NS bolus`,route:`IV`,notes:`Cautious — avoid volume overload`}),(0,O.jsx)(c,{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,O.jsx)(c,{drug:`Glucagon`,dose:`50 mcg/kg IV bolus → 50-150 mcg/kg/hr`,route:`IV`,notes:`β-blocker antidote. GI side effects common.`}),(0,O.jsx)(c,{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,O.jsx)(c,{drug:`Vasopressors`,dose:`Epi / norepi infusion`,route:`IV`,notes:`Titrate to MAP.`}),(0,O.jsx)(c,{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,O.jsx)(c,{drug:`Methylene blue / ECMO`,dose:`—`,route:`—`,notes:`Rescue therapy — toxicology/ICU consult.`})]})]}),n===`benzo`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Benzodiazepine overdose`}),(0,O.jsxs)(`p`,{className:`text-sm`,children:[`Sedation + resp depression. Usually supportive — intubation rarely needed alone. `,(0,O.jsx)(`strong`,{children:`Flumazenil caution.`})]}),(0,O.jsx)(l,{children:(0,O.jsx)(c,{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. <strong>Can precipitate seizures.</strong>`})}),(0,O.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,O.jsx)(`strong`,{children:`supportive care (airway, monitoring)`}),` is usually safer than flumazenil.`]})]}),n===`organo`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Organophosphate / carbamate poisoning`}),(0,O.jsxs)(`p`,{className:`text-sm`,children:[`Cholinergic toxidrome: `,(0,O.jsx)(`strong`,{children:`SLUDGE-M`}),` (salivation, lacrimation, urination, defecation, GI distress, emesis, miosis) + muscle fasciculation, bradycardia, bronchorrhea. Decontamination critical (PPE for providers).`]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{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,O.jsx)(c,{drug:`Diazepam / midazolam`,dose:`Standard seizure doses`,route:`IV`,notes:`For seizures or severe fasciculations.`})]})]}),n===`salicylate`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Salicylate overdose`}),(0,O.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,O.jsxs)(l,{children:[(0,O.jsx)(c,{drug:`Fluids`,dose:`Aggressive resuscitation`,route:`IV`,notes:`Dehydration common. Avoid fluid overload (risk of pulmonary edema).`}),(0,O.jsx)(c,{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,O.jsx)(c,{drug:`Glucose`,dose:`Maintain euglycemia even if BG normal`,route:`IV`,notes:`CNS hypoglycemia despite normal serum glucose.`}),(0,O.jsx)(c,{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,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.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,O.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,O.jsxs)(l,{children:[(0,O.jsx)(c,{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,O.jsx)(c,{drug:`Ethanol (alternative)`,dose:`Load 600 mg/kg → maintain level 100-150 mg/dL`,route:`IV / PO`,notes:`If fomepizole unavailable. Monitor closely.`}),(0,O.jsx)(c,{drug:`Hemodialysis`,dose:`—`,route:`—`,notes:`For severe acidosis, end-organ damage, or high levels.`}),(0,O.jsx)(c,{drug:`Folate / thiamine / pyridoxine`,dose:`Standard doses`,route:`IV`,notes:`Methanol: folate. EG: thiamine + pyridoxine (divert to non-toxic metabolites).`})]})]}),n===`dialyzable`&&(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Dialyzable drugs (ISTUMBLE)`}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,O.jsxs)(`strong`,{children:[e,`:`]}),` `,t]},e))}),(0,O.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,O.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,O.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 Qf(e){switch(e){case`anaphylaxis`:return(0,O.jsx)(If,{});case`cardiac`:return(0,O.jsx)(Lf,{});case`seizure`:return(0,O.jsx)(Rf,{});case`airway`:return(0,O.jsx)(zf,{});case`agitation`:return(0,O.jsx)(Bf,{});case`antiemetics`:return(0,O.jsx)(Vf,{});case`antimicrobials`:return(0,O.jsx)(Gf,{});case`trauma`:return(0,O.jsx)(Kf,{});case`sedation`:return(0,O.jsx)(Yf,{});case`toxicology`:return(0,O.jsx)(Zf,{});case`neonatal`:return(0,O.jsx)(Cf,{});case`respiratory`:return(0,O.jsx)(wf,{});case`ventilation`:return(0,O.jsx)(Tf,{});case`sepsis`:return(0,O.jsx)(Ef,{});case`burns`:return(0,O.jsx)(kf,{});default:return null}}var $f=new Set([`anaphylaxis`,`cardiac`,`seizure`,`airway`,`agitation`,`antiemetics`,`antimicrobials`,`trauma`,`sedation`,`toxicology`,`neonatal`,`respiratory`,`ventilation`,`sepsis`,`burns`]),ep=`rounded-lg border border-border bg-card p-5 space-y-3`,tp=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,np=`rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted`,rp=`block text-xs font-medium text-muted-foreground`,ip=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,ap=[{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 op(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`apls`),[i,a]=(0,_.useState)(``),o=Xd(e),s=o==null?null:$d(o),c=s?n===`bestguess`?s.all.bestGuess:s.all.apls:null,l=i.trim()||(c==null?``:String(c));function u(){t(``),r(`apls`),a(``)}return(0,O.jsxs)(`section`,{className:ep,"data-testid":`bedside-weight-estimator`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Age → Weight Estimator`}),(0,O.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,O.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[1.2fr_1fr_1fr_auto] md:items-end`,children:[(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(`label`,{htmlFor:`bedside-react-age`,className:rp,children:`Age`}),(0,O.jsx)(`input`,{id:`bedside-react-age`,value:e,onChange:e=>t(e.target.value),placeholder:`e.g. "18m", "3y", "2y5m"`,className:ip,"data-testid":`bedside-age-input`})]}),(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(`label`,{htmlFor:`bedside-react-formula`,className:rp,children:`Formula`}),(0,O.jsxs)(`select`,{id:`bedside-react-formula`,value:n,onChange:e=>{r(e.target.value),a(``)},className:ip,"data-testid":`bedside-formula-select`,children:[(0,O.jsx)(`option`,{value:`apls`,children:`APLS`}),(0,O.jsx)(`option`,{value:`bestguess`,children:`Best Guess`})]})]}),(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(`label`,{htmlFor:`bedside-react-weight`,className:rp,children:`Weight (kg)`}),(0,O.jsx)(`input`,{id:`bedside-react-weight`,type:`number`,min:`0.3`,step:`0.1`,value:l,onChange:e=>a(e.target.value),className:ip,"data-testid":`bedside-weight-input`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:u,className:np,children:`Clear`})]}),e.trim()&&o==null?(0,O.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,s&&c!=null?(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/40 p-4 text-sm`,"data-testid":`bedside-estimate-result`,children:[(0,O.jsxs)(`div`,{className:`font-semibold`,children:[c,` kg estimated from `,Zd(o??0)]}),(0,O.jsxs)(`div`,{className:`text-muted-foreground`,children:[`APLS: `,s.all.apls,` kg · Best Guess: `,s.all.bestGuess,` kg. You can override the weight field.`]})]}):null]})}function sp({pill:e}){return(0,O.jsxs)(`section`,{className:ep,"data-testid":`bedside-panel-`+e.id,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`span`,{className:`text-2xl`,"aria-hidden":!0,children:e.icon}),(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label})]}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary}),(0,O.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,O.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,O.jsx)(`a`,{href:`/#bedside`,className:tp+` inline-block`,children:`Open in legacy viewer`})]})}function cp(){let[e,t]=(0,_.useState)(ap[0].id),n=ap.find(t=>t.id===e)??ap[0];return(0,O.jsxs)(`div`,{className:`max-w-5xl mx-auto p-6 space-y-4`,children:[(0,O.jsxs)(`header`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Bedside`}),(0,O.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,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`bedside-subnav`,children:ap.map(n=>(0,O.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,O.jsx)(`span`,{className:`mr-1`,"aria-hidden":!0,children:n.icon}),n.label]},n.id))}),(0,O.jsx)(op,{}),$f.has(n.id)?Qf(n.id):(0,O.jsx)(sp,{pill:n})]})}var lp={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}},up={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},dp={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},fp={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},pp={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},mp={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},hp={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},gp={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},_p={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},vp={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},yp={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},bp={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},xp={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},Sp={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},Cp={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},wp={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},Tp={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},Ep={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},Dp={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 Op(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.length-1;r++)if(t>=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 kp(e,t){let n=Op(lp.p95,e),r=Op(lp.p75,e),i=Op(lp.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 Ap(e,t){return t===`medium`?e===35?gp:e===36?_p:e===37?vp:yp:e===35?up:e===36?dp:e===37?fp:e===38?pp:e===39?mp:hp}function jp(e,t){return t===`medium`?e===35?wp:e===36?Tp:e===37?Ep:Dp:e===35?bp:e===36?xp:e===37?Sp:Cp}function Mp(e,t,n,r){let i=Op(Ap(e,r),t),a=Op(jp(e,r),t),o;return o=n>=a?`Above Exchange`:n>=i?`Above Phototherapy`:`Below Phototherapy`,{photoThreshold:i,exchangeThreshold:a,status:o}}var Np={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 Pp(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 Fp(e,t,n,r){let i;i=Math.abs(t)<.001?Math.log(e/n)/r:((e/n)**+t-1)/(t*r);let a=Pp(i);return{z:i,percentile:Math.round(a*1e4)/100}}function Ip(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 Lp(e,t,n,r){let i=e/(t/100)**2,a=Math.max(24,Math.min(240,n)),o=of(Np[r],a),{z:s,percentile:c}=Fp(i,o.L,o.M,o.S),l=Ip(c,i,o);return{bmi:i,z:s,percentile:c,L:o.L,M:o.M,S:o.S,classification:l}}var Rp=`rounded-lg border border-border bg-card p-5 space-y-3`,zp=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,Bp=`block text-xs font-medium text-muted-foreground`,Vp=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,Hp=`rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted`,Up=`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`;function Wp(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(`male`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(null);function m(){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){d(`Fill in all fields.`),p(null);return}if(t<2||t>20){d(`Age must be 2-20 years.`),p(null);return}d(``),p(Lp(r,a,Math.round(t*12),i))}return(0,O.jsxs)(`section`,{className:Rp,"data-testid":`calc-panel-bmi`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`BMI Percentile (CDC 2000)`}),(0,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:col-span-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:Bp,children:`Age (yr)`}),(0,O.jsx)(`input`,{type:`number`,min:`2`,max:`20`,step:`0.1`,className:zp,value:e,onChange:e=>t(e.target.value),"data-testid":`bmi-age-yr`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:Bp,children:`Months`}),(0,O.jsx)(`input`,{type:`number`,min:`0`,max:`11`,className:zp,value:n,onChange:e=>r(e.target.value),"data-testid":`bmi-age-mo`})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:Bp,children:`Sex`}),(0,O.jsxs)(`select`,{className:zp,value:i,onChange:e=>a(e.target.value),"data-testid":`bmi-sex`,children:[(0,O.jsx)(`option`,{value:`male`,children:`Male`}),(0,O.jsx)(`option`,{value:`female`,children:`Female`})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:Bp,children:`Weight (kg)`}),(0,O.jsx)(`input`,{type:`number`,min:`1`,max:`200`,step:`0.1`,className:zp,value:o,onChange:e=>s(e.target.value),"data-testid":`bmi-weight`})]}),(0,O.jsxs)(`div`,{className:`sm:col-span-1`,children:[(0,O.jsx)(`label`,{className:Bp,children:`Height (cm)`}),(0,O.jsx)(`input`,{type:`number`,min:`50`,max:`220`,step:`0.1`,className:zp,value:c,onChange:e=>l(e.target.value),"data-testid":`bmi-height`})]})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:m,className:Vp,"data-testid":`calc-bmi-calculate`,children:`Calculate`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>{t(``),r(``),s(``),l(``),p(null),d(``)},className:Hp,children:`Clear`})]}),u&&(0,O.jsx)(`div`,{className:Up,children:u}),f&&(0,O.jsxs)(`div`,{className:`rounded-lg p-4 space-y-2`,style:{background:f.classification.bg,borderLeft:`4px solid ${f.classification.color}`},"data-testid":`calc-bmi-result`,children:[(0,O.jsx)(`div`,{className:`text-base font-bold`,style:{color:f.classification.color},children:f.classification.label}),(0,O.jsxs)(`div`,{className:`text-sm`,children:[`BMI `,f.bmi.toFixed(1),` kg/m² — `,f.percentile,`th percentile`]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`BMI`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:f.bmi.toFixed(1)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Percentile`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[f.percentile,`th`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Z-Score`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:f.z.toFixed(2)})]}),f.percentile>=85&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`% of 95th`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[f.classification.pctOf95.toFixed(0),`%`]})]})]})]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`CDC 2000 LMS tables · Kuczmarski et al. Vital Health Stat 11. 2002;(246).`})]})}var Gp={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`]}},Kp=[`premie`,`0-3mo`,`3-6mo`,`6-12mo`,`1-3yr`,`3-6yr`,`6-12yr`,`>12yr`];function qp(){let[e,t]=(0,_.useState)(`1-3yr`),n=Gp[e];return(0,O.jsxs)(`section`,{className:Rp,"data-testid":`calc-panel-vitals`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Vital Signs by Age`}),(0,O.jsxs)(`div`,{className:`max-w-xs`,children:[(0,O.jsx)(`label`,{className:Bp,children:`Age group`}),(0,O.jsx)(`select`,{className:zp,value:e,onChange:e=>t(e.target.value),"data-testid":`vitals-age-select`,children:Kp.map(e=>(0,O.jsx)(`option`,{value:e,children:Gp[e].label},e))})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3 text-sm`,"data-testid":`vitals-result`,children:[(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Heart rate (awake)`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[n.hr.awake,` bpm`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Heart rate (sleep)`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[n.hr.sleeping,` bpm`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Respiratory rate`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[n.rr,` /min`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`SpO₂`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:n.spo2})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`SBP`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[n.sbp,` mmHg`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`DBP`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[n.dbp,` mmHg`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Temperature`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[n.temp,` °C`]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Weight`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:n.weight})]})]}),(0,O.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs`,children:[(0,O.jsx)(`div`,{className:`font-semibold mb-1`,children:`Clinical notes`}),(0,O.jsx)(`ul`,{className:`list-disc pl-5 space-y-0.5`,children:n.notes.map((e,t)=>(0,O.jsx)(`li`,{children:e},t))})]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Harriet Lane Handbook 23rd ed · PALS · AAP 2017 BP guidelines.`})]})}var Jp=[{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`}}}],Yp={cardiac:`#ef4444`,metabolic:`#3b82f6`,reversal:`#10b981`},Xp={cardiac:`Cardiac`,metabolic:`Metabolic`,reversal:`Reversal`};function Zp(){let[e,t]=(0,_.useState)(``),n=Number.parseFloat(e);return(0,O.jsxs)(`section`,{className:Rp,"data-testid":`calc-panel-resus`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Resus Medications`}),(0,O.jsxs)(`div`,{className:`max-w-xs`,children:[(0,O.jsx)(`label`,{className:Bp,children:`Weight (kg)`}),(0,O.jsx)(`input`,{type:`number`,min:`0.5`,max:`100`,step:`0.1`,className:zp,value:e,onChange:e=>t(e.target.value),"data-testid":`resus-weight`})]}),Number.isFinite(n)&&n>0?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`text-sm font-semibold`,children:[`Doses for `,n,` kg patient`]}),(0,O.jsx)(`div`,{className:`flex gap-3 flex-wrap text-xs`,children:[`cardiac`,`metabolic`,`reversal`].map(e=>(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,O.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full`,style:{background:Yp[e]}}),Xp[e]]},e))}),(0,O.jsx)(`div`,{className:`grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3`,"data-testid":`resus-result`,children:Jp.map(e=>{let t=e.calc(n),r=Yp[e.category];return(0,O.jsxs)(`div`,{className:`rounded-lg border bg-card overflow-hidden`,style:{borderColor:r+`55`},children:[(0,O.jsxs)(`div`,{className:`px-3 py-2 border-b`,style:{background:r+`10`,borderColor:r+`22`},children:[(0,O.jsx)(`div`,{className:`text-sm font-bold`,style:{color:r},children:e.name}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.indication})]}),(0,O.jsxs)(`div`,{className:`p-3 text-sm space-y-1`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`strong`,{children:`Dose:`}),` `,t.dose]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.extra}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.jsx)(`strong`,{children:`Max:`}),` `,t.max]}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,O.jsx)(`strong`,{children:`Route:`}),` `,e.route]})]})]},e.name)})}),(0,O.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,O.jsx)(`strong`,{children:`Disclaimer:`}),` Always verify doses against institutional protocols and current guidelines.`]})]}):(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var Qp={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`}},$p=[`premie`,`newborn`,`6mo`,`1yr`,`2-3yr`,`4-6yr`,`7-10yr`,`11-15yr`,`16yr`];function em(){let[e,t]=(0,_.useState)(`1yr`),n=Qp[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,O.jsxs)(`section`,{className:Rp,"data-testid":`calc-panel-equipment`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Equipment Sizing`}),(0,O.jsxs)(`div`,{className:`max-w-xs`,children:[(0,O.jsx)(`label`,{className:Bp,children:`Age / weight band`}),(0,O.jsx)(`select`,{className:zp,value:e,onChange:e=>t(e.target.value),"data-testid":`equip-age-select`,children:$p.map(e=>(0,O.jsx)(`option`,{value:e,children:Qp[e].label},e))})]}),(0,O.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,O.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:e}),(0,O.jsx)(`div`,{className:`font-semibold`,children:t})]},e))}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Harriet Lane Handbook · PALS · Broselow cross-reference.`})]})}var tm=`rounded-lg border border-border bg-card p-5 space-y-3`,nm=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,rm=`rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted`,im=`space-y-1`,am=`block text-xs font-medium text-muted-foreground`,om=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,sm=`rounded-lg border border-border bg-muted/40 p-4`,cm=`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`,lm=[{id:`bp`,label:`BP Percentile`,summary:`AAP 2017 age/height/sex-adjusted BP percentiles (Rosner quantile splines).`,source:`AAP 2017 (Flynn) — Rosner splines`},{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 um(e){if(!e.trim())return null;let t=Number(e);return Number.isFinite(t)?t:null}function dm({id:e,labelText:t,value:n,onChange:r,min:i,max:a,step:o=`0.1`,placeholder:s}){return(0,O.jsxs)(`div`,{className:im,children:[(0,O.jsx)(`label`,{htmlFor:e,className:am,children:t}),(0,O.jsx)(`input`,{id:e,type:`number`,min:i,max:a,step:o,value:n,onChange:e=>r(e.target.value),placeholder:s,className:om})]})}function fm(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(``);function c(){let t=ef(Number(e),Number(n));if(t==null){s(`Enter a valid weight and height.`),a(null);return}s(``),a(t)}function l(){t(``),r(``),a(null),s(``)}return(0,O.jsxs)(`section`,{className:tm,"data-testid":`calc-panel-bsa`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Body Surface Area`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Mosteller formula: BSA (m2) = sqrt(height(cm) x weight(kg) / 3600).`}),(0,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,O.jsx)(dm,{id:`react-bsa-weight`,labelText:`Weight (kg)`,value:e,onChange:t,min:`1`,max:`200`,placeholder:`20`}),(0,O.jsx)(dm,{id:`react-bsa-height`,labelText:`Height (cm)`,value:n,onChange:r,min:`30`,max:`220`,placeholder:`110`})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:c,className:nm,"data-testid":`calc-bsa-calculate`,children:`Calculate`}),(0,O.jsx)(`button`,{type:`button`,onClick:l,className:rm,children:`Clear`})]}),o?(0,O.jsx)(`div`,{className:cm,children:o}):null,i==null?null:(0,O.jsxs)(`div`,{className:sm,"data-testid":`calc-bsa-result`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Mosteller BSA`}),(0,O.jsxs)(`div`,{className:`text-2xl font-semibold`,children:[i.toFixed(3),` m²`]}),(0,O.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[e,` kg, `,n,` cm`]})]})]})}function pm(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(`1`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(``);function m(){let t=tf({weightKg:Number(e),dosePerKg:Number(n),frequencyPerDay:Number(i),maxSingleDoseMg:um(o),concentrationMgPerMl:um(c)});if(t==null){p(`Enter a valid weight, mg/kg dose, and frequency.`),d(null);return}p(``),d(t)}function h(){t(``),r(``),a(`1`),s(``),l(``),d(null),p(``)}return(0,O.jsxs)(`section`,{className:tm,"data-testid":`calc-panel-dose`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Weight-Based Dosing`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generic mg/kg calculator. Always verify medication-specific dosing against formulary and local policy.`}),(0,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,O.jsx)(dm,{id:`react-dose-weight`,labelText:`Patient Weight (kg)`,value:e,onChange:t,min:`1`,max:`200`,placeholder:`15`}),(0,O.jsx)(dm,{id:`react-dose-per-kg`,labelText:`Dose (mg/kg)`,value:n,onChange:r,min:`0.01`,step:`0.01`,placeholder:`10`}),(0,O.jsxs)(`div`,{className:im,children:[(0,O.jsx)(`label`,{htmlFor:`react-dose-frequency`,className:am,children:`Frequency`}),(0,O.jsxs)(`select`,{id:`react-dose-frequency`,value:i,onChange:e=>a(e.target.value),className:om,children:[(0,O.jsx)(`option`,{value:`1`,children:`Once daily`}),(0,O.jsx)(`option`,{value:`2`,children:`Twice daily (BID)`}),(0,O.jsx)(`option`,{value:`3`,children:`Three times daily (TID)`}),(0,O.jsx)(`option`,{value:`4`,children:`Four times daily (QID)`}),(0,O.jsx)(`option`,{value:`6`,children:`Every 4 hours (Q4H)`})]})]}),(0,O.jsx)(dm,{id:`react-dose-max`,labelText:`Max single dose (mg, optional)`,value:o,onChange:s,min:`0`,step:`1`,placeholder:`500`}),(0,O.jsx)(dm,{id:`react-dose-concentration`,labelText:`Concentration (mg/mL, optional)`,value:c,onChange:l,min:`0`,placeholder:`40`})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:m,className:nm,"data-testid":`calc-dose-calculate`,children:`Calculate`}),(0,O.jsx)(`button`,{type:`button`,onClick:h,className:rm,children:`Clear`})]}),f?(0,O.jsx)(`div`,{className:cm,children:f}):null,u==null?null:(0,O.jsx)(`div`,{className:sm,"data-testid":`calc-dose-result`,children:(0,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Single Dose`}),(0,O.jsxs)(`div`,{className:`text-xl font-semibold`,children:[u.singleDoseMg.toFixed(1),` mg`]}),u.capped?(0,O.jsx)(`div`,{className:`text-xs text-red-600`,children:`Capped at max dose`}):null]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Daily Total`}),(0,O.jsxs)(`div`,{className:`text-xl font-semibold`,children:[u.dailyDoseMg.toFixed(1),` mg/day`]}),(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`x `,u.frequencyPerDay,`/day`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:`Volume`}),(0,O.jsx)(`div`,{className:`text-xl font-semibold`,children:u.volumeMl==null?`n/a`:`${u.volumeMl.toFixed(1)} mL`}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`per dose`})]})]})})]})}var mm={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 hm({id:e,labelText:t,value:n,options:r,onChange:i}){return(0,O.jsxs)(`div`,{className:im,children:[(0,O.jsx)(`label`,{htmlFor:e,className:am,children:t}),(0,O.jsx)(`select`,{id:e,value:n,onChange:e=>i(e.target.value),className:om,children:r.map(([e,t])=>(0,O.jsx)(`option`,{value:e,children:t},e))})]})}function gm(){let[e,t]=(0,_.useState)(`child`),[n,r]=(0,_.useState)(`4`),[i,a]=(0,_.useState)(`5`),[o,s]=(0,_.useState)(`6`),c=rf(Number(n),Number(i),Number(o)),l=mm[e];function u(e){t(e),r(`4`),a(`5`),s(`6`)}return(0,O.jsxs)(`section`,{className:tm,"data-testid":`calc-panel-gcs`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Glasgow Coma Scale`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select responses to calculate child/adult or infant-modified GCS. Total score 3-15.`}),(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>u(`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,O.jsx)(`button`,{type:`button`,onClick:()=>u(`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,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,O.jsx)(hm,{id:`react-gcs-eye`,labelText:`Eye Opening`,value:n,options:l.eye,onChange:r}),(0,O.jsx)(hm,{id:`react-gcs-verbal`,labelText:`Verbal Response`,value:i,options:l.verbal,onChange:a}),(0,O.jsx)(hm,{id:`react-gcs-motor`,labelText:`Motor Response`,value:o,options:l.motor,onChange:s})]}),c==null?null:(0,O.jsxs)(`div`,{className:sm,"data-testid":`calc-gcs-result`,children:[(0,O.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:e===`infant`?`Infant-modified GCS`:`Child / adult GCS`}),(0,O.jsxs)(`div`,{className:`text-3xl font-semibold`,children:[`GCS: `,c.total,`/15`]}),(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:c.severity}),(0,O.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:`Interpretation: 13-15 Mild, 9-12 Moderate, 3-8 Severe/Coma.`})]})]})}function _m({pill:e}){return(0,O.jsxs)(`section`,{className:tm,"data-testid":`calc-panel-`+e.id,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary}),(0,O.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,O.jsxs)(`p`,{className:`text-amber-900 dark:text-amber-100`,children:[(0,O.jsx)(`strong`,{children:`Source of truth:`}),` `,e.source,`.`]}),(0,O.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,O.jsx)(`a`,{href:`/#calculators`,className:nm+` inline-block`,children:`Open in legacy viewer`})]})}function vm(){let[e,t]=(0,_.useState)(`aap`),[n,r]=(0,_.useState)(`38`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(`low`),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(``);function g(){let t=Number(i),r=Number(o);if(!Number.isFinite(t)||!Number.isFinite(r)||t<=0||r<=0){h(`Enter hours of life and TSB (mg/dL).`),d(null),p(null);return}if(h(``),e===`aap`){let e=Number(n);if(!Number.isFinite(e)||e<35){h(`AAP 2022 thresholds apply to GA ≥35 weeks.`),d(null);return}d(Mp(e,t,r,c)),p(null)}else p(kp(t,r)),d(null)}let v=u?u.status===`Above Exchange`?`text-red-800 bg-red-100`:u.status===`Above Phototherapy`?`text-red-700 bg-red-50`:`text-green-700 bg-green-50`:``,y=f?f.zone===`High-Risk`?`text-red-800 bg-red-100`:f.zone===`High-Intermediate`?`text-orange-700 bg-orange-50`:f.zone===`Low-Intermediate`?`text-amber-700 bg-amber-50`:`text-green-700 bg-green-50`:``;return(0,O.jsxs)(`section`,{className:tm,"data-testid":`calc-panel-bili`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Bilirubin`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.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,O.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,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e===`aap`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:im,children:[(0,O.jsx)(`label`,{htmlFor:`bili-ga`,className:am,children:`GA (weeks)`}),(0,O.jsx)(`select`,{id:`bili-ga`,className:om,value:n,onChange:e=>r(e.target.value),children:[35,36,37,38,39,40].map(e=>(0,O.jsxs)(`option`,{value:e,children:[e,e===40?`+`:``]},e))})]}),(0,O.jsxs)(`div`,{className:im,children:[(0,O.jsx)(`label`,{htmlFor:`bili-risk`,className:am,children:`Neurotoxicity risk`}),(0,O.jsxs)(`select`,{id:`bili-risk`,className:om,value:c,onChange:e=>l(e.target.value),children:[(0,O.jsx)(`option`,{value:`low`,children:`No risk factors`}),(0,O.jsx)(`option`,{value:`medium`,children:`With risk factors`})]})]})]}),(0,O.jsx)(dm,{id:`bili-hours`,labelText:`Age (hours)`,value:i,onChange:a,min:`0`,max:`336`,placeholder:`48`}),(0,O.jsx)(dm,{id:`bili-tsb`,labelText:`TSB (mg/dL)`,value:o,onChange:s,min:`0`,max:`50`,placeholder:`15`})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,className:nm,onClick:g,"data-testid":`calc-bili-calculate`,children:`Calculate`}),(0,O.jsx)(`button`,{type:`button`,className:rm,onClick:()=>{a(``),s(``),d(null),p(null),h(``)},children:`Clear`})]}),m&&(0,O.jsx)(`div`,{className:cm,children:m}),u&&(0,O.jsxs)(`div`,{className:sm+` space-y-2`,"data-testid":`calc-bili-aap-result`,children:[(0,O.jsx)(`div`,{className:`inline-block px-2 py-1 rounded text-sm font-bold `+v,children:u.status}),(0,O.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,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Phototherapy`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[u.photoThreshold.toFixed(1),` mg/dL`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Exchange`}),(0,O.jsxs)(`div`,{className:`font-semibold text-red-800`,children:[u.exchangeThreshold.toFixed(1),` mg/dL`]})]})]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP 2022 CPG (Kemper et al.). Always use clinical judgment.`})]}),f&&(0,O.jsxs)(`div`,{className:sm+` space-y-2`,"data-testid":`calc-bili-bhutani-result`,children:[(0,O.jsxs)(`div`,{className:`inline-block px-2 py-1 rounded text-sm font-bold `+y,children:[f.zone,` Zone`]}),(0,O.jsxs)(`div`,{className:`text-sm`,children:[`TSB `,o,` mg/dL at `,i,` hours of life`]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`40th %ile`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:f.p40.toFixed(1)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`75th %ile`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:f.p75.toFixed(1)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`95th %ile`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:f.p95.toFixed(1)})]})]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Bhutani 1999 hour-specific risk nomogram for infants ≥35 weeks GA.`})]})]})}function ym(){let[e,t]=(0,_.useState)(`male`),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(``);function u(){let t=Number(n),r=Number(i);if(!Number.isFinite(t)||!Number.isFinite(r)||t<22||t>50||r<=0){l(`Enter GA (22-50 weeks) and weight (grams).`),s(null);return}l(``),s(lf(t,r,e))}let d=o?uf(o.percentile):null,f=d===`SGA`?`text-orange-700 bg-orange-50`:d===`LGA`?`text-amber-700 bg-amber-50`:`text-green-700 bg-green-50`;return(0,O.jsxs)(`section`,{className:tm,"data-testid":`calc-panel-growth`,children:[(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Fenton 2013 Preterm Growth`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Weight-for-gestational-age Z-score + percentile + SGA/AGA/LGA classification.`}),(0,O.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,O.jsxs)(`div`,{className:im,children:[(0,O.jsx)(`label`,{htmlFor:`fenton-sex`,className:am,children:`Sex`}),(0,O.jsxs)(`select`,{id:`fenton-sex`,className:om,value:e,onChange:e=>t(e.target.value),children:[(0,O.jsx)(`option`,{value:`male`,children:`Male`}),(0,O.jsx)(`option`,{value:`female`,children:`Female`})]})]}),(0,O.jsx)(dm,{id:`fenton-ga`,labelText:`GA (weeks)`,value:n,onChange:r,min:`22`,max:`50`,step:`0.1`,placeholder:`32`}),(0,O.jsx)(dm,{id:`fenton-weight`,labelText:`Weight (g)`,value:i,onChange:a,min:`200`,max:`7000`,step:`10`,placeholder:`1500`})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,className:nm,onClick:u,"data-testid":`calc-fenton-calculate`,children:`Calculate`}),(0,O.jsx)(`button`,{type:`button`,className:rm,onClick:()=>{r(``),a(``),s(null),l(``)},children:`Clear`})]}),c&&(0,O.jsx)(`div`,{className:cm,children:c}),o&&d&&(0,O.jsxs)(`div`,{className:sm+` space-y-2`,"data-testid":`calc-fenton-result`,children:[(0,O.jsx)(`div`,{className:`inline-block px-2 py-1 rounded text-sm font-bold `+f,children:d}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Percentile`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[o.percentile.toFixed(1),`%`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Z-score`}),(0,O.jsx)(`div`,{className:`font-semibold`,children:o.z.toFixed(2)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`Median (M)`}),(0,O.jsxs)(`div`,{className:`font-semibold`,children:[Math.round(o.M),` g`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`text-xs uppercase text-muted-foreground`,children:`L / S`}),(0,O.jsxs)(`div`,{className:`font-mono text-xs`,children:[o.L.toFixed(3),` / `,o.S.toFixed(3)]})]})]}),(0,O.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 bm({pill:e}){return e.id===`bsa`?(0,O.jsx)(fm,{}):e.id===`dose`?(0,O.jsx)(pm,{}):e.id===`gcs`?(0,O.jsx)(gm,{}):e.id===`bili`?(0,O.jsx)(vm,{}):e.id===`growth`?(0,O.jsx)(ym,{}):e.id===`bmi`?(0,O.jsx)(Wp,{}):e.id===`vitals`?(0,O.jsx)(qp,{}):e.id===`resus`?(0,O.jsx)(Zp,{}):e.id===`equipment`?(0,O.jsx)(em,{}):(0,O.jsx)(_m,{pill:e})}function xm(){let[e,t]=(0,_.useState)(lm[0].id),n=lm.find(t=>t.id===e)??lm[0];return(0,O.jsxs)(`div`,{className:`max-w-5xl mx-auto p-6 space-y-4`,children:[(0,O.jsxs)(`header`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Calculators`}),(0,O.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,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`calc-subnav`,children:lm.map(n=>(0,O.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,O.jsx)(`span`,{className:`ml-1 text-[10px] opacity-80`,children:`React`}):null]},n.id))}),(0,O.jsx)(bm,{pill:n})]})}var Sm=`rounded-lg border border-border bg-card p-5 space-y-3`,Cm=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`;function wm(){let{data:e,isLoading:t}=k({queryKey:[`auth-me`],queryFn:()=>N.get(`/api/auth/me`),staleTime:5*6e4});return t?(0,O.jsx)(`div`,{className:`max-w-3xl mx-auto p-6`,children:(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Checking permissions…`})}):e?.user.role===`admin`?(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:`Admin Panel`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Registration, users, feature flags, OIDC, email templates, AI prompts, SMTP, saved encounters (site-wide), AI model management, TTS/STT provider selection.`})]}),(0,O.jsxs)(`section`,{className:Sm,"data-testid":`admin-shell`,children:[(0,O.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,O.jsx)(`p`,{className:`text-amber-900 dark:text-amber-100`,children:`Admin sub-sections still live in the legacy viewer. Each one (user management, feature flags, announcements, OIDC config, SMTP, AI prompts, model management, TTS/STT) touches production state immediately when saved — those controls port in discrete follow-up commits with their own tests before they go live in the React tree.`})}),(0,O.jsx)(`a`,{href:`/#admin`,className:Cm+` inline-block`,children:`Open admin in legacy viewer`})]})]}):(0,O.jsx)(`div`,{className:`max-w-3xl mx-auto p-6`,children:(0,O.jsxs)(`section`,{className:Sm,"data-testid":`admin-access-denied`,children:[(0,O.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Admin only`}),(0,O.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.`})]})})}var Tm=new $e({defaultOptions:{queries:{staleTime:3e4,retry:1}}});function Em(){return(0,O.jsxs)(`div`,{className:`max-w-3xl mx-auto p-6 space-y-4`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Pediatric AI Scribe — React client`}),(0,O.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This is the new React tree. The legacy vanilla-JS app still lives at`,` `,(0,O.jsx)(`a`,{href:`/`,className:`underline`,children:`/`}),`.`]}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Ported tabs so far:`}),(0,O.jsxs)(`ul`,{className:`list-disc pl-6 text-sm space-y-1`,children:[(0,O.jsx)(`li`,{children:(0,O.jsx)(oi,{to:`/encounter`,className:`underline`,children:`Encounter HPI`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(oi,{to:`/dictation`,className:`underline`,children:`Dictation HPI`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(oi,{to:`/soap`,className:`underline`,children:`SOAP Note`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(oi,{to:`/sickvisit`,className:`underline`,children:`Sick Visit`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(oi,{to:`/extensions`,className:`underline`,children:`Extensions & Pagers`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(oi,{to:`/faq`,className:`underline`,children:`FAQ`})})]})]})}function Dm(){return(0,O.jsx)(rt,{client:Tm,children:(0,O.jsx)(ri,{basename:`/app`,children:(0,O.jsx)(gr,{children:(0,O.jsxs)(mr,{element:(0,O.jsx)(Oi,{}),children:[(0,O.jsx)(mr,{path:`/`,element:(0,O.jsx)(Em,{})}),(0,O.jsx)(mr,{path:`/encounter`,element:(0,O.jsx)(ku,{})}),(0,O.jsx)(mr,{path:`/dictation`,element:(0,O.jsx)(Ou,{})}),(0,O.jsx)(mr,{path:`/soap`,element:(0,O.jsx)(Au,{})}),(0,O.jsx)(mr,{path:`/sickvisit`,element:(0,O.jsx)(ju,{})}),(0,O.jsx)(mr,{path:`/hospital`,element:(0,O.jsx)(Mu,{})}),(0,O.jsx)(mr,{path:`/chart`,element:(0,O.jsx)(Pu,{})}),(0,O.jsx)(mr,{path:`/wellvisit`,element:(0,O.jsx)(Fu,{})}),(0,O.jsx)(mr,{path:`/vaxschedule`,element:(0,O.jsx)(Iu,{})}),(0,O.jsx)(mr,{path:`/catchup`,element:(0,O.jsx)(Lu,{})}),(0,O.jsx)(mr,{path:`/extensions`,element:(0,O.jsx)(wu,{})}),(0,O.jsx)(mr,{path:`/settings`,element:(0,O.jsx)(vd,{})}),(0,O.jsx)(mr,{path:`/learning`,element:(0,O.jsx)(kd,{})}),(0,O.jsx)(mr,{path:`/peguide`,element:(0,O.jsx)(Yd,{})}),(0,O.jsx)(mr,{path:`/bedside`,element:(0,O.jsx)(cp,{})}),(0,O.jsx)(mr,{path:`/calculators`,element:(0,O.jsx)(xm,{})}),(0,O.jsx)(mr,{path:`/admin`,element:(0,O.jsx)(wm,{})}),(0,O.jsx)(mr,{path:`/faq`,element:(0,O.jsx)(Du,{})}),(0,O.jsx)(mr,{path:`*`,element:(0,O.jsx)(fr,{to:`/`,replace:!0})})]})})})})}(0,v.createRoot)(document.getElementById(`root`)).render((0,O.jsx)(_.StrictMode,{children:(0,O.jsx)(Dm,{})})); |