hplx-feature-library 1.0.306 → 1.0.308

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{APIAction-CsHSrMGS.cjs → APIAction-BPjQvoDr.cjs} +1 -1
  2. package/dist/{APIAction-DzFdW8eA.js → APIAction-Cn6CnUPj.js} +2 -2
  3. package/dist/AllInvestigations/index.js +1 -1
  4. package/dist/AllInvestigationsTable-DKMxC37E.cjs +80 -0
  5. package/dist/{AllInvestigationsTable-B8MboSJv.js → AllInvestigationsTable-o7sUrypz.js} +5718 -5188
  6. package/dist/Attachments/index.js +1 -1
  7. package/dist/{Attachments-CIYueFJF.js → Attachments-Bl0Bb93j.js} +36 -36
  8. package/dist/Attachments-DP1L4bRq.cjs +186 -0
  9. package/dist/NineDots/index.js +1 -1
  10. package/dist/{NineDots-Da4lmzBx.cjs → NineDots-BenIdNn6.cjs} +2 -2
  11. package/dist/{NineDots-BbUchUBX.js → NineDots-BovmR9lR.js} +1 -1
  12. package/dist/PatientAddEdit/index.js +1 -1
  13. package/dist/{PatientAddEdit-CqX2zr_o.js → PatientAddEdit-BsvMkDPi.js} +5 -5
  14. package/dist/{PatientAddEdit-HpPMq8Wc.cjs → PatientAddEdit-CiUyGlRS.cjs} +2 -2
  15. package/dist/PatientPopup/index.js +1 -1
  16. package/dist/{PatientPopupContainer-BwsiKzrc.js → PatientPopupContainer-BjejzoZp.js} +749 -749
  17. package/dist/PatientPopupContainer-CNb0MKZc.cjs +36 -0
  18. package/dist/PediatricsCalculator/index.js +1 -1
  19. package/dist/{PediatricsCalculatorTable-jrIsxnuu.cjs → PediatricsCalculatorTable-Bfnfpscv.cjs} +2 -2
  20. package/dist/{PediatricsCalculatorTable-D3nV9nYm.js → PediatricsCalculatorTable-CoHNZcKB.js} +2 -2
  21. package/dist/{PrintModal-CMsgj0Fx.cjs → PrintModal-BYaI_gvN.cjs} +52 -52
  22. package/dist/{PrintModal-BtXnauIC.js → PrintModal-Dnu4I6Bq.js} +3595 -3619
  23. package/dist/SearchPatients/index.js +1 -1
  24. package/dist/{SearchPatients-U7jvz_P2.js → SearchPatients-BTmBvIpk.js} +3 -3
  25. package/dist/{SearchPatients-CY8PAq3U.cjs → SearchPatients-BURn-eU9.cjs} +1 -1
  26. package/dist/UserProfile/index.js +1 -1
  27. package/dist/{UserProfile-B-Yidset.cjs → UserProfile-BcdsuEnn.cjs} +4 -4
  28. package/dist/{UserProfile-Dvxxt4ck.js → UserProfile-D9u7TGPM.js} +6 -6
  29. package/dist/{common-utils-DDQoB8lH.cjs → common-utils-BmJs-CNu.cjs} +1 -1
  30. package/dist/{common-utils-n9EfxOQR.js → common-utils-fQX0KRKT.js} +1 -1
  31. package/dist/{dayjs.min-CIprbO7P.js → dayjs.min-Dx50Uhvr.js} +15 -15
  32. package/dist/dayjs.min-QUFnA3Sz.cjs +1 -0
  33. package/dist/hplx-feature-library.css +1 -1
  34. package/dist/index-83gl7aAu.cjs +32 -0
  35. package/dist/{index-D_V85bv1.js → index-Cuk4eOa2.js} +19 -19
  36. package/dist/{index-CaEr5pIL.js → index-D-5bovl6.js} +840 -840
  37. package/dist/index-D-bucTJp.cjs +102 -0
  38. package/dist/{index-CJFGOBPb.js → index-DPIXOYYJ.js} +2 -2
  39. package/dist/index-Dsi-BJd2.cjs +17 -0
  40. package/dist/index.js +9 -9
  41. package/dist/print-pdf/index.js +1 -1
  42. package/package.json +2 -2
  43. package/dist/AllInvestigationsTable-smpg1QDK.cjs +0 -80
  44. package/dist/Attachments-CqPAQ0or.cjs +0 -186
  45. package/dist/PatientPopupContainer-Buf3U_bk.cjs +0 -36
  46. package/dist/dayjs.min-B8vCPONb.cjs +0 -1
  47. package/dist/index-B3-chQbw.cjs +0 -102
  48. package/dist/index-CahiknFx.cjs +0 -32
  49. package/dist/index-DfcUmlge.cjs +0 -17
