@openmrs/esm-billing-app 1.3.2-pre.1916 → 1.3.2-pre.1920

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/2250.js CHANGED
@@ -40,4 +40,4 @@ To fix this, ensure that you define the "component" field inside the page defini
40
40
  * {
41
41
  overscroll-behavior: contain;
42
42
  }
43
- }`.trim(),document.head.prepend(i),a=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let n=((e=document)=>e.activeElement)(),t=null!=n&&AR(n);a.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||AG(this,t)},o=g4(AV(document,"touchstart",n=>{let i=mB(n);e=_G(i)?i:_U(i,!0),t=!1;let r=i.ownerDocument.defaultView.getSelection();r&&!r.isCollapsed&&r.containsNode(i,!0)&&(t=!0),n.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(t=!0),"selectionStart"in i&&"selectionEnd"in i&&i.selectionStart<i.selectionEnd&&i.ownerDocument.activeElement===i&&(t=!0)},{passive:!1,capture:!0}),AV(document,"touchmove",n=>{if(2!==n.touches.length&&!t){if(!e||e===document.documentElement||e===document.body)return void n.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&n.preventDefault()}},{passive:!1,capture:!0}),AV(document,"blur",e=>{let n=mB(e),t=e.relatedTarget;if(t&&AR(t))t.focus({preventScroll:!0}),AG(t,AR(n));else if(!t){let e=n.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{n(),o(),i.remove(),HTMLElement.prototype.focus=a}):g4((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?AW(document.documentElement,"scrollbarGutter","stable"):AW(document.documentElement,"paddingRight",`${s}px`)),AW(document.documentElement,"overflow","hidden"))),()=>{0==--AL&&u()}}},[n])}({isDisabled:a||!n.isOpen}),(0,pX.useEffect)(()=>{if(n.isOpen&&i.current)if(a){var e,t,o=r?.current??i.current;let n=Ah[Ah.length-1];return n&&!n.visibleNodes.has(o)?(n.visibleNodes.add(o),()=>{n.visibleNodes.delete(o)}):void 0}else{let n,a,o,s,l,c,u,p,d,f,h;return e=[r?.current??i.current],a=(t={shouldUseInert:!0})instanceof(n=mP(e?.[0])).Element?{root:t}:t,o=a?.root??document.body,s=a?.shouldUseInert&&Ad,l=new Set(e),c=new Set,u=(e,t)=>{s&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof n.HTMLElement&&(e.inert=!1))},p=e=>{for(let n of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(n);let n=e=>{if(c.has(e)||l.has(e)||e.parentElement&&c.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let n of l)if(mT(e,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},t=v6(mO(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),i=n(e);if(i===NodeFilter.FILTER_ACCEPT&&d(e),i!==NodeFilter.FILTER_REJECT){let e=t.nextNode();for(;null!=e;)d(e),e=t.nextNode()}},d=e=>{let t=Af.get(e)??0;(s&&e instanceof n.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===t||(0===t&&u(e,!0),c.add(e),Af.set(e,t+1))},Ah.length&&Ah[Ah.length-1].disconnect(),p(o),(f=new MutationObserver(e=>{for(let t of e)if("childList"===t.type&&t.target.isConnected&&![...l,...c].some(e=>mT(e,t.target)))for(let e of t.addedNodes){var n;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(n=e).dataset.liveAnnouncer||void 0!==n.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&p(e)}})).observe(o,{childList:!0,subtree:!0}),h={visibleNodes:l,hiddenNodes:c,observe(){f.observe(o,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}},Ah.push(h),()=>{for(let e of(f.disconnect(),c)){let n=Af.get(e);null!=n&&(1===n?(u(e,!1),Af.delete(e)):Af.set(e,n-1))}h===Ah[Ah.length-1]?(Ah.pop(),Ah.length&&Ah[Ah.length-1].observe()):Ah.splice(Ah.indexOf(h),1)}}},[a,n.isOpen,i,r]),{popoverProps:mp(p,f),arrowProps:h,underlayProps:d,placement:g,triggerAnchorPoint:m}}({...i,offset:null!=(r=i.offset)?r:8,arrowSize:s,groupRef:d?p:c},e),b=i.popoverRef,y=function(e,n=!0){let[t,i]=(0,pX.useState)(!0),r=t&&n;return g6(()=>{if(r&&e.current&&"getAnimations"in e.current)for(let n of e.current.getAnimations())n instanceof CSSTransition&&n.cancel()},[e,r]),AK(e,r,(0,pX.useCallback)(()=>i(!1),[])),r}(b,!!m)||i.isEntering||!1,v=mh({...i,defaultClassName:"react-aria-Popover",values:{trigger:i.trigger||null,placement:m,isEntering:y,isExiting:n}}),$=!i.isNonModal||"SubmenuTrigger"===i.trigger,[A,w]=(0,pX.useState)(!1);g6(()=>{b.current&&w($&&!b.current.querySelector("[role=dialog]"))},[b,$]),(0,pX.useEffect)(()=>{var e;let n,t;A&&b.current&&!b.current.contains(document.activeElement)&&(t=((e=document)=>e.activeElement)(n=mO(e=b.current)),"virtual"===AY?bb(()=>{((e=document)=>e.activeElement)(n)===t&&e.isConnected&&mM(e)}):mM(e))},[A,b]);let k={...f.style,...v.style},x=pQ().createElement("div",{...mp(mD(i),f),...v,role:A?"dialog":void 0,tabIndex:A?-1:void 0,"aria-label":i["aria-label"],"aria-labelledby":i["aria-labelledby"],ref:b,slot:i.slot||void 0,style:k,dir:i.dir,"data-trigger":i.trigger,"data-placement":m,"data-entering":y||void 0,"data-exiting":n||void 0},!i.isNonModal&&pQ().createElement(Aq,{onDismiss:e.close}),pQ().createElement(Ap.Provider,{value:{...g,placement:m,ref:o}},v.children),pQ().createElement(Aq,{onDismiss:e.close}));return d?pQ().createElement(An,{...i,shouldContainFocus:A,isExiting:n,portalContainer:null!=(a=null!=t?t:null==p?void 0:p.current)?a:void 0},x):pQ().createElement(An,{...i,shouldContainFocus:A,isExiting:n,portalContainer:t},!i.isNonModal&&e.isOpen&&pQ().createElement("div",{"data-testid":"underlay",...h,style:{position:"fixed",inset:0}}),pQ().createElement("div",{ref:c,style:{display:"contents"}},pQ().createElement(we.Provider,{value:c},x)))}function wi(e){return e?.start!=null&&null!=e.end}let wr=(0,pX.createContext)(null),wa=(0,pX.createContext)(null),wo=(0,pX.createContext)(null),ws=(0,pX.createContext)(null),wl=(0,pX.forwardRef)(function(e,n){var t,i;[e,n]=mm(e,n,wr);let{validationBehavior:r}=mg(Al)||{},a=null!=(i=null!=(t=e.validationBehavior)?t:r)?i:"native",o=function(e){let n=A7(e),[t,i]=vj(e.value,e.defaultValue||null,e.onChange),[r]=(0,pX.useState)(t),a=t||e.placeholderValue||null,[o,s]=$H(a,e.granularity),l=null!=t?t.toDate(s??"UTC"):null,c="hour"===o||"minute"===o||"second"===o,u=e.shouldCloseOnSelect??!0,[p,d]=(0,pX.useState)(null),[f,h]=(0,pX.useState)(null);if(t&&(p=t,"hour"in t&&(f=t)),a&&!(o in a))throw Error("Invalid granularity "+o+" for value "+a.toString());let g=t?.calendar.identifier==="gregory"&&"BC"===t.era,m=(0,pX.useMemo)(()=>({granularity:o,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:g}),[o,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,g]),{minValue:b,maxValue:y,isDateUnavailable:v}=e,$=(0,pX.useMemo)(()=>$F(t,b,y,v,m),[t,b,y,v,m]),A=$P({...e,value:t,builtinValidation:$}),w=A.displayValidation.isInvalid,k=e.validationState||(w?"invalid":null),x=(e,n)=>{i("timeZone"in n?n.set(_u(e)):_p(e,n)),d(null),h(null),A.commitValidation()};return{...A,value:t,defaultValue:e.defaultValue??r,setValue:i,dateValue:p,timeValue:f,setDateValue:t=>{let r="function"==typeof u?u():u;c?f||r?x(t,f||$G(e.defaultValue||e.placeholderValue)):d(t):(i(t),A.commitValidation()),r&&n.setOpen(!1)},setTimeValue:e=>{p&&e?x(p,e):h(e)},granularity:o,hasTime:c,...n,setOpen(i){!i&&!t&&p&&c&&x(p,f||$G(e.defaultValue||e.placeholderValue)),n.setOpen(i)},validationState:k,isInvalid:w,formatValue:(e,n)=>l?new y_(e,$V(n,m)).format(l):"",getDateFormatter:(e,n)=>new y_(e,$V({},{...m,...n}))}}({...e,validationBehavior:a}),s=(0,pX.useRef)(null),[l,c]=mb(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,fieldProps:d,buttonProps:f,dialogProps:h,calendarProps:g,descriptionProps:m,errorMessageProps:b,...y}=function(e,n,t){var i;let r=ml(),a=ml(),o=ml(),s=yT((i=$b)&&i.__esModule?i.default:i,"@react-aria/datepicker"),{isInvalid:l,validationErrors:c,validationDetails:u}=n.displayValidation,{labelProps:p,fieldProps:d,descriptionProps:f,errorMessageProps:h}=$v({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||c}),g=$y(n,t),m=d["aria-labelledby"]||d.id,{locale:b}=yd(),y=n.formatValue(b,{month:"long"}),v=_Z(y?s.format("selectedDateDescription",{date:y}):""),$=[v["aria-describedby"],d["aria-describedby"]].filter(Boolean).join(" ")||void 0,A=mD(e),w=(0,pX.useMemo)(()=>$d(t),[t]),k=(0,pX.useRef)(!1),{focusWithinProps:x}=bK({...e,isDisabled:n.isOpen,onBlurWithin:n=>{mT(document.getElementById(a),n.relatedTarget)||(k.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{k.current||(k.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}});return{groupProps:mp(A,g,d,v,x,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":m,"aria-describedby":$,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...p,onClick:()=>{w.focusFirst()}},fieldProps:{...d,id:o,[$k]:"presentation","aria-describedby":$,value:n.value,defaultValue:n.defaultValue,onChange:n.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[$O]:n,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:f,errorMessageProps:h,buttonProps:{...v,id:r,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${r} ${m}`,"aria-describedby":$,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:a,"aria-labelledby":`${r} ${m}`},calendarProps:{autoFocus:!0,value:n.dateValue,onChange:n.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:n.dateValue?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:c,validationDetails:u}}({...my(e),label:c,validationBehavior:a},o,s),[v,$]=(0,pX.useState)(null),A=(0,pX.useCallback)(()=>{s.current&&$(s.current.offsetWidth+"px")},[]);AT({ref:s,onResize:A});let{focusProps:w,isFocused:k,isFocusVisible:x}=bY({within:!0}),C=mh({...e,values:{state:o,isFocusWithin:k,isFocusVisible:x,isDisabled:e.isDisabled||!1,isInvalid:o.isInvalid,isOpen:o.isOpen},defaultClassName:"react-aria-DatePicker"}),E=mD(e);return delete E.id,pQ().createElement(mf,{values:[[wo,o],[v2,{...u,ref:s,isInvalid:o.isInvalid}],[$2,d],[b5,{...f,isPressed:o.isOpen}],[Ac,{...p,ref:l,elementType:"span"}],[vG,g],[Ai,o],[A9,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":v}}],[At,h],[b8,{slots:{description:m,errorMessage:b}}],[Aa,y]]},pQ().createElement("div",{...w,...E,...C,ref:n,slot:e.slot||void 0,"data-focus-within":k||void 0,"data-invalid":o.isInvalid||void 0,"data-focus-visible":x||void 0,"data-disabled":e.isDisabled||void 0,"data-open":o.isOpen||void 0}))}),wc=(0,pX.forwardRef)(function(e,n){var t,i;[e,n]=mm(e,n,wa);let{validationBehavior:r}=mg(Al)||{},a=null!=(i=null!=(t=e.validationBehavior)?t:r)?i:"native",o=function(e){let n=A7(e),[t,i]=vj(e.value,e.defaultValue||null,e.onChange),[r]=(0,pX.useState)(t),[a,o]=(0,pX.useState)(()=>t||{start:null,end:null});null==t&&a.start&&a.end&&o(a={start:null,end:null});let s=t||a,l=e=>{o(s=e||{start:null,end:null}),wi(s)?i(s):i(null)},[c,u]=$H(s?.start||s?.end||e.placeholderValue||null,e.granularity),p="hour"===c||"minute"===c||"second"===c,d=e.shouldCloseOnSelect??!0,[f,h]=(0,pX.useState)(null),[g,m]=(0,pX.useState)(null);s&&wi(s)&&(f=s,"hour"in s.start&&(g=s));let b=(e,n)=>{l({start:"timeZone"in n.start?n.start.set(_u(e.start)):_p(e.start,n.start),end:"timeZone"in n.end?n.end.set(_u(e.end)):_p(e.end,n.end)}),h(null),m(null),E.commitValidation()},y=t=>{let i="function"==typeof d?d():d;p?wi(t)&&(i||g?.start&&g?.end)?b(t,{start:g?.start||$G(e.placeholderValue),end:g?.end||$G(e.placeholderValue)}):h(t):wi(t)?(l(t),E.commitValidation()):h(t),i&&n.setOpen(!1)},v=e=>{wi(f)&&wi(e)?b(f,e):m(e)},$=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,A=(0,pX.useMemo)(()=>({granularity:c,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:$}),[c,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,$]),{minValue:w,maxValue:k,isDateUnavailable:x}=e,C=(0,pX.useMemo)(()=>{var e;let n;return e=s,n=$N($F(e?.start??null,w,k,x,A),$F(e?.end??null,w,k,x,A)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(n=$N(n,{isInvalid:!0,validationErrors:[(yS.getGlobalDictionaryForPackage("@react-stately/datepicker")||$j).getStringForLocale("rangeReversed",$R())],validationDetails:{...$S,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),n},[s,w,k,x,A]),E=$P({...e,value:t,name:(0,pX.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:C}),S=E.displayValidation.isInvalid,D=e.validationState||(S?"invalid":null);return{...E,value:s,defaultValue:e.defaultValue??r,setValue:l,dateRange:f,timeRange:g,granularity:c,hasTime:p,setDate(e,n){"start"===e?y({start:n,end:f?.end??null}):y({start:f?.start??null,end:n})},setTime(e,n){"start"===e?v({start:n,end:g?.end??null}):v({start:g?.start??null,end:n})},setDateTime(e,n){"start"===e?l({start:n,end:s?.end??null}):l({start:s?.start??null,end:n})},setDateRange:y,setTimeRange:v,...n,setOpen(t){!t&&!(s?.start&&s?.end)&&wi(f)&&p&&b(f,{start:g?.start||$G(e.placeholderValue),end:g?.end||$G(e.placeholderValue)}),n.setOpen(t)},validationState:D,isInvalid:S,formatValue(n,t){let i;if(!s||!s.start||!s.end)return null;let r="timeZone"in s.start?s.start.timeZone:void 0,a=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),o="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),c=$V(t,{granularity:a,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),u=s.start.toDate(r||"UTC"),p=s.end.toDate(o||"UTC"),d=new y_(n,c);if(r===o&&a===l&&0!==s.start.compare(s.end)){try{let e=d.formatRangeToParts(u,p),n=-1;for(let t=0;t<e.length;t++){let i=e[t];if("shared"===i.source&&"literal"===i.type)n=t;else if("endRange"===i.source)break}let t="",i="";for(let r=0;r<e.length;r++)r<n?t+=e[r].value:r>n&&(i+=e[r].value);return{start:t,end:i}}catch{}i=d}else i=new y_(n,$V(t,{granularity:l,timeZone:o,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(u),end:i.format(p)}},getDateFormatter:(e,n)=>new y_(e,$V({},{...A,...n}))}}({...e,validationBehavior:a}),s=(0,pX.useRef)(null),[l,c]=mb(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,startFieldProps:d,endFieldProps:f,buttonProps:h,dialogProps:g,calendarProps:m,descriptionProps:b,errorMessageProps:y,...v}=function(e,n,t){var i;let r=yT((i=$b)&&i.__esModule?i.default:i,"@react-aria/datepicker"),{isInvalid:a,validationErrors:o,validationDetails:s}=n.displayValidation,{labelProps:l,fieldProps:c,descriptionProps:u,errorMessageProps:p}=$v({...e,labelElementType:"span",isInvalid:a,errorMessage:e.errorMessage||o}),d=c["aria-labelledby"]||c.id,{locale:f}=yd(),h=n.formatValue(f,{month:"long"}),g=_Z(h?r.format("selectedRangeDescription",{startDate:h.start,endDate:h.end}):""),m={"aria-label":r.format("startDate"),"aria-labelledby":d},b={"aria-label":r.format("endDate"),"aria-labelledby":d},y=ml(),v=ml(),$=$y(n,t),A=[g["aria-describedby"],c["aria-describedby"]].filter(Boolean).join(" ")||void 0,w=(0,pX.useMemo)(()=>$d(t,{accept:e=>e.id!==y}),[t,y]),k={[$x]:w,[$k]:"presentation","aria-describedby":A,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},x=mD(e),C=(0,pX.useRef)(!1),{focusWithinProps:E}=bK({...e,isDisabled:n.isOpen,onBlurWithin:n=>{mT(document.getElementById(v),n.relatedTarget)||(C.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{C.current||(C.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}}),S=(0,pX.useRef)($M),D=(0,pX.useRef)($M);return{groupProps:mp(x,$,c,g,E,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":A,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...l,onClick:()=>{w.focusFirst()}},buttonProps:{...g,id:y,"aria-haspopup":"dialog","aria-label":r.format("calendar"),"aria-labelledby":`${y} ${d}`,"aria-describedby":A,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:v,"aria-labelledby":`${y} ${d}`},startFieldProps:{...m,...k,value:n.value?.start??null,defaultValue:n.defaultValue?.start,onChange:e=>n.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[$O]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){S.current=e,n.updateValidation($N(e,D.current))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},endFieldProps:{...b,...k,value:n.value?.end??null,defaultValue:n.defaultValue?.end,onChange:e=>n.setDateTime("end",e),name:e.endName,form:e.form,[$O]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){D.current=e,n.updateValidation($N(S.current,e))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},descriptionProps:u,errorMessageProps:p,calendarProps:{autoFocus:!0,value:n.dateRange?.start&&n.dateRange.end?n.dateRange:null,onChange:n.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:n.dateRange?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:a,validationErrors:o,validationDetails:s}}({...my(e),label:c,validationBehavior:a},o,s),[$,A]=(0,pX.useState)(null),w=(0,pX.useCallback)(()=>{s.current&&A(s.current.offsetWidth+"px")},[]);AT({ref:s,onResize:w});let{focusProps:k,isFocused:x,isFocusVisible:C}=bY({within:!0}),E=mh({...e,values:{state:o,isFocusWithin:x,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:o.isInvalid,isOpen:o.isOpen},defaultClassName:"react-aria-DateRangePicker"}),S=mD(e);return delete S.id,pQ().createElement(mf,{values:[[ws,o],[v2,{...u,ref:s,isInvalid:o.isInvalid}],[b5,{...h,isPressed:o.isOpen}],[Ac,{...p,ref:l,elementType:"span"}],[vU,m],[Ai,o],[A9,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":$}}],[At,g],[$2,{slots:{start:d,end:f}}],[b8,{slots:{description:b,errorMessage:y}}],[Aa,v]]},pQ().createElement("div",{...k,...S,...E,ref:n,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":o.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-open":o.isOpen||void 0}))});function wu(e){return pQ().createElement(yp,e)}function wp(e,n,t=!1){if(null==e)return t?e:void 0;if("string"==typeof e&&!e)return t?null:void 0;if(e instanceof y7||e instanceof _e||e instanceof _n)return n?_d(e,n):e;{let t=fC()(e).toDate(),i=new y7(t.getFullYear(),t.getMonth()+1,t.getDate());return n?_d(i,n):i}}function wd(e){if(e)return e.toDate(_k())}function wf(){let e=window.i18next.language;return"ht"===(e=e.replaceAll("_","-"))&&(e="fr-HT"),e}if("u">typeof navigator){let e=navigator;et=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;et=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var wh=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(et||"en-US"),wg=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},wm={};for(let e=1;e<100;e++)wm[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var wb={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},wy="[1234567890一二三四五六七八九〇\\d]",w_={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},wv={},w$={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},wA={zone:w$,year:wm,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},ww={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?(?:"+Object.keys(w$).join("|")+")\\)?",MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},wk={...ww,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},wx={},wC=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(n=wh){return wx[n.toLowerCase()]||(wx[n.toLowerCase()]=new e(n)),wx[n.toLowerCase()]}constructor(e=wh){this.locale=e,this.lookups={...wA},this.vars={...ww};let n=new Intl.NumberFormat(this.locale);this.numberingSystem=n.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let n=parseInt(e,10);if(!isNaN(n))return n}let n="";for(let t=0;t<e.length;t++)n+=String(this.lookups.digit[e[t]]);return parseInt(n,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let n=e.slice(0,3);return 1===n.length?100*this.toInt(n):2===n.length?10*this.toInt(n):this.toInt(n)}monthNameToInt(e){if("string"!=typeof e)return;let n=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[n]||12}h12ToInt(e,n){if("string"!=typeof e)return;let t=this.lookups.meridiem[n?.toLowerCase()]||0,i=this.toInt(e);return i<12&&12===t&&(i+=12),12===i&&0===t&&(i=0),i}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let n=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(n){let[,e,t,i]=n;return("-"===e||"−"===e?-1:1)*(60*this.toInt(t)+this.toInt(i||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=w_:this.buildNumbers(),/^en/i.test(this.locale)||(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:n}=function(e){if(wv[e])return wv[e];if("fullwide"===e||"hanidec"===e)return{group:wy,lookup:{...w_}};let n=wb[e];if(!n)return{group:"\\d",lookup:{...w_}};let t=String.fromCharCode(n),i=String.fromCharCode(n+9),r={};for(let e=0;e<10;e++)r[String.fromCharCode(n+e)]=e;return wv[e]={group:`[${t}-${i}]`,lookup:r},wv[e]}(this.numberingSystem);for(let t in this.lookups.digit=n,wk)wk.hasOwnProperty(t)&&(this.vars[t]=wk[t].replace(/\*/g,e))}buildMonthNames(){let e={},n={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((t,i)=>{["","k","kuu","kuuta"].forEach((r,a)=>{e[t+r+(a<2?"\\.?":"")]=!0,n[t+r]=i+1})});else{let t=[],i=e=>"month"===e.type;for(let e=0;e<12;e++)t.push(new Date(2017,e,1));for(let r of["full","long","medium"]){let a=Intl.DateTimeFormat(this.locale,{dateStyle:r});for(let o=0;o<12;o++){let s=a.formatToParts(t[o]).find(i).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===r?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,n[s]=o+1)}}let r=Intl.DateTimeFormat(this.locale,{month:"short"});for(let a=0;a<12;a++){let o=r.formatToParts(t[a]).find(i).value.toLocaleLowerCase(this.locale);o=o.replace(/\.$/,""),e[`${o}\\.?`]=!0,n[o]=a+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=n}buildDaynames(){let e=[],n=e=>"weekday"===e.type;for(let n=0;n<7;n++)e.push(new Date(2017,0,n+1));let t=[],i={};for(let r of["long","short"]){let a=Intl.DateTimeFormat(this.locale,{weekday:r});for(let o=0;o<7;o++){let s=a.formatToParts(e[o]).find(n).value.toLocaleLowerCase(this.locale);"short"===r?(s=s.replace(/\.$/,""),t.push(`${s}\\.?`)):t.push(s),i[s]=o}}this.vars.DAYNAME=t.join("|"),this.lookups.dayname=i}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],n=e=>"dayPeriod"===e.type,t=[],i={},r=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let a=0;a<2;a++){let o=r.formatToParts(e[a]).find(n);if(!o)return;let s=o.value.toLocaleLowerCase(this.locale);t.push(s),i[s]=12*a}this.vars.MERIDIEM=t.join("|"),this.lookups.meridiem=i}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,n)=>{if(!this.vars[n])throw Error(`Template string contains invalid variable _${n}_`);return this.vars[n]}),"i")}},wE=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],wS={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},wD=()=>new Date;function wM(e){return function(n){let t={};for(let i=0,r=e.length;i<r;i++){let r=e[i];r&&(t[r]=n[i])}return t}}var wz=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:n,patterns:t,formatter:i}){this.doneChecker=e,this.fallback=n,this.patterns=t,this.formatter=i}attempt(e){if("string"!=typeof e)return this.fallback(e);let n=e.trim(),t={},i=!1;for(let e of this.patterns){let r=n.match(e.regex);if(!r)continue;i=!0;let a=e.handler(r);if(a){for(let[e,n]of Object.entries(a))e in t||void 0===n||(t[e]=n);if(n=(n=n.slice(0,r.index)+n.slice(r.index+r[0].length+1)).trim(),this.doneChecker(t,n))break}}return i?this.formatter(t):this.fallback(e)}},wO=["year","month","day","hour","minute","second","millisecond","offset"],wP={};function wT(e,n){return""===n||/^\s+$/.test(n)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var wB=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],wI={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...wB],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:wB,id:wB,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function wN(e,n=wh){let t=function(e){if(!wP[e]){var n,t;let i,r,a=wC.factory(e);wP[e]=new wz({doneChecker:wT,fallback:(n=e,function(e){let t=String(e).slice(0,50);return""===t&&(t="(empty string)"),{invalid:`Unable to parse "${t}" with locale "${n}"`}}),patterns:(i=[{name:"timestampWithOffset",regex:a.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:wM(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:a.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:wM(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:a.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:wM(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:a.compile(`^(${wy}{2,4})\\s*\u5E74\\s*(${wy}{1,2})\\s*\u6708\\s*(${wy}{1,2})\\s*\u65E5$`),handler:wM(["","year","month","day"])},{name:"korean",regex:a.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:wM(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:wM(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let n=wD(),t=e[1].toLowerCase();switch(t){case"tomorrow":n.setUTCDate(n.getUTCDate()+1);break;case"yesterday":n.setUTCDate(n.getUTCDate()-1)}let i={year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate()};return"now"===t&&(i.hour=n.getUTCHours(),i.minute=n.getUTCMinutes(),i.second=n.getUTCSeconds(),i.millisecond=n.getUTCMilliseconds()),console.log("today=>",t,i),i}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,e,n,t,i]){n=parseFloat(n),"week"===(t=t.length<=2?wS[t]:(t=t.replace(/s$/,"")).toLowerCase())&&(t="day",n*=7),("-"===e||i)&&(n*=-1);let r=wD();return"millisecond"===t?r.setUTCMilliseconds(r.getUTCMilliseconds()+n):"second"===t?r.setUTCSeconds(r.getUTCSeconds()+n):"minute"===t?r.setUTCMinutes(r.getUTCMinutes()+n):"hour"===t?r.setUTCHours(r.getUTCHours()+n):"day"===t?r.setUTCDate(r.getUTCDate()+n):"month"===t?r.setUTCMonth(r.getUTCMonth()+n):"year"===t&&r.setUTCFullYear(r.getUTCFullYear()+n),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let n=new Date(1e3*parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let n=new Date(parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:a.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:wM(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:a.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:wM(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:a.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:wM(["","hour","minute","second","meridiem"])},{name:"hms24",regex:a.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:wM(["","hour","minute","second","millisecond"])},{name:"hm12",regex:a.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:wM(["","hour","minute","meridiem"])},{name:"hm24",regex:a.compile("(_H24_):(_MIN_)"),handler:wM(["","hour","minute"])},{name:"h12",regex:a.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:wM(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:wM(["","year","month","day"])},{name:"yearMonthnameDay",regex:a.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:wM(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:a.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:wM(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:a.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:wM(["","monthname","day","","year"])},{name:"dayMonthname",regex:a.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:wM(["","day","","monthname"])},{name:"monthnameDay",regex:a.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:wM(["","monthname","day"])},{name:"hmsNoMeridiem",regex:a.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:wM(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:a.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:wM(["","hour","minute"])},{name:"ymd",regex:a.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:wM(["","year","","month","day"])},{name:"mdy",regex:a.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:wM(["","month","","day","year"])},{name:"dmy",regex:a.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:wM(["","day","month","year"])},{name:"yearLoose",regex:a.compile("_YEAR4_"),handler:wM(["year"])},{name:"dayMonthnameLoose",regex:a.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:wM(["","day","monthname"])},{name:"monthnameDayLoose",regex:a.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:wM(["","monthname","day"])},{name:"monthname",regex:a.compile("_MONTHNAME_"),handler:wM(["monthname"])},{name:"year4",regex:a.compile("_YEAR4_"),handler:wM(["year"])},{name:"md",regex:a.compile("(_MONTH_)[/-](_DAY_)"),handler:wM(["","month","day"])},{name:"dm",regex:a.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:wM(["","day","month"])},{name:"day",regex:a.compile("_DAY_"),handler:wM(["day"])},{name:"year2",regex:a.compile("_YEAR2_"),handler:wM(["year"])},{name:"onlyZone",regex:a.compile("_ZONE_"),handler:wM(["zone"])}],r=a.baseName.slice(0,5),wE.includes(r)?i:i.filter(e=>!["mdy","md"].includes(e.name))),formatter:(t=a,function(e){let n={};for(let[i,r]of Object.entries(e))if("monthname"===i){if(r){let e=t.monthNameToInt(r);void 0!==e&&(n.month=e)}}else if("hour"===i&&e.meridiem){let i=t.h12ToInt(r,e.meridiem);void 0!==i&&(n.hour=i)}else if("zone"===i){if(r){let e=t.zoneToOffset(r);void 0!==e&&(n.offset=e)}}else if("offset"===i){let e=t.offsetToMinutes(r);void 0!==e&&(n.offset=e)}else if("millisecond"===i){let e=t.millisecondToInt(r);"number"==typeof e&&(n.millisecond=e)}else if(wO.includes(i)){let e=t.toInt(r);"number"==typeof e&&(n[i]=e)}return n.year<100&&(n.year=wm[n.year]),n.year&&"buddhist"===t.dateOptions.calendar&&(n.year-=543),n})})}return wP[e]}(n),i=function(e,n){let t=wI[n.slice(0,2).toLowerCase()];if(!t)return e;for(let[n,i]of t)e=e.replace(n,i);return e}(e,n);return t.attempt(i)}function wj(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let n=new wg(e.year,e.month-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new wg(n.valueOf()-60*e.offset*1e3):n}function wR(e,n=wh){let t=wN(e,n),i=t.invalid?new wg(NaN):wj(t);return i.isValid()||(i.invalid=`Unable to parse date "${e}"`),i}function wF(e,n=wh){return e instanceof Date?new wg(e.valueOf()):"number"==typeof e?new wg(e):wR(e,n)}Date.fromString=wg.fromString=wR,Date.fromAny=wg.fromAny=wF,"u">typeof window&&(window.anyDateParser={fromString:wR,fromAny:wF,fromObject:wj,attempt:wN});var wL=t(5238),wW=t(83826);let wV=function(e){return null==e};function wG(e,n){var t=function(e,n){if(!n.has(e))throw TypeError("attempted to get private field on non-instance");return n.get(e)}(e,n);return t.get?t.get.call(e):t.value}fx.extend(fE),fx.extend(wW),fx.extend(wL);let wU="YYYY-MM-DDTHH:mm:ss.SSSZZ";function wH(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&fx(e,wU).isValid()}function wq(e){return fx(e).isToday()}function wK(e){return wH(e)?fx(e,wU).toDate():null}function wY(e,n=!1){let t=fx(e);return n&&(t=t.utc()),t.format(wU)}function wJ(e){return fx(e).toDate()}var wZ=new WeakMap;let wX=new class{register(e,n){wG(this,wZ).set(e,n)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let n=`${e.language}-${e.region}`;if(wG(this,wZ).has(n))return wG(this,wZ).get(n)}if(e.language&&wG(this,wZ).has(e.language))return wG(this,wZ).get(e.language);let n=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wG(this,wZ).set(`${e.language}${e.region?`-${e.region}`:""}`,n),n}constructor(){!function(e,n,t){if(n.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");n.set(e,t)}(this,wZ,{writable:!0,value:new Map})}};function wQ(e,n){wX.register(e,n)}function w0(e){let n=e??wf();return wX.getCalendar(n instanceof Intl.Locale?n:new Intl.Locale(n))}let w1={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function w2(e,n={}){let t=wN(e,wf());if(t.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!wV(t.day)&&wV(t.month)&&(t=Object.assign({},nP(t,"day"),{month:t.day})),t.month&&(t.month-=1),t.day&&(t=Object.assign({},nP(t,"day"),{date:t.day}));let i=fx().set(t).toDate();return wV(t.year)&&(n.year=!1),wV(t.month)&&(n.month=!1),wV(t.date)&&(n.day=!1),w3(i,n)}function w3(e,n){let t,i=n?.locale??wf(),r=new Intl.Locale(i),{calendar:a,mode:o,time:s,day:l,month:c,year:u,noToday:p,numberingSystem:d}={...w1,...{noToday:"am"===r.language},...n},f={calendar:a??w0(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:d},h=fx(e).isToday();if(h&&!p)t=(t=new Intl.RelativeTimeFormat(i,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(i)+t.slice(1);else{"en"===r.language&&(i="en-GB");let n=new Intl.DateTimeFormat(i,f).formatToParts(e);("en"===r.language||"am"===r.language)&&"standard"==o&&u&&l&&(n=n.map(w5("-"))),"wide"==o&&(n=n.map(w5(" — "))),"ethiopic"===f.calendar&&(n=n.filter((e,n,t)=>"era"!==e.type&&("literal"!==e.type||!(n<t.length-1)||"era"!==t[n+1].type))),t=n.map(e=>e.value).join("")}return(!0===s||h&&"for today"===s)&&(t+=`, ${w4(e)}`),t}let w5=e=>(n,t,i)=>"literal"!==n.type||" "!==n.value||t<i.length-1&&"era"===i[t+1].type?n:{type:"literal",value:e};function w4(e){return e.toLocaleTimeString(wf(),{hour:"2-digit",minute:"2-digit"})}function w6(e,n){return w3(e,{...n,time:!0})}function w8(e,n){let t=w0("string"==typeof n?new Intl.Locale(n):n);return t?_d(e,vD(t)):e}function w7(e,n){return new Intl.DurationFormat(wf(),n).format(e)}function w9(e,n){if(null==e)return null;if("string"==typeof e){let t=wN(e,wf());return t.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(t.day&&!t.month&&(t={...nP(t,"day"),...{month:t.day}}),t.month&&(t.month-=1),t.day&&(t={...nP(t,"day"),...{date:t.day}}),fx(n).set(t))}return fx(e)}let ke=["years","months","days","hours","minutes","seconds"],kn={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},kt={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function ki(e,n=fx(),t){let i,r=fx(n),a=w9(e,r);if(null==a)return null;if("string"==typeof t){let e=kn[t]??t;return{[e]:r.diff(a,e)}}let{thresholds:o,largestUnit:s,smallestUnit:l}=t??{};if(void 0!==s||void 0!==l){let e,n=l?kn[l]??l:void 0;return e="auto"===s||void 0===s?function(e,n,t){let i=ke.indexOf(t);for(let r=0;r<ke.length;r++){let a=ke[r];if(n.diff(e,a)>0)return r<=i?a:t}return t}(a,r,n??"seconds"):kn[s]??s,function(e,n,t,i){let r=ke.indexOf(t),a=ke.indexOf(i),o=ke.slice(r,a+1),s={},l=e;for(let e of o){let t=n.diff(l,e);s[e]=t,l=l.add(t,e)}return s}(a,r,e,n??e)}let c=(i=function(e){let n={...kt};if(e)for(let[t,i]of Object.entries(e))void 0!==i&&(n[kn[t]??t]=i);return n}(o),r.diff(a,"seconds")<i.seconds?"seconds":r.diff(a,"minutes")<i.minutes?"minutes":r.diff(a,"hours")<i.hours?"hours":r.diff(a,"days")<i.days?"days":r.diff(a,"months")<i.months?"months":"years");return{[c]:r.diff(a,c)}}let kr={style:"short",localeMatcher:"lookup"};function ka(e,n=fx(),t){let i=ki(e,n,t);return null==i?null:w7(i,"object"==typeof t&&t.formatOptions?{...kr,...t.formatOptions}:kr)}let ko=(0,pX.createContext)(null);function ks(){let e=dH({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,n=(0,pX.useMemo)(()=>{let n=wf();return e[n]&&(n=e[n]),n},[window.i18next.language]),t=(0,pX.useMemo)(()=>{let e=w0(n);return void 0!==e?vD(e):void 0},[n]),i=(0,pX.useMemo)(()=>new Intl.Locale(n,{calendar:t?.identifier}),[n,t]),r=(0,pX.useMemo)(()=>t?_d(_v(_k()),t):_v(_k()),[t]);return{calendar:t,intlLocale:i,today_:r}}let kl=new y7(1793,1,1);var kc={};function ku(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function kp(e={}){let{locale:n}=yd();return(0,pX.useMemo)(()=>new(0,$Z.K)(n,e),[n,e])}kc={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var kd={};kd={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let kf=()=>{};function kh(e){var n;let t=(0,pX.useRef)(void 0),{value:i,textValue:r,minValue:a,maxValue:o,isDisabled:s,isReadOnly:l,isRequired:c,onIncrement:u,onIncrementPage:p,onDecrement:d,onDecrementPage:f,onDecrementToMin:h,onIncrementToMax:g}=e,m=yT((n=kd)&&n.__esModule?n.default:n,"@react-aria/spinbutton"),b=(0,pX.useRef)(!1),y=(0,pX.useCallback)(()=>{clearTimeout(t.current),b.current=!1},[]),v=bP(()=>{y()});(0,pX.useEffect)(()=>()=>v(),[]);let $=(0,pX.useRef)(!1),A=()=>{$.current=!0},w=()=>{$.current=!1},k=""===r?m.format("Empty"):(r||`${i}`).replace("-","−");(0,pX.useEffect)(()=>{$.current&&(yf&&yf.clear("assertive"),yh(k,"assertive"))},[k]);let x=(0,pX.useCallback)(()=>{y()},[y]),C=bP(u??kf),E=bP(d??kf),S=bP(()=>{(void 0===o||isNaN(o)||void 0===i||isNaN(i)||i<o)&&(C(),D(60))}),D=bP(e=>{v(),b.current=!0,t.current=window.setTimeout(S,e)}),M=bP(()=>{(void 0===a||isNaN(a)||void 0===i||isNaN(i)||i>a)&&(E(),z(60))}),z=bP(e=>{v(),b.current=!0,t.current=window.setTimeout(M,e)}),O=e=>{e.preventDefault()},{addGlobalListener:P,removeAllGlobalListeners:T}=bT(),B=(0,pX.useRef)(!1),[I,N]=(0,pX.useState)(null);(0,pX.useEffect)(()=>{"touch"===I?D(600):I&&D(400)},[I]);let[j,R]=(0,pX.useState)(null);return(0,pX.useEffect)(()=>{"touch"===j?z(600):j&&z(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===i||isNaN(i)?void 0:i,"aria-valuetext":k,"aria-valuemin":a,"aria-valuemax":o,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":c||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(p){e.preventDefault(),p?.();break}case"ArrowUp":case"Up":u&&(e.preventDefault(),u?.());break;case"PageDown":if(f){e.preventDefault(),f?.();break}case"ArrowDown":case"Down":d&&(e.preventDefault(),d?.());break;case"Home":h&&(e.preventDefault(),h?.());break;case"End":g&&(e.preventDefault(),g?.())}},onFocus:A,onBlur:w},incrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(u?.(),N("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,N("touch")),P(window,"contextmenu",O)},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),N(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&u?.(),B.current=!1,N(null)},onFocus:A,onBlur:w},decrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(d?.(),R("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,R("touch"))},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),R(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&d?.(),B.current=!1,R(null)},onFocus:A,onBlur:w}}}let kg=null;var km=t(66284);function kb(e,n,t){let i="+"===e?n+t:n-t;if(n%1!=0||t%1!=0){let r=n.toString().split("."),a=t.toString().split("."),o=Math.pow(10,Math.max(r[1]&&r[1].length||0,a[1]&&a[1].length||0));n=Math.round(n*o),t=Math.round(t*o),i=("+"===e?n+t:n-t)/o}return i}let ky=(0,pX.createContext)(null),k_=(0,pX.createContext)(null),kv=(0,pX.forwardRef)(function(e,n){var t,i;[e,n]=mm(e,n,ky);let{validationBehavior:r}=mg(Al)||{},a=null!=(i=null!=(t=e.validationBehavior)?t:r)?i:"native",{locale:o}=yd(),s=function(e){let{minValue:n,maxValue:t,step:i,formatOptions:r,value:a,defaultValue:o=NaN,onChange:s,locale:l,isDisabled:c,isReadOnly:u,commitBehavior:p="snap"}=e;null===a&&(a=NaN);let d=(0,pX.useCallback)(e=>void 0===i||isNaN(i)?Ag(e,n,t):Ab(e,n,t,i),[i,n,t]);void 0===a||isNaN(a)||"snap"!==p||(a=d(a)),isNaN(o)||"snap"!==p||(o=d(o));let[f,h]=vj(a,isNaN(o)?NaN:o,s),[g]=(0,pX.useState)(f),[m,b]=(0,pX.useState)(()=>isNaN(f)?"":new(0,$Z.K)(l,r).format(f)),y=(0,pX.useMemo)(()=>new(0,km.d)(l,r),[l,r]),v=(0,pX.useMemo)(()=>y.getNumberingSystem(m),[y,m]),$=(0,pX.useMemo)(()=>new(0,$Z.K)(l,{...r,numberingSystem:v}),[l,r,v]),A=(0,pX.useMemo)(()=>$.resolvedOptions(),[$]),w=(0,pX.useCallback)(e=>isNaN(e)||null===e?"":$.format(e),[$]),k=$P({...e,value:f}),x=void 0===i||isNaN(i)?1:i;"percent"===A.style&&(void 0===i||isNaN(i))&&(x=.01);let[C,E]=(0,pX.useState)(f),[S,D]=(0,pX.useState)(l),[M,z]=(0,pX.useState)(r);Object.is(f,C)&&l===S&&r===M||(b(w(f)),E(f),D(l),z(r));let O=(0,pX.useMemo)(()=>y.parse(m),[y,m]),P=(e,i=0)=>{if(isNaN(O))return Ab(isNaN(i)?0:i,n,t,x);{let i=Ab(O,n,t,x);return"+"===e&&i>O||"-"===e&&i<O?i:Ab(kb(e,O,x),n,t,x)}},T=(0,pX.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===t||isNaN(t)||Ab(O,n,t,x)>O||kb("+",O,x)<=t),[c,u,n,t,x,O]),B=(0,pX.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===n||isNaN(n)||Ab(O,n,t,x)<O||kb("-",O,x)>=n),[c,u,n,t,x,O]);return{...k,validate:e=>y.isValidPartialNumber(e,n,t),increment:()=>{let e=P("+",n);e===f&&b(w(e)),h(e),k.commitValidation()},incrementToMax:()=>{null!=t&&(h(Ab(t,n,t,x)),k.commitValidation())},decrement:()=>{let e=P("-",t);e===f&&b(w(e)),h(e),k.commitValidation()},decrementToMin:()=>{null!=n&&(h(n),k.commitValidation())},canIncrement:T,canDecrement:B,minValue:n,maxValue:t,numberValue:O,defaultNumberValue:isNaN(o)?g:o,setNumberValue:h,setInputValue:b,inputValue:m,commit:e=>{let n=void 0===e?m:e,t=O;if(void 0!==e&&(t=y.parse(n)),!n.length){h(NaN),b(void 0===a?"":w(f));return}if(isNaN(t))return void b(w(f));let i="snap"===p?d(t):t,r=(i=y.parse(w(i)))!==f;h(i),b(w(void 0===a?i:f)),r&&k.commitValidation()}}}({...e,locale:o,validationBehavior:a}),l=(0,pX.useRef)(null),[c,u]=mb(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:p,groupProps:d,inputProps:f,incrementButtonProps:h,decrementButtonProps:g,descriptionProps:m,errorMessageProps:b,...y}=function(e,n,t){var i,r,a,o,s,l,c,u,p;let d,{id:f,decrementAriaLabel:h,incrementAriaLabel:g,isDisabled:m,isReadOnly:b,isRequired:y,minValue:v,maxValue:$,autoFocus:A,label:w,formatOptions:k,onBlur:x=()=>{},onFocus:C,onFocusChange:E,onKeyDown:S,onKeyUp:D,description:M,errorMessage:z,isWheelDisabled:O,...P}=e,{increment:T,incrementToMax:B,decrement:I,decrementToMin:N,numberValue:j,inputValue:R,commit:F,commitValidation:L}=n,W=yT((i=kc)&&i.__esModule?i.default:i,"@react-aria/numberfield"),V=(0,pX.useCallback)(()=>{let e=t.current?.value??"";(0,bB.flushSync)(()=>{F()}),t.current?.value!==e&&yh(t.current?.value??"","assertive")},[F,t]),G=ml(f),{focusProps:U}=b_({onBlur(){V()}}),H=kp(k),q=(0,pX.useMemo)(()=>H.resolvedOptions(),[H]),K=kp({...k,currencySign:void 0}),Y=(0,pX.useMemo)(()=>isNaN(j)?"":K.format(j),[K,j]),{spinButtonProps:J,incrementButtonProps:Z,decrementButtonProps:X}=kh({isDisabled:m,isReadOnly:b,isRequired:y,maxValue:$,minValue:v,onIncrement:T,onIncrementToMax:B,onDecrement:I,onDecrementToMin:N,value:j,textValue:Y}),[Q,ee]=(0,pX.useState)(!1),{focusWithinProps:en}=bK({isDisabled:m,onFocusWithinChange:ee});!function(e,n){let{onScroll:t,isDisabled:i}=e,r=(0,pX.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),t&&t({deltaX:e.deltaX,deltaY:e.deltaY}))},[t]);_V(n,"wheel",i?void 0:r)}({onScroll:(0,pX.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?T():e.deltaY<0&&I())},[I,T]),isDisabled:O||m||b||!Q},t);let et=(q.maximumFractionDigits??0)>0,ei=void 0===n.minValue||isNaN(n.minValue)||n.minValue<0,er="numeric";mQ()?ei?er="text":et&&(er="decimal"):m5()&&(ei?er="numeric":et&&(er="decimal"));let ea=mD(e),eo=(0,pX.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,bB.flushSync)(()=>{F()}),L()):e.continuePropagation())},[F,L]),{isInvalid:es,validationErrors:el,validationDetails:ec}=n.displayValidation,{labelProps:eu,inputProps:ep,descriptionProps:ed,errorMessageProps:ef}=function(e,n,t){let i=bP(e=>{let i=t.current;if(!i)return;let r=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":r=i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd);break;case"deleteContentForward":r=i.selectionEnd===i.selectionStart?i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd+1):i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd);break;case"deleteContentBackward":r=i.selectionEnd===i.selectionStart?i.value.slice(0,i.selectionStart-1)+i.value.slice(i.selectionStart):i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":r=i.value.slice(i.selectionStart);break;default:null!=e.data&&(r=i.value.slice(0,i.selectionStart)+e.data+i.value.slice(i.selectionEnd))}null!=r&&n.validate(r)||e.preventDefault()});(0,pX.useEffect)(()=>{if(!ku()||!t.current)return;let e=t.current;return e.addEventListener("beforeinput",i,!1),()=>{e.removeEventListener("beforeinput",i,!1)}},[t]);let r=ku()?null:e=>{let t=mB(e).value.slice(0,mB(e).selectionStart)+e.data+mB(e).value.slice(mB(e).selectionEnd);n.validate(t)||e.preventDefault()},{labelProps:a,inputProps:o,descriptionProps:s,errorMessageProps:l,...c}=function(e,n){let{inputElementType:t="input",isDisabled:i=!1,isRequired:r=!1,isReadOnly:a=!1,type:o="text",validationBehavior:s="aria"}=e,[l,c]=vj(e.value,e.defaultValue||"",e.onChange),{focusableProps:u}=bw(e,n),p=$P({...e,value:l}),{isInvalid:d,validationErrors:f,validationDetails:h}=p.displayValidation,{labelProps:g,fieldProps:m,descriptionProps:b,errorMessageProps:y}=$v({...e,isInvalid:d,errorMessage:e.errorMessage||f}),v=mD(e,{labelable:!0}),$={type:o,pattern:e.pattern},[A]=(0,pX.useState)(l);return $$(n,e.defaultValue??A,c),$A(e,p,n),{labelProps:g,inputProps:mp(v,"input"===t?$:void 0,{disabled:i,readOnly:a,required:r&&"native"===s,"aria-required":r&&"aria"===s||void 0,"aria-invalid":d||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>c(mB(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(pQ().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...u,...m}),descriptionProps:b,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:h}}(e,t),u=(0,pX.useRef)(null);return{inputProps:mp(o,{onBeforeInput:r,onCompositionStart(){let{value:e,selectionStart:n,selectionEnd:i}=t.current;u.current={value:e,selectionStart:n,selectionEnd:i}},onCompositionEnd(){if(t.current&&!n.validate(t.current.value)){let{value:e,selectionStart:i,selectionEnd:r}=u.current;t.current.value=e,t.current.setSelectionRange(i,r),n.setInputValue(e)}}}),labelProps:a,descriptionProps:s,errorMessageProps:l,...c}}({...P,...ea,name:void 0,form:void 0,label:w,autoFocus:A,isDisabled:m,isReadOnly:b,isRequired:y,validate:void 0,[$O]:n,value:R,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:G,type:"text",inputMode:er,onChange:e=>{n.validate(e)&&n.setInputValue(e)},onBlur:x,onFocus:C,onFocusChange:E,onKeyDown:(0,pX.useMemo)(()=>g4(eo,S),[eo,S]),onKeyUp:D,onPaste:n=>{e.onPaste?.(n);let t=mB(n);t&&(t.selectionEnd??-1)-(t.selectionStart??0)===t.value.length&&(n.preventDefault(),F(n.clipboardData?.getData?.("text/plain")?.trim()??""))},description:M,errorMessage:z},n,t);$$(t,n.defaultNumberValue,n.setNumberValue),r=n,a=e.validationBehavior,o=e.commitBehavior,s=t,l=n.minValue,c=n.maxValue,u=e.step,p=n.numberValue,g6(()=>{let e=s.current;if("validate"!==o||r.realtimeValidation.isInvalid||!e||e.disabled||(!kg&&"u">typeof document&&((kg=document.createElement("input")).type="number"),!kg))return;kg.min=null==l||isNaN(l)?"":String(l),kg.max=null==c||isNaN(c)?"":String(c),kg.step=null==u||isNaN(u)?"":String(u),kg.value=null==p||isNaN(p)?"":String(p);let n=e.validity.valid&&kg.validity.valid,t=e.validationMessage||kg.validationMessage,i={isInvalid:!n,validationErrors:t?[t]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:kg.validity.rangeOverflow,rangeUnderflow:kg.validity.rangeUnderflow,stepMismatch:kg.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:n}};r.updateValidation(i),"native"!==a||kg.validity.valid||e.setCustomValidity(kg.validationMessage)});let eh=mp(J,U,ep,{role:null,"aria-roledescription":m1()?null:W.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(eh["aria-required"]=void 0);let eg=e=>{((e=document)=>e.activeElement)()!==t.current&&("mouse"===e.pointerType?t.current?.focus():e.target.focus())},em=e["aria-label"]||("string"==typeof e.label?e.label:"");em||(d=null!=e.label?eu.id:e["aria-labelledby"]);let eb=ml(),ey=ml(),e_=mp(Z,{"aria-label":g||W.format("increase",{fieldLabel:em}).trim(),id:d&&!g?eb:null,"aria-labelledby":d&&!g?`${eb} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canIncrement,onPressStart:eg}),ev=mp(X,{"aria-label":h||W.format("decrease",{fieldLabel:em}).trim(),id:d&&!h?ey:null,"aria-labelledby":d&&!h?`${ey} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canDecrement,onPressStart:eg});return{groupProps:{...en,role:"group","aria-disabled":m,"aria-invalid":es?"true":void 0},labelProps:eu,inputProps:eh,incrementButtonProps:e_,decrementButtonProps:ev,errorMessageProps:ef,descriptionProps:ed,isInvalid:es,validationErrors:el,validationDetails:ec}}({...my(e),label:u,validationBehavior:a},s,l),v=mh({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:y.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),$=mD(e);return delete $.id,pQ().createElement(mf,{values:[[k_,s],[v2,d],[v5,{...f,ref:l}],[Ac,{...p,ref:c}],[b5,{slots:{increment:h,decrement:g}}],[b8,{slots:{description:m,errorMessage:b}}],[Aa,y]]},pQ().createElement("div",{...$,...v,ref:n,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":y.isInvalid||void 0}),e.name&&pQ().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function k$(e,n){return Number.parseInt(w3(e,{calendar:n.calendar,locale:n.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let kA=(0,pX.forwardRef)(function(e,n){let{className:t}=e,i=(0,pX.useContext)(vH),r=(0,pX.useContext)(vq),a=i??r,o=(0,pX.useContext)(ko),s=_k(),l=w3(a.visibleRange.start.toDate(s),{calendar:o.calendar,locale:o.baseName,day:!1,year:!1,noToday:!0}),c=k$(a.visibleRange.start.toDate(s),o),u=a.maxValue?k$(a.maxValue.toDate(s),o):void 0,p=a.minValue?k$(a.minValue.toDate(s),o):void 0,d=(0,pX.useCallback)(e=>{a.setFocusedDate(a.focusedDate.cycle("year",e-a.focusedDate.year))},[]);return a&&(0,fG.jsxs)("span",{ref:n,className:t,children:[(0,fG.jsx)("span",{children:l}),(0,fG.jsxs)(kv,{formatOptions:{useGrouping:!1},maxValue:u,minValue:p,onChange:d,value:c,children:[(0,fG.jsx)(v4,{}),(0,fG.jsxs)(v3,{children:[(0,fG.jsx)(b4,{slot:"increment",children:(0,fG.jsx)(hM,{size:8})}),(0,fG.jsx)(b4,{slot:"decrement",children:(0,fG.jsx)(hE,{size:8})})]})]})]})});var kw=t(74782),kk={};kk.styleTagTransform=f5(),kk.setAttributes=f0(),kk.insert=fX().bind(null,"head"),kk.domAPI=fJ(),kk.insertStyleElement=f2(),fK()(kw.A,kk);let kx=kw.A&&kw.A.locals?kw.A.locals:void 0;function kC({children:e}){let n=(0,pX.useContext)(wo),t=(0,pX.useContext)(ws),i=n??t,r=fh(()=>i?.close());return(0,fG.jsx)(Ar,{className:kx.dialog,ref:r,children:e})}let kE=(0,pX.forwardRef)(function({variant:e,today_:n,minDate:t,maxDate:i},r){let a="range"===e;return(0,fG.jsx)(wn,{ref:r,className:kx.popover,placement:"bottom start",offset:1,isNonModal:!0,children:(0,fG.jsx)(kC,{children:(0,fG.jsxs)(a?vY:vK,{...a?{minValue:t,maxValue:i,className:"cds--date-picker__calendar"}:{},children:[(0,fG.jsxs)("header",{className:kx.header,children:[(0,fG.jsx)(b4,{className:fH()(kx.flatButton,kx.flatButtonMd),slot:"previous",children:(0,fG.jsx)(hN,{size:16})}),(0,fG.jsx)(kA,{className:kx.monthYear}),(0,fG.jsx)(b4,{className:fH()(kx.flatButton,kx.flatButtonMd),slot:"next",children:(0,fG.jsx)(hj,{size:16})})]}),(0,fG.jsx)(vZ,{className:kx.calendarGrid,children:e=>(0,fG.jsx)(v1,{className:fH()("cds--date-picker__day",{[kx.today]:0===n.compare(e)}),date:e},e.toString())})]})})})}),kS=(0,pX.forwardRef)(function(e,n){let t=(0,pX.useContext)(wo),[i,r]=mm({slot:e.slot},n,$2),{locale:a}=yd(),o=$1({...i,locale:a,createCalendar:vD}),s=(0,pX.useRef)(null),{fieldProps:l,inputProps:c}=$C({...i,inputRef:s},o,r),u=(0,pX.useCallback)(()=>{o.isDisabled||t.toggle()},[]);return(0,fG.jsxs)(mf,{values:[[$3,o],[v5,{...c,ref:s}],[v2,{...l,ref:r,isInvalid:o.isInvalid}]],children:[(0,fG.jsx)(v3,{...e,id:e.id,ref:n,slot:e.slot||void 0,className:e.className,isDisabled:o.isDisabled,isInvalid:o.isInvalid,onClick:u,children:o.segments.map((n,t)=>(0,pX.cloneElement)(e.children(n),{key:t}))}),(0,fG.jsx)(v4,{})]})}),kD=(0,pX.forwardRef)(function(e,n){let t=(0,pX.useContext)(wo),i=(0,pX.useContext)(ws);return(t??i).isInvalid?(0,fG.jsx)(gV,{ref:n,size:16,...e}):(0,fG.jsx)(hC,{ref:n,size:16,...e})});class kM{constructor(e,n){this.locale=e,this.dictionary=n}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let kz=new Map,kO=(0,pX.forwardRef)(function({segment:e,...n},t){let i=(0,pX.useContext)($3),r=g2(t),{segmentProps:a}=function(e,n,t){let i,r,a,o,s=(0,pX.useRef)(""),{locale:l,direction:c}=yd(),u=function(){var e;let{locale:n}=yd(),t=yP((e=$b)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,pX.useMemo)(()=>{try{return new Intl.DisplayNames(n,{type:"dateTimeField"})}catch{return new kM(n,t)}},[n,t])}(),{ariaLabel:p,ariaLabelledBy:d,ariaDescribedBy:f,focusManager:h}=$w.get(n),g=e.isPlaceholder?"":e.text,m=(0,pX.useMemo)(()=>n.dateFormatter.resolvedOptions(),[n.dateFormatter]),b=yk({month:"long",timeZone:m.timeZone}),y=yk({hour:"numeric",hour12:m.hour12,timeZone:m.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(g=y.format(n.dateValue));else{let e=b.format(n.dateValue);g=e!==g?`${g} \u{2013} ${e}`:e}let{spinButtonProps:v}=kh({value:e.value??void 0,textValue:g,minValue:e.minValue,maxValue:e.maxValue,isDisabled:n.isDisabled,isReadOnly:n.isReadOnly||!e.isEditable,isRequired:n.isRequired,onIncrement:()=>{s.current="",n.increment(e.type)},onDecrement:()=>{s.current="",n.decrement(e.type)},onIncrementPage:()=>{s.current="",n.incrementPage(e.type)},onDecrementPage:()=>{s.current="",n.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",n.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",n.decrementToMin(e.type)}}),$=(0,pX.useMemo)(()=>new(0,km.d)(l,{maximumFractionDigits:0}),[l]),A=()=>{if(e.text===e.placeholder&&h.focusPrevious(),!$.isValidPartialNumber(e.text)||n.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&n.clearSegment(e.type);else{let t=e.text.slice(0,-1),i=$.parse(t);0===(t=0===i?"":t).length||0===i?n.clearSegment(e.type):n.setSegment(e.type,i),s.current=t}},{startsWith:w}=(i=function(e){let{locale:n}=yd(),t=n+(e?Object.entries(e).sort((e,n)=>e[0]<n[0]?-1:1).join():"");if(kz.has(t))return kz.get(t);let i=new Intl.Collator(n,e);return kz.set(t,i),i}({usage:"search",sensitivity:"base"}),r=(0,pX.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===i.compare(e.slice(0,n.length),n)),[i]),a=(0,pX.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===i.compare(e.slice(-n.length),n)),[i]),o=(0,pX.useCallback)((e,n)=>{if(0===n.length)return!0;e=e.normalize("NFC");let t=0,r=(n=n.normalize("NFC")).length;for(;t+r<=e.length;t++){let a=e.slice(t,t+r);if(0===i.compare(n,a))return!0}return!1},[i]),(0,pX.useMemo)(()=>({startsWith:r,endsWith:a,contains:o}),[r,a,o])),k=yk({hour:"numeric",hour12:!0}),x=(0,pX.useMemo)(()=>{let e=new Date;return e.setHours(0),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),C=(0,pX.useMemo)(()=>{let e=new Date;return e.setHours(12),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),E=yk({year:"numeric",era:"narrow",timeZone:"UTC"}),S=(0,pX.useMemo)(()=>{if("era"!==e.type)return[];let t=_d(new y7(1,1,1),n.calendar),i=n.calendar.getEras().map(e=>{let n=t.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:E.formatToParts(n).find(e=>"era"===e.type).value}}),r=function(e){e.sort();let n=e[0],t=e[e.length-1];for(let e=0;e<n.length;e++)if(n[e]!==t[e])return e;return 0}(i.map(e=>e.formatted));if(r)for(let e of i)e.formatted=e.formatted.slice(r);return i},[E,n.calendar,e.type]),D=t=>{if(n.isDisabled||n.isReadOnly)return;let i=s.current+t;switch(e.type){case"dayPeriod":if(w(x,t))n.setSegment("dayPeriod",0);else if(w(C,t))n.setSegment("dayPeriod",1);else break;h.focusNext();break;case"era":{let e=S.find(e=>w(e.formatted,t));e&&(n.setSegment("era",e.era),h.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!$.isValidPartialNumber(i))return;let r=$.parse(i),a=r;if(void 0!==e.maxValue&&r>e.maxValue&&(a=$.parse(t)),isNaN(r))return;n.setSegment(e.type,a),void 0!==e.maxValue&&(Number(r+"0")>e.maxValue||i.length>=String(e.maxValue).length)?(s.current="",h.focusNext()):s.current=i}}};_V((0,pX.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mT(t.current,e?.anchorNode)&&e.collapse(t.current)});let M=(0,pX.useRef)("");_V(t,"beforeinput",i=>{if(t.current)switch(i.preventDefault(),i.inputType){case"deleteContentBackward":case"deleteContentForward":$.isValidPartialNumber(e.text)&&!n.isReadOnly&&A();break;case"insertCompositionText":M.current=t.current.textContent,t.current.textContent=t.current.textContent;break;default:null!=i.data&&D(i.data)}}),_V(t,"input",e=>{let{inputType:n,data:i}=e;"insertCompositionText"===n&&(t.current&&(t.current.textContent=M.current),null!=i&&(w(x,i)||w(C,i))&&D(i))}),g6(()=>{let e=t.current;return()=>{((e=document)=>e.activeElement)()===e&&(h.focusPrevious()||h.focusNext())}},[t,h]);let z=m1()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,pX.useMemo)(()=>n.segments.find(e=>e.isEditable),[n.segments])||n.isInvalid||(f=void 0);let O=ml(),P=!n.isDisabled&&!n.isReadOnly&&e.isEditable,T="literal"===e.type?"":u.of(e.type),B=_j({"aria-label":`${T}${p?`, ${p}`:""}${d?", ":""}`,"aria-labelledby":d});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===c){I.unicodeBidi="embed";let n=m[e.type];("numeric"===n||"2-digit"===n)&&(I.direction="ltr")}return{segmentProps:mp(v,B,{id:O,...z,"aria-invalid":n.isInvalid?"true":void 0,"aria-describedby":f,"aria-readonly":n.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:P,suppressContentEditableWarning:P,spellCheck:P?"false":void 0,autoCorrect:P?"off":void 0,[parseInt(pQ().version,10)>=17?"enterKeyHint":"enterkeyhint"]:P?"next":void 0,inputMode:n.isDisabled||"dayPeriod"===e.type||"era"===e.type||!P?void 0:"numeric",tabIndex:n.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(mX()?e.metaKey:e.ctrlKey)&&e.preventDefault(),!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey)switch(e.key){case"Backspace":case"Delete":e.preventDefault(),e.stopPropagation(),A()}},onFocus:()=>{s.current="",t.current&&_K(t.current,{containingElement:_U(t.current)});let e=window.getSelection();e?.collapse(t.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,i,r),{focusProps:o,isFocused:s,isFocusVisible:l}=bY(),{hoverProps:c,isHovered:u}=b0({...n,isDisabled:i.isDisabled||"literal"===e.type}),p=function(e){let{className:n,style:t,children:i,defaultClassName:r,defaultChildren:a,defaultStyle:o,values:s}=e;return(0,pX.useMemo)(()=>{let e,l,c;return e="function"==typeof n?n({...s,defaultClassName:r}):n,l="function"==typeof t?t({...s,defaultStyle:o||{}}):t,c="function"==typeof i?i({...s,defaultChildren:a}):null==i?a:i,{className:e??r,style:l||o?{...o,...l}:void 0,children:c??a,"data-rac":""}},[n,t,i,r,a,o,s])}({...n,values:{...e,isReadOnly:!e.isEditable,isInvalid:i.isInvalid,isDisabled:i.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),d=(0,pX.useCallback)(e=>{e.stopPropagation()},[]);return(0,fG.jsx)("span",{...mp(mD(n),a,o,c),...p,ref:r,style:a.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":i.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":i.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:d})}),kP={short:!1,size:"md"},kT=(0,pX.forwardRef)(function(e,n){let{className:t,defaultValue:i,isDisabled:r,invalid:a,invalidText:o,isInvalid:s,label:l,labelText:c,light:u,maxDate:p,minDate:d,onChange:f,onChangeRaw:h,short:g,size:m,value:b,...y}={...kP,...e},{calendar:v,intlLocale:$,today_:A}=ks(),w=(0,pX.useId)(),k=!!(c??l),x=(0,pX.useMemo)(()=>wp(i,v),[i,v]),C=(0,pX.useMemo)(()=>wp(b,v,!0),[b,v]),E=(0,pX.useMemo)(()=>wp(p,v),[p,v]),S=(0,pX.useMemo)(()=>wp(d??kl,v),[d,v]),D=(0,pX.useMemo)(()=>a||s,[a,s]),M=(0,pX.useMemo)(()=>(h&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),h??(e=>f?.(wd(e)))),[h,f]);return(0,fG.jsx)(wu,{locale:$.toString(),children:(0,fG.jsx)("div",{className:fH()("cds--form-item",t),children:(0,fG.jsx)(mf,{values:[[ko,$]],children:(0,fG.jsxs)(wl,{className:fH()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":g,"cds--date-picker--light":u}),defaultValue:x,isDisabled:r,isInvalid:D,maxValue:E,minValue:S,value:C,shouldForceLeadingZeros:"en"===$.language||void 0,...y,onChange:M,children:[(0,fG.jsxs)("div",{className:"cds--date-picker-container",children:[k&&(0,fG.jsx)(Au,{className:fH()("cds--label",{"cds--label--disabled":r}),htmlFor:w,children:c??l}),(0,fG.jsxs)(v3,{className:kx.inputGroup,children:[(0,fG.jsx)(kS,{id:k?w:void 0,ref:n,className:fH()("cds--date-picker-input__wrapper",kx.inputWrapper,{[kx.inputWrapperSm]:"sm"===m,[kx.inputWrapperMd]:"md"===m||!m||0===m.length,[kx.inputWrapperLg]:"lg"===m}),children:e=>"era"!==e.type?(0,fG.jsx)(kO,{className:kx.inputSegment,segment:e}):(0,fG.jsx)(pQ().Fragment,{})}),(0,fG.jsx)(b4,{className:fH()(kx.flatButton,{[kx.flatButtonSm]:"sm"===m,[kx.flatButtonMd]:"md"===m||!m||0===m.length,[kx.flatButtonLg]:"lg"===m}),children:(0,fG.jsx)(kD,{})})]}),(0,fG.jsx)(Ao,{className:kx.invalidText,children:o})]}),(0,fG.jsx)(kE,{variant:"single",today_:A})]})})})})}),kB=(0,pX.forwardRef)(function({className:e,defaultValue:n,invalid:t,invalidText:i,isDisabled:r,isInvalid:a,label:o,labelText:s,light:l,maxDate:c,minDate:u,onChange:p,onChangeRaw:d,size:f="md",value:h,...g},m){let{calendar:b,intlLocale:y,today_:v}=ks(),$=(0,pX.useId)(),A=!!(s??o),w=(0,pX.useMemo)(()=>{if(h)return{start:wp(h[0],b,!1),end:wp(h[1],b,!1)}},[h,b]),k=(0,pX.useMemo)(()=>{if(n)return{start:wp(n[0],b,!1),end:wp(n[1],b,!1)}},[n,b]),x=(0,pX.useMemo)(()=>wp(u??kl,b,!0),[u,b]),C=(0,pX.useMemo)(()=>wp(c,b,!0),[c,b]),E=(0,pX.useMemo)(()=>t||a,[t,a]),S=(0,pX.useMemo)(()=>(d&&p&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),d??(e=>p?.([wd(e.start),wd(e.end)]))),[d,p]);return(0,fG.jsx)(wu,{locale:y.toString(),children:(0,fG.jsx)("div",{className:fH()("cds--form-item",e),children:(0,fG.jsx)(mf,{values:[[ko,y]],children:(0,fG.jsx)(wc,{id:A?$:void 0,className:fH()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":r}),isInvalid:E,shouldForceLeadingZeros:"en"===y.language||void 0,maxValue:C,minValue:x,value:w,defaultValue:k,ref:m,isDisabled:r,...g,onChange:S,children:(0,fG.jsxs)("div",{className:"cds--date-picker-container",children:[A&&(0,fG.jsx)(Au,{className:fH()("cds--label",{"cds--label--disabled":r}),htmlFor:$,children:s??o}),(0,fG.jsxs)(v3,{className:kx.inputGroup,children:[(0,fG.jsxs)("div",{className:fH()(kx.inputsWrapper,{[kx.inputsWrapperSm]:"sm"===f,[kx.inputsWrapperMd]:"md"===f||!f||0===f.length,[kx.inputsWrapperLg]:"lg"===f}),children:[(0,fG.jsx)($4,{className:fH()("cds--date-picker-input__wrapper",kx.startInput,kx.dateInputWrapper),slot:"start",children:e=>(0,fG.jsx)(kO,{className:kx.inputSegment,segment:e})}),(0,fG.jsx)("div",{className:kx.separator,children:(0,fG.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,fG.jsx)($4,{className:fH()("cds--date-picker-input__wrapper",kx.endInput,kx.dateInputWrapper),slot:"end",children:e=>(0,fG.jsx)(kO,{className:kx.inputSegment,segment:e})})]}),(0,fG.jsx)(b4,{className:fH()(kx.flatButton,{[kx.flatButtonSm]:"sm"===f,[kx.flatButtonMd]:"md"===f||!f||0===f.length,[kx.flatButtonLg]:"lg"===f}),children:(0,fG.jsx)(kD,{})})]}),(0,fG.jsx)(Ao,{className:kx.invalidText,children:i}),(0,fG.jsx)(kE,{variant:"range",today_:v,minDate:x,maxDate:C})]})})})})})});var kI=t(89124),kN={};kN.styleTagTransform=f5(),kN.setAttributes=f0(),kN.insert=fX().bind(null,"head"),kN.domAPI=fJ(),kN.insertStyleElement=f2(),fK()(kI.A,kN);let kj=kI.A&&kI.A.locals?kI.A.locals:void 0,kR=({diagnoses:e})=>{let{diagnosisTags:n}=dH({externalModuleName:"@openmrs/esm-styleguide"});return(0,fG.jsx)("div",{className:kj.container,children:e.map(e=>{let{rank:t,uuid:i,display:r}=e,a=n[1===t?"primaryColor":"secondaryColor"];return(0,fG.jsx)(ht.vwO,{type:a,children:r},i)})})};var kF=t(87770),kL={};kL.styleTagTransform=f5(),kL.setAttributes=f0(),kL.insert=fX().bind(null,"head"),kL.domAPI=fJ(),kL.insertStyleElement=f2(),fK()(kF.A,kL);let kW=kF.A&&kF.A.locals?kF.A.locals:void 0,kV=({width:e="64",height:n="64"})=>(0,fG.jsx)("svg",{width:e,height:n,viewBox:"0 0 64 64",children:(0,fG.jsx)("use",{href:"#omrs-empty-data-illustration"})}),kG=e=>{let n="tablet"===fc(),t=e.launchForm;return(0,fG.jsx)(ht.Wdr,{className:kW.layer,children:(0,fG.jsxs)(ht.FAs,{className:kW.tile,children:[(0,fG.jsx)("div",{className:n?kW.tabletHeading:kW.desktopHeading,children:(0,fG.jsx)("h4",{children:e.headerTitle})}),(0,fG.jsx)(kV,{}),(0,fG.jsx)("p",{className:kW.content,children:ad("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,fG.jsx)("p",{className:kW.action,children:t&&(0,fG.jsx)(ht.$nd,{onClick:()=>t(),kind:"ghost",size:n?"lg":"sm",children:ad("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})};var kU=t(88480),kH={};kH.styleTagTransform=f5(),kH.setAttributes=f0(),kH.insert=fX().bind(null,"head"),kH.domAPI=fJ(),kH.insertStyleElement=f2(),fK()(kU.A,kH);let kq=kU.A&&kU.A.locals?kU.A.locals:void 0,kK=({error:e,headerTitle:n})=>{let t="tablet"===fc();return(0,fG.jsx)(ht.Wdr,{children:(0,fG.jsxs)(ht.FAs,{className:kq.tile,children:[(0,fG.jsx)("div",{className:t?kq.tabletHeading:kq.desktopHeading,children:(0,fG.jsx)("h4",{children:n})}),(0,fG.jsxs)("p",{className:kq.errorMessage,children:[ad("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,fG.jsx)("p",{className:kq.errorCopy,children:ad("errorCopy")})]})})},kY=kK;var kJ=t(15764),kZ={};kZ.styleTagTransform=f5(),kZ.setAttributes=f0(),kZ.insert=fX().bind(null,"head"),kZ.domAPI=fJ(),kZ.insertStyleElement=f2(),fK()(kJ.A,kZ);let kX=kJ.A&&kJ.A.locals?kJ.A.locals:void 0,kQ=pQ().forwardRef((e,n)=>{let{slotName:t,basePath:i,componentContext:r,state:a}=fd(),o=window.location??{pathname:""},s=p9(t??"");return e.isChildOfHeader&&t&&s.length>0?(0,fG.jsxs)(ht.f8J,{"aria-label":ad("leftNavigation","Left navigation"),className:kX.leftNav,expanded:!0,isFixedNav:!0,ref:n,...e,children:[(0,fG.jsx)(dt,{name:"global-nav-menu-slot"}),t?(0,fG.jsx)(dN,{value:r,fallback:(0,fG.jsx)(dt,{name:t,state:{basePath:i,currentPath:o,...a}}),children:(0,fG.jsx)(p0.Provider,{value:r,children:(0,fG.jsx)(dt,{name:t,state:{basePath:i,currentPath:o,...a}})})}):null]}):null});var k0=t(48500),k1={};k1.styleTagTransform=f5(),k1.setAttributes=f0(),k1.insert=fX().bind(null,"head"),k1.domAPI=fJ(),k1.insertStyleElement=f2(),fK()(k0.A,k1);let k2=k0.A&&k0.A.locals?k0.A.locals:void 0,k3=({selectedLocationUuid:e,defaultLocationUuid:n,locationTag:t,locationsPerRequest:i=50,onChange:r})=>{let[a,o]=(0,pX.useState)(""),s=(0,pX.useId)(),{location:l}=function(e){let n=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:t,error:i,isLoading:r}=dZ()(n,rd,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,pX.useMemo)(()=>({location:t?.data?.entry?t.data.entry[0]:null,error:n?i:null,isLoading:!!n&&r}),[t,r,i,n])}(n),{locations:c,isLoading:u,hasMore:p,loadingNewData:d,error:f,setPage:h}=function(e,n=0,t=""){let i=dY(t),{data:r,isLoading:a,isValidating:o,setSize:s,error:l}=fn()(function(t,r){if(r){let e=r.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let n=new URL(e.url);return n.origin===window.location.origin?e.url:new URL(`${n.pathname}${n.search?`?${n.search}`:""}`,window.location.origin).toString()}let a=`${rc}/Location?`,o=new URLSearchParams;return o.append("_summary","data"),n&&o.append("_count",""+n),t&&o.append("_getpagesoffset",""+t*n),e&&o.append("_tag",e),"string"==typeof i&&""!==i&&o.append("name:contains",i),a+o.toString()},rd);return(0,pX.useMemo)(()=>({locations:r?.length?r?.flatMap(e=>e?.data?.entry??[]):[],isLoading:a,totalResults:r?.[0]?.data?.total,hasMore:!!r?.length&&r?.[r.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:o,error:l||null,setPage:s}),[a,r,o,s,l])}(t,i,a),g=(0,pX.useMemo)(()=>l&&!a&&n?[l,...c.filter(({resource:e})=>e.id!==n)]:c??[],[l,c,n,a]),m=(0,pX.useCallback)(e=>{r(),o(e.trim())},[r]),b=fg((0,pX.useCallback)(()=>{!d&&p&&h(e=>e+1)},[d,p,h])),y=p?Math.max(0,Math.floor(g.length-i/2)):-1;return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)(ht.vji,{"aria-describedby":f?`${s}-error`:void 0,labelText:ad("searchForLocation"),id:s,placeholder:ad("searchForLocation"),onChange:e=>m(e.target.value),size:"lg"}),f&&(0,fG.jsx)("div",{className:k2.errorNotification,id:`${s}-error`,children:(0,fG.jsx)(ht.jeF,{kind:"error",subtitle:ad("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:ad("error","Error")})}),(0,fG.jsx)("div",{className:k2.searchResults,children:u?(0,fG.jsx)("div",{className:k2.loadingContainer,children:Array.from({length:5}).map((e,n)=>(0,fG.jsx)(ht.Psq,{className:k2.radioButtonSkeleton,role:"progressbar"},n))}):(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("div",{className:k2.locationResultsContainer,children:g.length>0?(0,fG.jsx)(ht.zWQ,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,n)=>(0,fG.jsx)(ht.aaP,{className:k2.locationRadioButton,id:e.resource.id,labelText:(0,fG.jsx)("span",{ref:n===y?b:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,fG.jsx)("div",{className:k2.emptyState,children:(0,fG.jsx)("p",{className:k2.locationNotFound,children:ad("noResultsToDisplay")})})}),d&&(0,fG.jsx)("div",{className:k2.loadingIcon,children:(0,fG.jsx)(ht.OuH,{description:ad("loading")})})]})})]})},k5=U("modalState",{modalContainer:null,modalStack:[]}),k4=0;async function k6(e,n,t={}){let i=pB(n),r=null;if(e){if(!i)throw Error(`No modal named '${n}' has been registered.`);let{load:a}=i,o=await a(),s=k4++;r=ic({...o,name:`${n}-${s}`},{...t,domElement:e})}else B(`Failed to launch modal. Please notify your administrator. Modal name: ${n}`);return r}let k8=window.getComputedStyle(document.body).overflow;function k7({modalStack:e,modalContainer:n}){n&&(e.length?(n.style.visibility||(addEventListener("keydown",xe),document.body.style.overflow="hidden",n.style.visibility="unset"),e.forEach((t,i)=>{switch(t.state){case"NEW":{let e=function({size:e}){let n=document.createElement("div");return n.className=`cds--modal-container cds--modal-container--${e}`,n.setAttribute("role","dialog"),n.setAttribute("tabindex","-1"),n.setAttribute("aria-modal","true"),n}({size:t.props?.size??"md"});t.container=e,k6(e,t.modalName,t.props).then(i=>{t.parcel=i,t.state="MOUNTED",n.prepend(e),e.style.visibility="unset"});break}case"MOUNTED":t.container&&(t.container.style.visibility=i?"hidden":"unset");break;case"TO_BE_DELETED":t.onClose(),t.parcel?.unmount?.(),t.container?.remove(),setTimeout(()=>{k5.setState({modalContainer:n,modalStack:e.filter(e=>e!==t)})},0)}})):(n.style.removeProperty("visibility"),document.body.style.overflow=k8,removeEventListener("keydown",xe)))}function k9(e){let n=k5.getState(),t=n.modalStack.map(n=>n===e?{...n,state:"TO_BE_DELETED"}:n);k5.setState({...n,modalStack:t})}function xe(e){"Escape"===e.key&&function(){let[e]=k5.getState().modalStack;e&&k9(e)}()}function xn(e){k5.subscribe(k7),k5.setState({...k5.getState(),modalContainer:e})}function xt(e,n={},t=()=>{}){let i=()=>{let e=k5.getState().modalStack.find(e=>e.onClose===t);e&&k9(e)};if(pB(e)){var r;let a,o;r={state:"NEW",onClose:t,modalName:e,props:{close:i,...n}},o=[r,...(a=k5.getState()).modalStack],k5.setState({...a,modalStack:o})}else B(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return i}let xi=({notification:e})=>{let{description:n,action:t,kind:i,critical:r,title:a,onAction:o}=e;return(0,fG.jsx)(ht.kZS,{actionButtonLabel:t,kind:i||"info",lowContrast:r,subtitle:n,title:a||"",inline:!0,onActionButtonClick:o})},xr=({subject:e})=>{let[n,t]=(0,pX.useState)([]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.description!==e.description||n.action!==e.action||n.kind!==e.kind||n.title!==e.title),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(xi,{notification:e},e.id))})},xa=({notification:e})=>{let{actionButtonLabel:n,onActionButtonClick:t=()=>{},subtitle:i,kind:r,title:a,critical:o,progressActionLabel:s,id:l,...c}=e,[u,p]=(0,pX.useState)(n);return(0,fG.jsx)(ht.kZS,{kind:r||"info",actionButtonLabel:u,ariaLabel:ad("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{t(),s&&p(s)},statusIconDescription:ad("actionableNotification","Actionable notification"),subtitle:i,title:a,lowContrast:o,inline:!0,...c})},xo=({subject:e})=>{let[n,t]=(0,pX.useState)([]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.subtitle!==e.subtitle||n.actionButtonLabel!==e.actionButtonLabel||n.onActionButtonClick!==e.onActionButtonClick||n.kind!==e.kind||n.title!==e.title),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(xa,{notification:e},e.id))})};var xs=t(84065),xl=Object.prototype.hasOwnProperty;let xc=function(e){if(null==e)return!0;if((0,eB.A)(e)&&((0,eT.A)(e)||"string"==typeof e||"function"==typeof e.splice||(0,eI.A)(e)||(0,ej.A)(e)||(0,eP.A)(e)))return!e.length;var n=(0,nt.A)(e);if("[object Map]"==n||"[object Set]"==n)return!e.size;if((0,ez.A)(e))return!(0,xs.A)(e).length;for(var t in e)if(xl.call(e,t))return!1;return!0},xu=new ei.Subject,xp=0,xd=new ei.Subject,xf=0;function xh(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(xr,{subject:xu}))}function xg(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&(n instanceof Error||!xc(n)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{xu.next({...e,id:xp++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function xm(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(xo,{subject:xd}))}function xb(e){var n;e&&("string"==typeof(n=e.actionButtonLabel)?n.trim().length>0:"object"==typeof n&&!xc(n))?setTimeout(()=>{xd.next({...e,id:xf++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let xy=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],x_=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"];var xv=t(4112),x$={};x$.styleTagTransform=f5(),x$.setAttributes=f0(),x$.insert=fX().bind(null,"head"),x$.domAPI=fJ(),x$.insertStyleElement=f2(),fK()(xv.A,x$);let xA=xv.A&&xv.A.locals?xv.A.locals:void 0,xw=({value:e,unit:n,label:t,interpretation:i,referenceRange:r,conceptUuid:a,variant:o="card",patientUuid:s})=>{let l=(0,pX.useId)(),{referenceRange:c,isLoading:u}=function(e,n){let t=null;e&&(t=n?`${rl}/conceptreferencerange/?patient=${n}&concept=${e}&v=full`:`${rl}/conceptreferencerange/?concept=${e}&v=full`);let{data:i,error:r,isLoading:a}=dZ()(t,rd),o=i?.data?.results?.[0];return{referenceRange:o?{hiNormal:o.hiNormal??null,hiAbsolute:o.hiAbsolute??null,hiCritical:o.hiCritical??null,lowNormal:o.lowNormal??null,lowAbsolute:o.lowAbsolute??null,lowCritical:o.lowCritical??null}:void 0,error:r,isLoading:a}}(r||i?void 0:a,s),p=r??c,d=(0,pX.useMemo)(()=>{if(i)return i?"--"===i?"normal":xy.includes(i)?i.toLowerCase():x_.includes(i)?i:"normal":void 0;if(p&&!u){if(!p||null==e||""===e)return"normal";let n="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(n)?"normal":null!==p.hiAbsolute&&void 0!==p.hiAbsolute&&n>p.hiAbsolute?"off_scale_high":null!==p.hiCritical&&void 0!==p.hiCritical&&n>=p.hiCritical?"critically_high":null!==p.hiNormal&&void 0!==p.hiNormal&&n>p.hiNormal?"high":null!==p.lowAbsolute&&void 0!==p.lowAbsolute&&n<p.lowAbsolute?"off_scale_low":null!==p.lowCritical&&void 0!==p.lowCritical&&n<=p.lowCritical?"critically_low":null!==p.lowNormal&&void 0!==p.lowNormal&&n<p.lowNormal?"low":"normal"}return"normal"},[i,p,e,u])??"normal",f="critically_low"===d||"critically_high"===d||"off_scale_low"===d||"off_scale_high"===d,h="normal"!==d,g=t?`omrs-numeric-obs-label-${t.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,m=`omrs-numeric-obs-value-${l}`,b=`omrs-numeric-obs-unit-${l}`,y=null!=e&&""!==e,v=y?e:ad("notAvailable","Not available"),$=fH()({[xA["critically-low"]]:"critically_low"===d||"off_scale_low"===d,[xA["critically-high"]]:"critically_high"===d||"off_scale_high"===d,[xA.low]:"low"===d,[xA.high]:"high"===d,[xA["off-scale-low"]]:"off_scale_low"===d,[xA["off-scale-high"]]:"off_scale_high"===d}),A=fH()({[xA.container]:!0,[xA.card]:!0,[xA["critical-value"]]:f,[xA["abnormal-value"]]:h&&!f}),w=fH()({[xA.cell]:!0,[$]:!0});return"cell"===o?(0,fG.jsxs)("div",{className:w,children:[v,y&&n?` ${n}`:""]}):(0,fG.jsxs)("section",{className:A,"data-testid":"numeric-observation-card",children:[t&&(0,fG.jsxs)("div",{className:xA["label-container"],children:[(0,fG.jsx)("span",{id:g,className:xA.label,children:t}),h&&(0,fG.jsx)("span",{className:xA[d.replace("_","-")],title:ad("abnormalValue","Abnormal value")})]}),(0,fG.jsxs)("div",{className:xA["value-container"],children:[(0,fG.jsx)("span",{id:m,"aria-labelledby":g&&b?`${g} ${b}`:g||b||void 0,className:xA.value,children:v}),y&&n&&(0,fG.jsx)("span",{id:b,className:xA.units,children:n})]})]})};var xk=t(292),xx={};xx.styleTagTransform=f5(),xx.setAttributes=f0(),xx.insert=fX().bind(null,"head"),xx.domAPI=fJ(),xx.insertStyleElement=f2(),fK()(xk.A,xx);let xC=xk.A&&xk.A.locals?xk.A.locals:void 0,xE=e=>{if("children"in e){let{children:n,className:t,...i}=e;return(0,fG.jsx)("div",{className:fH()(xC.pageHeader,t),...i,children:n})}{let{title:n,illustration:t,className:i,...r}=e;return(0,fG.jsx)("div",{className:fH()(xC.pageHeader,i),...r,children:(0,fG.jsx)(xS,{title:n,illustration:t})})}},xS=({title:e,illustration:n,className:t})=>{let[i,r]=(0,pX.useState)(null);return(0,pX.useEffect)(()=>{te("@openmrs/esm-styleguide").then(e=>{r(e)})},[]),(0,fG.jsxs)("div",{className:fH()(xC.pageHeaderContent,t),children:[n,(0,fG.jsxs)("div",{className:xC.pageLabels,children:[i?.implementationName&&(0,fG.jsx)("p",{children:ad(i.implementationName)}),(0,fG.jsx)("p",{className:xC.pageName,children:e})]})]})};var xD=t(72886),xM={};xM.styleTagTransform=f5(),xM.setAttributes=f0(),xM.insert=fX().bind(null,"head"),xM.domAPI=fJ(),xM.insertStyleElement=f2(),fK()(xD.A,xM);let xz=xD.A&&xD.A.locals?xD.A.locals:void 0,xO=({totalItems:e,pageSize:n,onPageNumberChange:t,pageNumber:i,dashboardLinkUrl:r,currentItems:a,dashboardLinkLabel:o})=>{let{pageSizes:s,pageItemsCount:l}=fy(n,e,i,a),c="tablet"===fc(),u=ad("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,fG.jsx)(fG.Fragment,{children:e>0&&(0,fG.jsxs)("div",{className:fH()({[xz.tablet]:c,[xz.desktop]:!c}),children:[(0,fG.jsxs)("div",{children:[u,r&&(0,fG.jsx)(p1,{to:r,className:xz.configurableLink,children:o??ad("seeAll","See all")})]}),(0,fG.jsx)(ht.dKS,{className:xz.pagination,page:i,pageSize:n,pageSizes:s,totalItems:e,onChange:t,pageRangeText:(e,n)=>ad("paginationOfPages","of {{count}} pages",{count:n}),size:c?"lg":"sm"})]})})};function xP(e){return xB(xN(e,"usual","official"))}function xT(e){return xP(e)}function xB(e){var n;let t;return e?e.text??(t=(n=e).given??[],(n.family?t.concat(n.family):t).join(" ")):""}function xI(e){return xB(e)}function xN(e,...n){for(let t of(0==n.length&&(n=["usual"]),n)){let n=e.name?.find(e=>{var n,i;return n=e,i=t,n.use?n.use===i:"usual"===i});if(n)return n}}function xj(e,n=fx()){let t=fx(n),i=w9(e,t);if(null==i)return null;let r=t.diff(i,"hours"),a=t.diff(i,"days"),o=t.diff(i,"weeks"),s=t.diff(i,"months"),l=t.diff(i,"years"),c={};if(r<2)c.minutes=t.diff(i,"minutes");else if(a<2)c.hours=r;else if(o<4)c.days=a;else if(l<1){let e=t.subtract(o,"weeks").diff(i,"days");c.weeks=o,c.days=e}else if(l<2){let e=t.subtract(s,"months").diff(i,"days");c.months=s,c.days=e}else if(l<18){let e=t.subtract(l,"year").diff(i,"months");c.years=l,c.months=e}else c.years=l;return c}function xR(e,n=fx()){let t=xj(e,n);if(null==t)return null;let i={style:"short",localeMatcher:"lookup"};return"minutes"in t&&0===t.minutes&&(i.minutesDisplay="always"),w7(t,i)}var xF=t(46010),xL={};xL.styleTagTransform=f5(),xL.setAttributes=f0(),xL.insert=fX().bind(null,"head"),xL.domAPI=fJ(),xL.insertStyleElement=f2(),fK()(xF.A,xL);let xW=xF.A&&xF.A.locals?xF.A.locals:void 0;function xV({showIdentifierLabel:e,type:n,value:t}){return(0,fG.jsx)("span",{className:xW.primaryIdentifier,children:(0,fG.jsxs)(ht.vwO,{className:xW.tag,type:"gray",children:[e&&n?.text&&(0,fG.jsxs)("span",{className:xW.label,children:[n.text,": "]}),(0,fG.jsx)("span",{className:xW.value,children:t})]})})}function xG({showIdentifierLabel:e,type:n,value:t}){return(0,fG.jsxs)(ht.lRv,{className:xW.secondaryIdentifier,id:`patient-banner-identifier-${t}`,children:[e&&(0,fG.jsxs)("span",{className:xW.label,children:[n?.text,": "]}),(0,fG.jsx)("span",{className:xW.value,children:t})]})}function xU({identifiers:e,showIdentifierLabel:n}){let{excludePatientIdentifierCodeTypes:t}=dH(),{primaryIdentifierCode:i}=f$(),r=e?.filter(e=>{let n=e.type?.coding?.[0]?.code;return n&&!t?.uuids.includes(n)})??[];return(0,fG.jsx)(fG.Fragment,{children:r?.length?r.map(({value:e,type:t},a)=>(0,fG.jsxs)(pQ().Fragment,{children:[(0,fG.jsx)("span",{className:xW.identifier,children:t?.coding?.[0]?.code===i?(0,fG.jsx)(xV,{showIdentifierLabel:n,type:t,value:e}):(0,fG.jsx)(xG,{showIdentifierLabel:n,type:t,value:e})}),a<r.length-1&&(0,fG.jsx)("span",{className:xW.separator,children:"\xb7"})]},e)):""})}let xH={Female:hJ,Male:hZ,Other:hX,Unknown:hQ},xq=({gender:e})=>{let n=xH[e];return n?(0,fG.jsx)(n,{fill:"#525252"}):null},xK={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function xY({patient:e,renderedFrom:n}){var t;let i,r,a=xP(e),o=e?.gender&&(r=xK[i=(t=e.gender).toLowerCase()]??"Unknown",{displayText:ad(i,t),iconKey:r}),s=(0,pX.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:n}),[e.id,e,n]);return(0,fG.jsxs)("div",{className:xW.patientInfo,children:[(0,fG.jsx)("div",{className:fH()(xW.row,xW.patientNameRow),children:(0,fG.jsxs)("div",{className:xW.flexRow,children:[(0,fG.jsx)("span",{className:xW.patientName,children:a}),o&&(0,fG.jsxs)("div",{className:xW.gender,children:[(0,fG.jsx)(xq,{gender:o.iconKey}),(0,fG.jsx)("span",{children:o.displayText})]}),(0,fG.jsx)(dt,{className:xW.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,fG.jsxs)("div",{className:xW.demographics,children:[e.birthDate&&(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("span",{children:xR(e.birthDate)}),(0,fG.jsx)("span",{className:xW.separator,children:"\xb7"}),(0,fG.jsx)("span",{children:w2(e.birthDate,{time:!1})}),(0,fG.jsx)("span",{className:xW.separator,children:"\xb7"})]}),(0,fG.jsx)(xU,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,fG.jsx)(dt,{className:xW.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var xJ=t(81673),xZ=t(9102),xX={};xX.styleTagTransform=f5(),xX.setAttributes=f0(),xX.insert=fX().bind(null,"head"),xX.domAPI=fJ(),xX.insertStyleElement=f2(),fK()(xZ.A,xX);let xQ=xZ.A&&xZ.A.locals?xZ.A.locals:void 0;function x0({patient:e,patientUuid:n,actionsSlotName:t,additionalActionsSlotState:i}){let[r,a]=(0,pX.useState)(!1),{extensions:o}=de(t),s="tablet"===fc(),l=fh(()=>a(!1),r),c=(0,pX.useRef)(null),u=(0,pX.useRef)(null),p=(0,pX.useId)(),d=`patient-actions-menu-trigger-${p}`,f=`patient-actions-menu-${p}`,h=(0,pX.useCallback)(()=>a(e=>!e),[]),g=(0,pX.useCallback)(()=>{a(!1),c.current?.focus()},[]),m=(0,pX.useCallback)(e=>{if("Escape"===e.key&&r){e.stopPropagation(),g();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&r){e.preventDefault();let n=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let t=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,i=Array.from(n).indexOf(t);if(-1===i)return void n["ArrowDown"===e.key?0:n.length-1]?.focus();let r=i+("ArrowDown"===e.key?1:-1),a=r<0?n.length-1:r>=n.length?0:r;n[a]?.focus()}},[g,r]);(0,pX.useEffect)(()=>{if(r&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[r]);let b=(0,pX.useMemo)(()=>({patientUuid:n,patient:e,closeMenu:g,...i}),[n,e,g,i]);return 0===o.length?null:(0,fG.jsx)("div",{className:xQ.overflowMenuContainer,children:(0,fG.jsxs)("div",{"data-overflow-menu":!0,className:fH()("cds--overflow-menu",hs.container),ref:l,children:[(0,fG.jsxs)("button",{className:fH()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},hs.overflowMenuButton),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:d,onClick:h,onKeyDown:m,ref:c,children:[(0,fG.jsx)("span",{className:xQ.actionsButtonText,children:ad("actions","Actions")})," ",(0,fG.jsx)(xJ.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,fG.jsxs)("div",{className:fH()("cds--overflow-menu-options","cds--overflow-menu--flip",hs.menu,{[hs.show]:r}),"aria-labelledby":d,"data-floating-menu-direction":"bottom",id:f,onKeyDown:m,ref:u,role:"menu",tabIndex:-1,children:[(0,fG.jsx)("ul",{className:fH()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,fG.jsx)(dt,{name:t,state:b},t)}),(0,fG.jsx)("span",{})]})]})})}var x1=t(16767),x2=t.n(x1);function x3(e){let{patientPhotoConceptUuid:n}=dH({externalModuleName:"@openmrs/esm-styleguide"}),t=n?`${rl}/obs?patient=${e}&concept=${n}&v=full`:null,{data:i,error:r,isLoading:a}=(0,d_.Ay)(e?t:null,rd),o=i?.data?.results[0];return{data:o?{dateTime:o?.obsDatetime,imageSrc:o?.value?.links?.uri}:null,error:r,isLoading:a}}let x5=({width:e=56,height:n=56,"aria-label":t})=>{let{t:i}=(0,dy.useTranslation)();return(0,fG.jsxs)("svg",{"aria-label":t??i("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:n,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,fG.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,fG.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"})]})};var x4=t(27268),x6={};x6.styleTagTransform=f5(),x6.setAttributes=f0(),x6.insert=fX().bind(null,"head"),x6.domAPI=fJ(),x6.insertStyleElement=f2(),fK()(x4.A,x6);let x8=x4.A&&x4.A.locals?x4.A.locals:void 0;function x7({patientUuid:e,patientName:n,alt:t}){let{data:i,isLoading:r}=x3(e),[a,o]=(0,pX.useState)(null),[s,l]=(0,pX.useState)(!1),c=(0,pX.useMemo)(()=>x2().generate(e),[e]);(0,pX.useEffect)(()=>{if(i?.imageSrc){let e=new URL(i.imageSrc,window.location.origin).pathname;l(!0);let n=!1,t=new Image;return t.onload=()=>{n||(o(e),l(!1))},t.onerror=()=>{n||(o(null),l(!1))},t.src=e,()=>{n=!0}}o(null),l(!1)},[i?.imageSrc]);let u=(0,pX.useMemo)(()=>t||(a?ad("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:n}):ad("patientAvatarAlt","Avatar for {{patientName}}",{patientName:n})),[t,a,n]);return r||s?(0,fG.jsx)(ht.ryE,{className:x8.skeleton,"data-testid":"skeleton-icon"}):i?.imageSrc&&!a?(0,fG.jsx)(x5,{"aria-label":ad("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:n})}):a?(0,fG.jsx)("div",{"aria-label":u,children:(0,fG.jsx)("img",{className:x8.avatar,src:a,alt:u,title:n})}):(0,fG.jsx)("div",{"aria-label":u,children:(0,fG.jsx)("div",{className:x8.avatar,title:n,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,fG.jsx)("span",{className:x8.initials,children:function(e,n=3){return e.split(/\s+/).filter(Boolean).slice(0,n).map(e=>e[0]).join("")}(n)})})})}var x9=t(1636),Ce={};Ce.styleTagTransform=f5(),Ce.setAttributes=f0(),Ce.insert=fX().bind(null,"head"),Ce.domAPI=fJ(),Ce.insertStyleElement=f2(),fK()(x9.A,Ce);let Cn=x9.A&&x9.A.locals?x9.A.locals:void 0,Ct=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-ct-scan","omrs-pict-dentistry","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-obstetrics","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],Ci=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-appointments",pictogramProps:e})})),Cr=Ci,Ca=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),Co=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),Cs=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),Cl=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),Cc=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),Cu=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),Cp=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),Cd=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-facility",pictogramProps:e})})),Cf=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),Ch=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),Cg=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),Cm=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),Cb=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),Cy=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),C_=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),Cv=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-patients",pictogramProps:e})})),C$=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),CA=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),Cw=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),Ck=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-registration",pictogramProps:e})})),Cx=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),CC=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),CE=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-transfer",pictogramProps:e})})),CS=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-triage",pictogramProps:e})})),CD=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),CM=Cd,Cz=Cv,CO=(0,pX.memo)((0,pX.forwardRef)(function({pictogram:e,fallback:n,...t},i){let r=(0,pX.useRef)(document.getElementById(e));return(0,pX.useEffect)(()=>{let n=document.getElementById("omrs-svgs-container"),t=new MutationObserver(n=>{for(let t of n)"childList"===t.type&&(r.current=document.getElementById(e))});return n&&t.observe(n,{childList:!0}),()=>t.disconnect()},[e]),(0,fG.jsx)(dN,{value:r.current,fallback:n,children:(0,fG.jsx)(CP,{ref:i,pictogram:e,pictogramProps:t})})})),CP=(0,pX.memo)((0,pX.forwardRef)(function({pictogram:e,pictogramProps:n},t){let{className:i,size:r}=Object.assign({},{size:92},n);return(r<=26||r>144)&&(console.error(`Invalid size '${r}' specified for ${e}. Defaulting to 92.`),r=92),(0,fG.jsx)("svg",{ref:t,className:fH()(Cn.pictogram,i),height:r,width:r,children:(0,fG.jsx)("use",{href:`#${e}`})})})),CT=({children:e})=>"tablet"===fc()?(0,fG.jsx)(ht.Wdr,{children:e}):(0,fG.jsx)(fG.Fragment,{children:e});var CB=t(85925),CI={};CI.styleTagTransform=f5(),CI.setAttributes=f0(),CI.insert=fX().bind(null,"head"),CI.domAPI=fJ(),CI.insertStyleElement=f2(),fK()(CB.A,CI);let CN=CB.A&&CB.A.locals?CB.A.locals:void 0,Cj=({snackbar:e,closeSnackbar:n})=>{let{actionButtonLabel:t="",kind:i="success",onActionButtonClick:r=()=>{},isLowContrast:a="error"!==i,progressActionLabel:o,subtitle:s="",timeoutInMs:l=5e3,autoClose:c="error"!==i,title:u,id:p,...d}=e,[f,h]=(0,pX.useState)(t),[g,m]=(0,pX.useState)(!0),[b,y]=(0,pX.useState)(!1),v=(0,pX.useCallback)(()=>{setTimeout(n,250)},[n]),$=(0,pX.useCallback)(()=>{y(!0),v()},[v]);return(0,pX.useEffect)(()=>{if(c){let e=setTimeout($,l);return()=>clearTimeout(e)}},[l,c,$]),(0,pX.useEffect)(()=>{m(!1),window.setTimeout(()=>{m(!0)},0)},[]),(0,fG.jsx)(ht.kZS,{actionButtonLabel:f,"aria-label":ad("closeSnackbar","Close snackbar"),className:fH()(CN.slideIn,{[CN.animated]:g,[CN.slideOut]:b}),kind:i,lowContrast:a,onActionButtonClick:()=>{r(),$(),o&&h(o)},onClose:v,statusIconDescription:ad("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...d})},CR=({subject:e})=>{let[n,t]=(0,pX.useState)([]),i=(0,pX.useCallback)(e=>{t(n=>n.filter(n=>n!==e))},[]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.subtitle!==e.subtitle||n.actionButtonLabel!==e.actionButtonLabel||n.onActionButtonClick!==e.onActionButtonClick||n.kind!==e.kind||n.title!==e.title),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(Cj,{snackbar:e,closeSnackbar:()=>i(e)},e.id))})},CF=new ei.Subject,CL=0;function CW(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(CR,{subject:CF}))}function CV(e){var n;e&&"string"==typeof(n=e.title)&&n.trim().length>0?setTimeout(()=>{CF.next({...e,id:CL++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let CG=({toast:e,closeToast:n})=>{let{description:t,kind:i,critical:r,title:a,actionButtonLabel:o,onActionButtonClick:s=()=>{}}=e,l=(0,pX.useCallback)(()=>{s(),n()},[n,s]);return(0,fG.jsx)("div",{children:(0,fG.jsx)(ht.kZS,{actionButtonLabel:o,kind:i||"info",lowContrast:r,subtitle:t,title:a||"",onActionButtonClick:l,onClose:n})})},CU=({subject:e})=>{let[n,t]=(0,pX.useState)([]),i=(0,pX.useCallback)(e=>{t(n=>n.filter(n=>n!==e))},[]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.description!==e.description||n.kind!==e.kind||n.title!==e.title||n.actionButtonLabel!==e.actionButtonLabel||n.onActionButtonClick!==e.onActionButtonClick),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(CG,{toast:e,closeToast:()=>i(e)},e.id))})},CH=new ei.Subject,Cq=0;function CK(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(CU,{subject:CH}))}function CY(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&!xc(n))?setTimeout(()=>{CH.next({...e,id:Cq++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}function CJ(e,n=!1){if(n)return!0;let t=C1[e];return!t||!t()}function CZ(e,n){let t=C9.getState()?.workspaceGroup,i=t?.name;i&&e===i&&Ei(()=>{let i=El(e);i&&(i.setState({},!0),i.subscribe(()=>{})()),"function"==typeof t?.cleanup&&t.cleanup(),C9.setState(e=>({...e,workspaceGroup:void 0})),"function"==typeof n&&n()},i?e=>e.currentWorkspaceGroup===i:()=>!0)}function CX(e,n){let{name:t,additionalProps:i}=n;pL(t);let r=()=>{C6(e.name,{ignoreChanges:!0,onWorkspaceClose:()=>CQ(t,i),closeWorkspaceGroup:!1})};CJ(e.name)?r():Ea("closing-workspace-launching-new-workspace",r,e.title??e.name)}function CQ(e,n){let t=pL(e),i=C9.getState().workspaceGroup;if(i&&!i.members?.includes(e))return void CZ(i.name,()=>{CQ(e,n)});let r=C9.getState().workspaceGroup?.name,a={...t,title:Eo(t,n),closeWorkspace:(n={})=>C6(e,n),closeWorkspaceWithSavedChanges:n=>C6(e,{ignoreChanges:!0,...n}),promptBeforeClosing:n=>{var t,i;return t=e,i=n,void(C1[t]=i)},setTitle:(n,t)=>{a.title=n,a.titleNode=t,C9.setState(n=>{let t=n.openWorkspaces.map(n=>n.name===e?a:n);return{...n,openWorkspaces:t}})},currentWorkspaceGroup:r,additionalProps:n??{}};function o(e,n){C9.setState(t=>{let i=[e,...n??t.openWorkspaces],r=Et(e);return{...t,openWorkspaces:i,workspaceWindowState:r}})}r&&El(r,n);let s=C9.getState().openWorkspaces,l=s.findIndex(n=>n.name===e),c=s.find(e=>e.type==a.type);if(0===s.length)o(a);else if(s[0].canHide||0===l)if(l>=0){let n=s[l];o({...n,additionalProps:a.additionalProps,...n.title===Eo(n,n.additionalProps)&&{title:Eo(a,a.additionalProps)}},s.filter(n=>n.name!=e))}else c?(o(c,C9.getState().openWorkspaces.filter(e=>e.type!=a.type)),CX(c,{name:e,additionalProps:n})):o(a);else CX(s[0],{name:e,additionalProps:n})}function C0({targetUrl:e,contextKey:n,workspaceName:t,additionalProps:i}){C8(n),CQ(t,i),i7({to:e})}let C1={};function C2(e,n){C1[e]=n}function C3(e){return C1[e]}function C5(){let e=C9.getState();C9.setState({...e,prompt:null})}let C4={ignoreChanges:!1,onWorkspaceClose:()=>{},closeWorkspaceGroup:!0};function C6(e,n={}){n={...C4,...n};let t=()=>{let t=C9.getState();t.openWorkspaces.find(n=>n.name===e);let i=t.openWorkspaces.filter(n=>n.name!=e),r=C9.getState().workspaceGroup?.name;r&&n.closeWorkspaceGroup&&CZ(r),C1[e]=()=>!1,C9.setState(e=>({...e,prompt:null,openWorkspaces:i,workspaceWindowState:Et(i?.[0])})),n?.onWorkspaceClose?.()};return CJ(e,n?.ignoreChanges)?(t(),!0):(Ea("closing-workspace",t,pL(e).title??e),!1)}function C8(e){C9.getState().context!=e&&C9.setState({context:e,openWorkspaces:[],prompt:null})}let C7={context:"",openWorkspaces:[],prompt:null,workspaceWindowState:"normal",workspaceGroup:void 0},C9=U("workspace",C7);function Ee(){return C9}function En(e){let n=C9.getState();C9.setState({...n,workspaceWindowState:e})}function Et(e){return e?.preferredWindowSize??"normal"}function Ei(e=()=>{},n=()=>!0){let t=C9.getState().openWorkspaces.filter(n).every(({name:e})=>CJ(e)),i=()=>{Es(),e?.()};t?i():Ea("closing-all-workspaces",i)}function Er(){let{workspaceWindowState:e,openWorkspaces:n,prompt:t,workspaceGroup:i}=p4(C9);return(0,pX.useMemo)(()=>({active:n.length>0,prompt:t,workspaceWindowState:e,workspaces:n,workspaceGroup:i}),[n,e,t,i])}function Ea(e,n=()=>{},t=""){let i;switch(e){case"closing-workspace":i={title:ad("unsavedChangesTitleText","Unsaved changes"),body:ad("unsavedChangesInOpenedWorkspace","You may have unsaved changes in the opened workspace. Do you want to discard these changes?"),onConfirm:()=>{n?.()},confirmText:ad("discard","Discard")};break;case"closing-all-workspaces":{let e=C9.getState().openWorkspaces.filter(({name:e})=>!CJ(e)).map(({title:e},n)=>`${n+1}. ${e}`);i={title:ad("closingAllWorkspacesPromptTitle","You have unsaved changes"),body:ad("closingAllWorkspacesPromptBody","There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",{workspaceNames:e.join(",")}),onConfirm:()=>{n?.()},confirmText:ad("closeAllOpenedWorkspaces","Discard changes in {{count}} workspaces",{count:e.length})};break}case"closing-workspace-launching-new-workspace":i={title:ad("unsavedChangesTitleText","Unsaved changes"),body:ad("unsavedChangesInWorkspace",'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',{workspaceName:t}),onConfirm:()=>{C9.setState(e=>({...e,prompt:null})),n?.()},confirmText:ad("openAnyway","Open anyway")};break;default:console.error(`Workspace system trying to open unknown prompt type "${e}" in function "showWorkspacePrompts"`),n?.();return}C9.setState(e=>({...e,prompt:i}))}function Eo(e,n){return n?.workspaceTitle??e.title}function Es(){C9.setState(C7)}function El(e,n={}){if(!e||"default"===e)return;let t=q(e,{});return n&&t.setState(e=>({...e,...n})),t}var Ec=t(81341),Eu={};Eu.styleTagTransform=f5(),Eu.setAttributes=f0(),Eu.insert=fX().bind(null,"head"),Eu.domAPI=fJ(),Eu.insertStyleElement=f2(),fK()(Ec.A,Eu);let Ep=Ec.A&&Ec.A.locals?Ec.A.locals:void 0;function Ed({getIcon:e,formOpenInTheBackground:n,tagContent:t}){return(0,fG.jsxs)(fG.Fragment,{children:[e({size:16}),n?(0,fG.jsx)("span",{className:Ep.interruptedTag,children:"!"}):(0,fG.jsx)("span",{className:Ep.countTag,children:t})]})}let Ef=({getIcon:e,label:n,iconDescription:t,handler:i,type:r,tagContent:a})=>{let o=fc(),{workspaces:s,workspaceWindowState:l}=Er(),c=s?.findIndex(({type:e})=>e===r)??-1,u="hidden"!==l&&0===c,p=c>0||0===c&&"hidden"===l;return"tablet"===o||"phone"===o?(0,fG.jsxs)(ht.$nd,{className:fH()(Ep.container,{[Ep.active]:u}),iconDescription:t,kind:"ghost",onClick:i,role:"button",tabIndex:0,size:"md",children:[(0,fG.jsx)("span",{className:Ep.elementContainer,children:(0,fG.jsx)(Ed,{formOpenInTheBackground:p,getIcon:e,tagContent:a})}),(0,fG.jsx)("span",{children:n})]}):(0,fG.jsx)(ht.K0,{align:"left","aria-label":t,className:fH()(Ep.container,{[Ep.active]:u}),enterDelayMs:300,kind:"ghost",label:n,onClick:i,size:"md",children:(0,fG.jsx)("div",{className:Ep.elementContainer,children:(0,fG.jsx)(Ed,{formOpenInTheBackground:p,getIcon:e,tagContent:a})})})};var Eh=t(54535),Eg=t(40771),Em=t(24898),Eb=/[\\^$.*+?()[\]{}|]/g,Ey=RegExp(Eb.source);let E_=function(e){return(e=(0,Em.A)(e))&&Ey.test(e)?e.replace(Eb,"\\$&"):e};var Ev=t(37781),E$={};E$.styleTagTransform=f5(),E$.setAttributes=f0(),E$.insert=fX().bind(null,"head"),E$.domAPI=fJ(),E$.insertStyleElement=f2(),fK()(Ev.A,E$);let EA=Ev.A&&Ev.A.locals?Ev.A.locals:void 0;function Ew({contextKey:e}){let{prompt:n}=Er();return(0,pX.useEffect)(()=>{RegExp(`/${E_(e)}(/|$)`).test(window.location.pathname)||console.warn(`WorkspaceContainer has provided an invalid context key: "${e}". The context key must be part of the URL path, with no initial or trailing slash.`)},[]),(0,pX.useEffect)(()=>(C8(e),()=>{C8(null)}),[e]),(0,pX.useEffect)(()=>{let n=n=>{let{detail:{cancelNavigation:t,newUrl:i}}=n,r=RegExp(`/${E_(e)}(/|$)`),a=new URL(i),o=r.test(a.pathname),s=C9.getState().openWorkspaces.every(({name:e})=>CJ(e));o||(s?Es():(t?.(),Ei(()=>{i7({to:i})})))};return window.addEventListener("single-spa:before-routing-event",n),()=>{window.removeEventListener("single-spa:before-routing-event",n)}},[]),null!=n?(0,fG.jsxs)(ht.KXP,{open:!0,onClose:C5,children:[(0,fG.jsx)(ht.rQ0,{title:n.title}),(0,fG.jsx)(ht.cwr,{children:(0,fG.jsx)("p",{className:EA.messageBody,children:n.body})}),(0,fG.jsxs)(ht.jlY,{children:[(0,fG.jsx)(ht.$nd,{kind:"secondary",onClick:C5,children:n.cancelText??ad("cancel")}),(0,fG.jsx)(ht.$nd,{kind:"danger",onClick:n.onConfirm,children:n.confirmText??ad("confirm")})]})]}):null}function Ek(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Ex(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ek(Object(t),!0).forEach(function(n){EE(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ek(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function EC(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function EE(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ES(e){return(ES=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ED(e,n){return(ED=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function EM(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Ez=function(e){var n=pX.Component;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),n&&ED(o,n);var t,i,r,a=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=ES(o);e=t?Reflect.construct(n,arguments,ES(this).constructor):n.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return EM(this)});function o(e){var n;if(function(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}(this,o),EE(EM(n=a.call(this,e)),"handleRef",function(e){n.el=e}),EE(EM(n),"addThingToDo",function(e,t){n.state.hasError&&"unmount"!==e||(n.nextThingToDo=(n.nextThingToDo||Promise.resolve()).then(function(){if(!n.unmounted||"unmount"===e)return t.apply(void 0,arguments)}).catch(function(t){throw n.nextThingToDo=Promise.resolve(),n.setState({hasError:!0}),t&&t.message&&(t.message="During '".concat(e,"', parcel threw an error: ").concat(t.message)),n.props.handleError?n.props.handleError(t):setTimeout(function(){throw t}),t}))}),EE(EM(n),"getParcelProps",function(){var e=Ex(Ex({},n.props),{},{domElement:n.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),n.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return n}return i=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var n,t=e.props.mountParcel||e.mountParcel;if(!t)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?n=e.el:(e.createdDomElement=n=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(t){n.style[t]=e.props.wrapStyle[t]}),e.props.appendTo.appendChild(n)),e.parcel=t(e.props.config,Ex({domElement:n},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return du&&du.Consumer?pX.createElement(du.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):null;var n=du&&du.Consumer?pX.createElement(du.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):void 0;return pX.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},n)}}],EC(o.prototype,i),r&&EC(o,r),o}();EE(Ez,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var EO=t(57515),EP={};EP.styleTagTransform=f5(),EP.setAttributes=f0(),EP.insert=fX().bind(null,"head"),EP.domAPI=fJ(),EP.insertStyleElement=f2(),fK()(EO.A,EP);let ET=EO.A&&EO.A.locals?EO.A.locals:void 0;function EB({workspace:e,additionalPropsFromPage:n}){let[t,i]=(0,pX.useState)(),r=function(e){let[n,t]=(0,pX.useState)({}),[i,r]=(0,pX.useState)(e);return(0,pX.useEffect)(()=>{i!==e&&r(e)},[e]),(0,pX.useEffect)(()=>{let e,n=El(i);return n&&(t(n.getState()),e=n.subscribe(t)),()=>{n&&e?.()}},[i]),n}(e.currentWorkspaceGroup);(0,pX.useEffect)(()=>{let n=!0;return e.load().then(e=>{n&&i(e)}),()=>{n=!1}},[e]);let a=(0,pX.useMemo)(()=>e&&{closeWorkspace:e.closeWorkspace,closeWorkspaceWithSavedChanges:e.closeWorkspaceWithSavedChanges,promptBeforeClosing:e.promptBeforeClosing,setTitle:e.setTitle,...n,...r,...e.additionalProps},[e,n,r]);return t?(0,fG.jsx)(Ez,{config:t,mountParcel:ic,...a},e.name):(0,fG.jsx)(ht.OuH,{className:ET.loader,description:`${ad("loading","Loading")} ...`})}var EI=t(24646),EN={};EN.styleTagTransform=f5(),EN.setAttributes=f0(),EN.insert=fX().bind(null,"head"),EN.domAPI=fJ(),EN.insertStyleElement=f2(),fK()(EI.A,EN);let Ej=EI.A&&EI.A.locals?EI.A.locals:void 0;function ER({isWithinWorkspace:e,name:n,actionMenuProps:t={}}){let[i,r]=(0,pX.useState)(!1),a=(0,pX.useRef)(window.innerHeight),{featureName:o}=(0,pX.useContext)(p0),s=fc();(0,pX.useEffect)(()=>{let e=()=>{r(!fu(s)&&a.current>window.innerHeight),a.current!=window.innerHeight&&(a.current=window.innerHeight)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[a]);let l=`action-menu-${n&&"default"!=n?n:o}-items-slot`;return(0,fG.jsx)("aside",{className:fH()(Ej.sideRail,{[Ej.withinWorkspace]:e,[Ej.sideRailHidden]:i,[Ej.sideRailVisible]:!i}),children:(0,fG.jsx)("div",{className:Ej.container,children:(0,fG.jsx)(dt,{className:Ej.chartExtensions,name:l,state:t})})})}function EF({contextKey:e,overlay:n,showSiderailAndBottomNav:t,additionalWorkspaceProps:i,actionMenuProps:r}){let a=fc(),{workspaces:o,workspaceWindowState:s,workspaceGroup:l}=Er(),c=l?.name,u=o[0],p="hidden"===s||null==u,d=u?.width??(n?"wider":"narrow"),f=(0,pX.useMemo)(()=>t||c&&!p,[c,p,t]);return dV(!p&&!fu(a)),(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsxs)("div",{className:t?ET.workspaceContainerWithActionMenu:ET.workspaceContainerWithoutActionMenu,children:[(0,fG.jsx)("aside",{className:fH()(n?ET.workspaceOverlayOuterContainer:ET.workspaceWindowSpacer,{[ET.hiddenRelative]:p,[ET.narrowWorkspace]:"narrow"===d,[ET.widerWorkspace]:"wider"===d,[ET.extraWideWorkspace]:"extra-wide"===d}),children:(0,fG.jsx)("div",{className:fH()(ET.workspaceFixedContainer,{[ET.maximizedWindow]:"maximized"===s,[ET.hiddenFixed]:p}),children:o.map((e,n)=>(0,fG.jsx)("div",{className:fH()(ET.workspaceInnerContainer,{[ET.hiddenExtraWorkspace]:0!==n}),children:(0,fG.jsx)(pX.Suspense,{fallback:null,children:(0,fG.jsx)(dy.I18nextProvider,{i18n:window.i18next,defaultNS:e.moduleName,children:(0,fG.jsx)(EL,{workspaceInstance:e,additionalWorkspaceProps:i})})})},`workspace-container-${e?e.name:`empty-${n}`}`))})}),(0,fG.jsx)(Ew,{contextKey:e})]}),f&&(0,fG.jsx)(ER,{name:c,isWithinWorkspace:!t,actionMenuProps:r})]})}function EL({workspaceInstance:e,additionalWorkspaceProps:n}){let{t}=(0,dy.useTranslation)(),i=fc(),{workspaceWindowState:r,workspaceGroup:a}=Er(),o=a?.name,s="maximized"===r;(0,pX.useEffect)(()=>{let n=t(e.title);n!==e.title&&e.setTitle(n)},[e.title,t,e.setTitle]);let{featureName:l}=(0,pX.useContext)(p0),c=(0,pX.useCallback)(()=>{En(s?"normal":"maximized")},[s]),{canHide:u=!1,canMaximize:p=!1,currentWorkspaceGroup:d="",closeWorkspace:f}=(0,pX.useMemo)(()=>e??{},[e]),h=(0,pX.useMemo)(()=>({...n,...e?.additionalProps}),[n,e]);return e&&(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsxs)(ht.Y9Y,{"aria-label":ad("workspaceHeader","Workspace Header"),className:ET.header,children:[!fu(i)&&!u&&(0,fG.jsx)(ht.dJ2,{"aria-label":ad("close","Close"),renderMenuIcon:(0,fG.jsx)(h$,{}),onClick:()=>f()}),(0,fG.jsx)(ht.bCw,{prefix:"",children:e.titleNode??t(e.title)}),(0,fG.jsx)("div",{className:ET.overlayHeaderSpacer}),(0,fG.jsxs)(ht.wdv,{className:ET.headerButtons,children:[(0,fG.jsx)(dt,{name:`workspace-header-group-${e.currentWorkspaceGroup}-slot`,state:h}),(0,fG.jsx)(dt,{name:`workspace-header-type-${e.type}-slot`,state:h}),(0,fG.jsx)(dt,{name:`workspace-header-${l}-slot`,state:h}),fu(i)&&(0,fG.jsxs)(fG.Fragment,{children:[(p||s)&&(0,fG.jsx)(ht.V8d,{"aria-label":s?ad("minimize","Minimize"):ad("maximize","Maximize"),onClick:c,children:s?(0,fG.jsx)(Eh.Xj,{}):(0,fG.jsx)(Eh.hz,{})}),u&&!o?(0,fG.jsx)(ht.V8d,{"aria-label":ad("hide","Hide"),onClick:()=>En("hidden"),children:(0,fG.jsx)(hA,{})}):(0,fG.jsx)(ht.V8d,{"aria-label":ad("close","Close"),onClick:()=>f?.(),children:(0,fG.jsx)(hF,{})})]}),"tablet"===i&&u&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("close","Close"),onClick:()=>f?.(),children:(0,fG.jsx)(Eg.d3,{})})]})]}),(0,fG.jsx)("div",{className:fH()(ET.workspaceContent,{[ET.marginWorkspaceContent]:!!d}),children:(0,fG.jsx)(EB,{workspace:e,additionalPropsFromPage:n},e.name)})]})}async function EW(e,n){let{openedGroup:t}=pV.getState();if(t){if(t.groupName===e&&EU(t.props,n))return!0;else if(!await EH({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return pV.setState(t=>({...t,openedGroup:{groupName:e,props:n},openedWindows:[]})),!0}async function EV(e){let{openedGroup:n,openedWindows:t}=pV.getState();if(n){if(t.length>0&&!(e||await EH({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;pV.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function EG(e,n=null,t=null,i=null){let r=pV.getState();if(!r.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let a=pG(e);if(!a)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:o}=r,{name:s}=a,l=pU(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${a.name} is not registered to a workspace group`);let c=pH(e);if(o&&(o.groupName!==l.name||!EU(o.props,i)))return!!await EH({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:i},openedWindows:[{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let i=r.openedWindows[c],a=r.openedGroup?.props??{},o=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=i;if(EU(i.props,t)){let p=u.find(n=>n.workspaceName===e);return p&&EU(p.props,n)?((o||c!==r.openedWindows.length-1)&&pV.setState(Eq.restoreWindow(r,s)),!0):!!await EH({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??a},openedWindows:[...r.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[EZ(e,n)],props:i?.props??t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await EH({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:a??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(pV.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props??null},openedWindows:[...r.openedWindows,{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await EH({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:a.name})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function EU(e,n){return null==e||null==n||j(e,n)}function EH(e){function n(e,n){let t=[];for(let i=e.openedWorkspaces.length-1;i>=0;i--){let r=e.openedWorkspaces[i];if(r.hasUnsavedChanges&&t.push(r),n&&r.workspaceName===n)break}return t}let{openedWindows:t,workspaceTitleByWorkspaceName:i}=pV.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=t.flatMap(e=>n(e));break;case"CLOSE_WINDOW":{let i=t.find(n=>n.windowName===e.windowName);if(!i)throw Error(`Window ${e.windowName} not found in opened windows.`);r=n(i);break}case"CLOSE_WORKSPACE":{let i=t.find(n=>n.windowName===e.windowName);if(!i)throw Error(`Window ${e.windowName} not found in opened windows.`);r=n(i,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=t.filter(n=>n.windowName!==e.windowNameToSpare).flatMap(e=>n(e))}return 0===r.length?Promise.resolve(!0):new Promise(e=>{let n=xt("workspace2-close-prompt",{onConfirm:()=>{n(),e(!0)},onCancel:()=>{n(),e(!1)},affectedWorkspaceTitles:r.map(e=>i[e.workspaceName])})})}let Eq={setWindowMaximized(e,n,t){let i=e.openedWindows.findIndex(e=>e.windowName===n),r=[...e.openedWindows],a={...r[i],maximized:t};return r[i]=a,{...e,openedWindows:r}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,n){let t=e.openedWindows.findIndex(e=>e.windowName===n),i=e.openedWindows[t],r=[...e.openedWindows.filter((e,n)=>n!==t),i];return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,n){let t=pH(n);if(t<0)return e;let i={...e.openedWindows[t]},r=i.openedWorkspaces.findIndex(e=>e.workspaceName===n),a=[...e.openedWindows];i.openedWorkspaces=i.openedWorkspaces.slice(0,r);let o=e.isMostRecentlyOpenedWindowHidden;if(0===i.openedWorkspaces.length){let n=t===e.openedWindows.length-1;a.splice(t,1),n&&a.length>0&&(o=!1)}else a[t]=i;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,n,t,i){let r=e.registeredWorkspacesByName[t];if(!r)throw Error(`No workspace named "${t}" registered`);let a=e.registeredWorkspacesByName[n];if(!a)throw Error(`No workspace named "${n}" registered`);if(a.window!==r.window)throw Error(`Child workspace ${t} does not belong to the same workspace window as parent workspace ${n}`);let o=e.openedWindows.findIndex(e=>e.windowName===r.window);if(-1==o)throw Error(`Cannot open child workspace ${t} as window ${r.window} is not opened`);let{openedWorkspaces:s}=e.openedWindows[o],l=s.findIndex(e=>e.workspaceName===n);if(-1===l)throw Error(`Cannot open child workspace ${t} from parent workspace ${n} as the parent is not opened within the workspace window`);let c=s.slice(0,l+1);return{openedWindows:e.openedWindows.map((e,n)=>n==o?{...e,openedWorkspaces:[...c,EZ(t,i)]}:e)}},setHasUnsavedChanges(e,n,t){let i=pH(n);if(i<0)return e;let r={...e.openedWindows[i]},a=r.openedWorkspaces.findIndex(e=>e.workspaceName===n);if(a<0)return e;r.openedWorkspaces[a]={...r.openedWorkspaces[a],hasUnsavedChanges:t};let o=[...e.openedWindows];return o[i]=r,{...e,openedWindows:o}},setWorkspaceTitle(e,n,t){let i={...e.workspaceTitleByWorkspaceName};return null===t?delete i[n]:i[n]=t,{...e,workspaceTitleByWorkspaceName:i}}};function EK(){return p6(pV,Eq)}let EY=()=>(0,pX.useContext)(du),EJ=()=>Object.keys(pV.getState().registeredWorkspacesByName);function EZ(e,n){return{workspaceName:e,props:n??{},hasUnsavedChanges:!1,uuid:c2()}}var EX=t(81179),EQ={};EQ.styleTagTransform=f5(),EQ.setAttributes=f0(),EQ.insert=fX().bind(null,"head"),EQ.domAPI=fJ(),EQ.insertStyleElement=f2(),fK()(EX.A,EQ);let E0=EX.A&&EX.A.locals?EX.A.locals:void 0,E1=({title:e,children:n,hasUnsavedChanges:t=!1})=>{let i=fc(),{setWindowMaximized:r,hideWindow:a,setHasUnsavedChanges:o,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:p,workspaceTitleByWorkspaceName:d,setWorkspaceTitle:f,isMostRecentlyOpenedWindowHidden:h}=EK(),{workspaceName:g,isRootWorkspace:m,closeWorkspace:b,showActionMenu:y}=EY(),v=pH(g),$=s[v],A=$?.openedWorkspaces.find(e=>e.workspaceName===g);if((0,pX.useEffect)(()=>{A?.hasUnsavedChanges!=t&&o(g,t??!1)},[A?.hasUnsavedChanges,t,g,o]),(0,pX.useEffect)(()=>{d[g]!==e&&f(g,e)},[d,g,e,f]),v<0||null==l||null==A)return null;let w=c[l.groupName];if(!w)throw Error(`Cannot find registered workspace group ${l.groupName}`);let k=p[g].window,x=u[k];if(!x)throw Error(`Cannot find registered workspace window ${k}`);let{icon:C,canMaximize:E}=x,S="closable"===w.persistence,D=!!C&&!S,{maximized:M}=$,z=x?.width??"narrow",O=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),P=v<s.length-1||h;return(0,fG.jsxs)("div",{className:fH()(E0.workspaceOuterContainer,{[E0.narrowWorkspace]:"narrow"===z,[E0.widerWorkspace]:"wider"===z,[E0.extraWideWorkspace]:"extra-wide"===z,[E0.isActionMenuOpened]:O}),children:[(0,fG.jsx)("div",{className:fH()(E0.workspaceSpacer,{[E0.hidden]:P})}),(0,fG.jsx)("div",{className:fH()(E0.workspaceMiddleContainer,{[E0.maximized]:M,[E0.hidden]:P,[E0.isRootWorkspace]:m,[E0.showActionMenu]:y}),children:(0,fG.jsxs)("div",{className:fH()(E0.workspaceInnerContainer,{[E0.maximized]:M,[E0.hidden]:P,[E0.isRootWorkspace]:m}),children:[(0,fG.jsxs)(ht.Y9Y,{"aria-label":ad("workspaceHeader"),className:E0.header,children:[(0,fG.jsx)(ht.bCw,{prefix:"",children:e}),(0,fG.jsx)("div",{className:E0.overlayHeaderSpacer}),(0,fG.jsx)(ht.wdv,{className:E0.headerButtons,children:fu(i)?(0,fG.jsxs)(fG.Fragment,{children:[(E||M)&&(0,fG.jsx)(ht.V8d,{"aria-label":M?ad("minimize"):ad("maximize"),onClick:()=>r(k,!M),children:M?(0,fG.jsx)(Eh.Xj,{}):(0,fG.jsx)(Eh.hz,{})}),D&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("hide"),onClick:()=>a(),children:(0,fG.jsx)(hA,{})}),!S&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("close"),onClick:()=>b({closeWindow:!0}),children:(0,fG.jsx)(hF,{})})]}):(0,fG.jsxs)(fG.Fragment,{children:[D&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("hide"),onClick:()=>a(),children:(0,fG.jsx)(Eg.d3,{})}),(0,fG.jsx)(ht.V8d,{"aria-label":ad("close"),onClick:()=>{S?EV():b({closeWindow:!0})},children:(0,fG.jsx)(hF,{})})]})})]}),(0,fG.jsx)("div",{className:fH()(E0.workspaceContent),children:n})]})})]})};var E2=t(97810),E3={};E3.styleTagTransform=f5(),E3.setAttributes=f0(),E3.insert=fX().bind(null,"head"),E3.domAPI=fJ(),E3.insertStyleElement=f2(),fK()(E2.A,E3);let E5=E2.A&&E2.A.locals?E2.A.locals:void 0;function E4({getIcon:e,hasUnsavedChanges:n,tagContent:t}){return(0,fG.jsxs)(fG.Fragment,{children:[e({size:16}),n?(0,fG.jsx)("span",{className:E5.interruptedTag,children:"!"}):(0,fG.jsx)("span",{className:E5.countTag,children:t})]})}let E6=({icon:e,label:n,tagContent:t,workspaceToLaunch:i,onBeforeWorkspaceLaunch:r})=>{let a=fc(),{openedWindows:o,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=EK(),{extension:u}=(0,pX.useContext)(p0),p=o.findIndex(e=>e.windowName===u?.extensionId),d=o[p],f=null!=d,h=f&&(p<o.length-1||c),g=f&&!h,m=d?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(f)h?s(d.windowName):l();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:n,windowProps:t}=i;EG(e,n,t)}};return"tablet"===a||"phone"===a?(0,fG.jsxs)(ht.$nd,{className:fH()(E5.container,{[E5.active]:f&&!g,[E5.focused]:g}),iconDescription:n,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",children:[(0,fG.jsx)("span",{className:E5.elementContainer,children:(0,fG.jsx)(E4,{hasUnsavedChanges:m,getIcon:e,tagContent:t})}),(0,fG.jsx)("span",{children:n})]}):(0,fG.jsx)(ht.K0,{align:"left","aria-label":n,className:fH()(E5.container,{[E5.active]:f&&!g,[E5.focused]:g}),enterDelayMs:300,kind:"ghost",label:n,onClick:b,size:"md",children:(0,fG.jsx)("div",{className:E5.elementContainer,children:(0,fG.jsx)(E4,{hasUnsavedChanges:m,getIcon:e,tagContent:t})})})};function E8({showContactDetails:e,toggleContactDetails:n,className:t}){return(0,fG.jsx)(ht.$nd,{className:t,iconDescription:"Toggle contact details",kind:"ghost",onClick:n,renderIcon:e?hR:hI,children:e?ad("showLess","Show less"):ad("showMore","Show more")})}var E7=t(95804),E9={};E9.styleTagTransform=f5(),E9.setAttributes=f0(),E9.insert=fX().bind(null,"head"),E9.domAPI=fJ(),E9.insertStyleElement=f2(),fK()(E7.A,E9);let Se=E7.A&&E7.A.locals?E7.A.locals:void 0,Sn=({patientUuid:e})=>{let{cohorts:n=[],isLoading:t}=function(e){let n=e?`${rl}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:t,isLoading:i}=(0,d_.Ay)(n,rd),r=t?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,pX.useMemo)(()=>({cohorts:r,isLoading:i}),[i,r])}(e);return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsxs)("p",{className:Se.heading,children:[ad("patientLists","Patient Lists")," (",n?.length??0,")"]}),t?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsxs)("ul",{children:[(()=>{if(n?.length>0){let e=n.sort((e,n)=>wJ(e?.startDate).getTime()-wJ(n?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,fG.jsx)("li",{children:(0,fG.jsx)(p1,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,fG.jsx)("li",{children:"--"})})(),n.length>3&&(0,fG.jsx)("li",{className:Se.link,children:(0,fG.jsx)(p1,{to:`${window.spaBase}/home/patient-lists`,children:ad("seeMoreLists","See {{count}} more lists",{count:n?.length-3})})})]})]})},St=({patientId:e})=>{let{patient:n,isLoading:t}=fv(e),i=n?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return t?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("p",{className:Se.heading,children:ad("address","Address")}),(0,fG.jsx)("ul",{children:i?Object.entries(i).filter(([e])=>"id"!==e&&"use"!==e).map(([e,n])=>"extension"===e?i.extension?.[0]?.extension?.map((n,t)=>(0,fG.jsxs)("li",{children:[ad(r(n.url),r(n.url)),": ",n.valueString]},`address-${e}-${t}`)):(0,fG.jsxs)("li",{children:[ad(e,e),": ",n]},`address-${e}`)):(0,fG.jsx)("li",{children:"--"})})]})},Si=({patientUuid:e})=>{let{isLoading:n,contactAttributes:t}=(e=>{let{contactAttributeTypes:n=[]}=dH({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:t,error:i,isLoading:r}=(e=>{let{data:n,error:t,isLoading:i}=dZ()(`${rl}/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)))`,rd);return{isLoading:i,attributes:n?.data.person.attributes??[],error:t}})(e);return{contactAttributes:(0,pX.useMemo)(()=>t.filter(({attributeType:e})=>n?.some(n=>e.uuid===n)),[t,n]),isLoading:r,error:i}})(e),i=(0,pX.useMemo)(()=>t?[...t?.map(e=>[e.attributeType.display?ad(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[t]);return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("p",{className:Se.heading,children:ad("contactDetails","Contact Details")}),n?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsx)("ul",{children:i.length?i.map(([e,n],t)=>(0,fG.jsxs)("li",{children:[e,": ",n]},`${e}-${n}-${t}`)):(0,fG.jsx)("li",{children:"--"})})]})},Sr=({patientId:e})=>{let{data:n,isLoading:t}=function(e){let n=`${rl}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:t,error:i,isLoading:r,isValidating:a}=(0,d_.Ay)(e?n:null,rd),o=t?.data?.results?.length?function(e,n){let t=[];for(let i of n)e===i.personA.uuid?t.push({uuid:`${i.uuid}`,display:i.personB.display,relativeAge:i.personB.age,relativeUuid:i.personB.uuid,relationshipType:i.relationshipType.bIsToA}):t.push({uuid:`${i.uuid}`,display:i.personA.display,relativeAge:i.personA.age,relativeUuid:i.personA.uuid,relationshipType:i.relationshipType.aIsToB});return t}(e,t.data.results):null;return{data:t?o:null,error:i,isLoading:r,isValidating:a}}(e);return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("p",{className:Se.heading,children:ad("relationships","Relationships")}),t?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsx)("ul",{children:n&&n.length>0?(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsxs)("li",{className:Se.relationship,children:[(0,fG.jsx)("div",{children:(0,fG.jsx)(p1,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,fG.jsx)("div",{children:e.relationshipType}),(0,fG.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?ad("yearAbbreviation","yr"):ad("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,fG.jsx)("li",{children:"--"})})]})};function Sa({patientId:e,deceased:n}){return(0,fG.jsxs)("div",{className:fH()(Se.contactDetails,{[Se.deceased]:n}),children:[(0,fG.jsxs)("div",{className:Se.row,children:[(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(St,{patientId:e})}),(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(Si,{patientUuid:e})})]}),(0,fG.jsxs)("div",{className:Se.row,children:[(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(Sr,{patientId:e})}),(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(Sn,{patientUuid:e})})]})]})}function So(e){let n=document.querySelector("template#loading-spinner");if(n){let t=n.content.cloneNode(!0),i=Array.prototype.map.call(t.childNodes,e=>e);return e.appendChild(t),()=>i.forEach(e=>e.remove())}return()=>{}}var Ss=t(24039),Sl={};Sl.styleTagTransform=f5(),Sl.setAttributes=f0(),Sl.insert=fX().bind(null,"head"),Sl.domAPI=fJ(),Sl.insertStyleElement=f2(),fK()(Ss.A,Sl);let Sc=Ss.A&&Ss.A.locals?Ss.A.locals:void 0;function Su({workspaceGroup:e,groupProps:n}){let t=fc(),{persistence:i}=e;return(0,fG.jsx)("aside",{className:Sc.sideRail,children:(0,fG.jsxs)("div",{className:Sc.container,children:["closable"==i&&fu(t)&&(0,fG.jsx)(ht.K0,{align:"left",onClick:()=>EV(),label:ad("close"),kind:"ghost",children:(0,fG.jsx)(hF,{})}),(0,fG.jsx)(p0.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,fG.jsx)(dt,{className:Sc.container,name:e.name,state:{groupProps:n}})})]})})}let Sp=({lifeCycle:e,openedWorkspace:n,openedWindow:t,isRootWorkspace:i,isLeafWorkspace:r,showActionMenu:a})=>{let{openedGroup:o,closeWorkspace:s,openChildWorkspace:l}=EK(),c=(0,pX.useMemo)(()=>n&&{closeWorkspace:async(e={})=>{let{closeWindow:i=!1,discardUnsavedChanges:r=!1}=e;return i?!!(r||await EH({reason:"CLOSE_WINDOW",explicit:!0,windowName:t.windowName}))&&(s(t.openedWorkspaces[0].workspaceName),!0):!!(r||await EH({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:t.windowName,workspaceName:n.workspaceName}))&&(s(n.workspaceName),!0)},launchChildWorkspace:async(e,i)=>{let r=n.workspaceName,{openedWorkspaces:a}=t,o=a.findIndex(e=>e.workspaceName===r);-1===o||o!==a.length-1&&a.slice(o+1).some(e=>e.hasUnsavedChanges)&&!await EH({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:t.windowName,workspaceName:a[o+1].workspaceName})||l(r,e,i||{})},workspaceName:n.workspaceName,workspaceProps:n.props,windowProps:t.props,groupProps:o&&o.props?o.props:null,isRootWorkspace:i,isLeafWorkspace:r,windowName:t.windowName,showActionMenu:a},[n,s,o,t]);if(!e){let{registeredWorkspacesByName:e}=pV.getState(),t=e[n.workspaceName],r=t&&t.window?t.window:void 0,{registeredWindowsByName:s}=pV.getState(),l=r?s[r]:void 0,c=l&&l.width?l.width:"narrow",u=Object.values(s).some(e=>e.group===o?.groupName&&void 0!==e.icon);return(0,fG.jsxs)("div",{className:fH()(E0.workspaceOuterContainer,{[E0.narrowWorkspace]:"narrow"===c,[E0.widerWorkspace]:"wider"===c,[E0.extraWideWorkspace]:"extra-wide"===c,[E0.isActionMenuOpened]:u}),children:[(0,fG.jsx)("div",{className:E0.workspaceSpacer}),(0,fG.jsx)("div",{className:fH()(E0.workspaceMiddleContainer,{[E0.isRootWorkspace]:i,[E0.showActionMenu]:a}),children:(0,fG.jsx)("div",{className:fH()(E0.workspaceInnerContainer,{[E0.isRootWorkspace]:i}),children:(0,fG.jsx)(ht.OuH,{className:E0.loader,description:`${ad("loading")} ...`})})})]})}return(0,fG.jsx)(Ez,{config:e,mountParcel:ic,...c},n.workspaceName)},Sd=({openedWindow:e,showActionMenu:n})=>{let{openedWorkspaces:t}=e,[i,r]=(0,pX.useState)(),{registeredWorkspacesByName:a}=pV.getState();return(0,pX.useEffect)(()=>{Promise.all(t.map(e=>{let{moduleName:n,component:t}=a[e.workspaceName];return fP(n,t)})).then(r)},[t]),(0,fG.jsx)(fG.Fragment,{children:t.map((r,a)=>(0,fG.jsx)(Sp,{openedWorkspace:r,openedWindow:e,lifeCycle:i&&i[a]?i[a]:void 0,isRootWorkspace:0===a,isLeafWorkspace:a===t.length-1,showActionMenu:n},r.uuid))})};var Sf=t(297),Sh={};Sh.styleTagTransform=f5(),Sh.setAttributes=f0(),Sh.insert=fX().bind(null,"head"),Sh.domAPI=fJ(),Sh.insertStyleElement=f2(),fK()(Sf.A,Sh);let Sg=Sf.A&&Sf.A.locals?Sf.A.locals:void 0;function Sm(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(Sb,{}))}function Sb(){let{openedGroup:e,openedWindows:n,registeredGroupsByName:t,registeredWindowsByName:i}=EK();if((0,pX.useEffect)(()=>um("before-page-changed",n=>{let{newPage:i,cancelNavigation:r,oldUrl:a,newUrl:o}=n;if(!e)return;if(i)return void r(EV().then(e=>!e));let s=t[e.groupName],l=s?.scopePattern;l&&function(e,n,t){try{let i=new URL(n,window.location.origin).pathname,r=new URL(t,window.location.origin).pathname,a=new RegExp(e),o=i.match(a),s=r.match(a);if(!o||!s)return!0;if(o.length>1)return!o.slice(1).every((e,n)=>e===s[n+1]);return!1}catch{return!0}}(l,a,o)&&r(EV().then(e=>!e))}),[e,t]),!e)return null;let r=t[e.groupName],a=n.some(e=>e.maximized),{name:o}=r,s=Object.values(i).filter(e=>e.group===o&&void 0!==e.icon).sort((e,n)=>(e.order??Number.MAX_VALUE)-(n.order??Number.MAX_VALUE)).length>0;return(0,fG.jsxs)("div",{className:fH()(Sg.workspaceWindowsAndMenuContainer,{[Sg.overlay]:r.overlay,[Sg.hasMaximizedWindow]:a}),children:[(0,fG.jsx)("div",{className:Sg.workspaceWindowsContainer,children:n.map(e=>(0,fG.jsx)(Sd,{openedWindow:e,showActionMenu:s},e.windowName))}),s&&(0,fG.jsx)(Su,{workspaceGroup:r,groupProps:e.props})]})}function Sy(e){if("string"!=typeof e||0===e.trim().length)return;let n=e.replaceAll("_","-");try{return new Intl.Locale(n).toString()}catch{return}}function S_(e,n,t){if(null==e)return t;let i=Sy(e);if(!i)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),t;let r=[];for(let e of n){let n=Sy(e);if(!n){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}r.push({canonical:n,original:e})}let a=i;for(;a;){let e=r.find(e=>e.canonical===a);if(e)return e.original;let n=a+"-",t=r.find(e=>e.canonical.startsWith(n));if(t)return t.original;if("ht"===a){a="fr-HT";continue}let i=a.lastIndexOf("-");if(-1===i)break;let o=(a=a.slice(0,i)).lastIndexOf("-");-1!==o&&a.length-o==2&&(a=a.slice(0,o))}return t}function Sv(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function S$(e){return!!e&&e.constructor===Object}var SA=t(99589);function Sw(e){let[n,t,i]=e.split(".");return`${n}.${t}.${i}`}function Sk(e,n){let t=function(e){let n=e.indexOf("-");if(n>=0){let t=Sw(e.slice(0,n)),i=e.slice(n+1);return`${t}-${i}`}return Sw(e)}(n);return SA.satisfies(t,e,{includePrerelease:!0})}async function Sx(e,n={}){let t,{shouldRetry:i,getDelay:r,onError:a}=n;i=i??(e=>e<=5),r=r??(e=>(function(e,n=!1){return 1e3*Math.pow(2,n?e+1:e)})(e));let o=0;do try{return await SC(r(o)),await e()}catch(e){a?.(e,o),t=e}while(i(o++));throw t}async function SC(e){if(!(e<=0))return new Promise(n=>setTimeout(n,e))}}}]);
43
+ }`.trim(),document.head.prepend(i),a=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let n=((e=document)=>e.activeElement)(),t=null!=n&&AR(n);a.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||AG(this,t)},o=g4(AV(document,"touchstart",n=>{let i=mB(n);e=_G(i)?i:_U(i,!0),t=!1;let r=i.ownerDocument.defaultView.getSelection();r&&!r.isCollapsed&&r.containsNode(i,!0)&&(t=!0),n.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(t=!0),"selectionStart"in i&&"selectionEnd"in i&&i.selectionStart<i.selectionEnd&&i.ownerDocument.activeElement===i&&(t=!0)},{passive:!1,capture:!0}),AV(document,"touchmove",n=>{if(2!==n.touches.length&&!t){if(!e||e===document.documentElement||e===document.body)return void n.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&n.preventDefault()}},{passive:!1,capture:!0}),AV(document,"blur",e=>{let n=mB(e),t=e.relatedTarget;if(t&&AR(t))t.focus({preventScroll:!0}),AG(t,AR(n));else if(!t){let e=n.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{n(),o(),i.remove(),HTMLElement.prototype.focus=a}):g4((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?AW(document.documentElement,"scrollbarGutter","stable"):AW(document.documentElement,"paddingRight",`${s}px`)),AW(document.documentElement,"overflow","hidden"))),()=>{0==--AL&&u()}}},[n])}({isDisabled:a||!n.isOpen}),(0,pX.useEffect)(()=>{if(n.isOpen&&i.current)if(a){var e,t,o=r?.current??i.current;let n=Ah[Ah.length-1];return n&&!n.visibleNodes.has(o)?(n.visibleNodes.add(o),()=>{n.visibleNodes.delete(o)}):void 0}else{let n,a,o,s,l,c,u,p,d,f,h;return e=[r?.current??i.current],a=(t={shouldUseInert:!0})instanceof(n=mP(e?.[0])).Element?{root:t}:t,o=a?.root??document.body,s=a?.shouldUseInert&&Ad,l=new Set(e),c=new Set,u=(e,t)=>{s&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof n.HTMLElement&&(e.inert=!1))},p=e=>{for(let n of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(n);let n=e=>{if(c.has(e)||l.has(e)||e.parentElement&&c.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let n of l)if(mT(e,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},t=v6(mO(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),i=n(e);if(i===NodeFilter.FILTER_ACCEPT&&d(e),i!==NodeFilter.FILTER_REJECT){let e=t.nextNode();for(;null!=e;)d(e),e=t.nextNode()}},d=e=>{let t=Af.get(e)??0;(s&&e instanceof n.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===t||(0===t&&u(e,!0),c.add(e),Af.set(e,t+1))},Ah.length&&Ah[Ah.length-1].disconnect(),p(o),(f=new MutationObserver(e=>{for(let t of e)if("childList"===t.type&&t.target.isConnected&&![...l,...c].some(e=>mT(e,t.target)))for(let e of t.addedNodes){var n;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(n=e).dataset.liveAnnouncer||void 0!==n.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&p(e)}})).observe(o,{childList:!0,subtree:!0}),h={visibleNodes:l,hiddenNodes:c,observe(){f.observe(o,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}},Ah.push(h),()=>{for(let e of(f.disconnect(),c)){let n=Af.get(e);null!=n&&(1===n?(u(e,!1),Af.delete(e)):Af.set(e,n-1))}h===Ah[Ah.length-1]?(Ah.pop(),Ah.length&&Ah[Ah.length-1].observe()):Ah.splice(Ah.indexOf(h),1)}}},[a,n.isOpen,i,r]),{popoverProps:mp(p,f),arrowProps:h,underlayProps:d,placement:g,triggerAnchorPoint:m}}({...i,offset:null!=(r=i.offset)?r:8,arrowSize:s,groupRef:d?p:c},e),b=i.popoverRef,y=function(e,n=!0){let[t,i]=(0,pX.useState)(!0),r=t&&n;return g6(()=>{if(r&&e.current&&"getAnimations"in e.current)for(let n of e.current.getAnimations())n instanceof CSSTransition&&n.cancel()},[e,r]),AK(e,r,(0,pX.useCallback)(()=>i(!1),[])),r}(b,!!m)||i.isEntering||!1,v=mh({...i,defaultClassName:"react-aria-Popover",values:{trigger:i.trigger||null,placement:m,isEntering:y,isExiting:n}}),$=!i.isNonModal||"SubmenuTrigger"===i.trigger,[A,w]=(0,pX.useState)(!1);g6(()=>{b.current&&w($&&!b.current.querySelector("[role=dialog]"))},[b,$]),(0,pX.useEffect)(()=>{var e;let n,t;A&&b.current&&!b.current.contains(document.activeElement)&&(t=((e=document)=>e.activeElement)(n=mO(e=b.current)),"virtual"===AY?bb(()=>{((e=document)=>e.activeElement)(n)===t&&e.isConnected&&mM(e)}):mM(e))},[A,b]);let k={...f.style,...v.style},x=pQ().createElement("div",{...mp(mD(i),f),...v,role:A?"dialog":void 0,tabIndex:A?-1:void 0,"aria-label":i["aria-label"],"aria-labelledby":i["aria-labelledby"],ref:b,slot:i.slot||void 0,style:k,dir:i.dir,"data-trigger":i.trigger,"data-placement":m,"data-entering":y||void 0,"data-exiting":n||void 0},!i.isNonModal&&pQ().createElement(Aq,{onDismiss:e.close}),pQ().createElement(Ap.Provider,{value:{...g,placement:m,ref:o}},v.children),pQ().createElement(Aq,{onDismiss:e.close}));return d?pQ().createElement(An,{...i,shouldContainFocus:A,isExiting:n,portalContainer:null!=(a=null!=t?t:null==p?void 0:p.current)?a:void 0},x):pQ().createElement(An,{...i,shouldContainFocus:A,isExiting:n,portalContainer:t},!i.isNonModal&&e.isOpen&&pQ().createElement("div",{"data-testid":"underlay",...h,style:{position:"fixed",inset:0}}),pQ().createElement("div",{ref:c,style:{display:"contents"}},pQ().createElement(we.Provider,{value:c},x)))}function wi(e){return e?.start!=null&&null!=e.end}let wr=(0,pX.createContext)(null),wa=(0,pX.createContext)(null),wo=(0,pX.createContext)(null),ws=(0,pX.createContext)(null),wl=(0,pX.forwardRef)(function(e,n){var t,i;[e,n]=mm(e,n,wr);let{validationBehavior:r}=mg(Al)||{},a=null!=(i=null!=(t=e.validationBehavior)?t:r)?i:"native",o=function(e){let n=A7(e),[t,i]=vj(e.value,e.defaultValue||null,e.onChange),[r]=(0,pX.useState)(t),a=t||e.placeholderValue||null,[o,s]=$H(a,e.granularity),l=null!=t?t.toDate(s??"UTC"):null,c="hour"===o||"minute"===o||"second"===o,u=e.shouldCloseOnSelect??!0,[p,d]=(0,pX.useState)(null),[f,h]=(0,pX.useState)(null);if(t&&(p=t,"hour"in t&&(f=t)),a&&!(o in a))throw Error("Invalid granularity "+o+" for value "+a.toString());let g=t?.calendar.identifier==="gregory"&&"BC"===t.era,m=(0,pX.useMemo)(()=>({granularity:o,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:g}),[o,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,g]),{minValue:b,maxValue:y,isDateUnavailable:v}=e,$=(0,pX.useMemo)(()=>$F(t,b,y,v,m),[t,b,y,v,m]),A=$P({...e,value:t,builtinValidation:$}),w=A.displayValidation.isInvalid,k=e.validationState||(w?"invalid":null),x=(e,n)=>{i("timeZone"in n?n.set(_u(e)):_p(e,n)),d(null),h(null),A.commitValidation()};return{...A,value:t,defaultValue:e.defaultValue??r,setValue:i,dateValue:p,timeValue:f,setDateValue:t=>{let r="function"==typeof u?u():u;c?f||r?x(t,f||$G(e.defaultValue||e.placeholderValue)):d(t):(i(t),A.commitValidation()),r&&n.setOpen(!1)},setTimeValue:e=>{p&&e?x(p,e):h(e)},granularity:o,hasTime:c,...n,setOpen(i){!i&&!t&&p&&c&&x(p,f||$G(e.defaultValue||e.placeholderValue)),n.setOpen(i)},validationState:k,isInvalid:w,formatValue:(e,n)=>l?new y_(e,$V(n,m)).format(l):"",getDateFormatter:(e,n)=>new y_(e,$V({},{...m,...n}))}}({...e,validationBehavior:a}),s=(0,pX.useRef)(null),[l,c]=mb(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,fieldProps:d,buttonProps:f,dialogProps:h,calendarProps:g,descriptionProps:m,errorMessageProps:b,...y}=function(e,n,t){var i;let r=ml(),a=ml(),o=ml(),s=yT((i=$b)&&i.__esModule?i.default:i,"@react-aria/datepicker"),{isInvalid:l,validationErrors:c,validationDetails:u}=n.displayValidation,{labelProps:p,fieldProps:d,descriptionProps:f,errorMessageProps:h}=$v({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||c}),g=$y(n,t),m=d["aria-labelledby"]||d.id,{locale:b}=yd(),y=n.formatValue(b,{month:"long"}),v=_Z(y?s.format("selectedDateDescription",{date:y}):""),$=[v["aria-describedby"],d["aria-describedby"]].filter(Boolean).join(" ")||void 0,A=mD(e),w=(0,pX.useMemo)(()=>$d(t),[t]),k=(0,pX.useRef)(!1),{focusWithinProps:x}=bK({...e,isDisabled:n.isOpen,onBlurWithin:n=>{mT(document.getElementById(a),n.relatedTarget)||(k.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{k.current||(k.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}});return{groupProps:mp(A,g,d,v,x,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":m,"aria-describedby":$,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...p,onClick:()=>{w.focusFirst()}},fieldProps:{...d,id:o,[$k]:"presentation","aria-describedby":$,value:n.value,defaultValue:n.defaultValue,onChange:n.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[$O]:n,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:f,errorMessageProps:h,buttonProps:{...v,id:r,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${r} ${m}`,"aria-describedby":$,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:a,"aria-labelledby":`${r} ${m}`},calendarProps:{autoFocus:!0,value:n.dateValue,onChange:n.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:n.dateValue?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:c,validationDetails:u}}({...my(e),label:c,validationBehavior:a},o,s),[v,$]=(0,pX.useState)(null),A=(0,pX.useCallback)(()=>{s.current&&$(s.current.offsetWidth+"px")},[]);AT({ref:s,onResize:A});let{focusProps:w,isFocused:k,isFocusVisible:x}=bY({within:!0}),C=mh({...e,values:{state:o,isFocusWithin:k,isFocusVisible:x,isDisabled:e.isDisabled||!1,isInvalid:o.isInvalid,isOpen:o.isOpen},defaultClassName:"react-aria-DatePicker"}),E=mD(e);return delete E.id,pQ().createElement(mf,{values:[[wo,o],[v2,{...u,ref:s,isInvalid:o.isInvalid}],[$2,d],[b5,{...f,isPressed:o.isOpen}],[Ac,{...p,ref:l,elementType:"span"}],[vG,g],[Ai,o],[A9,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":v}}],[At,h],[b8,{slots:{description:m,errorMessage:b}}],[Aa,y]]},pQ().createElement("div",{...w,...E,...C,ref:n,slot:e.slot||void 0,"data-focus-within":k||void 0,"data-invalid":o.isInvalid||void 0,"data-focus-visible":x||void 0,"data-disabled":e.isDisabled||void 0,"data-open":o.isOpen||void 0}))}),wc=(0,pX.forwardRef)(function(e,n){var t,i;[e,n]=mm(e,n,wa);let{validationBehavior:r}=mg(Al)||{},a=null!=(i=null!=(t=e.validationBehavior)?t:r)?i:"native",o=function(e){let n=A7(e),[t,i]=vj(e.value,e.defaultValue||null,e.onChange),[r]=(0,pX.useState)(t),[a,o]=(0,pX.useState)(()=>t||{start:null,end:null});null==t&&a.start&&a.end&&o(a={start:null,end:null});let s=t||a,l=e=>{o(s=e||{start:null,end:null}),wi(s)?i(s):i(null)},[c,u]=$H(s?.start||s?.end||e.placeholderValue||null,e.granularity),p="hour"===c||"minute"===c||"second"===c,d=e.shouldCloseOnSelect??!0,[f,h]=(0,pX.useState)(null),[g,m]=(0,pX.useState)(null);s&&wi(s)&&(f=s,"hour"in s.start&&(g=s));let b=(e,n)=>{l({start:"timeZone"in n.start?n.start.set(_u(e.start)):_p(e.start,n.start),end:"timeZone"in n.end?n.end.set(_u(e.end)):_p(e.end,n.end)}),h(null),m(null),E.commitValidation()},y=t=>{let i="function"==typeof d?d():d;p?wi(t)&&(i||g?.start&&g?.end)?b(t,{start:g?.start||$G(e.placeholderValue),end:g?.end||$G(e.placeholderValue)}):h(t):wi(t)?(l(t),E.commitValidation()):h(t),i&&n.setOpen(!1)},v=e=>{wi(f)&&wi(e)?b(f,e):m(e)},$=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,A=(0,pX.useMemo)(()=>({granularity:c,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:$}),[c,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,$]),{minValue:w,maxValue:k,isDateUnavailable:x}=e,C=(0,pX.useMemo)(()=>{var e;let n;return e=s,n=$N($F(e?.start??null,w,k,x,A),$F(e?.end??null,w,k,x,A)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(n=$N(n,{isInvalid:!0,validationErrors:[(yS.getGlobalDictionaryForPackage("@react-stately/datepicker")||$j).getStringForLocale("rangeReversed",$R())],validationDetails:{...$S,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),n},[s,w,k,x,A]),E=$P({...e,value:t,name:(0,pX.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:C}),S=E.displayValidation.isInvalid,D=e.validationState||(S?"invalid":null);return{...E,value:s,defaultValue:e.defaultValue??r,setValue:l,dateRange:f,timeRange:g,granularity:c,hasTime:p,setDate(e,n){"start"===e?y({start:n,end:f?.end??null}):y({start:f?.start??null,end:n})},setTime(e,n){"start"===e?v({start:n,end:g?.end??null}):v({start:g?.start??null,end:n})},setDateTime(e,n){"start"===e?l({start:n,end:s?.end??null}):l({start:s?.start??null,end:n})},setDateRange:y,setTimeRange:v,...n,setOpen(t){!t&&!(s?.start&&s?.end)&&wi(f)&&p&&b(f,{start:g?.start||$G(e.placeholderValue),end:g?.end||$G(e.placeholderValue)}),n.setOpen(t)},validationState:D,isInvalid:S,formatValue(n,t){let i;if(!s||!s.start||!s.end)return null;let r="timeZone"in s.start?s.start.timeZone:void 0,a=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),o="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),c=$V(t,{granularity:a,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),u=s.start.toDate(r||"UTC"),p=s.end.toDate(o||"UTC"),d=new y_(n,c);if(r===o&&a===l&&0!==s.start.compare(s.end)){try{let e=d.formatRangeToParts(u,p),n=-1;for(let t=0;t<e.length;t++){let i=e[t];if("shared"===i.source&&"literal"===i.type)n=t;else if("endRange"===i.source)break}let t="",i="";for(let r=0;r<e.length;r++)r<n?t+=e[r].value:r>n&&(i+=e[r].value);return{start:t,end:i}}catch{}i=d}else i=new y_(n,$V(t,{granularity:l,timeZone:o,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(u),end:i.format(p)}},getDateFormatter:(e,n)=>new y_(e,$V({},{...A,...n}))}}({...e,validationBehavior:a}),s=(0,pX.useRef)(null),[l,c]=mb(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,startFieldProps:d,endFieldProps:f,buttonProps:h,dialogProps:g,calendarProps:m,descriptionProps:b,errorMessageProps:y,...v}=function(e,n,t){var i;let r=yT((i=$b)&&i.__esModule?i.default:i,"@react-aria/datepicker"),{isInvalid:a,validationErrors:o,validationDetails:s}=n.displayValidation,{labelProps:l,fieldProps:c,descriptionProps:u,errorMessageProps:p}=$v({...e,labelElementType:"span",isInvalid:a,errorMessage:e.errorMessage||o}),d=c["aria-labelledby"]||c.id,{locale:f}=yd(),h=n.formatValue(f,{month:"long"}),g=_Z(h?r.format("selectedRangeDescription",{startDate:h.start,endDate:h.end}):""),m={"aria-label":r.format("startDate"),"aria-labelledby":d},b={"aria-label":r.format("endDate"),"aria-labelledby":d},y=ml(),v=ml(),$=$y(n,t),A=[g["aria-describedby"],c["aria-describedby"]].filter(Boolean).join(" ")||void 0,w=(0,pX.useMemo)(()=>$d(t,{accept:e=>e.id!==y}),[t,y]),k={[$x]:w,[$k]:"presentation","aria-describedby":A,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},x=mD(e),C=(0,pX.useRef)(!1),{focusWithinProps:E}=bK({...e,isDisabled:n.isOpen,onBlurWithin:n=>{mT(document.getElementById(v),n.relatedTarget)||(C.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{C.current||(C.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}}),S=(0,pX.useRef)($M),D=(0,pX.useRef)($M);return{groupProps:mp(x,$,c,g,E,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":A,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...l,onClick:()=>{w.focusFirst()}},buttonProps:{...g,id:y,"aria-haspopup":"dialog","aria-label":r.format("calendar"),"aria-labelledby":`${y} ${d}`,"aria-describedby":A,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:v,"aria-labelledby":`${y} ${d}`},startFieldProps:{...m,...k,value:n.value?.start??null,defaultValue:n.defaultValue?.start,onChange:e=>n.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[$O]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){S.current=e,n.updateValidation($N(e,D.current))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},endFieldProps:{...b,...k,value:n.value?.end??null,defaultValue:n.defaultValue?.end,onChange:e=>n.setDateTime("end",e),name:e.endName,form:e.form,[$O]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){D.current=e,n.updateValidation($N(S.current,e))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},descriptionProps:u,errorMessageProps:p,calendarProps:{autoFocus:!0,value:n.dateRange?.start&&n.dateRange.end?n.dateRange:null,onChange:n.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:n.dateRange?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:a,validationErrors:o,validationDetails:s}}({...my(e),label:c,validationBehavior:a},o,s),[$,A]=(0,pX.useState)(null),w=(0,pX.useCallback)(()=>{s.current&&A(s.current.offsetWidth+"px")},[]);AT({ref:s,onResize:w});let{focusProps:k,isFocused:x,isFocusVisible:C}=bY({within:!0}),E=mh({...e,values:{state:o,isFocusWithin:x,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:o.isInvalid,isOpen:o.isOpen},defaultClassName:"react-aria-DateRangePicker"}),S=mD(e);return delete S.id,pQ().createElement(mf,{values:[[ws,o],[v2,{...u,ref:s,isInvalid:o.isInvalid}],[b5,{...h,isPressed:o.isOpen}],[Ac,{...p,ref:l,elementType:"span"}],[vU,m],[Ai,o],[A9,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":$}}],[At,g],[$2,{slots:{start:d,end:f}}],[b8,{slots:{description:b,errorMessage:y}}],[Aa,v]]},pQ().createElement("div",{...k,...S,...E,ref:n,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":o.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-open":o.isOpen||void 0}))});function wu(e){return pQ().createElement(yp,e)}function wp(e,n,t=!1){if(null==e)return t?e:void 0;if("string"==typeof e&&!e)return t?null:void 0;if(e instanceof y7||e instanceof _e||e instanceof _n)return n?_d(e,n):e;{let t=fC()(e).toDate(),i=new y7(t.getFullYear(),t.getMonth()+1,t.getDate());return n?_d(i,n):i}}function wd(e){if(e)return e.toDate(_k())}function wf(){let e=window.i18next.language;return"ht"===(e=e.replaceAll("_","-"))&&(e="fr-HT"),e}if("u">typeof navigator){let e=navigator;et=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;et=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var wh=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(et||"en-US"),wg=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},wm={};for(let e=1;e<100;e++)wm[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var wb={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},wy="[1234567890一二三四五六七八九〇\\d]",w_={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},wv={},w$={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},wA={zone:w$,year:wm,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},ww={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?(?:"+Object.keys(w$).join("|")+")\\)?",MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},wk={...ww,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},wx={},wC=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(n=wh){return wx[n.toLowerCase()]||(wx[n.toLowerCase()]=new e(n)),wx[n.toLowerCase()]}constructor(e=wh){this.locale=e,this.lookups={...wA},this.vars={...ww};let n=new Intl.NumberFormat(this.locale);this.numberingSystem=n.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let n=parseInt(e,10);if(!isNaN(n))return n}let n="";for(let t=0;t<e.length;t++)n+=String(this.lookups.digit[e[t]]);return parseInt(n,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let n=e.slice(0,3);return 1===n.length?100*this.toInt(n):2===n.length?10*this.toInt(n):this.toInt(n)}monthNameToInt(e){if("string"!=typeof e)return;let n=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[n]||12}h12ToInt(e,n){if("string"!=typeof e)return;let t=this.lookups.meridiem[n?.toLowerCase()]||0,i=this.toInt(e);return i<12&&12===t&&(i+=12),12===i&&0===t&&(i=0),i}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let n=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(n){let[,e,t,i]=n;return("-"===e||"−"===e?-1:1)*(60*this.toInt(t)+this.toInt(i||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=w_:this.buildNumbers(),/^en/i.test(this.locale)||(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:n}=function(e){if(wv[e])return wv[e];if("fullwide"===e||"hanidec"===e)return{group:wy,lookup:{...w_}};let n=wb[e];if(!n)return{group:"\\d",lookup:{...w_}};let t=String.fromCharCode(n),i=String.fromCharCode(n+9),r={};for(let e=0;e<10;e++)r[String.fromCharCode(n+e)]=e;return wv[e]={group:`[${t}-${i}]`,lookup:r},wv[e]}(this.numberingSystem);for(let t in this.lookups.digit=n,wk)wk.hasOwnProperty(t)&&(this.vars[t]=wk[t].replace(/\*/g,e))}buildMonthNames(){let e={},n={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((t,i)=>{["","k","kuu","kuuta"].forEach((r,a)=>{e[t+r+(a<2?"\\.?":"")]=!0,n[t+r]=i+1})});else{let t=[],i=e=>"month"===e.type;for(let e=0;e<12;e++)t.push(new Date(2017,e,1));for(let r of["full","long","medium"]){let a=Intl.DateTimeFormat(this.locale,{dateStyle:r});for(let o=0;o<12;o++){let s=a.formatToParts(t[o]).find(i).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===r?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,n[s]=o+1)}}let r=Intl.DateTimeFormat(this.locale,{month:"short"});for(let a=0;a<12;a++){let o=r.formatToParts(t[a]).find(i).value.toLocaleLowerCase(this.locale);o=o.replace(/\.$/,""),e[`${o}\\.?`]=!0,n[o]=a+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=n}buildDaynames(){let e=[],n=e=>"weekday"===e.type;for(let n=0;n<7;n++)e.push(new Date(2017,0,n+1));let t=[],i={};for(let r of["long","short"]){let a=Intl.DateTimeFormat(this.locale,{weekday:r});for(let o=0;o<7;o++){let s=a.formatToParts(e[o]).find(n).value.toLocaleLowerCase(this.locale);"short"===r?(s=s.replace(/\.$/,""),t.push(`${s}\\.?`)):t.push(s),i[s]=o}}this.vars.DAYNAME=t.join("|"),this.lookups.dayname=i}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],n=e=>"dayPeriod"===e.type,t=[],i={},r=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let a=0;a<2;a++){let o=r.formatToParts(e[a]).find(n);if(!o)return;let s=o.value.toLocaleLowerCase(this.locale);t.push(s),i[s]=12*a}this.vars.MERIDIEM=t.join("|"),this.lookups.meridiem=i}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,n)=>{if(!this.vars[n])throw Error(`Template string contains invalid variable _${n}_`);return this.vars[n]}),"i")}},wE=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],wS={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},wD=()=>new Date;function wM(e){return function(n){let t={};for(let i=0,r=e.length;i<r;i++){let r=e[i];r&&(t[r]=n[i])}return t}}var wz=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:n,patterns:t,formatter:i}){this.doneChecker=e,this.fallback=n,this.patterns=t,this.formatter=i}attempt(e){if("string"!=typeof e)return this.fallback(e);let n=e.trim(),t={},i=!1;for(let e of this.patterns){let r=n.match(e.regex);if(!r)continue;i=!0;let a=e.handler(r);if(a){for(let[e,n]of Object.entries(a))e in t||void 0===n||(t[e]=n);if(n=(n=n.slice(0,r.index)+n.slice(r.index+r[0].length+1)).trim(),this.doneChecker(t,n))break}}return i?this.formatter(t):this.fallback(e)}},wO=["year","month","day","hour","minute","second","millisecond","offset"],wP={};function wT(e,n){return""===n||/^\s+$/.test(n)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var wB=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],wI={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...wB],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:wB,id:wB,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function wN(e,n=wh){let t=function(e){if(!wP[e]){var n,t;let i,r,a=wC.factory(e);wP[e]=new wz({doneChecker:wT,fallback:(n=e,function(e){let t=String(e).slice(0,50);return""===t&&(t="(empty string)"),{invalid:`Unable to parse "${t}" with locale "${n}"`}}),patterns:(i=[{name:"timestampWithOffset",regex:a.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:wM(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:a.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:wM(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:a.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:wM(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:a.compile(`^(${wy}{2,4})\\s*\u5E74\\s*(${wy}{1,2})\\s*\u6708\\s*(${wy}{1,2})\\s*\u65E5$`),handler:wM(["","year","month","day"])},{name:"korean",regex:a.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:wM(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:wM(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let n=wD(),t=e[1].toLowerCase();switch(t){case"tomorrow":n.setUTCDate(n.getUTCDate()+1);break;case"yesterday":n.setUTCDate(n.getUTCDate()-1)}let i={year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate()};return"now"===t&&(i.hour=n.getUTCHours(),i.minute=n.getUTCMinutes(),i.second=n.getUTCSeconds(),i.millisecond=n.getUTCMilliseconds()),console.log("today=>",t,i),i}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,e,n,t,i]){n=parseFloat(n),"week"===(t=t.length<=2?wS[t]:(t=t.replace(/s$/,"")).toLowerCase())&&(t="day",n*=7),("-"===e||i)&&(n*=-1);let r=wD();return"millisecond"===t?r.setUTCMilliseconds(r.getUTCMilliseconds()+n):"second"===t?r.setUTCSeconds(r.getUTCSeconds()+n):"minute"===t?r.setUTCMinutes(r.getUTCMinutes()+n):"hour"===t?r.setUTCHours(r.getUTCHours()+n):"day"===t?r.setUTCDate(r.getUTCDate()+n):"month"===t?r.setUTCMonth(r.getUTCMonth()+n):"year"===t&&r.setUTCFullYear(r.getUTCFullYear()+n),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let n=new Date(1e3*parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let n=new Date(parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:a.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:wM(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:a.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:wM(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:a.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:wM(["","hour","minute","second","meridiem"])},{name:"hms24",regex:a.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:wM(["","hour","minute","second","millisecond"])},{name:"hm12",regex:a.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:wM(["","hour","minute","meridiem"])},{name:"hm24",regex:a.compile("(_H24_):(_MIN_)"),handler:wM(["","hour","minute"])},{name:"h12",regex:a.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:wM(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:wM(["","year","month","day"])},{name:"yearMonthnameDay",regex:a.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:wM(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:a.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:wM(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:a.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:wM(["","monthname","day","","year"])},{name:"dayMonthname",regex:a.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:wM(["","day","","monthname"])},{name:"monthnameDay",regex:a.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:wM(["","monthname","day"])},{name:"hmsNoMeridiem",regex:a.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:wM(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:a.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:wM(["","hour","minute"])},{name:"ymd",regex:a.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:wM(["","year","","month","day"])},{name:"mdy",regex:a.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:wM(["","month","","day","year"])},{name:"dmy",regex:a.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:wM(["","day","month","year"])},{name:"yearLoose",regex:a.compile("_YEAR4_"),handler:wM(["year"])},{name:"dayMonthnameLoose",regex:a.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:wM(["","day","monthname"])},{name:"monthnameDayLoose",regex:a.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:wM(["","monthname","day"])},{name:"monthname",regex:a.compile("_MONTHNAME_"),handler:wM(["monthname"])},{name:"year4",regex:a.compile("_YEAR4_"),handler:wM(["year"])},{name:"md",regex:a.compile("(_MONTH_)[/-](_DAY_)"),handler:wM(["","month","day"])},{name:"dm",regex:a.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:wM(["","day","month"])},{name:"day",regex:a.compile("_DAY_"),handler:wM(["day"])},{name:"year2",regex:a.compile("_YEAR2_"),handler:wM(["year"])},{name:"onlyZone",regex:a.compile("_ZONE_"),handler:wM(["zone"])}],r=a.baseName.slice(0,5),wE.includes(r)?i:i.filter(e=>!["mdy","md"].includes(e.name))),formatter:(t=a,function(e){let n={};for(let[i,r]of Object.entries(e))if("monthname"===i){if(r){let e=t.monthNameToInt(r);void 0!==e&&(n.month=e)}}else if("hour"===i&&e.meridiem){let i=t.h12ToInt(r,e.meridiem);void 0!==i&&(n.hour=i)}else if("zone"===i){if(r){let e=t.zoneToOffset(r);void 0!==e&&(n.offset=e)}}else if("offset"===i){let e=t.offsetToMinutes(r);void 0!==e&&(n.offset=e)}else if("millisecond"===i){let e=t.millisecondToInt(r);"number"==typeof e&&(n.millisecond=e)}else if(wO.includes(i)){let e=t.toInt(r);"number"==typeof e&&(n[i]=e)}return n.year<100&&(n.year=wm[n.year]),n.year&&"buddhist"===t.dateOptions.calendar&&(n.year-=543),n})})}return wP[e]}(n),i=function(e,n){let t=wI[n.slice(0,2).toLowerCase()];if(!t)return e;for(let[n,i]of t)e=e.replace(n,i);return e}(e,n);return t.attempt(i)}function wj(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let n=new wg(e.year,e.month-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new wg(n.valueOf()-60*e.offset*1e3):n}function wR(e,n=wh){let t=wN(e,n),i=t.invalid?new wg(NaN):wj(t);return i.isValid()||(i.invalid=`Unable to parse date "${e}"`),i}function wF(e,n=wh){return e instanceof Date?new wg(e.valueOf()):"number"==typeof e?new wg(e):wR(e,n)}Date.fromString=wg.fromString=wR,Date.fromAny=wg.fromAny=wF,"u">typeof window&&(window.anyDateParser={fromString:wR,fromAny:wF,fromObject:wj,attempt:wN});var wL=t(5238),wW=t(83826);let wV=function(e){return null==e};function wG(e,n){var t=function(e,n){if(!n.has(e))throw TypeError("attempted to get private field on non-instance");return n.get(e)}(e,n);return t.get?t.get.call(e):t.value}fx.extend(fE),fx.extend(wW),fx.extend(wL);let wU="YYYY-MM-DDTHH:mm:ss.SSSZZ";function wH(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&fx(e,wU).isValid()}function wq(e){return fx(e).isToday()}function wK(e){return wH(e)?fx(e,wU).toDate():null}function wY(e,n=!1){let t=fx(e);return n&&(t=t.utc()),t.format(wU)}function wJ(e){return fx(e).toDate()}var wZ=new WeakMap;let wX=new class{register(e,n){wG(this,wZ).set(e,n)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let n=`${e.language}-${e.region}`;if(wG(this,wZ).has(n))return wG(this,wZ).get(n)}if(e.language&&wG(this,wZ).has(e.language))return wG(this,wZ).get(e.language);let n=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wG(this,wZ).set(`${e.language}${e.region?`-${e.region}`:""}`,n),n}constructor(){!function(e,n,t){if(n.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");n.set(e,t)}(this,wZ,{writable:!0,value:new Map})}};function wQ(e,n){wX.register(e,n)}function w0(e){let n=e??wf();return wX.getCalendar(n instanceof Intl.Locale?n:new Intl.Locale(n))}let w1={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function w2(e,n={}){let t=wN(e,wf());if(t.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!wV(t.day)&&wV(t.month)&&(t=Object.assign({},nP(t,"day"),{month:t.day})),t.month&&(t.month-=1),t.day&&(t=Object.assign({},nP(t,"day"),{date:t.day}));let i=fx().set(t).toDate();return wV(t.year)&&(n.year=!1),wV(t.month)&&(n.month=!1),wV(t.date)&&(n.day=!1),w3(i,n)}function w3(e,n){let t,i=n?.locale??wf(),r=new Intl.Locale(i),{calendar:a,mode:o,time:s,day:l,month:c,year:u,noToday:p,numberingSystem:d}={...w1,...{noToday:"am"===r.language},...n},f={calendar:a??w0(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:d},h=fx(e).isToday();if(h&&!p)t=(t=new Intl.RelativeTimeFormat(i,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(i)+t.slice(1);else{"en"===r.language&&(i="en-GB");let n=new Intl.DateTimeFormat(i,f).formatToParts(e);("en"===r.language||"am"===r.language)&&"standard"==o&&u&&l&&(n=n.map(w5("-"))),"wide"==o&&(n=n.map(w5(" — "))),"ethiopic"===f.calendar&&(n=n.filter((e,n,t)=>"era"!==e.type&&("literal"!==e.type||!(n<t.length-1)||"era"!==t[n+1].type))),t=n.map(e=>e.value).join("")}return(!0===s||h&&"for today"===s)&&(t+=`, ${w4(e)}`),t}let w5=e=>(n,t,i)=>"literal"!==n.type||" "!==n.value||t<i.length-1&&"era"===i[t+1].type?n:{type:"literal",value:e};function w4(e){return e.toLocaleTimeString(wf(),{hour:"2-digit",minute:"2-digit"})}function w6(e,n){return w3(e,{...n,time:!0})}function w8(e,n){let t=w0("string"==typeof n?new Intl.Locale(n):n);return t?_d(e,vD(t)):e}function w7(e,n){return new Intl.DurationFormat(wf(),n).format(e)}function w9(e,n){if(null==e)return null;if("string"==typeof e){let t=wN(e,wf());return t.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(t.day&&!t.month&&(t={...nP(t,"day"),...{month:t.day}}),t.month&&(t.month-=1),t.day&&(t={...nP(t,"day"),...{date:t.day}}),fx(n).set(t))}return fx(e)}let ke=["years","months","days","hours","minutes","seconds"],kn={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},kt={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function ki(e,n=fx(),t){let i,r=fx(n),a=w9(e,r);if(null==a)return null;if("string"==typeof t){let e=kn[t]??t;return{[e]:r.diff(a,e)}}let{thresholds:o,largestUnit:s,smallestUnit:l}=t??{};if(void 0!==s||void 0!==l){let e,n=l?kn[l]??l:void 0;return e="auto"===s||void 0===s?function(e,n,t){let i=ke.indexOf(t);for(let r=0;r<ke.length;r++){let a=ke[r];if(n.diff(e,a)>0)return r<=i?a:t}return t}(a,r,n??"seconds"):kn[s]??s,function(e,n,t,i){let r=ke.indexOf(t),a=ke.indexOf(i),o=ke.slice(r,a+1),s={},l=e;for(let e of o){let t=n.diff(l,e);s[e]=t,l=l.add(t,e)}return s}(a,r,e,n??e)}let c=(i=function(e){let n={...kt};if(e)for(let[t,i]of Object.entries(e))void 0!==i&&(n[kn[t]??t]=i);return n}(o),r.diff(a,"seconds")<i.seconds?"seconds":r.diff(a,"minutes")<i.minutes?"minutes":r.diff(a,"hours")<i.hours?"hours":r.diff(a,"days")<i.days?"days":r.diff(a,"months")<i.months?"months":"years");return{[c]:r.diff(a,c)}}let kr={style:"short",localeMatcher:"lookup"};function ka(e,n=fx(),t){let i=ki(e,n,t);return null==i?null:w7(i,"object"==typeof t&&t.formatOptions?{...kr,...t.formatOptions}:kr)}let ko=(0,pX.createContext)(null);function ks(){let e=dH({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,n=(0,pX.useMemo)(()=>{let n=wf();return e[n]&&(n=e[n]),n},[window.i18next.language]),t=(0,pX.useMemo)(()=>{let e=w0(n);return void 0!==e?vD(e):void 0},[n]),i=(0,pX.useMemo)(()=>new Intl.Locale(n,{calendar:t?.identifier}),[n,t]),r=(0,pX.useMemo)(()=>t?_d(_v(_k()),t):_v(_k()),[t]);return{calendar:t,intlLocale:i,today_:r}}let kl=new y7(1793,1,1);var kc={};function ku(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function kp(e={}){let{locale:n}=yd();return(0,pX.useMemo)(()=>new(0,$Z.K)(n,e),[n,e])}kc={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var kd={};kd={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let kf=()=>{};function kh(e){var n;let t=(0,pX.useRef)(void 0),{value:i,textValue:r,minValue:a,maxValue:o,isDisabled:s,isReadOnly:l,isRequired:c,onIncrement:u,onIncrementPage:p,onDecrement:d,onDecrementPage:f,onDecrementToMin:h,onIncrementToMax:g}=e,m=yT((n=kd)&&n.__esModule?n.default:n,"@react-aria/spinbutton"),b=(0,pX.useRef)(!1),y=(0,pX.useCallback)(()=>{clearTimeout(t.current),b.current=!1},[]),v=bP(()=>{y()});(0,pX.useEffect)(()=>()=>v(),[]);let $=(0,pX.useRef)(!1),A=()=>{$.current=!0},w=()=>{$.current=!1},k=""===r?m.format("Empty"):(r||`${i}`).replace("-","−");(0,pX.useEffect)(()=>{$.current&&(yf&&yf.clear("assertive"),yh(k,"assertive"))},[k]);let x=(0,pX.useCallback)(()=>{y()},[y]),C=bP(u??kf),E=bP(d??kf),S=bP(()=>{(void 0===o||isNaN(o)||void 0===i||isNaN(i)||i<o)&&(C(),D(60))}),D=bP(e=>{v(),b.current=!0,t.current=window.setTimeout(S,e)}),M=bP(()=>{(void 0===a||isNaN(a)||void 0===i||isNaN(i)||i>a)&&(E(),z(60))}),z=bP(e=>{v(),b.current=!0,t.current=window.setTimeout(M,e)}),O=e=>{e.preventDefault()},{addGlobalListener:P,removeAllGlobalListeners:T}=bT(),B=(0,pX.useRef)(!1),[I,N]=(0,pX.useState)(null);(0,pX.useEffect)(()=>{"touch"===I?D(600):I&&D(400)},[I]);let[j,R]=(0,pX.useState)(null);return(0,pX.useEffect)(()=>{"touch"===j?z(600):j&&z(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===i||isNaN(i)?void 0:i,"aria-valuetext":k,"aria-valuemin":a,"aria-valuemax":o,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":c||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(p){e.preventDefault(),p?.();break}case"ArrowUp":case"Up":u&&(e.preventDefault(),u?.());break;case"PageDown":if(f){e.preventDefault(),f?.();break}case"ArrowDown":case"Down":d&&(e.preventDefault(),d?.());break;case"Home":h&&(e.preventDefault(),h?.());break;case"End":g&&(e.preventDefault(),g?.())}},onFocus:A,onBlur:w},incrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(u?.(),N("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,N("touch")),P(window,"contextmenu",O)},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),N(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&u?.(),B.current=!1,N(null)},onFocus:A,onBlur:w},decrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(d?.(),R("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,R("touch"))},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),R(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&d?.(),B.current=!1,R(null)},onFocus:A,onBlur:w}}}let kg=null;var km=t(66284);function kb(e,n,t){let i="+"===e?n+t:n-t;if(n%1!=0||t%1!=0){let r=n.toString().split("."),a=t.toString().split("."),o=Math.pow(10,Math.max(r[1]&&r[1].length||0,a[1]&&a[1].length||0));n=Math.round(n*o),t=Math.round(t*o),i=("+"===e?n+t:n-t)/o}return i}let ky=(0,pX.createContext)(null),k_=(0,pX.createContext)(null),kv=(0,pX.forwardRef)(function(e,n){var t,i;[e,n]=mm(e,n,ky);let{validationBehavior:r}=mg(Al)||{},a=null!=(i=null!=(t=e.validationBehavior)?t:r)?i:"native",{locale:o}=yd(),s=function(e){let{minValue:n,maxValue:t,step:i,formatOptions:r,value:a,defaultValue:o=NaN,onChange:s,locale:l,isDisabled:c,isReadOnly:u,commitBehavior:p="snap"}=e;null===a&&(a=NaN);let d=(0,pX.useCallback)(e=>void 0===i||isNaN(i)?Ag(e,n,t):Ab(e,n,t,i),[i,n,t]);void 0===a||isNaN(a)||"snap"!==p||(a=d(a)),isNaN(o)||"snap"!==p||(o=d(o));let[f,h]=vj(a,isNaN(o)?NaN:o,s),[g]=(0,pX.useState)(f),[m,b]=(0,pX.useState)(()=>isNaN(f)?"":new(0,$Z.K)(l,r).format(f)),y=(0,pX.useMemo)(()=>new(0,km.d)(l,r),[l,r]),v=(0,pX.useMemo)(()=>y.getNumberingSystem(m),[y,m]),$=(0,pX.useMemo)(()=>new(0,$Z.K)(l,{...r,numberingSystem:v}),[l,r,v]),A=(0,pX.useMemo)(()=>$.resolvedOptions(),[$]),w=(0,pX.useCallback)(e=>isNaN(e)||null===e?"":$.format(e),[$]),k=$P({...e,value:f}),x=void 0===i||isNaN(i)?1:i;"percent"===A.style&&(void 0===i||isNaN(i))&&(x=.01);let[C,E]=(0,pX.useState)(f),[S,D]=(0,pX.useState)(l),[M,z]=(0,pX.useState)(r);Object.is(f,C)&&l===S&&r===M||(b(w(f)),E(f),D(l),z(r));let O=(0,pX.useMemo)(()=>y.parse(m),[y,m]),P=(e,i=0)=>{if(isNaN(O))return Ab(isNaN(i)?0:i,n,t,x);{let i=Ab(O,n,t,x);return"+"===e&&i>O||"-"===e&&i<O?i:Ab(kb(e,O,x),n,t,x)}},T=(0,pX.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===t||isNaN(t)||Ab(O,n,t,x)>O||kb("+",O,x)<=t),[c,u,n,t,x,O]),B=(0,pX.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===n||isNaN(n)||Ab(O,n,t,x)<O||kb("-",O,x)>=n),[c,u,n,t,x,O]);return{...k,validate:e=>y.isValidPartialNumber(e,n,t),increment:()=>{let e=P("+",n);e===f&&b(w(e)),h(e),k.commitValidation()},incrementToMax:()=>{null!=t&&(h(Ab(t,n,t,x)),k.commitValidation())},decrement:()=>{let e=P("-",t);e===f&&b(w(e)),h(e),k.commitValidation()},decrementToMin:()=>{null!=n&&(h(n),k.commitValidation())},canIncrement:T,canDecrement:B,minValue:n,maxValue:t,numberValue:O,defaultNumberValue:isNaN(o)?g:o,setNumberValue:h,setInputValue:b,inputValue:m,commit:e=>{let n=void 0===e?m:e,t=O;if(void 0!==e&&(t=y.parse(n)),!n.length){h(NaN),b(void 0===a?"":w(f));return}if(isNaN(t))return void b(w(f));let i="snap"===p?d(t):t,r=(i=y.parse(w(i)))!==f;h(i),b(w(void 0===a?i:f)),r&&k.commitValidation()}}}({...e,locale:o,validationBehavior:a}),l=(0,pX.useRef)(null),[c,u]=mb(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:p,groupProps:d,inputProps:f,incrementButtonProps:h,decrementButtonProps:g,descriptionProps:m,errorMessageProps:b,...y}=function(e,n,t){var i,r,a,o,s,l,c,u,p;let d,{id:f,decrementAriaLabel:h,incrementAriaLabel:g,isDisabled:m,isReadOnly:b,isRequired:y,minValue:v,maxValue:$,autoFocus:A,label:w,formatOptions:k,onBlur:x=()=>{},onFocus:C,onFocusChange:E,onKeyDown:S,onKeyUp:D,description:M,errorMessage:z,isWheelDisabled:O,...P}=e,{increment:T,incrementToMax:B,decrement:I,decrementToMin:N,numberValue:j,inputValue:R,commit:F,commitValidation:L}=n,W=yT((i=kc)&&i.__esModule?i.default:i,"@react-aria/numberfield"),V=(0,pX.useCallback)(()=>{let e=t.current?.value??"";(0,bB.flushSync)(()=>{F()}),t.current?.value!==e&&yh(t.current?.value??"","assertive")},[F,t]),G=ml(f),{focusProps:U}=b_({onBlur(){V()}}),H=kp(k),q=(0,pX.useMemo)(()=>H.resolvedOptions(),[H]),K=kp({...k,currencySign:void 0}),Y=(0,pX.useMemo)(()=>isNaN(j)?"":K.format(j),[K,j]),{spinButtonProps:J,incrementButtonProps:Z,decrementButtonProps:X}=kh({isDisabled:m,isReadOnly:b,isRequired:y,maxValue:$,minValue:v,onIncrement:T,onIncrementToMax:B,onDecrement:I,onDecrementToMin:N,value:j,textValue:Y}),[Q,ee]=(0,pX.useState)(!1),{focusWithinProps:en}=bK({isDisabled:m,onFocusWithinChange:ee});!function(e,n){let{onScroll:t,isDisabled:i}=e,r=(0,pX.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),t&&t({deltaX:e.deltaX,deltaY:e.deltaY}))},[t]);_V(n,"wheel",i?void 0:r)}({onScroll:(0,pX.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?T():e.deltaY<0&&I())},[I,T]),isDisabled:O||m||b||!Q},t);let et=(q.maximumFractionDigits??0)>0,ei=void 0===n.minValue||isNaN(n.minValue)||n.minValue<0,er="numeric";mQ()?ei?er="text":et&&(er="decimal"):m5()&&(ei?er="numeric":et&&(er="decimal"));let ea=mD(e),eo=(0,pX.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,bB.flushSync)(()=>{F()}),L()):e.continuePropagation())},[F,L]),{isInvalid:es,validationErrors:el,validationDetails:ec}=n.displayValidation,{labelProps:eu,inputProps:ep,descriptionProps:ed,errorMessageProps:ef}=function(e,n,t){let i=bP(e=>{let i=t.current;if(!i)return;let r=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":r=i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd);break;case"deleteContentForward":r=i.selectionEnd===i.selectionStart?i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd+1):i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd);break;case"deleteContentBackward":r=i.selectionEnd===i.selectionStart?i.value.slice(0,i.selectionStart-1)+i.value.slice(i.selectionStart):i.value.slice(0,i.selectionStart)+i.value.slice(i.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":r=i.value.slice(i.selectionStart);break;default:null!=e.data&&(r=i.value.slice(0,i.selectionStart)+e.data+i.value.slice(i.selectionEnd))}null!=r&&n.validate(r)||e.preventDefault()});(0,pX.useEffect)(()=>{if(!ku()||!t.current)return;let e=t.current;return e.addEventListener("beforeinput",i,!1),()=>{e.removeEventListener("beforeinput",i,!1)}},[t]);let r=ku()?null:e=>{let t=mB(e).value.slice(0,mB(e).selectionStart)+e.data+mB(e).value.slice(mB(e).selectionEnd);n.validate(t)||e.preventDefault()},{labelProps:a,inputProps:o,descriptionProps:s,errorMessageProps:l,...c}=function(e,n){let{inputElementType:t="input",isDisabled:i=!1,isRequired:r=!1,isReadOnly:a=!1,type:o="text",validationBehavior:s="aria"}=e,[l,c]=vj(e.value,e.defaultValue||"",e.onChange),{focusableProps:u}=bw(e,n),p=$P({...e,value:l}),{isInvalid:d,validationErrors:f,validationDetails:h}=p.displayValidation,{labelProps:g,fieldProps:m,descriptionProps:b,errorMessageProps:y}=$v({...e,isInvalid:d,errorMessage:e.errorMessage||f}),v=mD(e,{labelable:!0}),$={type:o,pattern:e.pattern},[A]=(0,pX.useState)(l);return $$(n,e.defaultValue??A,c),$A(e,p,n),{labelProps:g,inputProps:mp(v,"input"===t?$:void 0,{disabled:i,readOnly:a,required:r&&"native"===s,"aria-required":r&&"aria"===s||void 0,"aria-invalid":d||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>c(mB(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(pQ().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...u,...m}),descriptionProps:b,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:h}}(e,t),u=(0,pX.useRef)(null);return{inputProps:mp(o,{onBeforeInput:r,onCompositionStart(){let{value:e,selectionStart:n,selectionEnd:i}=t.current;u.current={value:e,selectionStart:n,selectionEnd:i}},onCompositionEnd(){if(t.current&&!n.validate(t.current.value)){let{value:e,selectionStart:i,selectionEnd:r}=u.current;t.current.value=e,t.current.setSelectionRange(i,r),n.setInputValue(e)}}}),labelProps:a,descriptionProps:s,errorMessageProps:l,...c}}({...P,...ea,name:void 0,form:void 0,label:w,autoFocus:A,isDisabled:m,isReadOnly:b,isRequired:y,validate:void 0,[$O]:n,value:R,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:G,type:"text",inputMode:er,onChange:e=>{n.validate(e)&&n.setInputValue(e)},onBlur:x,onFocus:C,onFocusChange:E,onKeyDown:(0,pX.useMemo)(()=>g4(eo,S),[eo,S]),onKeyUp:D,onPaste:n=>{e.onPaste?.(n);let t=mB(n);t&&(t.selectionEnd??-1)-(t.selectionStart??0)===t.value.length&&(n.preventDefault(),F(n.clipboardData?.getData?.("text/plain")?.trim()??""))},description:M,errorMessage:z},n,t);$$(t,n.defaultNumberValue,n.setNumberValue),r=n,a=e.validationBehavior,o=e.commitBehavior,s=t,l=n.minValue,c=n.maxValue,u=e.step,p=n.numberValue,g6(()=>{let e=s.current;if("validate"!==o||r.realtimeValidation.isInvalid||!e||e.disabled||(!kg&&"u">typeof document&&((kg=document.createElement("input")).type="number"),!kg))return;kg.min=null==l||isNaN(l)?"":String(l),kg.max=null==c||isNaN(c)?"":String(c),kg.step=null==u||isNaN(u)?"":String(u),kg.value=null==p||isNaN(p)?"":String(p);let n=e.validity.valid&&kg.validity.valid,t=e.validationMessage||kg.validationMessage,i={isInvalid:!n,validationErrors:t?[t]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:kg.validity.rangeOverflow,rangeUnderflow:kg.validity.rangeUnderflow,stepMismatch:kg.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:n}};r.updateValidation(i),"native"!==a||kg.validity.valid||e.setCustomValidity(kg.validationMessage)});let eh=mp(J,U,ep,{role:null,"aria-roledescription":m1()?null:W.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(eh["aria-required"]=void 0);let eg=e=>{((e=document)=>e.activeElement)()!==t.current&&("mouse"===e.pointerType?t.current?.focus():e.target.focus())},em=e["aria-label"]||("string"==typeof e.label?e.label:"");em||(d=null!=e.label?eu.id:e["aria-labelledby"]);let eb=ml(),ey=ml(),e_=mp(Z,{"aria-label":g||W.format("increase",{fieldLabel:em}).trim(),id:d&&!g?eb:null,"aria-labelledby":d&&!g?`${eb} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canIncrement,onPressStart:eg}),ev=mp(X,{"aria-label":h||W.format("decrease",{fieldLabel:em}).trim(),id:d&&!h?ey:null,"aria-labelledby":d&&!h?`${ey} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canDecrement,onPressStart:eg});return{groupProps:{...en,role:"group","aria-disabled":m,"aria-invalid":es?"true":void 0},labelProps:eu,inputProps:eh,incrementButtonProps:e_,decrementButtonProps:ev,errorMessageProps:ef,descriptionProps:ed,isInvalid:es,validationErrors:el,validationDetails:ec}}({...my(e),label:u,validationBehavior:a},s,l),v=mh({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:y.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),$=mD(e);return delete $.id,pQ().createElement(mf,{values:[[k_,s],[v2,d],[v5,{...f,ref:l}],[Ac,{...p,ref:c}],[b5,{slots:{increment:h,decrement:g}}],[b8,{slots:{description:m,errorMessage:b}}],[Aa,y]]},pQ().createElement("div",{...$,...v,ref:n,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":y.isInvalid||void 0}),e.name&&pQ().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function k$(e,n){return Number.parseInt(w3(e,{calendar:n.calendar,locale:n.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let kA=(0,pX.forwardRef)(function(e,n){let{className:t}=e,i=(0,pX.useContext)(vH),r=(0,pX.useContext)(vq),a=i??r,o=(0,pX.useContext)(ko),s=_k(),l=w3(a.visibleRange.start.toDate(s),{calendar:o.calendar,locale:o.baseName,day:!1,year:!1,noToday:!0}),c=k$(a.visibleRange.start.toDate(s),o),u=a.maxValue?k$(a.maxValue.toDate(s),o):void 0,p=a.minValue?k$(a.minValue.toDate(s),o):void 0,d=(0,pX.useCallback)(e=>{a.setFocusedDate(a.focusedDate.cycle("year",e-a.focusedDate.year))},[]);return a&&(0,fG.jsxs)("span",{ref:n,className:t,children:[(0,fG.jsx)("span",{children:l}),(0,fG.jsxs)(kv,{formatOptions:{useGrouping:!1},maxValue:u,minValue:p,onChange:d,value:c,children:[(0,fG.jsx)(v4,{}),(0,fG.jsxs)(v3,{children:[(0,fG.jsx)(b4,{slot:"increment",children:(0,fG.jsx)(hM,{size:8})}),(0,fG.jsx)(b4,{slot:"decrement",children:(0,fG.jsx)(hE,{size:8})})]})]})]})});var kw=t(74782),kk={};kk.styleTagTransform=f5(),kk.setAttributes=f0(),kk.insert=fX().bind(null,"head"),kk.domAPI=fJ(),kk.insertStyleElement=f2(),fK()(kw.A,kk);let kx=kw.A&&kw.A.locals?kw.A.locals:void 0;function kC({children:e}){let n=(0,pX.useContext)(wo),t=(0,pX.useContext)(ws),i=n??t,r=fh(()=>i?.close());return(0,fG.jsx)(Ar,{className:kx.dialog,ref:r,children:e})}let kE=(0,pX.forwardRef)(function({variant:e,today_:n,minDate:t,maxDate:i},r){let a="range"===e;return(0,fG.jsx)(wn,{ref:r,className:kx.popover,placement:"bottom start",offset:1,isNonModal:!0,children:(0,fG.jsx)(kC,{children:(0,fG.jsxs)(a?vY:vK,{...a?{minValue:t,maxValue:i,className:"cds--date-picker__calendar"}:{},children:[(0,fG.jsxs)("header",{className:kx.header,children:[(0,fG.jsx)(b4,{className:fH()(kx.flatButton,kx.flatButtonMd),slot:"previous",children:(0,fG.jsx)(hN,{size:16})}),(0,fG.jsx)(kA,{className:kx.monthYear}),(0,fG.jsx)(b4,{className:fH()(kx.flatButton,kx.flatButtonMd),slot:"next",children:(0,fG.jsx)(hj,{size:16})})]}),(0,fG.jsx)(vZ,{className:kx.calendarGrid,children:e=>(0,fG.jsx)(v1,{className:fH()("cds--date-picker__day",{[kx.today]:0===n.compare(e)}),date:e},e.toString())})]})})})}),kS=(0,pX.forwardRef)(function(e,n){let t=(0,pX.useContext)(wo),[i,r]=mm({slot:e.slot},n,$2),{locale:a}=yd(),o=$1({...i,locale:a,createCalendar:vD}),s=(0,pX.useRef)(null),{fieldProps:l,inputProps:c}=$C({...i,inputRef:s},o,r),u=(0,pX.useCallback)(()=>{o.isDisabled||t.toggle()},[]);return(0,fG.jsxs)(mf,{values:[[$3,o],[v5,{...c,ref:s}],[v2,{...l,ref:r,isInvalid:o.isInvalid}]],children:[(0,fG.jsx)(v3,{...e,id:e.id,ref:n,slot:e.slot||void 0,className:e.className,isDisabled:o.isDisabled,isInvalid:o.isInvalid,onClick:u,children:o.segments.map((n,t)=>(0,pX.cloneElement)(e.children(n),{key:t}))}),(0,fG.jsx)(v4,{})]})}),kD=(0,pX.forwardRef)(function(e,n){let t=(0,pX.useContext)(wo),i=(0,pX.useContext)(ws);return(t??i).isInvalid?(0,fG.jsx)(gV,{ref:n,size:16,...e}):(0,fG.jsx)(hC,{ref:n,size:16,...e})});class kM{constructor(e,n){this.locale=e,this.dictionary=n}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let kz=new Map,kO=(0,pX.forwardRef)(function({segment:e,...n},t){let i=(0,pX.useContext)($3),r=g2(t),{segmentProps:a}=function(e,n,t){let i,r,a,o,s=(0,pX.useRef)(""),{locale:l,direction:c}=yd(),u=function(){var e;let{locale:n}=yd(),t=yP((e=$b)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,pX.useMemo)(()=>{try{return new Intl.DisplayNames(n,{type:"dateTimeField"})}catch{return new kM(n,t)}},[n,t])}(),{ariaLabel:p,ariaLabelledBy:d,ariaDescribedBy:f,focusManager:h}=$w.get(n),g=e.isPlaceholder?"":e.text,m=(0,pX.useMemo)(()=>n.dateFormatter.resolvedOptions(),[n.dateFormatter]),b=yk({month:"long",timeZone:m.timeZone}),y=yk({hour:"numeric",hour12:m.hour12,timeZone:m.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(g=y.format(n.dateValue));else{let e=b.format(n.dateValue);g=e!==g?`${g} \u{2013} ${e}`:e}let{spinButtonProps:v}=kh({value:e.value??void 0,textValue:g,minValue:e.minValue,maxValue:e.maxValue,isDisabled:n.isDisabled,isReadOnly:n.isReadOnly||!e.isEditable,isRequired:n.isRequired,onIncrement:()=>{s.current="",n.increment(e.type)},onDecrement:()=>{s.current="",n.decrement(e.type)},onIncrementPage:()=>{s.current="",n.incrementPage(e.type)},onDecrementPage:()=>{s.current="",n.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",n.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",n.decrementToMin(e.type)}}),$=(0,pX.useMemo)(()=>new(0,km.d)(l,{maximumFractionDigits:0}),[l]),A=()=>{if(e.text===e.placeholder&&h.focusPrevious(),!$.isValidPartialNumber(e.text)||n.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&n.clearSegment(e.type);else{let t=e.text.slice(0,-1),i=$.parse(t);0===(t=0===i?"":t).length||0===i?n.clearSegment(e.type):n.setSegment(e.type,i),s.current=t}},{startsWith:w}=(i=function(e){let{locale:n}=yd(),t=n+(e?Object.entries(e).sort((e,n)=>e[0]<n[0]?-1:1).join():"");if(kz.has(t))return kz.get(t);let i=new Intl.Collator(n,e);return kz.set(t,i),i}({usage:"search",sensitivity:"base"}),r=(0,pX.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===i.compare(e.slice(0,n.length),n)),[i]),a=(0,pX.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===i.compare(e.slice(-n.length),n)),[i]),o=(0,pX.useCallback)((e,n)=>{if(0===n.length)return!0;e=e.normalize("NFC");let t=0,r=(n=n.normalize("NFC")).length;for(;t+r<=e.length;t++){let a=e.slice(t,t+r);if(0===i.compare(n,a))return!0}return!1},[i]),(0,pX.useMemo)(()=>({startsWith:r,endsWith:a,contains:o}),[r,a,o])),k=yk({hour:"numeric",hour12:!0}),x=(0,pX.useMemo)(()=>{let e=new Date;return e.setHours(0),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),C=(0,pX.useMemo)(()=>{let e=new Date;return e.setHours(12),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),E=yk({year:"numeric",era:"narrow",timeZone:"UTC"}),S=(0,pX.useMemo)(()=>{if("era"!==e.type)return[];let t=_d(new y7(1,1,1),n.calendar),i=n.calendar.getEras().map(e=>{let n=t.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:E.formatToParts(n).find(e=>"era"===e.type).value}}),r=function(e){e.sort();let n=e[0],t=e[e.length-1];for(let e=0;e<n.length;e++)if(n[e]!==t[e])return e;return 0}(i.map(e=>e.formatted));if(r)for(let e of i)e.formatted=e.formatted.slice(r);return i},[E,n.calendar,e.type]),D=t=>{if(n.isDisabled||n.isReadOnly)return;let i=s.current+t;switch(e.type){case"dayPeriod":if(w(x,t))n.setSegment("dayPeriod",0);else if(w(C,t))n.setSegment("dayPeriod",1);else break;h.focusNext();break;case"era":{let e=S.find(e=>w(e.formatted,t));e&&(n.setSegment("era",e.era),h.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!$.isValidPartialNumber(i))return;let r=$.parse(i),a=r;if(void 0!==e.maxValue&&r>e.maxValue&&(a=$.parse(t)),isNaN(r))return;n.setSegment(e.type,a),void 0!==e.maxValue&&(Number(r+"0")>e.maxValue||i.length>=String(e.maxValue).length)?(s.current="",h.focusNext()):s.current=i}}};_V((0,pX.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mT(t.current,e?.anchorNode)&&e.collapse(t.current)});let M=(0,pX.useRef)("");_V(t,"beforeinput",i=>{if(t.current)switch(i.preventDefault(),i.inputType){case"deleteContentBackward":case"deleteContentForward":$.isValidPartialNumber(e.text)&&!n.isReadOnly&&A();break;case"insertCompositionText":M.current=t.current.textContent,t.current.textContent=t.current.textContent;break;default:null!=i.data&&D(i.data)}}),_V(t,"input",e=>{let{inputType:n,data:i}=e;"insertCompositionText"===n&&(t.current&&(t.current.textContent=M.current),null!=i&&(w(x,i)||w(C,i))&&D(i))}),g6(()=>{let e=t.current;return()=>{((e=document)=>e.activeElement)()===e&&(h.focusPrevious()||h.focusNext())}},[t,h]);let z=m1()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,pX.useMemo)(()=>n.segments.find(e=>e.isEditable),[n.segments])||n.isInvalid||(f=void 0);let O=ml(),P=!n.isDisabled&&!n.isReadOnly&&e.isEditable,T="literal"===e.type?"":u.of(e.type),B=_j({"aria-label":`${T}${p?`, ${p}`:""}${d?", ":""}`,"aria-labelledby":d});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===c){I.unicodeBidi="embed";let n=m[e.type];("numeric"===n||"2-digit"===n)&&(I.direction="ltr")}return{segmentProps:mp(v,B,{id:O,...z,"aria-invalid":n.isInvalid?"true":void 0,"aria-describedby":f,"aria-readonly":n.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:P,suppressContentEditableWarning:P,spellCheck:P?"false":void 0,autoCorrect:P?"off":void 0,[parseInt(pQ().version,10)>=17?"enterKeyHint":"enterkeyhint"]:P?"next":void 0,inputMode:n.isDisabled||"dayPeriod"===e.type||"era"===e.type||!P?void 0:"numeric",tabIndex:n.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(mX()?e.metaKey:e.ctrlKey)&&e.preventDefault(),!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey)switch(e.key){case"Backspace":case"Delete":e.preventDefault(),e.stopPropagation(),A()}},onFocus:()=>{s.current="",t.current&&_K(t.current,{containingElement:_U(t.current)});let e=window.getSelection();e?.collapse(t.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,i,r),{focusProps:o,isFocused:s,isFocusVisible:l}=bY(),{hoverProps:c,isHovered:u}=b0({...n,isDisabled:i.isDisabled||"literal"===e.type}),p=function(e){let{className:n,style:t,children:i,defaultClassName:r,defaultChildren:a,defaultStyle:o,values:s}=e;return(0,pX.useMemo)(()=>{let e,l,c;return e="function"==typeof n?n({...s,defaultClassName:r}):n,l="function"==typeof t?t({...s,defaultStyle:o||{}}):t,c="function"==typeof i?i({...s,defaultChildren:a}):null==i?a:i,{className:e??r,style:l||o?{...o,...l}:void 0,children:c??a,"data-rac":""}},[n,t,i,r,a,o,s])}({...n,values:{...e,isReadOnly:!e.isEditable,isInvalid:i.isInvalid,isDisabled:i.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),d=(0,pX.useCallback)(e=>{e.stopPropagation()},[]);return(0,fG.jsx)("span",{...mp(mD(n),a,o,c),...p,ref:r,style:a.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":i.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":i.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:d})}),kP={short:!1,size:"md"},kT=(0,pX.forwardRef)(function(e,n){let{className:t,defaultValue:i,isDisabled:r,invalid:a,invalidText:o,isInvalid:s,label:l,labelText:c,light:u,maxDate:p,minDate:d,onChange:f,onChangeRaw:h,short:g,size:m,value:b,...y}={...kP,...e},{calendar:v,intlLocale:$,today_:A}=ks(),w=(0,pX.useId)(),k=!!(c??l),x=(0,pX.useMemo)(()=>wp(i,v),[i,v]),C=(0,pX.useMemo)(()=>wp(b,v,!0),[b,v]),E=(0,pX.useMemo)(()=>wp(p,v),[p,v]),S=(0,pX.useMemo)(()=>wp(d??kl,v),[d,v]),D=(0,pX.useMemo)(()=>a||s,[a,s]),M=(0,pX.useMemo)(()=>(h&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),h??(e=>f?.(wd(e)))),[h,f]);return(0,fG.jsx)(wu,{locale:$.toString(),children:(0,fG.jsx)("div",{className:fH()("cds--form-item",t),children:(0,fG.jsx)(mf,{values:[[ko,$]],children:(0,fG.jsxs)(wl,{className:fH()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":g,"cds--date-picker--light":u}),defaultValue:x,isDisabled:r,isInvalid:D,maxValue:E,minValue:S,value:C,shouldForceLeadingZeros:"en"===$.language||void 0,...y,onChange:M,children:[(0,fG.jsxs)("div",{className:"cds--date-picker-container",children:[k&&(0,fG.jsx)(Au,{className:fH()("cds--label",{"cds--label--disabled":r}),htmlFor:w,children:c??l}),(0,fG.jsxs)(v3,{className:kx.inputGroup,children:[(0,fG.jsx)(kS,{id:k?w:void 0,ref:n,className:fH()("cds--date-picker-input__wrapper",kx.inputWrapper,{[kx.inputWrapperSm]:"sm"===m,[kx.inputWrapperMd]:"md"===m||!m||0===m.length,[kx.inputWrapperLg]:"lg"===m}),children:e=>"era"!==e.type?(0,fG.jsx)(kO,{className:kx.inputSegment,segment:e}):(0,fG.jsx)(pQ().Fragment,{})}),(0,fG.jsx)(b4,{className:fH()(kx.flatButton,{[kx.flatButtonSm]:"sm"===m,[kx.flatButtonMd]:"md"===m||!m||0===m.length,[kx.flatButtonLg]:"lg"===m}),children:(0,fG.jsx)(kD,{})})]}),(0,fG.jsx)(Ao,{className:kx.invalidText,children:o})]}),(0,fG.jsx)(kE,{variant:"single",today_:A})]})})})})}),kB=(0,pX.forwardRef)(function({className:e,defaultValue:n,invalid:t,invalidText:i,isDisabled:r,isInvalid:a,label:o,labelText:s,light:l,maxDate:c,minDate:u,onChange:p,onChangeRaw:d,size:f="md",value:h,...g},m){let{calendar:b,intlLocale:y,today_:v}=ks(),$=(0,pX.useId)(),A=!!(s??o),w=(0,pX.useMemo)(()=>{if(h)return{start:wp(h[0],b,!1),end:wp(h[1],b,!1)}},[h,b]),k=(0,pX.useMemo)(()=>{if(n)return{start:wp(n[0],b,!1),end:wp(n[1],b,!1)}},[n,b]),x=(0,pX.useMemo)(()=>wp(u??kl,b,!0),[u,b]),C=(0,pX.useMemo)(()=>wp(c,b,!0),[c,b]),E=(0,pX.useMemo)(()=>t||a,[t,a]),S=(0,pX.useMemo)(()=>(d&&p&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),d??(e=>p?.([wd(e.start),wd(e.end)]))),[d,p]);return(0,fG.jsx)(wu,{locale:y.toString(),children:(0,fG.jsx)("div",{className:fH()("cds--form-item",e),children:(0,fG.jsx)(mf,{values:[[ko,y]],children:(0,fG.jsx)(wc,{id:A?$:void 0,className:fH()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":r}),isInvalid:E,shouldForceLeadingZeros:"en"===y.language||void 0,maxValue:C,minValue:x,value:w,defaultValue:k,ref:m,isDisabled:r,...g,onChange:S,children:(0,fG.jsxs)("div",{className:"cds--date-picker-container",children:[A&&(0,fG.jsx)(Au,{className:fH()("cds--label",{"cds--label--disabled":r}),htmlFor:$,children:s??o}),(0,fG.jsxs)(v3,{className:kx.inputGroup,children:[(0,fG.jsxs)("div",{className:fH()(kx.inputsWrapper,{[kx.inputsWrapperSm]:"sm"===f,[kx.inputsWrapperMd]:"md"===f||!f||0===f.length,[kx.inputsWrapperLg]:"lg"===f}),children:[(0,fG.jsx)($4,{className:fH()("cds--date-picker-input__wrapper",kx.startInput,kx.dateInputWrapper),slot:"start",children:e=>(0,fG.jsx)(kO,{className:kx.inputSegment,segment:e})}),(0,fG.jsx)("div",{className:kx.separator,children:(0,fG.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,fG.jsx)($4,{className:fH()("cds--date-picker-input__wrapper",kx.endInput,kx.dateInputWrapper),slot:"end",children:e=>(0,fG.jsx)(kO,{className:kx.inputSegment,segment:e})})]}),(0,fG.jsx)(b4,{className:fH()(kx.flatButton,{[kx.flatButtonSm]:"sm"===f,[kx.flatButtonMd]:"md"===f||!f||0===f.length,[kx.flatButtonLg]:"lg"===f}),children:(0,fG.jsx)(kD,{})})]}),(0,fG.jsx)(Ao,{className:kx.invalidText,children:i}),(0,fG.jsx)(kE,{variant:"range",today_:v,minDate:x,maxDate:C})]})})})})})});var kI=t(89124),kN={};kN.styleTagTransform=f5(),kN.setAttributes=f0(),kN.insert=fX().bind(null,"head"),kN.domAPI=fJ(),kN.insertStyleElement=f2(),fK()(kI.A,kN);let kj=kI.A&&kI.A.locals?kI.A.locals:void 0,kR=({diagnoses:e})=>{let{diagnosisTags:n}=dH({externalModuleName:"@openmrs/esm-styleguide"});return(0,fG.jsx)("div",{className:kj.container,children:e.map(e=>{let{rank:t,uuid:i,display:r}=e,a=n[1===t?"primaryColor":"secondaryColor"];return(0,fG.jsx)(ht.vwO,{type:a,children:r},i)})})};var kF=t(87770),kL={};kL.styleTagTransform=f5(),kL.setAttributes=f0(),kL.insert=fX().bind(null,"head"),kL.domAPI=fJ(),kL.insertStyleElement=f2(),fK()(kF.A,kL);let kW=kF.A&&kF.A.locals?kF.A.locals:void 0,kV=({width:e="64",height:n="64"})=>(0,fG.jsx)("svg",{width:e,height:n,viewBox:"0 0 64 64",children:(0,fG.jsx)("use",{href:"#omrs-empty-data-illustration"})}),kG=e=>{let n="tablet"===fc(),t=e.launchForm;return(0,fG.jsx)(ht.Wdr,{className:kW.layer,children:(0,fG.jsxs)(ht.FAs,{className:kW.tile,children:[(0,fG.jsx)("div",{className:n?kW.tabletHeading:kW.desktopHeading,children:(0,fG.jsx)("h4",{children:e.headerTitle})}),(0,fG.jsx)(kV,{}),(0,fG.jsx)("p",{className:kW.content,children:ad("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,fG.jsx)("p",{className:kW.action,children:t&&(0,fG.jsx)(ht.$nd,{onClick:()=>t(),kind:"ghost",size:n?"lg":"sm",children:ad("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})};var kU=t(88480),kH={};kH.styleTagTransform=f5(),kH.setAttributes=f0(),kH.insert=fX().bind(null,"head"),kH.domAPI=fJ(),kH.insertStyleElement=f2(),fK()(kU.A,kH);let kq=kU.A&&kU.A.locals?kU.A.locals:void 0,kK=({error:e,headerTitle:n})=>{let t="tablet"===fc();return(0,fG.jsx)(ht.Wdr,{children:(0,fG.jsxs)(ht.FAs,{className:kq.tile,children:[(0,fG.jsx)("div",{className:t?kq.tabletHeading:kq.desktopHeading,children:(0,fG.jsx)("h4",{children:n})}),(0,fG.jsxs)("p",{className:kq.errorMessage,children:[ad("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,fG.jsx)("p",{className:kq.errorCopy,children:ad("errorCopy")})]})})},kY=kK;var kJ=t(15764),kZ={};kZ.styleTagTransform=f5(),kZ.setAttributes=f0(),kZ.insert=fX().bind(null,"head"),kZ.domAPI=fJ(),kZ.insertStyleElement=f2(),fK()(kJ.A,kZ);let kX=kJ.A&&kJ.A.locals?kJ.A.locals:void 0,kQ=pQ().forwardRef((e,n)=>{let{slotName:t,basePath:i,componentContext:r,state:a}=fd(),o=window.location??{pathname:""},s=p9(t??"");return e.isChildOfHeader&&t&&s.length>0?(0,fG.jsxs)(ht.f8J,{"aria-label":ad("leftNavigation","Left navigation"),className:kX.leftNav,expanded:!0,isFixedNav:!0,ref:n,...e,children:[(0,fG.jsx)(dt,{name:"global-nav-menu-slot"}),t?(0,fG.jsx)(dN,{value:r,fallback:(0,fG.jsx)(dt,{name:t,state:{basePath:i,currentPath:o,...a}}),children:(0,fG.jsx)(p0.Provider,{value:r,children:(0,fG.jsx)(dt,{name:t,state:{basePath:i,currentPath:o,...a}})})}):null]}):null});var k0=t(48500),k1={};k1.styleTagTransform=f5(),k1.setAttributes=f0(),k1.insert=fX().bind(null,"head"),k1.domAPI=fJ(),k1.insertStyleElement=f2(),fK()(k0.A,k1);let k2=k0.A&&k0.A.locals?k0.A.locals:void 0,k3=({selectedLocationUuid:e,defaultLocationUuid:n,locationTag:t,locationsPerRequest:i=50,onChange:r})=>{let[a,o]=(0,pX.useState)(""),s=(0,pX.useId)(),{location:l}=function(e){let n=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:t,error:i,isLoading:r}=dZ()(n,rd,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,pX.useMemo)(()=>({location:t?.data?.entry?t.data.entry[0]:null,error:n?i:null,isLoading:!!n&&r}),[t,r,i,n])}(n),{locations:c,isLoading:u,hasMore:p,loadingNewData:d,error:f,setPage:h}=function(e,n=0,t=""){let i=dY(t),{data:r,isLoading:a,isValidating:o,setSize:s,error:l}=fn()(function(t,r){if(r){let e=r.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let n=new URL(e.url);return n.origin===window.location.origin?e.url:new URL(`${n.pathname}${n.search?`?${n.search}`:""}`,window.location.origin).toString()}let a=`${rc}/Location?`,o=new URLSearchParams;return o.append("_summary","data"),n&&o.append("_count",""+n),t&&o.append("_getpagesoffset",""+t*n),e&&o.append("_tag",e),"string"==typeof i&&""!==i&&o.append("name:contains",i),a+o.toString()},rd);return(0,pX.useMemo)(()=>({locations:r?.length?r?.flatMap(e=>e?.data?.entry??[]):[],isLoading:a,totalResults:r?.[0]?.data?.total,hasMore:!!r?.length&&r?.[r.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:o,error:l||null,setPage:s}),[a,r,o,s,l])}(t,i,a),g=(0,pX.useMemo)(()=>l&&!a&&n?[l,...c.filter(({resource:e})=>e.id!==n)]:c??[],[l,c,n,a]),m=(0,pX.useCallback)(e=>{r(),o(e.trim())},[r]),b=fg((0,pX.useCallback)(()=>{!d&&p&&h(e=>e+1)},[d,p,h])),y=p?Math.max(0,Math.floor(g.length-i/2)):-1;return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)(ht.vji,{"aria-describedby":f?`${s}-error`:void 0,labelText:ad("searchForLocation"),id:s,placeholder:ad("searchForLocation"),onChange:e=>m(e.target.value),size:"lg"}),f&&(0,fG.jsx)("div",{className:k2.errorNotification,id:`${s}-error`,children:(0,fG.jsx)(ht.jeF,{kind:"error",subtitle:ad("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:ad("error","Error")})}),(0,fG.jsx)("div",{className:k2.searchResults,children:u?(0,fG.jsx)("div",{className:k2.loadingContainer,children:Array.from({length:5}).map((e,n)=>(0,fG.jsx)(ht.Psq,{className:k2.radioButtonSkeleton,role:"progressbar"},n))}):(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("div",{className:k2.locationResultsContainer,children:g.length>0?(0,fG.jsx)(ht.zWQ,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,n)=>(0,fG.jsx)(ht.aaP,{className:k2.locationRadioButton,id:e.resource.id,labelText:(0,fG.jsx)("span",{ref:n===y?b:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,fG.jsx)("div",{className:k2.emptyState,children:(0,fG.jsx)("p",{className:k2.locationNotFound,children:ad("noResultsToDisplay")})})}),d&&(0,fG.jsx)("div",{className:k2.loadingIcon,children:(0,fG.jsx)(ht.OuH,{description:ad("loading")})})]})})]})},k5=U("modalState",{modalContainer:null,modalStack:[]}),k4=0;async function k6(e,n,t={}){let i=pB(n),r=null;if(e){if(!i)throw Error(`No modal named '${n}' has been registered.`);let{load:a}=i,o=await a(),s=k4++;r=ic({...o,name:`${n}-${s}`},{...t,domElement:e})}else B(`Failed to launch modal. Please notify your administrator. Modal name: ${n}`);return r}let k8=window.getComputedStyle(document.body).overflow;function k7({modalStack:e,modalContainer:n}){n&&(e.length?(n.style.visibility||(addEventListener("keydown",xe),document.body.style.overflow="hidden",n.style.visibility="unset"),e.forEach((t,i)=>{switch(t.state){case"NEW":{let e=function({size:e}){let n=document.createElement("div");return n.className=`cds--modal-container cds--modal-container--${e}`,n.setAttribute("role","dialog"),n.setAttribute("tabindex","-1"),n.setAttribute("aria-modal","true"),n}({size:t.props?.size??"md"});t.container=e,k6(e,t.modalName,t.props).then(i=>{t.parcel=i,t.state="MOUNTED",n.prepend(e),e.style.visibility="unset"});break}case"MOUNTED":t.container&&(t.container.style.visibility=i?"hidden":"unset");break;case"TO_BE_DELETED":t.onClose(),t.parcel?.unmount?.(),t.container?.remove(),setTimeout(()=>{k5.setState({modalContainer:n,modalStack:e.filter(e=>e!==t)})},0)}})):(n.style.removeProperty("visibility"),document.body.style.overflow=k8,removeEventListener("keydown",xe)))}function k9(e){let n=k5.getState(),t=n.modalStack.map(n=>n===e?{...n,state:"TO_BE_DELETED"}:n);k5.setState({...n,modalStack:t})}function xe(e){"Escape"===e.key&&function(){let[e]=k5.getState().modalStack;e&&k9(e)}()}function xn(e){k5.subscribe(k7),k5.setState({...k5.getState(),modalContainer:e})}function xt(e,n={},t=()=>{}){let i=()=>{let e=k5.getState().modalStack.find(e=>e.onClose===t);e&&k9(e)};if(pB(e)){var r;let a,o;r={state:"NEW",onClose:t,modalName:e,props:{close:i,...n}},o=[r,...(a=k5.getState()).modalStack],k5.setState({...a,modalStack:o})}else B(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return i}let xi=({notification:e})=>{let{description:n,action:t,kind:i,critical:r,title:a,onAction:o}=e;return(0,fG.jsx)(ht.kZS,{actionButtonLabel:t,kind:i||"info",lowContrast:r,subtitle:n,title:a||"",inline:!0,onActionButtonClick:o})},xr=({subject:e})=>{let[n,t]=(0,pX.useState)([]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.description!==e.description||n.action!==e.action||n.kind!==e.kind||n.title!==e.title),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(xi,{notification:e},e.id))})},xa=({notification:e})=>{let{actionButtonLabel:n,onActionButtonClick:t=()=>{},subtitle:i,kind:r,title:a,critical:o,progressActionLabel:s,id:l,...c}=e,[u,p]=(0,pX.useState)(n);return(0,fG.jsx)(ht.kZS,{kind:r||"info",actionButtonLabel:u,ariaLabel:ad("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{t(),s&&p(s)},statusIconDescription:ad("actionableNotification","Actionable notification"),subtitle:i,title:a,lowContrast:o,inline:!0,...c})},xo=({subject:e})=>{let[n,t]=(0,pX.useState)([]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.subtitle!==e.subtitle||n.actionButtonLabel!==e.actionButtonLabel||n.onActionButtonClick!==e.onActionButtonClick||n.kind!==e.kind||n.title!==e.title),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(xa,{notification:e},e.id))})};var xs=t(84065),xl=Object.prototype.hasOwnProperty;let xc=function(e){if(null==e)return!0;if((0,eB.A)(e)&&((0,eT.A)(e)||"string"==typeof e||"function"==typeof e.splice||(0,eI.A)(e)||(0,ej.A)(e)||(0,eP.A)(e)))return!e.length;var n=(0,nt.A)(e);if("[object Map]"==n||"[object Set]"==n)return!e.size;if((0,ez.A)(e))return!(0,xs.A)(e).length;for(var t in e)if(xl.call(e,t))return!1;return!0},xu=new ei.Subject,xp=0,xd=new ei.Subject,xf=0;function xh(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(xr,{subject:xu}))}function xg(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&(n instanceof Error||!xc(n)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{xu.next({...e,id:xp++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function xm(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(xo,{subject:xd}))}function xb(e){var n;e&&("string"==typeof(n=e.actionButtonLabel)?n.trim().length>0:"object"==typeof n&&!xc(n))?setTimeout(()=>{xd.next({...e,id:xf++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let xy=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],x_=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"];var xv=t(4112),x$={};x$.styleTagTransform=f5(),x$.setAttributes=f0(),x$.insert=fX().bind(null,"head"),x$.domAPI=fJ(),x$.insertStyleElement=f2(),fK()(xv.A,x$);let xA=xv.A&&xv.A.locals?xv.A.locals:void 0,xw=({value:e,unit:n,label:t,interpretation:i,referenceRange:r,conceptUuid:a,variant:o="card",patientUuid:s})=>{let l=(0,pX.useId)(),{referenceRange:c,isLoading:u}=function(e,n){let t=null;e&&(t=n?`${rl}/conceptreferencerange/?patient=${n}&concept=${e}&v=full`:`${rl}/conceptreferencerange/?concept=${e}&v=full`);let{data:i,error:r,isLoading:a}=dZ()(t,rd),o=i?.data?.results?.[0];return{referenceRange:o?{hiNormal:o.hiNormal??null,hiAbsolute:o.hiAbsolute??null,hiCritical:o.hiCritical??null,lowNormal:o.lowNormal??null,lowAbsolute:o.lowAbsolute??null,lowCritical:o.lowCritical??null}:void 0,error:r,isLoading:a}}(r||i?void 0:a,s),p=r??c,d=(0,pX.useMemo)(()=>{if(i)return i?"--"===i?"normal":xy.includes(i)?i.toLowerCase():x_.includes(i)?i:"normal":void 0;if(p&&!u){if(!p||null==e||""===e)return"normal";let n="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(n)?"normal":null!==p.hiAbsolute&&void 0!==p.hiAbsolute&&n>p.hiAbsolute?"off_scale_high":null!==p.hiCritical&&void 0!==p.hiCritical&&n>=p.hiCritical?"critically_high":null!==p.hiNormal&&void 0!==p.hiNormal&&n>p.hiNormal?"high":null!==p.lowAbsolute&&void 0!==p.lowAbsolute&&n<p.lowAbsolute?"off_scale_low":null!==p.lowCritical&&void 0!==p.lowCritical&&n<=p.lowCritical?"critically_low":null!==p.lowNormal&&void 0!==p.lowNormal&&n<p.lowNormal?"low":"normal"}return"normal"},[i,p,e,u])??"normal",f="critically_low"===d||"critically_high"===d||"off_scale_low"===d||"off_scale_high"===d,h="normal"!==d,g=t?`omrs-numeric-obs-label-${t.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,m=`omrs-numeric-obs-value-${l}`,b=`omrs-numeric-obs-unit-${l}`,y=null!=e&&""!==e,v=y?e:ad("notAvailable","Not available"),$=fH()({[xA["critically-low"]]:"critically_low"===d||"off_scale_low"===d,[xA["critically-high"]]:"critically_high"===d||"off_scale_high"===d,[xA.low]:"low"===d,[xA.high]:"high"===d,[xA["off-scale-low"]]:"off_scale_low"===d,[xA["off-scale-high"]]:"off_scale_high"===d}),A=fH()({[xA.container]:!0,[xA.card]:!0,[xA["critical-value"]]:f,[xA["abnormal-value"]]:h&&!f}),w=fH()({[xA.cell]:!0,[$]:!0});return"cell"===o?(0,fG.jsxs)("div",{className:w,children:[v,y&&n?` ${n}`:""]}):(0,fG.jsxs)("section",{className:A,"data-testid":"numeric-observation-card",children:[t&&(0,fG.jsxs)("div",{className:xA["label-container"],children:[(0,fG.jsx)("span",{id:g,className:xA.label,children:t}),h&&(0,fG.jsx)("span",{className:xA[d.replace("_","-")],title:ad("abnormalValue","Abnormal value")})]}),(0,fG.jsxs)("div",{className:xA["value-container"],children:[(0,fG.jsx)("span",{id:m,"aria-labelledby":g&&b?`${g} ${b}`:g||b||void 0,className:xA.value,children:v}),y&&n&&(0,fG.jsx)("span",{id:b,className:xA.units,children:n})]})]})};var xk=t(292),xx={};xx.styleTagTransform=f5(),xx.setAttributes=f0(),xx.insert=fX().bind(null,"head"),xx.domAPI=fJ(),xx.insertStyleElement=f2(),fK()(xk.A,xx);let xC=xk.A&&xk.A.locals?xk.A.locals:void 0,xE=e=>{if("children"in e){let{children:n,className:t,...i}=e;return(0,fG.jsx)("div",{className:fH()(xC.pageHeader,t),...i,children:n})}{let{title:n,illustration:t,className:i,...r}=e;return(0,fG.jsx)("div",{className:fH()(xC.pageHeader,i),...r,children:(0,fG.jsx)(xS,{title:n,illustration:t})})}},xS=({title:e,illustration:n,className:t})=>{let[i,r]=(0,pX.useState)(null);return(0,pX.useEffect)(()=>{te("@openmrs/esm-styleguide").then(e=>{r(e)})},[]),(0,fG.jsxs)("div",{className:fH()(xC.pageHeaderContent,t),children:[n,(0,fG.jsxs)("div",{className:xC.pageLabels,children:[i?.implementationName&&(0,fG.jsx)("p",{children:ad(i.implementationName)}),(0,fG.jsx)("p",{className:xC.pageName,children:e})]})]})};var xD=t(72886),xM={};xM.styleTagTransform=f5(),xM.setAttributes=f0(),xM.insert=fX().bind(null,"head"),xM.domAPI=fJ(),xM.insertStyleElement=f2(),fK()(xD.A,xM);let xz=xD.A&&xD.A.locals?xD.A.locals:void 0,xO=({totalItems:e,pageSize:n,onPageNumberChange:t,pageNumber:i,dashboardLinkUrl:r,currentItems:a,dashboardLinkLabel:o})=>{let{pageSizes:s,pageItemsCount:l}=fy(n,e,i,a),c="tablet"===fc(),u=ad("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,fG.jsx)(fG.Fragment,{children:e>0&&(0,fG.jsxs)("div",{className:fH()({[xz.tablet]:c,[xz.desktop]:!c}),children:[(0,fG.jsxs)("div",{children:[u,r&&(0,fG.jsx)(p1,{to:r,className:xz.configurableLink,children:o??ad("seeAll","See all")})]}),(0,fG.jsx)(ht.dKS,{className:xz.pagination,page:i,pageSize:n,pageSizes:s,totalItems:e,onChange:t,pageRangeText:(e,n)=>ad("paginationOfPages","of {{count}} pages",{count:n}),size:c?"lg":"sm"})]})})};function xP(e){return xB(xN(e,"usual","official"))}function xT(e){return xP(e)}function xB(e){var n;let t;return e?e.text??(t=(n=e).given??[],(n.family?t.concat(n.family):t).join(" ")):""}function xI(e){return xB(e)}function xN(e,...n){for(let t of(0==n.length&&(n=["usual"]),n)){let n=e.name?.find(e=>{var n,i;return n=e,i=t,n.use?n.use===i:"usual"===i});if(n)return n}}function xj(e,n=fx()){let t=fx(n),i=w9(e,t);if(null==i)return null;let r=t.diff(i,"hours"),a=t.diff(i,"days"),o=t.diff(i,"weeks"),s=t.diff(i,"months"),l=t.diff(i,"years"),c={};if(r<2)c.minutes=t.diff(i,"minutes");else if(a<2)c.hours=r;else if(o<4)c.days=a;else if(l<1){let e=t.subtract(o,"weeks").diff(i,"days");c.weeks=o,c.days=e}else if(l<2){let e=t.subtract(s,"months").diff(i,"days");c.months=s,c.days=e}else if(l<18){let e=t.subtract(l,"year").diff(i,"months");c.years=l,c.months=e}else c.years=l;return c}function xR(e,n=fx()){let t=xj(e,n);if(null==t)return null;let i={style:"short",localeMatcher:"lookup"};return"minutes"in t&&0===t.minutes&&(i.minutesDisplay="always"),w7(t,i)}var xF=t(46010),xL={};xL.styleTagTransform=f5(),xL.setAttributes=f0(),xL.insert=fX().bind(null,"head"),xL.domAPI=fJ(),xL.insertStyleElement=f2(),fK()(xF.A,xL);let xW=xF.A&&xF.A.locals?xF.A.locals:void 0;function xV({showIdentifierLabel:e,type:n,value:t}){return(0,fG.jsx)("span",{className:xW.primaryIdentifier,children:(0,fG.jsxs)(ht.vwO,{className:xW.tag,type:"gray",children:[e&&n?.text&&(0,fG.jsxs)("span",{className:xW.label,children:[n.text,": "]}),(0,fG.jsx)("span",{className:xW.value,children:t})]})})}function xG({showIdentifierLabel:e,type:n,value:t}){return(0,fG.jsxs)(ht.lRv,{className:xW.secondaryIdentifier,id:`patient-banner-identifier-${t}`,children:[e&&(0,fG.jsxs)("span",{className:xW.label,children:[n?.text,": "]}),(0,fG.jsx)("span",{className:xW.value,children:t})]})}function xU({identifiers:e,showIdentifierLabel:n}){let{excludePatientIdentifierCodeTypes:t}=dH(),{primaryIdentifierCode:i}=f$(),r=e?.filter(e=>{let n=e.type?.coding?.[0]?.code;return n&&!t?.uuids.includes(n)})??[];return(0,fG.jsx)(fG.Fragment,{children:r?.length?r.map(({value:e,type:t},a)=>(0,fG.jsxs)(pQ().Fragment,{children:[(0,fG.jsx)("span",{className:xW.identifier,children:t?.coding?.[0]?.code===i?(0,fG.jsx)(xV,{showIdentifierLabel:n,type:t,value:e}):(0,fG.jsx)(xG,{showIdentifierLabel:n,type:t,value:e})}),a<r.length-1&&(0,fG.jsx)("span",{className:xW.separator,children:"\xb7"})]},e)):""})}let xH={Female:hJ,Male:hZ,Other:hX,Unknown:hQ},xq=({gender:e})=>{let n=xH[e];return n?(0,fG.jsx)(n,{fill:"#525252"}):null},xK={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function xY({patient:e,renderedFrom:n}){var t;let i,r,a=xP(e),o=e?.gender&&(r=xK[i=(t=e.gender).toLowerCase()]??"Unknown",{displayText:ad(i,t),iconKey:r}),s=(0,pX.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:n}),[e.id,e,n]);return(0,fG.jsxs)("div",{className:xW.patientInfo,children:[(0,fG.jsx)("div",{className:fH()(xW.row,xW.patientNameRow),children:(0,fG.jsxs)("div",{className:xW.flexRow,children:[(0,fG.jsx)("span",{className:xW.patientName,children:a}),o&&(0,fG.jsxs)("div",{className:xW.gender,children:[(0,fG.jsx)(xq,{gender:o.iconKey}),(0,fG.jsx)("span",{children:o.displayText})]}),(0,fG.jsx)(dt,{className:xW.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,fG.jsxs)("div",{className:xW.demographics,children:[e.birthDate&&(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("span",{children:xR(e.birthDate)}),(0,fG.jsx)("span",{className:xW.separator,children:"\xb7"}),(0,fG.jsx)("span",{children:w2(e.birthDate,{time:!1})}),(0,fG.jsx)("span",{className:xW.separator,children:"\xb7"})]}),(0,fG.jsx)(xU,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,fG.jsx)(dt,{className:xW.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var xJ=t(81673),xZ=t(9102),xX={};xX.styleTagTransform=f5(),xX.setAttributes=f0(),xX.insert=fX().bind(null,"head"),xX.domAPI=fJ(),xX.insertStyleElement=f2(),fK()(xZ.A,xX);let xQ=xZ.A&&xZ.A.locals?xZ.A.locals:void 0;function x0({patient:e,patientUuid:n,actionsSlotName:t,additionalActionsSlotState:i}){let[r,a]=(0,pX.useState)(!1),{extensions:o}=de(t),s="tablet"===fc(),l=fh(()=>a(!1),r),c=(0,pX.useRef)(null),u=(0,pX.useRef)(null),p=(0,pX.useId)(),d=`patient-actions-menu-trigger-${p}`,f=`patient-actions-menu-${p}`,h=(0,pX.useCallback)(()=>a(e=>!e),[]),g=(0,pX.useCallback)(()=>{a(!1),c.current?.focus()},[]),m=(0,pX.useCallback)(e=>{if("Escape"===e.key&&r){e.stopPropagation(),g();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&r){e.preventDefault();let n=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let t=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,i=Array.from(n).indexOf(t);if(-1===i)return void n["ArrowDown"===e.key?0:n.length-1]?.focus();let r=i+("ArrowDown"===e.key?1:-1),a=r<0?n.length-1:r>=n.length?0:r;n[a]?.focus()}},[g,r]);(0,pX.useEffect)(()=>{if(r&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[r]);let b=(0,pX.useMemo)(()=>({patientUuid:n,patient:e,closeMenu:g,...i}),[n,e,g,i]);return 0===o.length?null:(0,fG.jsx)("div",{className:xQ.overflowMenuContainer,children:(0,fG.jsxs)("div",{"data-overflow-menu":!0,className:fH()("cds--overflow-menu",hs.container),ref:l,children:[(0,fG.jsxs)("button",{className:fH()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},hs.overflowMenuButton),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:d,onClick:h,onKeyDown:m,ref:c,children:[(0,fG.jsx)("span",{className:xQ.actionsButtonText,children:ad("actions","Actions")})," ",(0,fG.jsx)(xJ.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,fG.jsxs)("div",{className:fH()("cds--overflow-menu-options","cds--overflow-menu--flip",hs.menu,{[hs.show]:r}),"aria-labelledby":d,"data-floating-menu-direction":"bottom",id:f,onKeyDown:m,ref:u,role:"menu",tabIndex:-1,children:[(0,fG.jsx)("ul",{className:fH()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,fG.jsx)(dt,{name:t,state:b},t)}),(0,fG.jsx)("span",{})]})]})})}var x1=t(16767),x2=t.n(x1);function x3(e){let{patientPhotoConceptUuid:n}=dH({externalModuleName:"@openmrs/esm-styleguide"}),t=n?`${rl}/obs?patient=${e}&concept=${n}&v=full`:null,{data:i,error:r,isLoading:a}=(0,d_.Ay)(e?t:null,rd),o=i?.data?.results[0];return{data:o?{dateTime:o?.obsDatetime,imageSrc:o?.value?.links?.uri}:null,error:r,isLoading:a}}let x5=({width:e=56,height:n=56,"aria-label":t})=>{let{t:i}=(0,dy.useTranslation)();return(0,fG.jsxs)("svg",{"aria-label":t??i("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:n,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,fG.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,fG.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"})]})};var x4=t(27268),x6={};x6.styleTagTransform=f5(),x6.setAttributes=f0(),x6.insert=fX().bind(null,"head"),x6.domAPI=fJ(),x6.insertStyleElement=f2(),fK()(x4.A,x6);let x8=x4.A&&x4.A.locals?x4.A.locals:void 0;function x7({patientUuid:e,patientName:n,alt:t}){let{data:i,isLoading:r}=x3(e),[a,o]=(0,pX.useState)(null),[s,l]=(0,pX.useState)(!1),c=(0,pX.useMemo)(()=>x2().generate(e),[e]);(0,pX.useEffect)(()=>{if(i?.imageSrc){let e=new URL(i.imageSrc,window.location.origin).pathname;l(!0);let n=!1,t=new Image;return t.onload=()=>{n||(o(e),l(!1))},t.onerror=()=>{n||(o(null),l(!1))},t.src=e,()=>{n=!0}}o(null),l(!1)},[i?.imageSrc]);let u=(0,pX.useMemo)(()=>t||(a?ad("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:n}):ad("patientAvatarAlt","Avatar for {{patientName}}",{patientName:n})),[t,a,n]);return r||s?(0,fG.jsx)(ht.ryE,{className:x8.skeleton,"data-testid":"skeleton-icon"}):i?.imageSrc&&!a?(0,fG.jsx)(x5,{"aria-label":ad("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:n})}):a?(0,fG.jsx)("div",{"aria-label":u,children:(0,fG.jsx)("img",{className:x8.avatar,src:a,alt:u,title:n})}):(0,fG.jsx)("div",{"aria-label":u,children:(0,fG.jsx)("div",{className:x8.avatar,title:n,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,fG.jsx)("span",{className:x8.initials,children:function(e,n=3){return e.split(/\s+/).filter(Boolean).slice(0,n).map(e=>e[0]).join("")}(n)})})})}var x9=t(1636),Ce={};Ce.styleTagTransform=f5(),Ce.setAttributes=f0(),Ce.insert=fX().bind(null,"head"),Ce.domAPI=fJ(),Ce.insertStyleElement=f2(),fK()(x9.A,Ce);let Cn=x9.A&&x9.A.locals?x9.A.locals:void 0,Ct=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-ct-scan","omrs-pict-dentistry","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-obstetrics","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],Ci=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-appointments",pictogramProps:e})})),Cr=Ci,Ca=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),Co=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),Cs=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),Cl=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),Cc=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),Cu=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),Cp=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),Cd=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-facility",pictogramProps:e})})),Cf=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),Ch=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),Cg=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),Cm=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),Cb=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),Cy=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),C_=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),Cv=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-patients",pictogramProps:e})})),C$=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),CA=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),Cw=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),Ck=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-registration",pictogramProps:e})})),Cx=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),CC=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),CE=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-transfer",pictogramProps:e})})),CS=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-triage",pictogramProps:e})})),CD=(0,pX.memo)((0,pX.forwardRef)(function(e,n){return(0,fG.jsx)(CP,{ref:n,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),CM=Cd,Cz=Cv,CO=(0,pX.memo)((0,pX.forwardRef)(function({pictogram:e,fallback:n,...t},i){let r=(0,pX.useRef)(document.getElementById(e));return(0,pX.useEffect)(()=>{let n=document.getElementById("omrs-svgs-container"),t=new MutationObserver(n=>{for(let t of n)"childList"===t.type&&(r.current=document.getElementById(e))});return n&&t.observe(n,{childList:!0}),()=>t.disconnect()},[e]),(0,fG.jsx)(dN,{value:r.current,fallback:n,children:(0,fG.jsx)(CP,{ref:i,pictogram:e,pictogramProps:t})})})),CP=(0,pX.memo)((0,pX.forwardRef)(function({pictogram:e,pictogramProps:n},t){let{className:i,size:r}=Object.assign({},{size:92},n);return(r<=26||r>144)&&(console.error(`Invalid size '${r}' specified for ${e}. Defaulting to 92.`),r=92),(0,fG.jsx)("svg",{ref:t,className:fH()(Cn.pictogram,i),height:r,width:r,children:(0,fG.jsx)("use",{href:`#${e}`})})})),CT=({children:e})=>"tablet"===fc()?(0,fG.jsx)(ht.Wdr,{children:e}):(0,fG.jsx)(fG.Fragment,{children:e});var CB=t(85925),CI={};CI.styleTagTransform=f5(),CI.setAttributes=f0(),CI.insert=fX().bind(null,"head"),CI.domAPI=fJ(),CI.insertStyleElement=f2(),fK()(CB.A,CI);let CN=CB.A&&CB.A.locals?CB.A.locals:void 0,Cj=({snackbar:e,closeSnackbar:n})=>{let{actionButtonLabel:t="",kind:i="success",onActionButtonClick:r=()=>{},isLowContrast:a="error"!==i,progressActionLabel:o,subtitle:s="",timeoutInMs:l=5e3,autoClose:c="error"!==i,title:u,id:p,...d}=e,[f,h]=(0,pX.useState)(t),[g,m]=(0,pX.useState)(!0),[b,y]=(0,pX.useState)(!1),v=(0,pX.useCallback)(()=>{setTimeout(n,250)},[n]),$=(0,pX.useCallback)(()=>{y(!0),v()},[v]);return(0,pX.useEffect)(()=>{if(c){let e=setTimeout($,l);return()=>clearTimeout(e)}},[l,c,$]),(0,pX.useEffect)(()=>{m(!1),window.setTimeout(()=>{m(!0)},0)},[]),(0,fG.jsx)(ht.kZS,{actionButtonLabel:f,"aria-label":ad("closeSnackbar","Close snackbar"),className:fH()(CN.slideIn,{[CN.animated]:g,[CN.slideOut]:b}),kind:i,lowContrast:a,onActionButtonClick:()=>{r(),$(),o&&h(o)},onClose:v,statusIconDescription:ad("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...d})},CR=({subject:e})=>{let[n,t]=(0,pX.useState)([]),i=(0,pX.useCallback)(e=>{t(n=>n.filter(n=>n!==e))},[]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.subtitle!==e.subtitle||n.actionButtonLabel!==e.actionButtonLabel||n.onActionButtonClick!==e.onActionButtonClick||n.kind!==e.kind||n.title!==e.title),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(Cj,{snackbar:e,closeSnackbar:()=>i(e)},e.id))})},CF=new ei.Subject,CL=0;function CW(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(CR,{subject:CF}))}function CV(e){var n;e&&"string"==typeof(n=e.title)&&n.trim().length>0?setTimeout(()=>{CF.next({...e,id:CL++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let CG=({toast:e,closeToast:n})=>{let{description:t,kind:i,critical:r,title:a,actionButtonLabel:o,onActionButtonClick:s=()=>{}}=e,l=(0,pX.useCallback)(()=>{s(),n()},[n,s]);return(0,fG.jsx)("div",{children:(0,fG.jsx)(ht.kZS,{actionButtonLabel:o,kind:i||"info",lowContrast:r,subtitle:t,title:a||"",onActionButtonClick:l,onClose:n})})},CU=({subject:e})=>{let[n,t]=(0,pX.useState)([]),i=(0,pX.useCallback)(e=>{t(n=>n.filter(n=>n!==e))},[]);return(0,pX.useEffect)(()=>{let n=e.subscribe(e=>t(n=>[...n.filter(n=>n.description!==e.description||n.kind!==e.kind||n.title!==e.title||n.actionButtonLabel!==e.actionButtonLabel||n.onActionButtonClick!==e.onActionButtonClick),e]));return()=>n.unsubscribe()},[e]),(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsx)(CG,{toast:e,closeToast:()=>i(e)},e.id))})},CH=new ei.Subject,Cq=0;function CK(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(CU,{subject:CH}))}function CY(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&!xc(n))?setTimeout(()=>{CH.next({...e,id:Cq++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}function CJ(e,n=!1){if(n)return!0;let t=C1[e];return!t||!t()}function CZ(e,n){let t=C9.getState()?.workspaceGroup,i=t?.name;i&&e===i&&Ei(()=>{let i=El(e);i&&(i.setState({},!0),i.subscribe(()=>{})()),"function"==typeof t?.cleanup&&t.cleanup(),C9.setState(e=>({...e,workspaceGroup:void 0})),"function"==typeof n&&n()},i?e=>e.currentWorkspaceGroup===i:()=>!0)}function CX(e,n){let{name:t,additionalProps:i}=n;pL(t);let r=()=>{C6(e.name,{ignoreChanges:!0,onWorkspaceClose:()=>CQ(t,i),closeWorkspaceGroup:!1})};CJ(e.name)?r():Ea("closing-workspace-launching-new-workspace",r,e.title??e.name)}function CQ(e,n){let t=pL(e),i=C9.getState().workspaceGroup;if(i&&!i.members?.includes(e))return void CZ(i.name,()=>{CQ(e,n)});let r=C9.getState().workspaceGroup?.name,a={...t,title:Eo(t,n),closeWorkspace:(n={})=>C6(e,n),closeWorkspaceWithSavedChanges:n=>C6(e,{ignoreChanges:!0,...n}),promptBeforeClosing:n=>{var t,i;return t=e,i=n,void(C1[t]=i)},setTitle:(n,t)=>{a.title=n,a.titleNode=t,C9.setState(n=>{let t=n.openWorkspaces.map(n=>n.name===e?a:n);return{...n,openWorkspaces:t}})},currentWorkspaceGroup:r,additionalProps:n??{}};function o(e,n){C9.setState(t=>{let i=[e,...n??t.openWorkspaces],r=Et(e);return{...t,openWorkspaces:i,workspaceWindowState:r}})}r&&El(r,n);let s=C9.getState().openWorkspaces,l=s.findIndex(n=>n.name===e),c=s.find(e=>e.type==a.type);if(0===s.length)o(a);else if(s[0].canHide||0===l)if(l>=0){let n=s[l];o({...n,additionalProps:a.additionalProps,...n.title===Eo(n,n.additionalProps)&&{title:Eo(a,a.additionalProps)}},s.filter(n=>n.name!=e))}else c?(o(c,C9.getState().openWorkspaces.filter(e=>e.type!=a.type)),CX(c,{name:e,additionalProps:n})):o(a);else CX(s[0],{name:e,additionalProps:n})}function C0({targetUrl:e,contextKey:n,workspaceName:t,additionalProps:i}){C8(n),CQ(t,i),i7({to:e})}let C1={};function C2(e,n){C1[e]=n}function C3(e){return C1[e]}function C5(){let e=C9.getState();C9.setState({...e,prompt:null})}let C4={ignoreChanges:!1,onWorkspaceClose:()=>{},closeWorkspaceGroup:!0};function C6(e,n={}){n={...C4,...n};let t=()=>{let t=C9.getState();t.openWorkspaces.find(n=>n.name===e);let i=t.openWorkspaces.filter(n=>n.name!=e),r=C9.getState().workspaceGroup?.name;r&&n.closeWorkspaceGroup&&CZ(r),C1[e]=()=>!1,C9.setState(e=>({...e,prompt:null,openWorkspaces:i,workspaceWindowState:Et(i?.[0])})),n?.onWorkspaceClose?.()};return CJ(e,n?.ignoreChanges)?(t(),!0):(Ea("closing-workspace",t,pL(e).title??e),!1)}function C8(e){C9.getState().context!=e&&C9.setState({context:e,openWorkspaces:[],prompt:null})}let C7={context:"",openWorkspaces:[],prompt:null,workspaceWindowState:"normal",workspaceGroup:void 0},C9=U("workspace",C7);function Ee(){return C9}function En(e){let n=C9.getState();C9.setState({...n,workspaceWindowState:e})}function Et(e){return e?.preferredWindowSize??"normal"}function Ei(e=()=>{},n=()=>!0){let t=C9.getState().openWorkspaces.filter(n).every(({name:e})=>CJ(e)),i=()=>{Es(),e?.()};t?i():Ea("closing-all-workspaces",i)}function Er(){let{workspaceWindowState:e,openWorkspaces:n,prompt:t,workspaceGroup:i}=p4(C9);return(0,pX.useMemo)(()=>({active:n.length>0,prompt:t,workspaceWindowState:e,workspaces:n,workspaceGroup:i}),[n,e,t,i])}function Ea(e,n=()=>{},t=""){let i;switch(e){case"closing-workspace":i={title:ad("unsavedChangesTitleText","Unsaved changes"),body:ad("unsavedChangesInOpenedWorkspace","You may have unsaved changes in the opened workspace. Do you want to discard these changes?"),onConfirm:()=>{n?.()},confirmText:ad("discard","Discard")};break;case"closing-all-workspaces":{let e=C9.getState().openWorkspaces.filter(({name:e})=>!CJ(e)).map(({title:e},n)=>`${n+1}. ${e}`);i={title:ad("closingAllWorkspacesPromptTitle","You have unsaved changes"),body:ad("closingAllWorkspacesPromptBody","There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",{workspaceNames:e.join(",")}),onConfirm:()=>{n?.()},confirmText:ad("closeAllOpenedWorkspaces","Discard changes in {{count}} workspaces",{count:e.length})};break}case"closing-workspace-launching-new-workspace":i={title:ad("unsavedChangesTitleText","Unsaved changes"),body:ad("unsavedChangesInWorkspace",'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',{workspaceName:t}),onConfirm:()=>{C9.setState(e=>({...e,prompt:null})),n?.()},confirmText:ad("openAnyway","Open anyway")};break;default:console.error(`Workspace system trying to open unknown prompt type "${e}" in function "showWorkspacePrompts"`),n?.();return}C9.setState(e=>({...e,prompt:i}))}function Eo(e,n){return n?.workspaceTitle??e.title}function Es(){C9.setState(C7)}function El(e,n={}){if(!e||"default"===e)return;let t=q(e,{});return n&&t.setState(e=>({...e,...n})),t}var Ec=t(81341),Eu={};Eu.styleTagTransform=f5(),Eu.setAttributes=f0(),Eu.insert=fX().bind(null,"head"),Eu.domAPI=fJ(),Eu.insertStyleElement=f2(),fK()(Ec.A,Eu);let Ep=Ec.A&&Ec.A.locals?Ec.A.locals:void 0;function Ed({getIcon:e,formOpenInTheBackground:n,tagContent:t}){return(0,fG.jsxs)(fG.Fragment,{children:[e({size:16}),n?(0,fG.jsx)("span",{className:Ep.interruptedTag,children:"!"}):(0,fG.jsx)("span",{className:Ep.countTag,children:t})]})}let Ef=({getIcon:e,label:n,iconDescription:t,handler:i,type:r,tagContent:a})=>{let o=fc(),{workspaces:s,workspaceWindowState:l}=Er(),c=s?.findIndex(({type:e})=>e===r)??-1,u="hidden"!==l&&0===c,p=c>0||0===c&&"hidden"===l;return"tablet"===o||"phone"===o?(0,fG.jsxs)(ht.$nd,{className:fH()(Ep.container,{[Ep.active]:u}),iconDescription:t,kind:"ghost",onClick:i,role:"button",tabIndex:0,size:"md",children:[(0,fG.jsx)("span",{className:Ep.elementContainer,children:(0,fG.jsx)(Ed,{formOpenInTheBackground:p,getIcon:e,tagContent:a})}),(0,fG.jsx)("span",{children:n})]}):(0,fG.jsx)(ht.K0,{align:"left","aria-label":t,className:fH()(Ep.container,{[Ep.active]:u}),enterDelayMs:300,kind:"ghost",label:n,onClick:i,size:"md",children:(0,fG.jsx)("div",{className:Ep.elementContainer,children:(0,fG.jsx)(Ed,{formOpenInTheBackground:p,getIcon:e,tagContent:a})})})};var Eh=t(54535),Eg=t(40771),Em=t(24898),Eb=/[\\^$.*+?()[\]{}|]/g,Ey=RegExp(Eb.source);let E_=function(e){return(e=(0,Em.A)(e))&&Ey.test(e)?e.replace(Eb,"\\$&"):e};var Ev=t(37781),E$={};E$.styleTagTransform=f5(),E$.setAttributes=f0(),E$.insert=fX().bind(null,"head"),E$.domAPI=fJ(),E$.insertStyleElement=f2(),fK()(Ev.A,E$);let EA=Ev.A&&Ev.A.locals?Ev.A.locals:void 0;function Ew({contextKey:e}){let{prompt:n}=Er();return(0,pX.useEffect)(()=>{RegExp(`/${E_(e)}(/|$)`).test(window.location.pathname)||console.warn(`WorkspaceContainer has provided an invalid context key: "${e}". The context key must be part of the URL path, with no initial or trailing slash.`)},[]),(0,pX.useEffect)(()=>(C8(e),()=>{C8(null)}),[e]),(0,pX.useEffect)(()=>{let n=n=>{let{detail:{cancelNavigation:t,newUrl:i}}=n,r=RegExp(`/${E_(e)}(/|$)`),a=new URL(i),o=r.test(a.pathname),s=C9.getState().openWorkspaces.every(({name:e})=>CJ(e));o||(s?Es():(t?.(),Ei(()=>{i7({to:i})})))};return window.addEventListener("single-spa:before-routing-event",n),()=>{window.removeEventListener("single-spa:before-routing-event",n)}},[]),null!=n?(0,fG.jsxs)(ht.KXP,{open:!0,onClose:C5,children:[(0,fG.jsx)(ht.rQ0,{title:n.title}),(0,fG.jsx)(ht.cwr,{children:(0,fG.jsx)("p",{className:EA.messageBody,children:n.body})}),(0,fG.jsxs)(ht.jlY,{children:[(0,fG.jsx)(ht.$nd,{kind:"secondary",onClick:C5,children:n.cancelText??ad("cancel")}),(0,fG.jsx)(ht.$nd,{kind:"danger",onClick:n.onConfirm,children:n.confirmText??ad("confirm")})]})]}):null}function Ek(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Ex(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ek(Object(t),!0).forEach(function(n){EE(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ek(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function EC(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function EE(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ES(e){return(ES=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ED(e,n){return(ED=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function EM(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Ez=function(e){var n=pX.Component;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),n&&ED(o,n);var t,i,r,a=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=ES(o);e=t?Reflect.construct(n,arguments,ES(this).constructor):n.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return EM(this)});function o(e){var n;if(function(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}(this,o),EE(EM(n=a.call(this,e)),"handleRef",function(e){n.el=e}),EE(EM(n),"addThingToDo",function(e,t){n.state.hasError&&"unmount"!==e||(n.nextThingToDo=(n.nextThingToDo||Promise.resolve()).then(function(){if(!n.unmounted||"unmount"===e)return t.apply(void 0,arguments)}).catch(function(t){throw n.nextThingToDo=Promise.resolve(),n.setState({hasError:!0}),t&&t.message&&(t.message="During '".concat(e,"', parcel threw an error: ").concat(t.message)),n.props.handleError?n.props.handleError(t):setTimeout(function(){throw t}),t}))}),EE(EM(n),"getParcelProps",function(){var e=Ex(Ex({},n.props),{},{domElement:n.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),n.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return n}return i=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var n,t=e.props.mountParcel||e.mountParcel;if(!t)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?n=e.el:(e.createdDomElement=n=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(t){n.style[t]=e.props.wrapStyle[t]}),e.props.appendTo.appendChild(n)),e.parcel=t(e.props.config,Ex({domElement:n},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return du&&du.Consumer?pX.createElement(du.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):null;var n=du&&du.Consumer?pX.createElement(du.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):void 0;return pX.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},n)}}],EC(o.prototype,i),r&&EC(o,r),o}();EE(Ez,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var EO=t(57515),EP={};EP.styleTagTransform=f5(),EP.setAttributes=f0(),EP.insert=fX().bind(null,"head"),EP.domAPI=fJ(),EP.insertStyleElement=f2(),fK()(EO.A,EP);let ET=EO.A&&EO.A.locals?EO.A.locals:void 0;function EB({workspace:e,additionalPropsFromPage:n}){let[t,i]=(0,pX.useState)(),r=function(e){let[n,t]=(0,pX.useState)({}),[i,r]=(0,pX.useState)(e);return(0,pX.useEffect)(()=>{i!==e&&r(e)},[e]),(0,pX.useEffect)(()=>{let e,n=El(i);return n&&(t(n.getState()),e=n.subscribe(t)),()=>{n&&e?.()}},[i]),n}(e.currentWorkspaceGroup);(0,pX.useEffect)(()=>{let n=!0;return e.load().then(e=>{n&&i(e)}),()=>{n=!1}},[e]);let a=(0,pX.useMemo)(()=>e&&{closeWorkspace:e.closeWorkspace,closeWorkspaceWithSavedChanges:e.closeWorkspaceWithSavedChanges,promptBeforeClosing:e.promptBeforeClosing,setTitle:e.setTitle,...n,...r,...e.additionalProps},[e,n,r]);return t?(0,fG.jsx)(Ez,{config:t,mountParcel:ic,...a},e.name):(0,fG.jsx)(ht.OuH,{className:ET.loader,description:`${ad("loading","Loading")} ...`})}var EI=t(24646),EN={};EN.styleTagTransform=f5(),EN.setAttributes=f0(),EN.insert=fX().bind(null,"head"),EN.domAPI=fJ(),EN.insertStyleElement=f2(),fK()(EI.A,EN);let Ej=EI.A&&EI.A.locals?EI.A.locals:void 0;function ER({isWithinWorkspace:e,name:n,actionMenuProps:t={}}){let[i,r]=(0,pX.useState)(!1),a=(0,pX.useRef)(window.innerHeight),{featureName:o}=(0,pX.useContext)(p0),s=fc();(0,pX.useEffect)(()=>{let e=()=>{r(!fu(s)&&a.current>window.innerHeight),a.current!=window.innerHeight&&(a.current=window.innerHeight)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[a]);let l=`action-menu-${n&&"default"!=n?n:o}-items-slot`;return(0,fG.jsx)("aside",{className:fH()(Ej.sideRail,{[Ej.withinWorkspace]:e,[Ej.sideRailHidden]:i,[Ej.sideRailVisible]:!i}),children:(0,fG.jsx)("div",{className:Ej.container,children:(0,fG.jsx)(dt,{className:Ej.chartExtensions,name:l,state:t})})})}function EF({contextKey:e,overlay:n,showSiderailAndBottomNav:t,additionalWorkspaceProps:i,actionMenuProps:r}){let a=fc(),{workspaces:o,workspaceWindowState:s,workspaceGroup:l}=Er(),c=l?.name,u=o[0],p="hidden"===s||null==u,d=u?.width??(n?"wider":"narrow"),f=(0,pX.useMemo)(()=>t||c&&!p,[c,p,t]);return dV(!p&&!fu(a)),(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsxs)("div",{className:t?ET.workspaceContainerWithActionMenu:ET.workspaceContainerWithoutActionMenu,children:[(0,fG.jsx)("aside",{className:fH()(n?ET.workspaceOverlayOuterContainer:ET.workspaceWindowSpacer,{[ET.hiddenRelative]:p,[ET.narrowWorkspace]:"narrow"===d,[ET.widerWorkspace]:"wider"===d,[ET.extraWideWorkspace]:"extra-wide"===d}),children:(0,fG.jsx)("div",{className:fH()(ET.workspaceFixedContainer,{[ET.maximizedWindow]:"maximized"===s,[ET.hiddenFixed]:p}),children:o.map((e,n)=>(0,fG.jsx)("div",{className:fH()(ET.workspaceInnerContainer,{[ET.hiddenExtraWorkspace]:0!==n}),children:(0,fG.jsx)(pX.Suspense,{fallback:null,children:(0,fG.jsx)(dy.I18nextProvider,{i18n:window.i18next,defaultNS:e.moduleName,children:(0,fG.jsx)(EL,{workspaceInstance:e,additionalWorkspaceProps:i})})})},`workspace-container-${e?e.name:`empty-${n}`}`))})}),(0,fG.jsx)(Ew,{contextKey:e})]}),f&&(0,fG.jsx)(ER,{name:c,isWithinWorkspace:!t,actionMenuProps:r})]})}function EL({workspaceInstance:e,additionalWorkspaceProps:n}){let{t}=(0,dy.useTranslation)(),i=fc(),{workspaceWindowState:r,workspaceGroup:a}=Er(),o=a?.name,s="maximized"===r;(0,pX.useEffect)(()=>{let n=t(e.title);n!==e.title&&e.setTitle(n)},[e.title,t,e.setTitle]);let{featureName:l}=(0,pX.useContext)(p0),c=(0,pX.useCallback)(()=>{En(s?"normal":"maximized")},[s]),{canHide:u=!1,canMaximize:p=!1,currentWorkspaceGroup:d="",closeWorkspace:f}=(0,pX.useMemo)(()=>e??{},[e]),h=(0,pX.useMemo)(()=>({...n,...e?.additionalProps}),[n,e]);return e&&(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsxs)(ht.Y9Y,{"aria-label":ad("workspaceHeader","Workspace Header"),className:ET.header,children:[!fu(i)&&!u&&(0,fG.jsx)(ht.dJ2,{"aria-label":ad("close","Close"),renderMenuIcon:(0,fG.jsx)(h$,{}),onClick:()=>f()}),(0,fG.jsx)(ht.bCw,{prefix:"",children:e.titleNode??t(e.title)}),(0,fG.jsx)("div",{className:ET.overlayHeaderSpacer}),(0,fG.jsxs)(ht.wdv,{className:ET.headerButtons,children:[(0,fG.jsx)(dt,{name:`workspace-header-group-${e.currentWorkspaceGroup}-slot`,state:h}),(0,fG.jsx)(dt,{name:`workspace-header-type-${e.type}-slot`,state:h}),(0,fG.jsx)(dt,{name:`workspace-header-${l}-slot`,state:h}),fu(i)&&(0,fG.jsxs)(fG.Fragment,{children:[(p||s)&&(0,fG.jsx)(ht.V8d,{"aria-label":s?ad("minimize","Minimize"):ad("maximize","Maximize"),onClick:c,children:s?(0,fG.jsx)(Eh.Xj,{}):(0,fG.jsx)(Eh.hz,{})}),u&&!o?(0,fG.jsx)(ht.V8d,{"aria-label":ad("hide","Hide"),onClick:()=>En("hidden"),children:(0,fG.jsx)(hA,{})}):(0,fG.jsx)(ht.V8d,{"aria-label":ad("close","Close"),onClick:()=>f?.(),children:(0,fG.jsx)(hF,{})})]}),"tablet"===i&&u&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("close","Close"),onClick:()=>f?.(),children:(0,fG.jsx)(Eg.d3,{})})]})]}),(0,fG.jsx)("div",{className:fH()(ET.workspaceContent,{[ET.marginWorkspaceContent]:!!d}),children:(0,fG.jsx)(EB,{workspace:e,additionalPropsFromPage:n},e.name)})]})}async function EW(e,n){let{openedGroup:t}=pV.getState();if(t){if(t.groupName===e&&EU(t.props,n))return!0;else if(!await EH({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return pV.setState(t=>({...t,openedGroup:{groupName:e,props:n},openedWindows:[]})),!0}async function EV(e){let{openedGroup:n,openedWindows:t}=pV.getState();if(n){if(t.length>0&&!(e||await EH({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;pV.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function EG(e,n=null,t=null,i=null){let r=pV.getState();if(!r.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let a=pG(e);if(!a)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:o}=r,{name:s}=a,l=pU(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${a.name} is not registered to a workspace group`);let c=pH(e);if(o&&(o.groupName!==l.name||!EU(o.props,i)))return!!await EH({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:i},openedWindows:[{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let i=r.openedWindows[c],a=r.openedGroup?.props??{},o=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=i;if(EU(i.props,t)){let p=u.find(n=>n.workspaceName===e);return p&&EU(p.props,n)?((o||c!==r.openedWindows.length-1)&&pV.setState(Eq.restoreWindow(r,s)),!0):!!await EH({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??a},openedWindows:[...r.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[EZ(e,n)],props:i?.props??t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await EH({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:a??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(pV.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props??null},openedWindows:[...r.openedWindows,{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await EH({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:a.name})&&(pV.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[EZ(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function EU(e,n){return null==e||null==n||j(e,n)}function EH(e){function n(e,n){let t=[];for(let i=e.openedWorkspaces.length-1;i>=0;i--){let r=e.openedWorkspaces[i];if(r.hasUnsavedChanges&&t.push(r),n&&r.workspaceName===n)break}return t}let{openedWindows:t,workspaceTitleByWorkspaceName:i}=pV.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=t.flatMap(e=>n(e));break;case"CLOSE_WINDOW":{let i=t.find(n=>n.windowName===e.windowName);if(!i)throw Error(`Window ${e.windowName} not found in opened windows.`);r=n(i);break}case"CLOSE_WORKSPACE":{let i=t.find(n=>n.windowName===e.windowName);if(!i)throw Error(`Window ${e.windowName} not found in opened windows.`);r=n(i,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=t.filter(n=>n.windowName!==e.windowNameToSpare).flatMap(e=>n(e))}return 0===r.length?Promise.resolve(!0):new Promise(e=>{let n=xt("workspace2-close-prompt",{onConfirm:()=>{n(),e(!0)},onCancel:()=>{n(),e(!1)},affectedWorkspaceTitles:r.map(e=>i[e.workspaceName])})})}let Eq={setWindowMaximized(e,n,t){let i=e.openedWindows.findIndex(e=>e.windowName===n),r=[...e.openedWindows],a={...r[i],maximized:t};return r[i]=a,{...e,openedWindows:r}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,n){let t=e.openedWindows.findIndex(e=>e.windowName===n),i=e.openedWindows[t],r=[...e.openedWindows.filter((e,n)=>n!==t),i];return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,n){let t=pH(n);if(t<0)return e;let i={...e.openedWindows[t]},r=i.openedWorkspaces.findIndex(e=>e.workspaceName===n),a=[...e.openedWindows];i.openedWorkspaces=i.openedWorkspaces.slice(0,r);let o=e.isMostRecentlyOpenedWindowHidden;if(0===i.openedWorkspaces.length){let n=t===e.openedWindows.length-1;a.splice(t,1),n&&a.length>0&&(o=!1)}else a[t]=i;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,n,t,i){let r=e.registeredWorkspacesByName[t];if(!r)throw Error(`No workspace named "${t}" registered`);let a=e.registeredWorkspacesByName[n];if(!a)throw Error(`No workspace named "${n}" registered`);if(a.window!==r.window)throw Error(`Child workspace ${t} does not belong to the same workspace window as parent workspace ${n}`);let o=e.openedWindows.findIndex(e=>e.windowName===r.window);if(-1==o)throw Error(`Cannot open child workspace ${t} as window ${r.window} is not opened`);let{openedWorkspaces:s}=e.openedWindows[o],l=s.findIndex(e=>e.workspaceName===n);if(-1===l)throw Error(`Cannot open child workspace ${t} from parent workspace ${n} as the parent is not opened within the workspace window`);let c=s.slice(0,l+1);return{openedWindows:e.openedWindows.map((e,n)=>n==o?{...e,openedWorkspaces:[...c,EZ(t,i)]}:e)}},setHasUnsavedChanges(e,n,t){let i=pH(n);if(i<0)return e;let r={...e.openedWindows[i]},a=r.openedWorkspaces.findIndex(e=>e.workspaceName===n);if(a<0)return e;r.openedWorkspaces[a]={...r.openedWorkspaces[a],hasUnsavedChanges:t};let o=[...e.openedWindows];return o[i]=r,{...e,openedWindows:o}},setWorkspaceTitle(e,n,t){let i={...e.workspaceTitleByWorkspaceName};return null===t?delete i[n]:i[n]=t,{...e,workspaceTitleByWorkspaceName:i}}};function EK(){return p6(pV,Eq)}let EY=()=>(0,pX.useContext)(du),EJ=()=>Object.keys(pV.getState().registeredWorkspacesByName);function EZ(e,n){return{workspaceName:e,props:n??{},hasUnsavedChanges:!1,uuid:c2()}}var EX=t(81179),EQ={};EQ.styleTagTransform=f5(),EQ.setAttributes=f0(),EQ.insert=fX().bind(null,"head"),EQ.domAPI=fJ(),EQ.insertStyleElement=f2(),fK()(EX.A,EQ);let E0=EX.A&&EX.A.locals?EX.A.locals:void 0,E1=({title:e,children:n,hasUnsavedChanges:t=!1})=>{let i=fc(),{setWindowMaximized:r,hideWindow:a,setHasUnsavedChanges:o,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:p,workspaceTitleByWorkspaceName:d,setWorkspaceTitle:f,isMostRecentlyOpenedWindowHidden:h}=EK(),{workspaceName:g,isRootWorkspace:m,closeWorkspace:b,showActionMenu:y}=EY(),v=pH(g),$=s[v],A=$?.openedWorkspaces.find(e=>e.workspaceName===g);if((0,pX.useEffect)(()=>{A?.hasUnsavedChanges!=t&&o(g,t??!1)},[A?.hasUnsavedChanges,t,g,o]),(0,pX.useEffect)(()=>{d[g]!==e&&f(g,e)},[d,g,e,f]),v<0||null==l||null==A)return null;let w=c[l.groupName];if(!w)throw Error(`Cannot find registered workspace group ${l.groupName}`);let k=p[g].window,x=u[k];if(!x)throw Error(`Cannot find registered workspace window ${k}`);let{icon:C,canMaximize:E}=x,S="closable"===w.persistence,D=!!C&&!S,{maximized:M}=$,z=x?.width??"narrow",O=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),P=v<s.length-1||h;return(0,fG.jsxs)("div",{className:fH()(E0.workspaceOuterContainer,{[E0.narrowWorkspace]:"narrow"===z,[E0.widerWorkspace]:"wider"===z,[E0.extraWideWorkspace]:"extra-wide"===z,[E0.isActionMenuOpened]:O}),children:[(0,fG.jsx)("div",{className:fH()(E0.workspaceSpacer,{[E0.hidden]:P})}),(0,fG.jsx)("div",{className:fH()(E0.workspaceMiddleContainer,{[E0.maximized]:M,[E0.hidden]:P,[E0.isRootWorkspace]:m,[E0.showActionMenu]:y}),children:(0,fG.jsxs)("div",{className:fH()(E0.workspaceInnerContainer,{[E0.maximized]:M,[E0.hidden]:P,[E0.isRootWorkspace]:m}),children:[(0,fG.jsxs)(ht.Y9Y,{"aria-label":ad("workspaceHeader"),className:E0.header,children:[(0,fG.jsx)(ht.bCw,{prefix:"",children:e}),(0,fG.jsx)("div",{className:E0.overlayHeaderSpacer}),(0,fG.jsx)(ht.wdv,{className:E0.headerButtons,children:fu(i)?(0,fG.jsxs)(fG.Fragment,{children:[(E||M)&&(0,fG.jsx)(ht.V8d,{"aria-label":M?ad("minimize"):ad("maximize"),onClick:()=>r(k,!M),children:M?(0,fG.jsx)(Eh.Xj,{}):(0,fG.jsx)(Eh.hz,{})}),D&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("hide"),onClick:()=>a(),children:(0,fG.jsx)(hA,{})}),!S&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("close"),onClick:()=>b({closeWindow:!0}),children:(0,fG.jsx)(hF,{})})]}):(0,fG.jsxs)(fG.Fragment,{children:[D&&(0,fG.jsx)(ht.V8d,{"aria-label":ad("hide"),onClick:()=>a(),children:(0,fG.jsx)(Eg.d3,{})}),(0,fG.jsx)(ht.V8d,{"aria-label":ad("close"),onClick:()=>{S?EV():b({closeWindow:!0})},children:(0,fG.jsx)(hF,{})})]})})]}),(0,fG.jsx)("div",{className:fH()(E0.workspaceContent),children:n})]})})]})};var E2=t(97810),E3={};E3.styleTagTransform=f5(),E3.setAttributes=f0(),E3.insert=fX().bind(null,"head"),E3.domAPI=fJ(),E3.insertStyleElement=f2(),fK()(E2.A,E3);let E5=E2.A&&E2.A.locals?E2.A.locals:void 0;function E4({getIcon:e,hasUnsavedChanges:n,tagContent:t}){return(0,fG.jsxs)(fG.Fragment,{children:[e({size:16}),n?(0,fG.jsx)("span",{className:E5.interruptedTag,children:"!"}):(0,fG.jsx)("span",{className:E5.countTag,children:t})]})}let E6=({icon:e,label:n,tagContent:t,workspaceToLaunch:i,onBeforeWorkspaceLaunch:r})=>{let a=fc(),{openedWindows:o,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=EK(),{extension:u}=(0,pX.useContext)(p0),p=o.findIndex(e=>e.windowName===u?.extensionId),d=o[p],f=null!=d,h=f&&(p<o.length-1||c),g=f&&!h,m=d?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(f)h?s(d.windowName):l();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:n,windowProps:t}=i;EG(e,n,t)}};return"tablet"===a||"phone"===a?(0,fG.jsxs)(ht.$nd,{className:fH()(E5.container,{[E5.active]:f&&!g,[E5.focused]:g}),iconDescription:n,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",children:[(0,fG.jsx)("span",{className:E5.elementContainer,children:(0,fG.jsx)(E4,{hasUnsavedChanges:m,getIcon:e,tagContent:t})}),(0,fG.jsx)("span",{children:n})]}):(0,fG.jsx)(ht.K0,{align:"left","aria-label":n,className:fH()(E5.container,{[E5.active]:f&&!g,[E5.focused]:g}),enterDelayMs:300,kind:"ghost",label:n,onClick:b,size:"md",children:(0,fG.jsx)("div",{className:E5.elementContainer,children:(0,fG.jsx)(E4,{hasUnsavedChanges:m,getIcon:e,tagContent:t})})})};function E8({showContactDetails:e,toggleContactDetails:n,className:t}){return(0,fG.jsx)(ht.$nd,{className:t,iconDescription:"Toggle contact details",kind:"ghost",onClick:n,renderIcon:e?hR:hI,children:e?ad("showLess","Show less"):ad("showMore","Show more")})}var E7=t(95804),E9={};E9.styleTagTransform=f5(),E9.setAttributes=f0(),E9.insert=fX().bind(null,"head"),E9.domAPI=fJ(),E9.insertStyleElement=f2(),fK()(E7.A,E9);let Se=E7.A&&E7.A.locals?E7.A.locals:void 0,Sn=({patientUuid:e})=>{let{cohorts:n=[],isLoading:t}=function(e){let n=e?`${rl}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:t,isLoading:i}=(0,d_.Ay)(n,rd),r=t?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,pX.useMemo)(()=>({cohorts:r,isLoading:i}),[i,r])}(e);return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsxs)("p",{className:Se.heading,children:[ad("patientLists","Patient Lists")," (",n?.length??0,")"]}),t?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsxs)("ul",{children:[(()=>{if(n?.length>0){let e=n.sort((e,n)=>wJ(e?.startDate).getTime()-wJ(n?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,fG.jsx)("li",{children:(0,fG.jsx)(p1,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,fG.jsx)("li",{children:"--"})})(),n.length>3&&(0,fG.jsx)("li",{className:Se.link,children:(0,fG.jsx)(p1,{to:`${window.spaBase}/home/patient-lists`,children:ad("seeMoreLists","See {{count}} more lists",{count:n?.length-3})})})]})]})},St=({patientId:e})=>{let{patient:n,isLoading:t}=fv(e),i=n?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return t?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("p",{className:Se.heading,children:ad("address","Address")}),(0,fG.jsx)("ul",{children:i?Object.entries(i).filter(([e])=>"id"!==e&&"use"!==e).map(([e,n])=>"extension"===e?i.extension?.[0]?.extension?.map((n,t)=>(0,fG.jsxs)("li",{children:[ad(r(n.url),r(n.url)),": ",n.valueString]},`address-${e}-${t}`)):(0,fG.jsxs)("li",{children:[ad(e,e),": ",n]},`address-${e}`)):(0,fG.jsx)("li",{children:"--"})})]})},Si=({patientUuid:e})=>{let{isLoading:n,contactAttributes:t}=(e=>{let{contactAttributeTypes:n=[]}=dH({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:t,error:i,isLoading:r}=(e=>{let{data:n,error:t,isLoading:i}=dZ()(`${rl}/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)))`,rd);return{isLoading:i,attributes:n?.data.person.attributes??[],error:t}})(e);return{contactAttributes:(0,pX.useMemo)(()=>t.filter(({attributeType:e})=>n?.some(n=>e.uuid===n)),[t,n]),isLoading:r,error:i}})(e),i=(0,pX.useMemo)(()=>t?[...t?.map(e=>[e.attributeType.display?ad(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[t]);return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("p",{className:Se.heading,children:ad("contactDetails","Contact Details")}),n?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsx)("ul",{children:i.length?i.map(([e,n],t)=>(0,fG.jsxs)("li",{children:[e,": ",n]},`${e}-${n}-${t}`)):(0,fG.jsx)("li",{children:"--"})})]})},Sr=({patientId:e})=>{let{data:n,isLoading:t}=function(e){let n=`${rl}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:t,error:i,isLoading:r,isValidating:a}=(0,d_.Ay)(e?n:null,rd),o=t?.data?.results?.length?function(e,n){let t=[];for(let i of n)e===i.personA.uuid?t.push({uuid:`${i.uuid}`,display:i.personB.display,relativeAge:i.personB.age,relativeUuid:i.personB.uuid,relationshipType:i.relationshipType.bIsToA}):t.push({uuid:`${i.uuid}`,display:i.personA.display,relativeAge:i.personA.age,relativeUuid:i.personA.uuid,relationshipType:i.relationshipType.aIsToB});return t}(e,t.data.results):null;return{data:t?o:null,error:i,isLoading:r,isValidating:a}}(e);return(0,fG.jsxs)(fG.Fragment,{children:[(0,fG.jsx)("p",{className:Se.heading,children:ad("relationships","Relationships")}),t?(0,fG.jsx)(ht.OuH,{description:`${ad("loading","Loading")} ...`,role:"progressbar"}):(0,fG.jsx)("ul",{children:n&&n.length>0?(0,fG.jsx)(fG.Fragment,{children:n.map(e=>(0,fG.jsxs)("li",{className:Se.relationship,children:[(0,fG.jsx)("div",{children:(0,fG.jsx)(p1,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,fG.jsx)("div",{children:e.relationshipType}),(0,fG.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?ad("yearAbbreviation","yr"):ad("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,fG.jsx)("li",{children:"--"})})]})};function Sa({patientId:e,deceased:n}){return(0,fG.jsxs)("div",{className:fH()(Se.contactDetails,{[Se.deceased]:n}),children:[(0,fG.jsxs)("div",{className:Se.row,children:[(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(St,{patientId:e})}),(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(Si,{patientUuid:e})})]}),(0,fG.jsxs)("div",{className:Se.row,children:[(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(Sr,{patientId:e})}),(0,fG.jsx)("div",{className:Se.col,children:(0,fG.jsx)(Sn,{patientUuid:e})})]})]})}function So(e){let n=document.querySelector("template#loading-spinner");if(n){let t=n.content.cloneNode(!0),i=Array.prototype.map.call(t.childNodes,e=>e);return e.appendChild(t),()=>i.forEach(e=>e.remove())}return()=>{}}var Ss=t(24039),Sl={};Sl.styleTagTransform=f5(),Sl.setAttributes=f0(),Sl.insert=fX().bind(null,"head"),Sl.domAPI=fJ(),Sl.insertStyleElement=f2(),fK()(Ss.A,Sl);let Sc=Ss.A&&Ss.A.locals?Ss.A.locals:void 0;function Su({workspaceGroup:e,groupProps:n}){let t=fc(),{persistence:i}=e;return(0,fG.jsx)("aside",{className:Sc.sideRail,children:(0,fG.jsxs)("div",{className:Sc.container,children:["closable"==i&&fu(t)&&(0,fG.jsx)(ht.K0,{align:"left",onClick:()=>EV(),label:ad("close"),kind:"ghost",children:(0,fG.jsx)(hF,{})}),(0,fG.jsx)(p0.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,fG.jsx)(dt,{className:Sc.container,name:e.name,state:{groupProps:n}})})]})})}let Sp=({lifeCycle:e,openedWorkspace:n,openedWindow:t,isRootWorkspace:i,isLeafWorkspace:r,showActionMenu:a})=>{let{openedGroup:o,closeWorkspace:s,openChildWorkspace:l}=EK(),c=(0,pX.useMemo)(()=>n&&{closeWorkspace:async(e={})=>{let{closeWindow:i=!1,discardUnsavedChanges:r=!1}=e;return i?!!(r||await EH({reason:"CLOSE_WINDOW",explicit:!0,windowName:t.windowName}))&&(s(t.openedWorkspaces[0].workspaceName),!0):!!(r||await EH({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:t.windowName,workspaceName:n.workspaceName}))&&(s(n.workspaceName),!0)},launchChildWorkspace:async(e,i)=>{let r=n.workspaceName,{openedWorkspaces:a}=t,o=a.findIndex(e=>e.workspaceName===r);-1===o||o!==a.length-1&&a.slice(o+1).some(e=>e.hasUnsavedChanges)&&!await EH({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:t.windowName,workspaceName:a[o+1].workspaceName})||l(r,e,i||{})},workspaceName:n.workspaceName,workspaceProps:n.props,windowProps:t.props,groupProps:o&&o.props?o.props:null,isRootWorkspace:i,isLeafWorkspace:r,windowName:t.windowName,showActionMenu:a},[n,s,o,t]);if(!e){let{registeredWorkspacesByName:e}=pV.getState(),t=e[n.workspaceName],r=t&&t.window?t.window:void 0,{registeredWindowsByName:s}=pV.getState(),l=r?s[r]:void 0,c=l&&l.width?l.width:"narrow",u=Object.values(s).some(e=>e.group===o?.groupName&&void 0!==e.icon);return(0,fG.jsxs)("div",{className:fH()(E0.workspaceOuterContainer,{[E0.narrowWorkspace]:"narrow"===c,[E0.widerWorkspace]:"wider"===c,[E0.extraWideWorkspace]:"extra-wide"===c,[E0.isActionMenuOpened]:u}),children:[(0,fG.jsx)("div",{className:E0.workspaceSpacer}),(0,fG.jsx)("div",{className:fH()(E0.workspaceMiddleContainer,{[E0.isRootWorkspace]:i,[E0.showActionMenu]:a}),children:(0,fG.jsx)("div",{className:fH()(E0.workspaceInnerContainer,{[E0.isRootWorkspace]:i}),children:(0,fG.jsx)(ht.OuH,{className:E0.loader,description:`${ad("loading")} ...`})})})]})}return(0,fG.jsx)(Ez,{config:e,mountParcel:ic,...c},n.workspaceName)},Sd=({openedWindow:e,showActionMenu:n})=>{let{openedWorkspaces:t}=e,[i,r]=(0,pX.useState)({}),{registeredWorkspacesByName:a}=pV.getState();return(0,pX.useEffect)(()=>{let e=!1;return Promise.all(t.map(async e=>{let{moduleName:n,component:t}=a[e.workspaceName];return[e.uuid,await fP(n,t)]})).then(n=>{e||r(Object.fromEntries(n))}),()=>{e=!0}},[t]),(0,fG.jsx)(fG.Fragment,{children:t.map((r,a)=>(0,fG.jsx)(Sp,{openedWorkspace:r,openedWindow:e,lifeCycle:i[r.uuid],isRootWorkspace:0===a,isLeafWorkspace:a===t.length-1,showActionMenu:n},r.uuid))})};var Sf=t(297),Sh={};Sh.styleTagTransform=f5(),Sh.setAttributes=f0(),Sh.insert=fX().bind(null,"head"),Sh.domAPI=fJ(),Sh.insertStyleElement=f2(),fK()(Sf.A,Sh);let Sg=Sf.A&&Sf.A.locals?Sf.A.locals:void 0;function Sm(e){e&&(0,di.createRoot)(e).render((0,fG.jsx)(Sb,{}))}function Sb(){let{openedGroup:e,openedWindows:n,registeredGroupsByName:t,registeredWindowsByName:i}=EK();if((0,pX.useEffect)(()=>um("before-page-changed",n=>{let{newPage:i,cancelNavigation:r,oldUrl:a,newUrl:o}=n;if(!e)return;if(i)return void r(EV().then(e=>!e));let s=t[e.groupName],l=s?.scopePattern;l&&function(e,n,t){try{let i=new URL(n,window.location.origin).pathname,r=new URL(t,window.location.origin).pathname,a=new RegExp(e),o=i.match(a),s=r.match(a);if(!o||!s)return!0;if(o.length>1)return!o.slice(1).every((e,n)=>e===s[n+1]);return!1}catch{return!0}}(l,a,o)&&r(EV().then(e=>!e))}),[e,t]),!e)return null;let r=t[e.groupName],a=n.some(e=>e.maximized),{name:o}=r,s=Object.values(i).filter(e=>e.group===o&&void 0!==e.icon).sort((e,n)=>(e.order??Number.MAX_VALUE)-(n.order??Number.MAX_VALUE)).length>0;return(0,fG.jsxs)("div",{className:fH()(Sg.workspaceWindowsAndMenuContainer,{[Sg.overlay]:r.overlay,[Sg.hasMaximizedWindow]:a}),children:[(0,fG.jsx)("div",{className:Sg.workspaceWindowsContainer,children:n.map(e=>(0,fG.jsx)(Sd,{openedWindow:e,showActionMenu:s},e.windowName))}),s&&(0,fG.jsx)(Su,{workspaceGroup:r,groupProps:e.props})]})}function Sy(e){if("string"!=typeof e||0===e.trim().length)return;let n=e.replaceAll("_","-");try{return new Intl.Locale(n).toString()}catch{return}}function S_(e,n,t){if(null==e)return t;let i=Sy(e);if(!i)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),t;let r=[];for(let e of n){let n=Sy(e);if(!n){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}r.push({canonical:n,original:e})}let a=i;for(;a;){let e=r.find(e=>e.canonical===a);if(e)return e.original;let n=a+"-",t=r.find(e=>e.canonical.startsWith(n));if(t)return t.original;if("ht"===a){a="fr-HT";continue}let i=a.lastIndexOf("-");if(-1===i)break;let o=(a=a.slice(0,i)).lastIndexOf("-");-1!==o&&a.length-o==2&&(a=a.slice(0,o))}return t}function Sv(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function S$(e){return!!e&&e.constructor===Object}var SA=t(99589);function Sw(e){let[n,t,i]=e.split(".");return`${n}.${t}.${i}`}function Sk(e,n){let t=function(e){let n=e.indexOf("-");if(n>=0){let t=Sw(e.slice(0,n)),i=e.slice(n+1);return`${t}-${i}`}return Sw(e)}(n);return SA.satisfies(t,e,{includePrerelease:!0})}async function Sx(e,n={}){let t,{shouldRetry:i,getDelay:r,onError:a}=n;i=i??(e=>e<=5),r=r??(e=>(function(e,n=!1){return 1e3*Math.pow(2,n?e+1:e)})(e));let o=0;do try{return await SC(r(o)),await e()}catch(e){a?.(e,o),t=e}while(i(o++));throw t}async function SC(e){if(!(e<=0))return new Promise(n=>setTimeout(n,e))}}}]);