@openmrs/esm-primary-navigation-app 10.0.1-pre.5685 → 10.0.1-pre.5702

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.
@@ -4,4 +4,4 @@
4
4
  │ 195.js (660.563 KiB)
5
5
  
6
6
 
7
- Rspack compiled with 1 warning in 26.96 s
7
+ Rspack compiled with 1 warning in 26.64 s
package/dist/4777.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(){aj.sort((e,t)=>e.appName.localeCompare(t.appName,"en"));let e=new Map;for(let t of aj){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=>!!rL(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,tl.pathToActiveWhen)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,tl.registerApplication)(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 aI=!1;function aP(){aI||(window.addEventListener("resize",aC),aC(),aI=!0)}var aA=n(6870),aO=n(5530),aR=n.n(aO);function aT({title:e,children:t}){let n="tablet"===i2();return(0,aA.jsxs)("div",{className:aR()({"-esm-primary-navigation__card-header-module__tabletHeader___Vkmd-":n,"-esm-primary-navigation__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,aA.jsx)("h4",{children:e}),t]})}let a$=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],aM={primaryColor:{_type:V.String,_description:"The color for displaying primary diagnoses tags",_default:"red",_validators:[e9.oneOf(a$)]},secondaryColor:{_type:V.String,_description:"The color for displaying secondary diagnoses tags",_default:"blue",_validators:[e9.oneOf(a$)]}},aL={"Brand color #1":{_default:"#005d5d",_type:V.String},"Brand color #2":{_default:"#004144",_type:V.String},"Brand color #3":{_default:"#007d79",_type:V.String},excludePatientIdentifierCodeTypes:{uuids:{_type:V.Array,_description:"List of UUIDs of patient identifier types to exclude from rendering in the patient banner",_default:[],_elements:{_type:V.UUID}}},implementationName:{_type:V.String,_description:"A name of the place (or authority) where all possible locations a user can choose are located.",_default:"Clinic"},logo:{src:{_type:V.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:[e9.isUrl]},alt:{_type:V.String,_default:"Logo",_description:"The alternative text for the logo image, displayed when the image cannot be loaded or on hover."}},patientPhotoConceptUuid:{_type:V.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:V.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:[e9.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:V.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:V.String}},diagnosisTags:aM};var aD=n(8326);let aW={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},aB=e=>(0,aA.jsx)(aD.TableBatchActions,{translateWithId:(e,t)=>{let n=aW[e];return n?tp(n,e,t):e},...e}),aU="-esm-primary-navigation__custom-overflow-menu-module__container___8PykS",aF="-esm-primary-navigation__custom-overflow-menu-module__menu___qsOLn",aH="-esm-primary-navigation__custom-overflow-menu-module__show___BserJ",aV="-esm-primary-navigation__custom-overflow-menu-module__overflowMenuButton___n86Gz",aG=(0,oH.createContext)(null);function az(){let e=(0,oH.useContext)(aG);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function aq({menuTitle:e,children:t}){let[n,r]=oV().useState(!1),o=i7(()=>r(!1),n),i="tablet"===i2(),a=(0,oH.useCallback)(()=>r(e=>!e),[]),s=(0,oH.useRef)(null),l=(0,oH.useRef)(null),c=(0,oH.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,m=(0,oH.useCallback)(()=>{r(!1),s.current?.focus()},[]),p=(0,oH.useMemo)(()=>({closeMenu:m}),[m]),f=(0,oH.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),m())},[m,n]),g=oH.Children.toArray(t);(0,oH.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let h=(0,oH.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=g.map((e,t)=>(0,oH.isValidElement)(e)?(0,oH.cloneElement)(e,{closeMenu:m,handleOverflowMenuItemFocus:h,index:t}):e);return(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aU),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,oH.useContext)(aG);return(0,aA.jsx)(aD.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var aK=n(7665);let aX=["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"],aY=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),aZ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-add",iconProps:e})})),aQ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),a0=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),a1=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),a2=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),a5=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),a6=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),a8=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),a3=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),a4=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),a7=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),a9=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),se=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),st=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),sn=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),sr=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),so=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),si=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),sa=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),ss=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),sl=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),sc=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-close",iconProps:e})})),su=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),sd=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),sm=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-document",iconProps:e})})),sp=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),sf=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-download",iconProps:e})})),sg=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),sh=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),sw=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),sy=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-events",iconProps:e})})),s_=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),sv=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),sb=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),sx=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),sS=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),sj=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-group",iconProps:e})})),sk=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),sN=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),sE=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),sC=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-information",iconProps:e})})),sI=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),sP=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),sA=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),sO=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),sR=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),sT=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-location",iconProps:e})})),s$=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),sM=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),sL=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),sD=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),sW=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),sB=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),sU=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-money",iconProps:e})})),sF=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),sH=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),sV=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sG=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sz=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-password",iconProps:e})})),sq=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),sJ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),sK=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),sX=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),sY=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),sZ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),sQ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),s0=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-report",iconProps:e})})),s1=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),s2=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-save",iconProps:e})})),s5=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-search",iconProps:e})})),s6=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),s8=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),s3=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),s4=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),s7=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),s9=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),le=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),lt=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-table",iconProps:e})})),ln=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-time",iconProps:e})})),lr=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),lo=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),li=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),la=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),ls=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),ll=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),lc=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),lu=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),ld=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lm=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lp=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-view",iconProps:e})})),lf=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),lg=lf,lh=sp,lw=sR,ly=sE,l_=s4,lv=(0,oH.memo)((0,oH.forwardRef)(function({icon:e,fallback:t,...n},r){let o=(0,oH.useRef)(e?document.getElementById(e):void 0);return(0,oH.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)(ib,{value:o.current,fallback:t,children:(0,aA.jsx)(lb,{ref:r,icon:e,iconProps:n})})})),lb=(0,oH.memo)((0,oH.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,oH.useRef)(null);return(0,oH.useImperativeHandle)(n,()=>a.current),(0,oH.useEffect)(()=>{a.current&&"currentColor"!==o&&a.current.style.setProperty("--omrs-icon-fill",o)},[]),(0,aA.jsx)("svg",{ref:a,className:aR()("omrs-icon","-esm-primary-navigation__icons-module__icon___BfFhd",r),height:i,width:i,viewBox:"0 0 16 16",children:(0,aA.jsx)("use",{href:`#${e}`})})})),lx=({path:e,title:t,basePath:n,icon:r})=>{let{t:o}=(0,ie.useTranslation)(),i=(0,aK.useLocation)(),a=(0,oH.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)(oz,{className:aR()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${n}/${encodeURIComponent(e)}`,children:(0,aA.jsxs)("span",{className:"-esm-primary-navigation__dashboard-module__menu___ds1tf",children:[(0,aA.jsx)(lv,{icon:r,className:"-esm-primary-navigation__dashboard-module__icon___4Zrrh",size:16}),(0,aA.jsx)("span",{children:o(t)})]})})},e)};function lS(e){return function({basePath:t}){return(0,aA.jsx)(aK.BrowserRouter,{children:(0,aA.jsx)(lx,{basePath:t,...e})})}}var lj=n(7715),lk=n(7532),lN=n(3692),lE=n(7615),lC=n(700),lI=n(6816),lP=n(1168);function lA(e){return oV().createElement(lP.C,e)}var lO=n(3010),lR=n(6513),lT=n(6190);function l$(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 lO.ng||e instanceof lO._l||e instanceof lO.Ip)return t?(0,lR.yP)(e,t):e;{let n=au()(e).toDate(),r=new lO.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,lR.yP)(r,t):r}}function lM(e){if(e)return e.toDate((0,lT.Xj)())}var lL=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 lW(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 lU=n(7883),lF=n(424),lH=n(1492),lV=n(8271);function lG(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(lH),ac.extend(lF);let lz="YYYY-MM-DDTHH:mm:ss.SSSZZ";function lq(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,lz).isValid()}function lJ(e){return ac(e).isToday()}function lK(e){return lq(e)?ac(e,lz).toDate():null}function lX(e,t=!1){let n=ac(e);return t&&(n=n.utc()),n.format(lz)}function lY(e){return ac(e).toDate()}var lZ=new WeakMap;let lQ=new class{register(e,t){lG(this,lZ).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lG(this,lZ).has(t))return lG(this,lZ).get(t)}if(e.language&&lG(this,lZ).has(e.language))return lG(this,lZ).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lG(this,lZ).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,lZ,{writable:!0,value:new Map})}};function l0(e,t){lQ.register(e,t)}function l1(e){let t=e??lB();return lQ.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l2={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l5(e,t={}){let n=lB(),r=(0,lU.CD)(e,n);if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lV.A)(r.day)&&(0,lV.A)(r.month)&&(r=Object.assign({},(0,F.A)(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},(0,F.A)(r,"day"),{date:r.day}));let o=ac().set(r).toDate();return(0,lV.A)(r.year)&&(t.year=!1),(0,lV.A)(r.month)&&(t.month=!1),(0,lV.A)(r.date)&&(t.day=!1),l6(o,t)}function l6(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}={...l2,...{noToday:"am"===o.language},...t},p={calendar:i??l1(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(l8("-"))),"wide"==a&&(t=t.map(l8(" — "))),"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+=`, ${l3(e)}`),n}let l8=e=>(t,n,r)=>"literal"!==t.type||" "!==t.value||n<r.length-1&&"era"===r[n+1].type?t:{type:"literal",value:e};function l3(e){return e.toLocaleTimeString(lB(),{hour:"2-digit",minute:"2-digit"})}function l4(e,t){return l6(e,{...t,time:!0})}function l7(e,t){let n=l1("string"==typeof t?new Intl.Locale(t):t);return n?(0,lR.yP)(e,(0,lL.d)(n)):e}function l9(e,t){return new Intl.DurationFormat(lB(),t).format(e)}function ce(e,t){if(null==e)return null;if("string"==typeof e){let n=lB(),r=(0,lU.CD)(e,n);return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...(0,F.A)(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...(0,F.A)(r,"day"),...{date:r.day}}),ac(t).set(r))}return ac(e)}let ct=["years","months","days","hours","minutes","seconds"],cn={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},cr={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function co(e,t=ac(),n){let r,o=ac(t),i=ce(e,o);if(null==i)return null;if("string"==typeof n){let e=cn[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?cn[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=ct.indexOf(n);for(let o=0;o<ct.length;o++){let i=ct[o];if(t.diff(e,i)>0)return o<=r?i:n}return n}(i,o,t??"seconds"):cn[s]??s,function(e,t,n,r){let o=ct.indexOf(n),i=ct.indexOf(r),a=ct.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={...cr};if(e)for(let[n,r]of Object.entries(e))void 0!==r&&(t[cn[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 ci={style:"short",localeMatcher:"lookup"};function ca(e,t=ac(),n){let r=co(e,t,n);return null==r?null:l9(r,"object"==typeof n&&n.formatOptions?{...ci,...n.formatOptions}:ci)}let cs=(0,oH.createContext)(null);function cl(){let e=iA({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,oH.useMemo)(()=>{let t=lB();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,oH.useMemo)(()=>{let e=l1(t);return void 0!==e?(0,lL.d)(e):void 0},[t]),r=(0,oH.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),o=(0,oH.useMemo)(()=>n?(0,lR.yP)((0,lT.Ec)((0,lT.Xj)()),n):(0,lT.Ec)((0,lT.Xj)()),[n]);return{calendar:n,intlLocale:r,today_:o}}let cc=new lO.ng(1793,1,1);var cu=n(5830),cd=n(6156),cm=n(4745),cp=n(1202);function cf(e,t){return Number.parseInt(l6(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let cg=(0,oH.forwardRef)(function(e,t){let{className:n}=e,r=(0,oH.useContext)(cu.f2),o=(0,oH.useContext)(cu._I),i=r??o,a=(0,oH.useContext)(cs),s=(0,lT.Xj)(),l=l6(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=cf(i.visibleRange.start.toDate(s),a),u=i.maxValue?cf(i.maxValue.toDate(s),a):void 0,d=i.minValue?cf(i.minValue.toDate(s),a):void 0,m=(0,oH.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)(cm.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,aA.jsx)(cp.p,{}),(0,aA.jsxs)(lE.Y,{children:[(0,aA.jsx)(lC.$,{slot:"increment",children:(0,aA.jsx)(a9,{size:8})}),(0,aA.jsx)(lC.$,{slot:"decrement",children:(0,aA.jsx)(a3,{size:8})})]})]})]})});var ch=n(9588);let cw="-esm-primary-navigation__datepicker-module__inputGroup___+4zks",cy="-esm-primary-navigation__datepicker-module__inputSegment___wiExn",c_="-esm-primary-navigation__datepicker-module__dateInputWrapper___uiyAC",cv="-esm-primary-navigation__datepicker-module__invalidText___SxtTL",cb="-esm-primary-navigation__datepicker-module__flatButton___UU1Qp",cx="-esm-primary-navigation__datepicker-module__flatButtonMd___fhR-1",cS="-esm-primary-navigation__datepicker-module__flatButtonSm___5INZ7",cj="-esm-primary-navigation__datepicker-module__flatButtonLg___RFMrl";function ck({children:e}){let t=(0,oH.useContext)(lk.Pg),n=(0,oH.useContext)(lk.a8),r=t??n,o=i7(()=>r?.close());return(0,aA.jsx)(ch.lG,{className:"-esm-primary-navigation__datepicker-module__dialog___qllIf",ref:o,children:e})}let cN=(0,oH.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},o){let i="range"===e,a=i?cu._e:cu.Vv;return(0,aA.jsx)(cd.A,{ref:o,className:"-esm-primary-navigation__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,aA.jsx)(ck,{children:(0,aA.jsxs)(a,{...i?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,aA.jsxs)("header",{className:"-esm-primary-navigation__datepicker-module__header___WAVlD",children:[(0,aA.jsx)(lC.$,{className:aR()(cb,cx),slot:"previous",children:(0,aA.jsx)(sa,{size:16})}),(0,aA.jsx)(cg,{className:"-esm-primary-navigation__datepicker-module__monthYear___A3aKF"}),(0,aA.jsx)(lC.$,{className:aR()(cb,cx),slot:"next",children:(0,aA.jsx)(ss,{size:16})})]}),(0,aA.jsx)(cu.r8,{className:"-esm-primary-navigation__datepicker-module__calendarGrid___6qRB2",children:e=>(0,aA.jsx)(cu.Zr,{className:aR()("cds--date-picker__day",{"-esm-primary-navigation__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cE=n(8017),cC=n(9774),cI=n(7956);let cP=(0,oH.forwardRef)(function(e,t){let n=(0,oH.useContext)(lk.Pg),[r,o]=(0,lj.JT)({slot:e.slot},t,cC.cQ),{locale:i}=(0,lP.Y)(),a=(0,cI.F)({...r,locale:i,createCalendar:lL.d}),s=(0,oH.useRef)(null),{fieldProps:l,inputProps:c}=(0,cE.cJ)({...r,inputRef:s},a,o),u=(0,oH.useCallback)(()=>{a.isDisabled||n.toggle()},[]);return(0,aA.jsxs)(lj.Kq,{values:[[cC.$,a],[cp.E,{...c,ref:s}],[lE.t,{...l,ref:o,isInvalid:a.isInvalid}]],children:[(0,aA.jsx)(lE.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,oH.cloneElement)(e.children(t),{key:n}))}),(0,aA.jsx)(cp.p,{})]})}),cA=(0,oH.forwardRef)(function(e,t){let n=(0,oH.useContext)(lk.Pg),r=(0,oH.useContext)(lk.a8);return(n??r).isInvalid?(0,aA.jsx)(lf,{ref:t,size:16,...e}):(0,aA.jsx)(a8,{ref:t,size:16,...e})});var cO=n(64),cR=n(5503),cT=n(1697),c$=n(7866),cM=n(8035),cL=n(2231);let cD=(0,oH.forwardRef)(function({segment:e,...t},n){let r=(0,oH.useContext)(cC.$),o=(0,cO.U)(n),{segmentProps:i}=(0,cR.V)(e,r,o),{focusProps:a,isFocused:s,isFocusVisible:l}=(0,cT.o)(),{hoverProps:c,isHovered:u}=(0,c$.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,oH.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,oH.useCallback)(e=>{e.stopPropagation()},[]);return(0,aA.jsx)("span",{...(0,cM.v)((0,cL.$)(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})}),cW={short:!1,size:"md"},cB=(0,oH.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:g,size:h,value:w,...y}={...cW,...e},{calendar:_,intlLocale:v,today_:b}=cl(),x=(0,oH.useId)(),S=!!(c??l),j=(0,oH.useMemo)(()=>l$(r,_),[r,_]),k=(0,oH.useMemo)(()=>l$(w,_,!0),[w,_]),N=(0,oH.useMemo)(()=>l$(d,_),[d,_]),E=(0,oH.useMemo)(()=>l$(m??cc,_),[m,_]),C=(0,oH.useMemo)(()=>i||s,[i,s]),I=(0,oH.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?.(lM(e)))),[f,p]);return(0,aA.jsx)(lA,{locale:v.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",n),children:(0,aA.jsx)(lj.Kq,{values:[[cs,v]],children:(0,aA.jsxs)(lk.lr,{className:aR()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":g,"cds--date-picker--light":u}),defaultValue:j,isDisabled:o,isInvalid:C,maxValue:N,minValue:E,value:k,shouldForceLeadingZeros:"en"===v.language||void 0,...y,onChange:I,children:[(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,aA.jsx)(lN.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:x,children:c??l}),(0,aA.jsxs)(lE.Y,{className:cw,children:[(0,aA.jsx)(cP,{id:S?x:void 0,ref:t,className:aR()("cds--date-picker-input__wrapper","-esm-primary-navigation__datepicker-module__inputWrapper___kykar",{"-esm-primary-navigation__datepicker-module__inputWrapperSm___KJtg-":"sm"===h,"-esm-primary-navigation__datepicker-module__inputWrapperMd___ablE9":"md"===h||!h||0===h.length,"-esm-primary-navigation__datepicker-module__inputWrapperLg___5dkQp":"lg"===h}),children:e=>"era"!==e.type?(0,aA.jsx)(cD,{className:cy,segment:e}):(0,aA.jsx)(oV().Fragment,{})}),(0,aA.jsx)(lC.$,{className:aR()(cb,{[cS]:"sm"===h,[cx]:"md"===h||!h||0===h.length,[cj]:"lg"===h}),children:(0,aA.jsx)(cA,{})})]}),(0,aA.jsx)(lI.b,{className:cv,children:a})]}),(0,aA.jsx)(cN,{variant:"single",today_:b})]})})})})}),cU=(0,oH.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,...g},h){let{calendar:w,intlLocale:y,today_:_}=cl(),v=(0,oH.useId)(),b=!!(s??a),x=(0,oH.useMemo)(()=>{if(f)return{start:l$(f[0],w,!1),end:l$(f[1],w,!1)}},[f,w]),S=(0,oH.useMemo)(()=>{if(t)return{start:l$(t[0],w,!1),end:l$(t[1],w,!1)}},[t,w]),j=(0,oH.useMemo)(()=>l$(u??cc,w,!0),[u,w]),k=(0,oH.useMemo)(()=>l$(c,w,!0),[c,w]),N=(0,oH.useMemo)(()=>n||i,[n,i]),E=(0,oH.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?.([lM(e.start),lM(e.end)]))),[m,d]);return(0,aA.jsx)(lA,{locale:y.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",e),children:(0,aA.jsx)(lj.Kq,{values:[[cs,y]],children:(0,aA.jsx)(lk.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"===y.language||void 0,maxValue:k,minValue:j,value:x,defaultValue:S,ref:h,isDisabled:o,...g,onChange:E,children:(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[b&&(0,aA.jsx)(lN.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:v,children:s??a}),(0,aA.jsxs)(lE.Y,{className:cw,children:[(0,aA.jsxs)("div",{className:aR()("-esm-primary-navigation__datepicker-module__inputsWrapper___YlkGh",{"-esm-primary-navigation__datepicker-module__inputsWrapperSm___fAKhS":"sm"===p,"-esm-primary-navigation__datepicker-module__inputsWrapperMd___XVgGP":"md"===p||!p||0===p.length,"-esm-primary-navigation__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===p}),children:[(0,aA.jsx)(cC.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-primary-navigation__datepicker-module__startInput___qgbQm",c_),slot:"start",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})}),(0,aA.jsx)("div",{className:"-esm-primary-navigation__datepicker-module__separator___79vXZ",children:(0,aA.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,aA.jsx)(cC.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-primary-navigation__datepicker-module__endInput___huv7x",c_),slot:"end",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})})]}),(0,aA.jsx)(lC.$,{className:aR()(cb,{[cS]:"sm"===p,[cx]:"md"===p||!p||0===p.length,[cj]:"lg"===p}),children:(0,aA.jsx)(cA,{})})]}),(0,aA.jsx)(lI.b,{className:cv,children:r}),(0,aA.jsx)(cN,{variant:"range",today_:_,minDate:j,maxDate:k})]})})})})})}),cF=({diagnoses:e})=>{let{diagnosisTags:t}=iA({externalModuleName:"@openmrs/esm-styleguide"});return(0,aA.jsx)("div",{className:"-esm-primary-navigation__diagnosis-tags-module__container___8kut8",children:e.map(e=>{let{rank:n,uuid:r,display:o}=e,i=t[1===n?"primaryColor":"secondaryColor"];return(0,aA.jsx)(aD.Tag,{type:i,children:o},r)})})},cH={action:"-esm-primary-navigation__empty-card-module__action___Y0dul",content:"-esm-primary-navigation__empty-card-module__content___fo0nB",desktopHeading:"-esm-primary-navigation__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-primary-navigation__empty-card-module__tabletHeading___BogTF",tile:"-esm-primary-navigation__empty-card-module__tile___QB8Ld"},cV=({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"})}),cG=e=>{let t="tablet"===i2(),n=e.launchForm;return(0,aA.jsx)(aD.Layer,{className:cH.layer,children:(0,aA.jsxs)(aD.Tile,{className:cH.tile,children:[(0,aA.jsx)("div",{className:t?cH.tabletHeading:cH.desktopHeading,children:(0,aA.jsx)("h4",{children:e.headerTitle})}),(0,aA.jsx)(cV,{}),(0,aA.jsx)("p",{className:cH.content,children:tp("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,aA.jsx)("p",{className:cH.action,children:n&&(0,aA.jsx)(aD.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tp("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},cz=({error:e,headerTitle:t})=>{let n="tablet"===i2();return(0,aA.jsx)(aD.Layer,{children:(0,aA.jsxs)(aD.Tile,{className:"-esm-primary-navigation__error-state-module__tile___dd418",children:[(0,aA.jsx)("div",{className:n?"-esm-primary-navigation__error-state-module__tabletHeading___g5rjg":"-esm-primary-navigation__error-state-module__desktopHeading___Nd9u2",children:(0,aA.jsx)("h4",{children:t})}),(0,aA.jsxs)("p",{className:"-esm-primary-navigation__error-state-module__errorMessage___z2RiN",children:[tp("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,aA.jsx)("p",{className:"-esm-primary-navigation__error-state-module__errorCopy___dq+e2",children:tp("errorCopy")})]})})},cq=cz,cJ=oV().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:o,state:i}=i8(),a=window.location??{pathname:""},s=o6(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,aA.jsxs)(aD.SideNav,{"aria-label":tp("leftNavigation","Left navigation"),className:"-esm-primary-navigation__left-nav-module__leftNav___jzTJK",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,aA.jsx)(o4,{name:"global-nav-menu-slot"}),n?(0,aA.jsx)(ib,{value:o,fallback:(0,aA.jsx)(o4,{name:n,state:{basePath:r,currentPath:a,...i}}),children:(0,aA.jsx)(oG.Provider,{value:o,children:(0,aA.jsx)(o4,{name:n,state:{basePath:r,currentPath:a,...i}})})}):null]}):null}),cK=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:r=50,onChange:o})=>{let[i,a]=(0,oH.useState)(""),s=(0,oH.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:r,isLoading:o}=(0,iT.A)(t,tP,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,oH.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=`${tE}/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,oH.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),g=(0,oH.useMemo)(()=>l&&!i&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,i]),h=(0,oH.useCallback)(e=>{o(),a(e.trim())},[o]),w=i9((0,oH.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),y=d?Math.max(0,Math.floor(g.length-r/2)):-1;return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)(aD.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:tp("searchForLocation"),id:s,placeholder:tp("searchForLocation"),onChange:e=>h(e.target.value),size:"lg"}),p&&(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__errorNotification___vWBFD",id:`${s}-error`,children:(0,aA.jsx)(aD.InlineNotification,{kind:"error",subtitle:tp("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:tp("error","Error")})}),(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__searchResults___Gbet+",children:u?(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,aA.jsx)(aD.RadioButtonSkeleton,{className:"-esm-primary-navigation__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__locationResultsContainer___6Pasf",children:g.length>0?(0,aA.jsx)(aD.RadioButtonGroup,{name:"loginLocations",onChange:e=>{o(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,t)=>(0,aA.jsx)(aD.RadioButton,{className:"-esm-primary-navigation__location-picker-module__locationRadioButton___rTDPj",id:e.resource.id,labelText:(0,aA.jsx)("span",{ref:t===y?w:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__emptyState___w4-Ca",children:(0,aA.jsx)("p",{className:"-esm-primary-navigation__location-picker-module__locationNotFound___Of2MJ",children:tp("noResultsToDisplay")})})}),m&&(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__loadingIcon___NAwSB",children:(0,aA.jsx)(aD.InlineLoading,{description:tp("loading")})})]})})]})},cX=R("modalState",{modalContainer:null,modalStack:[]}),cY=0;async function cZ(e,t,n={}){let r=oE(t),o=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:i}=r,a=await i(),s=cY++;o=await oW({...a,name:`${t}-${s}`},{...n,domElement:e})}else _(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return o}function cQ(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c0(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c1(e){return e.find(e=>!cQ(e))}function c2(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let c5=window.getComputedStyle(document.body).overflow;function c6({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",c3),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c1(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",cZ(n,e.modalName,e.props).then(r=>{cQ(e)?c0(e.modalName,r):r?(e.parcel=r,t.prepend(n),c2(e,c1(cX.getState().modalStack)===e),r.mountPromise.then(()=>{cQ(e)||(e.state="MOUNTED")},t=>{_(t),e.parcel=null,c8(e)})):c8(e)},t=>{_(t),c8(e)});break}case"MOUNTING":case"MOUNTED":c2(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c0(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=cX.getState();cX.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=c5,removeEventListener("keydown",c3)}function c8(e){if(cQ(e))return;e.state="TO_BE_DELETED";let t=cX.getState();cX.setState({...t,modalStack:[...t.modalStack]})}function c3(e){"Escape"===e.key&&function(){let[e]=cX.getState().modalStack;e&&c8(e)}()}function c4(e){cX.subscribe(c6),cX.setState({...cX.getState(),modalContainer:e})}function c7(e,t={},n=()=>{}){let r=()=>{let e=cX.getState().modalStack.find(e=>e.onClose===n);e&&c8(e)};if(oE(e)){var o;let i,a;o={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},a=[o,...(i=cX.getState()).modalStack],cX.setState({...i,modalStack:a})}else _(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var c9=n(9685);let ue=({notification:e})=>{let{description:t,action:n,kind:r,critical:o,title:i,onAction:a}=e;return(0,aA.jsx)(aD.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:o,subtitle:t,title:i||"",inline:!0,onActionButtonClick:a})},ut=({subject:e})=>{let[t,n]=(0,oH.useState)([]);return(0,oH.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)(ue,{notification:e},e.id))})},un=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:r,kind:o,title:i,critical:a,progressActionLabel:s,id:l,...c}=e,[u,d]=(0,oH.useState)(t);return(0,aA.jsx)(aD.ActionableNotification,{kind:o||"info",actionButtonLabel:u,ariaLabel:tp("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:tp("actionableNotification","Actionable notification"),subtitle:r,title:i,lowContrast:a,inline:!0,...c})},ur=({subject:e})=>{let[t,n]=(0,oH.useState)([]);return(0,oH.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)(un,{notification:e},e.id))})};class uo{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 ui=new uo,ua=0,us=new uo,ul=0;function uc(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(ut,{subject:ui}))}function uu(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,c9.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{ui.next({...e,id:ua++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function ud(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(ur,{subject:us}))}function um(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,c9.A)(t))?setTimeout(()=>{us.next({...e,id:ul++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let up=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],uf=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],ug={container:"-esm-primary-navigation__numeric-observation-module__container___NfxbH",card:"-esm-primary-navigation__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-primary-navigation__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-primary-navigation__numeric-observation-module__critical-value___JAIHt",cell:"-esm-primary-navigation__numeric-observation-module__cell___lTunW","critically-high":"-esm-primary-navigation__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-primary-navigation__numeric-observation-module__critically-low___5srAK",high:"-esm-primary-navigation__numeric-observation-module__high___7KiyK",low:"-esm-primary-navigation__numeric-observation-module__low___Zs2ct","label-container":"-esm-primary-navigation__numeric-observation-module__label-container___lGnGH","value-container":"-esm-primary-navigation__numeric-observation-module__value-container___hHPXt",label:"-esm-primary-navigation__numeric-observation-module__label___WFuxk",value:"-esm-primary-navigation__numeric-observation-module__value___6fHUr",units:"-esm-primary-navigation__numeric-observation-module__units___EdVuw","pad-right":"-esm-primary-navigation__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-primary-navigation__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-primary-navigation__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-primary-navigation__numeric-observation-module__arrow___SLGUh"},uh=({value:e,unit:t,label:n,interpretation:r,referenceRange:o,conceptUuid:i,variant:a="card",patientUuid:s})=>{let l=(0,oH.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${tN}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${tN}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:o,isLoading:i}=(0,iT.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,oH.useMemo)(()=>{if(r)return r?"--"===r?"normal":up.includes(r)?r.toLowerCase():uf.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,g=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,h=`omrs-numeric-obs-value-${l}`,w=`omrs-numeric-obs-unit-${l}`,y=null!=e&&""!==e,_=y?e:tp("notAvailable","Not available"),v=aR()({[ug["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[ug["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[ug.low]:"low"===m,[ug.high]:"high"===m,[ug["off-scale-low"]]:"off_scale_low"===m,[ug["off-scale-high"]]:"off_scale_high"===m}),b=aR()({[ug.container]:!0,[ug.card]:!0,[ug["critical-value"]]:p,[ug["abnormal-value"]]:f&&!p}),x=aR()({[ug.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:ug["label-container"],children:[(0,aA.jsx)("span",{id:g,className:ug.label,children:n}),f&&(0,aA.jsx)("span",{className:ug[m.replace("_","-")],title:tp("abnormalValue","Abnormal value")})]}),(0,aA.jsxs)("div",{className:ug["value-container"],children:[(0,aA.jsx)("span",{id:h,"aria-labelledby":g&&w?`${g} ${w}`:g||w||void 0,className:ug.value,children:_}),y&&t&&(0,aA.jsx)("span",{id:w,className:ug.units,children:t})]})]})},uw="-esm-primary-navigation__page-header-module__pageHeader___YOpQL",uy=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,aA.jsx)("div",{className:aR()(uw,n),...r,children:t})}{let{title:t,illustration:n,className:r,...o}=e;return(0,aA.jsx)("div",{className:aR()(uw,r),...o,children:(0,aA.jsx)(u_,{title:t,illustration:n})})}},u_=({title:e,illustration:t,className:n})=>{let[r,o]=(0,oH.useState)(null);return(0,oH.useEffect)(()=>{eM("@openmrs/esm-styleguide").then(e=>{o(e)})},[]),(0,aA.jsxs)("div",{className:aR()("-esm-primary-navigation__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,aA.jsxs)("div",{className:"-esm-primary-navigation__page-header-module__pageLabels___pPcKj",children:[r?.implementationName&&(0,aA.jsx)("p",{children:tp(r.implementationName)}),(0,aA.jsx)("p",{className:"-esm-primary-navigation__page-header-module__pageName___3d4IC",children:e})]})]})},uv=({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=tp("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,aA.jsx)(aA.Fragment,{children:e>0&&(0,aA.jsxs)("div",{className:aR()({"-esm-primary-navigation__pagination-module__tablet___lQ3ak":c,"-esm-primary-navigation__pagination-module__desktop___HfUTY":!c}),children:[(0,aA.jsxs)("div",{children:[u,o&&(0,aA.jsx)(oz,{to:o,className:"-esm-primary-navigation__pagination-module__configurableLink___NM9v7",children:a??tp("seeAll","See all")})]}),(0,aA.jsx)(aD.Pagination,{className:"-esm-primary-navigation__pagination-module__pagination___WzkBs",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>tp("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function ub(e){return uS(uk(e,"usual","official"))}function ux(e){return ub(e)}function uS(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uj(e){return uS(e)}function uk(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 uN(e,t=ac()){let n=ac(t),r=ce(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 uE(e,t=ac()){let n=uN(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),l9(n,r)}let uC={container:"-esm-primary-navigation__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-primary-navigation__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-primary-navigation__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-primary-navigation__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-primary-navigation__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-primary-navigation__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-primary-navigation__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-primary-navigation__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-primary-navigation__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-primary-navigation__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-primary-navigation__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-primary-navigation__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-primary-navigation__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-primary-navigation__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-primary-navigation__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-primary-navigation__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-primary-navigation__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-primary-navigation__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-primary-navigation__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-primary-navigation__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-primary-navigation__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-primary-navigation__patient-banner-patient-info-module__actionsButtonText___mn139"};function uI({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsx)("span",{className:uC.primaryIdentifier,children:(0,aA.jsxs)(aD.Tag,{className:uC.tag,type:"gray",children:[e&&t?.text&&(0,aA.jsxs)("span",{className:uC.label,children:[t.text,": "]}),(0,aA.jsx)("span",{className:uC.value,children:n})]})})}function uP({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsxs)(aD.FormLabel,{className:uC.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,aA.jsxs)("span",{className:uC.label,children:[t?.text,": "]}),(0,aA.jsx)("span",{className:uC.value,children:n})]})}function uA({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)(oV().Fragment,{children:[(0,aA.jsx)("span",{className:uC.identifier,children:n?.coding?.[0]?.code===r?(0,aA.jsx)(uI,{showIdentifierLabel:t,type:n,value:e}):(0,aA.jsx)(uP,{showIdentifierLabel:t,type:n,value:e})}),i<o.length-1&&(0,aA.jsx)("span",{className:uC.separator,children:"\xb7"})]},e)):""})}let uO={Female:s_,Male:sv,Other:sb,Unknown:sx},uR=({gender:e})=>{let t=uO[e];return t?(0,aA.jsx)(t,{fill:"#525252"}):null},uT={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function u$({patient:e,renderedFrom:t}){var n;let r,o,i=ub(e),a=e?.gender&&(o=uT[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tp(r,n),iconKey:o}),s=(0,oH.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,aA.jsxs)("div",{className:uC.patientInfo,children:[(0,aA.jsx)("div",{className:aR()(uC.row,uC.patientNameRow),children:(0,aA.jsxs)("div",{className:uC.flexRow,children:[(0,aA.jsx)("span",{className:uC.patientName,children:i}),a&&(0,aA.jsxs)("div",{className:uC.gender,children:[(0,aA.jsx)(uR,{gender:a.iconKey}),(0,aA.jsx)("span",{children:a.displayText})]}),(0,aA.jsx)(o4,{className:uC.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,aA.jsxs)("div",{className:uC.demographics,children:[e.birthDate&&(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("span",{children:uE(e.birthDate)}),(0,aA.jsx)("span",{className:uC.separator,children:"\xb7"}),(0,aA.jsx)("span",{children:l5(e.birthDate,{time:!1})}),(0,aA.jsx)("span",{className:uC.separator,children:"\xb7"})]}),(0,aA.jsx)(uA,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,aA.jsx)(o4,{className:uC.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var uM=n(7683);function uL({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[o,i]=(0,oH.useState)(!1),{extensions:a}=o8(n),s="tablet"===i2(),l=i7(()=>i(!1),o),c=(0,oH.useRef)(null),u=(0,oH.useRef)(null),d=(0,oH.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,oH.useCallback)(()=>i(e=>!e),[]),g=(0,oH.useCallback)(()=>{i(!1),c.current?.focus()},[]),h=(0,oH.useCallback)(e=>{if("Escape"===e.key&&o){e.stopPropagation(),g();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()}},[g,o]);(0,oH.useEffect)(()=>{if(o&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[o]);let w=(0,oH.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:g,...r}),[t,e,g,r]);return 0===a.length?null:(0,aA.jsx)("div",{className:"-esm-primary-navigation__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aU),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:h,ref:c,children:[(0,aA.jsx)("span",{className:"-esm-primary-navigation__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tp("actions","Actions")})," ",(0,aA.jsx)(uM.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:h,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)(o4,{name:n,state:w},n)}),(0,aA.jsx)("span",{})]})]})})}var uD=n(397),uW=n.n(uD);function uB(e){let{patientPhotoConceptUuid:t}=iA({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tN}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:o,isLoading:i}=(0,it.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 uU=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,ie.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"})]})},uF="-esm-primary-navigation__patient-photo-module__avatar___t5TmZ";function uH({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:o}=uB(e),[i,a]=(0,oH.useState)(null),[s,l]=(0,oH.useState)(!1),c=(0,oH.useMemo)(()=>uW().generate(e),[e]);(0,oH.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,oH.useMemo)(()=>n||(i?tp("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):tp("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,i,t]);return o||s?(0,aA.jsx)(aD.SkeletonIcon,{className:"-esm-primary-navigation__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):r?.imageSrc&&!i?(0,aA.jsx)(uU,{"aria-label":tp("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("img",{className:uF,src:i,alt:u,title:t})}):(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("div",{className:uF,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,aA.jsx)("span",{className:"-esm-primary-navigation__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 uV=["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-transfer","omrs-pict-triage","omrs-pict-x-ray"],uG=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),uz=uG,uq=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),uJ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),uK=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),uX=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),uY=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),uZ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),uQ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u0=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u1=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),u2=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),u5=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),u6=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),u8=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),u3=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),u4=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),u7=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),u9=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),de=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),dt=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),dn=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),dr=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),di=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),da=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),ds=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dl=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dc=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),du=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),dd=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),dm=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),dp=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),df=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dg=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dh=u6,dw=di,dy=(0,oH.memo)((0,oH.forwardRef)(function({pictogram:e,fallback:t,...n},r){let o=(0,oH.useRef)(document.getElementById(e));return(0,oH.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)(ib,{value:o.current,fallback:t,children:(0,aA.jsx)(d_,{ref:r,pictogram:e,pictogramProps:n})})})),d_=(0,oH.memo)((0,oH.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-primary-navigation__pictograms-module__pictogram___wXX7t",r),height:o,width:o,children:(0,aA.jsx)("use",{href:`#${e}`})})})),dv=({children:e})=>"tablet"===i2()?(0,aA.jsx)(aD.Layer,{children:e}):(0,aA.jsx)(aA.Fragment,{children:e}),db=({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,oH.useState)(n),[g,h]=(0,oH.useState)(!0),[w,y]=(0,oH.useState)(!1),_=(0,oH.useCallback)(()=>{setTimeout(t,250)},[t]),v=(0,oH.useCallback)(()=>{y(!0),_()},[_]);return(0,oH.useEffect)(()=>{if(c){let e=setTimeout(v,l);return()=>clearTimeout(e)}},[l,c,v]),(0,oH.useEffect)(()=>{h(!1),window.setTimeout(()=>{h(!0)},0)},[]),(0,aA.jsx)(aD.ActionableNotification,{actionButtonLabel:p,"aria-label":tp("closeSnackbar","Close snackbar"),className:aR()("-esm-primary-navigation__snackbar-module__slideIn___-oZIt",{"-esm-primary-navigation__snackbar-module__animated___M2YBU":g,"-esm-primary-navigation__snackbar-module__slideOut___yEmGT":w}),kind:r,lowContrast:i,onActionButtonClick:()=>{o(),v(),a&&f(a)},onClose:_,statusIconDescription:tp("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...m})},dx=({subject:e})=>{let[t,n]=(0,oH.useState)([]),r=(0,oH.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oH.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)(db,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},dS=new uo,dj=0;function dk(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(dx,{subject:dS}))}function dN(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dS.next({...e,id:dj++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dE=({toast:e,closeToast:t})=>{let{description:n,kind:r,critical:o,title:i,actionButtonLabel:a,onActionButtonClick:s=()=>{}}=e,l=(0,oH.useCallback)(()=>{s(),t()},[t,s]);return(0,aA.jsx)("div",{children:(0,aA.jsx)(aD.ActionableNotification,{actionButtonLabel:a,kind:r||"info",lowContrast:o,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},dC=({subject:e})=>{let[t,n]=(0,oH.useState)([]),r=(0,oH.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oH.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)(dE,{toast:e,closeToast:()=>r(e)},e.id))})},dI=new uo,dP=0;function dA(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(dC,{subject:dI}))}function dO(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,c9.A)(t))?setTimeout(()=>{dI.next({...e,id:dP++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dR=n(3173),dT=n(185),d$=n(4656);async function dM(e,t){let{openedGroup:n}=oC.getState();if(n){if(n.groupName===e&&dW(n.props,t))return!0;else if(!await dB({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return oC.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dL(e){let{openedGroup:t,openedWindows:n}=oC.getState();if(t){if(n.length>0&&!(e||await dB({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;oC.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dD(e,t=null,n=null,r=null){let o=oC.getState();if(!o.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=oI(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=oA(e);if(a&&(a.groupName!==l.name||!dW(a.props,r)))return!!await dB({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[dG(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(dW(r.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dW(d.props,t)?((a||c!==o.openedWindows.length-1)&&oC.setState(dU.restoreWindow(o,s)),!0):!!await dB({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:o?.openedGroup?.props??i},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[dG(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dB({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:i??o?.openedGroup?.props},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[dG(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(oC.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[...o.openedWindows,{windowName:s,openedWorkspaces:[dG(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dB({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[dG(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dW(e,t){return null==e||null==t||x(e,t)}function dB(e){function t(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}let{openedWindows:n,workspaceTitleByWorkspaceName:r}=oC.getState(),o=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":o=n.flatMap(e=>t(e));break;case"CLOSE_WINDOW":{let r=n.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=t(r);break}case"CLOSE_WORKSPACE":{let r=n.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=t(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":o=n.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>t(e))}return 0===o.length?Promise.resolve(!0):new Promise(e=>{let t=c7("workspace2-close-prompt",{size:"sm",onConfirm:()=>{t(),e(!0)},onCancel:()=>{t(),e(!1)},affectedWorkspaceTitles:o.map(e=>r[e.workspaceName])})})}let dU={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=oA(t);if(n<0)return e;let r={...e.openedWindows[n]},o=r.openedWorkspaces.findIndex(e=>e.workspaceName===t),i=[...e.openedWindows];r.openedWorkspaces=r.openedWorkspaces.slice(0,o);let a=e.isMostRecentlyOpenedWindowHidden;if(0===r.openedWorkspaces.length){let t=n===e.openedWindows.length-1;i.splice(n,1),t&&i.length>0&&(a=!1)}else i[n]=r;return{...e,openedWindows:i,isMostRecentlyOpenedWindowHidden:a}},openChildWorkspace(e,t,n,r){let o=e.registeredWorkspacesByName[n];if(!o)throw Error(`No workspace named "${n}" registered`);let i=e.registeredWorkspacesByName[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);let a=e.openedWindows.findIndex(e=>e.windowName===o.window);if(-1==a)throw Error(`Cannot open child workspace ${n} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e.openedWindows[a],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{openedWindows:e.openedWindows.map((e,t)=>t==a?{...e,openedWorkspaces:[...c,dG(n,r)]}:e)}},setHasUnsavedChanges(e,t,n){let r=oA(t);if(r<0)return e;let o={...e.openedWindows[r]},i=o.openedWorkspaces.findIndex(e=>e.workspaceName===t);if(i<0)return e;o.openedWorkspaces[i]={...o.openedWorkspaces[i],hasUnsavedChanges:n};let a=[...e.openedWindows];return a[r]=o,{...e,openedWindows:a}},setWorkspaceTitle(e,t,n){let r={...e.workspaceTitleByWorkspaceName};return null===n?delete r[t]:r[t]=n,{...e,workspaceTitleByWorkspaceName:r}}};function dF(){return oZ(oC,dU)}let dH=()=>(0,oH.useContext)(o9.i),dV=()=>Object.keys(oC.getState().registeredWorkspacesByName);function dG(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,d$.A)()}}let dz={workspaceOuterContainer:"-esm-primary-navigation__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-primary-navigation__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-primary-navigation__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-primary-navigation__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-primary-navigation__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-primary-navigation__workspace2-module__maximized___Kfygr",hidden:"-esm-primary-navigation__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-primary-navigation__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-primary-navigation__workspace2-module__workspaceSpacer___E+982",loader:"-esm-primary-navigation__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-primary-navigation__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-primary-navigation__workspace2-module__header___IZ-2+",headerButtons:"-esm-primary-navigation__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-primary-navigation__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-primary-navigation__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-primary-navigation__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-primary-navigation__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-primary-navigation__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-primary-navigation__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-primary-navigation__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-primary-navigation__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},dq=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let r=i2(),{setWindowMaximized:o,hideWindow:i,setHasUnsavedChanges:a,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:d,workspaceTitleByWorkspaceName:m,setWorkspaceTitle:p,isMostRecentlyOpenedWindowHidden:f}=dF(),{workspaceName:g,isRootWorkspace:h,closeWorkspace:w,showActionMenu:y}=dH(),_=oA(g),v=s[_],b=v?.openedWorkspaces.find(e=>e.workspaceName===g);if((0,oH.useEffect)(()=>{b?.hasUnsavedChanges!=n&&a(g,n??!1)},[b?.hasUnsavedChanges,n,g,a]),(0,oH.useEffect)(()=>{m[g]!==e&&p(g,e)},[m,g,e,p]),_<0||null==l||null==b)return null;let x=c[l.groupName];if(!x)throw Error(`Cannot find registered workspace group ${l.groupName}`);let S=d[g].window,j=u[S];if(!j)throw Error(`Cannot find registered workspace window ${S}`);let{icon:k,canMaximize:N}=j,E="closable"===x.persistence,C=!!k&&!E,{maximized:I}=v,P=j?.width??"narrow",A=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),O=_<s.length-1||f;return(0,aA.jsxs)("div",{className:aR()(dz.workspaceOuterContainer,{[dz.narrowWorkspace]:"narrow"===P,[dz.widerWorkspace]:"wider"===P,[dz.extraWideWorkspace]:"extra-wide"===P,[dz.isActionMenuOpened]:A}),children:[(0,aA.jsx)("div",{className:aR()(dz.workspaceSpacer,{[dz.hidden]:O})}),(0,aA.jsx)("div",{className:aR()(dz.workspaceMiddleContainer,{[dz.maximized]:I,[dz.hidden]:O,[dz.isRootWorkspace]:h,[dz.showActionMenu]:y}),children:(0,aA.jsxs)("div",{className:aR()(dz.workspaceInnerContainer,{[dz.maximized]:I,[dz.hidden]:O,[dz.isRootWorkspace]:h}),children:[(0,aA.jsxs)(aD.Header,{"aria-label":tp("workspaceHeader"),className:dz.header,children:[(0,aA.jsx)(aD.HeaderName,{prefix:"",children:e}),(0,aA.jsx)("div",{className:dz.overlayHeaderSpacer}),(0,aA.jsx)(aD.HeaderGlobalBar,{className:dz.headerButtons,children:i5(r)?(0,aA.jsxs)(aA.Fragment,{children:[(N||I)&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":I?tp("minimize"):tp("maximize"),onClick:()=>o(S,!I),children:I?(0,aA.jsx)(dR.Xj,{}):(0,aA.jsx)(dR.hz,{})}),C&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("hide"),onClick:()=>i(),children:(0,aA.jsx)(a1,{})}),!E&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("close"),onClick:()=>w({closeWindow:!0}),children:(0,aA.jsx)(sc,{})})]}):(0,aA.jsxs)(aA.Fragment,{children:[C&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("hide"),onClick:()=>i(),children:(0,aA.jsx)(dT.d3,{})}),(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("close"),onClick:()=>{E?dL():w({closeWindow:!0})},children:(0,aA.jsx)(sc,{})})]})})]}),(0,aA.jsx)("div",{className:aR()(dz.workspaceContent),children:t})]})})]})},dJ="-esm-primary-navigation__action-menu-button2-module__container___jc6--",dK="-esm-primary-navigation__action-menu-button2-module__elementContainer___whLL8",dX="-esm-primary-navigation__action-menu-button2-module__active___fbyFm",dY="-esm-primary-navigation__action-menu-button2-module__focused___+aVpz";function dZ({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,aA.jsxs)(aA.Fragment,{children:[e({size:16}),t?(0,aA.jsx)("span",{className:"-esm-primary-navigation__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,aA.jsx)("span",{className:"-esm-primary-navigation__action-menu-button2-module__countTag___XMH0D",children:n})]})}let dQ=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:o})=>{let i=i2(),{openedWindows:a,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=dF(),{extension:u}=(0,oH.useContext)(oG),d=a.findIndex(e=>e.windowName===u?.extensionId),m=a[d],p=null!=m,f=p&&(d<a.length-1||c),g=p&&!f,h=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;dD(e,t,n)}};return"tablet"===i||"phone"===i?(0,aA.jsxs)(aD.Button,{className:aR()(dJ,{[dX]:p&&!g,[dY]:g}),iconDescription:t,kind:"ghost",onClick:w,role:"button",tabIndex:0,size:"md",children:[(0,aA.jsx)("span",{className:dK,children:(0,aA.jsx)(dZ,{hasUnsavedChanges:h,getIcon:e,tagContent:n})}),(0,aA.jsx)("span",{children:t})]}):(0,aA.jsx)(aD.IconButton,{align:"left","aria-label":t,className:aR()(dJ,{[dX]:p&&!g,[dY]:g}),enterDelayMs:300,kind:"ghost",label:t,onClick:w,size:"md",children:(0,aA.jsx)("div",{className:dK,children:(0,aA.jsx)(dZ,{hasUnsavedChanges:h,getIcon:e,tagContent:n})})})};function d0({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,aA.jsx)(aD.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?sl:si,children:e?tp("showLess","Show less"):tp("showMore","Show more")})}let d1={contactDetails:"-esm-primary-navigation__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-primary-navigation__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-primary-navigation__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-primary-navigation__patient-banner-contact-details-module__row___qFgIi",col:"-esm-primary-navigation__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-primary-navigation__patient-banner-contact-details-module__relationship___T3LO-"},d2=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${tN}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=(0,it.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,oH.useMemo)(()=>({cohorts:o,isLoading:r}),[r,o])}(e);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsxs)("p",{className:d1.heading,children:[tp("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,aA.jsx)(aD.InlineLoading,{description:`${tp("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>lY(e?.startDate).getTime()-lY(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,aA.jsx)("li",{children:(0,aA.jsx)(oz,{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:d1.link,children:(0,aA.jsx)(oz,{to:`${window.spaBase}/home/patient-lists`,children:tp("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},d5=({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)(aD.InlineLoading,{description:`${tp("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:d1.heading,children:tp("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:[tp(o(t.url),o(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,aA.jsxs)("li",{children:[tp(e,e),": ",t]},`address-${e}`)):(0,aA.jsx)("li",{children:"--"})})]})},d6=({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,iT.A)(`${tN}/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,oH.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:o,error:r}})(e),r=(0,oH.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?tp(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:d1.heading,children:tp("contactDetails","Contact Details")}),t?(0,aA.jsx)(aD.InlineLoading,{description:`${tp("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:"--"})})]})},d8=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${tN}/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,it.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:d1.heading,children:tp("relationships","Relationships")}),n?(0,aA.jsx)(aD.InlineLoading,{description:`${tp("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:d1.relationship,children:[(0,aA.jsx)("div",{children:(0,aA.jsx)(oz,{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?tp("yearAbbreviation","yr"):tp("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,aA.jsx)("li",{children:"--"})})]})};function d3({patientId:e,deceased:t}){return(0,aA.jsxs)("div",{className:aR()(d1.contactDetails,{[d1.deceased]:t}),children:[(0,aA.jsxs)("div",{className:d1.row,children:[(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d5,{patientId:e})}),(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d6,{patientUuid:e})})]}),(0,aA.jsxs)("div",{className:d1.row,children:[(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d8,{patientId:e})}),(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d2,{patientUuid:e})})]})]})}function d4(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 d7="-esm-primary-navigation__action-menu2-module__container___6Gke0";function d9({workspaceGroup:e,groupProps:t}){let n=i2(),{persistence:r}=e;return(0,aA.jsx)("aside",{className:"-esm-primary-navigation__action-menu2-module__sideRail___T2lMV",children:(0,aA.jsxs)("div",{className:d7,children:["closable"==r&&i5(n)&&(0,aA.jsx)(aD.IconButton,{align:"left",onClick:()=>dL(),label:tp("close"),kind:"ghost",children:(0,aA.jsx)(sc,{})}),(0,aA.jsx)(oG.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,aA.jsx)(o4,{className:d7,name:e.name,state:{groupProps:t}})})]})})}function me(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}}var mt=n(1820);let mn=({lifeCycle:e,openedWorkspace:t,openedWindow:n,isRootWorkspace:r,isLeafWorkspace:o,showActionMenu:i})=>{let{openedGroup:a,closeWorkspace:s,openChildWorkspace:l}=dF(),c=(0,oH.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:r=!1,discardUnsavedChanges:o=!1}=e;return r?!!(o||await dB({reason:"CLOSE_WINDOW",explicit:!0,windowName:n.windowName}))&&(s(n.openedWorkspaces[0].workspaceName),!0):!!(o||await dB({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:t.workspaceName}))&&(s(t.workspaceName),!0)},launchChildWorkspace:async(e,r)=>{let o=t.workspaceName,{openedWorkspaces:i}=n,a=i.findIndex(e=>e.workspaceName===o);-1===a||a!==i.length-1&&i.slice(a+1).some(e=>e.hasUnsavedChanges)&&!await dB({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:i[a+1].workspaceName})||l(o,e,r||{})},workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:a&&a.props?a.props:null,workspaceMeta:oC.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:r,isLeafWorkspace:o,windowName:n.windowName,showActionMenu:i},[t,s,a,n]);if(!e){let{registeredWorkspacesByName:e}=oC.getState(),n=e[t.workspaceName],o=n&&n.window?n.window:void 0,{registeredWindowsByName:s}=oC.getState(),l=o?s[o]:void 0,c=l&&l.width?l.width:"narrow",u=Object.values(s).some(e=>e.group===a?.groupName&&void 0!==e.icon);return(0,aA.jsxs)("div",{className:aR()(dz.workspaceOuterContainer,{[dz.narrowWorkspace]:"narrow"===c,[dz.widerWorkspace]:"wider"===c,[dz.extraWideWorkspace]:"extra-wide"===c,[dz.isActionMenuOpened]:u}),children:[(0,aA.jsx)("div",{className:dz.workspaceSpacer}),(0,aA.jsx)("div",{className:aR()(dz.workspaceMiddleContainer,{[dz.isRootWorkspace]:r,[dz.showActionMenu]:i}),children:(0,aA.jsx)("div",{className:aR()(dz.workspaceInnerContainer,{[dz.isRootWorkspace]:r}),children:(0,aA.jsx)(aD.InlineLoading,{className:dz.loader,description:`${tp("loading")} ...`})})})]})}return(0,aA.jsx)(mt.A,{config:e,mountParcel:oU,...c},t.workspaceName)},mr=({openedWindow:e,showActionMenu:t})=>{let{openedWorkspaces:n}=e,[r,o]=(0,oH.useState)({}),{registeredWorkspacesByName:i}=oC.getState();return(0,oH.useEffect)(()=>{let e=!1;return Promise.all(n.map(async e=>{let{moduleName:t,component:n}=i[e.workspaceName];return[e.uuid,await av(t,n)]})).then(t=>{e||o(Object.fromEntries(t))}),()=>{e=!0}},[n]),(0,aA.jsx)(aA.Fragment,{children:n.map((o,i)=>(0,aA.jsx)(mn,{openedWorkspace:o,openedWindow:e,lifeCycle:r[o.uuid],isRootWorkspace:0===i,isLeafWorkspace:i===n.length-1,showActionMenu:t},o.uuid))})};function mo(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(mi,{}))}function mi(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=dF();if((0,oH.useEffect)(()=>nz("before-page-changed",t=>{let{newPage:r,cancelNavigation:o,oldUrl:i,newUrl:a}=t;if(!e)return;if(r)return void o(dL().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),o=me(t),i=me(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(dL().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-primary-navigation__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-primary-navigation__workspace-windows-and-menu-module__overlay___7RHYZ":o.overlay,"-esm-primary-navigation__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,aA.jsx)("div",{className:"-esm-primary-navigation__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(e=>(0,aA.jsx)(mr,{openedWindow:e,showActionMenu:s},e.windowName))}),s&&(0,aA.jsx)(d9,{workspaceGroup:o,groupProps:e.props})]})}function ma(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 ms(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function ml(e){return!!e&&e.constructor===Object}var mc=n(3376);function mu(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function md(e,t){return mc(function(e){let t=e.indexOf("-");if(t>=0){let n=mu(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return mu(e)}(t),e,{includePrerelease:!0})}async function mm(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 mp(o(a)),await e()}catch(e){i?.(e,a),n=e}while(r(a++));throw n}async function mp(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function mf(e,t,n,r){}function mg(e){}function mh(e){return Promise.resolve([])}function mw(e){return Promise.resolve([])}function my(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 m_(e){return()=>{}}function mv(){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=>!!rL(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,tl.pathToActiveWhen)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,tl.registerApplication)(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 aI=!1;function aP(){aI||(window.addEventListener("resize",aC),aC(),aI=!0)}var aA=n(6870),aO=n(5530),aR=n.n(aO);function aT({title:e,children:t}){let n="tablet"===i2();return(0,aA.jsxs)("div",{className:aR()({"-esm-primary-navigation__card-header-module__tabletHeader___Vkmd-":n,"-esm-primary-navigation__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,aA.jsx)("h4",{children:e}),t]})}let a$=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],aM={primaryColor:{_type:V.String,_description:"The color for displaying primary diagnoses tags",_default:"red",_validators:[e9.oneOf(a$)]},secondaryColor:{_type:V.String,_description:"The color for displaying secondary diagnoses tags",_default:"blue",_validators:[e9.oneOf(a$)]}},aL={"Brand color #1":{_default:"#005d5d",_type:V.String},"Brand color #2":{_default:"#004144",_type:V.String},"Brand color #3":{_default:"#007d79",_type:V.String},excludePatientIdentifierCodeTypes:{uuids:{_type:V.Array,_description:"List of UUIDs of patient identifier types to exclude from rendering in the patient banner",_default:[],_elements:{_type:V.UUID}}},implementationName:{_type:V.String,_description:"A name of the place (or authority) where all possible locations a user can choose are located.",_default:"Clinic"},logo:{src:{_type:V.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:[e9.isUrl]},alt:{_type:V.String,_default:"Logo",_description:"The alternative text for the logo image, displayed when the image cannot be loaded or on hover."}},patientPhotoConceptUuid:{_type:V.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:V.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:[e9.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:V.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:V.String}},diagnosisTags:aM};var aD=n(8326);let aW={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},aB=e=>(0,aA.jsx)(aD.TableBatchActions,{translateWithId:(e,t)=>{let n=aW[e];return n?tp(n,e,t):e},...e}),aU="-esm-primary-navigation__custom-overflow-menu-module__container___8PykS",aF="-esm-primary-navigation__custom-overflow-menu-module__menu___qsOLn",aH="-esm-primary-navigation__custom-overflow-menu-module__show___BserJ",aV="-esm-primary-navigation__custom-overflow-menu-module__overflowMenuButton___n86Gz",aG=(0,oH.createContext)(null);function az(){let e=(0,oH.useContext)(aG);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function aq({menuTitle:e,children:t}){let[n,r]=oV().useState(!1),o=i7(()=>r(!1),n),i="tablet"===i2(),a=(0,oH.useCallback)(()=>r(e=>!e),[]),s=(0,oH.useRef)(null),l=(0,oH.useRef)(null),c=(0,oH.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,m=(0,oH.useCallback)(()=>{r(!1),s.current?.focus()},[]),p=(0,oH.useMemo)(()=>({closeMenu:m}),[m]),f=(0,oH.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),m())},[m,n]),g=oH.Children.toArray(t);(0,oH.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let h=(0,oH.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=g.map((e,t)=>(0,oH.isValidElement)(e)?(0,oH.cloneElement)(e,{closeMenu:m,handleOverflowMenuItemFocus:h,index:t}):e);return(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aU),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,oH.useContext)(aG);return(0,aA.jsx)(aD.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var aK=n(7665);let aX=["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"],aY=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),aZ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-add",iconProps:e})})),aQ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),a0=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),a1=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),a2=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),a5=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),a6=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),a8=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),a3=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),a4=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),a7=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),a9=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),se=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),st=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),sn=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),sr=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),so=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),si=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),sa=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),ss=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),sl=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),sc=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-close",iconProps:e})})),su=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),sd=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),sm=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-document",iconProps:e})})),sp=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),sf=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-download",iconProps:e})})),sg=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),sh=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),sw=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),sy=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-events",iconProps:e})})),s_=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),sv=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),sb=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),sx=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),sS=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),sj=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-group",iconProps:e})})),sk=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),sN=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),sE=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),sC=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-information",iconProps:e})})),sI=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),sP=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),sA=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),sO=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),sR=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),sT=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-location",iconProps:e})})),s$=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),sM=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),sL=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),sD=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),sW=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),sB=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),sU=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-money",iconProps:e})})),sF=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),sH=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),sV=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sG=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sz=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-password",iconProps:e})})),sq=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),sJ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),sK=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),sX=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),sY=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),sZ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),sQ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),s0=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-report",iconProps:e})})),s1=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),s2=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-save",iconProps:e})})),s5=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-search",iconProps:e})})),s6=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),s8=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),s3=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),s4=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),s7=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),s9=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),le=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),lt=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-table",iconProps:e})})),ln=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-time",iconProps:e})})),lr=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),lo=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),li=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),la=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),ls=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),ll=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),lc=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),lu=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),ld=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lm=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lp=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-view",iconProps:e})})),lf=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(lb,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),lg=lf,lh=sp,lw=sR,ly=sE,l_=s4,lv=(0,oH.memo)((0,oH.forwardRef)(function({icon:e,fallback:t,...n},r){let o=(0,oH.useRef)(e?document.getElementById(e):void 0);return(0,oH.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)(ib,{value:o.current,fallback:t,children:(0,aA.jsx)(lb,{ref:r,icon:e,iconProps:n})})})),lb=(0,oH.memo)((0,oH.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,oH.useRef)(null);return(0,oH.useImperativeHandle)(n,()=>a.current),(0,oH.useEffect)(()=>{a.current&&"currentColor"!==o&&a.current.style.setProperty("--omrs-icon-fill",o)},[]),(0,aA.jsx)("svg",{ref:a,className:aR()("omrs-icon","-esm-primary-navigation__icons-module__icon___BfFhd",r),height:i,width:i,viewBox:"0 0 16 16",children:(0,aA.jsx)("use",{href:`#${e}`})})})),lx=({path:e,title:t,basePath:n,icon:r})=>{let{t:o}=(0,ie.useTranslation)(),i=(0,aK.useLocation)(),a=(0,oH.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)(oz,{className:aR()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${n}/${encodeURIComponent(e)}`,children:(0,aA.jsxs)("span",{className:"-esm-primary-navigation__dashboard-module__menu___ds1tf",children:[(0,aA.jsx)(lv,{icon:r,className:"-esm-primary-navigation__dashboard-module__icon___4Zrrh",size:16}),(0,aA.jsx)("span",{children:o(t)})]})})},e)};function lS(e){return function({basePath:t}){return(0,aA.jsx)(aK.BrowserRouter,{children:(0,aA.jsx)(lx,{basePath:t,...e})})}}var lj=n(7715),lk=n(7532),lN=n(3692),lE=n(7615),lC=n(700),lI=n(6816),lP=n(1168);function lA(e){return oV().createElement(lP.C,e)}var lO=n(3010),lR=n(6513),lT=n(6190);function l$(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 lO.ng||e instanceof lO._l||e instanceof lO.Ip)return t?(0,lR.yP)(e,t):e;{let n=au()(e).toDate(),r=new lO.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,lR.yP)(r,t):r}}function lM(e){if(e)return e.toDate((0,lT.Xj)())}var lL=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 lW(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 lU=n(7883),lF=n(424),lH=n(1492),lV=n(8271);function lG(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(lH),ac.extend(lF);let lz="YYYY-MM-DDTHH:mm:ss.SSSZZ";function lq(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,lz).isValid()}function lJ(e){return ac(e).isToday()}function lK(e){return lq(e)?ac(e,lz).toDate():null}function lX(e,t=!1){let n=ac(e);return t&&(n=n.utc()),n.format(lz)}function lY(e){return ac(e).toDate()}var lZ=new WeakMap;let lQ=new class{register(e,t){lG(this,lZ).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lG(this,lZ).has(t))return lG(this,lZ).get(t)}if(e.language&&lG(this,lZ).has(e.language))return lG(this,lZ).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lG(this,lZ).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,lZ,{writable:!0,value:new Map})}};function l0(e,t){lQ.register(e,t)}function l1(e){let t=e??lB();return lQ.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l2={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l5(e,t={}){let n=lB(),r=(0,lU.CD)(e,n);if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lV.A)(r.day)&&(0,lV.A)(r.month)&&(r=Object.assign({},(0,F.A)(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},(0,F.A)(r,"day"),{date:r.day}));let o=ac().set(r).toDate();return(0,lV.A)(r.year)&&(t.year=!1),(0,lV.A)(r.month)&&(t.month=!1),(0,lV.A)(r.date)&&(t.day=!1),l6(o,t)}function l6(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}={...l2,...{noToday:"am"===o.language},...t},p={calendar:i??l1(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(l8("-"))),"wide"==a&&(t=t.map(l8(" — "))),"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+=`, ${l3(e)}`),n}let l8=e=>(t,n,r)=>"literal"!==t.type||" "!==t.value||n<r.length-1&&"era"===r[n+1].type?t:{type:"literal",value:e};function l3(e){return e.toLocaleTimeString(lB(),{hour:"2-digit",minute:"2-digit"})}function l4(e,t){return l6(e,{...t,time:!0})}function l7(e,t){let n=l1("string"==typeof t?new Intl.Locale(t):t);return n?(0,lR.yP)(e,(0,lL.d)(n)):e}function l9(e,t){return new Intl.DurationFormat(lB(),t).format(e)}function ce(e,t){if(null==e)return null;if("string"==typeof e){let n=lB(),r=(0,lU.CD)(e,n);return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...(0,F.A)(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...(0,F.A)(r,"day"),...{date:r.day}}),ac(t).set(r))}return ac(e)}let ct=["years","months","days","hours","minutes","seconds"],cn={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},cr={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function co(e,t=ac(),n){let r,o=ac(t),i=ce(e,o);if(null==i)return null;if("string"==typeof n){let e=cn[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?cn[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=ct.indexOf(n);for(let o=0;o<ct.length;o++){let i=ct[o];if(t.diff(e,i)>0)return o<=r?i:n}return n}(i,o,t??"seconds"):cn[s]??s,function(e,t,n,r){let o=ct.indexOf(n),i=ct.indexOf(r),a=ct.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={...cr};if(e)for(let[n,r]of Object.entries(e))void 0!==r&&(t[cn[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 ci={style:"short",localeMatcher:"lookup"};function ca(e,t=ac(),n){let r=co(e,t,n);return null==r?null:l9(r,"object"==typeof n&&n.formatOptions?{...ci,...n.formatOptions}:ci)}let cs=(0,oH.createContext)(null);function cl(){let e=iA({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,oH.useMemo)(()=>{let t=lB();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,oH.useMemo)(()=>{let e=l1(t);return void 0!==e?(0,lL.d)(e):void 0},[t]),r=(0,oH.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),o=(0,oH.useMemo)(()=>n?(0,lR.yP)((0,lT.Ec)((0,lT.Xj)()),n):(0,lT.Ec)((0,lT.Xj)()),[n]);return{calendar:n,intlLocale:r,today_:o}}let cc=new lO.ng(1793,1,1);var cu=n(5830),cd=n(6156),cm=n(4745),cp=n(1202);function cf(e,t){return Number.parseInt(l6(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let cg=(0,oH.forwardRef)(function(e,t){let{className:n}=e,r=(0,oH.useContext)(cu.f2),o=(0,oH.useContext)(cu._I),i=r??o,a=(0,oH.useContext)(cs),s=(0,lT.Xj)(),l=l6(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=cf(i.visibleRange.start.toDate(s),a),u=i.maxValue?cf(i.maxValue.toDate(s),a):void 0,d=i.minValue?cf(i.minValue.toDate(s),a):void 0,m=(0,oH.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)(cm.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,aA.jsx)(cp.p,{}),(0,aA.jsxs)(lE.Y,{children:[(0,aA.jsx)(lC.$,{slot:"increment",children:(0,aA.jsx)(a9,{size:8})}),(0,aA.jsx)(lC.$,{slot:"decrement",children:(0,aA.jsx)(a3,{size:8})})]})]})]})});var ch=n(9588);let cw="-esm-primary-navigation__datepicker-module__inputGroup___+4zks",cy="-esm-primary-navigation__datepicker-module__inputSegment___wiExn",c_="-esm-primary-navigation__datepicker-module__dateInputWrapper___uiyAC",cv="-esm-primary-navigation__datepicker-module__invalidText___SxtTL",cb="-esm-primary-navigation__datepicker-module__flatButton___UU1Qp",cx="-esm-primary-navigation__datepicker-module__flatButtonMd___fhR-1",cS="-esm-primary-navigation__datepicker-module__flatButtonSm___5INZ7",cj="-esm-primary-navigation__datepicker-module__flatButtonLg___RFMrl";function ck({children:e}){let t=(0,oH.useContext)(lk.Pg),n=(0,oH.useContext)(lk.a8),r=t??n,o=i7(()=>r?.close());return(0,aA.jsx)(ch.lG,{className:"-esm-primary-navigation__datepicker-module__dialog___qllIf",ref:o,children:e})}let cN=(0,oH.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},o){let i="range"===e,a=i?cu._e:cu.Vv;return(0,aA.jsx)(cd.A,{ref:o,className:"-esm-primary-navigation__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,aA.jsx)(ck,{children:(0,aA.jsxs)(a,{...i?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,aA.jsxs)("header",{className:"-esm-primary-navigation__datepicker-module__header___WAVlD",children:[(0,aA.jsx)(lC.$,{className:aR()(cb,cx),slot:"previous",children:(0,aA.jsx)(sa,{size:16})}),(0,aA.jsx)(cg,{className:"-esm-primary-navigation__datepicker-module__monthYear___A3aKF"}),(0,aA.jsx)(lC.$,{className:aR()(cb,cx),slot:"next",children:(0,aA.jsx)(ss,{size:16})})]}),(0,aA.jsx)(cu.r8,{className:"-esm-primary-navigation__datepicker-module__calendarGrid___6qRB2",children:e=>(0,aA.jsx)(cu.Zr,{className:aR()("cds--date-picker__day",{"-esm-primary-navigation__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cE=n(8017),cC=n(9774),cI=n(7956);let cP=(0,oH.forwardRef)(function(e,t){let n=(0,oH.useContext)(lk.Pg),[r,o]=(0,lj.JT)({slot:e.slot},t,cC.cQ),{locale:i}=(0,lP.Y)(),a=(0,cI.F)({...r,locale:i,createCalendar:lL.d}),s=(0,oH.useRef)(null),{fieldProps:l,inputProps:c}=(0,cE.cJ)({...r,inputRef:s},a,o),u=(0,oH.useCallback)(()=>{a.isDisabled||n.toggle()},[]);return(0,aA.jsxs)(lj.Kq,{values:[[cC.$,a],[cp.E,{...c,ref:s}],[lE.t,{...l,ref:o,isInvalid:a.isInvalid}]],children:[(0,aA.jsx)(lE.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,oH.cloneElement)(e.children(t),{key:n}))}),(0,aA.jsx)(cp.p,{})]})}),cA=(0,oH.forwardRef)(function(e,t){let n=(0,oH.useContext)(lk.Pg),r=(0,oH.useContext)(lk.a8);return(n??r).isInvalid?(0,aA.jsx)(lf,{ref:t,size:16,...e}):(0,aA.jsx)(a8,{ref:t,size:16,...e})});var cO=n(64),cR=n(5503),cT=n(1697),c$=n(7866),cM=n(8035),cL=n(2231);let cD=(0,oH.forwardRef)(function({segment:e,...t},n){let r=(0,oH.useContext)(cC.$),o=(0,cO.U)(n),{segmentProps:i}=(0,cR.V)(e,r,o),{focusProps:a,isFocused:s,isFocusVisible:l}=(0,cT.o)(),{hoverProps:c,isHovered:u}=(0,c$.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,oH.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,oH.useCallback)(e=>{e.stopPropagation()},[]);return(0,aA.jsx)("span",{...(0,cM.v)((0,cL.$)(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})}),cW={short:!1,size:"md"},cB=(0,oH.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:g,size:h,value:w,...y}={...cW,...e},{calendar:_,intlLocale:v,today_:b}=cl(),x=(0,oH.useId)(),S=!!(c??l),j=(0,oH.useMemo)(()=>l$(r,_),[r,_]),k=(0,oH.useMemo)(()=>l$(w,_,!0),[w,_]),N=(0,oH.useMemo)(()=>l$(d,_),[d,_]),E=(0,oH.useMemo)(()=>l$(m??cc,_),[m,_]),C=(0,oH.useMemo)(()=>i||s,[i,s]),I=(0,oH.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?.(lM(e)))),[f,p]);return(0,aA.jsx)(lA,{locale:v.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",n),children:(0,aA.jsx)(lj.Kq,{values:[[cs,v]],children:(0,aA.jsxs)(lk.lr,{className:aR()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":g,"cds--date-picker--light":u}),defaultValue:j,isDisabled:o,isInvalid:C,maxValue:N,minValue:E,value:k,shouldForceLeadingZeros:"en"===v.language||void 0,...y,onChange:I,children:[(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,aA.jsx)(lN.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:x,children:c??l}),(0,aA.jsxs)(lE.Y,{className:cw,children:[(0,aA.jsx)(cP,{id:S?x:void 0,ref:t,className:aR()("cds--date-picker-input__wrapper","-esm-primary-navigation__datepicker-module__inputWrapper___kykar",{"-esm-primary-navigation__datepicker-module__inputWrapperSm___KJtg-":"sm"===h,"-esm-primary-navigation__datepicker-module__inputWrapperMd___ablE9":"md"===h||!h||0===h.length,"-esm-primary-navigation__datepicker-module__inputWrapperLg___5dkQp":"lg"===h}),children:e=>"era"!==e.type?(0,aA.jsx)(cD,{className:cy,segment:e}):(0,aA.jsx)(oV().Fragment,{})}),(0,aA.jsx)(lC.$,{className:aR()(cb,{[cS]:"sm"===h,[cx]:"md"===h||!h||0===h.length,[cj]:"lg"===h}),children:(0,aA.jsx)(cA,{})})]}),(0,aA.jsx)(lI.b,{className:cv,children:a})]}),(0,aA.jsx)(cN,{variant:"single",today_:b})]})})})})}),cU=(0,oH.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,...g},h){let{calendar:w,intlLocale:y,today_:_}=cl(),v=(0,oH.useId)(),b=!!(s??a),x=(0,oH.useMemo)(()=>{if(f)return{start:l$(f[0],w,!1),end:l$(f[1],w,!1)}},[f,w]),S=(0,oH.useMemo)(()=>{if(t)return{start:l$(t[0],w,!1),end:l$(t[1],w,!1)}},[t,w]),j=(0,oH.useMemo)(()=>l$(u??cc,w,!0),[u,w]),k=(0,oH.useMemo)(()=>l$(c,w,!0),[c,w]),N=(0,oH.useMemo)(()=>n||i,[n,i]),E=(0,oH.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?.([lM(e.start),lM(e.end)]))),[m,d]);return(0,aA.jsx)(lA,{locale:y.toString(),children:(0,aA.jsx)("div",{className:aR()("cds--form-item",e),children:(0,aA.jsx)(lj.Kq,{values:[[cs,y]],children:(0,aA.jsx)(lk.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"===y.language||void 0,maxValue:k,minValue:j,value:x,defaultValue:S,ref:h,isDisabled:o,...g,onChange:E,children:(0,aA.jsxs)("div",{className:"cds--date-picker-container",children:[b&&(0,aA.jsx)(lN.J,{className:aR()("cds--label",{"cds--label--disabled":o}),htmlFor:v,children:s??a}),(0,aA.jsxs)(lE.Y,{className:cw,children:[(0,aA.jsxs)("div",{className:aR()("-esm-primary-navigation__datepicker-module__inputsWrapper___YlkGh",{"-esm-primary-navigation__datepicker-module__inputsWrapperSm___fAKhS":"sm"===p,"-esm-primary-navigation__datepicker-module__inputsWrapperMd___XVgGP":"md"===p||!p||0===p.length,"-esm-primary-navigation__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===p}),children:[(0,aA.jsx)(cC.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-primary-navigation__datepicker-module__startInput___qgbQm",c_),slot:"start",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})}),(0,aA.jsx)("div",{className:"-esm-primary-navigation__datepicker-module__separator___79vXZ",children:(0,aA.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,aA.jsx)(cC.J3,{className:aR()("cds--date-picker-input__wrapper","-esm-primary-navigation__datepicker-module__endInput___huv7x",c_),slot:"end",children:e=>(0,aA.jsx)(cD,{className:cy,segment:e})})]}),(0,aA.jsx)(lC.$,{className:aR()(cb,{[cS]:"sm"===p,[cx]:"md"===p||!p||0===p.length,[cj]:"lg"===p}),children:(0,aA.jsx)(cA,{})})]}),(0,aA.jsx)(lI.b,{className:cv,children:r}),(0,aA.jsx)(cN,{variant:"range",today_:_,minDate:j,maxDate:k})]})})})})})}),cF=({diagnoses:e})=>{let{diagnosisTags:t}=iA({externalModuleName:"@openmrs/esm-styleguide"});return(0,aA.jsx)("div",{className:"-esm-primary-navigation__diagnosis-tags-module__container___8kut8",children:e.map(e=>{let{rank:n,uuid:r,display:o}=e,i=t[1===n?"primaryColor":"secondaryColor"];return(0,aA.jsx)(aD.Tag,{type:i,children:o},r)})})},cH={action:"-esm-primary-navigation__empty-card-module__action___Y0dul",content:"-esm-primary-navigation__empty-card-module__content___fo0nB",desktopHeading:"-esm-primary-navigation__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-primary-navigation__empty-card-module__tabletHeading___BogTF",tile:"-esm-primary-navigation__empty-card-module__tile___QB8Ld"},cV=({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"})}),cG=e=>{let t="tablet"===i2(),n=e.launchForm;return(0,aA.jsx)(aD.Layer,{className:cH.layer,children:(0,aA.jsxs)(aD.Tile,{className:cH.tile,children:[(0,aA.jsx)("div",{className:t?cH.tabletHeading:cH.desktopHeading,children:(0,aA.jsx)("h4",{children:e.headerTitle})}),(0,aA.jsx)(cV,{}),(0,aA.jsx)("p",{className:cH.content,children:tp("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,aA.jsx)("p",{className:cH.action,children:n&&(0,aA.jsx)(aD.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tp("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},cz=({error:e,headerTitle:t})=>{let n="tablet"===i2();return(0,aA.jsx)(aD.Layer,{children:(0,aA.jsxs)(aD.Tile,{className:"-esm-primary-navigation__error-state-module__tile___dd418",children:[(0,aA.jsx)("div",{className:n?"-esm-primary-navigation__error-state-module__tabletHeading___g5rjg":"-esm-primary-navigation__error-state-module__desktopHeading___Nd9u2",children:(0,aA.jsx)("h4",{children:t})}),(0,aA.jsxs)("p",{className:"-esm-primary-navigation__error-state-module__errorMessage___z2RiN",children:[tp("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,aA.jsx)("p",{className:"-esm-primary-navigation__error-state-module__errorCopy___dq+e2",children:tp("errorCopy")})]})})},cq=cz,cJ=oV().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:o,state:i}=i8(),a=window.location??{pathname:""},s=o6(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,aA.jsxs)(aD.SideNav,{"aria-label":tp("leftNavigation","Left navigation"),className:"-esm-primary-navigation__left-nav-module__leftNav___jzTJK",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,aA.jsx)(o4,{name:"global-nav-menu-slot"}),n?(0,aA.jsx)(ib,{value:o,fallback:(0,aA.jsx)(o4,{name:n,state:{basePath:r,currentPath:a,...i}}),children:(0,aA.jsx)(oG.Provider,{value:o,children:(0,aA.jsx)(o4,{name:n,state:{basePath:r,currentPath:a,...i}})})}):null]}):null}),cK=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:r=50,onChange:o})=>{let[i,a]=(0,oH.useState)(""),s=(0,oH.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:r,isLoading:o}=(0,iT.A)(t,tP,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,oH.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=`${tE}/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,oH.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),g=(0,oH.useMemo)(()=>l&&!i&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,i]),h=(0,oH.useCallback)(e=>{o(),a(e.trim())},[o]),w=i9((0,oH.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),y=d?Math.max(0,Math.floor(g.length-r/2)):-1;return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)(aD.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:tp("searchForLocation"),id:s,placeholder:tp("searchForLocation"),onChange:e=>h(e.target.value),size:"lg"}),p&&(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__errorNotification___vWBFD",id:`${s}-error`,children:(0,aA.jsx)(aD.InlineNotification,{kind:"error",subtitle:tp("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:tp("error","Error")})}),(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__searchResults___Gbet+",children:u?(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,aA.jsx)(aD.RadioButtonSkeleton,{className:"-esm-primary-navigation__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__locationResultsContainer___6Pasf",children:g.length>0?(0,aA.jsx)(aD.RadioButtonGroup,{name:"loginLocations",onChange:e=>{o(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,t)=>(0,aA.jsx)(aD.RadioButton,{className:"-esm-primary-navigation__location-picker-module__locationRadioButton___rTDPj",id:e.resource.id,labelText:(0,aA.jsx)("span",{ref:t===y?w:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__emptyState___w4-Ca",children:(0,aA.jsx)("p",{className:"-esm-primary-navigation__location-picker-module__locationNotFound___Of2MJ",children:tp("noResultsToDisplay")})})}),m&&(0,aA.jsx)("div",{className:"-esm-primary-navigation__location-picker-module__loadingIcon___NAwSB",children:(0,aA.jsx)(aD.InlineLoading,{description:tp("loading")})})]})})]})},cX=R("modalState",{modalContainer:null,modalStack:[]}),cY=0;async function cZ(e,t,n={}){let r=oE(t),o=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:i}=r,a=await i(),s=cY++;o=await oW({...a,name:`${t}-${s}`},{...n,domElement:e})}else _(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return o}function cQ(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c0(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c1(e){return e.find(e=>!cQ(e))}function c2(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let c5=window.getComputedStyle(document.body).overflow;function c6({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",c3),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c1(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",cZ(n,e.modalName,e.props).then(r=>{cQ(e)?c0(e.modalName,r):r?(e.parcel=r,t.prepend(n),c2(e,c1(cX.getState().modalStack)===e),r.mountPromise.then(()=>{cQ(e)||(e.state="MOUNTED")},t=>{_(t),e.parcel=null,c8(e)})):c8(e)},t=>{_(t),c8(e)});break}case"MOUNTING":case"MOUNTED":c2(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c0(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=cX.getState();cX.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=c5,removeEventListener("keydown",c3)}function c8(e){if(cQ(e))return;e.state="TO_BE_DELETED";let t=cX.getState();cX.setState({...t,modalStack:[...t.modalStack]})}function c3(e){"Escape"===e.key&&function(){let[e]=cX.getState().modalStack;e&&c8(e)}()}function c4(e){cX.subscribe(c6),cX.setState({...cX.getState(),modalContainer:e})}function c7(e,t={},n=()=>{}){let r=()=>{let e=cX.getState().modalStack.find(e=>e.onClose===n);e&&c8(e)};if(oE(e)){var o;let i,a;o={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},a=[o,...(i=cX.getState()).modalStack],cX.setState({...i,modalStack:a})}else _(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var c9=n(9685);let ue=({notification:e})=>{let{description:t,action:n,kind:r,critical:o,title:i,onAction:a}=e;return(0,aA.jsx)(aD.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:o,subtitle:t,title:i||"",inline:!0,onActionButtonClick:a})},ut=({subject:e})=>{let[t,n]=(0,oH.useState)([]);return(0,oH.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)(ue,{notification:e},e.id))})},un=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:r,kind:o,title:i,critical:a,progressActionLabel:s,id:l,...c}=e,[u,d]=(0,oH.useState)(t);return(0,aA.jsx)(aD.ActionableNotification,{kind:o||"info",actionButtonLabel:u,ariaLabel:tp("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:tp("actionableNotification","Actionable notification"),subtitle:r,title:i,lowContrast:a,inline:!0,...c})},ur=({subject:e})=>{let[t,n]=(0,oH.useState)([]);return(0,oH.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)(un,{notification:e},e.id))})};class uo{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 ui=new uo,ua=0,us=new uo,ul=0;function uc(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(ut,{subject:ui}))}function uu(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,c9.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{ui.next({...e,id:ua++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function ud(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(ur,{subject:us}))}function um(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,c9.A)(t))?setTimeout(()=>{us.next({...e,id:ul++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let up=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],uf=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],ug={container:"-esm-primary-navigation__numeric-observation-module__container___NfxbH",card:"-esm-primary-navigation__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-primary-navigation__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-primary-navigation__numeric-observation-module__critical-value___JAIHt",cell:"-esm-primary-navigation__numeric-observation-module__cell___lTunW","critically-high":"-esm-primary-navigation__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-primary-navigation__numeric-observation-module__critically-low___5srAK",high:"-esm-primary-navigation__numeric-observation-module__high___7KiyK",low:"-esm-primary-navigation__numeric-observation-module__low___Zs2ct","label-container":"-esm-primary-navigation__numeric-observation-module__label-container___lGnGH","value-container":"-esm-primary-navigation__numeric-observation-module__value-container___hHPXt",label:"-esm-primary-navigation__numeric-observation-module__label___WFuxk",value:"-esm-primary-navigation__numeric-observation-module__value___6fHUr",units:"-esm-primary-navigation__numeric-observation-module__units___EdVuw","pad-right":"-esm-primary-navigation__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-primary-navigation__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-primary-navigation__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-primary-navigation__numeric-observation-module__arrow___SLGUh"},uh=({value:e,unit:t,label:n,interpretation:r,referenceRange:o,conceptUuid:i,variant:a="card",patientUuid:s})=>{let l=(0,oH.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${tN}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${tN}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:o,isLoading:i}=(0,iT.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,oH.useMemo)(()=>{if(r)return r?"--"===r?"normal":up.includes(r)?r.toLowerCase():uf.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,g=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,h=`omrs-numeric-obs-value-${l}`,w=`omrs-numeric-obs-unit-${l}`,y=null!=e&&""!==e,_=y?e:tp("notAvailable","Not available"),v=aR()({[ug["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[ug["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[ug.low]:"low"===m,[ug.high]:"high"===m,[ug["off-scale-low"]]:"off_scale_low"===m,[ug["off-scale-high"]]:"off_scale_high"===m}),b=aR()({[ug.container]:!0,[ug.card]:!0,[ug["critical-value"]]:p,[ug["abnormal-value"]]:f&&!p}),x=aR()({[ug.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:ug["label-container"],children:[(0,aA.jsx)("span",{id:g,className:ug.label,children:n}),f&&(0,aA.jsx)("span",{className:ug[m.replace("_","-")],title:tp("abnormalValue","Abnormal value")})]}),(0,aA.jsxs)("div",{className:ug["value-container"],children:[(0,aA.jsx)("span",{id:h,"aria-labelledby":g&&w?`${g} ${w}`:g||w||void 0,className:ug.value,children:_}),y&&t&&(0,aA.jsx)("span",{id:w,className:ug.units,children:t})]})]})},uw="-esm-primary-navigation__page-header-module__pageHeader___YOpQL",uy=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,aA.jsx)("div",{className:aR()(uw,n),...r,children:t})}{let{title:t,illustration:n,className:r,...o}=e;return(0,aA.jsx)("div",{className:aR()(uw,r),...o,children:(0,aA.jsx)(u_,{title:t,illustration:n})})}},u_=({title:e,illustration:t,className:n})=>{let[r,o]=(0,oH.useState)(null);return(0,oH.useEffect)(()=>{eM("@openmrs/esm-styleguide").then(e=>{o(e)})},[]),(0,aA.jsxs)("div",{className:aR()("-esm-primary-navigation__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,aA.jsxs)("div",{className:"-esm-primary-navigation__page-header-module__pageLabels___pPcKj",children:[r?.implementationName&&(0,aA.jsx)("p",{children:tp(r.implementationName)}),(0,aA.jsx)("h1",{className:"-esm-primary-navigation__page-header-module__pageName___3d4IC",children:e})]})]})},uv=({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=tp("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,aA.jsx)(aA.Fragment,{children:e>0&&(0,aA.jsxs)("div",{className:aR()({"-esm-primary-navigation__pagination-module__tablet___lQ3ak":c,"-esm-primary-navigation__pagination-module__desktop___HfUTY":!c}),children:[(0,aA.jsxs)("div",{children:[u,o&&(0,aA.jsx)(oz,{to:o,className:"-esm-primary-navigation__pagination-module__configurableLink___NM9v7",children:a??tp("seeAll","See all")})]}),(0,aA.jsx)(aD.Pagination,{className:"-esm-primary-navigation__pagination-module__pagination___WzkBs",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>tp("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function ub(e){return uS(uk(e,"usual","official"))}function ux(e){return ub(e)}function uS(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uj(e){return uS(e)}function uk(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 uN(e,t=ac()){let n=ac(t),r=ce(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 uE(e,t=ac()){let n=uN(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),l9(n,r)}let uC={container:"-esm-primary-navigation__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-primary-navigation__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-primary-navigation__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-primary-navigation__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-primary-navigation__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-primary-navigation__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-primary-navigation__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-primary-navigation__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-primary-navigation__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-primary-navigation__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-primary-navigation__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-primary-navigation__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-primary-navigation__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-primary-navigation__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-primary-navigation__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-primary-navigation__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-primary-navigation__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-primary-navigation__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-primary-navigation__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-primary-navigation__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-primary-navigation__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-primary-navigation__patient-banner-patient-info-module__actionsButtonText___mn139"};function uI({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsx)("span",{className:uC.primaryIdentifier,children:(0,aA.jsxs)(aD.Tag,{className:uC.tag,type:"gray",children:[e&&t?.text&&(0,aA.jsxs)("span",{className:uC.label,children:[t.text,": "]}),(0,aA.jsx)("span",{className:uC.value,children:n})]})})}function uP({showIdentifierLabel:e,type:t,value:n}){return(0,aA.jsxs)(aD.FormLabel,{className:uC.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,aA.jsxs)("span",{className:uC.label,children:[t?.text,": "]}),(0,aA.jsx)("span",{className:uC.value,children:n})]})}function uA({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)(oV().Fragment,{children:[(0,aA.jsx)("span",{className:uC.identifier,children:n?.coding?.[0]?.code===r?(0,aA.jsx)(uI,{showIdentifierLabel:t,type:n,value:e}):(0,aA.jsx)(uP,{showIdentifierLabel:t,type:n,value:e})}),i<o.length-1&&(0,aA.jsx)("span",{className:uC.separator,children:"\xb7"})]},e)):""})}let uO={Female:s_,Male:sv,Other:sb,Unknown:sx},uR=({gender:e})=>{let t=uO[e];return t?(0,aA.jsx)(t,{fill:"#525252"}):null},uT={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function u$({patient:e,renderedFrom:t}){var n;let r,o,i=ub(e),a=e?.gender&&(o=uT[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tp(r,n),iconKey:o}),s=(0,oH.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,aA.jsxs)("div",{className:uC.patientInfo,children:[(0,aA.jsx)("div",{className:aR()(uC.row,uC.patientNameRow),children:(0,aA.jsxs)("div",{className:uC.flexRow,children:[(0,aA.jsx)("span",{className:uC.patientName,children:i}),a&&(0,aA.jsxs)("div",{className:uC.gender,children:[(0,aA.jsx)(uR,{gender:a.iconKey}),(0,aA.jsx)("span",{children:a.displayText})]}),(0,aA.jsx)(o4,{className:uC.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,aA.jsxs)("div",{className:uC.demographics,children:[e.birthDate&&(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("span",{children:uE(e.birthDate)}),(0,aA.jsx)("span",{className:uC.separator,children:"\xb7"}),(0,aA.jsx)("span",{children:l5(e.birthDate,{time:!1})}),(0,aA.jsx)("span",{className:uC.separator,children:"\xb7"})]}),(0,aA.jsx)(uA,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,aA.jsx)(o4,{className:uC.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var uM=n(7683);function uL({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[o,i]=(0,oH.useState)(!1),{extensions:a}=o8(n),s="tablet"===i2(),l=i7(()=>i(!1),o),c=(0,oH.useRef)(null),u=(0,oH.useRef)(null),d=(0,oH.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,oH.useCallback)(()=>i(e=>!e),[]),g=(0,oH.useCallback)(()=>{i(!1),c.current?.focus()},[]),h=(0,oH.useCallback)(e=>{if("Escape"===e.key&&o){e.stopPropagation(),g();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()}},[g,o]);(0,oH.useEffect)(()=>{if(o&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[o]);let w=(0,oH.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:g,...r}),[t,e,g,r]);return 0===a.length?null:(0,aA.jsx)("div",{className:"-esm-primary-navigation__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,aA.jsxs)("div",{"data-overflow-menu":!0,className:aR()("cds--overflow-menu",aU),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:h,ref:c,children:[(0,aA.jsx)("span",{className:"-esm-primary-navigation__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tp("actions","Actions")})," ",(0,aA.jsx)(uM.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:h,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)(o4,{name:n,state:w},n)}),(0,aA.jsx)("span",{})]})]})})}var uD=n(397),uW=n.n(uD);function uB(e){let{patientPhotoConceptUuid:t}=iA({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tN}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:o,isLoading:i}=(0,it.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 uU=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,ie.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"})]})},uF="-esm-primary-navigation__patient-photo-module__avatar___t5TmZ";function uH({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:o}=uB(e),[i,a]=(0,oH.useState)(null),[s,l]=(0,oH.useState)(!1),c=(0,oH.useMemo)(()=>uW().generate(e),[e]);(0,oH.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,oH.useMemo)(()=>n||(i?tp("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):tp("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,i,t]);return o||s?(0,aA.jsx)(aD.SkeletonIcon,{className:"-esm-primary-navigation__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):r?.imageSrc&&!i?(0,aA.jsx)(uU,{"aria-label":tp("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("img",{className:uF,src:i,alt:u,title:t})}):(0,aA.jsx)("div",{"aria-label":u,children:(0,aA.jsx)("div",{className:uF,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,aA.jsx)("span",{className:"-esm-primary-navigation__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 uV=["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-transfer","omrs-pict-triage","omrs-pict-x-ray"],uG=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),uz=uG,uq=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),uJ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),uK=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),uX=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),uY=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),uZ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),uQ=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u0=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u1=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),u2=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),u5=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),u6=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),u8=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),u3=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),u4=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),u7=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),u9=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),de=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),dt=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),dn=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),dr=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),di=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),da=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),ds=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dl=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dc=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),du=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),dd=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),dm=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),dp=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),df=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dg=(0,oH.memo)((0,oH.forwardRef)(function(e,t){return(0,aA.jsx)(d_,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dh=u6,dw=di,dy=(0,oH.memo)((0,oH.forwardRef)(function({pictogram:e,fallback:t,...n},r){let o=(0,oH.useRef)(document.getElementById(e));return(0,oH.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)(ib,{value:o.current,fallback:t,children:(0,aA.jsx)(d_,{ref:r,pictogram:e,pictogramProps:n})})})),d_=(0,oH.memo)((0,oH.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-primary-navigation__pictograms-module__pictogram___wXX7t",r),height:o,width:o,children:(0,aA.jsx)("use",{href:`#${e}`})})})),dv=({children:e})=>"tablet"===i2()?(0,aA.jsx)(aD.Layer,{children:e}):(0,aA.jsx)(aA.Fragment,{children:e}),db=({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,oH.useState)(n),[g,h]=(0,oH.useState)(!0),[w,y]=(0,oH.useState)(!1),_=(0,oH.useCallback)(()=>{setTimeout(t,250)},[t]),v=(0,oH.useCallback)(()=>{y(!0),_()},[_]);return(0,oH.useEffect)(()=>{if(c){let e=setTimeout(v,l);return()=>clearTimeout(e)}},[l,c,v]),(0,oH.useEffect)(()=>{h(!1),window.setTimeout(()=>{h(!0)},0)},[]),(0,aA.jsx)(aD.ActionableNotification,{actionButtonLabel:p,"aria-label":tp("closeSnackbar","Close snackbar"),className:aR()("-esm-primary-navigation__snackbar-module__slideIn___-oZIt",{"-esm-primary-navigation__snackbar-module__animated___M2YBU":g,"-esm-primary-navigation__snackbar-module__slideOut___yEmGT":w}),kind:r,lowContrast:i,onActionButtonClick:()=>{o(),v(),a&&f(a)},onClose:_,statusIconDescription:tp("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...m})},dx=({subject:e})=>{let[t,n]=(0,oH.useState)([]),r=(0,oH.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oH.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)(db,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},dS=new uo,dj=0;function dk(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(dx,{subject:dS}))}function dN(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dS.next({...e,id:dj++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dE=({toast:e,closeToast:t})=>{let{description:n,kind:r,critical:o,title:i,actionButtonLabel:a,onActionButtonClick:s=()=>{}}=e,l=(0,oH.useCallback)(()=>{s(),t()},[t,s]);return(0,aA.jsx)("div",{children:(0,aA.jsx)(aD.ActionableNotification,{actionButtonLabel:a,kind:r||"info",lowContrast:o,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},dC=({subject:e})=>{let[t,n]=(0,oH.useState)([]),r=(0,oH.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,oH.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)(dE,{toast:e,closeToast:()=>r(e)},e.id))})},dI=new uo,dP=0;function dA(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(dC,{subject:dI}))}function dO(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,c9.A)(t))?setTimeout(()=>{dI.next({...e,id:dP++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dR=n(3173),dT=n(185),d$=n(4656);async function dM(e,t){let{openedGroup:n}=oC.getState();if(n){if(n.groupName===e&&dW(n.props,t))return!0;else if(!await dB({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return oC.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dL(e){let{openedGroup:t,openedWindows:n}=oC.getState();if(t){if(n.length>0&&!(e||await dB({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;oC.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dD(e,t=null,n=null,r=null){let o=oC.getState();if(!o.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=oI(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=oA(e);if(a&&(a.groupName!==l.name||!dW(a.props,r)))return!!await dB({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[dG(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(dW(r.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dW(d.props,t)?((a||c!==o.openedWindows.length-1)&&oC.setState(dU.restoreWindow(o,s)),!0):!!await dB({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:o?.openedGroup?.props??i},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[dG(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dB({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:i??o?.openedGroup?.props},openedWindows:[...o.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[dG(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(oC.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[...o.openedWindows,{windowName:s,openedWorkspaces:[dG(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dB({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(oC.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[dG(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dW(e,t){return null==e||null==t||x(e,t)}function dB(e){function t(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}let{openedWindows:n,workspaceTitleByWorkspaceName:r}=oC.getState(),o=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":o=n.flatMap(e=>t(e));break;case"CLOSE_WINDOW":{let r=n.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=t(r);break}case"CLOSE_WORKSPACE":{let r=n.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=t(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":o=n.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>t(e))}return 0===o.length?Promise.resolve(!0):new Promise(e=>{let t=c7("workspace2-close-prompt",{size:"sm",onConfirm:()=>{t(),e(!0)},onCancel:()=>{t(),e(!1)},affectedWorkspaceTitles:o.map(e=>r[e.workspaceName])})})}let dU={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=oA(t);if(n<0)return e;let r={...e.openedWindows[n]},o=r.openedWorkspaces.findIndex(e=>e.workspaceName===t),i=[...e.openedWindows];r.openedWorkspaces=r.openedWorkspaces.slice(0,o);let a=e.isMostRecentlyOpenedWindowHidden;if(0===r.openedWorkspaces.length){let t=n===e.openedWindows.length-1;i.splice(n,1),t&&i.length>0&&(a=!1)}else i[n]=r;return{...e,openedWindows:i,isMostRecentlyOpenedWindowHidden:a}},openChildWorkspace(e,t,n,r){let o=e.registeredWorkspacesByName[n];if(!o)throw Error(`No workspace named "${n}" registered`);let i=e.registeredWorkspacesByName[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);let a=e.openedWindows.findIndex(e=>e.windowName===o.window);if(-1==a)throw Error(`Cannot open child workspace ${n} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e.openedWindows[a],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{openedWindows:e.openedWindows.map((e,t)=>t==a?{...e,openedWorkspaces:[...c,dG(n,r)]}:e)}},setHasUnsavedChanges(e,t,n){let r=oA(t);if(r<0)return e;let o={...e.openedWindows[r]},i=o.openedWorkspaces.findIndex(e=>e.workspaceName===t);if(i<0)return e;o.openedWorkspaces[i]={...o.openedWorkspaces[i],hasUnsavedChanges:n};let a=[...e.openedWindows];return a[r]=o,{...e,openedWindows:a}},setWorkspaceTitle(e,t,n){let r={...e.workspaceTitleByWorkspaceName};return null===n?delete r[t]:r[t]=n,{...e,workspaceTitleByWorkspaceName:r}}};function dF(){return oZ(oC,dU)}let dH=()=>(0,oH.useContext)(o9.i),dV=()=>Object.keys(oC.getState().registeredWorkspacesByName);function dG(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,d$.A)()}}let dz={workspaceOuterContainer:"-esm-primary-navigation__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-primary-navigation__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-primary-navigation__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-primary-navigation__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-primary-navigation__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-primary-navigation__workspace2-module__maximized___Kfygr",hidden:"-esm-primary-navigation__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-primary-navigation__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-primary-navigation__workspace2-module__workspaceSpacer___E+982",loader:"-esm-primary-navigation__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-primary-navigation__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-primary-navigation__workspace2-module__header___IZ-2+",headerButtons:"-esm-primary-navigation__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-primary-navigation__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-primary-navigation__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-primary-navigation__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-primary-navigation__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-primary-navigation__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-primary-navigation__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-primary-navigation__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-primary-navigation__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},dq=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let r=i2(),{setWindowMaximized:o,hideWindow:i,setHasUnsavedChanges:a,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:d,workspaceTitleByWorkspaceName:m,setWorkspaceTitle:p,isMostRecentlyOpenedWindowHidden:f}=dF(),{workspaceName:g,isRootWorkspace:h,closeWorkspace:w,showActionMenu:y}=dH(),_=oA(g),v=s[_],b=v?.openedWorkspaces.find(e=>e.workspaceName===g);if((0,oH.useEffect)(()=>{b?.hasUnsavedChanges!=n&&a(g,n??!1)},[b?.hasUnsavedChanges,n,g,a]),(0,oH.useEffect)(()=>{m[g]!==e&&p(g,e)},[m,g,e,p]),_<0||null==l||null==b)return null;let x=c[l.groupName];if(!x)throw Error(`Cannot find registered workspace group ${l.groupName}`);let S=d[g].window,j=u[S];if(!j)throw Error(`Cannot find registered workspace window ${S}`);let{icon:k,canMaximize:N}=j,E="closable"===x.persistence,C=!!k&&!E,{maximized:I}=v,P=j?.width??"narrow",A=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),O=_<s.length-1||f;return(0,aA.jsxs)("div",{className:aR()(dz.workspaceOuterContainer,{[dz.narrowWorkspace]:"narrow"===P,[dz.widerWorkspace]:"wider"===P,[dz.extraWideWorkspace]:"extra-wide"===P,[dz.isActionMenuOpened]:A}),children:[(0,aA.jsx)("div",{className:aR()(dz.workspaceSpacer,{[dz.hidden]:O})}),(0,aA.jsx)("div",{className:aR()(dz.workspaceMiddleContainer,{[dz.maximized]:I,[dz.hidden]:O,[dz.isRootWorkspace]:h,[dz.showActionMenu]:y}),children:(0,aA.jsxs)("div",{className:aR()(dz.workspaceInnerContainer,{[dz.maximized]:I,[dz.hidden]:O,[dz.isRootWorkspace]:h}),children:[(0,aA.jsxs)(aD.Header,{"aria-label":tp("workspaceHeader"),className:dz.header,children:[(0,aA.jsx)(aD.HeaderName,{prefix:"",children:e}),(0,aA.jsx)("div",{className:dz.overlayHeaderSpacer}),(0,aA.jsx)(aD.HeaderGlobalBar,{className:dz.headerButtons,children:i5(r)?(0,aA.jsxs)(aA.Fragment,{children:[(N||I)&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":I?tp("minimize"):tp("maximize"),onClick:()=>o(S,!I),children:I?(0,aA.jsx)(dR.Xj,{}):(0,aA.jsx)(dR.hz,{})}),C&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("hide"),onClick:()=>i(),children:(0,aA.jsx)(a1,{})}),!E&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("close"),onClick:()=>w({closeWindow:!0}),children:(0,aA.jsx)(sc,{})})]}):(0,aA.jsxs)(aA.Fragment,{children:[C&&(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("hide"),onClick:()=>i(),children:(0,aA.jsx)(dT.d3,{})}),(0,aA.jsx)(aD.HeaderGlobalAction,{"aria-label":tp("close"),onClick:()=>{E?dL():w({closeWindow:!0})},children:(0,aA.jsx)(sc,{})})]})})]}),(0,aA.jsx)("div",{className:aR()(dz.workspaceContent),children:t})]})})]})},dJ="-esm-primary-navigation__action-menu-button2-module__container___jc6--",dK="-esm-primary-navigation__action-menu-button2-module__elementContainer___whLL8",dX="-esm-primary-navigation__action-menu-button2-module__active___fbyFm",dY="-esm-primary-navigation__action-menu-button2-module__focused___+aVpz";function dZ({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,aA.jsxs)(aA.Fragment,{children:[e({size:16}),t?(0,aA.jsx)("span",{className:"-esm-primary-navigation__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,aA.jsx)("span",{className:"-esm-primary-navigation__action-menu-button2-module__countTag___XMH0D",children:n})]})}let dQ=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:o})=>{let i=i2(),{openedWindows:a,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=dF(),{extension:u}=(0,oH.useContext)(oG),d=a.findIndex(e=>e.windowName===u?.extensionId),m=a[d],p=null!=m,f=p&&(d<a.length-1||c),g=p&&!f,h=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;dD(e,t,n)}};return"tablet"===i||"phone"===i?(0,aA.jsxs)(aD.Button,{className:aR()(dJ,{[dX]:p&&!g,[dY]:g}),iconDescription:t,kind:"ghost",onClick:w,role:"button",tabIndex:0,size:"md",children:[(0,aA.jsx)("span",{className:dK,children:(0,aA.jsx)(dZ,{hasUnsavedChanges:h,getIcon:e,tagContent:n})}),(0,aA.jsx)("span",{children:t})]}):(0,aA.jsx)(aD.IconButton,{align:"left","aria-label":t,className:aR()(dJ,{[dX]:p&&!g,[dY]:g}),enterDelayMs:300,kind:"ghost",label:t,onClick:w,size:"md",children:(0,aA.jsx)("div",{className:dK,children:(0,aA.jsx)(dZ,{hasUnsavedChanges:h,getIcon:e,tagContent:n})})})};function d0({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,aA.jsx)(aD.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?sl:si,children:e?tp("showLess","Show less"):tp("showMore","Show more")})}let d1={contactDetails:"-esm-primary-navigation__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-primary-navigation__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-primary-navigation__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-primary-navigation__patient-banner-contact-details-module__row___qFgIi",col:"-esm-primary-navigation__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-primary-navigation__patient-banner-contact-details-module__relationship___T3LO-"},d2=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${tN}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=(0,it.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,oH.useMemo)(()=>({cohorts:o,isLoading:r}),[r,o])}(e);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsxs)("p",{className:d1.heading,children:[tp("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,aA.jsx)(aD.InlineLoading,{description:`${tp("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>lY(e?.startDate).getTime()-lY(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,aA.jsx)("li",{children:(0,aA.jsx)(oz,{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:d1.link,children:(0,aA.jsx)(oz,{to:`${window.spaBase}/home/patient-lists`,children:tp("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},d5=({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)(aD.InlineLoading,{description:`${tp("loading","Loading")} ...`,role:"progressbar"}):(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:d1.heading,children:tp("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:[tp(o(t.url),o(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,aA.jsxs)("li",{children:[tp(e,e),": ",t]},`address-${e}`)):(0,aA.jsx)("li",{children:"--"})})]})},d6=({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,iT.A)(`${tN}/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,oH.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:o,error:r}})(e),r=(0,oH.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?tp(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,aA.jsxs)(aA.Fragment,{children:[(0,aA.jsx)("p",{className:d1.heading,children:tp("contactDetails","Contact Details")}),t?(0,aA.jsx)(aD.InlineLoading,{description:`${tp("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:"--"})})]})},d8=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${tN}/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,it.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:d1.heading,children:tp("relationships","Relationships")}),n?(0,aA.jsx)(aD.InlineLoading,{description:`${tp("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:d1.relationship,children:[(0,aA.jsx)("div",{children:(0,aA.jsx)(oz,{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?tp("yearAbbreviation","yr"):tp("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,aA.jsx)("li",{children:"--"})})]})};function d3({patientId:e,deceased:t}){return(0,aA.jsxs)("div",{className:aR()(d1.contactDetails,{[d1.deceased]:t}),children:[(0,aA.jsxs)("div",{className:d1.row,children:[(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d5,{patientId:e})}),(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d6,{patientUuid:e})})]}),(0,aA.jsxs)("div",{className:d1.row,children:[(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d8,{patientId:e})}),(0,aA.jsx)("div",{className:d1.col,children:(0,aA.jsx)(d2,{patientUuid:e})})]})]})}function d4(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 d7="-esm-primary-navigation__action-menu2-module__container___6Gke0";function d9({workspaceGroup:e,groupProps:t}){let n=i2(),{persistence:r}=e;return(0,aA.jsx)("aside",{className:"-esm-primary-navigation__action-menu2-module__sideRail___T2lMV",children:(0,aA.jsxs)("div",{className:d7,children:["closable"==r&&i5(n)&&(0,aA.jsx)(aD.IconButton,{align:"left",onClick:()=>dL(),label:tp("close"),kind:"ghost",children:(0,aA.jsx)(sc,{})}),(0,aA.jsx)(oG.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,aA.jsx)(o4,{className:d7,name:e.name,state:{groupProps:t}})})]})})}function me(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}}var mt=n(1820);let mn=({lifeCycle:e,openedWorkspace:t,openedWindow:n,isRootWorkspace:r,isLeafWorkspace:o,showActionMenu:i})=>{let{openedGroup:a,closeWorkspace:s,openChildWorkspace:l}=dF(),c=(0,oH.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:r=!1,discardUnsavedChanges:o=!1}=e;return r?!!(o||await dB({reason:"CLOSE_WINDOW",explicit:!0,windowName:n.windowName}))&&(s(n.openedWorkspaces[0].workspaceName),!0):!!(o||await dB({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:t.workspaceName}))&&(s(t.workspaceName),!0)},launchChildWorkspace:async(e,r)=>{let o=t.workspaceName,{openedWorkspaces:i}=n,a=i.findIndex(e=>e.workspaceName===o);-1===a||a!==i.length-1&&i.slice(a+1).some(e=>e.hasUnsavedChanges)&&!await dB({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:i[a+1].workspaceName})||l(o,e,r||{})},workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:a&&a.props?a.props:null,workspaceMeta:oC.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:r,isLeafWorkspace:o,windowName:n.windowName,showActionMenu:i},[t,s,a,n]);if(!e){let{registeredWorkspacesByName:e}=oC.getState(),n=e[t.workspaceName],o=n&&n.window?n.window:void 0,{registeredWindowsByName:s}=oC.getState(),l=o?s[o]:void 0,c=l&&l.width?l.width:"narrow",u=Object.values(s).some(e=>e.group===a?.groupName&&void 0!==e.icon);return(0,aA.jsxs)("div",{className:aR()(dz.workspaceOuterContainer,{[dz.narrowWorkspace]:"narrow"===c,[dz.widerWorkspace]:"wider"===c,[dz.extraWideWorkspace]:"extra-wide"===c,[dz.isActionMenuOpened]:u}),children:[(0,aA.jsx)("div",{className:dz.workspaceSpacer}),(0,aA.jsx)("div",{className:aR()(dz.workspaceMiddleContainer,{[dz.isRootWorkspace]:r,[dz.showActionMenu]:i}),children:(0,aA.jsx)("div",{className:aR()(dz.workspaceInnerContainer,{[dz.isRootWorkspace]:r}),children:(0,aA.jsx)(aD.InlineLoading,{className:dz.loader,description:`${tp("loading")} ...`})})})]})}return(0,aA.jsx)(mt.A,{config:e,mountParcel:oU,...c},t.workspaceName)},mr=({openedWindow:e,showActionMenu:t})=>{let{openedWorkspaces:n}=e,[r,o]=(0,oH.useState)({}),{registeredWorkspacesByName:i}=oC.getState();return(0,oH.useEffect)(()=>{let e=!1;return Promise.all(n.map(async e=>{let{moduleName:t,component:n}=i[e.workspaceName];return[e.uuid,await av(t,n)]})).then(t=>{e||o(Object.fromEntries(t))}),()=>{e=!0}},[n]),(0,aA.jsx)(aA.Fragment,{children:n.map((o,i)=>(0,aA.jsx)(mn,{openedWorkspace:o,openedWindow:e,lifeCycle:r[o.uuid],isRootWorkspace:0===i,isLeafWorkspace:i===n.length-1,showActionMenu:t},o.uuid))})};function mo(e){e&&(0,o7.createRoot)(e).render((0,aA.jsx)(mi,{}))}function mi(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=dF();if((0,oH.useEffect)(()=>nz("before-page-changed",t=>{let{newPage:r,cancelNavigation:o,oldUrl:i,newUrl:a}=t;if(!e)return;if(r)return void o(dL().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),o=me(t),i=me(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(dL().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-primary-navigation__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-primary-navigation__workspace-windows-and-menu-module__overlay___7RHYZ":o.overlay,"-esm-primary-navigation__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,aA.jsx)("div",{className:"-esm-primary-navigation__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(e=>(0,aA.jsx)(mr,{openedWindow:e,showActionMenu:s},e.windowName))}),s&&(0,aA.jsx)(d9,{workspaceGroup:o,groupProps:e.props})]})}function ma(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 ms(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function ml(e){return!!e&&e.constructor===Object}var mc=n(3376);function mu(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function md(e,t){return mc(function(e){let t=e.indexOf("-");if(t>=0){let n=mu(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return mu(e)}(t),e,{includePrerelease:!0})}async function mm(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 mp(o(a)),await e()}catch(e){i?.(e,a),n=e}while(r(a++));throw n}async function mp(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function mf(e,t,n,r){}function mg(e){}function mh(e){return Promise.resolve([])}function mw(e){return Promise.resolve([])}function my(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 m_(e){return()=>{}}function mv(){return!0}}}]);