@@ -1,4 +1,4 @@
1
- import { P as f } from "../PediatricsCalculatorTable-D3nV9nYm.js";
1
+ import { P as f } from "../PediatricsCalculatorTable-CoHNZcKB.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./index-B3-chQbw.cjs"),a=require("react"),A=require("./constants/PediatricsCalculatorConstants/index.js"),Me=require("./useClickOutside-DsVG12Cs.cjs"),Se=require("./useOutsideClick-CicUjzPP.cjs"),_e=require("./index-CahiknFx.cjs"),we=a.createContext(null),Ee=()=>{const s=a.useContext(we);if(!s)throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");return s},Te=({effectiveEditMode:s,rowData:l,isSavedToLibrary:g,onSave:_,onCancel:m,onEdit:v,onCheckboxToggle:r})=>{const{variant:C,externallyTriggeredEditMode:w,setRowToDelete:y,openPopupForRow:k}=Ee();return C==="standard"?s?e.jsxRuntimeExports.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ",children:[e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",onClick:_,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xs",className:"hfl-text-Blue_gray-800",children:"Save"})}),e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50",onClick:m,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xs",className:"",children:"Cancel"})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg",children:[e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50",onClick:v,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xs",className:"",children:"Edit"})}),e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",onClick:()=>k?.(l),children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xs",className:"",children:"Copy"})}),e.jsxRuntimeExports.jsx("button",{className:"hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",onClick:()=>y?.(l.rowId)})]}):e.jsxRuntimeExports.jsx(e.Os,{disabled:!w,text:"Save this to Pediatric Calculator Library ",id:l.rowId,size:"md",onClick:r,isMarked:g??!1,checkboxClasses:"hfl-mt-2",checkBoxInnerDivClasses:"hfl-text-Blue-600 hfl-bg-Blue-50"},l.rowId)};function De(s){const{options:l,selectedOption:g,onChangeHandler:_}=s;return e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-2 hfl-h-full hfl-items-center hfl-px-4 hfl-justify-center hfl-py-1",children:l?.map(m=>e.jsxRuntimeExports.jsx("div",{className:"hfl-bg-White hfl-rounded-lg",children:e.jsxRuntimeExports.jsx(e.Ku,{onClick:()=>_&&_(m),hierarchy:g?.label===m.label?"Primary":"Secondary-Grey",size:"sm",textField:m.label,className:g?.label===m.label?"hfl-bg-Blue-600":""})},m.label))})}const Fe="data:image/svg+xml,%3csvg%20width='10'%20height='6'%20viewBox='0%200%2010%206'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0.480062%200.819173C0.650418%200.648817%200.92662%200.648817%201.09698%200.819173L4.71454%204.43674L8.3321%200.819173C8.50246%200.648817%208.77866%200.648817%208.94902%200.819173C9.11937%200.98953%209.11937%201.26573%208.94902%201.43609L5.023%205.36211C4.85264%205.53246%204.57644%205.53246%204.40608%205.36211L0.480062%201.43609C0.309706%201.26573%200.309706%200.98953%200.480062%200.819173Z'%20fill='%23667085'/%3e%3c/svg%3e";function T(s){const{label:l,labelClassName:g,hideDropdownIcon:_,showClearOption:m,isRequiredField:v,btnClassName:r,placeholder:C,options:w,selectedOption:y,onChangeHandler:k,inputValue:b,inputChangeHandler:L,onInputFocusOutEvent:B,inputClassName:i,isSearchable:p,inputType:$,showInput:M,inputSuffix:S,selectedLabel:U,suffixPadding:W,disableInputAutoSize:o,selectedOptions:j,isMulti:f,dropDownItemClickHandler:x,showToggle:q,toggleChangeHandler:D,selectedToggleOption:c,toggleOptionsList:n,border:N,height:E,disabled:I,fieldColor:H,errorMsg:t,showErrorMsg:d,placeholderStyle:u,onInputKeyDown:F,showEmptyDropdownPopup:z=!0,isDropdownFixed:G=!1,dropdownClassName:ie="",wrapperClass:ae="",maxInputLength:re,alternateListBgStyle:ee,showLabelTooltip:R=!1,labelToolTipContent:K="",inputContainerClasses:X="",onInputFocus:Q}=s,[Z,te]=a.useState(!1),[le,Re]=a.useState(null),oe=a.useRef(null),ce=a.useRef(null),pe=a.useRef(null),ue=a.useRef([]),Ce=a.useMemo(()=>w?.filter(h=>h?h.label.toLowerCase().includes((b??"").toLowerCase()):void 0),[b,w]),[ve,de]=a.useState(!1),Ne=()=>{te(!1),f&&L&&L(""),Re(null)},me=a.useCallback(h=>{h.stopPropagation(),I||te(O=>!O)},[I]),ge=(b?.length||0)+2+Number(W||0);Se.useOutsideClick(oe,Ne),a.useEffect(()=>{le!==null&&ue.current[le]&&ue.current[le].scrollIntoView({block:"nearest"})},[le]);const se=a.useCallback(()=>{if(G&&Z){const h=M?ce.current:pe.current,O=oe.current;if(h&&O){const J=h.getBoundingClientRect();O.style.position="fixed",O.style.top=`${window.scrollY?J.bottom+window.scrollY:J.bottom}px`,O.style.left=`${J.left}px`,O.style.width=`${J.width}px`}}},[G,Z,M]);a.useEffect(()=>{if(G)return Z?(se(),window.addEventListener("scroll",se,!0)):window.removeEventListener("scroll",se,!0),()=>{window.removeEventListener("scroll",se,!0)}},[G,se,Z]),Me.useClickOutside(oe,()=>{ve&&B&&B()});const je=h=>{if(f&&x){const O=j?.some(J=>J.value===h.value);x(!!O,h)}},Ie=a.useCallback(async h=>{h.stopPropagation(),Z||te(!0),Q&&await Q()},[Q,Z]);return e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-inline-block hfl-text-left ${ae||""}`,children:[!!l&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-text-Gray-700 hfl-mb-1 hfl-flex",children:[e.jsxRuntimeExports.jsx(e.bs,{type:"Text sm",variant:"Medium",className:g||"",children:`${l}`}),v&&e.jsxRuntimeExports.jsx("span",{className:"hfl-ml-1 hfl-text-Error-600",children:"*"}),R&&e.jsxRuntimeExports.jsx(e.Nu,{variant:"Right",text:K,theme:"dark",children:e.jsxRuntimeExports.jsx("i",{className:"hx_info-filled"})})]}),M?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-items-center hfl-shadow-xs hfl-px-2 ${X||""} ${N||"hfl-border-1"} hfl-rounded-lg hfl-overflow-x-auto ${t?"hfl-border-Error-300":"hfl-border-Gray-300"} ${E||"hfl-h-10"} ${I?"!hfl-bg-Gray-50 !hfl-pointer-events-none":H||"hfl-bg-White"} hover:hfl-border-Primary-300 hover:hfl-shadow-xs-primary`,onClick:I?()=>{}:me,children:[j?.map((h,O)=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Blue-100 hfl-mr-2 hfl-py-1 hfl-px-2 hfl-rounded-sm hfl-font-inter-0 hfl-text-nowrap",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-pointer-events-none",children:h.label}),e.jsxRuntimeExports.jsx("span",{onClick:J=>{J.stopPropagation(),je(h)},className:"hx_close hfl-text-Gray-500 hfl-my-0 hfl-text-[14px] hfl-ml-[1px] hfl-cursor-pointer"})]},`${h.label}-${O}`)),Object.keys(u||{}).length>0&&e.jsxRuntimeExports.jsx("style",{children:`
1
+ "use strict";const e=require("./index-D-bucTJp.cjs"),a=require("react"),A=require("./constants/PediatricsCalculatorConstants/index.js"),Me=require("./useClickOutside-DsVG12Cs.cjs"),Se=require("./useOutsideClick-CicUjzPP.cjs"),_e=require("./index-83gl7aAu.cjs"),we=a.createContext(null),Ee=()=>{const s=a.useContext(we);if(!s)throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");return s},Te=({effectiveEditMode:s,rowData:l,isSavedToLibrary:g,onSave:_,onCancel:m,onEdit:v,onCheckboxToggle:r})=>{const{variant:C,externallyTriggeredEditMode:w,setRowToDelete:y,openPopupForRow:k}=Ee();return C==="standard"?s?e.jsxRuntimeExports.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ",children:[e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",onClick:_,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xs",className:"hfl-text-Blue_gray-800",children:"Save"})}),e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50",onClick:m,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xs",className:"",children:"Cancel"})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg",children:[e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50",onClick:v,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xs",className:"",children:"Edit"})}),e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",onClick:()=>k?.(l),children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xs",className:"",children:"Copy"})}),e.jsxRuntimeExports.jsx("button",{className:"hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",onClick:()=>y?.(l.rowId)})]}):e.jsxRuntimeExports.jsx(e.Oi,{disabled:!w,text:"Save this to Pediatric Calculator Library ",id:l.rowId,size:"md",onClick:r,isMarked:g??!1,checkboxClasses:"hfl-mt-2",checkBoxInnerDivClasses:"hfl-text-Blue-600 hfl-bg-Blue-50"},l.rowId)};function De(s){const{options:l,selectedOption:g,onChangeHandler:_}=s;return e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-2 hfl-h-full hfl-items-center hfl-px-4 hfl-justify-center hfl-py-1",children:l?.map(m=>e.jsxRuntimeExports.jsx("div",{className:"hfl-bg-White hfl-rounded-lg",children:e.jsxRuntimeExports.jsx(e.Ku,{onClick:()=>_&&_(m),hierarchy:g?.label===m.label?"Primary":"Secondary-Grey",size:"sm",textField:m.label,className:g?.label===m.label?"hfl-bg-Blue-600":""})},m.label))})}const Fe="data:image/svg+xml,%3csvg%20width='10'%20height='6'%20viewBox='0%200%2010%206'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0.480062%200.819173C0.650418%200.648817%200.92662%200.648817%201.09698%200.819173L4.71454%204.43674L8.3321%200.819173C8.50246%200.648817%208.77866%200.648817%208.94902%200.819173C9.11937%200.98953%209.11937%201.26573%208.94902%201.43609L5.023%205.36211C4.85264%205.53246%204.57644%205.53246%204.40608%205.36211L0.480062%201.43609C0.309706%201.26573%200.309706%200.98953%200.480062%200.819173Z'%20fill='%23667085'/%3e%3c/svg%3e";function T(s){const{label:l,labelClassName:g,hideDropdownIcon:_,showClearOption:m,isRequiredField:v,btnClassName:r,placeholder:C,options:w,selectedOption:y,onChangeHandler:k,inputValue:b,inputChangeHandler:L,onInputFocusOutEvent:B,inputClassName:i,isSearchable:p,inputType:$,showInput:M,inputSuffix:S,selectedLabel:U,suffixPadding:W,disableInputAutoSize:o,selectedOptions:j,isMulti:f,dropDownItemClickHandler:x,showToggle:q,toggleChangeHandler:D,selectedToggleOption:c,toggleOptionsList:n,border:N,height:E,disabled:I,fieldColor:H,errorMsg:t,showErrorMsg:d,placeholderStyle:u,onInputKeyDown:F,showEmptyDropdownPopup:z=!0,isDropdownFixed:G=!1,dropdownClassName:ie="",wrapperClass:ae="",maxInputLength:re,alternateListBgStyle:ee,showLabelTooltip:R=!1,labelToolTipContent:K="",inputContainerClasses:X="",onInputFocus:Q}=s,[Z,te]=a.useState(!1),[le,Re]=a.useState(null),oe=a.useRef(null),ce=a.useRef(null),pe=a.useRef(null),ue=a.useRef([]),Ce=a.useMemo(()=>w?.filter(h=>h?h.label.toLowerCase().includes((b??"").toLowerCase()):void 0),[b,w]),[ve,de]=a.useState(!1),Ne=()=>{te(!1),f&&L&&L(""),Re(null)},me=a.useCallback(h=>{h.stopPropagation(),I||te(O=>!O)},[I]),ge=(b?.length||0)+2+Number(W||0);Se.useOutsideClick(oe,Ne),a.useEffect(()=>{le!==null&&ue.current[le]&&ue.current[le].scrollIntoView({block:"nearest"})},[le]);const se=a.useCallback(()=>{if(G&&Z){const h=M?ce.current:pe.current,O=oe.current;if(h&&O){const J=h.getBoundingClientRect();O.style.position="fixed",O.style.top=`${window.scrollY?J.bottom+window.scrollY:J.bottom}px`,O.style.left=`${J.left}px`,O.style.width=`${J.width}px`}}},[G,Z,M]);a.useEffect(()=>{if(G)return Z?(se(),window.addEventListener("scroll",se,!0)):window.removeEventListener("scroll",se,!0),()=>{window.removeEventListener("scroll",se,!0)}},[G,se,Z]),Me.useClickOutside(oe,()=>{ve&&B&&B()});const je=h=>{if(f&&x){const O=j?.some(J=>J.value===h.value);x(!!O,h)}},Ie=a.useCallback(async h=>{h.stopPropagation(),Z||te(!0),Q&&await Q()},[Q,Z]);return e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-inline-block hfl-text-left ${ae||""}`,children:[!!l&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-text-Gray-700 hfl-mb-1 hfl-flex",children:[e.jsxRuntimeExports.jsx(e.bi,{type:"Text sm",variant:"Medium",className:g||"",children:`${l}`}),v&&e.jsxRuntimeExports.jsx("span",{className:"hfl-ml-1 hfl-text-Error-600",children:"*"}),R&&e.jsxRuntimeExports.jsx(e.Nu,{variant:"Right",text:K,theme:"dark",children:e.jsxRuntimeExports.jsx("i",{className:"hx_info-filled"})})]}),M?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-items-center hfl-shadow-xs hfl-px-2 ${X||""} ${N||"hfl-border-1"} hfl-rounded-lg hfl-overflow-x-auto ${t?"hfl-border-Error-300":"hfl-border-Gray-300"} ${E||"hfl-h-10"} ${I?"!hfl-bg-Gray-50 !hfl-pointer-events-none":H||"hfl-bg-White"} hover:hfl-border-Primary-300 hover:hfl-shadow-xs-primary`,onClick:I?()=>{}:me,children:[j?.map((h,O)=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Blue-100 hfl-mr-2 hfl-py-1 hfl-px-2 hfl-rounded-sm hfl-font-inter-0 hfl-text-nowrap",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-pointer-events-none",children:h.label}),e.jsxRuntimeExports.jsx("span",{onClick:J=>{J.stopPropagation(),je(h)},className:"hx_close hfl-text-Gray-500 hfl-my-0 hfl-text-[14px] hfl-ml-[1px] hfl-cursor-pointer"})]},`${h.label}-${O}`)),Object.keys(u||{}).length>0&&e.jsxRuntimeExports.jsx("style",{children:`
2
2
  input.input-placeholder::placeholder {
3
3
  font-family: ${u?.fontFamily};
4
4
  font-weight: ${u?.fontWeight};
@@ -6,4 +6,4 @@
6
6
  font-size: ${u?.fontSize};
7
7
  color: ${u?.color};
8
8
  }
9
- `}),e.jsxRuntimeExports.jsx("input",{ref:ce,style:o?{}:{width:`${Number(b?.length)>4?(b?.length||0)+5:12}ch`},type:$,placeholder:C,value:b,className:`input-placeholder hfl-flex-1 hfl-pl-2 hfl-placeholder hfl-py-1 focus-visible:hfl-outline-0 focus-visible:hfl-outline-none hfl-border-0 focus:hfl-border-0 ${I?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":H||"hfl-bg-White"} ${i||""}`,onChange:h=>{L&&L(h.target.value),de(!0)},onClick:Ie,onKeyDown:h=>F&&F(h,te,ce),maxLength:re??re,...s.inputProps||{}}),!_&&!m&&e.jsxRuntimeExports.jsx("i",{className:"hx_down hfl-mx-2"}),m&&e.jsxRuntimeExports.jsx("i",{className:`${b?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(y?.value||b)&&(L&&L(""),de(!0))}}),S?e.jsxRuntimeExports.jsx("span",{style:{left:`${ge<2?"3":ge}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:S}):null]}),d&&e.jsxRuntimeExports.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:t})]}):e.jsxRuntimeExports.jsxs("button",{ref:pe,onClick:me,className:`hfl-w-full hfl-bg-White hfl-py-[6px] hfl-px-4 hfl-rounded-lg hfl-inline-flex hfl-justify-between hfl-items-center ${r||""} ${N||"hfl-border-1"} ${t?"hfl-border-Error-300":"hfl-border-Gray-300"} ${E||"hfl-h-[40px]"} ${I?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:U||y?.label?{}:u?{fontFamily:u?.fontFamily,fontSize:u?.fontSize,fontWeight:u?.fontWeight,lineHeight:u?.lineHeight,color:u?.color}:{},children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-pr-4",children:U||y?.label||C||"Select an option"}),e.jsxRuntimeExports.jsx("img",{src:Fe,alt:"down arrow"})]}),w&&w?.length>=0&&e.jsxRuntimeExports.jsxs("ul",{ref:oe,className:`custom-dropdown-menu ${Z?"hfl-visible":"hfl-invisible"} hfl-absolute hfl-z-50 hfl-grid hfl-gap-1 hfl-mt-3 hfl-w-full hfl-rounded-lg hfl-shadow-lg hfl-bg-White hfl-font-inter-0 hfl-p-1 hfl-px-2 ${f?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${ie}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[q?e.jsxRuntimeExports.jsx(De,{onChangeHandler:D,selectedOption:c,options:n}):!1,(p?Ce:w)?.map((h,O)=>{const J=f?!!j?.some(fe=>fe.value===h?.value):!1,be=y?.value===h?.value,ke=le===O;return h?e.jsxRuntimeExports.jsx("li",{onClick:()=>{f?je(h):(k&&k(h),te(!1),de(!1))},className:`hfl-text-1 hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item ${ee?"odd:hfl-bg-Gray-100":""} ${be?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":be,tabIndex:ke?0:-1,ref:fe=>{ue.current[O]=fe},children:f?e.jsxRuntimeExports.jsx(e.Os,{size:"sm",disabled:!1,text:e.jsxRuntimeExports.jsx("span",{children:h.label}),secondaryText:"",id:`${h.label}-${O}`,isMarked:J}):h.label},`${h.label}-${O}`):null}),w?.length===0&&z&&e.jsxRuntimeExports.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}var he,ye;function Oe(){if(ye)return he;ye=1;var s="Expected a function",l=NaN,g="[object Symbol]",_=/^\s+|\s+$/g,m=/^[-+]0x[0-9a-f]+$/i,v=/^0b[01]+$/i,r=/^0o[0-7]+$/i,C=parseInt,w=typeof e.commonjsGlobal=="object"&&e.commonjsGlobal&&e.commonjsGlobal.Object===Object&&e.commonjsGlobal,y=typeof self=="object"&&self&&self.Object===Object&&self,k=w||y||Function("return this")(),b=Object.prototype,L=b.toString,B=Math.max,i=Math.min,p=function(){return k.Date.now()};function $(o,j,f){var x,q,D,c,n,N,E=0,I=!1,H=!1,t=!0;if(typeof o!="function")throw new TypeError(s);j=W(j)||0,M(f)&&(I=!!f.leading,H="maxWait"in f,D=H?B(W(f.maxWait)||0,j):D,t="trailing"in f?!!f.trailing:t);function d(R){var K=x,X=q;return x=q=void 0,E=R,c=o.apply(X,K),c}function u(R){return E=R,n=setTimeout(G,j),I?d(R):c}function F(R){var K=R-N,X=R-E,Q=j-K;return H?i(Q,D-X):Q}function z(R){var K=R-N,X=R-E;return N===void 0||K>=j||K<0||H&&X>=D}function G(){var R=p();if(z(R))return ie(R);n=setTimeout(G,F(R))}function ie(R){return n=void 0,t&&x?d(R):(x=q=void 0,c)}function ae(){n!==void 0&&clearTimeout(n),E=0,x=N=q=n=void 0}function re(){return n===void 0?c:ie(p())}function ee(){var R=p(),K=z(R);if(x=arguments,q=this,N=R,K){if(n===void 0)return u(N);if(H)return n=setTimeout(G,j),d(N)}return n===void 0&&(n=setTimeout(G,j)),c}return ee.cancel=ae,ee.flush=re,ee}function M(o){var j=typeof o;return!!o&&(j=="object"||j=="function")}function S(o){return!!o&&typeof o=="object"}function U(o){return typeof o=="symbol"||S(o)&&L.call(o)==g}function W(o){if(typeof o=="number")return o;if(U(o))return l;if(M(o)){var j=typeof o.valueOf=="function"?o.valueOf():o;o=M(j)?j+"":j}if(typeof o!="string")return o===0?o:+o;o=o.replace(_,"");var f=v.test(o);return f||r.test(o)?C(o.slice(2),f?2:8):m.test(o)?l:+o}return he=$,he}var Le=Oe();const Be=e.getDefaultExportFromCjs(Le),xe=(s,l)=>{const g=parseFloat(s),_=parseFloat(l);if(!s||!l||isNaN(g)||isNaN(_)||_===0)return"";const m=g/_;return Number.isInteger(m)?m.toString(10):m.toFixed(3).replace(/\.?0+$/,"")},Y=s=>/^(\d+)?(\.)?(\d*)?$/.test(s),V=({label:s,children:l})=>e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[e.jsxRuntimeExports.jsxs("span",{className:"hfl-flex-shrink-0",children:[s,":"]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:l})]}),P=({label:s,value:l})=>e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[e.jsxRuntimeExports.jsxs("span",{className:"hfl-flex-shrink-0",children:[s,":"]}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:l||"--"})]}),ne=({children:s,className:l=""})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${l}`,children:s}),$e=a.memo(function({rowData:l,isEditing:g,setIsEditing:_,onSaveRow:m,allowCustomMedicineInput:v}){const{variant:r,externallyTriggeredEditMode:C,externallyTriggeredEditRowIds:w,getMedicineOptions:y,onRowChange:k,onRowDelete:b}=Ee(),[L,B]=a.useState([]),[i,p]=a.useState(l),[$,M]=a.useState(l.medicine_name);a.useEffect(()=>{g||M(l.medicine_name)},[l.medicine_name,g]),a.useEffect(()=>{g||p(l)},[l,g]);const S=async t=>(await y?.(t))?.map(u=>({label:u.doctorMedicineName,value:u}))||[],W=C||w?.includes(l.rowId)||g,o=a.useMemo(()=>i.out_of_range||l.out_of_range,[i.out_of_range,l.out_of_range]),j=a.useMemo(()=>i?.isDosageMismatch||l?.isDosageMismatch,[i?.isDosageMismatch,l?.isDosageMismatch]),f=a.useMemo(()=>i.calculation_type===A.C_MedicineCalculatorList[0]?i.calculation_fields:null,[i.calculation_fields,i.calculation_type]),x=a.useMemo(()=>i.calculation_type===A.C_MedicineCalculatorList[1]?i.calculation_fields:null,[i.calculation_fields,i.calculation_type]),q=(t,d)=>{let u;if(t==="calculation_type"){const F=d,z={frequency:i.calculation_fields.frequency,pedia_dosage:r==="standard"?i.calculation_fields.pedia_dosage:i.pedia_dosage};u={...i,calculation_type:F,calculation_fields:F==="mg/kg/dose"?{...A.C_DefaultMgKgFields,...z}:{...A.C_DefaultMlKgFields,...z}}}else u={...i,[t]:d};p(u),r==="prescription"&&D(u,t)},D=a.useMemo(()=>Be((t,d)=>{k?.(t,d||void 0)},500),[k]),c=a.useMemo(()=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mb-1 hfl-flex hfl-w-max hfl-items-center hfl-rounded hfl-border-1 hfl-border-Warning-400 hfl-bg-Warning-50 hfl-p-1 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_warning hfl-text-Error-400"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceed safety limits"})]}),[]);a.useEffect(()=>()=>{D.cancel()},[D]);const n=a.useCallback((t,d)=>{p(u=>{let F={...u.calculation_fields,[t]:d};if(t==="frequency"&&r==="standard"){const G=A.C_FrequencyDosageMap[d]||[];G.length>0&&(F={...F,pedia_dosage:G[0]})}const z={...u,calculation_fields:F};return r==="prescription"&&D(z,t),z})},[D,r]),N=async()=>{const t={...i,calculation_fields:{...i.calculation_fields}};await m?.(t)&&D({...t,isNewlyAdded:!1,isEditing:!1})},E=async()=>{if(!l.medicine_name||l.medicine_name.trim()===""){b?.(l.rowId);return}p(l),r==="standard"&&_(!1)},I=t=>r==="prescription"&&(t==="medicine_name"||t==="generic_name"||t==="type"||t==="calculation_type")?!1:W,H=()=>{const t=!(i?.isSavedToLibrary??!1),d={...i,isSavedToLibrary:t};p(d),D(d,"isSavedToLibrary")};return e.jsxRuntimeExports.jsxs("div",{className:`medicine-row hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-px-2 hfl-py-1 hfl-border-b-1 hfl-border-Gray-200 ${W?"hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50":""} ${r==="prescription"&&!i.pedia_data_available?"hfl-hidden":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("medicine_name")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:i.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async t=>{if(q("medicine_name",t),t.trim()){const d=await S(t);B(d)}else B([])},onInputFocus:async()=>{const t=await S(i.medicine_name);B(t)},onChangeHandler:t=>{const d=t.value,u=A.C_MedicineTypeList.find(F=>F.val===d.medicineType);p(F=>({...F,medicine_name:d.doctorMedicineName,medicine_id:d.medicineId,generic_name:d.doctorGenericName,type:u?.type??""})),M(d.doctorMedicineName)},options:L,isSearchable:!0,placeholder:"Search medicine",disabled:!i?.isNewlyAdded,inputProps:{onBlur:t=>{const d=t.relatedTarget;if(!(d&&d.closest(".custom-dropdown-menu"))&&!v){const u=i.medicine_name?.trim()||"";L.some(z=>z.label===u)||p(z=>({...z,medicine_name:$}))}}}}):e.jsxRuntimeExports.jsx(ne,{children:l.medicine_name})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("generic_name")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:i.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:t=>q("generic_name",t),hideDropdownIcon:!0}):e.jsxRuntimeExports.jsx(ne,{children:l.generic_name})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("type")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const t=A.C_MedicineTypeList.find(d=>d.type===i.type);return t?{label:t.type,value:t.type}:void 0})(),options:A.C_MedicineTypeList.map(t=>({label:t.type,value:t.type})),onChangeHandler:t=>q("type",t.value)}):e.jsxRuntimeExports.jsx(ne,{children:l.type||""})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("calculation_type")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:i.calculation_type,value:i.calculation_type},options:A.C_MedicineCalculatorList.map(t=>({label:t,value:t})),onChangeHandler:t=>q("calculation_type",t.value)}):e.jsxRuntimeExports.jsx(ne,{children:l.calculation_type})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:I("calculation_fields")?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(V,{label:"Drug Strength",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.drug_strength||"",inputChangeHandler:t=>{Y(t)&&n("drug_strength",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Dose/mg/kg",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.dose_mg_kg||"",inputChangeHandler:t=>{Y(t)&&n("dose_mg_kg",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Frequency",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:i.calculation_fields.frequency?{label:i.calculation_fields.frequency,value:i.calculation_fields.frequency}:void 0,options:A.C_MedicineFrequencyList.map(t=>({label:t,value:t})),onChangeHandler:t=>{n("frequency",t.value)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Dose (mg)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.max_mg_dose||"",inputChangeHandler:t=>{Y(t)&&n("max_mg_dose",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Day (mg)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.max_mg_day||"",inputChangeHandler:t=>{Y(t)&&n("max_mg_day",t)}})})]}),x&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(V,{label:"Drug Strength/mL",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.drug_strength||"",inputChangeHandler:t=>{Y(t)&&(n("drug_strength",t),n("dose_ml_kg",xe(x.dose_mg_kg,t)))}})}),e.jsxRuntimeExports.jsx(V,{label:"Dose/mg/kg",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.dose_mg_kg||"",inputChangeHandler:t=>{Y(t)&&(n("dose_mg_kg",t),n("dose_ml_kg",xe(t,x.drug_strength)))}})}),e.jsxRuntimeExports.jsx(V,{label:"Dose/mL/kg",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",disabled:!0,placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:xe(x.dose_mg_kg,x.drug_strength)||"",inputChangeHandler:t=>{Y(t)&&n("dose_ml_kg",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Frequency",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:i.calculation_fields.frequency?{label:i.calculation_fields.frequency,value:i.calculation_fields.frequency}:void 0,options:A.C_MedicineFrequencyList.map(t=>({label:t,value:t})),onChangeHandler:t=>{n("frequency",t.value)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Dose (mL)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.max_ml_dose||"",inputChangeHandler:t=>{Y(t)&&n("max_ml_dose",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Day (mL)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.max_ml_day||"",inputChangeHandler:t=>{Y(t)&&n("max_ml_day",t)}})})]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P,{label:"Drug Strength",value:f.drug_strength}),e.jsxRuntimeExports.jsx(P,{label:"Dose/mg/kg",value:f.dose_mg_kg}),e.jsxRuntimeExports.jsx(P,{label:"Frequency",value:f.frequency}),e.jsxRuntimeExports.jsx(P,{label:"Max Dose (mg)",value:f.max_mg_dose}),e.jsxRuntimeExports.jsx(P,{label:"Max Day (mg)",value:f.max_mg_day})]}),x&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P,{label:"Drug Strength/mL",value:x.drug_strength}),e.jsxRuntimeExports.jsx(P,{label:"Dose/mg/kg",value:x.dose_mg_kg}),e.jsxRuntimeExports.jsx(P,{label:"Dose/mL/kg",value:x.dose_ml_kg}),e.jsxRuntimeExports.jsx(P,{label:"Frequency",value:x.frequency}),e.jsxRuntimeExports.jsx(P,{label:"Max Dose (mL)",value:x.max_ml_dose}),e.jsxRuntimeExports.jsx(P,{label:"Max Day (mL)",value:x.max_ml_day})]})]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("pedia_dosage")?(()=>{const t=i.calculation_fields.frequency,d=A.C_FrequencyDosageMap[t]||[];return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:r!=="standard",disableInputAutoSize:!0,inputValue:r==="standard"?i.calculation_fields.pedia_dosage:i.pedia_dosage,inputChangeHandler:u=>r==="prescription"?q("pedia_dosage",u):n("pedia_dosage",u),selectedOption:r==="standard"?{label:i.calculation_fields.pedia_dosage,value:i.calculation_fields.pedia_dosage}:void 0,options:r!=="prescription"?d.map(u=>({label:u,value:u})):void 0,onChangeHandler:r!=="prescription"?u=>n("pedia_dosage",u.value):void 0,hideDropdownIcon:r==="prescription",showEmptyDropdownPopup:r!=="prescription",showErrorMsg:r==="prescription"?o||j:!1,errorMsg:r==="prescription"&&o?"Dosage Exceeds Safety Limits":r==="prescription"&&j?"Dosage is in mismatch with selected type of Frequency":""})})})():e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[e.jsxRuntimeExports.jsx(ne,{children:r==="prescription"?l.pedia_dosage:l.calculation_fields.pedia_dosage}),o&&c]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:e.jsxRuntimeExports.jsx(Te,{effectiveEditMode:W,rowData:l,isSavedToLibrary:i.isSavedToLibrary??!1,onSave:N,onCancel:E,onEdit:()=>_(!0),onCheckboxToggle:H})})]})},(s,l)=>s.isEditing===l.isEditing&&s.rowData.rowId===l.rowData.rowId&&s.rowData.isEditing===l.rowData.isEditing&&s.rowData.medicine_name===l.rowData.medicine_name&&s.rowData.generic_name===l.rowData.generic_name&&s.rowData.type===l.rowData.type&&s.rowData.pedia_dosage===l.rowData.pedia_dosage&&s.rowData.calculation_type===l.rowData.calculation_type&&JSON.stringify(s.rowData.calculation_fields)===JSON.stringify(l.rowData.calculation_fields)&&s.rowData.out_of_range===l.rowData.out_of_range&&s.rowData.isDosageMismatch===l.rowData.isDosageMismatch&&s.rowData.calculation_fields.pedia_dosage===l.rowData.calculation_fields.pedia_dosage&&s.rowData?.isNewlyAdded===l.rowData?.isNewlyAdded&&s.rowData?.pedia_data_available===l.rowData?.pedia_data_available),qe=s=>{const{openState:l,closePopupCallback:g,headingIconFile:_,headingText:m,subHeadingText:v,positiveButtonText:r,negativeButtonText:C,classNamePositiveBtn:w,classNameNegativeBtn:y,positiveActionCallback:k,negativeActionCallback:b}=s;return e.jsxRuntimeExports.jsxs(_e.Modal,{isOpen:l,onRequestClose:g,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",alignContent:"center",justifyContent:"center",zIndex:1030,display:l?"block":"none"},content:{zIndex:1030,padding:"24px",maxWidth:"750px",maxHeight:"600px",width:"400px",height:"fit-content",margin:"auto",borderRadius:"12px",overflow:"unset",display:l?"block":"none"}},children:[_=="warning"&&e.jsxRuntimeExports.jsx("div",{className:"hfl-hx_warning hfl-mb-4 hfl-flex hfl-h-12 hfl-w-12 hfl-items-center hfl-justify-center hfl-rounded-full hfl-border-8 hfl-border-Warning-50 hfl-bg-Warning-100 hfl-text-Warning-600",children:e.jsxRuntimeExports.jsx("i",{className:"hx_warning hfl-text-5"})}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xl",className:"hfl-mt-5 hfl-text-Gray-900",children:m}),v&&e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-mt-1 hfl-text-Gray-500 ",children:v}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4",children:[C&&e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:C,hierarchy:"Primary",className:y||"",onClick:b,"data-qa":"negative-action"}),r&&e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:r,hierarchy:"Secondary",className:w||"",onClick:k,"data-qa":"positive-action"})]})]})},He=({open:s,onCancel:l,onCopySave:g,rowMedicineData:_,getMedicineOptions:m})=>{const[v,r]=a.useState([]),[C,w]=a.useState(""),[y,k]=a.useState([]),b=a.useCallback(async p=>{const M=(await m?.(p))?.map(S=>({label:S.doctorMedicineName,value:S}));k(M||[])},[m]);a.useEffect(()=>{s&&b(C)},[C,b,s]);const L=p=>{const $=p.value;v.some(S=>S.medicineId===$.medicineId&&S.doctorMedicineName.trim().toLowerCase()===$.doctorMedicineName.trim().toLowerCase())||r(S=>[...S,$]),w(""),k([])},B=p=>{r($=>$.filter(M=>M.medicineId!==p))},i=async()=>{C.trim()||await b("")};return e.jsxRuntimeExports.jsxs(_e.Modal,{isOpen:s,onRequestClose:l,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1030},content:{zIndex:1031,maxWidth:"600px",maxHeight:"50vh",height:"auto",margin:"auto",borderRadius:"12px",padding:"0px",display:"flex",flexDirection:"column"}},children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Bold",type:"Text lg",className:"hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",children:"Please select medicine to copy"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-px-6 hfl-py-5 hfl-flex hfl-flex-col hfl-gap-6 hfl-overflow-y-auto hfl-flex-1",children:[e.jsxRuntimeExports.jsx(T,{inputValue:C,showInput:!0,isSearchable:!0,disableInputAutoSize:!0,inputChangeHandler:w,onChangeHandler:L,onInputFocus:i,options:y,placeholder:"Search for medicines"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-wrap hfl-gap-2",children:v.map(p=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-nowrap",children:p.doctorMedicineName}),e.jsxRuntimeExports.jsx("button",{className:"hfl-text-Blue_gray-800",onClick:()=>B(p.medicineId),children:e.jsxRuntimeExports.jsx("i",{className:"hx_close"})})]},p.doctorMedicineName+p.medicineId))})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-end hfl-gap-2.5 hfl-bg-Gray-50 hfl-px-7 hfl-py-3 hfl-border-t hfl-border-Gray-200",children:[e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:"Cancel",onClick:l,hierarchy:"Secondary-Grey"}),e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:"Save",disabled:!v||v.length==0,onClick:async()=>{await g(_,v)&&l()},className:"hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",hierarchy:"Primary"})]})]})},ze=a.forwardRef(({data:s=[],variant:l,externallyTriggeredEditRowIds:g=[],externallyTriggeredEditMode:_=!1,allowCustomMedicineInput:m=!0,getMedicineOptions:v,onRowChange:r,onRowDelete:C,onRowCopy:w,onSaveRow:y,externalSaveTrigger:k,setSearchDisabled:b},L)=>{const[B,i]=a.useState(null),[p,$]=a.useState(!1),[M,S]=a.useState(),U=a.useCallback((c,n,N)=>{const E=s.find(H=>H.rowId===c);if(!E)return;const I={...E,...n};r?.(I,N||void 0)},[s,r]),W=a.useCallback(async()=>{const c=s.filter(n=>n.isEditing&&n.medicine_name);if(c.length!==0)try{await y?.(c)&&c.forEach(N=>{r?.({...N,isEditing:!1})})}catch(n){console.error("Bulk save failed",n)}finally{b?.(!1)}},[s,y,r,b]);a.useEffect(()=>{k&&W()},[k,W]),a.useEffect(()=>{const c=s.some(n=>n.isEditing);b?.(c)},[s,b]);const o=a.useCallback(c=>{S(c),$(!0)},[]),j=a.useCallback(async()=>{if(B)try{await C?.(B)}catch(c){console.error("Delete failed",c)}finally{i(null)}},[B,C]),f=a.useCallback(()=>{i(null)},[]),x=a.useCallback(async c=>{try{return await y?.([c])?(r?.({...c,isEditing:!1}),!0):!1}catch(n){return console.error("Save row failed",n),!1}},[y,r]),q=a.useCallback(async()=>{const c=s.filter(n=>n.isEditing&&n.medicine_name);if(c.length===0)return!0;try{const n=await y?.(c);return n&&s.map(E=>E.isEditing?{...E,isEditing:!1}:E).forEach(E=>r?.(E)),!!n}catch(n){return console.error("External bulk save failed",n),!1}},[s,y,r]);a.useImperativeHandle(L,()=>({triggerExternalSave:q}));const D={variant:l,externallyTriggeredEditMode:_,externallyTriggeredEditRowIds:g,getMedicineOptions:v,onRowChange:(c,n)=>{U(c.rowId,c,n),r?.(c,n)},onRowDelete:C,onRowCopy:w,setRowToDelete:i,openPopupForRow:o};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-border-1 hfl-border-Gray-200",children:[e.jsxRuntimeExports.jsx("div",{className:"table-header hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-py-2 hfl-px-2 hfl-font-bold hfl-border-b-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50",children:A.C_Table_Column_Name.map(c=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600",children:c},c))}),e.jsxRuntimeExports.jsxs(we.Provider,{value:D,children:[e.jsxRuntimeExports.jsx("div",{className:"table-body",children:s.length===0?e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3",children:"No medicines added"}):s.map(c=>e.jsxRuntimeExports.jsx($e,{rowData:c,isEditing:c.isEditing||!1,setIsEditing:n=>U(c.rowId,{isEditing:n}),onSaveRow:x,allowCustomMedicineInput:m},c.rowId))}),e.jsxRuntimeExports.jsx(qe,{headingText:"Delete Medicine",subHeadingText:"Are you sure you want to delete this medicine?",openState:!!B,positiveButtonText:"Delete",negativeButtonText:"Cancel",positiveActionCallback:j,negativeActionCallback:f,classNameNegativeBtn:"hfl-bg-Blue-600",classNamePositiveBtn:"hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",closePopupCallback:f}),e.jsxRuntimeExports.jsx(He,{open:p,onCancel:()=>$(!1),onCopySave:w,rowMedicineData:M,getMedicineOptions:v})]})]})});exports.PediatricsCalculatorTable=ze;
9
+ `}),e.jsxRuntimeExports.jsx("input",{ref:ce,style:o?{}:{width:`${Number(b?.length)>4?(b?.length||0)+5:12}ch`},type:$,placeholder:C,value:b,className:`input-placeholder hfl-flex-1 hfl-pl-2 hfl-placeholder hfl-py-1 focus-visible:hfl-outline-0 focus-visible:hfl-outline-none hfl-border-0 focus:hfl-border-0 ${I?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":H||"hfl-bg-White"} ${i||""}`,onChange:h=>{L&&L(h.target.value),de(!0)},onClick:Ie,onKeyDown:h=>F&&F(h,te,ce),maxLength:re??re,...s.inputProps||{}}),!_&&!m&&e.jsxRuntimeExports.jsx("i",{className:"hx_down hfl-mx-2"}),m&&e.jsxRuntimeExports.jsx("i",{className:`${b?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(y?.value||b)&&(L&&L(""),de(!0))}}),S?e.jsxRuntimeExports.jsx("span",{style:{left:`${ge<2?"3":ge}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:S}):null]}),d&&e.jsxRuntimeExports.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:t})]}):e.jsxRuntimeExports.jsxs("button",{ref:pe,onClick:me,className:`hfl-w-full hfl-bg-White hfl-py-[6px] hfl-px-4 hfl-rounded-lg hfl-inline-flex hfl-justify-between hfl-items-center ${r||""} ${N||"hfl-border-1"} ${t?"hfl-border-Error-300":"hfl-border-Gray-300"} ${E||"hfl-h-[40px]"} ${I?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:U||y?.label?{}:u?{fontFamily:u?.fontFamily,fontSize:u?.fontSize,fontWeight:u?.fontWeight,lineHeight:u?.lineHeight,color:u?.color}:{},children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-pr-4",children:U||y?.label||C||"Select an option"}),e.jsxRuntimeExports.jsx("img",{src:Fe,alt:"down arrow"})]}),w&&w?.length>=0&&e.jsxRuntimeExports.jsxs("ul",{ref:oe,className:`custom-dropdown-menu ${Z?"hfl-visible":"hfl-invisible"} hfl-absolute hfl-z-50 hfl-grid hfl-gap-1 hfl-mt-3 hfl-w-full hfl-rounded-lg hfl-shadow-lg hfl-bg-White hfl-font-inter-0 hfl-p-1 hfl-px-2 ${f?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${ie}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[q?e.jsxRuntimeExports.jsx(De,{onChangeHandler:D,selectedOption:c,options:n}):!1,(p?Ce:w)?.map((h,O)=>{const J=f?!!j?.some(fe=>fe.value===h?.value):!1,be=y?.value===h?.value,ke=le===O;return h?e.jsxRuntimeExports.jsx("li",{onClick:()=>{f?je(h):(k&&k(h),te(!1),de(!1))},className:`hfl-text-1 hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item ${ee?"odd:hfl-bg-Gray-100":""} ${be?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":be,tabIndex:ke?0:-1,ref:fe=>{ue.current[O]=fe},children:f?e.jsxRuntimeExports.jsx(e.Oi,{size:"sm",disabled:!1,text:e.jsxRuntimeExports.jsx("span",{children:h.label}),secondaryText:"",id:`${h.label}-${O}`,isMarked:J}):h.label},`${h.label}-${O}`):null}),w?.length===0&&z&&e.jsxRuntimeExports.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}var he,ye;function Oe(){if(ye)return he;ye=1;var s="Expected a function",l=NaN,g="[object Symbol]",_=/^\s+|\s+$/g,m=/^[-+]0x[0-9a-f]+$/i,v=/^0b[01]+$/i,r=/^0o[0-7]+$/i,C=parseInt,w=typeof e.commonjsGlobal=="object"&&e.commonjsGlobal&&e.commonjsGlobal.Object===Object&&e.commonjsGlobal,y=typeof self=="object"&&self&&self.Object===Object&&self,k=w||y||Function("return this")(),b=Object.prototype,L=b.toString,B=Math.max,i=Math.min,p=function(){return k.Date.now()};function $(o,j,f){var x,q,D,c,n,N,E=0,I=!1,H=!1,t=!0;if(typeof o!="function")throw new TypeError(s);j=W(j)||0,M(f)&&(I=!!f.leading,H="maxWait"in f,D=H?B(W(f.maxWait)||0,j):D,t="trailing"in f?!!f.trailing:t);function d(R){var K=x,X=q;return x=q=void 0,E=R,c=o.apply(X,K),c}function u(R){return E=R,n=setTimeout(G,j),I?d(R):c}function F(R){var K=R-N,X=R-E,Q=j-K;return H?i(Q,D-X):Q}function z(R){var K=R-N,X=R-E;return N===void 0||K>=j||K<0||H&&X>=D}function G(){var R=p();if(z(R))return ie(R);n=setTimeout(G,F(R))}function ie(R){return n=void 0,t&&x?d(R):(x=q=void 0,c)}function ae(){n!==void 0&&clearTimeout(n),E=0,x=N=q=n=void 0}function re(){return n===void 0?c:ie(p())}function ee(){var R=p(),K=z(R);if(x=arguments,q=this,N=R,K){if(n===void 0)return u(N);if(H)return n=setTimeout(G,j),d(N)}return n===void 0&&(n=setTimeout(G,j)),c}return ee.cancel=ae,ee.flush=re,ee}function M(o){var j=typeof o;return!!o&&(j=="object"||j=="function")}function S(o){return!!o&&typeof o=="object"}function U(o){return typeof o=="symbol"||S(o)&&L.call(o)==g}function W(o){if(typeof o=="number")return o;if(U(o))return l;if(M(o)){var j=typeof o.valueOf=="function"?o.valueOf():o;o=M(j)?j+"":j}if(typeof o!="string")return o===0?o:+o;o=o.replace(_,"");var f=v.test(o);return f||r.test(o)?C(o.slice(2),f?2:8):m.test(o)?l:+o}return he=$,he}var Le=Oe();const Be=e.getDefaultExportFromCjs(Le),xe=(s,l)=>{const g=parseFloat(s),_=parseFloat(l);if(!s||!l||isNaN(g)||isNaN(_)||_===0)return"";const m=g/_;return Number.isInteger(m)?m.toString(10):m.toFixed(3).replace(/\.?0+$/,"")},Y=s=>/^(\d+)?(\.)?(\d*)?$/.test(s),V=({label:s,children:l})=>e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[e.jsxRuntimeExports.jsxs("span",{className:"hfl-flex-shrink-0",children:[s,":"]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:l})]}),P=({label:s,value:l})=>e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[e.jsxRuntimeExports.jsxs("span",{className:"hfl-flex-shrink-0",children:[s,":"]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:l||"--"})]}),ne=({children:s,className:l=""})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${l}`,children:s}),$e=a.memo(function({rowData:l,isEditing:g,setIsEditing:_,onSaveRow:m,allowCustomMedicineInput:v}){const{variant:r,externallyTriggeredEditMode:C,externallyTriggeredEditRowIds:w,getMedicineOptions:y,onRowChange:k,onRowDelete:b}=Ee(),[L,B]=a.useState([]),[i,p]=a.useState(l),[$,M]=a.useState(l.medicine_name);a.useEffect(()=>{g||M(l.medicine_name)},[l.medicine_name,g]),a.useEffect(()=>{g||p(l)},[l,g]);const S=async t=>(await y?.(t))?.map(u=>({label:u.doctorMedicineName,value:u}))||[],W=C||w?.includes(l.rowId)||g,o=a.useMemo(()=>i.out_of_range||l.out_of_range,[i.out_of_range,l.out_of_range]),j=a.useMemo(()=>i?.isDosageMismatch||l?.isDosageMismatch,[i?.isDosageMismatch,l?.isDosageMismatch]),f=a.useMemo(()=>i.calculation_type===A.C_MedicineCalculatorList[0]?i.calculation_fields:null,[i.calculation_fields,i.calculation_type]),x=a.useMemo(()=>i.calculation_type===A.C_MedicineCalculatorList[1]?i.calculation_fields:null,[i.calculation_fields,i.calculation_type]),q=(t,d)=>{let u;if(t==="calculation_type"){const F=d,z={frequency:i.calculation_fields.frequency,pedia_dosage:r==="standard"?i.calculation_fields.pedia_dosage:i.pedia_dosage};u={...i,calculation_type:F,calculation_fields:F==="mg/kg/dose"?{...A.C_DefaultMgKgFields,...z}:{...A.C_DefaultMlKgFields,...z}}}else u={...i,[t]:d};p(u),r==="prescription"&&D(u,t)},D=a.useMemo(()=>Be((t,d)=>{k?.(t,d||void 0)},500),[k]),c=a.useMemo(()=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mb-1 hfl-flex hfl-w-max hfl-items-center hfl-rounded hfl-border-1 hfl-border-Warning-400 hfl-bg-Warning-50 hfl-p-1 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_warning hfl-text-Error-400"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceed safety limits"})]}),[]);a.useEffect(()=>()=>{D.cancel()},[D]);const n=a.useCallback((t,d)=>{p(u=>{let F={...u.calculation_fields,[t]:d};if(t==="frequency"&&r==="standard"){const G=A.C_FrequencyDosageMap[d]||[];G.length>0&&(F={...F,pedia_dosage:G[0]})}const z={...u,calculation_fields:F};return r==="prescription"&&D(z,t),z})},[D,r]),N=async()=>{const t={...i,calculation_fields:{...i.calculation_fields}};await m?.(t)&&D({...t,isNewlyAdded:!1,isEditing:!1})},E=async()=>{if(!l.medicine_name||l.medicine_name.trim()===""){b?.(l.rowId);return}p(l),r==="standard"&&_(!1)},I=t=>r==="prescription"&&(t==="medicine_name"||t==="generic_name"||t==="type"||t==="calculation_type")?!1:W,H=()=>{const t=!(i?.isSavedToLibrary??!1),d={...i,isSavedToLibrary:t};p(d),D(d,"isSavedToLibrary")};return e.jsxRuntimeExports.jsxs("div",{className:`medicine-row hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-px-2 hfl-py-1 hfl-border-b-1 hfl-border-Gray-200 ${W?"hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50":""} ${r==="prescription"&&!i.pedia_data_available?"hfl-hidden":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("medicine_name")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:i.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async t=>{if(q("medicine_name",t),t.trim()){const d=await S(t);B(d)}else B([])},onInputFocus:async()=>{const t=await S(i.medicine_name);B(t)},onChangeHandler:t=>{const d=t.value,u=A.C_MedicineTypeList.find(F=>F.val===d.medicineType);p(F=>({...F,medicine_name:d.doctorMedicineName,medicine_id:d.medicineId,generic_name:d.doctorGenericName,type:u?.type??""})),M(d.doctorMedicineName)},options:L,isSearchable:!0,placeholder:"Search medicine",disabled:!i?.isNewlyAdded,inputProps:{onBlur:t=>{const d=t.relatedTarget;if(!(d&&d.closest(".custom-dropdown-menu"))&&!v){const u=i.medicine_name?.trim()||"";L.some(z=>z.label===u)||p(z=>({...z,medicine_name:$}))}}}}):e.jsxRuntimeExports.jsx(ne,{children:l.medicine_name})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("generic_name")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:i.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:t=>q("generic_name",t),hideDropdownIcon:!0}):e.jsxRuntimeExports.jsx(ne,{children:l.generic_name})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("type")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const t=A.C_MedicineTypeList.find(d=>d.type===i.type);return t?{label:t.type,value:t.type}:void 0})(),options:A.C_MedicineTypeList.map(t=>({label:t.type,value:t.type})),onChangeHandler:t=>q("type",t.value)}):e.jsxRuntimeExports.jsx(ne,{children:l.type||""})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("calculation_type")?e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:i.calculation_type,value:i.calculation_type},options:A.C_MedicineCalculatorList.map(t=>({label:t,value:t})),onChangeHandler:t=>q("calculation_type",t.value)}):e.jsxRuntimeExports.jsx(ne,{children:l.calculation_type})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:I("calculation_fields")?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(V,{label:"Drug Strength",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.drug_strength||"",inputChangeHandler:t=>{Y(t)&&n("drug_strength",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Dose/mg/kg",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.dose_mg_kg||"",inputChangeHandler:t=>{Y(t)&&n("dose_mg_kg",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Frequency",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:i.calculation_fields.frequency?{label:i.calculation_fields.frequency,value:i.calculation_fields.frequency}:void 0,options:A.C_MedicineFrequencyList.map(t=>({label:t,value:t})),onChangeHandler:t=>{n("frequency",t.value)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Dose (mg)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.max_mg_dose||"",inputChangeHandler:t=>{Y(t)&&n("max_mg_dose",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Day (mg)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.max_mg_day||"",inputChangeHandler:t=>{Y(t)&&n("max_mg_day",t)}})})]}),x&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(V,{label:"Drug Strength/mL",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.drug_strength||"",inputChangeHandler:t=>{Y(t)&&(n("drug_strength",t),n("dose_ml_kg",xe(x.dose_mg_kg,t)))}})}),e.jsxRuntimeExports.jsx(V,{label:"Dose/mg/kg",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.dose_mg_kg||"",inputChangeHandler:t=>{Y(t)&&(n("dose_mg_kg",t),n("dose_ml_kg",xe(t,x.drug_strength)))}})}),e.jsxRuntimeExports.jsx(V,{label:"Dose/mL/kg",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",disabled:!0,placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:xe(x.dose_mg_kg,x.drug_strength)||"",inputChangeHandler:t=>{Y(t)&&n("dose_ml_kg",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Frequency",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:i.calculation_fields.frequency?{label:i.calculation_fields.frequency,value:i.calculation_fields.frequency}:void 0,options:A.C_MedicineFrequencyList.map(t=>({label:t,value:t})),onChangeHandler:t=>{n("frequency",t.value)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Dose (mL)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.max_ml_dose||"",inputChangeHandler:t=>{Y(t)&&n("max_ml_dose",t)}})}),e.jsxRuntimeExports.jsx(V,{label:"Max Day (mL)",children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.max_ml_day||"",inputChangeHandler:t=>{Y(t)&&n("max_ml_day",t)}})})]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P,{label:"Drug Strength",value:f.drug_strength}),e.jsxRuntimeExports.jsx(P,{label:"Dose/mg/kg",value:f.dose_mg_kg}),e.jsxRuntimeExports.jsx(P,{label:"Frequency",value:f.frequency}),e.jsxRuntimeExports.jsx(P,{label:"Max Dose (mg)",value:f.max_mg_dose}),e.jsxRuntimeExports.jsx(P,{label:"Max Day (mg)",value:f.max_mg_day})]}),x&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P,{label:"Drug Strength/mL",value:x.drug_strength}),e.jsxRuntimeExports.jsx(P,{label:"Dose/mg/kg",value:x.dose_mg_kg}),e.jsxRuntimeExports.jsx(P,{label:"Dose/mL/kg",value:x.dose_ml_kg}),e.jsxRuntimeExports.jsx(P,{label:"Frequency",value:x.frequency}),e.jsxRuntimeExports.jsx(P,{label:"Max Dose (mL)",value:x.max_ml_dose}),e.jsxRuntimeExports.jsx(P,{label:"Max Day (mL)",value:x.max_ml_day})]})]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:I("pedia_dosage")?(()=>{const t=i.calculation_fields.frequency,d=A.C_FrequencyDosageMap[t]||[];return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(T,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:r!=="standard",disableInputAutoSize:!0,inputValue:r==="standard"?i.calculation_fields.pedia_dosage:i.pedia_dosage,inputChangeHandler:u=>r==="prescription"?q("pedia_dosage",u):n("pedia_dosage",u),selectedOption:r==="standard"?{label:i.calculation_fields.pedia_dosage,value:i.calculation_fields.pedia_dosage}:void 0,options:r!=="prescription"?d.map(u=>({label:u,value:u})):void 0,onChangeHandler:r!=="prescription"?u=>n("pedia_dosage",u.value):void 0,hideDropdownIcon:r==="prescription",showEmptyDropdownPopup:r!=="prescription",showErrorMsg:r==="prescription"?o||j:!1,errorMsg:r==="prescription"&&o?"Dosage Exceeds Safety Limits":r==="prescription"&&j?"Dosage is in mismatch with selected type of Frequency":""})})})():e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[e.jsxRuntimeExports.jsx(ne,{children:r==="prescription"?l.pedia_dosage:l.calculation_fields.pedia_dosage}),o&&c]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:e.jsxRuntimeExports.jsx(Te,{effectiveEditMode:W,rowData:l,isSavedToLibrary:i.isSavedToLibrary??!1,onSave:N,onCancel:E,onEdit:()=>_(!0),onCheckboxToggle:H})})]})},(s,l)=>s.isEditing===l.isEditing&&s.rowData.rowId===l.rowData.rowId&&s.rowData.isEditing===l.rowData.isEditing&&s.rowData.medicine_name===l.rowData.medicine_name&&s.rowData.generic_name===l.rowData.generic_name&&s.rowData.type===l.rowData.type&&s.rowData.pedia_dosage===l.rowData.pedia_dosage&&s.rowData.calculation_type===l.rowData.calculation_type&&JSON.stringify(s.rowData.calculation_fields)===JSON.stringify(l.rowData.calculation_fields)&&s.rowData.out_of_range===l.rowData.out_of_range&&s.rowData.isDosageMismatch===l.rowData.isDosageMismatch&&s.rowData.calculation_fields.pedia_dosage===l.rowData.calculation_fields.pedia_dosage&&s.rowData?.isNewlyAdded===l.rowData?.isNewlyAdded&&s.rowData?.pedia_data_available===l.rowData?.pedia_data_available),qe=s=>{const{openState:l,closePopupCallback:g,headingIconFile:_,headingText:m,subHeadingText:v,positiveButtonText:r,negativeButtonText:C,classNamePositiveBtn:w,classNameNegativeBtn:y,positiveActionCallback:k,negativeActionCallback:b}=s;return e.jsxRuntimeExports.jsxs(_e.Modal,{isOpen:l,onRequestClose:g,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",alignContent:"center",justifyContent:"center",zIndex:1030,display:l?"block":"none"},content:{zIndex:1030,padding:"24px",maxWidth:"750px",maxHeight:"600px",width:"400px",height:"fit-content",margin:"auto",borderRadius:"12px",overflow:"unset",display:l?"block":"none"}},children:[_=="warning"&&e.jsxRuntimeExports.jsx("div",{className:"hfl-hx_warning hfl-mb-4 hfl-flex hfl-h-12 hfl-w-12 hfl-items-center hfl-justify-center hfl-rounded-full hfl-border-8 hfl-border-Warning-50 hfl-bg-Warning-100 hfl-text-Warning-600",children:e.jsxRuntimeExports.jsx("i",{className:"hx_warning hfl-text-5"})}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xl",className:"hfl-mt-5 hfl-text-Gray-900",children:m}),v&&e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-mt-1 hfl-text-Gray-500 ",children:v}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4",children:[C&&e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:C,hierarchy:"Primary",className:y||"",onClick:b,"data-qa":"negative-action"}),r&&e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:r,hierarchy:"Secondary",className:w||"",onClick:k,"data-qa":"positive-action"})]})]})},He=({open:s,onCancel:l,onCopySave:g,rowMedicineData:_,getMedicineOptions:m})=>{const[v,r]=a.useState([]),[C,w]=a.useState(""),[y,k]=a.useState([]),b=a.useCallback(async p=>{const M=(await m?.(p))?.map(S=>({label:S.doctorMedicineName,value:S}));k(M||[])},[m]);a.useEffect(()=>{s&&b(C)},[C,b,s]);const L=p=>{const $=p.value;v.some(S=>S.medicineId===$.medicineId&&S.doctorMedicineName.trim().toLowerCase()===$.doctorMedicineName.trim().toLowerCase())||r(S=>[...S,$]),w(""),k([])},B=p=>{r($=>$.filter(M=>M.medicineId!==p))},i=async()=>{C.trim()||await b("")};return e.jsxRuntimeExports.jsxs(_e.Modal,{isOpen:s,onRequestClose:l,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1030},content:{zIndex:1031,maxWidth:"600px",maxHeight:"50vh",height:"auto",margin:"auto",borderRadius:"12px",padding:"0px",display:"flex",flexDirection:"column"}},children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Bold",type:"Text lg",className:"hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",children:"Please select medicine to copy"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-px-6 hfl-py-5 hfl-flex hfl-flex-col hfl-gap-6 hfl-overflow-y-auto hfl-flex-1",children:[e.jsxRuntimeExports.jsx(T,{inputValue:C,showInput:!0,isSearchable:!0,disableInputAutoSize:!0,inputChangeHandler:w,onChangeHandler:L,onInputFocus:i,options:y,placeholder:"Search for medicines"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-wrap hfl-gap-2",children:v.map(p=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-nowrap",children:p.doctorMedicineName}),e.jsxRuntimeExports.jsx("button",{className:"hfl-text-Blue_gray-800",onClick:()=>B(p.medicineId),children:e.jsxRuntimeExports.jsx("i",{className:"hx_close"})})]},p.doctorMedicineName+p.medicineId))})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-end hfl-gap-2.5 hfl-bg-Gray-50 hfl-px-7 hfl-py-3 hfl-border-t hfl-border-Gray-200",children:[e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:"Cancel",onClick:l,hierarchy:"Secondary-Grey"}),e.jsxRuntimeExports.jsx(e.Ku,{size:"md",textField:"Save",disabled:!v||v.length==0,onClick:async()=>{await g(_,v)&&l()},className:"hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",hierarchy:"Primary"})]})]})},ze=a.forwardRef(({data:s=[],variant:l,externallyTriggeredEditRowIds:g=[],externallyTriggeredEditMode:_=!1,allowCustomMedicineInput:m=!0,getMedicineOptions:v,onRowChange:r,onRowDelete:C,onRowCopy:w,onSaveRow:y,externalSaveTrigger:k,setSearchDisabled:b},L)=>{const[B,i]=a.useState(null),[p,$]=a.useState(!1),[M,S]=a.useState(),U=a.useCallback((c,n,N)=>{const E=s.find(H=>H.rowId===c);if(!E)return;const I={...E,...n};r?.(I,N||void 0)},[s,r]),W=a.useCallback(async()=>{const c=s.filter(n=>n.isEditing&&n.medicine_name);if(c.length!==0)try{await y?.(c)&&c.forEach(N=>{r?.({...N,isEditing:!1})})}catch(n){console.error("Bulk save failed",n)}finally{b?.(!1)}},[s,y,r,b]);a.useEffect(()=>{k&&W()},[k,W]),a.useEffect(()=>{const c=s.some(n=>n.isEditing);b?.(c)},[s,b]);const o=a.useCallback(c=>{S(c),$(!0)},[]),j=a.useCallback(async()=>{if(B)try{await C?.(B)}catch(c){console.error("Delete failed",c)}finally{i(null)}},[B,C]),f=a.useCallback(()=>{i(null)},[]),x=a.useCallback(async c=>{try{return await y?.([c])?(r?.({...c,isEditing:!1}),!0):!1}catch(n){return console.error("Save row failed",n),!1}},[y,r]),q=a.useCallback(async()=>{const c=s.filter(n=>n.isEditing&&n.medicine_name);if(c.length===0)return!0;try{const n=await y?.(c);return n&&s.map(E=>E.isEditing?{...E,isEditing:!1}:E).forEach(E=>r?.(E)),!!n}catch(n){return console.error("External bulk save failed",n),!1}},[s,y,r]);a.useImperativeHandle(L,()=>({triggerExternalSave:q}));const D={variant:l,externallyTriggeredEditMode:_,externallyTriggeredEditRowIds:g,getMedicineOptions:v,onRowChange:(c,n)=>{U(c.rowId,c,n),r?.(c,n)},onRowDelete:C,onRowCopy:w,setRowToDelete:i,openPopupForRow:o};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-border-1 hfl-border-Gray-200",children:[e.jsxRuntimeExports.jsx("div",{className:"table-header hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-py-2 hfl-px-2 hfl-font-bold hfl-border-b-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50",children:A.C_Table_Column_Name.map(c=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600",children:c},c))}),e.jsxRuntimeExports.jsxs(we.Provider,{value:D,children:[e.jsxRuntimeExports.jsx("div",{className:"table-body",children:s.length===0?e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3",children:"No medicines added"}):s.map(c=>e.jsxRuntimeExports.jsx($e,{rowData:c,isEditing:c.isEditing||!1,setIsEditing:n=>U(c.rowId,{isEditing:n}),onSaveRow:x,allowCustomMedicineInput:m},c.rowId))}),e.jsxRuntimeExports.jsx(qe,{headingText:"Delete Medicine",subHeadingText:"Are you sure you want to delete this medicine?",openState:!!B,positiveButtonText:"Delete",negativeButtonText:"Cancel",positiveActionCallback:j,negativeActionCallback:f,classNameNegativeBtn:"hfl-bg-Blue-600",classNamePositiveBtn:"hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",closePopupCallback:f}),e.jsxRuntimeExports.jsx(He,{open:p,onCancel:()=>$(!1),onCopySave:w,rowMedicineData:M,getMedicineOptions:v})]})]})});exports.PediatricsCalculatorTable=ze;
@@ -1,9 +1,9 @@
1
- import { j as e, b as $, O as Ee, K as oe, N as Re, d as ue, g as We } from "./index-CaEr5pIL.js";
1
+ import { j as e, b as $, O as Ee, K as oe, N as Re, d as ue, g as We } from "./index-D-5bovl6.js";
2
2
  import be, { createContext as Ge, useContext as Ve, useState as G, useRef as pe, useMemo as re, useCallback as W, useEffect as Q, forwardRef as Pe, useImperativeHandle as Ke } from "react";
3
3
  import { C_MedicineCalculatorList as _e, C_FrequencyDosageMap as Me, C_MedicineTypeList as we, C_MedicineFrequencyList as Se, C_DefaultMgKgFields as Je, C_DefaultMlKgFields as Ye, C_Table_Column_Name as Ue } from "./constants/PediatricsCalculatorConstants/index.js";
4
4
  import { u as Xe } from "./useClickOutside-BjJyGTec.js";
5
5
  import { u as Ze } from "./useOutsideClick-C4Q0aGuf.js";
6
- import { M as Fe } from "./index-D_V85bv1.js";
6
+ import { M as Fe } from "./index-Cuk4eOa2.js";
7
7
  const Oe = Ge(null), $e = () => {
8
8
  const a = Ve(Oe);
9
9
  if (!a) throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");