PageSourceSearch

https://novellia.com/_next/static/chunks/pages/patient/medications-1d60862c156a548c.js

js novellia.com collected 2026-09-24 22:15:42 UTC 20,224 bytes, 1 lines download raw bytes

1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="faf12f46-fb5c-4add-8068-f7ec2cd8f514",e._sentryDebugIdIdentifier="sentry-dbid-faf12f46-fb5c-4add-8068-f7ec2cd8f514")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1441],{14348:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/patient/medications",function(){return t(40245)}])},13199:function(e,n,t){"use strict";t.d(n,{i:function(){return i}});let i={ANCHOR:"anchor",BUTTON:"button"}},6571:function(e,n,t){"use strict";var i=t(85893),o=t(31560),l=t(75097),r=t(74569),a=t(16379),d=t(85896),s=t(32761),c=t(4975),u=t(13199);let p=e=>{let{action:n,styles:t}=e,o=(0,i.jsxs)(i.Fragment,{children:[n.label,(0,i.jsx)(d.m.span,{"aria-hidden":"true",display:"inline-flex",children:(0,i.jsx)(r.A,{icon:c.lJjZ,size:a.E.REG,useCurrentColor:!0})})]});return n.type===u.i.ANCHOR?(0,i.jsx)(d.m.a,{href:n.href,target:n.target,...t,children:o}):(0,i.jsx)(d.m.button,{type:"button",onClick:n.onClick,...t,children:o})},m={display:{base:"flex",lg:"none"},flexDirection:"row",alignItems:"flex-start",gap:"2",width:"100%"},h={display:"flex",flexDirection:"column",flexShrink:0},f={display:"flex",flexDirection:"column",gap:"1",minWidth:0,flex:"1 1 auto"},g={flexShrink:0,mt:"-4px"},x={display:{base:"none",lg:"flex"},flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"4",width:"100%"};n.Z=e=>{var n;let{role:t,header:u,description:b,icon:v,mobileIconAlignment:S="flex-start",action:y,dismiss:C,"data-testid":D,styles:R}=e,E=(0,i.jsx)(d.m.span,{"aria-hidden":"true",...R.iconWrapper,children:v}),j=(0,i.jsx)(d.m.span,{"aria-hidden":"true",...R.iconWrapper,alignItems:S,children:v}),k=(0,i.jsx)(d.m.span,{...R.title,children:u}),T=b&&(0,i.jsx)(d.m.span,{...R.description,children:b}),A=y&&(0,i.jsx)(p,{action:y,styles:R.actionLink}),O=y&&(0,i.jsx)(p,{action:y,styles:{...R.actionLink,alignSelf:"flex-start",justifyContent:"flex-start",pl:0}}),M=C&&(0,i.jsx)(o.Z,{variant:l.g.INHERIT,size:l.r.SM,icon:(0,i.jsx)(r.A,{icon:c.rUE1,size:a.E.REG,useCurrentColor:!0}),onClick:C.onClose,"aria-label":null!==(n=C.ariaLabel)&&void 0!==n?n:"Dismiss"});return(0,i.jsxs)(s.x,{role:t,"data-testid":D,...R.root,children:[(0,i.jsxs)(s.x,{...m,children:[(0,i.jsx)(s.x,{...h,children:j}),(0,i.jsxs)(s.x,{...f,children:[k,T,O]}),C&&(0,i.jsx)(s.x,{...g,children:M})]}),(0,i.jsxs)(s.x,{...x,children:[(0,i.jsxs)(s.x,{...R.content,children:[E,(0,i.jsxs)(s.x,{...R.textStack,children:[k,T]})]}),(y||C)&&(0,i.jsxs)(s.x,{...R.actions,children:[y&&(0,i.jsx)(s.x,{...R.actionOffset,children:A}),C&&(0,i.jsx)(s.x,{...R.dismissWrapper,children:M})]})]})]})}},13593:function(e,n,t){"use strict";t.d(n,{Z:function(){return h}});var i=t(85893),o=t(6571),l=t(74569),r=t(16379),a=t(11946),d=t(94466),s=t(4975),c=t(67294);let u={fontFamily:"body"},p={root:{display:"flex",boxSizing:"border-box",width:"100%",padding:"4",borderRadius:"lg",bg:"badge.info.reversed.foreground",color:"layout.foreground",marginBottom:"5"},content:{display:"flex",alignItems:"center",gap:"4",minWidth:0},iconWrapper:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"10",height:"10",borderRadius:"sm",bg:"layout.card",boxShadow:"0px 1px 2px 0px rgba(17, 17, 26, 0.02), 0px 1px 4px 0px rgba(17, 17, 26, 0.06)"},textStack:{display:"flex",flexDirection:"column",gap:"1",minWidth:0},title:{...u,fontSize:"18px",fontWeight:"semibold",lineHeight:"1.1",letterSpacing:"0.2px"},description:{...u,fontSize:"14px",fontWeight:"normal",lineHeight:"1.6",color:"badge.info.on.color.dark"},actions:{display:"flex",alignSelf:"flex-start",flexShrink:0,marginTop:"-2"},actionLink:{}},m="hideMergeEducationBanner";var h=()=>{let{currentUserFlags:e}=(0,a.Z)(),{getItem:n,setItem:t}=(0,d._)(),[u,h]=(0,c.useState)(!0);return((0,c.useEffect)(()=>{h(!0===n(m))},[]),!u&&(null==e?void 0:e.mergeRecordsEnabled))?(0,i.jsx)(o.Z,{role:"status",header:"Tidy up your health record",description:"See a record more than once? Select two or more records and use merge to combine them into a single view.",icon:(0,i.jsx)(l.A,{icon:s.$tQ3,size:r.E.L,useCurrentColor:!0}),mobileIconAlignment:"center",dismiss:{onClose:()=>{t(m,!0),h(!0)},ariaLabel:"Dismiss merge tip"},"data-testid":"merge-education-banner",styles:p}):null}},98289:function(e,n,t){"use strict";t.d(n,{M:function(){return c}});var i=t(85893),o=t(22218),l=t(19645),r=t(71124),a=t(51039),d=t(4975),s=t(84653);let c={SM:r.$u.SM,MD:r.$u.MD},u=e=>({display:"inline-flex",alignItems:"center",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),flexShrink:0,borderRadius:"".concat(e.shape.borderRadiusTokens[r.cM.EXTRA_SMALL],"px"),backgroundColor:e.palette.layout.muted}),p=e=>({[c.SM]:{height:e.spacing(5),gap:e.spacing(1)},[c.MD]:{height:e.spacing(7),gap:e.spacing(2)}}),m={[c.SM]:o.E4.SM,[c.MD]:o.E4.REG};n.Z=e=>{let{count:n,label:t="records",size:h=c.MD}=e,f="merged"===t?"".concat(n," merged"):(0,a.CZ)(n,"record");return(0,i.jsxs)(s.Z,{sx:e=>({...u(e),...p(e)[h]}),children:[(0,i.jsx)(o.AY,{icon:d.kgl3,size:m[h],colorScheme:r.eL.LAYOUT_ACCENT,colorProperty:r.g8.FOREGROUND,accent:{pathKeys:["1","2"],colorScheme:r.eL.LAYOUT,colorProperty:r.g8.RING}}),h===c.SM?(0,i.jsx)(l.YS,{component:"span",colorScheme:r.eL.LAYOUT,colorProperty:r.g8.FOREGROUND,children:f}):(0,i.jsx)(l.uT,{size:"sm",fontWeight:"semibold",colorScheme:r.eL.LAYOUT,colorProperty:r.g8.FOREGROUND,children:f})]})}},12095:function(e,n,t){"use strict";t.d(n,{V:function(){return i}});let i=(0,t(82457).P)("\n  query PaginatedMedications(\n    $offset: Int, $limit: Int,\n    $sortBy: MedicationSortField, $sortDirection: SortDirection,\n    $searchTerm: String,\n    $statuses: [MedicationStatus!],\
1n    $trackingEnabled: Boolean,\n    $remindersEnabled: Boolean,\n    $startDate: DateTime, $endDate: DateTime,\n    $mergeRecordsEnabled: Boolean! = false\n  ) {\n    paginatedMedications(\n      offset: $offset, limit: $limit,\n      sortBy: $sortBy, sortDirection: $sortDirection,\n      searchTerm: $searchTerm,\n      statuses: $statuses,\n      trackingEnabled: $trackingEnabled,\n      remindersEnabled: $remindersEnabled,\n      startDate: $startDate, endDate: $endDate\n    ) {\n      items {\n        novelliaResourceId\n        name\n        status\n        dosage\n        instructions\n        startDate\n        pinned\n        active\n        createdBy {\n          label\n          source\n        }\n        userGeneratedNotes {\n          content\n          id\n          novelliaResourceId\n          patientPortalResourceType\n          readOnly\n          updatedAt\n        }\n        reminderSchedule {\n          id\n          endDate\n          scheduleTimes {\n            timeOfDay\n          }\n          remindersEnabled\n          adherenceEnabled\n          currentDayAdherence {\n            id\n            createdAt\n            scheduledAtUtc\n            status\n            reminderId\n          }\n        }\n        dataSupportLabel\n        lastEditedAt\n        lastEditedByLabel\n        patientId\n        recordStatus\n        rxNormCode\n        patientPortalResourceType\n        resourceCollections {\n          id\n          name\n          description\n          color\n          icon\n          type\n          entryCount\n        }\n        mergedResource @include(if: $mergeRecordsEnabled) {\n          id\n          recordCount\n          prime {\n            id\n            novelliaResourceId\n            patientPortalResourceType\n          }\n        }\n      }\n      pagination {\n        totalCount\n        offset\n        limit\n        hasNextPage\n      }\n    }\n  }\n")},64142:function(e,n,t){"use strict";var i=t(67294),o=t(6812);n.Z=function(e,n){var t,l,r;let{variables:a,skip:d}=n,[s,c]=(0,i.useState)(0),[u,p]=(0,i.useState)([]),[m,h]=(0,i.useState)(0);(0,i.useEffect)(()=>{c(0)},[JSON.stringify(a)]);let{data:f,loading:g,refetch:x}=(0,o.aM)(e,{skip:d,variables:{...a,offset:s,limit:25},fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first"}),b=g||!!d,v=Object.values(f||{}).find(e=>e&&"object"==typeof e&&"pagination"in e),S=null!==(t=null==v?void 0:v.items)&&void 0!==t?t:[],y=null!==(l=null==v?void 0:v.pagination)&&void 0!==l?l:null,C=JSON.stringify(S),D=(0,i.useRef)("");(0,i.useEffect)(()=>{D.current=""},[JSON.stringify(a)]),(0,i.useEffect)(()=>{C!==D.current&&(D.current=C,0===s?p(S):p(e=>[...e,...S]))},[C,s,m]);let R=null!==(r=null==y?void 0:y.hasNextPage)&&void 0!==r&&r,E=0===s?S:u,j=(0,i.useCallback)(()=>{R&&c(e=>e+25)},[R]),k=(0,i.useCallback)(async()=>{c(0);let e=Object.values((await x({...a,offset:0,limit:25})).data||{}).find(e=>e&&"object"==typeof e&&"pagination"in e);e&&p(e.items)},[x,a]),T=y?{totalCount:y.totalCount,currentCount:E.length,limit:y.limit,onLoadMore:j}:void 0;return{items:E,pagination:y,paginationConfig:T,loading:b,hasMore:R,showMore:j,refetch:k}}},40245:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return el}});var i=t(85893),o=t(67294),l=t(11163),r=t(44567),a=t(60599),d=t(96753),s=t(13593),c=t(71413),u=t(12095),p=t(11946),m=t(64142),h=t(86337),f=t(88840),g=t(52394),x=t(62146),b=t(80885),v=t(35683),S=t(79209),y=t(67880),C=t(12362),D=t(15546),R=t(8689);let E=(e,n,t)=>{if(n)(0,D.L9)("Medication adherence ".concat(t),{page:window.location.pathname,medication_name:e.name,adherence_id:n});else{var i;(0,D.L9)("Manual medication adherence recorded: ".concat(t),{page:window.location.pathname,medication_name:e.name,reminder_schedule_id:Number(null===(i=e.reminderSchedule)||void 0===i?void 0:i.id)})}},j=e=>{let{refetch:n}=e,{currentUser:t}=(0,C.Z)(),{updateAdherence:i,isUpdating:l}=(0,y.M)({onSuccess:n}),[r,a]=(0,o.useState)(!1),[d,s]=(0,o.useState)(null),c=(0,o.useCallback)(e=>n=>{s({medication:e,timeOfDay:n}),a(!0)},[]),u=(0,o.useCallback)(async e=>{var n,o;if(!d)return;a(!1);let{medication:l,timeOfDay:r}=d,s=((null===(n=l.reminderSchedule)||void 0===n?void 0:n.currentDayAdherence)||[]).find(e=>
1(0,b.b4)(e.scheduledAtUtc,null==t?void 0:t.timezone)===r);E(l,null==s?void 0:s.id,e),await i({existingAdherenceId:null==s?void 0:s.id,reminderScheduleId:Number(null===(o=l.reminderSchedule)||void 0===o?void 0:o.id),timeOfDay:r,status:e,medicationName:l.name})},[d,null==t?void 0:t.timezone,i]);return{isSheetOpen:r,selectedDose:d,isUpdating:l,handleDoseClick:c,handleStatusSelect:(0,o.useCallback)(e=>(n,o)=>{var l,r;let a=((null===(l=e.reminderSchedule)||void 0===l?void 0:l.currentDayAdherence)||[]).find(e=>(0,b.b4)(e.scheduledAtUtc,null==t?void 0:t.timezone)===n);E(e,null==a?void 0:a.id,o),i({existingAdherenceId:null==a?void 0:a.id,reminderScheduleId:Number(null===(r=e.reminderSchedule)||void 0===r?void 0:r.id),timeOfDay:n,status:o,medicationName:e.name})},[null==t?void 0:t.timezone,i]),closeSheet:(0,o.useCallback)(()=>a(!1),[]),handleSheetStatusSelect:u}};var k=e=>{let{isSheetOpen:n,selectedDose:t,closeSheet:o,handleSheetStatusSelect:l}=e,r=(0,R.F)(),a=(0,S.jf)(r).filter(e=>"default"!==e.value).map(e=>({label:e.label,iconName:e.iconName,iconColor:e.iconColor,value:e.value}));return(0,i.jsx)(v.yo,{open:n,onClose:o,title:(null==t?void 0:t.medication.name)?"Log ".concat(t.medication.name):"Log Medication",options:a,onOptionSelect:l})},T=t(83472),A=t(79361),O=t(71124),M=t(29295),I=t(4975),N=t(84653),L=t(22347),w=t(58195),Z=t(69421),P=t(22218),$=t(72715),U=t(99324),_=t(34922),B=t(19645),z=t(19888),F=t(93147);let G=e=>{var n,t;return{backgroundColor:null===(n=e.palette.layout)||void 0===n?void 0:n.muted,border:"1px solid ".concat(null===(t=e.palette.layout)||void 0===t?void 0:t.border),borderTop:"none",borderBottomLeftRadius:"".concat(e.shape.borderRadiusTokens[O.cM.SMALL],"px"),borderBottomRightRadius:"".concat(e.shape.borderRadiusTokens[O.cM.SMALL],"px"),display:"flex",flexDirection:"column",gap:"10px",paddingTop:e.spacing(2),paddingBottom:e.spacing(4),paddingLeft:e.spacing(4),paddingRight:e.spacing(4)}},W=e=>({display:"flex",gap:e.spacing(2),alignItems:"center",width:"100%"}),Y=e=>({display:"flex",gap:e.spacing(1),alignItems:"center"}),V=(e,n)=>({position:"fixed",top:"".concat(n.top,"px"),left:"".concat(n.left,"px"),minWidth:"200px",background:e.palette.layout.background,border:"1px solid ".concat(e.palette.layout.border),borderRadius:"".concat(e.shape.borderRadiusTokens[O.cM.MEDIUM],"px"),boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:1300,overflow:"hidden"}),J=e=>({display:"flex",alignItems:"center",padding:e.spacing(3),cursor:"pointer",transition:"background-color 0.2s ease-in-out","&:hover":{backgroundColor:e.palette.layout.muted},"&:not(:last-child)":{borderBottom:"1px solid ".concat(e.palette.layout.border)}}),H=(e,n,t)=>{let i=n.find(n=>(0,b.b4)(n.scheduledAtUtc,t)===e);return i?(0,b.nS)(i.status):"default"};var X=e=>{var n;let{reminderSchedule:t,disabled:l=!1,onDoseClick:r,onStatusSelect:a}=e,d=(0,R.F)(),{isMobile:s}=(0,F.Z)(),{reminderPreferredSmsPhoneNumber:c}=(0,L.F)(),{currentUser:u}=(0,C.Z)(),[p,m]=(0,o.useState)(null),[h,f]=(0,o.useState)({top:0,left:0}),g=(0,o.useRef)(null),x=(0,o.useRef)({}),v=t.adherenceEnabled?(0,S.jf)(d):null;if((0,z.O)(g,()=>m(null),!!p),!(null==t?void 0:null===(n=t.scheduleTimes)||void 0===n?void 0:n.length))return null;let y=t.adherenceEnabled,D=t.remindersEnabled,E=(e,n,t)=>{if(e.stopPropagation(),!l){if(s&&r)r(n);else if(!s){let e=p!==t;if(m(e?t:null),e&&x.current[t]){let e=x.current[t];if(e){let n=e.getBoundingClientRect();f({top:n.bottom+4,left:n.left})}}}}},j=(e,n,t)=>{e.stopPropagation(),null==a||a(n,t),m(null)};return(0,i.jsxs)(N.Z,{sx:G,children:[(0,i.jsxs)(N.Z,{sx:W,children:[(0,i.jsx)(B.uT,{fontWeight:"semibold",colorScheme:O.eL.LAYOUT,colorProperty:O.g8.FOREGROUND,children:y?"Track your dose":"Reminders"}),c&&D&&(0,i.jsxs)(N.Z,{sx:Y,children:[(0,i.jsx)($.A,{icon:I.q5is,size:U.E.SM,colorScheme:O.eL.LAYOUT,colorProperty:O.g8.MUTED_FOREGROUND}),(0,i.jsx)(B.__,{fontWeight:"regular",colorScheme:O.eL.LAYOUT,colorProperty:O.g8.MUTED_FOREGROUND,children:(0,w.u)(c.value)})]})]}),(0,i.jsx)(_.Z,{onScroll:()=>m(null),children:y?t.scheduleTimes.map((e,n)=>{let o="".concat(e.timeOfDay,"-").concat(n),l=(0,b.T7)(e.timeOfDay),r=H(e.timeOfDay,t.currentDayAdherence||[],null==u?void 0:u.timezone),a=(null==v?void 0:v.find(e=>e.value===r))||(null==v?void 0:v.find(e=>"default"===e.value));return(0,i.jsxs)(N.Z,{ref:e=>{x.current[o]=e,p===o&&e&&(g.current=e)},children:[(0,i.jsx)(Z.ZP,{title:l,shape:Z.ce.ROUNDED,iconName:(null==a?void 0:a.iconName)||"CheckmarkInCircle",iconColor:null==a?void 0:a.iconColor,backgroundColor:null==a?void 0:a.backgroundColor,borderColor:null==a?void 0:a.border,color:"taken"===r?d.palette.brandPrimary700:void 0,onClick:n=>E(n,e.timeOfDay,o),showDefaultIcon:!1,hoverBorderColor:"taken"===r?d.palette.secondaryBrand.main:d.palette.layout["muted-foreground"]}
1),!s&&p===o&&v&&(0,i.jsx)(N.Z,{sx:V(d,h),children:v.filter(e=>"default"!==e.value).map(n=>(0,i.jsxs)(N.Z,{onClick:t=>j(t,e.timeOfDay,n.value),sx:J,children:[(0,i.jsx)(P.JO,{iconName:n.iconName,size:P.Jh.MD,color:n.iconColor}),(0,i.jsx)(N.Z,{component:"span",sx:{marginLeft:d.spacing(2)},children:(0,i.jsx)(B.uT,{fontWeight:"bold",colorScheme:O.eL.LAYOUT,colorProperty:O.g8.FOREGROUND,children:n.label})})]},n.value))})]},o)}):t.scheduleTimes.map((e,n)=>(0,i.jsx)(Z.ZP,{title:(0,b.T7)(e.timeOfDay),shape:Z.ce.RECTANGULAR,iconName:"CheckmarkInFilledCircle",iconColor:d.palette.successBrand.pressed,showDefaultIcon:!1},"".concat(e.timeOfDay,"-").concat(n)))})]})};let q=(e,n)=>{var t,i,o,l;return{display:"flex",flexDirection:"column",border:"1px solid ".concat(n?null===(t=e.palette["layout-accent"])||void 0===t?void 0:t.foreground:null===(i=e.palette.layout)||void 0===i?void 0:i.border),borderRadius:"".concat(e.shape.borderRadiusTokens[O.cM.SMALL],"px"),overflow:"hidden","@media (prefers-reduced-motion: no-preference)":{transition:"border-color 0.15s ease, box-shadow 0.15s ease"},"@media (hover: hover)":{"&:hover":n?{borderColor:null===(o=e.palette.secondaryBrand)||void 0===o?void 0:o.hover}:{borderColor:null===(l=e.palette.neutral)||void 0===l?void 0:l.hover,boxShadow:"0 1px 3px 0 rgba(0,0,0,0.08)"}},"& > :first-of-type":{border:"none",borderRadius:0},"& > :last-of-type":{border:"none",borderRadius:0}}};var K=e=>{var n,t;let{medication:l,isUpdatingAdherence:r,onCardClick:a,onEdit:s,onReminderSchedule:u,onDoseClick:p,onStatusSelect:m,refetch:h}=e,f=!!(null===(t=l.reminderSchedule)||void 0===t?void 0:null===(n=t.scheduleTimes)||void 0===n?void 0:n.length),g=!!l.reminderSchedule,x=(0,o.useContext)(A.Dy),b=!!(null==x?void 0:x.enabled)&&x.isSelected(l.novelliaResourceId),v=l.active?[{label:g?"Edit schedule":"Set schedule",icon:I.rjZ2,onClick:e=>{e.stopPropagation(),u(l)}}]:[],S=(0,o.useMemo)(()=>{let e=[];return l.startDate&&e.push({label:"Prescription date",value:(0,M.$X)(l.startDate)}),l.dosage&&e.push({label:"Dosage",value:l.dosage}),e.length>0?e:void 0},[l.startDate,l.dosage]),y=(0,i.jsx)(T.Z,{record:l,onClick:()=>a(l.novelliaResourceId),medicalRecordType:d.ek.MEDICATION,patientPortalResourceType:c.lyM[l.patientPortalResourceType],refetch:h,handleEdit:()=>s(l),customMenuItems:v,supportingInfo:S},l.novelliaResourceId);return f&&l.reminderSchedule?(0,i.jsxs)(N.Z,{sx:e=>q(e,b),children:[y,(0,i.jsx)(X,{reminderSchedule:l.reminderSchedule,disabled:r,onDoseClick:p(l),onStatusSelect:m(l)})]}):y};let Q=[{value:"status",label:"Status (Active → Completed)"},{value:"name",label:"Name (A–Z)"},{value:"date",label:"Date (Newest → Oldest)"}],ee=[{value:"active",label:"Active"},{value:"completed",label:"Completed"}],en=[{value:"tracking",label:"Tracking enabled"},{value:"reminders",label:"Reminders enabled"}],et={status:c.c$N.STATUS,name:c.c$N.NAME,date:c.c$N.DATE},ei={active:c.PTI.ACTIVE,completed:c.PTI.COMPLETED};var eo=()=>{let{currentUserFlags:e,loading:n}=(0,p.Z)(),t=(0,l.useRouter)(),{openModal:b}=(0,h.d)(),[v,S]=(0,o.useState)(""),[y,C]=(0,o.useState)(null),[D,R]=(0,o.useState)("status"),[E,T]=(0,o.useState)(c.SrV.ASC),[A,O]=(0,o.useState)([]),[M,I]=(0,o.useState)(),[N,L]=(0,o.useState)(),w=A.filter(e=>"active"===e||"completed"===e),Z=A.filter(e=>"tracking"===e||"reminders"===e),P=w.map(e=>ei[e]).filter(Boolean),$=!!Z.includes("tracking")||void 0,U=!!Z.includes("reminders")||void 0,_=et[D],{items:B,loading:z,paginationConfig:F,refetch:G}=(0,m.Z)(u.V,{variables:{searchTerm:v||void 0,sortBy:_||void 0,sortDirection:_?E:void 0,statuses:P.length>0?P:void 0,trackingEnabled:$,remindersEnabled:U,startDate:M,endDate:N,mergeRecordsEnabled:!!(null==e?void 0:e.mergeRecordsEnabled)},skip:n}),{isSheetOpen:W,selectedDose:Y,isUpdating:V,handleDoseClick:J,handleStatusSelect:H,closeSheet:X,handleSheetStatusSelect:q}=j({refetch:G}),eo=(0,o.useCallback)(e=>{t.push("".concat(f.i,"/medications/").concat(e))},[t]),el=!!(null==B?void 0:B.length),er=(0,o.useCallback)(e=>{b(r.n.MedicationReminderModal,{medication:e,refetch:G,existingReminderSchedule:e.reminderSchedule})},[b,G]);return(0,i.jsxs)(g.Z,{currType:d.ek.MEDICATION,fullBleed:!0,refetch:G,children:[(0,i.jsx)(x.Z,{title:"Medications",searchPlaceholder:"Search medications",searchValue:v,onSearchChange:S,isLoading:z,isEmpty:!z&&!el,recordTypeLabel:"medication",showBulkMergeAction:!!(null==e?void 0:e.mergeRecordsEnabled),contentBanner:(0,i.jsx)(s.Z,{}),onAddRecord:()=>{C("add")},sortConfig:{options:Q,activeValue:D,onChange:e=>{R(e),"date"===e?T(c.SrV.DESC):T(c.SrV.ASC)},hideClearAll:!0},filterConfig:{title:"Filters",filterGroups:[{title:"Status",options:ee},{title:"Schedule",options:en}],selectedValues:A,onApply:O},dateRangeEnabled:!0,hasActiveDateRange:!!(M||N),onDateRangeChange:(e,n)=>{I(e),L(n)},paginationConfig:F,children:null==B?void 0:B.map(e=>e?(0,i.jsx)(K,{medication:e,isUpdatingAdherence:V,onCardClick:eo,onEdit:C,onReminderSchedule:er,onDoseClick:J,onStatusSelect:H,refetch:G},e.novelliaResourceId):null)}),(0,i.jsx)(a.Z,{open:!!y,onClose:()=>C(null),item:y&&"add"!==y?y:void 0}),(0,i.jsx)(k,{isSheetOpen:W,selectedDose:Y,closeSheet:X,handleSheetStatusSelect:q})]})},el=()=>(0,i.jsx)(eo,{})}},function(e){e.O(0,[6513,4090,4612,3144,4457,7932,4925,983,2906,3472,2146,6391,2888,9774,179],function(){return e(e.s=14348)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.