@openmrs/esm-help-menu-app 10.0.1-pre.5745 → 10.0.1-pre.5748
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.
- package/.turbo/turbo-build.log +1 -1
- package/dist/575.js +1 -1
- package/dist/575.js.map +1 -1
- package/dist/openmrs-esm-help-menu-app.js +2 -2
- package/dist/routes.json +1 -1
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
package/dist/575.js
CHANGED
|
@@ -25,4 +25,4 @@ To fix this, ensure that you define the "description" field inside the feature f
|
|
|
25
25
|
To fix this, ensure that you define the "label" field inside the feature flag definition.`,t):console.error(`A feature flag definition in ${e} is missing a name and thus cannot be registered.
|
|
26
26
|
To fix this, ensure that you define the "name" field inside the feature flag definition.`,t);else console.warn(`A feature flag for ${e} could not be registered as it does not appear to have the required properties`,t)})}})(e,t))}function aN(){ak.sort((e,t)=>e.appName.localeCompare(t.appName,"en"));let e=new Map;for(let t of ak){e.has(t.appName)?e.set(t.appName,e.get(t.appName)+1):e.set(t.appName,0);let n=e.get(t.appName),r=`${t.appName}-page-${n}`,o=t.containerDomId??"omrs-apps-container",i=document.getElementById(o),a=`single-spa-application:${r}`;if(i){let e=document.createElement("div");e.id=a,i?.appendChild(e)}else throw Error(`${t.appName} ${t.component} cannot be mounted to "${o}"; DOM element does not exist.`);!function(e,t){let n=void 0!==t.route?t.route:void 0!==t.routeRegex&&new RegExp(t.routeRegex);if(!1===n)return console.warn(`A registered page definition is missing a route and thus cannot be registered.
|
|
27
27
|
To fix this, ensure that you define the "route" (or alternatively the "routeRegex") field inside the extension definition.`,e);if(!t.component)return console.warn(`A registered page definition is missing a component and thus cannot be registered.
|
|
28
|
-
To fix this, ensure that you define the "component" field inside the page definition.`,e);let r=function(e,{featureFlag:t}){return t?n=>!!rM(t)&&e(n):e}(function e(t){if(Array.isArray(t)){let n=t.map(e);return e=>n.some(t=>t(e))}return"string"==typeof t?(0,ts.fz)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,ts.AG)(e,()=>av(t.appName,t.component),r)}(r,t)}}let aE={PHONE_MIN:0,PHONE_MAX:600,TABLET_MIN:601,TABLET_MAX:1023,SMALL_DESKTOP_MIN:1024,SMALL_DESKTOP_MAX:1439,LARGE_DESKTOP_MIN:1440,LARGE_DESKTOP_MAX:Number.MAX_SAFE_INTEGER};function aC(){document.body.classList.toggle("omrs-breakpoint-lt-tablet",window.innerWidth<aE.TABLET_MIN),document.body.classList.toggle("omrs-breakpoint-gt-phone",window.innerWidth>aE.PHONE_MAX),document.body.classList.toggle("omrs-breakpoint-gt-tablet",window.innerWidth>aE.TABLET_MAX),document.body.classList.toggle("omrs-breakpoint-lt-desktop",window.innerWidth<aE.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-small-desktop",window.innerWidth<aE.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-large-desktop",window.innerWidth<aE.LARGE_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-gt-small-desktop",window.innerWidth>aE.SMALL_DESKTOP_MAX)}let aP=!1;function aI(){aP||(window.addEventListener("resize",aC),aC(),aP=!0)}var aA=n(6870),aO=n(5530),aR=n.n(aO);function a$({title:e,children:t}){let n="tablet"===i2();return(0,aA.jsxs)("div",{className:aR()({"-esm-help-menu__card-header-module__tabletHeader___Vkmd-":n,"-esm-help-menu__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,aA.jsx)("h4",{children:e}),t]})}let aT=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],aM={primaryColor:{_type:G.String,_description:"The color for displaying primary diagnoses tags",_default:"blue",_validators:[e7.oneOf(aT)]},secondaryColor:{_type:G.String,_description:"The color for displaying secondary diagnoses tags",_default:"gray",_validators:[e7.oneOf(aT)]}},aL={"Brand color #1":{_default:"#005d5d",_type:G.String},"Brand color #2":{_default:"#004144",_type:G.String},"Brand color #3":{_default:"#007d79",_type:G.String},excludePatientIdentifierCodeTypes:{uuids:{_type:G.Array,_description:"List of UUIDs of patient identifier types to exclude from rendering in the patient banner",_default:[],_elements:{_type:G.UUID}}},implementationName:{_type:G.String,_description:"A name of the place (or authority) where all possible locations a user can choose are located.",_default:"Clinic"},logo:{src:{_type:G.String,_default:"",_description:"The path or URL to the logo shown on the login page and while the server is starting up. If set to an empty string, the default OpenMRS logo is used.",_validators:[e7.isUrl]},alt:{_type:G.String,_default:"Logo",_description:"The alternative text for the logo image, displayed when the image cannot be loaded or on hover."}},patientPhotoConceptUuid:{_type:G.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5",_description:"Used to look up the patient photo, which is stored as an attachment obs. Set to `null` in order to disable the feature and use only generated avatars. To remove the avatars entirely, use extension configuration's `remove` feature."},preferredCalendar:{_type:G.Object,_description:"Keys should be locale codes, and values should be the preferred calendar for that locale. For example, {'am': 'ethiopic'}.",_default:{am:"ethiopic"},_elements:{_validators:[e7.oneOf(["buddhist","chinese","coptic","dangi","ethioaa","ethiopic","gregory","hebrew","indian","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","iso8601","japanese","persian","roc","islamicc"])]}},preferredDateLocale:{_type:G.Object,_description:"Allows setting the locale used for date formatting for any browser locale. Does not affect time formatting. Keys should be locale codes, and values should be the preferred locale for formatting dates. For example, {'en': 'en-US', 'fr-CA': 'en-CA'}.",_default:{en:"en-GB"},_elements:{_type:G.String}},diagnosisTags:aM};var aW=n(8326);let aD={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},aU=e=>(0,aA.jsx)(aW.TableBatchActions,{translateWithId:(e,t)=>{let n=aD[e];return n?tm(n,e,t):e},...e}),aB="-esm-help-menu__custom-overflow-menu-module__container___8PykS",aF="-esm-help-menu__custom-overflow-menu-module__menu___qsOLn",aH="-esm-help-menu__custom-overflow-menu-module__show___BserJ",aV="-esm-help-menu__custom-overflow-menu-module__overflowMenuButton___n86Gz",aG=(0,oF.createContext)(null);function az(){let e=(0,oF.useContext)(aG);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function aq({menuTitle:e,children:t}){let[n,r]=oH().useState(!1),o=i7(()=>r(!1),n),i="tablet"===i2(),a=(0,oF.useCallback)(()=>r(e=>!e),[]),s=(0,oF.useRef)(null),l=(0,oF.useRef)(null),c=(0,oF.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,m=(0,oF.useCallback)(()=>{r(!1),s.current?.focus()},[]),p=(0,oF.useMemo)(()=>({closeMenu:m}),[m]),f=(0,oF.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),m())},[m,n]),h=oF.Children.toArray(t);(0,oF.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let g=(0,oF.useCallback)(({currentIndex:e,direction:t})=>{let n=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,o=Array.from(n).indexOf(r);if(-1===o)return void n[t>0?0:n.length-1]?.focus();let i=o+t,a=i<0?n.length-1:i>=n.length?0:i;n[a]?.focus()},[]),w=h.map((e,t)=>(0,oF.isValidElement)(e)?(0,oF.cloneElement)(e,{closeMenu:m,handleOverflowMenuItemFocus:g,index:t}):e);return(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aB),ref:o,children:[(0,aA.jsx)("button",{className:aR()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},aV),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:a,onKeyDown:f,ref:s,children:e}),(0,aA.jsxs)("div",{className:aR()("cds--overflow-menu-options","cds--overflow-menu--flip",aF,{[aH]:n}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:d,onKeyDown:f,ref:l,role:"menu",tabIndex:-1,children:[(0,aA.jsx)("ul",{className:aR()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,aA.jsx)(aG.Provider,{value:p,children:w})}),(0,aA.jsx)("span",{})]})]})}function aJ(e){let t=(0,oF.useContext)(aG);return(0,aA.jsx)(aW.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var aK=n(2277),aX=n(4194);let aY=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],aZ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),aQ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-add",iconProps:e})})),a0=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),a1=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),a2=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),a5=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),a6=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),a8=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),a3=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),a4=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),a7=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),a9=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),se=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),st=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),sn=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),sr=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),so=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),si=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),sa=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),ss=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),sl=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),sc=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),su=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-close",iconProps:e})})),sd=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),sm=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),sp=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-document",iconProps:e})})),sf=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),sh=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-download",iconProps:e})})),sg=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),sw=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),s_=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),sy=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-events",iconProps:e})})),sv=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),sb=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),sx=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),sS=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),sk=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),sj=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-group",iconProps:e})})),sN=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),sE=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),sC=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),sP=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-information",iconProps:e})})),sI=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),sA=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),sO=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),sR=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),s$=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),sT=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-location",iconProps:e})})),sM=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),sL=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),sW=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),sD=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),sU=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),sB=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),sF=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-money",iconProps:e})})),sH=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),sV=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),sG=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sz=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sq=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-password",iconProps:e})})),sJ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),sK=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),sX=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),sY=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),sZ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),sQ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),s0=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),s1=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-report",iconProps:e})})),s2=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),s5=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-save",iconProps:e})})),s6=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-search",iconProps:e})})),s8=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),s3=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),s4=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),s7=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),s9=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),le=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),lt=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),ln=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-table",iconProps:e})})),lr=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-time",iconProps:e})})),lo=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),li=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),la=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),ls=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),ll=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),lc=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),lu=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),ld=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),lm=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lp=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lf=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-view",iconProps:e})})),lh=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),lg=lh,lw=sf,l_=s$,ly=sC,lv=s7,lb=(0,oF.memo)((0,oF.forwardRef)(function({icon:e,fallback:t,...n},r){let o=(0,oF.useRef)(e?document.getElementById(e):void 0);return(0,oF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(o.current=e?document.getElementById(e):void 0)});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,aA.jsx)(iv,{value:o.current,fallback:t,children:(0,aA.jsx)(lx,{ref:r,icon:e,iconProps:n})})})),lx=(0,oF.memo)((0,oF.forwardRef)(function({icon:e,iconProps:t},n){let{className:r,fill:o,size:i}=Object.assign({},{fill:"currentColor",size:20},t);(i<=0||i>72)&&(console.error(`Invalid size '${i}' specified for ${e}. Defaulting to 20.`),i=20);let a=(0,oF.useRef)(null);return(0,oF.useImperativeHandle)(n,()=>a.current),(0,oF.useEffect)(()=>{a.current&&"currentColor"!==o&&a.current.style.setProperty("--omrs-icon-fill",o)},[]),(0,aA.jsx)("svg",{ref:a,className:aR()("omrs-icon","-esm-help-menu__icons-module__icon___BfFhd",r),height:i,width:i,viewBox:"0 0 16 16",children:(0,aA.jsx)("use",{href:`#${e}`})})})),lS=({path:e,title:t,basePath:n,icon:r})=>{let{t:o}=(0,o9.useTranslation)(),i=(0,aK.zy)(),a=(0,oF.useMemo)(()=>{if(!e)return!1;let t=e.startsWith("/")?e.slice(1):e;if(t.startsWith("http"))return t===window.location.href;let n=t.split("/").map(e=>decodeURIComponent(e)),r=(i.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return r.some((e,t)=>n.every((e,n)=>r[t+n]===e))},[i.pathname,e]);return(0,aA.jsx)("div",{children:(0,aA.jsx)(oG,{className:aR()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${n}/${encodeURIComponent(e)}`,children:(0,aA.jsxs)("span",{className:"-esm-help-menu__dashboard-module__menu___ds1tf",children:[(0,aA.jsx)(lb,{icon:r,className:"-esm-help-menu__dashboard-module__icon___4Zrrh",size:16}),(0,aA.jsx)("span",{children:o(t)})]})})},e)};function lk(e){return function({basePath:t}){return(0,aA.jsx)(aX.Kd,{children:(0,aA.jsx)(lS,{basePath:t,...e})})}}var lj=n(7715),lN=n(7532),lE=n(3692),lC=n(7615),lP=n(700),lI=n(6816),lA=n(1168);function lO(e){return oH().createElement(lA.C,e)}var lR=n(3010),l$=n(6513),lT=n(6190);function lM(e,t,n=!1){if(null==e)return n?e:void 0;if("string"==typeof e&&!e)return n?null:void 0;if(e instanceof lR.ng||e instanceof lR._l||e instanceof lR.Ip)return t?(0,l$.yP)(e,t):e;{let n=au()(e).toDate(),r=new lR.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,l$.yP)(r,t):r}}function lL(e){if(e)return e.toDate((0,lT.Xj)())}var lW=n(9002);function lD(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function lU(e){let t=e??"",n=lD(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function lB(){let e=window.i18next.language,t=lD(e)??e;return"ht"===t&&(t="fr-HT"),t}var lF=n(7883),lH=n(424),lV=n(1492),lG=n(8271);function lz(e,t){var n=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return n.get?n.get.call(e):n.value}ac.extend(ad),ac.extend(lV),ac.extend(lH);let lq="YYYY-MM-DDTHH:mm:ss.SSSZZ";function lJ(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&ac(e,lq).isValid()}function lK(e){return ac(e).isToday()}function lX(e){return lJ(e)?ac(e,lq).toDate():null}function lY(e,t=!1){let n=ac(e);return t&&(n=n.utc()),n.format(lq)}function lZ(e){return ac(e).toDate()}var lQ=new WeakMap;let l0=new class{register(e,t){lz(this,lQ).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lz(this,lQ).has(t))return lz(this,lQ).get(t)}if(e.language&&lz(this,lQ).has(e.language))return lz(this,lQ).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lz(this,lQ).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,lQ,{writable:!0,value:new Map})}};function l1(e,t){l0.register(e,t)}function l2(e){let t=e??lB();return l0.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l5={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l6(e,t={}){let n=lB(),r=(0,lF.CD)(e,n);if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lG.A)(r.day)&&(0,lG.A)(r.month)&&(r=Object.assign({},(0,H.A)(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},(0,H.A)(r,"day"),{date:r.day}));let o=ac().set(r).toDate();return(0,lG.A)(r.year)&&(t.year=!1),(0,lG.A)(r.month)&&(t.month=!1),(0,lG.A)(r.date)&&(t.day=!1),l8(o,t)}function l8(e,t){let n,r=t?.locale??lB(),o=new Intl.Locale(r),{calendar:i,mode:a,time:s,day:l,month:c,year:u,noToday:d,numberingSystem:m}={...l5,...{noToday:"am"===o.language},...t},p={calendar:i??l2(o),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=ac(e).isToday();if(f&&!d)n=(n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(r)+n.slice(1);else{"en"===o.language&&(r="en-GB");let t=new Intl.DateTimeFormat(r,p).formatToParts(e);("en"===o.language||"am"===o.language)&&"standard"==a&&u&&l&&(t=t.map(l3("-"))),"wide"==a&&(t=t.map(l3(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,n)=>"era"!==e.type&&("literal"!==e.type||!(t<n.length-1)||"era"!==n[t+1].type))),n=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(n+=`, ${l4(e)}`),n}let l3=e=>(t,n,r)=>"literal"!==t.type||" "!==t.value||n<r.length-1&&"era"===r[n+1].type?t:{type:"literal",value:e};function l4(e){return e.toLocaleTimeString(lB(),{hour:"2-digit",minute:"2-digit"})}function l7(e,t){return l8(e,{...t,time:!0})}function l9(e,t){let n=l2("string"==typeof t?new Intl.Locale(t):t);return n?(0,l$.yP)(e,(0,lW.d)(n)):e}function ce(e,t){return new Intl.DurationFormat(lB(),t).format(e)}function ct(e,t){if(null==e)return null;if("string"==typeof e){let n=lB(),r=(0,lF.CD)(e,n);return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...(0,H.A)(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...(0,H.A)(r,"day"),...{date:r.day}}),ac(t).set(r))}return ac(e)}let cn=["years","months","days","hours","minutes","seconds"],cr={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},co={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function ci(e,t=ac(),n){let r,o=ac(t),i=ct(e,o);if(null==i)return null;if("string"==typeof n){let e=cr[n]??n;return{[e]:o.diff(i,e)}}let{thresholds:a,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?cr[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=cn.indexOf(n);for(let o=0;o<cn.length;o++){let i=cn[o];if(t.diff(e,i)>0)return o<=r?i:n}return n}(i,o,t??"seconds"):cr[s]??s,function(e,t,n,r){let o=cn.indexOf(n),i=cn.indexOf(r),a=cn.slice(o,i+1),s={},l=e;for(let e of a){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(i,o,e,t??e)}let c=(r=function(e){let t={...co};if(e)for(let[n,r]of Object.entries(e))void 0!==r&&(t[cr[n]??n]=r);return t}(a),o.diff(i,"seconds")<r.seconds?"seconds":o.diff(i,"minutes")<r.minutes?"minutes":o.diff(i,"hours")<r.hours?"hours":o.diff(i,"days")<r.days?"days":o.diff(i,"months")<r.months?"months":"years");return{[c]:o.diff(i,c)}}let ca={style:"short",localeMatcher:"lookup"};function cs(e,t=ac(),n){let r=ci(e,t,n);return null==r?null:ce(r,"object"==typeof n&&n.formatOptions?{...ca,...n.formatOptions}:ca)}let cl=(0,oF.createContext)(null);function cc(){let e=iA({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,oF.useMemo)(()=>{let t=lB();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,oF.useMemo)(()=>{let e=l2(t);return void 0!==e?(0,lW.d)(e):void 0},[t]),r=(0,oF.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),o=(0,oF.useMemo)(()=>n?(0,l$.yP)((0,lT.Ec)((0,lT.Xj)()),n):(0,lT.Ec)((0,lT.Xj)()),[n]);return{calendar:n,intlLocale:r,today_:o}}let cu=new lR.ng(1793,1,1);var cd=n(5830),cm=n(5354),cp=n(4745),cf=n(1202);function ch(e,t){return Number.parseInt(l8(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let cg=(0,oF.forwardRef)(function(e,t){let{className:n}=e,r=(0,oF.useContext)(cd.f2),o=(0,oF.useContext)(cd._I),i=r??o,a=(0,oF.useContext)(cl),s=(0,lT.Xj)(),l=l8(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=ch(i.visibleRange.start.toDate(s),a),u=i.maxValue?ch(i.maxValue.toDate(s),a):void 0,d=i.minValue?ch(i.minValue.toDate(s),a):void 0,m=(0,oF.useCallback)(e=>{i.setFocusedDate(i.focusedDate.cycle("year",e-i.focusedDate.year))},[]);return i&&(0,aA.jsxs)("span",{ref:t,className:n,children:[(0,aA.jsx)("span",{children:l}),(0,aA.jsxs)(cp.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,aA.jsx)(cf.p,{}),(0,aA.jsxs)(lC.Y,{children:[(0,aA.jsx)(lP.$,{slot:"increment",children:(0,aA.jsx)(se,{size:8})}),(0,aA.jsx)(lP.$,{slot:"decrement",children:(0,aA.jsx)(a4,{size:8})})]})]})]})});var cw=n(9588);let c_="-esm-help-menu__datepicker-module__inputGroup___+4zks",cy="-esm-help-menu__datepicker-module__inputSegment___wiExn",cv="-esm-help-menu__datepicker-module__dateInputWrapper___uiyAC",cb="-esm-help-menu__datepicker-module__invalidText___SxtTL",cx="-esm-help-menu__datepicker-module__flatButton___UU1Qp",cS="-esm-help-menu__datepicker-module__flatButtonMd___fhR-1",ck="-esm-help-menu__datepicker-module__flatButtonSm___5INZ7",cj="-esm-help-menu__datepicker-module__flatButtonLg___RFMrl";function cN({children:e}){let t=(0,oF.useContext)(lN.Pg),n=(0,oF.useContext)(lN.a8),r=t??n,o=i7(()=>r?.close());return(0,aA.jsx)(cw.lG,{className:"-esm-help-menu__datepicker-module__dialog___qllIf",ref:o,children:e})}let cE=(0,oF.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},o){let i="range"===e,a=i?cd._e:cd.Vv;return(0,aA.jsx)(cm.A,{ref:o,className:"-esm-help-menu__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,aA.jsx)(cN,{children:(0,aA.jsxs)(a,{...i?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,aA.jsxs)("header",{className:"-esm-help-menu__datepicker-module__header___WAVlD",children:[(0,aA.jsx)(lP.$,{className:aR()(cx,cS),slot:"previous",children:(0,aA.jsx)(ss,{size:16})}),(0,aA.jsx)(cg,{className:"-esm-help-menu__datepicker-module__monthYear___A3aKF"}),(0,aA.jsx)(lP.$,{className:aR()(cx,cS),slot:"next",children:(0,aA.jsx)(sl,{size:16})})]}),(0,aA.jsx)(cd.r8,{className:"-esm-help-menu__datepicker-module__calendarGrid___6qRB2",children:e=>(0,aA.jsx)(cd.Zr,{className:aR()("cds--date-picker__day",{"-esm-help-menu__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cC=n(8017),cP=n(9774),cI=n(7956);let cA=(0,oF.forwardRef)(function(e,t){let n=(0,oF.useContext)(lN.Pg),[r,o]=(0,lj.JT)({slot:e.slot},t,cP.cQ),{locale:i}=(0,lA.Y)(),a=(0,cI.F)({...r,locale:i,createCalendar:lW.d}),s=(0,oF.useRef)(null),{fieldProps:l,inputProps:c}=(0,cC.cJ)({...r,inputRef:s},a,o),u=(0,oF.useCallback)(()=>{a.isDisabled||n.toggle()},[]);return(0,aA.jsxs)(lj.Kq,{values:[[cP.$,a],[cf.E,{...c,ref:s}],[lC.t,{...l,ref:o,isInvalid:a.isInvalid}]],children:[(0,aA.jsx)(lC.Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:a.isDisabled,isInvalid:a.isInvalid,onClick:u,children:a.segments.map((t,n)=>(0,oF.cloneElement)(e.children(t),{key:n}))}),(0,aA.jsx)(cf.p,{})]})}),cO=(0,oF.forwardRef)(function(e,t){let n=(0,oF.useContext)(lN.Pg),r=(0,oF.useContext)(lN.a8);return(n??r).isInvalid?(0,aA.jsx)(lh,{ref:t,size:16,...e}):(0,aA.jsx)(a3,{ref:t,size:16,...e})});var cR=n(64),c$=n(5503),cT=n(1697),cM=n(7866),cL=n(8035),cW=n(2231);let cD=(0,oF.forwardRef)(function({segment:e,...t},n){let r=(0,oF.useContext)(cP.$),o=(0,cR.U)(n),{segmentProps:i}=(0,c$.V)(e,r,o),{focusProps:a,isFocused:s,isFocusVisible:l}=(0,cT.o)(),{hoverProps:c,isHovered:u}=(0,cM.M)({...t,isDisabled:r.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:r,defaultClassName:o,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,oF.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:o}):t,l="function"==typeof n?n({...s,defaultStyle:a||{}}):n,c="function"==typeof r?r({...s,defaultChildren:i}):null==r?i:r,{className:e??o,style:l||a?{...a,...l}:void 0,children:c??i,"data-rac":""}},[t,n,r,o,i,a,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:r.isInvalid,isDisabled:r.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,oF.useCallback)(e=>{e.stopPropagation()},[]);return(0,aA.jsx)("span",{...(0,cL.v)((0,cW.$)(t),i,a,c),...d,ref:o,style:i.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":r.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":r.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),cU={short:!1,size:"md"},cB=(0,oF.forwardRef)(function(e,t){let{className:n,defaultValue:r,isDisabled:o,invalid:i,invalidText:a,isInvalid:s,label:l,labelText:c,light:u,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:w,..._}={...cU,...e},{calendar:y,intlLocale:v,today_:b}=cc(),x=(0,oF.useId)(),S=!!(c??l),k=(0,oF.useMemo)(()=>lM(r,y),[r,y]),j=(0,oF.useMemo)(()=>lM(w,y,!0),[w,y]),N=(0,oF.useMemo)(()=>lM(d,y),[d,y]),E=(0,oF.useMemo)(()=>lM(m??cu,y),[m,y]),C=(0,oF.useMemo)(()=>i||s,[i,s]),P=(0,oF.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(lL(e)))),[f,p]);return(0,aA.jsx)(lO,{locale:v.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",n),children:(0,aA.jsx)(lj.Kq,{values:[[cl,v]],children:(0,aA.jsxs)(lN.lr,{className:aR()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":u}),defaultValue:k,isDisabled:o,isInvalid:C,maxValue:N,minValue:E,value:j,shouldForceLeadingZeros:"en"===v.language||void 0,..._,onChange:P,children:[(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,aA.jsx)(lE.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:x,children:c??l}),(0,aA.jsxs)(lC.Y,{className:c_,children:[(0,aA.jsx)(cA,{id:S?x:void 0,ref:t,className:aR()("cds--date-picker-input__wrapper","-esm-help-menu__datepicker-module__inputWrapper___kykar",{"-esm-help-menu__datepicker-module__inputWrapperSm___KJtg-":"sm"===g,"-esm-help-menu__datepicker-module__inputWrapperMd___ablE9":"md"===g||!g||0===g.length,"-esm-help-menu__datepicker-module__inputWrapperLg___5dkQp":"lg"===g}),children:e=>"era"!==e.type?(0,aA.jsx)(cD,{className:cy,segment:e}):(0,aA.jsx)(oH().Fragment,{})}),(0,aA.jsx)(lP.$,{className:aR()(cx,{[ck]:"sm"===g,[cS]:"md"===g||!g||0===g.length,[cj]:"lg"===g}),children:(0,aA.jsx)(cO,{})})]}),(0,aA.jsx)(lI.b,{className:cb,children:a})]}),(0,aA.jsx)(cE,{variant:"single",today_:b})]})})})})}),cF=(0,oF.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:r,isDisabled:o,isInvalid:i,label:a,labelText:s,light:l,maxDate:c,minDate:u,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:w,intlLocale:_,today_:y}=cc(),v=(0,oF.useId)(),b=!!(s??a),x=(0,oF.useMemo)(()=>{if(f)return{start:lM(f[0],w,!1),end:lM(f[1],w,!1)}},[f,w]),S=(0,oF.useMemo)(()=>{if(t)return{start:lM(t[0],w,!1),end:lM(t[1],w,!1)}},[t,w]),k=(0,oF.useMemo)(()=>lM(u??cu,w,!0),[u,w]),j=(0,oF.useMemo)(()=>lM(c,w,!0),[c,w]),N=(0,oF.useMemo)(()=>n||i,[n,i]),E=(0,oF.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([lL(e.start),lL(e.end)]))),[m,d]);return(0,aA.jsx)(lO,{locale:_.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",e),children:(0,aA.jsx)(lj.Kq,{values:[[cl,_]],children:(0,aA.jsx)(lN.Ur,{id:b?v:void 0,className:aR()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":o}),isInvalid:N,shouldForceLeadingZeros:"en"===_.language||void 0,maxValue:j,minValue:k,value:x,defaultValue:S,ref:g,isDisabled:o,...h,onChange:E,children:(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[b&&(0,aA.jsx)(lE.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:v,children:s??a}),(0,aA.jsxs)(lC.Y,{className:c_,children:[(0,aA.jsxs)("div",{className:aR()("-esm-help-menu__datepicker-module__inputsWrapper___YlkGh",{"-esm-help-menu__datepicker-module__inputsWrapperSm___fAKhS":"sm"===p,"-esm-help-menu__datepicker-module__inputsWrapperMd___XVgGP":"md"===p||!p||0===p.length,"-esm-help-menu__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===p}),children:[(0,aA.jsx)(cP.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-help-menu__datepicker-module__startInput___qgbQm",cv),slot:"start",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})}),(0,aA.jsx)("div",{className:"-esm-help-menu__datepicker-module__separator___79vXZ",children:(0,aA.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,aA.jsx)(cP.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-help-menu__datepicker-module__endInput___huv7x",cv),slot:"end",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})})]}),(0,aA.jsx)(lP.$,{className:aR()(cx,{[ck]:"sm"===p,[cS]:"md"===p||!p||0===p.length,[cj]:"lg"===p}),children:(0,aA.jsx)(cO,{})})]}),(0,aA.jsx)(lI.b,{className:cb,children:r}),(0,aA.jsx)(cE,{variant:"range",today_:y,minDate:k,maxDate:j})]})})})})})});var cH=n(9606);let cV=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=iA({externalModuleName:"@openmrs/esm-styleguide"});return(0,aA.jsx)("div",{className:"-esm-help-menu__diagnosis-tags-module__container___8kut8",children:e.map(e=>{let r=t&&"PROVISIONAL"===e.certainty,o=1===e.rank?n?.primaryColor??"blue":n?.secondaryColor??"gray";return(0,aA.jsx)(cG,{color:o,isProvisional:r,name:e.display},e.uuid)})})};function cG({color:e,isProvisional:t,name:n}){let[r,o]=(0,oF.useState)(!1),[i,a]=(0,oF.useState)(!1),[s,l]=(0,oF.useState)(!1),c=s||i,u=(0,oF.useRef)(null);(0,oF.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||o(!1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n,t,c]);let d=aR()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-help-menu__diagnosis-tags-module__diagnosisTag___PFhpl"),m=(0,aA.jsxs)(aA.Fragment,{children:[t&&(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("span",{"aria-hidden":"true",className:"-esm-help-menu__diagnosis-tags-module__provisionalMark___8o6l4",children:"?"}),(0,aA.jsxs)("span",{className:"cds--visually-hidden",children:[tm("provisional","Provisional")," "]})]}),(0,aA.jsx)("span",{ref:u,className:"cds--tag__label",children:n})]});return c?(0,aA.jsxs)(cH.k$,{delay:0,closeDelay:150,isOpen:r,onOpenChange:o,children:[(0,aA.jsx)(lP.$,{className:d,"data-testid":"diagnosis-tag",onFocusChange:a,onPress:()=>o(!0),children:m}),(0,aA.jsx)(cH.m_,{className:"-esm-help-menu__diagnosis-tags-module__tagTooltip___asRTH",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,aA.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let cz={action:"-esm-help-menu__empty-card-module__action___Y0dul",content:"-esm-help-menu__empty-card-module__content___fo0nB",desktopHeading:"-esm-help-menu__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-help-menu__empty-card-module__tabletHeading___BogTF",tile:"-esm-help-menu__empty-card-module__tile___QB8Ld"},cq=({width:e="64",height:t="64"})=>(0,aA.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,aA.jsx)("use",{href:"#omrs-empty-data-illustration"})}),cJ=e=>{let t="tablet"===i2(),n=e.launchForm;return(0,aA.jsx)(aW.Layer,{className:cz.layer,children:(0,aA.jsxs)(aW.Tile,{className:cz.tile,children:[(0,aA.jsx)("div",{className:t?cz.tabletHeading:cz.desktopHeading,children:(0,aA.jsx)("h4",{children:e.headerTitle})}),(0,aA.jsx)(cq,{}),(0,aA.jsx)("p",{className:cz.content,children:tm("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,aA.jsx)("p",{className:cz.action,children:n&&(0,aA.jsx)(aW.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tm("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},cK=({error:e,headerTitle:t})=>{let n="tablet"===i2();return(0,aA.jsx)(aW.Layer,{children:(0,aA.jsxs)(aW.Tile,{className:"-esm-help-menu__error-state-module__tile___dd418",children:[(0,aA.jsx)("div",{className:n?"-esm-help-menu__error-state-module__tabletHeading___g5rjg":"-esm-help-menu__error-state-module__desktopHeading___Nd9u2",children:(0,aA.jsx)("h4",{children:t})}),(0,aA.jsxs)("p",{className:"-esm-help-menu__error-state-module__errorMessage___z2RiN",children:[tm("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,aA.jsx)("p",{className:"-esm-help-menu__error-state-module__errorCopy___dq+e2",children:tm("errorCopy")})]})})},cX=cK,cY=oH().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:o,state:i}=i8(),a=window.location??{pathname:""},s=o5(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,aA.jsxs)(aW.SideNav,{"aria-label":tm("leftNavigation","Left navigation"),className:"-esm-help-menu__left-nav-module__leftNav___jzTJK",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,aA.jsx)(o3,{name:"global-nav-menu-slot"}),n?(0,aA.jsx)(iv,{value:o,fallback:(0,aA.jsx)(o3,{name:n,state:{basePath:r,currentPath:a,...i}}),children:(0,aA.jsx)(oV.Provider,{value:o,children:(0,aA.jsx)(o3,{name:n,state:{basePath:r,currentPath:a,...i}})})}):null]}):null}),cZ=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:r=50,onChange:o})=>{let[i,a]=(0,oF.useState)(""),s=(0,oF.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:r,isLoading:o}=(0,i$.A)(t,tP,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,oF.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?r:null,isLoading:!!t&&o}),[n,o,r,t])}(t),{locations:c,isLoading:u,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,n=""){let r=iR(n),{data:o,isLoading:i,isValidating:a,setSize:s,error:l}=(0,iJ.Ay)(function(n,o){if(o){let e=o.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let i=`${tN}/Location?`,a=new URLSearchParams;return a.append("_summary","data"),t&&a.append("_count",""+t),n&&a.append("_getpagesoffset",""+n*t),e&&a.append("_tag",e),"string"==typeof r&&""!==r&&a.append("name:contains",r),i+a.toString()},tP);return(0,oF.useMemo)(()=>({locations:o?.length?o?.flatMap(e=>e?.data?.entry??[]):[],isLoading:i,totalResults:o?.[0]?.data?.total,hasMore:!!o?.length&&o?.[o.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:a,error:l||null,setPage:s}),[i,o,a,s,l])}(n,r,i),h=(0,oF.useMemo)(()=>l&&!i&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,i]),g=(0,oF.useCallback)(e=>{o(),a(e.trim())},[o]),w=i9((0,oF.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),_=d?Math.max(0,Math.floor(h.length-r/2)):-1;return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)(aW.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:tm("searchForLocation"),id:s,placeholder:tm("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__errorNotification___vWBFD",id:`${s}-error`,children:(0,aA.jsx)(aW.InlineNotification,{kind:"error",subtitle:tm("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:tm("error","Error")})}),(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__searchResults___Gbet+",children:u?(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,aA.jsx)(aW.RadioButtonSkeleton,{className:"-esm-help-menu__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__locationResultsContainer___6Pasf",children:h.length>0?(0,aA.jsx)(aW.RadioButtonGroup,{name:"loginLocations",onChange:e=>{o(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,aA.jsx)(aW.RadioButton,{className:"-esm-help-menu__location-picker-module__locationRadioButton___rTDPj",id:e.resource.id,labelText:(0,aA.jsx)("span",{ref:t===_?w:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__emptyState___w4-Ca",children:(0,aA.jsx)("p",{className:"-esm-help-menu__location-picker-module__locationNotFound___Of2MJ",children:tm("noResultsToDisplay")})})}),m&&(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__loadingIcon___NAwSB",children:(0,aA.jsx)(aW.InlineLoading,{description:tm("loading")})})]})})]})},cQ=R("modalState",{modalContainer:null,modalStack:[]}),c0=0;async function c1(e,t,n={}){let r=oN(t),o=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:i}=r,a=await i(),s=c0++;o=await oW({...a,name:`${t}-${s}`},{...n,domElement:e})}else y(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return o}function c2(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c5(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c6(e){return e.find(e=>!c2(e))}function c8(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let c3=window.getComputedStyle(document.body).overflow;function c4({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",c9),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c6(e);e.forEach(e=>{switch(e.state){case"NEW":{let n=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=n,e.state="MOUNTING",c1(n,e.modalName,e.props).then(r=>{c2(e)?c5(e.modalName,r):r?(e.parcel=r,t.prepend(n),c8(e,c6(cQ.getState().modalStack)===e),r.mountPromise.then(()=>{c2(e)||(e.state="MOUNTED")},t=>{y(t),e.parcel=null,c7(e)})):c7(e)},t=>{y(t),c7(e)});break}case"MOUNTING":case"MOUNTED":c8(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c5(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=cQ.getState();cQ.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=c3,removeEventListener("keydown",c9)}function c7(e){if(c2(e))return;e.state="TO_BE_DELETED";let t=cQ.getState();cQ.setState({...t,modalStack:[...t.modalStack]})}function c9(e){"Escape"===e.key&&function(){let[e]=cQ.getState().modalStack;e&&c7(e)}()}function ue(e){cQ.subscribe(c4),cQ.setState({...cQ.getState(),modalContainer:e})}function ut(e,t={},n=()=>{}){let r=()=>{let e=cQ.getState().modalStack.find(e=>e.onClose===n);e&&c7(e)};if(oN(e)){var o;let i,a;o={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},a=[o,...(i=cQ.getState()).modalStack],cQ.setState({...i,modalStack:a})}else y(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var un=n(9685);let ur=({notification:e})=>{let{description:t,action:n,kind:r,critical:o,title:i,onAction:a}=e;return(0,aA.jsx)(aW.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:o,subtitle:t,title:i||"",inline:!0,onActionButtonClick:a})},uo=({subject:e})=>{let[t,n]=(0,oF.useState)([]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(ur,{notification:e},e.id))})},ui=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:r,kind:o,title:i,critical:a,progressActionLabel:s,id:l,...c}=e,[u,d]=(0,oF.useState)(t);return(0,aA.jsx)(aW.ActionableNotification,{kind:o||"info",actionButtonLabel:u,ariaLabel:tm("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:tm("actionableNotification","Actionable notification"),subtitle:r,title:i,lowContrast:a,inline:!0,...c})},ua=({subject:e})=>{let[t,n]=(0,oF.useState)([]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(ui,{notification:e},e.id))})};class us{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"listeners",new Set)}}let ul=new us,uc=0,uu=new us,ud=0;function um(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(uo,{subject:ul}))}function up(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,un.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{ul.next({...e,id:uc++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function uf(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(ua,{subject:uu}))}function uh(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,un.A)(t))?setTimeout(()=>{uu.next({...e,id:ud++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let ug=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],uw=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],u_={container:"-esm-help-menu__numeric-observation-module__container___NfxbH",card:"-esm-help-menu__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-help-menu__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-help-menu__numeric-observation-module__critical-value___JAIHt",cell:"-esm-help-menu__numeric-observation-module__cell___lTunW","critically-high":"-esm-help-menu__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-help-menu__numeric-observation-module__critically-low___5srAK",high:"-esm-help-menu__numeric-observation-module__high___7KiyK",low:"-esm-help-menu__numeric-observation-module__low___Zs2ct","label-container":"-esm-help-menu__numeric-observation-module__label-container___lGnGH","value-container":"-esm-help-menu__numeric-observation-module__value-container___hHPXt",label:"-esm-help-menu__numeric-observation-module__label___WFuxk",value:"-esm-help-menu__numeric-observation-module__value___6fHUr",units:"-esm-help-menu__numeric-observation-module__units___EdVuw","pad-right":"-esm-help-menu__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-help-menu__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-help-menu__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-help-menu__numeric-observation-module__arrow___SLGUh"},uy=({value:e,unit:t,label:n,interpretation:r,referenceRange:o,conceptUuid:i,variant:a="card",patientUuid:s})=>{let l=(0,oF.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${tj}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${tj}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:o,isLoading:i}=(0,i$.A)(n,tP),a=r?.data?.results?.[0];return{referenceRange:a?{hiNormal:a.hiNormal??null,hiAbsolute:a.hiAbsolute??null,hiCritical:a.hiCritical??null,lowNormal:a.lowNormal??null,lowAbsolute:a.lowAbsolute??null,lowCritical:a.lowCritical??null}:void 0,error:o,isLoading:i}}(o||r?void 0:i,s),d=o??c,m=(0,oF.useMemo)(()=>{if(r)return r?"--"===r?"normal":ug.includes(r)?r.toLowerCase():uw.includes(r)?r:"normal":void 0;if(d&&!u){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[r,d,e,u])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,w=`omrs-numeric-obs-unit-${l}`,_=null!=e&&""!==e,y=_?e:tm("notAvailable","Not available"),v=aR()({[u_["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[u_["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[u_.low]:"low"===m,[u_.high]:"high"===m,[u_["off-scale-low"]]:"off_scale_low"===m,[u_["off-scale-high"]]:"off_scale_high"===m}),b=aR()({[u_.container]:!0,[u_.card]:!0,[u_["critical-value"]]:p,[u_["abnormal-value"]]:f&&!p}),x=aR()({[u_.cell]:!0,[v]:!0});return"cell"===a?(0,aA.jsxs)("div",{className:x,children:[y,_&&t?` ${t}`:""]}):(0,aA.jsxs)("section",{className:b,"data-testid":"numeric-observation-card",children:[n&&(0,aA.jsxs)("div",{className:u_["label-container"],children:[(0,aA.jsx)("span",{id:h,className:u_.label,children:n}),f&&(0,aA.jsx)("span",{className:u_[m.replace("_","-")],title:tm("abnormalValue","Abnormal value")})]}),(0,aA.jsxs)("div",{className:u_["value-container"],children:[(0,aA.jsx)("span",{id:g,"aria-labelledby":h&&w?`${h} ${w}`:h||w||void 0,className:u_.value,children:y}),_&&t&&(0,aA.jsx)("span",{id:w,className:u_.units,children:t})]})]})},uv="-esm-help-menu__page-header-module__pageHeader___YOpQL",ub=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,aA.jsx)("div",{className:aR()(uv,n),...r,children:t})}{let{title:t,illustration:n,className:r,...o}=e;return(0,aA.jsx)("div",{className:aR()(uv,r),...o,children:(0,aA.jsx)(ux,{title:t,illustration:n})})}},ux=({title:e,illustration:t,className:n})=>{let[r,o]=(0,oF.useState)(null);return(0,oF.useEffect)(()=>{eM("@openmrs/esm-styleguide").then(e=>{o(e)})},[]),(0,aA.jsxs)("div",{className:aR()("-esm-help-menu__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,aA.jsxs)("div",{className:"-esm-help-menu__page-header-module__pageLabels___pPcKj",children:[r?.implementationName&&(0,aA.jsx)("p",{children:tm(r.implementationName)}),(0,aA.jsx)("h1",{className:"-esm-help-menu__page-header-module__pageName___3d4IC",children:e})]})]})},uS=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:r,dashboardLinkUrl:o,currentItems:i,dashboardLinkLabel:a})=>{let{pageSizes:s,pageItemsCount:l}=an(t,e,r,i),c="tablet"===i2(),u=tm("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,aA.jsx)(aA.Fragment,{children:e>0&&(0,aA.jsxs)("div",{className:aR()({"-esm-help-menu__pagination-module__tablet___lQ3ak":c,"-esm-help-menu__pagination-module__desktop___HfUTY":!c}),children:[(0,aA.jsxs)("div",{children:[u,o&&(0,aA.jsx)(oG,{to:o,className:"-esm-help-menu__pagination-module__configurableLink___NM9v7",children:a??tm("seeAll","See all")})]}),(0,aA.jsx)(aW.Pagination,{className:"-esm-help-menu__pagination-module__pagination___WzkBs",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>tm("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function uk(e){return uN(uC(e,"usual","official"))}function uj(e){return uk(e)}function uN(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uE(e){return uN(e)}function uC(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,r;return t=e,r=n,t.use?t.use===r:"usual"===r});if(t)return t}}function uP(e,t=ac()){let n=ac(t),r=ct(e,n);if(null==r)return null;let o=n.diff(r,"hours"),i=n.diff(r,"days"),a=n.diff(r,"weeks"),s=n.diff(r,"months"),l=n.diff(r,"years"),c={};if(o<2)c.minutes=n.diff(r,"minutes");else if(i<2)c.hours=o;else if(a<4)c.days=i;else if(l<1){let e=n.subtract(a,"weeks").diff(r,"days");c.weeks=a,c.days=e}else if(l<2){let e=n.subtract(s,"months").diff(r,"days");c.months=s,c.days=e}else if(l<18){let e=n.subtract(l,"year").diff(r,"months");c.years=l,c.months=e}else c.years=l;return c}function uI(e,t=ac()){let n=uP(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),ce(n,r)}let uA={container:"-esm-help-menu__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-help-menu__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-help-menu__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-help-menu__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-help-menu__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-help-menu__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-help-menu__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-help-menu__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-help-menu__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-help-menu__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-help-menu__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-help-menu__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-help-menu__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-help-menu__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-help-menu__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-help-menu__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-help-menu__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-help-menu__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-help-menu__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-help-menu__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-help-menu__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-help-menu__patient-banner-patient-info-module__actionsButtonText___mn139"};function uO({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsx)("span",{className:uA.primaryIdentifier,children:(0,aA.jsxs)(aW.Tag,{className:uA.tag,type:"gray",children:[e&&t?.text&&(0,aA.jsxs)("span",{className:uA.label,children:[t.text,": "]}),(0,aA.jsx)("span",{className:uA.value,children:n})]})})}function uR({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsxs)(aW.FormLabel,{className:uA.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,aA.jsxs)("span",{className:uA.label,children:[t?.text,": "]}),(0,aA.jsx)("span",{className:uA.value,children:n})]})}function u$({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=iA(),{primaryIdentifierCode:r}=ai(),o=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,aA.jsx)(aA.Fragment,{children:o?.length?o.map(({value:e,type:n},i)=>(0,aA.jsxs)(oH().Fragment,{children:[(0,aA.jsx)("span",{className:uA.identifier,children:n?.coding?.[0]?.code===r?(0,aA.jsx)(uO,{showIdentifierLabel:t,type:n,value:e}):(0,aA.jsx)(uR,{showIdentifierLabel:t,type:n,value:e})}),i<o.length-1&&(0,aA.jsx)("span",{className:uA.separator,children:"\xb7"})]},e)):""})}let uT={Female:sv,Male:sb,Other:sx,Unknown:sS},uM=({gender:e})=>{let t=uT[e];return t?(0,aA.jsx)(t,{fill:"#525252"}):null},uL={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function uW({patient:e,renderedFrom:t}){var n;let r,o,i=uk(e),a=e?.gender&&(o=uL[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tm(r,n),iconKey:o}),s=(0,oF.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,aA.jsxs)("div",{className:uA.patientInfo,children:[(0,aA.jsx)("div",{className:aR()(uA.row,uA.patientNameRow),children:(0,aA.jsxs)("div",{className:uA.flexRow,children:[(0,aA.jsx)("span",{className:uA.patientName,children:i}),a&&(0,aA.jsxs)("div",{className:uA.gender,children:[(0,aA.jsx)(uM,{gender:a.iconKey}),(0,aA.jsx)("span",{children:a.displayText})]}),(0,aA.jsx)(o3,{className:uA.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,aA.jsxs)("div",{className:uA.demographics,children:[e.birthDate&&(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("span",{children:uI(e.birthDate)}),(0,aA.jsx)("span",{className:uA.separator,children:"\xb7"}),(0,aA.jsx)("span",{children:l6(e.birthDate,{time:!1})}),(0,aA.jsx)("span",{className:uA.separator,children:"\xb7"})]}),(0,aA.jsx)(u$,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,aA.jsx)(o3,{className:uA.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var uD=n(7683);function uU({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[o,i]=(0,oF.useState)(!1),{extensions:a}=o6(n),s="tablet"===i2(),l=i7(()=>i(!1),o),c=(0,oF.useRef)(null),u=(0,oF.useRef)(null),d=(0,oF.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,oF.useCallback)(()=>i(e=>!e),[]),h=(0,oF.useCallback)(()=>{i(!1),c.current?.focus()},[]),g=(0,oF.useCallback)(e=>{if("Escape"===e.key&&o){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&o){e.preventDefault();let t=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let n=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(t).indexOf(n);if(-1===r)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let o=r+("ArrowDown"===e.key?1:-1),i=o<0?t.length-1:o>=t.length?0:o;t[i]?.focus()}},[h,o]);(0,oF.useEffect)(()=>{if(o&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[o]);let w=(0,oF.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...r}),[t,e,h,r]);return 0===a.length?null:(0,aA.jsx)("div",{className:"-esm-help-menu__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aB),ref:l,children:[(0,aA.jsxs)("button",{className:aR()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":o},aV),"aria-controls":p,"aria-expanded":o,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:c,children:[(0,aA.jsx)("span",{className:"-esm-help-menu__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tm("actions","Actions")})," ",(0,aA.jsx)(uD.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,aA.jsxs)("div",{className:aR()("cds--overflow-menu-options","cds--overflow-menu--flip",aF,{[aH]:o}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:u,role:"menu",tabIndex:-1,children:[(0,aA.jsx)("ul",{className:aR()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,aA.jsx)(o3,{name:n,state:w},n)}),(0,aA.jsx)("span",{})]})]})})}var uB=n(397),uF=n.n(uB);function uH(e){let{patientPhotoConceptUuid:t}=iA({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tj}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:o,isLoading:i}=(0,ie.u)(e?n:null,tP),a=r?.data?.results[0];return{data:a?{dateTime:a?.obsDatetime,imageSrc:a?.value?.links?.uri}:null,error:o,isLoading:i}}let uV=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,o9.useTranslation)();return(0,aA.jsxs)("svg",{"aria-label":n??r("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,aA.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,aA.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})},uG="-esm-help-menu__patient-photo-module__avatar___t5TmZ";function uz({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:o}=uH(e),[i,a]=(0,oF.useState)(null),[s,l]=(0,oF.useState)(!1),c=(0,oF.useMemo)(()=>uF().generate(e),[e]);(0,oF.useEffect)(()=>{if(r?.imageSrc){let e=new URL(r.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(a(e),l(!1))},n.onerror=()=>{t||(a(null),l(!1))},n.src=e,()=>{t=!0}}a(null),l(!1)},[r?.imageSrc]);let u=(0,oF.useMemo)(()=>n||(i?tm("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):tm("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,i,t]);return o||s?(0,aA.jsx)(aW.SkeletonIcon,{className:"-esm-help-menu__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):r?.imageSrc&&!i?(0,aA.jsx)(uV,{"aria-label":tm("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("img",{className:uG,src:i,alt:u,title:t})}):(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("div",{className:uG,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,aA.jsx)("span",{className:"-esm-help-menu__patient-photo-module__initials___-k9Hv",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let uq=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],uJ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),uK=uJ,uX=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),uY=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),uZ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),uQ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),u0=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),u1=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),u2=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u5=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u6=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),u8=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),u3=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),u4=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),u7=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),u9=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),de=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),dt=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),dn=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),dr=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),di=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),da=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),ds=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),dl=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),dc=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),du=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dd=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dm=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),dp=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),df=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),dh=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),dg=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),dw=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),d_=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dy=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dv=u4,db=dl,dx=(0,oF.memo)((0,oF.forwardRef)(function({pictogram:e,fallback:t,...n},r){let o=(0,oF.useRef)(document.getElementById(e));return(0,oF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(o.current=document.getElementById(e))});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,aA.jsx)(iv,{value:o.current,fallback:t,children:(0,aA.jsx)(dS,{ref:r,pictogram:e,pictogramProps:n})})})),dS=(0,oF.memo)((0,oF.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:r,size:o}=Object.assign({},{size:92},t);return(o<=26||o>144)&&(console.error(`Invalid size '${o}' specified for ${e}. Defaulting to 92.`),o=92),(0,aA.jsx)("svg",{ref:n,className:aR()("-esm-help-menu__pictograms-module__pictogram___wXX7t",r),height:o,width:o,children:(0,aA.jsx)("use",{href:`#${e}`})})})),dk=({children:e})=>"tablet"===i2()?(0,aA.jsx)(aW.Layer,{children:e}):(0,aA.jsx)(aA.Fragment,{children:e}),dj=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:r="success",onActionButtonClick:o=()=>{},isLowContrast:i="error"!==r,progressActionLabel:a,subtitle:s="",timeoutInMs:l=5e3,autoClose:c="error"!==r,title:u,id:d,...m}=e,[p,f]=(0,oF.useState)(n),[h,g]=(0,oF.useState)(!0),[w,_]=(0,oF.useState)(!1),y=(0,oF.useCallback)(()=>{setTimeout(t,250)},[t]),v=(0,oF.useCallback)(()=>{_(!0),y()},[y]);return(0,oF.useEffect)(()=>{if(c){let e=setTimeout(v,l);return()=>clearTimeout(e)}},[l,c,v]),(0,oF.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,aA.jsx)(aW.ActionableNotification,{actionButtonLabel:p,"aria-label":tm("closeSnackbar","Close snackbar"),className:aR()("-esm-help-menu__snackbar-module__slideIn___-oZIt",{"-esm-help-menu__snackbar-module__animated___M2YBU":h,"-esm-help-menu__snackbar-module__slideOut___yEmGT":w}),kind:r,lowContrast:i,onActionButtonClick:()=>{o(),v(),a&&f(a)},onClose:y,statusIconDescription:tm("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...m})},dN=({subject:e})=>{let[t,n]=(0,oF.useState)([]),r=(0,oF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(dj,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},dE=new us,dC=0;function dP(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(dN,{subject:dE}))}function dI(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dE.next({...e,id:dC++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dA=({toast:e,closeToast:t})=>{let{description:n,kind:r,critical:o,title:i,actionButtonLabel:a,onActionButtonClick:s=()=>{}}=e,l=(0,oF.useCallback)(()=>{s(),t()},[t,s]);return(0,aA.jsx)("div",{children:(0,aA.jsx)(aW.ActionableNotification,{actionButtonLabel:a,kind:r||"info",lowContrast:o,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},dO=({subject:e})=>{let[t,n]=(0,oF.useState)([]),r=(0,oF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(dA,{toast:e,closeToast:()=>r(e)},e.id))})},dR=new us,d$=0;function dT(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(dO,{subject:dR}))}function dM(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,un.A)(t))?setTimeout(()=>{dR.next({...e,id:d$++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dL=n(4656);async function dW(e,t){let{openedGroup:n}=oE.getState();if(n){if(n.groupName===e&&dB(n.props,t))return!0;else if(!await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return oE.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dD(e){let{openedGroup:t,openedWindows:n}=oE.getState();if(t){if(n.length>0&&!(e||await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;oE.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dU(e,t=null,n=null,r=null){let o=oE.getState();if(!o.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=oC(e);if(!i)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:a}=o,{name:s}=i,l=oP(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${i.name} is not registered to a workspace group`);let c=oI(e);if(a&&(a.groupName!==l.name||!dB(a.props,r)))return!!await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let r=o.openedWindows[c],i=o.openedGroup?.props??{},a=o.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=r;if(dB(r.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dB(d.props,t)?((a||c!==o.openedWindows.length-1)&&oE.setState(dX.restoreWindow(o,s)),!0):!!await dV({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:o?.openedGroup?.props??i},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d1(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dV({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:i??o?.openedGroup?.props},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(oE.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[...o.openedWindows,{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dV({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dB(e,t){return null==e||null==t||x(e,t)}function dF(e,t){let n=[];for(let r=e.openedWorkspaces.length-1;r>=0;r--){let o=e.openedWorkspaces[r];if(o.hasUnsavedChanges&&n.push(o),t&&o.workspaceName===t)break}return n}function dH(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=ut("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function dV(e){let{openedWindows:t}=oE.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>dF(e));break;case"CLOSE_WINDOW":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dF(r);break}case"CLOSE_WORKSPACE":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dF(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>dF(e))}return dH(n)}function dG(e,t){return dH(dF(e,t))}function dz(e,t){let n=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return n<0?e:0===n?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,n)}}function dq(e,t,n,r){let{registeredWorkspacesByName:o}=oE.getState(),i=o[n];if(!i)throw Error(`No workspace named "${n}" registered`);let a=o[t];if(!a)throw Error(`No workspace named "${t}" registered`);if(a.window!==i.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);if(i.window!==e.windowName)throw Error(`Cannot open child workspace ${n} as window ${i.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${n} from parent workspace ${t} as the parent is not opened within the workspace window`);let c=s.slice(0,l+1);return{...e,openedWorkspaces:[...c,d1(n,r)]}}function dJ(e,t,n){let r=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(r<0)return e;let o=e.openedWorkspaces[r];if(Object.keys(n).every(e=>o[e]===n[e]))return e;let i=[...e.openedWorkspaces];return i[r]={...o,...n},{...e,openedWorkspaces:i}}function dK(e,t,n){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(r<0)return e;let o=e.openedWindows[r],i=dJ(o,t,n);if(i===o)return e;let a=[...e.openedWindows];return a[r]=i,{...e,openedWindows:a}}let dX={setWindowMaximized(e,t,n){let r=e.openedWindows.findIndex(e=>e.windowName===t),o=[...e.openedWindows],i={...o[r],maximized:n};return o[r]=i,{...e,openedWindows:o}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),r=e.openedWindows[n],o=[...e.openedWindows.filter((e,t)=>t!==n),r];return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(n<0)return e;let r=dz(e.openedWindows[n],t),o=[...e.openedWindows],i=e.isMostRecentlyOpenedWindowHidden;if(null===r){let t=n===e.openedWindows.length-1;o.splice(n,1),t&&o.length>0&&(i=!1)}else o[n]=r;return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:i}},openChildWorkspace(e,t,n,r){let o=e.registeredWorkspacesByName[n];if(!o)throw Error(`No workspace named "${n}" registered`);let i=e.openedWindows.findIndex(e=>e.windowName===o.window);if(-1==i)throw Error(`Cannot open child workspace ${n} as window ${o.window} is not opened`);let a=[...e.openedWindows];return a[i]=dq(e.openedWindows[i],t,n,r),{...e,openedWindows:a}},setHasUnsavedChanges:(e,t,n)=>dK(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>dK(e,t,{title:n})};function dY(){return oY(oE,dX)}let dZ=()=>(0,oF.useContext)(o7.i),dQ=()=>Object.keys(oE.getState().registeredWorkspacesByName);function d0(e,t,n){let r=e.openedWorkspaces[e.openedWorkspaces.length-1];return(r?t[r.workspaceName]?.width:void 0)??n[e.windowName]?.width??"narrow"}function d1(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,dL.A)()}}function d2(e,t,n){let r=oE.getState().registeredWorkspacesByName[e];return r?{windowName:r.window,openedWorkspaces:[d1(e,t)],props:n??null,maximized:!1}:null}let d5=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:r,setWorkspaceTitle:o}=dZ();return(0,oF.useEffect)(()=>{r(n??!1)},[n,r]),(0,oF.useEffect)(()=>{o(e)},[e,o]),(0,aA.jsx)(aA.Fragment,{children:t})};var d6=n(1820),d8=n(3173),d3=n(185);let d4={workspaceOuterContainer:"-esm-help-menu__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-help-menu__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-help-menu__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-help-menu__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-help-menu__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-help-menu__workspace2-module__maximized___Kfygr",hidden:"-esm-help-menu__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-help-menu__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-help-menu__workspace2-module__workspaceSpacer___E+982",loader:"-esm-help-menu__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-help-menu__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-help-menu__workspace2-module__header___IZ-2+",headerButtons:"-esm-help-menu__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-help-menu__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-help-menu__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-help-menu__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-help-menu__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-help-menu__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-help-menu__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-help-menu__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-help-menu__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},d7=e=>e.registeredWorkspacesByName,d9=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:r,actions:o,renderChrome:i,isRootWorkspace:a,isLeafWorkspace:s,showActionMenu:l})=>{let c=(0,oF.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:r=!1,discardUnsavedChanges:i=!1}=e;return r?!!(i||await o.promptForClosingWorkspaces())&&(o.closeWorkspace(n.openedWorkspaces[0].workspaceName),!0):!!(i||await o.promptForClosingWorkspaces(t.workspaceName))&&(o.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,r)=>{let i=t.workspaceName,{openedWorkspaces:a}=n,s=a.findIndex(e=>e.workspaceName===i);-1===s||s!==a.length-1&&a.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await o.promptForClosingWorkspaces(a[s+1].workspaceName)||o.openChildWorkspace(i,e,r||{})},setWorkspaceTitle:e=>o.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>o.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:r,workspaceMeta:oE.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:a,isLeafWorkspace:s,windowName:n.windowName,showActionMenu:l},[t,n,r,o,a,s,l]),u=!i&&!s,d=(0,oF.useMemo)(()=>e?(0,aA.jsx)(d6.A,{config:e,mountParcel:oU,wrapWith:"div",wrapClassName:aR()(d4.workspaceContent,{[d4.hiddenExtraWorkspace]:u}),...c},t.workspaceName):null,[e,t.workspaceName,c,u]);return i?(0,aA.jsx)(me,{openedWorkspace:t,openedWindow:n,isRootWorkspace:a,showActionMenu:l,closeWindow:()=>c.closeWorkspace({closeWindow:!0}),children:d}):d??(0,aA.jsx)(aW.InlineLoading,{className:aR()(d4.loader,{[d4.hiddenExtraWorkspace]:u}),description:`${tm("loading")}`})},me=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:r,closeWindow:o,children:i})=>{let a=i2(),{openedGroup:s,openedWindows:l,registeredWindowsByName:c,registeredWorkspacesByName:u,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=dY(),h=t.windowName,{maximized:g}=t,w=e.title??"",_=c[h],y=d0(t,u,c),v=_?.icon,b=_?.canMaximize,x=!!s&&d[s.groupName]?.persistence==="closable",S=!!v&&!x,k=l.findIndex(e=>e.windowName===h)<l.length-1||m,j=Object.values(c).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,aA.jsxs)("div",{className:aR()(d4.workspaceOuterContainer,{[d4.narrowWorkspace]:"narrow"===y,[d4.widerWorkspace]:"wider"===y,[d4.extraWideWorkspace]:"extra-wide"===y,[d4.isActionMenuOpened]:j}),children:[(0,aA.jsx)("div",{className:aR()(d4.workspaceSpacer,{[d4.hidden]:k})}),(0,aA.jsx)("div",{className:aR()(d4.workspaceMiddleContainer,{[d4.maximized]:g,[d4.hidden]:k,[d4.isRootWorkspace]:n,[d4.showActionMenu]:r}),children:(0,aA.jsx)("div",{className:aR()(d4.workspaceInnerContainer,{[d4.maximized]:g,[d4.hidden]:k,[d4.isRootWorkspace]:n}),children:i?(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsxs)(aW.Header,{"aria-label":tm("workspaceHeader"),className:d4.header,children:[(0,aA.jsx)(aW.HeaderName,{prefix:"",children:w}),(0,aA.jsx)("div",{className:d4.overlayHeaderSpacer}),(0,aA.jsx)(aW.HeaderGlobalBar,{className:d4.headerButtons,children:i5(a)?(0,aA.jsxs)(aA.Fragment,{children:[(b||g)&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":g?tm("minimize"):tm("maximize"),onClick:()=>p(h,!g),children:g?(0,aA.jsx)(d8.Xj,{}):(0,aA.jsx)(d8.hz,{})}),S&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>f(),children:(0,aA.jsx)(a2,{})}),!x&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("close"),onClick:o,children:(0,aA.jsx)(su,{})})]}):(0,aA.jsxs)(aA.Fragment,{children:[S&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>f(),children:(0,aA.jsx)(d3.d3,{})}),(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("close"),onClick:()=>{x?dD():o()},children:(0,aA.jsx)(su,{})})]})})]}),i]}):(0,aA.jsx)(aW.InlineLoading,{className:d4.loader,description:`${tm("loading")} ...`})})})]})},mt=({openedWindow:e,groupProps:t,actions:n,renderChrome:r,showActionMenu:o})=>{let{openedWorkspaces:i}=e,[a,s]=(0,oF.useState)({}),l=oX(oE,d7);return(0,oF.useEffect)(()=>{let e=!1;return Promise.all(i.map(async e=>{let t=l[e.workspaceName];if(!t)return null;let{moduleName:n,component:r}=t;return[e.uuid,await av(n,r)]})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))}),()=>{e=!0}},[i,l]),(0,aA.jsx)(aA.Fragment,{children:i.map((s,l)=>(0,aA.jsx)(d9,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:n,renderChrome:r,lifeCycle:a[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===i.length-1,showActionMenu:o},s.uuid))})},mn=e=>e.registeredWorkspacesByName,mr=({name:e,workspaceProps:t,windowProps:n,groupProps:r,onWindowChanged:o})=>{let i=oX(oE,mn),a=oX(oE,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),s={name:e,workspaceProps:t,windowProps:n,groupProps:r},l=(0,oF.useRef)(),c=(0,oF.useRef)(null);if(!l.current){let o=d2(e,t,n);l.current=$({openedWindow:o,groupProps:r??null}),o&&(c.current=s)}let u=l.current;(0,oF.useEffect)(()=>{let o=c.current;if(o&&o.name===e&&x(o.workspaceProps,t)&&x(o.windowProps,n)&&x(o.groupProps,r))return;let i=d2(e,t,n);u.setState({openedWindow:i,groupProps:r??null},!0),c.current=i?s:null},[e,t,n,r,i,u]);let d=(0,oF.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let n=t(e.openedWindow);return n===e.openedWindow?e:{...e,openedWindow:n}})}return{closeWorkspace(e){t(t=>dz(t,e))},openChildWorkspace(e,n,r){t(t=>dq(t,e,n,r))},setWorkspaceTitle(e,n){t(t=>dJ(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>dJ(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?dG(n,t):Promise.resolve(!0)}}})(u),[u]),{openedWindow:m,groupProps:p}=oX(u),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",w=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,_=a?.width??"narrow",y=(0,oF.useRef)(o);return(0,oF.useEffect)(()=>{y.current=o}),(0,oF.useEffect)(()=>{y.current?.({workspaceName:h,windowWidth:_,title:g,hasUnsavedChanges:w})},[h,_,g,w]),(0,aA.jsx)("div",{className:"-esm-help-menu__exported-workspace-module__exportedWorkspace___7PE0H",children:m?(0,aA.jsx)(mt,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},mo="-esm-help-menu__action-menu-button2-module__container___jc6--",mi="-esm-help-menu__action-menu-button2-module__elementContainer___whLL8",ma="-esm-help-menu__action-menu-button2-module__active___fbyFm",ms="-esm-help-menu__action-menu-button2-module__focused___+aVpz";function ml({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,aA.jsxs)(aA.Fragment,{children:[e({size:16}),t?(0,aA.jsx)("span",{className:"-esm-help-menu__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,aA.jsx)("span",{className:"-esm-help-menu__action-menu-button2-module__countTag___XMH0D",children:n})]})}let mc=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:o})=>{let i=i2(),{openedWindows:a,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=dY(),{extension:u}=(0,oF.useContext)(oV),d=a.findIndex(e=>e.windowName===u?.extensionId),m=a[d],p=null!=m,f=p&&(d<a.length-1||c),h=p&&!f,g=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,w=async()=>{if(p)f?s(m.windowName):l();else if(await (o?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=r;dU(e,t,n)}};return"tablet"===i||"phone"===i?(0,aA.jsxs)(aW.Button,{className:aR()(mo,{[ma]:p&&!h,[ms]:h}),iconDescription:t,kind:"ghost",onClick:w,role:"button",tabIndex:0,size:"md",children:[(0,aA.jsx)("span",{className:mi,children:(0,aA.jsx)(ml,{hasUnsavedChanges:g,getIcon:e,tagContent:n})}),(0,aA.jsx)("span",{children:t})]}):(0,aA.jsx)(aW.IconButton,{align:"left","aria-label":t,className:aR()(mo,{[ma]:p&&!h,[ms]:h}),enterDelayMs:300,kind:"ghost",label:t,onClick:w,size:"md",children:(0,aA.jsx)("div",{className:mi,children:(0,aA.jsx)(ml,{hasUnsavedChanges:g,getIcon:e,tagContent:n})})})};function mu({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,aA.jsx)(aW.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?sc:sa,children:e?tm("showLess","Show less"):tm("showMore","Show more")})}let md={contactDetails:"-esm-help-menu__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-help-menu__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-help-menu__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-help-menu__patient-banner-contact-details-module__row___qFgIi",col:"-esm-help-menu__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-help-menu__patient-banner-contact-details-module__relationship___T3LO-"},mm=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${tj}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=(0,ie.u)(t,tP),o=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,oF.useMemo)(()=>({cohorts:o,isLoading:r}),[r,o])}(e);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsxs)("p",{className:md.heading,children:[tm("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>lZ(e?.startDate).getTime()-lZ(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,aA.jsx)("li",{children:(0,aA.jsx)(oG,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,aA.jsx)("li",{children:"--"})})(),t.length>3&&(0,aA.jsx)("li",{className:md.link,children:(0,aA.jsx)(oG,{to:`${window.spaBase}/home/patient-lists`,children:tm("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},mp=({patientId:e})=>{let{patient:t,isLoading:n}=ao(e),r=t?.address?.find(e=>"home"===e.use),o=e=>e.split("#")[1];return n?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:md.heading,children:tm("address","Address")}),(0,aA.jsx)("ul",{children:r?Object.entries(r).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?r.extension?.[0]?.extension?.map((t,n)=>(0,aA.jsxs)("li",{children:[tm(o(t.url),o(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,aA.jsxs)("li",{children:[tm(e,e),": ",t]},`address-${e}`)):(0,aA.jsx)("li",{children:"--"})})]})},mf=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=iA({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:r,isLoading:o}=(e=>{let{data:t,error:n,isLoading:r}=(0,i$.A)(`${tj}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,tP);return{isLoading:r,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,oF.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:o,error:r}})(e),r=(0,oF.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?tm(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:md.heading,children:tm("contactDetails","Contact Details")}),t?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsx)("ul",{children:r.length?r.map(([e,t],n)=>(0,aA.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,aA.jsx)("li",{children:"--"})})]})},mh=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${tj}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:n,error:r,isLoading:o,isValidating:i}=(0,ie.u)(e?t:null,tP),a=n?.data?.results?.length?function(e,t){let n=[];for(let r of t)e===r.personA.uuid?n.push({uuid:`${r.uuid}`,display:r.personB.display,relativeAge:r.personB.age,relativeUuid:r.personB.uuid,relationshipType:r.relationshipType.bIsToA}):n.push({uuid:`${r.uuid}`,display:r.personA.display,relativeAge:r.personA.age,relativeUuid:r.personA.uuid,relationshipType:r.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?a:null,error:r,isLoading:o,isValidating:i}}(e);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:md.heading,children:tm("relationships","Relationships")}),n?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsx)("ul",{children:t&&t.length>0?(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsxs)("li",{className:md.relationship,children:[(0,aA.jsx)("div",{children:(0,aA.jsx)(oG,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,aA.jsx)("div",{children:e.relationshipType}),(0,aA.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?tm("yearAbbreviation","yr"):tm("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,aA.jsx)("li",{children:"--"})})]})};function mg({patientId:e,deceased:t}){return(0,aA.jsxs)("div",{className:aR()(md.contactDetails,{[md.deceased]:t}),children:[(0,aA.jsxs)("div",{className:md.row,children:[(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mp,{patientId:e})}),(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mf,{patientUuid:e})})]}),(0,aA.jsxs)("div",{className:md.row,children:[(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mh,{patientId:e})}),(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mm,{patientUuid:e})})]})]})}function mw(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),r=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>r.forEach(e=>e.remove())}return()=>{}}let m_="-esm-help-menu__action-menu2-module__container___6Gke0";function my({workspaceGroup:e,groupProps:t}){let n=i2(),{persistence:r}=e;return(0,aA.jsx)("aside",{className:"-esm-help-menu__action-menu2-module__sideRail___T2lMV",children:(0,aA.jsxs)("div",{className:m_,children:["closable"==r&&i5(n)&&(0,aA.jsx)(aW.IconButton,{align:"left",onClick:()=>dD(),label:tm("close"),kind:"ghost",children:(0,aA.jsx)(su,{})}),(0,aA.jsx)(oV.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,aA.jsx)(o3,{className:m_,name:e.name,state:{groupProps:t}})})]})})}function mv(e){let t=new URL(e,window.location.origin).pathname,n=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,r=n.endsWith("/")?n.slice(0,-1):n,o=null;return r?r===t?o="/":t.startsWith(`${r}/`)&&(o=t.slice(r.length)):o=t,{full:t,spaRelative:o}}function mb(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(mx,{}))}function mx(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=dY();if((0,oF.useEffect)(()=>nG("before-page-changed",t=>{let{newPage:r,cancelNavigation:o,oldUrl:i,newUrl:a}=t;if(!e)return;if(r)return void o(dD().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),o=mv(t),i=mv(n);if(null===o.spaRelative||null===i.spaRelative)return!0;let a=r.exec(o.spaRelative),s=r.exec(i.spaRelative);if(a&&s||(a=r.exec(o.full),s=r.exec(i.full)),!a||!s)return!0;if(a.length>1)return!a.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,i,a)&&o(dD().then(e=>!e))}),[e,n]),!e)return null;let o=n[e.groupName],i=t.some(e=>e.maximized),{name:a}=o,s=Object.values(r).filter(e=>e.group===a&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,aA.jsxs)("div",{className:aR()("-esm-help-menu__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-help-menu__workspace-windows-and-menu-module__overlay___7RHYZ":o.overlay,"-esm-help-menu__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,aA.jsx)("div",{className:"-esm-help-menu__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(t=>(0,aA.jsx)(mS,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,aA.jsx)(my,{workspaceGroup:o,groupProps:e.props})]})}function mS({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:r}=e,o=(0,oF.useMemo)(()=>({closeWorkspace(e){oE.setState(t=>dX.closeWorkspace(t,e))},openChildWorkspace(e,t,n){oE.setState(r=>dX.openChildWorkspace(r,e,t,n))},setWorkspaceTitle(e,t){oE.setState(n=>dX.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){oE.setState(n=>dX.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=oE.getState().openedWindows.find(e=>e.windowName===r);return t?dG(t,e):Promise.resolve(!0)}}),[r]);return(0,aA.jsx)(mt,{openedWindow:e,groupProps:t,actions:o,renderChrome:!0,showActionMenu:n})}function mk(e,t,n){if(null==e)return n;let r=lD(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let o=[];for(let e of t){let t=lD(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}o.push({canonical:t,original:e})}let i=r;for(;i;){let e=o.find(e=>e.canonical===i);if(e)return e.original;let t=i+"-",n=o.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===i){i="fr-HT";continue}let r=i.lastIndexOf("-");if(-1===r)break;let a=(i=i.slice(0,r)).lastIndexOf("-");-1!==a&&i.length-a==2&&(i=i.slice(0,a))}return n}function mj(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function mN(e){return!!e&&e.constructor===Object}var mE=n(3376);function mC(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function mP(e,t){return mE(function(e){let t=e.indexOf("-");if(t>=0){let n=mC(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return mC(e)}(t),e,{includePrerelease:!0})}async function mI(e,t={}){let n,{shouldRetry:r,getDelay:o,onError:i}=t;r=r??(e=>e<=5),o=o??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let a=0;do try{return await mA(o(a)),await e()}catch(e){i?.(e,a),n=e}while(r(a++));throw n}async function mA(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function mO(e,t,n,r){}function mR(e){}function m$(e){return Promise.resolve([])}function mT(e){return Promise.resolve([])}function mM(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function mL(e){return()=>{}}function mW(){return!0}}}]);
|
|
28
|
+
To fix this, ensure that you define the "component" field inside the page definition.`,e);let r=function(e,{featureFlag:t}){return t?n=>!!rM(t)&&e(n):e}(function e(t){if(Array.isArray(t)){let n=t.map(e);return e=>n.some(t=>t(e))}return"string"==typeof t?(0,ts.fz)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,ts.AG)(e,()=>av(t.appName,t.component),r)}(r,t)}}let aE={PHONE_MIN:0,PHONE_MAX:600,TABLET_MIN:601,TABLET_MAX:1023,SMALL_DESKTOP_MIN:1024,SMALL_DESKTOP_MAX:1439,LARGE_DESKTOP_MIN:1440,LARGE_DESKTOP_MAX:Number.MAX_SAFE_INTEGER};function aC(){document.body.classList.toggle("omrs-breakpoint-lt-tablet",window.innerWidth<aE.TABLET_MIN),document.body.classList.toggle("omrs-breakpoint-gt-phone",window.innerWidth>aE.PHONE_MAX),document.body.classList.toggle("omrs-breakpoint-gt-tablet",window.innerWidth>aE.TABLET_MAX),document.body.classList.toggle("omrs-breakpoint-lt-desktop",window.innerWidth<aE.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-small-desktop",window.innerWidth<aE.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-large-desktop",window.innerWidth<aE.LARGE_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-gt-small-desktop",window.innerWidth>aE.SMALL_DESKTOP_MAX)}let aP=!1;function aI(){aP||(window.addEventListener("resize",aC),aC(),aP=!0)}var aA=n(6870),aO=n(5530),aR=n.n(aO);function a$({title:e,children:t}){let n="tablet"===i2();return(0,aA.jsxs)("div",{className:aR()({"-esm-help-menu__card-header-module__tabletHeader___Vkmd-":n,"-esm-help-menu__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,aA.jsx)("h4",{children:e}),t]})}let aT=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],aM={primaryColor:{_type:G.String,_description:"The color for displaying primary diagnoses tags",_default:"blue",_validators:[e7.oneOf(aT)]},secondaryColor:{_type:G.String,_description:"The color for displaying secondary diagnoses tags",_default:"gray",_validators:[e7.oneOf(aT)]}},aL={"Brand color #1":{_default:"#005d5d",_type:G.String},"Brand color #2":{_default:"#004144",_type:G.String},"Brand color #3":{_default:"#007d79",_type:G.String},excludePatientIdentifierCodeTypes:{uuids:{_type:G.Array,_description:"List of UUIDs of patient identifier types to exclude from rendering in the patient banner",_default:[],_elements:{_type:G.UUID}}},implementationName:{_type:G.String,_description:"A name of the place (or authority) where all possible locations a user can choose are located.",_default:"Clinic"},logo:{src:{_type:G.String,_default:"",_description:"The path or URL to the logo shown on the login page and while the server is starting up. If set to an empty string, the default OpenMRS logo is used.",_validators:[e7.isUrl]},alt:{_type:G.String,_default:"Logo",_description:"The alternative text for the logo image, displayed when the image cannot be loaded or on hover."}},patientPhotoConceptUuid:{_type:G.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5",_description:"Used to look up the patient photo, which is stored as an attachment obs. Set to `null` in order to disable the feature and use only generated avatars. To remove the avatars entirely, use extension configuration's `remove` feature."},preferredCalendar:{_type:G.Object,_description:"Keys should be locale codes, and values should be the preferred calendar for that locale. For example, {'am': 'ethiopic'}.",_default:{am:"ethiopic"},_elements:{_validators:[e7.oneOf(["buddhist","chinese","coptic","dangi","ethioaa","ethiopic","gregory","hebrew","indian","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","iso8601","japanese","persian","roc","islamicc"])]}},preferredDateLocale:{_type:G.Object,_description:"Allows setting the locale used for date formatting for any browser locale. Does not affect time formatting. Keys should be locale codes, and values should be the preferred locale for formatting dates. For example, {'en': 'en-US', 'fr-CA': 'en-CA'}.",_default:{en:"en-GB"},_elements:{_type:G.String}},diagnosisTags:aM};var aW=n(8326);let aD={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},aU=e=>(0,aA.jsx)(aW.TableBatchActions,{translateWithId:(e,t)=>{let n=aD[e];return n?tm(n,e,t):e},...e}),aB="-esm-help-menu__custom-overflow-menu-module__container___8PykS",aF="-esm-help-menu__custom-overflow-menu-module__menu___qsOLn",aH="-esm-help-menu__custom-overflow-menu-module__show___BserJ",aV="-esm-help-menu__custom-overflow-menu-module__overflowMenuButton___n86Gz",aG=(0,oF.createContext)(null);function az(){let e=(0,oF.useContext)(aG);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function aq({menuTitle:e,children:t}){let[n,r]=oH().useState(!1),o=i7(()=>r(!1),n),i="tablet"===i2(),a=(0,oF.useCallback)(()=>r(e=>!e),[]),s=(0,oF.useRef)(null),l=(0,oF.useRef)(null),c=(0,oF.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,m=(0,oF.useCallback)(()=>{r(!1),s.current?.focus()},[]),p=(0,oF.useMemo)(()=>({closeMenu:m}),[m]),f=(0,oF.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),m())},[m,n]),h=oF.Children.toArray(t);(0,oF.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let g=(0,oF.useCallback)(({currentIndex:e,direction:t})=>{let n=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,o=Array.from(n).indexOf(r);if(-1===o)return void n[t>0?0:n.length-1]?.focus();let i=o+t,a=i<0?n.length-1:i>=n.length?0:i;n[a]?.focus()},[]),w=h.map((e,t)=>(0,oF.isValidElement)(e)?(0,oF.cloneElement)(e,{closeMenu:m,handleOverflowMenuItemFocus:g,index:t}):e);return(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aB),ref:o,children:[(0,aA.jsx)("button",{className:aR()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},aV),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:a,onKeyDown:f,ref:s,children:e}),(0,aA.jsxs)("div",{className:aR()("cds--overflow-menu-options","cds--overflow-menu--flip",aF,{[aH]:n}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:d,onKeyDown:f,ref:l,role:"menu",tabIndex:-1,children:[(0,aA.jsx)("ul",{className:aR()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,aA.jsx)(aG.Provider,{value:p,children:w})}),(0,aA.jsx)("span",{})]})]})}function aJ(e){let t=(0,oF.useContext)(aG);return(0,aA.jsx)(aW.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var aK=n(2277),aX=n(4194);let aY=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],aZ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),aQ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-add",iconProps:e})})),a0=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),a1=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),a2=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),a5=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),a6=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),a8=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),a3=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),a4=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),a7=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),a9=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),se=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),st=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),sn=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),sr=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),so=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),si=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),sa=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),ss=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),sl=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),sc=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),su=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-close",iconProps:e})})),sd=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),sm=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),sp=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-document",iconProps:e})})),sf=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),sh=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-download",iconProps:e})})),sg=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),sw=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),s_=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),sy=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-events",iconProps:e})})),sv=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),sb=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),sx=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),sS=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),sk=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),sj=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-group",iconProps:e})})),sN=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),sE=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),sC=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),sP=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-information",iconProps:e})})),sI=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),sA=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),sO=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),sR=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),s$=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),sT=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-location",iconProps:e})})),sM=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),sL=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),sW=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),sD=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),sU=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),sB=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),sF=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-money",iconProps:e})})),sH=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),sV=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),sG=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sz=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sq=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-password",iconProps:e})})),sJ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),sK=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),sX=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),sY=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),sZ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),sQ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),s0=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),s1=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-report",iconProps:e})})),s2=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),s5=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-save",iconProps:e})})),s6=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-search",iconProps:e})})),s8=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),s3=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),s4=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),s7=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),s9=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),le=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),lt=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),ln=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-table",iconProps:e})})),lr=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-time",iconProps:e})})),lo=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),li=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),la=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),ls=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),ll=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),lc=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),lu=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),ld=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),lm=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lp=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lf=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-view",iconProps:e})})),lh=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(lx,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),lg=lh,lw=sf,l_=s$,ly=sC,lv=s7,lb=(0,oF.memo)((0,oF.forwardRef)(function({icon:e,fallback:t,...n},r){let o=(0,oF.useRef)(e?document.getElementById(e):void 0);return(0,oF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(o.current=e?document.getElementById(e):void 0)});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,aA.jsx)(iv,{value:o.current,fallback:t,children:(0,aA.jsx)(lx,{ref:r,icon:e,iconProps:n})})})),lx=(0,oF.memo)((0,oF.forwardRef)(function({icon:e,iconProps:t},n){let{className:r,fill:o,size:i}=Object.assign({},{fill:"currentColor",size:20},t);(i<=0||i>72)&&(console.error(`Invalid size '${i}' specified for ${e}. Defaulting to 20.`),i=20);let a=(0,oF.useRef)(null);return(0,oF.useImperativeHandle)(n,()=>a.current),(0,oF.useEffect)(()=>{a.current&&"currentColor"!==o&&a.current.style.setProperty("--omrs-icon-fill",o)},[]),(0,aA.jsx)("svg",{ref:a,className:aR()("omrs-icon","-esm-help-menu__icons-module__icon___BfFhd",r),height:i,width:i,viewBox:"0 0 16 16",children:(0,aA.jsx)("use",{href:`#${e}`})})})),lS=({path:e,title:t,basePath:n,icon:r})=>{let{t:o}=(0,o9.useTranslation)(),i=(0,aK.zy)(),a=(0,oF.useMemo)(()=>{if(!e)return!1;let t=e.startsWith("/")?e.slice(1):e;if(t.startsWith("http"))return t===window.location.href;let n=t.split("/").map(e=>decodeURIComponent(e)),r=(i.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return r.some((e,t)=>n.every((e,n)=>r[t+n]===e))},[i.pathname,e]);return(0,aA.jsx)("div",{children:(0,aA.jsx)(oG,{className:aR()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${n}/${encodeURIComponent(e)}`,children:(0,aA.jsxs)("span",{className:"-esm-help-menu__dashboard-module__menu___ds1tf",children:[(0,aA.jsx)(lb,{icon:r,className:"-esm-help-menu__dashboard-module__icon___4Zrrh",size:16}),(0,aA.jsx)("span",{children:o(t)})]})})},e)};function lk(e){return function({basePath:t}){return(0,aA.jsx)(aX.Kd,{children:(0,aA.jsx)(lS,{basePath:t,...e})})}}var lj=n(7715),lN=n(7532),lE=n(3692),lC=n(7615),lP=n(700),lI=n(6816),lA=n(1168);function lO(e){return oH().createElement(lA.C,e)}var lR=n(3010),l$=n(6513),lT=n(6190);function lM(e,t,n=!1){if(null==e)return n?e:void 0;if("string"==typeof e&&!e)return n?null:void 0;if(e instanceof lR.ng||e instanceof lR._l||e instanceof lR.Ip)return t?(0,l$.yP)(e,t):e;{let n=au()(e).toDate(),r=new lR.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,l$.yP)(r,t):r}}function lL(e){if(e)return e.toDate((0,lT.Xj)())}var lW=n(9002);function lD(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function lU(e){let t=e??"",n=lD(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function lB(){let e=window.i18next.language,t=lD(e)??e;return"ht"===t&&(t="fr-HT"),t}var lF=n(7883),lH=n(424),lV=n(1492),lG=n(8271);function lz(e,t){var n=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return n.get?n.get.call(e):n.value}ac.extend(ad),ac.extend(lV),ac.extend(lH);let lq="YYYY-MM-DDTHH:mm:ss.SSSZZ";function lJ(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&ac(e,lq).isValid()}function lK(e){return ac(e).isToday()}function lX(e){return lJ(e)?ac(e,lq).toDate():null}function lY(e,t=!1){let n=ac(e);return t&&(n=n.utc()),n.format(lq)}function lZ(e){return ac(e).toDate()}var lQ=new WeakMap;let l0=new class{register(e,t){lz(this,lQ).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lz(this,lQ).has(t))return lz(this,lQ).get(t)}if(e.language&&lz(this,lQ).has(e.language))return lz(this,lQ).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lz(this,lQ).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,lQ,{writable:!0,value:new Map})}};function l1(e,t){l0.register(e,t)}function l2(e){let t=e??lB();return l0.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l5={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l6(e,t={}){let n=lB(),r=(0,lF.CD)(e,n);if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lG.A)(r.day)&&(0,lG.A)(r.month)&&(r=Object.assign({},(0,H.A)(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},(0,H.A)(r,"day"),{date:r.day}));let o=ac().set(r).toDate();return(0,lG.A)(r.year)&&(t.year=!1),(0,lG.A)(r.month)&&(t.month=!1),(0,lG.A)(r.date)&&(t.day=!1),l8(o,t)}function l8(e,t){let n,r=t?.locale??lB(),o=new Intl.Locale(r),{calendar:i,mode:a,time:s,day:l,month:c,year:u,noToday:d,numberingSystem:m}={...l5,...{noToday:"am"===o.language},...t},p={calendar:i??l2(o),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=ac(e).isToday();if(f&&!d)n=(n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(r)+n.slice(1);else{"en"===o.language&&(r="en-GB");let t=new Intl.DateTimeFormat(r,p).formatToParts(e);("en"===o.language||"am"===o.language)&&"standard"==a&&u&&l&&(t=t.map(l3("-"))),"wide"==a&&(t=t.map(l3(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,n)=>"era"!==e.type&&("literal"!==e.type||!(t<n.length-1)||"era"!==n[t+1].type))),n=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(n+=`, ${l4(e)}`),n}let l3=e=>(t,n,r)=>"literal"!==t.type||" "!==t.value||n<r.length-1&&"era"===r[n+1].type?t:{type:"literal",value:e};function l4(e){return e.toLocaleTimeString(lB(),{hour:"2-digit",minute:"2-digit"})}function l7(e,t){return l8(e,{...t,time:!0})}function l9(e,t){let n=l2("string"==typeof t?new Intl.Locale(t):t);return n?(0,l$.yP)(e,(0,lW.d)(n)):e}function ce(e,t){return new Intl.DurationFormat(lB(),t).format(e)}function ct(e,t){if(null==e)return null;if("string"==typeof e){let n=lB(),r=(0,lF.CD)(e,n);return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...(0,H.A)(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...(0,H.A)(r,"day"),...{date:r.day}}),ac(t).set(r))}return ac(e)}let cn=["years","months","days","hours","minutes","seconds"],cr={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},co={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function ci(e,t=ac(),n){let r,o=ac(t),i=ct(e,o);if(null==i)return null;if("string"==typeof n){let e=cr[n]??n;return{[e]:o.diff(i,e)}}let{thresholds:a,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?cr[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=cn.indexOf(n);for(let o=0;o<cn.length;o++){let i=cn[o];if(t.diff(e,i)>0)return o<=r?i:n}return n}(i,o,t??"seconds"):cr[s]??s,function(e,t,n,r){let o=cn.indexOf(n),i=cn.indexOf(r),a=cn.slice(o,i+1),s={},l=e;for(let e of a){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(i,o,e,t??e)}let c=(r=function(e){let t={...co};if(e)for(let[n,r]of Object.entries(e))void 0!==r&&(t[cr[n]??n]=r);return t}(a),o.diff(i,"seconds")<r.seconds?"seconds":o.diff(i,"minutes")<r.minutes?"minutes":o.diff(i,"hours")<r.hours?"hours":o.diff(i,"days")<r.days?"days":o.diff(i,"months")<r.months?"months":"years");return{[c]:o.diff(i,c)}}let ca={style:"short",localeMatcher:"lookup"};function cs(e,t=ac(),n){let r=ci(e,t,n);return null==r?null:ce(r,"object"==typeof n&&n.formatOptions?{...ca,...n.formatOptions}:ca)}let cl=(0,oF.createContext)(null);function cc(){let e=iA({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,oF.useMemo)(()=>{let t=lB();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,oF.useMemo)(()=>{let e=l2(t);return void 0!==e?(0,lW.d)(e):void 0},[t]),r=(0,oF.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),o=(0,oF.useMemo)(()=>n?(0,l$.yP)((0,lT.Ec)((0,lT.Xj)()),n):(0,lT.Ec)((0,lT.Xj)()),[n]);return{calendar:n,intlLocale:r,today_:o}}let cu=new lR.ng(1793,1,1);var cd=n(5830),cm=n(5354),cp=n(4745),cf=n(1202);function ch(e,t){return Number.parseInt(l8(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let cg=(0,oF.forwardRef)(function(e,t){let{className:n}=e,r=(0,oF.useContext)(cd.f2),o=(0,oF.useContext)(cd._I),i=r??o,a=(0,oF.useContext)(cl),s=(0,lT.Xj)(),l=l8(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=ch(i.visibleRange.start.toDate(s),a),u=i.maxValue?ch(i.maxValue.toDate(s),a):void 0,d=i.minValue?ch(i.minValue.toDate(s),a):void 0,m=(0,oF.useCallback)(e=>{i.setFocusedDate(i.focusedDate.cycle("year",e-i.focusedDate.year))},[]);return i&&(0,aA.jsxs)("span",{ref:t,className:n,children:[(0,aA.jsx)("span",{children:l}),(0,aA.jsxs)(cp.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,aA.jsx)(cf.p,{}),(0,aA.jsxs)(lC.Y,{children:[(0,aA.jsx)(lP.$,{slot:"increment",children:(0,aA.jsx)(se,{size:8})}),(0,aA.jsx)(lP.$,{slot:"decrement",children:(0,aA.jsx)(a4,{size:8})})]})]})]})});var cw=n(9588);let c_="-esm-help-menu__datepicker-module__inputGroup___+4zks",cy="-esm-help-menu__datepicker-module__inputSegment___wiExn",cv="-esm-help-menu__datepicker-module__dateInputWrapper___uiyAC",cb="-esm-help-menu__datepicker-module__invalidText___SxtTL",cx="-esm-help-menu__datepicker-module__flatButton___UU1Qp",cS="-esm-help-menu__datepicker-module__flatButtonMd___fhR-1",ck="-esm-help-menu__datepicker-module__flatButtonSm___5INZ7",cj="-esm-help-menu__datepicker-module__flatButtonLg___RFMrl";function cN({children:e}){let t=(0,oF.useContext)(lN.Pg),n=(0,oF.useContext)(lN.a8),r=t??n,o=i7(()=>r?.close());return(0,aA.jsx)(cw.lG,{className:"-esm-help-menu__datepicker-module__dialog___qllIf",ref:o,children:e})}let cE=(0,oF.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},o){let i="range"===e,a=i?cd._e:cd.Vv;return(0,aA.jsx)(cm.A,{ref:o,className:"-esm-help-menu__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,aA.jsx)(cN,{children:(0,aA.jsxs)(a,{...i?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,aA.jsxs)("header",{className:"-esm-help-menu__datepicker-module__header___WAVlD",children:[(0,aA.jsx)(lP.$,{className:aR()(cx,cS),slot:"previous",children:(0,aA.jsx)(ss,{size:16})}),(0,aA.jsx)(cg,{className:"-esm-help-menu__datepicker-module__monthYear___A3aKF"}),(0,aA.jsx)(lP.$,{className:aR()(cx,cS),slot:"next",children:(0,aA.jsx)(sl,{size:16})})]}),(0,aA.jsx)(cd.r8,{className:"-esm-help-menu__datepicker-module__calendarGrid___6qRB2",children:e=>(0,aA.jsx)(cd.Zr,{className:aR()("cds--date-picker__day",{"-esm-help-menu__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cC=n(8017),cP=n(9774),cI=n(7956);let cA=(0,oF.forwardRef)(function(e,t){let n=(0,oF.useContext)(lN.Pg),[r,o]=(0,lj.JT)({slot:e.slot},t,cP.cQ),{locale:i}=(0,lA.Y)(),a=(0,cI.F)({...r,locale:i,createCalendar:lW.d}),s=(0,oF.useRef)(null),{fieldProps:l,inputProps:c}=(0,cC.cJ)({...r,inputRef:s},a,o),u=(0,oF.useCallback)(()=>{a.isDisabled||n.toggle()},[]);return(0,aA.jsxs)(lj.Kq,{values:[[cP.$,a],[cf.E,{...c,ref:s}],[lC.t,{...l,ref:o,isInvalid:a.isInvalid}]],children:[(0,aA.jsx)(lC.Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:a.isDisabled,isInvalid:a.isInvalid,onClick:u,children:a.segments.map((t,n)=>(0,oF.cloneElement)(e.children(t),{key:n}))}),(0,aA.jsx)(cf.p,{})]})}),cO=(0,oF.forwardRef)(function(e,t){let n=(0,oF.useContext)(lN.Pg),r=(0,oF.useContext)(lN.a8);return(n??r).isInvalid?(0,aA.jsx)(lh,{ref:t,size:16,...e}):(0,aA.jsx)(a3,{ref:t,size:16,...e})});var cR=n(64),c$=n(5503),cT=n(1697),cM=n(7866),cL=n(8035),cW=n(2231);let cD=(0,oF.forwardRef)(function({segment:e,...t},n){let r=(0,oF.useContext)(cP.$),o=(0,cR.U)(n),{segmentProps:i}=(0,c$.V)(e,r,o),{focusProps:a,isFocused:s,isFocusVisible:l}=(0,cT.o)(),{hoverProps:c,isHovered:u}=(0,cM.M)({...t,isDisabled:r.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:r,defaultClassName:o,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,oF.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:o}):t,l="function"==typeof n?n({...s,defaultStyle:a||{}}):n,c="function"==typeof r?r({...s,defaultChildren:i}):null==r?i:r,{className:e??o,style:l||a?{...a,...l}:void 0,children:c??i,"data-rac":""}},[t,n,r,o,i,a,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:r.isInvalid,isDisabled:r.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,oF.useCallback)(e=>{e.stopPropagation()},[]);return(0,aA.jsx)("span",{...(0,cL.v)((0,cW.$)(t),i,a,c),...d,ref:o,style:i.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":r.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":r.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),cU={short:!1,size:"md"},cB=(0,oF.forwardRef)(function(e,t){let{className:n,defaultValue:r,isDisabled:o,invalid:i,invalidText:a,isInvalid:s,label:l,labelText:c,light:u,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:w,..._}={...cU,...e},{calendar:y,intlLocale:v,today_:b}=cc(),x=(0,oF.useId)(),S=!!(c??l),k=(0,oF.useMemo)(()=>lM(r,y),[r,y]),j=(0,oF.useMemo)(()=>lM(w,y,!0),[w,y]),N=(0,oF.useMemo)(()=>lM(d,y),[d,y]),E=(0,oF.useMemo)(()=>lM(m??cu,y),[m,y]),C=(0,oF.useMemo)(()=>i||s,[i,s]),P=(0,oF.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(lL(e)))),[f,p]);return(0,aA.jsx)(lO,{locale:v.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",n),children:(0,aA.jsx)(lj.Kq,{values:[[cl,v]],children:(0,aA.jsxs)(lN.lr,{className:aR()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":u}),defaultValue:k,isDisabled:o,isInvalid:C,maxValue:N,minValue:E,value:j,shouldForceLeadingZeros:"en"===v.language||void 0,..._,onChange:P,children:[(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,aA.jsx)(lE.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:x,children:c??l}),(0,aA.jsxs)(lC.Y,{className:c_,children:[(0,aA.jsx)(cA,{id:S?x:void 0,ref:t,className:aR()("cds--date-picker-input__wrapper","-esm-help-menu__datepicker-module__inputWrapper___kykar",{"-esm-help-menu__datepicker-module__inputWrapperSm___KJtg-":"sm"===g,"-esm-help-menu__datepicker-module__inputWrapperMd___ablE9":"md"===g||!g||0===g.length,"-esm-help-menu__datepicker-module__inputWrapperLg___5dkQp":"lg"===g}),children:e=>"era"!==e.type?(0,aA.jsx)(cD,{className:cy,segment:e}):(0,aA.jsx)(oH().Fragment,{})}),(0,aA.jsx)(lP.$,{className:aR()(cx,{[ck]:"sm"===g,[cS]:"md"===g||!g||0===g.length,[cj]:"lg"===g}),children:(0,aA.jsx)(cO,{})})]}),(0,aA.jsx)(lI.b,{className:cb,children:a})]}),(0,aA.jsx)(cE,{variant:"single",today_:b})]})})})})}),cF=(0,oF.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:r,isDisabled:o,isInvalid:i,label:a,labelText:s,light:l,maxDate:c,minDate:u,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:w,intlLocale:_,today_:y}=cc(),v=(0,oF.useId)(),b=!!(s??a),x=(0,oF.useMemo)(()=>{if(f)return{start:lM(f[0],w,!1),end:lM(f[1],w,!1)}},[f,w]),S=(0,oF.useMemo)(()=>{if(t)return{start:lM(t[0],w,!1),end:lM(t[1],w,!1)}},[t,w]),k=(0,oF.useMemo)(()=>lM(u??cu,w,!0),[u,w]),j=(0,oF.useMemo)(()=>lM(c,w,!0),[c,w]),N=(0,oF.useMemo)(()=>n||i,[n,i]),E=(0,oF.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([lL(e.start),lL(e.end)]))),[m,d]);return(0,aA.jsx)(lO,{locale:_.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",e),children:(0,aA.jsx)(lj.Kq,{values:[[cl,_]],children:(0,aA.jsx)(lN.Ur,{id:b?v:void 0,className:aR()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":o}),isInvalid:N,shouldForceLeadingZeros:"en"===_.language||void 0,maxValue:j,minValue:k,value:x,defaultValue:S,ref:g,isDisabled:o,...h,onChange:E,children:(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[b&&(0,aA.jsx)(lE.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:v,children:s??a}),(0,aA.jsxs)(lC.Y,{className:c_,children:[(0,aA.jsxs)("div",{className:aR()("-esm-help-menu__datepicker-module__inputsWrapper___YlkGh",{"-esm-help-menu__datepicker-module__inputsWrapperSm___fAKhS":"sm"===p,"-esm-help-menu__datepicker-module__inputsWrapperMd___XVgGP":"md"===p||!p||0===p.length,"-esm-help-menu__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===p}),children:[(0,aA.jsx)(cP.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-help-menu__datepicker-module__startInput___qgbQm",cv),slot:"start",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})}),(0,aA.jsx)("div",{className:"-esm-help-menu__datepicker-module__separator___79vXZ",children:(0,aA.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,aA.jsx)(cP.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-help-menu__datepicker-module__endInput___huv7x",cv),slot:"end",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})})]}),(0,aA.jsx)(lP.$,{className:aR()(cx,{[ck]:"sm"===p,[cS]:"md"===p||!p||0===p.length,[cj]:"lg"===p}),children:(0,aA.jsx)(cO,{})})]}),(0,aA.jsx)(lI.b,{className:cb,children:r}),(0,aA.jsx)(cE,{variant:"range",today_:y,minDate:k,maxDate:j})]})})})})})});var cH=n(9606);let cV=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=iA({externalModuleName:"@openmrs/esm-styleguide"});return(0,aA.jsx)("div",{className:"-esm-help-menu__diagnosis-tags-module__container___8kut8",children:e.map(e=>{let r=t&&"PROVISIONAL"===e.certainty,o=1===e.rank?n?.primaryColor??"blue":n?.secondaryColor??"gray";return(0,aA.jsx)(cG,{color:o,isProvisional:r,name:e.display},e.uuid)})})};function cG({color:e,isProvisional:t,name:n}){let[r,o]=(0,oF.useState)(!1),[i,a]=(0,oF.useState)(!1),[s,l]=(0,oF.useState)(!1),c=s||i,u=(0,oF.useRef)(null);(0,oF.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||o(!1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n,t,c]);let d=aR()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-help-menu__diagnosis-tags-module__diagnosisTag___PFhpl"),m=(0,aA.jsxs)(aA.Fragment,{children:[t&&(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("span",{"aria-hidden":"true",className:"-esm-help-menu__diagnosis-tags-module__provisionalMark___8o6l4",children:"?"}),(0,aA.jsxs)("span",{className:"cds--visually-hidden",children:[tm("provisional","Provisional")," "]})]}),(0,aA.jsx)("span",{ref:u,className:"cds--tag__label",children:n})]});return c?(0,aA.jsxs)(cH.k$,{delay:0,closeDelay:150,isOpen:r,onOpenChange:o,children:[(0,aA.jsx)(lP.$,{className:d,"data-testid":"diagnosis-tag",onFocusChange:a,onPress:()=>o(!0),children:m}),(0,aA.jsx)(cH.m_,{className:"-esm-help-menu__diagnosis-tags-module__tagTooltip___asRTH",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,aA.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let cz={action:"-esm-help-menu__empty-card-module__action___Y0dul",content:"-esm-help-menu__empty-card-module__content___fo0nB",desktopHeading:"-esm-help-menu__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-help-menu__empty-card-module__tabletHeading___BogTF",tile:"-esm-help-menu__empty-card-module__tile___QB8Ld"},cq=({width:e="64",height:t="64"})=>(0,aA.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,aA.jsx)("use",{href:"#omrs-empty-data-illustration"})}),cJ=e=>{let t="tablet"===i2(),n=e.launchForm;return(0,aA.jsx)(aW.Layer,{className:cz.layer,children:(0,aA.jsxs)(aW.Tile,{className:cz.tile,children:[(0,aA.jsx)("div",{className:t?cz.tabletHeading:cz.desktopHeading,children:(0,aA.jsx)("h4",{children:e.headerTitle})}),(0,aA.jsx)(cq,{}),(0,aA.jsx)("p",{className:cz.content,children:tm("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,aA.jsx)("p",{className:cz.action,children:n&&(0,aA.jsx)(aW.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tm("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},cK=({error:e,headerTitle:t})=>{let n="tablet"===i2();return(0,aA.jsx)(aW.Layer,{children:(0,aA.jsxs)(aW.Tile,{className:"-esm-help-menu__error-state-module__tile___dd418",children:[(0,aA.jsx)("div",{className:n?"-esm-help-menu__error-state-module__tabletHeading___g5rjg":"-esm-help-menu__error-state-module__desktopHeading___Nd9u2",children:(0,aA.jsx)("h4",{children:t})}),(0,aA.jsxs)("p",{className:"-esm-help-menu__error-state-module__errorMessage___z2RiN",children:[tm("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,aA.jsx)("p",{className:"-esm-help-menu__error-state-module__errorCopy___dq+e2",children:tm("errorCopy")})]})})},cX=cK,cY=oH().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:o,state:i}=i8(),a=window.location??{pathname:""},s=o5(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,aA.jsxs)(aW.SideNav,{"aria-label":tm("leftNavigation","Left navigation"),className:"-esm-help-menu__left-nav-module__leftNav___jzTJK",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,aA.jsx)(o3,{name:"global-nav-menu-slot"}),n?(0,aA.jsx)(iv,{value:o,fallback:(0,aA.jsx)(o3,{name:n,state:{basePath:r,currentPath:a,...i}}),children:(0,aA.jsx)(oV.Provider,{value:o,children:(0,aA.jsx)(o3,{name:n,state:{basePath:r,currentPath:a,...i}})})}):null]}):null}),cZ=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:r=50,onChange:o})=>{let[i,a]=(0,oF.useState)(""),s=(0,oF.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:r,isLoading:o}=(0,i$.A)(t,tP,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,oF.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?r:null,isLoading:!!t&&o}),[n,o,r,t])}(t),{locations:c,isLoading:u,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,n=""){let r=iR(n),{data:o,isLoading:i,isValidating:a,setSize:s,error:l}=(0,iJ.Ay)(function(n,o){if(o){let e=o.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let i=`${tN}/Location?`,a=new URLSearchParams;return a.append("_summary","data"),t&&a.append("_count",""+t),n&&a.append("_getpagesoffset",""+n*t),e&&a.append("_tag",e),"string"==typeof r&&""!==r&&a.append("name:contains",r),i+a.toString()},tP);return(0,oF.useMemo)(()=>({locations:o?.length?o?.flatMap(e=>e?.data?.entry??[]):[],isLoading:i,totalResults:o?.[0]?.data?.total,hasMore:!!o?.length&&o?.[o.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:a,error:l||null,setPage:s}),[i,o,a,s,l])}(n,r,i),h=(0,oF.useMemo)(()=>l&&!i&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,i]),g=(0,oF.useCallback)(e=>{o(),a(e.trim())},[o]),w=i9((0,oF.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),_=d?Math.max(0,Math.floor(h.length-r/2)):-1;return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)(aW.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:tm("searchForLocation"),id:s,placeholder:tm("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__errorNotification___vWBFD",id:`${s}-error`,children:(0,aA.jsx)(aW.InlineNotification,{kind:"error",subtitle:tm("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:tm("error","Error")})}),(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__searchResults___Gbet+",children:u?(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,aA.jsx)(aW.RadioButtonSkeleton,{className:"-esm-help-menu__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__locationResultsContainer___6Pasf",children:h.length>0?(0,aA.jsx)(aW.RadioButtonGroup,{name:"loginLocations",onChange:e=>{o(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,aA.jsx)(aW.RadioButton,{className:"-esm-help-menu__location-picker-module__locationRadioButton___rTDPj",id:e.resource.id,labelText:(0,aA.jsx)("span",{ref:t===_?w:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__emptyState___w4-Ca",children:(0,aA.jsx)("p",{className:"-esm-help-menu__location-picker-module__locationNotFound___Of2MJ",children:tm("noResultsToDisplay")})})}),m&&(0,aA.jsx)("div",{className:"-esm-help-menu__location-picker-module__loadingIcon___NAwSB",children:(0,aA.jsx)(aW.InlineLoading,{description:tm("loading")})})]})})]})},cQ=R("modalState",{modalContainer:null,modalStack:[]}),c0=0;async function c1(e,t,n={}){let r=oN(t),o=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:i}=r,a=await i(),s=c0++;o=await oW({...a,name:`${t}-${s}`},{...n,domElement:e})}else y(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return o}function c2(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c5(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c6(e){return e.find(e=>!c2(e))}function c8(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let c3=window.getComputedStyle(document.body).overflow;function c4({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",c9),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c6(e);e.forEach(e=>{switch(e.state){case"NEW":{let n=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=n,e.state="MOUNTING",c1(n,e.modalName,e.props).then(r=>{c2(e)?c5(e.modalName,r):r?(e.parcel=r,t.prepend(n),c8(e,c6(cQ.getState().modalStack)===e),r.mountPromise.then(()=>{c2(e)||(e.state="MOUNTED")},t=>{y(t),e.parcel=null,c7(e)})):c7(e)},t=>{y(t),c7(e)});break}case"MOUNTING":case"MOUNTED":c8(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c5(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=cQ.getState();cQ.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=c3,removeEventListener("keydown",c9)}function c7(e){if(c2(e))return;e.state="TO_BE_DELETED";let t=cQ.getState();cQ.setState({...t,modalStack:[...t.modalStack]})}function c9(e){"Escape"===e.key&&function(){let[e]=cQ.getState().modalStack;e&&c7(e)}()}function ue(e){cQ.subscribe(c4),cQ.setState({...cQ.getState(),modalContainer:e})}function ut(e,t={},n=()=>{}){let r=()=>{let e=cQ.getState().modalStack.find(e=>e.onClose===n);e&&c7(e)};if(oN(e)){var o;let i,a;o={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},a=[o,...(i=cQ.getState()).modalStack],cQ.setState({...i,modalStack:a})}else y(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var un=n(9685);let ur=({notification:e})=>{let{description:t,action:n,kind:r,critical:o,title:i,onAction:a}=e;return(0,aA.jsx)(aW.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:o,subtitle:t,title:i||"",inline:!0,onActionButtonClick:a})},uo=({subject:e})=>{let[t,n]=(0,oF.useState)([]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(ur,{notification:e},e.id))})},ui=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:r,kind:o,title:i,critical:a,progressActionLabel:s,id:l,...c}=e,[u,d]=(0,oF.useState)(t);return(0,aA.jsx)(aW.ActionableNotification,{kind:o||"info",actionButtonLabel:u,ariaLabel:tm("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:tm("actionableNotification","Actionable notification"),subtitle:r,title:i,lowContrast:a,inline:!0,...c})},ua=({subject:e})=>{let[t,n]=(0,oF.useState)([]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(ui,{notification:e},e.id))})};class us{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"listeners",new Set)}}let ul=new us,uc=0,uu=new us,ud=0;function um(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(uo,{subject:ul}))}function up(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,un.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{ul.next({...e,id:uc++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function uf(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(ua,{subject:uu}))}function uh(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,un.A)(t))?setTimeout(()=>{uu.next({...e,id:ud++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let ug=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],uw=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],u_={container:"-esm-help-menu__numeric-observation-module__container___NfxbH",card:"-esm-help-menu__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-help-menu__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-help-menu__numeric-observation-module__critical-value___JAIHt",cell:"-esm-help-menu__numeric-observation-module__cell___lTunW","critically-high":"-esm-help-menu__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-help-menu__numeric-observation-module__critically-low___5srAK",high:"-esm-help-menu__numeric-observation-module__high___7KiyK",low:"-esm-help-menu__numeric-observation-module__low___Zs2ct","label-container":"-esm-help-menu__numeric-observation-module__label-container___lGnGH","value-container":"-esm-help-menu__numeric-observation-module__value-container___hHPXt",label:"-esm-help-menu__numeric-observation-module__label___WFuxk",value:"-esm-help-menu__numeric-observation-module__value___6fHUr",units:"-esm-help-menu__numeric-observation-module__units___EdVuw","pad-right":"-esm-help-menu__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-help-menu__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-help-menu__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-help-menu__numeric-observation-module__arrow___SLGUh"},uy=({value:e,unit:t,label:n,interpretation:r,referenceRange:o,conceptUuid:i,variant:a="card",patientUuid:s})=>{let l=(0,oF.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${tj}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${tj}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:o,isLoading:i}=(0,i$.A)(n,tP),a=r?.data?.results?.[0];return{referenceRange:a?{hiNormal:a.hiNormal??null,hiAbsolute:a.hiAbsolute??null,hiCritical:a.hiCritical??null,lowNormal:a.lowNormal??null,lowAbsolute:a.lowAbsolute??null,lowCritical:a.lowCritical??null}:void 0,error:o,isLoading:i}}(o||r?void 0:i,s),d=o??c,m=(0,oF.useMemo)(()=>{if(r)return r?"--"===r?"normal":ug.includes(r)?r.toLowerCase():uw.includes(r)?r:"normal":void 0;if(d&&!u){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[r,d,e,u])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,w=`omrs-numeric-obs-unit-${l}`,_=null!=e&&""!==e,y=_?e:tm("notAvailable","Not available"),v=aR()({[u_["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[u_["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[u_.low]:"low"===m,[u_.high]:"high"===m,[u_["off-scale-low"]]:"off_scale_low"===m,[u_["off-scale-high"]]:"off_scale_high"===m}),b=aR()({[u_.container]:!0,[u_.card]:!0,[u_["critical-value"]]:p,[u_["abnormal-value"]]:f&&!p}),x=aR()({[u_.cell]:!0,[v]:!0});return"cell"===a?(0,aA.jsxs)("div",{className:x,children:[y,_&&t?` ${t}`:""]}):(0,aA.jsxs)("section",{className:b,"data-testid":"numeric-observation-card",children:[n&&(0,aA.jsxs)("div",{className:u_["label-container"],children:[(0,aA.jsx)("span",{id:h,className:u_.label,children:n}),f&&(0,aA.jsx)("span",{className:u_[m.replace("_","-")],title:tm("abnormalValue","Abnormal value")})]}),(0,aA.jsxs)("div",{className:u_["value-container"],children:[(0,aA.jsx)("span",{id:g,"aria-labelledby":h&&w?`${h} ${w}`:h||w||void 0,className:u_.value,children:y}),_&&t&&(0,aA.jsx)("span",{id:w,className:u_.units,children:t})]})]})},uv="-esm-help-menu__page-header-module__pageHeader___YOpQL",ub=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,aA.jsx)("div",{className:aR()(uv,n),...r,children:t})}{let{title:t,illustration:n,className:r,...o}=e;return(0,aA.jsx)("div",{className:aR()(uv,r),...o,children:(0,aA.jsx)(ux,{title:t,illustration:n})})}},ux=({title:e,illustration:t,className:n})=>{let[r,o]=(0,oF.useState)(null);return(0,oF.useEffect)(()=>{eM("@openmrs/esm-styleguide").then(e=>{o(e)})},[]),(0,aA.jsxs)("div",{className:aR()("-esm-help-menu__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,aA.jsxs)("div",{className:"-esm-help-menu__page-header-module__pageLabels___pPcKj",children:[r?.implementationName&&(0,aA.jsx)("p",{children:tm(r.implementationName)}),(0,aA.jsx)("h1",{className:"-esm-help-menu__page-header-module__pageName___3d4IC",children:e})]})]})},uS=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:r,dashboardLinkUrl:o,currentItems:i,dashboardLinkLabel:a})=>{let{pageSizes:s,pageItemsCount:l}=an(t,e,r,i),c="tablet"===i2(),u=tm("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,aA.jsx)(aA.Fragment,{children:e>0&&(0,aA.jsxs)("div",{className:aR()({"-esm-help-menu__pagination-module__tablet___lQ3ak":c,"-esm-help-menu__pagination-module__desktop___HfUTY":!c}),children:[(0,aA.jsxs)("div",{children:[u,o&&(0,aA.jsx)(oG,{to:o,className:"-esm-help-menu__pagination-module__configurableLink___NM9v7",children:a??tm("seeAll","See all")})]}),(0,aA.jsx)(aW.Pagination,{className:"-esm-help-menu__pagination-module__pagination___WzkBs",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>tm("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function uk(e){return uN(uC(e,"usual","official"))}function uj(e){return uk(e)}function uN(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uE(e){return uN(e)}function uC(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,r;return t=e,r=n,t.use?t.use===r:"usual"===r});if(t)return t}}function uP(e,t=ac()){let n=ac(t),r=ct(e,n);if(null==r)return null;let o=n.diff(r,"hours"),i=n.diff(r,"days"),a=n.diff(r,"weeks"),s=n.diff(r,"months"),l=n.diff(r,"years"),c={};if(o<2)c.minutes=n.diff(r,"minutes");else if(i<2)c.hours=o;else if(a<4)c.days=i;else if(l<1){let e=n.subtract(a,"weeks").diff(r,"days");c.weeks=a,c.days=e}else if(l<2){let e=n.subtract(s,"months").diff(r,"days");c.months=s,c.days=e}else if(l<18){let e=n.subtract(l,"year").diff(r,"months");c.years=l,c.months=e}else c.years=l;return c}function uI(e,t=ac()){let n=uP(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),ce(n,r)}let uA={container:"-esm-help-menu__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-help-menu__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-help-menu__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-help-menu__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-help-menu__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-help-menu__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-help-menu__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-help-menu__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-help-menu__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-help-menu__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-help-menu__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-help-menu__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-help-menu__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-help-menu__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-help-menu__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-help-menu__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-help-menu__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-help-menu__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-help-menu__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-help-menu__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-help-menu__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-help-menu__patient-banner-patient-info-module__actionsButtonText___mn139"};function uO({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsx)("span",{className:uA.primaryIdentifier,children:(0,aA.jsxs)(aW.Tag,{className:uA.tag,type:"gray",children:[e&&t?.text&&(0,aA.jsxs)("span",{className:uA.label,children:[t.text,": "]}),(0,aA.jsx)("span",{className:uA.value,children:n})]})})}function uR({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsxs)(aW.FormLabel,{className:uA.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,aA.jsxs)("span",{className:uA.label,children:[t?.text,": "]}),(0,aA.jsx)("span",{className:uA.value,children:n})]})}function u$({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=iA(),{primaryIdentifierCode:r}=ai(),o=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,aA.jsx)(aA.Fragment,{children:o?.length?o.map(({value:e,type:n},i)=>(0,aA.jsxs)(oH().Fragment,{children:[(0,aA.jsx)("span",{className:uA.identifier,children:n?.coding?.[0]?.code===r?(0,aA.jsx)(uO,{showIdentifierLabel:t,type:n,value:e}):(0,aA.jsx)(uR,{showIdentifierLabel:t,type:n,value:e})}),i<o.length-1&&(0,aA.jsx)("span",{className:uA.separator,children:"\xb7"})]},e)):""})}let uT={Female:sv,Male:sb,Other:sx,Unknown:sS},uM=({gender:e})=>{let t=uT[e];return t?(0,aA.jsx)(t,{fill:"#525252"}):null},uL={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function uW({patient:e,renderedFrom:t}){var n;let r,o,i=uk(e),a=e?.gender&&(o=uL[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tm(r,n),iconKey:o}),s=(0,oF.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,aA.jsxs)("div",{className:uA.patientInfo,children:[(0,aA.jsx)("div",{className:aR()(uA.row,uA.patientNameRow),children:(0,aA.jsxs)("div",{className:uA.flexRow,children:[(0,aA.jsx)("span",{className:uA.patientName,children:i}),a&&(0,aA.jsxs)("div",{className:uA.gender,children:[(0,aA.jsx)(uM,{gender:a.iconKey}),(0,aA.jsx)("span",{children:a.displayText})]}),(0,aA.jsx)(o3,{className:uA.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,aA.jsxs)("div",{className:uA.demographics,children:[e.birthDate&&(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("span",{children:uI(e.birthDate)}),(0,aA.jsx)("span",{className:uA.separator,children:"\xb7"}),(0,aA.jsx)("span",{children:l6(e.birthDate,{time:!1})}),(0,aA.jsx)("span",{className:uA.separator,children:"\xb7"})]}),(0,aA.jsx)(u$,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,aA.jsx)(o3,{className:uA.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var uD=n(7683);function uU({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[o,i]=(0,oF.useState)(!1),{extensions:a}=o6(n),s="tablet"===i2(),l=i7(()=>i(!1),o),c=(0,oF.useRef)(null),u=(0,oF.useRef)(null),d=(0,oF.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,oF.useCallback)(()=>i(e=>!e),[]),h=(0,oF.useCallback)(()=>{i(!1),c.current?.focus()},[]),g=(0,oF.useCallback)(e=>{if("Escape"===e.key&&o){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&o){e.preventDefault();let t=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let n=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(t).indexOf(n);if(-1===r)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let o=r+("ArrowDown"===e.key?1:-1),i=o<0?t.length-1:o>=t.length?0:o;t[i]?.focus()}},[h,o]);(0,oF.useEffect)(()=>{if(o&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[o]);let w=(0,oF.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...r}),[t,e,h,r]);return 0===a.length?null:(0,aA.jsx)("div",{className:"-esm-help-menu__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aB),ref:l,children:[(0,aA.jsxs)("button",{className:aR()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":o},aV),"aria-controls":p,"aria-expanded":o,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:c,children:[(0,aA.jsx)("span",{className:"-esm-help-menu__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tm("actions","Actions")})," ",(0,aA.jsx)(uD.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,aA.jsxs)("div",{className:aR()("cds--overflow-menu-options","cds--overflow-menu--flip",aF,{[aH]:o}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:u,role:"menu",tabIndex:-1,children:[(0,aA.jsx)("ul",{className:aR()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,aA.jsx)(o3,{name:n,state:w},n)}),(0,aA.jsx)("span",{})]})]})})}var uB=n(397),uF=n.n(uB);function uH(e){let{patientPhotoConceptUuid:t}=iA({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tj}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:o,isLoading:i}=(0,ie.u)(e?n:null,tP),a=r?.data?.results[0];return{data:a?{dateTime:a?.obsDatetime,imageSrc:a?.value?.links?.uri}:null,error:o,isLoading:i}}let uV=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,o9.useTranslation)();return(0,aA.jsxs)("svg",{"aria-label":n??r("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,aA.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,aA.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})},uG="-esm-help-menu__patient-photo-module__avatar___t5TmZ";function uz({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:o}=uH(e),[i,a]=(0,oF.useState)(null),[s,l]=(0,oF.useState)(!1),c=(0,oF.useMemo)(()=>uF().generate(e),[e]);(0,oF.useEffect)(()=>{if(r?.imageSrc){let e=new URL(r.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(a(e),l(!1))},n.onerror=()=>{t||(a(null),l(!1))},n.src=e,()=>{t=!0}}a(null),l(!1)},[r?.imageSrc]);let u=(0,oF.useMemo)(()=>n||(i?tm("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):tm("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,i,t]);return o||s?(0,aA.jsx)(aW.SkeletonIcon,{className:"-esm-help-menu__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):r?.imageSrc&&!i?(0,aA.jsx)(uV,{"aria-label":tm("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("img",{className:uG,src:i,alt:u,title:t})}):(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("div",{className:uG,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,aA.jsx)("span",{className:"-esm-help-menu__patient-photo-module__initials___-k9Hv",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let uq=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],uJ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),uK=uJ,uX=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),uY=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),uZ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),uQ=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),u0=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),u1=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),u2=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u5=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u6=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),u8=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),u3=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),u4=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),u7=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),u9=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),de=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),dt=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),dn=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),dr=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),di=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),da=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),ds=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),dl=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),dc=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),du=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dd=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dm=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),dp=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),df=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),dh=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),dg=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),dw=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),d_=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dy=(0,oF.memo)((0,oF.forwardRef)(function(e,t){return(0,aA.jsx)(dS,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dv=u4,db=dl,dx=(0,oF.memo)((0,oF.forwardRef)(function({pictogram:e,fallback:t,...n},r){let o=(0,oF.useRef)(document.getElementById(e));return(0,oF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(o.current=document.getElementById(e))});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,aA.jsx)(iv,{value:o.current,fallback:t,children:(0,aA.jsx)(dS,{ref:r,pictogram:e,pictogramProps:n})})})),dS=(0,oF.memo)((0,oF.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:r,size:o}=Object.assign({},{size:92},t);return(o<=26||o>144)&&(console.error(`Invalid size '${o}' specified for ${e}. Defaulting to 92.`),o=92),(0,aA.jsx)("svg",{ref:n,className:aR()("-esm-help-menu__pictograms-module__pictogram___wXX7t",r),height:o,width:o,children:(0,aA.jsx)("use",{href:`#${e}`})})})),dk=({children:e})=>"tablet"===i2()?(0,aA.jsx)(aW.Layer,{children:e}):(0,aA.jsx)(aA.Fragment,{children:e}),dj=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:r="success",onActionButtonClick:o=()=>{},isLowContrast:i="error"!==r,progressActionLabel:a,subtitle:s="",timeoutInMs:l=5e3,autoClose:c="error"!==r,title:u,id:d,...m}=e,[p,f]=(0,oF.useState)(n),[h,g]=(0,oF.useState)(!0),[w,_]=(0,oF.useState)(!1),y=(0,oF.useCallback)(()=>{setTimeout(t,250)},[t]),v=(0,oF.useCallback)(()=>{_(!0),y()},[y]);return(0,oF.useEffect)(()=>{if(c){let e=setTimeout(v,l);return()=>clearTimeout(e)}},[l,c,v]),(0,oF.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,aA.jsx)(aW.ActionableNotification,{actionButtonLabel:p,"aria-label":tm("closeSnackbar","Close snackbar"),className:aR()("-esm-help-menu__snackbar-module__slideIn___-oZIt",{"-esm-help-menu__snackbar-module__animated___M2YBU":h,"-esm-help-menu__snackbar-module__slideOut___yEmGT":w}),kind:r,lowContrast:i,onActionButtonClick:()=>{o(),v(),a&&f(a)},onClose:y,statusIconDescription:tm("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...m})},dN=({subject:e})=>{let[t,n]=(0,oF.useState)([]),r=(0,oF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(dj,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},dE=new us,dC=0;function dP(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(dN,{subject:dE}))}function dI(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dE.next({...e,id:dC++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dA=({toast:e,closeToast:t})=>{let{description:n,kind:r,critical:o,title:i,actionButtonLabel:a,onActionButtonClick:s=()=>{}}=e,l=(0,oF.useCallback)(()=>{s(),t()},[t,s]);return(0,aA.jsx)("div",{children:(0,aA.jsx)(aW.ActionableNotification,{actionButtonLabel:a,kind:r||"info",lowContrast:o,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},dO=({subject:e})=>{let[t,n]=(0,oF.useState)([]),r=(0,oF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsx)(dA,{toast:e,closeToast:()=>r(e)},e.id))})},dR=new us,d$=0;function dT(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(dO,{subject:dR}))}function dM(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,un.A)(t))?setTimeout(()=>{dR.next({...e,id:d$++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dL=n(4656);async function dW(e,t){let{openedGroup:n}=oE.getState();if(n){if(n.groupName===e&&dB(n.props,t))return!0;else if(!await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return oE.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dD(e){let{openedGroup:t,openedWindows:n}=oE.getState();if(t){if(n.length>0&&!(e||await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;oE.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dU(e,t=null,n=null,r=null){let o=oE.getState();if(!o.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=oC(e);if(!i)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:a}=o,{name:s}=i,l=oP(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${i.name} is not registered to a workspace group`);let c=oI(e);if(a&&(a.groupName!==l.name||!dB(a.props,r)))return!!await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let r=o.openedWindows[c],i=o.openedGroup?.props??{},a=o.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=r;if(dB(r.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dB(d.props,t)?((a||c!==o.openedWindows.length-1)&&oE.setState(dX.restoreWindow(o,s)),!0):!!await dV({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:o?.openedGroup?.props??i},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d1(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dV({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:i??o?.openedGroup?.props},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(oE.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[...o.openedWindows,{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dV({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(oE.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dB(e,t){return null==e||null==t||x(e,t)}function dF(e,t){let n=[];for(let r=e.openedWorkspaces.length-1;r>=0;r--){let o=e.openedWorkspaces[r];if(o.hasUnsavedChanges&&n.push(o),t&&o.workspaceName===t)break}return n}function dH(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=ut("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function dV(e){let{openedWindows:t}=oE.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>dF(e));break;case"CLOSE_WINDOW":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dF(r);break}case"CLOSE_WORKSPACE":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dF(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>dF(e))}return dH(n)}function dG(e,t){return dH(dF(e,t))}function dz(e,t){let n=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return n<0?e:0===n?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,n)}}function dq(e,t,n,r){let{registeredWorkspacesByName:o}=oE.getState(),i=o[n];if(!i)throw Error(`No workspace named "${n}" registered`);let a=o[t];if(!a)throw Error(`No workspace named "${t}" registered`);if(a.window!==i.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);if(i.window!==e.windowName)throw Error(`Cannot open child workspace ${n} as window ${i.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${n} from parent workspace ${t} as the parent is not opened within the workspace window`);let c=s.slice(0,l+1);return{...e,openedWorkspaces:[...c,d1(n,r)]}}function dJ(e,t,n){let r=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(r<0)return e;let o=e.openedWorkspaces[r];if(Object.keys(n).every(e=>o[e]===n[e]))return e;let i=[...e.openedWorkspaces];return i[r]={...o,...n},{...e,openedWorkspaces:i}}function dK(e,t,n){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(r<0)return e;let o=e.openedWindows[r],i=dJ(o,t,n);if(i===o)return e;let a=[...e.openedWindows];return a[r]=i,{...e,openedWindows:a}}let dX={setWindowMaximized(e,t,n){let r=e.openedWindows.findIndex(e=>e.windowName===t),o=[...e.openedWindows],i={...o[r],maximized:n};return o[r]=i,{...e,openedWindows:o}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),r=e.openedWindows[n],o=[...e.openedWindows.filter((e,t)=>t!==n),r];return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(n<0)return e;let r=dz(e.openedWindows[n],t),o=[...e.openedWindows],i=e.isMostRecentlyOpenedWindowHidden;if(null===r){let t=n===e.openedWindows.length-1;o.splice(n,1),t&&o.length>0&&(i=!1)}else o[n]=r;return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:i}},openChildWorkspace(e,t,n,r){let o=e.registeredWorkspacesByName[n];if(!o)throw Error(`No workspace named "${n}" registered`);let i=e.openedWindows.findIndex(e=>e.windowName===o.window);if(-1==i)throw Error(`Cannot open child workspace ${n} as window ${o.window} is not opened`);let a=[...e.openedWindows];return a[i]=dq(e.openedWindows[i],t,n,r),{...e,openedWindows:a}},setHasUnsavedChanges:(e,t,n)=>dK(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>dK(e,t,{title:n})};function dY(){return oY(oE,dX)}let dZ=()=>(0,oF.useContext)(o7.i),dQ=()=>Object.keys(oE.getState().registeredWorkspacesByName);function d0(e,t,n){let r=e.openedWorkspaces[e.openedWorkspaces.length-1];return(r?t[r.workspaceName]?.width:void 0)??n[e.windowName]?.width??"narrow"}function d1(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,dL.A)()}}function d2(e,t,n){let r=oE.getState().registeredWorkspacesByName[e];return r?{windowName:r.window,openedWorkspaces:[d1(e,t)],props:n??null,maximized:!1}:null}let d5=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:r,setWorkspaceTitle:o}=dZ();return(0,oF.useEffect)(()=>{r(n??!1)},[n,r]),(0,oF.useEffect)(()=>{o(e)},[e,o]),(0,aA.jsx)(aA.Fragment,{children:t})};var d6=n(1820),d8=n(3173),d3=n(185);let d4={workspaceOuterContainer:"-esm-help-menu__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-help-menu__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-help-menu__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-help-menu__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-help-menu__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-help-menu__workspace2-module__maximized___Kfygr",hidden:"-esm-help-menu__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-help-menu__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-help-menu__workspace2-module__workspaceSpacer___E+982",loader:"-esm-help-menu__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-help-menu__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-help-menu__workspace2-module__header___IZ-2+",headerButtons:"-esm-help-menu__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-help-menu__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-help-menu__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-help-menu__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-help-menu__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-help-menu__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-help-menu__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-help-menu__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-help-menu__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},d7=e=>e.registeredWorkspacesByName,d9=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:r,actions:o,renderChrome:i,isRootWorkspace:a,isLeafWorkspace:s,showActionMenu:l})=>{let c=(0,oF.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:r=!1,discardUnsavedChanges:i=!1}=e;return r?!!(i||await o.promptForClosingWorkspaces())&&(o.closeWorkspace(n.openedWorkspaces[0].workspaceName),!0):!!(i||await o.promptForClosingWorkspaces(t.workspaceName))&&(o.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,r)=>{let i=t.workspaceName,{openedWorkspaces:a}=n,s=a.findIndex(e=>e.workspaceName===i);-1===s||s!==a.length-1&&a.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await o.promptForClosingWorkspaces(a[s+1].workspaceName)||o.openChildWorkspace(i,e,r||{})},setWorkspaceTitle:e=>o.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>o.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:r,workspaceMeta:oE.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:a,isLeafWorkspace:s,windowName:n.windowName,showActionMenu:l},[t,n,r,o,a,s,l]),u=!i&&!s,d=(0,oF.useMemo)(()=>e?(0,aA.jsx)(d6.A,{config:e,mountParcel:oU,wrapWith:"div",wrapClassName:aR()(d4.workspaceContent,{[d4.hiddenExtraWorkspace]:u}),...c},t.workspaceName):null,[e,t.workspaceName,c,u]);return i?(0,aA.jsx)("div",{children:(0,aA.jsx)(me,{openedWorkspace:t,openedWindow:n,isRootWorkspace:a,showActionMenu:l,closeWindow:()=>c.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,aA.jsx)(aW.InlineLoading,{className:aR()(d4.loader,{[d4.hiddenExtraWorkspace]:u}),description:`${tm("loading")}`})},me=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:r,closeWindow:o,children:i})=>{let a=i2(),{openedGroup:s,openedWindows:l,registeredWindowsByName:c,registeredWorkspacesByName:u,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=dY(),h=t.windowName,{maximized:g}=t,w=e.title??"",_=c[h],y=d0(t,u,c),v=_?.icon,b=_?.canMaximize,x=!!s&&d[s.groupName]?.persistence==="closable",S=!!v&&!x,k=l.findIndex(e=>e.windowName===h)<l.length-1||m,j=Object.values(c).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,aA.jsxs)("div",{className:aR()(d4.workspaceOuterContainer,{[d4.narrowWorkspace]:"narrow"===y,[d4.widerWorkspace]:"wider"===y,[d4.extraWideWorkspace]:"extra-wide"===y,[d4.isActionMenuOpened]:j}),children:[(0,aA.jsx)("div",{className:aR()(d4.workspaceSpacer,{[d4.hidden]:k})}),(0,aA.jsx)("div",{className:aR()(d4.workspaceMiddleContainer,{[d4.maximized]:g,[d4.hidden]:k,[d4.isRootWorkspace]:n,[d4.showActionMenu]:r}),children:(0,aA.jsx)("div",{className:aR()(d4.workspaceInnerContainer,{[d4.maximized]:g,[d4.hidden]:k,[d4.isRootWorkspace]:n}),children:i?(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsxs)(aW.Header,{"aria-label":tm("workspaceHeader"),className:d4.header,children:[(0,aA.jsx)(aW.HeaderName,{prefix:"",children:w}),(0,aA.jsx)("div",{className:d4.overlayHeaderSpacer}),(0,aA.jsx)(aW.HeaderGlobalBar,{className:d4.headerButtons,children:i5(a)?(0,aA.jsxs)(aA.Fragment,{children:[(b||g)&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":g?tm("minimize"):tm("maximize"),onClick:()=>p(h,!g),children:g?(0,aA.jsx)(d8.Xj,{}):(0,aA.jsx)(d8.hz,{})}),S&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>f(),children:(0,aA.jsx)(a2,{})}),!x&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("close"),onClick:o,children:(0,aA.jsx)(su,{})})]}):(0,aA.jsxs)(aA.Fragment,{children:[S&&(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>f(),children:(0,aA.jsx)(d3.d3,{})}),(0,aA.jsx)(aW.HeaderGlobalAction,{"aria-label":tm("close"),onClick:()=>{x?dD():o()},children:(0,aA.jsx)(su,{})})]})})]}),i]}):(0,aA.jsx)(aW.InlineLoading,{className:d4.loader,description:`${tm("loading")} ...`})})})]})},mt=({openedWindow:e,groupProps:t,actions:n,renderChrome:r,showActionMenu:o})=>{let{openedWorkspaces:i}=e,[a,s]=(0,oF.useState)({}),l=oX(oE,d7);return(0,oF.useEffect)(()=>{let e=!1;return Promise.all(i.map(async e=>{let t=l[e.workspaceName];if(!t)return null;let{moduleName:n,component:r}=t;return[e.uuid,await av(n,r)]})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))}),()=>{e=!0}},[i,l]),(0,aA.jsx)(aA.Fragment,{children:i.map((s,l)=>(0,aA.jsx)(d9,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:n,renderChrome:r,lifeCycle:a[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===i.length-1,showActionMenu:o},s.uuid))})},mn=e=>e.registeredWorkspacesByName,mr=({name:e,workspaceProps:t,windowProps:n,groupProps:r,onWindowChanged:o})=>{let i=oX(oE,mn),a=oX(oE,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),s={name:e,workspaceProps:t,windowProps:n,groupProps:r},l=(0,oF.useRef)(),c=(0,oF.useRef)(null);if(!l.current){let o=d2(e,t,n);l.current=$({openedWindow:o,groupProps:r??null}),o&&(c.current=s)}let u=l.current;(0,oF.useEffect)(()=>{let o=c.current;if(o&&o.name===e&&x(o.workspaceProps,t)&&x(o.windowProps,n)&&x(o.groupProps,r))return;let i=d2(e,t,n);u.setState({openedWindow:i,groupProps:r??null},!0),c.current=i?s:null},[e,t,n,r,i,u]);let d=(0,oF.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let n=t(e.openedWindow);return n===e.openedWindow?e:{...e,openedWindow:n}})}return{closeWorkspace(e){t(t=>dz(t,e))},openChildWorkspace(e,n,r){t(t=>dq(t,e,n,r))},setWorkspaceTitle(e,n){t(t=>dJ(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>dJ(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?dG(n,t):Promise.resolve(!0)}}})(u),[u]),{openedWindow:m,groupProps:p}=oX(u),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",w=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,_=a?.width??"narrow",y=(0,oF.useRef)(o);return(0,oF.useEffect)(()=>{y.current=o}),(0,oF.useEffect)(()=>{y.current?.({workspaceName:h,windowWidth:_,title:g,hasUnsavedChanges:w})},[h,_,g,w]),(0,aA.jsx)("div",{className:"-esm-help-menu__exported-workspace-module__exportedWorkspace___7PE0H",children:m?(0,aA.jsx)(mt,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},mo="-esm-help-menu__action-menu-button2-module__container___jc6--",mi="-esm-help-menu__action-menu-button2-module__elementContainer___whLL8",ma="-esm-help-menu__action-menu-button2-module__active___fbyFm",ms="-esm-help-menu__action-menu-button2-module__focused___+aVpz";function ml({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,aA.jsxs)(aA.Fragment,{children:[e({size:16}),t?(0,aA.jsx)("span",{className:"-esm-help-menu__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,aA.jsx)("span",{className:"-esm-help-menu__action-menu-button2-module__countTag___XMH0D",children:n})]})}let mc=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:o})=>{let i=i2(),{openedWindows:a,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=dY(),{extension:u}=(0,oF.useContext)(oV),d=a.findIndex(e=>e.windowName===u?.extensionId),m=a[d],p=null!=m,f=p&&(d<a.length-1||c),h=p&&!f,g=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,w=async()=>{if(p)f?s(m.windowName):l();else if(await (o?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=r;dU(e,t,n)}};return"tablet"===i||"phone"===i?(0,aA.jsxs)(aW.Button,{className:aR()(mo,{[ma]:p&&!h,[ms]:h}),iconDescription:t,kind:"ghost",onClick:w,role:"button",tabIndex:0,size:"md",children:[(0,aA.jsx)("span",{className:mi,children:(0,aA.jsx)(ml,{hasUnsavedChanges:g,getIcon:e,tagContent:n})}),(0,aA.jsx)("span",{children:t})]}):(0,aA.jsx)(aW.IconButton,{align:"left","aria-label":t,className:aR()(mo,{[ma]:p&&!h,[ms]:h}),enterDelayMs:300,kind:"ghost",label:t,onClick:w,size:"md",children:(0,aA.jsx)("div",{className:mi,children:(0,aA.jsx)(ml,{hasUnsavedChanges:g,getIcon:e,tagContent:n})})})};function mu({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,aA.jsx)(aW.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?sc:sa,children:e?tm("showLess","Show less"):tm("showMore","Show more")})}let md={contactDetails:"-esm-help-menu__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-help-menu__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-help-menu__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-help-menu__patient-banner-contact-details-module__row___qFgIi",col:"-esm-help-menu__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-help-menu__patient-banner-contact-details-module__relationship___T3LO-"},mm=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${tj}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=(0,ie.u)(t,tP),o=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,oF.useMemo)(()=>({cohorts:o,isLoading:r}),[r,o])}(e);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsxs)("p",{className:md.heading,children:[tm("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>lZ(e?.startDate).getTime()-lZ(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,aA.jsx)("li",{children:(0,aA.jsx)(oG,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,aA.jsx)("li",{children:"--"})})(),t.length>3&&(0,aA.jsx)("li",{className:md.link,children:(0,aA.jsx)(oG,{to:`${window.spaBase}/home/patient-lists`,children:tm("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},mp=({patientId:e})=>{let{patient:t,isLoading:n}=ao(e),r=t?.address?.find(e=>"home"===e.use),o=e=>e.split("#")[1];return n?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:md.heading,children:tm("address","Address")}),(0,aA.jsx)("ul",{children:r?Object.entries(r).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?r.extension?.[0]?.extension?.map((t,n)=>(0,aA.jsxs)("li",{children:[tm(o(t.url),o(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,aA.jsxs)("li",{children:[tm(e,e),": ",t]},`address-${e}`)):(0,aA.jsx)("li",{children:"--"})})]})},mf=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=iA({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:r,isLoading:o}=(e=>{let{data:t,error:n,isLoading:r}=(0,i$.A)(`${tj}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,tP);return{isLoading:r,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,oF.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:o,error:r}})(e),r=(0,oF.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?tm(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:md.heading,children:tm("contactDetails","Contact Details")}),t?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsx)("ul",{children:r.length?r.map(([e,t],n)=>(0,aA.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,aA.jsx)("li",{children:"--"})})]})},mh=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${tj}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:n,error:r,isLoading:o,isValidating:i}=(0,ie.u)(e?t:null,tP),a=n?.data?.results?.length?function(e,t){let n=[];for(let r of t)e===r.personA.uuid?n.push({uuid:`${r.uuid}`,display:r.personB.display,relativeAge:r.personB.age,relativeUuid:r.personB.uuid,relationshipType:r.relationshipType.bIsToA}):n.push({uuid:`${r.uuid}`,display:r.personA.display,relativeAge:r.personA.age,relativeUuid:r.personA.uuid,relationshipType:r.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?a:null,error:r,isLoading:o,isValidating:i}}(e);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:md.heading,children:tm("relationships","Relationships")}),n?(0,aA.jsx)(aW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsx)("ul",{children:t&&t.length>0?(0,aA.jsx)(aA.Fragment,{children:t.map(e=>(0,aA.jsxs)("li",{className:md.relationship,children:[(0,aA.jsx)("div",{children:(0,aA.jsx)(oG,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,aA.jsx)("div",{children:e.relationshipType}),(0,aA.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?tm("yearAbbreviation","yr"):tm("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,aA.jsx)("li",{children:"--"})})]})};function mg({patientId:e,deceased:t}){return(0,aA.jsxs)("div",{className:aR()(md.contactDetails,{[md.deceased]:t}),children:[(0,aA.jsxs)("div",{className:md.row,children:[(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mp,{patientId:e})}),(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mf,{patientUuid:e})})]}),(0,aA.jsxs)("div",{className:md.row,children:[(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mh,{patientId:e})}),(0,aA.jsx)("div",{className:md.col,children:(0,aA.jsx)(mm,{patientUuid:e})})]})]})}function mw(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),r=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>r.forEach(e=>e.remove())}return()=>{}}let m_="-esm-help-menu__action-menu2-module__container___6Gke0";function my({workspaceGroup:e,groupProps:t}){let n=i2(),{persistence:r}=e;return(0,aA.jsx)("aside",{className:"-esm-help-menu__action-menu2-module__sideRail___T2lMV",children:(0,aA.jsxs)("div",{className:m_,children:["closable"==r&&i5(n)&&(0,aA.jsx)(aW.IconButton,{align:"left",onClick:()=>dD(),label:tm("close"),kind:"ghost",children:(0,aA.jsx)(su,{})}),(0,aA.jsx)(oV.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,aA.jsx)(o3,{className:m_,name:e.name,state:{groupProps:t}})})]})})}function mv(e){let t=new URL(e,window.location.origin).pathname,n=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,r=n.endsWith("/")?n.slice(0,-1):n,o=null;return r?r===t?o="/":t.startsWith(`${r}/`)&&(o=t.slice(r.length)):o=t,{full:t,spaRelative:o}}function mb(e){e&&(0,o4.createRoot)(e).render((0,aA.jsx)(mx,{}))}function mx(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=dY();if((0,oF.useEffect)(()=>nG("before-page-changed",t=>{let{newPage:r,cancelNavigation:o,oldUrl:i,newUrl:a}=t;if(!e)return;if(r)return void o(dD().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),o=mv(t),i=mv(n);if(null===o.spaRelative||null===i.spaRelative)return!0;let a=r.exec(o.spaRelative),s=r.exec(i.spaRelative);if(a&&s||(a=r.exec(o.full),s=r.exec(i.full)),!a||!s)return!0;if(a.length>1)return!a.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,i,a)&&o(dD().then(e=>!e))}),[e,n]),!e)return null;let o=n[e.groupName],i=t.some(e=>e.maximized),{name:a}=o,s=Object.values(r).filter(e=>e.group===a&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,aA.jsxs)("div",{className:aR()("-esm-help-menu__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-help-menu__workspace-windows-and-menu-module__overlay___7RHYZ":o.overlay,"-esm-help-menu__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,aA.jsx)("div",{className:"-esm-help-menu__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(t=>(0,aA.jsx)(mS,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,aA.jsx)(my,{workspaceGroup:o,groupProps:e.props})]})}function mS({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:r}=e,o=(0,oF.useMemo)(()=>({closeWorkspace(e){oE.setState(t=>dX.closeWorkspace(t,e))},openChildWorkspace(e,t,n){oE.setState(r=>dX.openChildWorkspace(r,e,t,n))},setWorkspaceTitle(e,t){oE.setState(n=>dX.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){oE.setState(n=>dX.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=oE.getState().openedWindows.find(e=>e.windowName===r);return t?dG(t,e):Promise.resolve(!0)}}),[r]);return(0,aA.jsx)(mt,{openedWindow:e,groupProps:t,actions:o,renderChrome:!0,showActionMenu:n})}function mk(e,t,n){if(null==e)return n;let r=lD(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let o=[];for(let e of t){let t=lD(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}o.push({canonical:t,original:e})}let i=r;for(;i;){let e=o.find(e=>e.canonical===i);if(e)return e.original;let t=i+"-",n=o.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===i){i="fr-HT";continue}let r=i.lastIndexOf("-");if(-1===r)break;let a=(i=i.slice(0,r)).lastIndexOf("-");-1!==a&&i.length-a==2&&(i=i.slice(0,a))}return n}function mj(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function mN(e){return!!e&&e.constructor===Object}var mE=n(3376);function mC(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function mP(e,t){return mE(function(e){let t=e.indexOf("-");if(t>=0){let n=mC(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return mC(e)}(t),e,{includePrerelease:!0})}async function mI(e,t={}){let n,{shouldRetry:r,getDelay:o,onError:i}=t;r=r??(e=>e<=5),o=o??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let a=0;do try{return await mA(o(a)),await e()}catch(e){i?.(e,a),n=e}while(r(a++));throw n}async function mA(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function mO(e,t,n,r){}function mR(e){}function m$(e){return Promise.resolve([])}function mT(e){return Promise.resolve([])}function mM(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function mL(e){return()=>{}}function mW(){return!0}}}]);
|