@openmrs/esm-form-engine-app 12.3.5-pre.12598 → 12.3.5-pre.12608

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/9894.js CHANGED
@@ -36,4 +36,4 @@ To fix this, ensure that you define the "component" field inside the page defini
36
36
  * {
37
37
  overscroll-behavior: contain;
38
38
  }
39
- }`.trim(),document.head.prepend(r),o=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let t=((e=document)=>e.activeElement)(),n=null!=t&&vG(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||vQ(this,n)},i=mn(vX(document,"touchstart",t=>{let r=mU(t);e=hJ(r)?r:hX(r,!0),n=!1;let a=r.ownerDocument.defaultView.getSelection();a&&!a.isCollapsed&&a.containsNode(r,!0)&&(n=!0),t.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(n=!0),"selectionStart"in r&&"selectionEnd"in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},{passive:!1,capture:!0}),vX(document,"touchmove",t=>{if(2!==t.touches.length&&!n){if(!e||e===document.documentElement||e===document.body)return void t.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&t.preventDefault()}},{passive:!1,capture:!0}),vX(document,"blur",e=>{let t=mU(e),n=e.relatedTarget;if(n&&vG(n))n.focus({preventScroll:!0}),vQ(n,vG(t));else if(!n){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),r.remove(),HTMLElement.prototype.focus=o}):mn((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?vJ(document.documentElement,"scrollbarGutter","stable"):vJ(document.documentElement,"paddingRight",`${s}px`)),vJ(document.documentElement,"overflow","hidden"))),()=>{0==--vq&&c()}}},[t])}({isDisabled:o||!t.isOpen}),(0,lr.useEffect)(()=>{if(t.isOpen&&r.current)if(o){var e,n,i=a?.current??r.current;let t=vD[vD.length-1];return t&&!t.visibleNodes.has(i)?(t.visibleNodes.add(i),()=>{t.visibleNodes.delete(i)}):void 0}else{let t,o,i,s,l,u,c,d,m,p,f;return e=[a?.current??r.current],o=(n={shouldUseInert:!0})instanceof(t=mB(e?.[0])).Element?{root:n}:n,i=o?.root??document.body,s=o?.shouldUseInert&&vw,l=new Set(e),u=new Set,c=(e,n)=>{s&&e instanceof t.HTMLElement?e.inert=n:n?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},d=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(u.has(e)||l.has(e)||e.parentElement&&u.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(mV(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=yr(mF(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&m(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;null!=e;)m(e),e=n.nextNode()}},m=e=>{let n=vx.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===n||(0===n&&c(e,!0),u.add(e),vx.set(e,n+1))},vD.length&&vD[vD.length-1].disconnect(),d(i),(p=new MutationObserver(e=>{for(let n of e)if("childList"===n.type&&n.target.isConnected&&![...l,...u].some(e=>mV(e,n.target)))for(let e of n.addedNodes){var t;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(t=e).dataset.liveAnnouncer||void 0!==t.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&d(e)}})).observe(i,{childList:!0,subtree:!0}),f={visibleNodes:l,hiddenNodes:u,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}},vD.push(f),()=>{for(let e of(p.disconnect(),u)){let t=vx.get(e);null!=t&&(1===t?(c(e,!1),vx.delete(e)):vx.set(e,t-1))}f===vD[vD.length-1]?(vD.pop(),vD.length&&vD[vD.length-1].observe()):vD.splice(vD.indexOf(f),1)}}},[o,t.isOpen,r,a]),{popoverProps:mv(d,p),arrowProps:f,underlayProps:m,placement:h,triggerAnchorPoint:g}}({...r,offset:null!=(a=r.offset)?a:8,arrowSize:s,groupRef:m?d:u},e),y=r.popoverRef,v=v2(y,!!g)||r.isEntering||!1,b=mx({...r,defaultClassName:"react-aria-Popover",values:{trigger:r.trigger||null,placement:g,isEntering:v,isExiting:t}}),w=!r.isNonModal||"SubmenuTrigger"===r.trigger,[x,D]=(0,lr.useState)(!1);mr(()=>{y.current&&D(w&&!y.current.querySelector("[role=dialog]"))},[y,w]),(0,lr.useEffect)(()=>{var e;let t,n;x&&y.current&&!y.current.contains(document.activeElement)&&(n=((e=document)=>e.activeElement)(t=mF(e=y.current)),"virtual"===v5?p_(()=>{((e=document)=>e.activeElement)(t)===n&&e.isConnected&&mj(e)}):mj(e))},[x,y]);let E={...p.style,...b.style},_=la().createElement("div",{...mv(mI(r),p),...b,role:x?"dialog":void 0,tabIndex:x?-1:void 0,"aria-label":r["aria-label"],"aria-labelledby":r["aria-labelledby"],ref:y,slot:r.slot||void 0,style:E,dir:r.dir,"data-trigger":r.trigger,"data-placement":g,"data-entering":v||void 0,"data-exiting":t||void 0},!r.isNonModal&&la().createElement(v4,{onDismiss:e.close}),la().createElement(vb.Provider,{value:{...h,placement:g,ref:i}},b.children),la().createElement(v4,{onDismiss:e.close}));return m?la().createElement(vu,{...r,shouldContainFocus:x,isExiting:t,portalContainer:null!=(o=null!=n?n:null==d?void 0:d.current)?o:void 0},_):la().createElement(vu,{...r,shouldContainFocus:x,isExiting:t,portalContainer:n},!r.isNonModal&&e.isOpen&&la().createElement("div",{"data-testid":"underlay",...f,style:{position:"fixed",inset:0}}),la().createElement("div",{ref:u,style:{display:"contents"}},la().createElement(bd.Provider,{value:u},_)))}function bf(e){return e?.start!=null&&null!=e.end}let bh=(0,lr.createContext)(null),bg=(0,lr.createContext)(null),by=(0,lr.createContext)(null),bv=(0,lr.createContext)(null),bb=(0,lr.forwardRef)(function(e,t){var n,r;[e,t]=mE(e,t,bh);let{validationBehavior:a}=mD(vg)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bu(e),[n,r]=gz(e.value,e.defaultValue||null,e.onChange),[a]=(0,lr.useState)(n),o=n||e.placeholderValue||null,[i,s]=yQ(o,e.granularity),l=null!=n?n.toDate(s??"UTC"):null,u="hour"===i||"minute"===i||"second"===i,c=e.shouldCloseOnSelect??!0,[d,m]=(0,lr.useState)(null),[p,f]=(0,lr.useState)(null);if(n&&(d=n,"hour"in n&&(p=n)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let h=n?.calendar.identifier==="gregory"&&"BC"===n.era,g=(0,lr.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:h}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,h]),{minValue:y,maxValue:v,isDateUnavailable:b}=e,w=(0,lr.useMemo)(()=>yZ(n,y,v,b,g),[n,y,v,b,g]),x=yB({...e,value:n,builtinValidation:w}),D=x.displayValidation.isInvalid,E=e.validationState||(D?"invalid":null),_=(e,t)=>{r("timeZone"in t?t.set(hy(e)):hv(e,t)),m(null),f(null),x.commitValidation()};return{...x,value:n,defaultValue:e.defaultValue??a,setValue:r,dateValue:d,timeValue:p,setDateValue:n=>{let a="function"==typeof c?c():c;u?p||a?_(n,p||yJ(e.defaultValue||e.placeholderValue)):m(n):(r(n),x.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?_(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(r){!r&&!n&&d&&u&&_(d,p||yJ(e.defaultValue||e.placeholderValue)),t.setOpen(r)},validationState:E,isInvalid:D,formatValue:(e,t)=>l?new fC(e,yq(t,g)).format(l):"",getDateFormatter:(e,t)=>new fC(e,yq({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,lr.useRef)(null),[l,u]=m_(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,fieldProps:m,buttonProps:p,dialogProps:f,calendarProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,n){var r;let a=mh(),o=mh(),i=mh(),s=fV((r=y_)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=yk({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=yS(t,n),g=m["aria-labelledby"]||m.id,{locale:y}=fb(),v=t.formatValue(y,{month:"long"}),b=h3(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,x=mI(e),D=(0,lr.useMemo)(()=>yb(n),[n]),E=(0,lr.useRef)(!1),{focusWithinProps:_}=p1({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mV(document.getElementById(o),t.relatedTarget)||(E.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{E.current||(E.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mv(x,h,m,b,_,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":w,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...d,onClick:()=>{D.focusFirst()}},fieldProps:{...m,id:i,[yO]:"presentation","aria-describedby":w,value:t.value,defaultValue:t.defaultValue,onChange:t.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,[yF]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:p,errorMessageProps:f,buttonProps:{...b,id:a,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${a} ${g}`,"aria-describedby":w,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${a} ${g}`},calendarProps:{autoFocus:!0,value:t.dateValue,onChange:t.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:t.dateValue?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:u,validationDetails:c}}({...mS(e),label:u,validationBehavior:o},i,s),[b,w]=(0,lr.useState)(null),x=(0,lr.useCallback)(()=>{s.current&&w(s.current.offsetWidth+"px")},[]);vU({ref:s,onResize:x});let{focusProps:D,isFocused:E,isFocusVisible:_}=p4({within:!0}),S=mx({...e,values:{state:i,isFocusWithin:E,isFocusVisible:_,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DatePicker"}),C=mI(e);return delete C.id,la().createElement(mw,{values:[[by,i],[g7,{...c,ref:s,isInvalid:i.isInvalid}],[y7,m],[ft,{...p,isPressed:i.isOpen}],[vy,{...d,ref:l,elementType:"span"}],[gJ,h],[vd,i],[bc,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":b}}],[vc,f],[fa,{slots:{description:g,errorMessage:y}}],[vp,v]]},la().createElement("div",{...D,...C,...S,ref:t,slot:e.slot||void 0,"data-focus-within":E||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":_||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))}),bw=(0,lr.forwardRef)(function(e,t){var n,r;[e,t]=mE(e,t,bg);let{validationBehavior:a}=mD(vg)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bu(e),[n,r]=gz(e.value,e.defaultValue||null,e.onChange),[a]=(0,lr.useState)(n),[o,i]=(0,lr.useState)(()=>n||{start:null,end:null});null==n&&o.start&&o.end&&i(o={start:null,end:null});let s=n||o,l=e=>{i(s=e||{start:null,end:null}),bf(s)?r(s):r(null)},[u,c]=yQ(s?.start||s?.end||e.placeholderValue||null,e.granularity),d="hour"===u||"minute"===u||"second"===u,m=e.shouldCloseOnSelect??!0,[p,f]=(0,lr.useState)(null),[h,g]=(0,lr.useState)(null);s&&bf(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(hy(e.start)):hv(e.start,t.start),end:"timeZone"in t.end?t.end.set(hy(e.end)):hv(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=n=>{let r="function"==typeof m?m():m;d?bf(n)&&(r||h?.start&&h?.end)?y(n,{start:h?.start||yJ(e.placeholderValue),end:h?.end||yJ(e.placeholderValue)}):f(n):bf(n)?(l(n),C.commitValidation()):f(n),r&&t.setOpen(!1)},b=e=>{bf(p)&&bf(e)?y(p,e):g(e)},w=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,x=(0,lr.useMemo)(()=>({granularity:u,timeZone:c,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:w}),[u,e.hourCycle,e.shouldForceLeadingZeros,c,e.hideTimeZone,w]),{minValue:D,maxValue:E,isDateUnavailable:_}=e,S=(0,lr.useMemo)(()=>{var e;let t;return e=s,t=yH(yZ(e?.start??null,D,E,_,x),yZ(e?.end??null,D,E,_,x)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(t=yH(t,{isInvalid:!0,validationErrors:[(fA.getGlobalDictionaryForPackage("@react-stately/datepicker")||yz).getStringForLocale("rangeReversed",yK())],validationDetails:{...yA,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),t},[s,D,E,_,x]),C=yB({...e,value:n,name:(0,lr.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:S}),k=C.displayValidation.isInvalid,P=e.validationState||(k?"invalid":null);return{...C,value:s,defaultValue:e.defaultValue??a,setValue:l,dateRange:p,timeRange:h,granularity:u,hasTime:d,setDate(e,t){"start"===e?v({start:t,end:p?.end??null}):v({start:p?.start??null,end:t})},setTime(e,t){"start"===e?b({start:t,end:h?.end??null}):b({start:h?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:v,setTimeRange:b,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&bf(p)&&d&&y(p,{start:h?.start||yJ(e.placeholderValue),end:h?.end||yJ(e.placeholderValue)}),t.setOpen(n)},validationState:P,isInvalid:k,formatValue(t,n){let r;if(!s||!s.start||!s.end)return null;let a="timeZone"in s.start?s.start.timeZone:void 0,o=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),i="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),u=yq(n,{granularity:o,timeZone:a,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}),c=s.start.toDate(a||"UTC"),d=s.end.toDate(i||"UTC"),m=new fC(t,u);if(a===i&&o===l&&0!==s.start.compare(s.end)){try{let e=m.formatRangeToParts(c,d),t=-1;for(let n=0;n<e.length;n++){let r=e[n];if("shared"===r.source&&"literal"===r.type)t=n;else if("endRange"===r.source)break}let n="",r="";for(let a=0;a<e.length;a++)a<t?n+=e[a].value:a>t&&(r+=e[a].value);return{start:n,end:r}}catch{}r=m}else r=new fC(t,yq(n,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:r.format(d)}},getDateFormatter:(e,t)=>new fC(e,yq({},{...x,...t}))}}({...e,validationBehavior:o}),s=(0,lr.useRef)(null),[l,u]=m_(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,startFieldProps:m,endFieldProps:p,buttonProps:f,dialogProps:h,calendarProps:g,descriptionProps:y,errorMessageProps:v,...b}=function(e,t,n){var r;let a=fV((r=y_)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=yk({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fb(),f=t.formatValue(p,{month:"long"}),h=h3(f?a.format("selectedRangeDescription",{startDate:f.start,endDate:f.end}):""),g={"aria-label":a.format("startDate"),"aria-labelledby":m},y={"aria-label":a.format("endDate"),"aria-labelledby":m},v=mh(),b=mh(),w=yS(t,n),x=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,D=(0,lr.useMemo)(()=>yb(n,{accept:e=>e.id!==v}),[n,v]),E={[yN]:D,[yO]:"presentation","aria-describedby":x,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},_=mI(e),S=(0,lr.useRef)(!1),{focusWithinProps:C}=p1({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mV(document.getElementById(b),t.relatedTarget)||(S.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{S.current||(S.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,lr.useRef)(yj),P=(0,lr.useRef)(yj);return{groupProps:mv(_,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":x,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...l,onClick:()=>{D.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":x,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...E,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[yF]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(yH(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...E,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[yF]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(yH(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:c,errorMessageProps:d,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:o,validationErrors:i,validationDetails:s}}({...mS(e),label:u,validationBehavior:o},i,s),[w,x]=(0,lr.useState)(null),D=(0,lr.useCallback)(()=>{s.current&&x(s.current.offsetWidth+"px")},[]);vU({ref:s,onResize:D});let{focusProps:E,isFocused:_,isFocusVisible:S}=p4({within:!0}),C=mx({...e,values:{state:i,isFocusWithin:_,isFocusVisible:S,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DateRangePicker"}),k=mI(e);return delete k.id,la().createElement(mw,{values:[[bv,i],[g7,{...c,ref:s,isInvalid:i.isInvalid}],[ft,{...f,isPressed:i.isOpen}],[vy,{...d,ref:l,elementType:"span"}],[gX,g],[vd,i],[bc,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":w}}],[vc,h],[y7,{slots:{start:m,end:p}}],[fa,{slots:{description:y,errorMessage:v}}],[vp,b]]},la().createElement("div",{...E,...k,...C,ref:t,slot:e.slot||void 0,"data-focus-within":_||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":S||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))});function bx(e){return la().createElement(fv,e)}function bD(e,t,n=!1){if(null==e)return n?e:void 0;if("string"==typeof e&&!e)return n?null:void 0;if(e instanceof ho||e instanceof hs||e instanceof hl)return t?hb(e,t):e;{let n=uG()(e).toDate(),r=new ho(n.getFullYear(),n.getMonth()+1,n.getDate());return t?hb(r,t):r}}function bE(e){if(e)return e.toDate(hO())}function b_(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function bS(e){let t=e??"",n=b_(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function bC(){let e=window.i18next.language,t=b_(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;er=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;er=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var bk=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(er||"en-US"),bP=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},bT={};for(let e=1;e<100;e++)bT[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var bR={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},bO="[1234567890一二三四五六七八九〇\\d]",bN={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},b$={},bM={"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},bA={zone:bM,year:bT,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:{}},bI={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(bM).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,}"},bj={...bI,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}"},bL={},bF=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=bk){return bL[t.toLowerCase()]||(bL[t.toLowerCase()]=new e(t)),bL[t.toLowerCase()]}constructor(e=bk){this.locale=e,this.lookups={...bA},this.vars={...bI};let t=new Intl.NumberFormat(this.locale);this.numberingSystem=t.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 t=parseInt(e,10);if(!isNaN(t))return t}let t="";for(let n=0;n<e.length;n++)t+=String(this.lookups.digit[e[n]]);return parseInt(t,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let t=e.slice(0,3);return 1===t.length?100*this.toInt(t):2===t.length?10*this.toInt(t):this.toInt(t)}monthNameToInt(e){if("string"!=typeof e)return;let t=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[t]||12}h12ToInt(e,t){if("string"!=typeof e)return;let n=this.lookups.meridiem[t?.toLowerCase()]||0,r=this.toInt(e);return r<12&&12===n&&(r+=12),12===r&&0===n&&(r=0),r}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 t=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(t){let[,e,n,r]=t;return("-"===e||"−"===e?-1:1)*(60*this.toInt(n)+this.toInt(r||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=bN:this.buildNumbers(),/^en/i.test(this.locale)||(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:t}=function(e){if(b$[e])return b$[e];if("fullwide"===e||"hanidec"===e)return{group:bO,lookup:{...bN}};let t=bR[e];if(!t)return{group:"\\d",lookup:{...bN}};let n=String.fromCharCode(t),r=String.fromCharCode(t+9),a={};for(let e=0;e<10;e++)a[String.fromCharCode(t+e)]=e;return b$[e]={group:`[${n}-${r}]`,lookup:a},b$[e]}(this.numberingSystem);for(let n in this.lookups.digit=t,bj)bj.hasOwnProperty(n)&&(this.vars[n]=bj[n].replace(/\*/g,e))}buildMonthNames(){let e={},t={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((n,r)=>{["","k","kuu","kuuta"].forEach((a,o)=>{e[n+a+(o<2?"\\.?":"")]=!0,t[n+a]=r+1})});else{let n=[],r=e=>"month"===e.type;for(let e=0;e<12;e++)n.push(new Date(2017,e,1));for(let a of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:a});for(let i=0;i<12;i++){let s=o.formatToParts(n[i]).find(r).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===a?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,t[s]=i+1)}}let a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=a.formatToParts(n[o]).find(r).value.toLocaleLowerCase(this.locale);i=i.replace(/\.$/,""),e[`${i}\\.?`]=!0,t[i]=o+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=t}buildDaynames(){let e=[],t=e=>"weekday"===e.type;for(let t=0;t<7;t++)e.push(new Date(2017,0,t+1));let n=[],r={};for(let a of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t).value.toLocaleLowerCase(this.locale);"short"===a?(s=s.replace(/\.$/,""),n.push(`${s}\\.?`)):n.push(s),r[s]=i}}this.vars.DAYNAME=n.join("|"),this.lookups.dayname=r}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,n=[],r={},a=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=a.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);n.push(s),r[s]=12*o}this.vars.MERIDIEM=n.join("|"),this.lookups.meridiem=r}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,t)=>{if(!this.vars[t])throw Error(`Template string contains invalid variable _${t}_`);return this.vars[t]}),"i")}},bB=["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"],bV={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},bU=()=>new Date;function bW(e){return function(t){let n={};for(let r=0,a=e.length;r<a;r++){let a=e[r];a&&(n[a]=t[r])}return n}}var bH=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:n,formatter:r}){this.doneChecker=e,this.fallback=t,this.patterns=n,this.formatter=r}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),n={},r=!1;for(let e of this.patterns){let a=t.match(e.regex);if(!a)continue;r=!0;let o=e.handler(a);if(o){for(let[e,t]of Object.entries(o))e in n||void 0===t||(n[e]=t);if(t=(t=t.slice(0,a.index)+t.slice(a.index+a[0].length+1)).trim(),this.doneChecker(n,t))break}}return r?this.formatter(n):this.fallback(e)}},bz=["year","month","day","hour","minute","second","millisecond","offset"],bK={};function bZ(e,t){return""===t||/^\s+$/.test(t)||"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 bG=[[/([^\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"]],bY={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," "],...bG],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:bG,id:bG,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function bq(e,t=bk){let n=function(e){if(!bK[e]){var t,n;let r,a,o=bF.factory(e);bK[e]=new bH({doneChecker:bZ,fallback:(t=e,function(e){let n=String(e).slice(0,50);return""===n&&(n="(empty string)"),{invalid:`Unable to parse "${n}" with locale "${t}"`}}),patterns:(r=[{name:"timestampWithOffset",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:bW(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:bW(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:bW(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${bO}{2,4})\\s*\u5E74\\s*(${bO}{1,2})\\s*\u6708\\s*(${bO}{1,2})\\s*\u65E5$`),handler:bW(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:bW(["","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:bW(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=bU(),n=e[1].toLowerCase();switch(n){case"tomorrow":t.setUTCDate(t.getUTCDate()+1);break;case"yesterday":t.setUTCDate(t.getUTCDate()-1)}let r={year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate()};return"now"===n&&(r.hour=t.getUTCHours(),r.minute=t.getUTCMinutes(),r.second=t.getUTCSeconds(),r.millisecond=t.getUTCMilliseconds()),console.log("today=>",n,r),r}},{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,t,n,r]){t=parseFloat(t),"week"===(n=n.length<=2?bV[n]:(n=n.replace(/s$/,"")).toLowerCase())&&(n="day",t*=7),("-"===e||r)&&(t*=-1);let a=bU();return"millisecond"===n?a.setUTCMilliseconds(a.getUTCMilliseconds()+t):"second"===n?a.setUTCSeconds(a.getUTCSeconds()+t):"minute"===n?a.setUTCMinutes(a.getUTCMinutes()+t):"hour"===n?a.setUTCHours(a.getUTCHours()+t):"day"===n?a.setUTCDate(a.getUTCDate()+t):"month"===n?a.setUTCMonth(a.getUTCMonth()+t):"year"===n&&a.setUTCFullYear(a.getUTCFullYear()+t),{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate(),hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let t=new Date(1e3*parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let t=new Date(parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:o.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:bW(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:bW(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:bW(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:bW(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:bW(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:bW(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:bW(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:bW(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:bW(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:bW(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:bW(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:bW(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:bW(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:bW(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:bW(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:bW(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:bW(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:bW(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:bW(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:bW(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:bW(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:bW(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:bW(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:bW(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:bW(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:bW(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:bW(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:bW(["zone"])}],a=o.baseName.slice(0,5),bB.includes(a)?r:r.filter(e=>!["mdy","md"].includes(e.name))),formatter:(n=o,function(e){let t={};for(let[r,a]of Object.entries(e))if("monthname"===r){if(a){let e=n.monthNameToInt(a);void 0!==e&&(t.month=e)}}else if("hour"===r&&e.meridiem){let r=n.h12ToInt(a,e.meridiem);void 0!==r&&(t.hour=r)}else if("zone"===r){if(a){let e=n.zoneToOffset(a);void 0!==e&&(t.offset=e)}}else if("offset"===r){let e=n.offsetToMinutes(a);void 0!==e&&(t.offset=e)}else if("millisecond"===r){let e=n.millisecondToInt(a);"number"==typeof e&&(t.millisecond=e)}else if(bz.includes(r)){let e=n.toInt(a);"number"==typeof e&&(t[r]=e)}return t.year<100&&(t.year=bT[t.year]),t.year&&"buddhist"===n.dateOptions.calendar&&(t.year-=543),t})})}return bK[e]}(t),r=function(e,t){let n=bY[t.slice(0,2).toLowerCase()];if(!n)return e;for(let[t,r]of n)e=e.replace(t,r);return e}(e,t);return n.attempt(r)}function bJ(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new bP(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 bP(t.valueOf()-60*e.offset*1e3):t}function bX(e,t=bk){let n=bq(e,t),r=n.invalid?new bP(NaN):bJ(n);return r.isValid()||(r.invalid=`Unable to parse date "${e}"`),r}function bQ(e,t=bk){return e instanceof Date?new bP(e.valueOf()):"number"==typeof e?new bP(e):bX(e,t)}Date.fromString=bP.fromString=bX,Date.fromAny=bP.fromAny=bQ,"u">typeof window&&(window.anyDateParser={fromString:bX,fromAny:bQ,fromObject:bJ,attempt:bq});var b0=n(4397),b1=n(7657);let b4=function(e){return null==e};function b2(e,t){var n=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return n.get?n.get.call(e):n.value}uG().extend(uY),uG().extend(b1),uG().extend(b0);let b3="YYYY-MM-DDTHH:mm:ss.SSSZZ";function b6(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&uG()(e,b3).isValid()}function b5(e){return uG()(e).isToday()}function b9(e){return b6(e)?uG()(e,b3).toDate():null}function b8(e,t=!1){let n=uG()(e);return t&&(n=n.utc()),n.format(b3)}function b7(e){return uG()(e).toDate()}var we=new WeakMap;let wt=new class{register(e,t){b2(this,we).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(b2(this,we).has(t))return b2(this,we).get(t)}if(e.language&&b2(this,we).has(e.language))return b2(this,we).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return b2(this,we).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,we,{writable:!0,value:new Map})}};function wn(e,t){wt.register(e,t)}function wr(e){let t=e??bC();return wt.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let wa={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function wo(e,t={}){let n=bq(e,bC());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!b4(n.day)&&b4(n.month)&&(n=Object.assign({},tf(n,"day"),{month:n.day})),n.month&&(n.month-=1),n.day&&(n=Object.assign({},tf(n,"day"),{date:n.day}));let r=uG()().set(n).toDate();return b4(n.year)&&(t.year=!1),b4(n.month)&&(t.month=!1),b4(n.date)&&(t.day=!1),wi(r,t)}function wi(e,t){let n,r=t?.locale??bC(),a=new Intl.Locale(r),{calendar:o,mode:i,time:s,day:l,month:u,year:c,noToday:d,numberingSystem:m}={...wa,...{noToday:"am"===a.language},...t},p={calendar:o??wr(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=uG()(e).isToday();if(f&&!d)n=(n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(r)+n.slice(1);else{"en"===a.language&&(r="en-GB");let t=new Intl.DateTimeFormat(r,p).formatToParts(e);("en"===a.language||"am"===a.language)&&"standard"==i&&c&&l&&(t=t.map(ws("-"))),"wide"==i&&(t=t.map(ws(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,n)=>"era"!==e.type&&("literal"!==e.type||!(t<n.length-1)||"era"!==n[t+1].type))),n=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(n+=`, ${wl(e)}`),n}let ws=e=>(t,n,r)=>"literal"!==t.type||" "!==t.value||n<r.length-1&&"era"===r[n+1].type?t:{type:"literal",value:e};function wl(e){return e.toLocaleTimeString(bC(),{hour:"2-digit",minute:"2-digit"})}function wu(e,t){return wi(e,{...t,time:!0})}function wc(e,t){let n=wr("string"==typeof t?new Intl.Locale(t):t);return n?hb(e,gI(n)):e}function wd(e,t){return new Intl.DurationFormat(bC(),t).format(e)}function wm(e,t){if(null==e)return null;if("string"==typeof e){let n=bq(e,bC());return n.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(n.day&&!n.month&&(n={...tf(n,"day"),...{month:n.day}}),n.month&&(n.month-=1),n.day&&(n={...tf(n,"day"),...{date:n.day}}),uG()(t).set(n))}return uG()(e)}let wp=["years","months","days","hours","minutes","seconds"],wf={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},wh={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function wg(e,t=uG()(),n){let r,a=uG()(t),o=wm(e,a);if(null==o)return null;if("string"==typeof n){let e=wf[n]??n;return{[e]:a.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?wf[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=wp.indexOf(n);for(let a=0;a<wp.length;a++){let o=wp[a];if(t.diff(e,o)>0)return a<=r?o:n}return n}(o,a,t??"seconds"):wf[s]??s,function(e,t,n,r){let a=wp.indexOf(n),o=wp.indexOf(r),i=wp.slice(a,o+1),s={},l=e;for(let e of i){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(o,a,e,t??e)}let u=(r=function(e){let t={...wh};if(e)for(let[n,r]of Object.entries(e))void 0!==r&&(t[wf[n]??n]=r);return t}(i),a.diff(o,"seconds")<r.seconds?"seconds":a.diff(o,"minutes")<r.minutes?"minutes":a.diff(o,"hours")<r.hours?"hours":a.diff(o,"days")<r.days?"days":a.diff(o,"months")<r.months?"months":"years");return{[u]:a.diff(o,u)}}let wy={style:"short",localeMatcher:"lookup"};function wv(e,t=uG()(),n){let r=wg(e,t,n);return null==r?null:wd(r,"object"==typeof n&&n.formatOptions?{...wy,...n.formatOptions}:wy)}let wb=(0,lr.createContext)(null);function ww(){let e=ur({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,lr.useMemo)(()=>{let t=bC();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,lr.useMemo)(()=>{let e=wr(t);return void 0!==e?gI(e):void 0},[t]),r=(0,lr.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),a=(0,lr.useMemo)(()=>n?hb(hk(hO()),n):hk(hO()),[n]);return{calendar:n,intlLocale:r,today_:a}}let wx=new ho(1793,1,1);var wD={};function wE(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function w_(e={}){let{locale:t}=fb();return(0,lr.useMemo)(()=>new(0,y3.K)(t,e),[t,e])}wD={"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 wS={};wS={"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 wC=()=>{};function wk(e){var t;let n=(0,lr.useRef)(void 0),{value:r,textValue:a,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:u,onIncrement:c,onIncrementPage:d,onDecrement:m,onDecrementPage:p,onDecrementToMin:f,onIncrementToMax:h}=e,g=fV((t=wS)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,lr.useRef)(!1),v=(0,lr.useCallback)(()=>{clearTimeout(n.current),y.current=!1},[]),b=pB(()=>{v()});(0,lr.useEffect)(()=>()=>b(),[]);let w=(0,lr.useRef)(!1),x=()=>{w.current=!0},D=()=>{w.current=!1},E=""===a?g.format("Empty"):(a||`${r}`).replace("-","−");(0,lr.useEffect)(()=>{w.current&&(fw&&fw.clear("assertive"),fx(E,"assertive"))},[E]);let _=(0,lr.useCallback)(()=>{v()},[v]),S=pB(c??wC),C=pB(m??wC),k=pB(()=>{(void 0===i||isNaN(i)||void 0===r||isNaN(r)||r<i)&&(S(),P(60))}),P=pB(e=>{b(),y.current=!0,n.current=window.setTimeout(k,e)}),T=pB(()=>{(void 0===o||isNaN(o)||void 0===r||isNaN(r)||r>o)&&(C(),R(60))}),R=pB(e=>{b(),y.current=!0,n.current=window.setTimeout(T,e)}),O=e=>{e.preventDefault()},{addGlobalListener:N,removeAllGlobalListeners:$}=pV(),M=(0,lr.useRef)(!1),[A,I]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{"touch"===A?P(600):A&&P(400)},[A]);let[j,L]=(0,lr.useState)(null);return(0,lr.useEffect)(()=>{"touch"===j?R(600):j&&R(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===r||isNaN(r)?void 0:r,"aria-valuetext":E,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":u||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(d){e.preventDefault(),d?.();break}case"ArrowUp":case"Up":c&&(e.preventDefault(),c?.());break;case"PageDown":if(p){e.preventDefault(),p?.();break}case"ArrowDown":case"Down":m&&(e.preventDefault(),m?.());break;case"Home":f&&(e.preventDefault(),f?.());break;case"End":h&&(e.preventDefault(),h?.())}},onFocus:x,onBlur:D},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),I("mouse")):(N(window,"pointercancel",_,{capture:!0}),M.current=!1,I("touch")),N(window,"contextmenu",O)},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),$(),I(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&c?.(),M.current=!1,I(null)},onFocus:x,onBlur:D},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),L("mouse")):(N(window,"pointercancel",_,{capture:!0}),M.current=!1,L("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),$(),L(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&m?.(),M.current=!1,L(null)},onFocus:x,onBlur:D}}}let wP=null;var wT=n(2103);function wR(e,t,n){let r="+"===e?t+n:t-n;if(t%1!=0||n%1!=0){let a=t.toString().split("."),o=n.toString().split("."),i=Math.pow(10,Math.max(a[1]&&a[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),n=Math.round(n*i),r=("+"===e?t+n:t-n)/i}return r}let wO=(0,lr.createContext)(null),wN=(0,lr.createContext)(null),w$=(0,lr.forwardRef)(function(e,t){var n,r;[e,t]=mE(e,t,wO);let{validationBehavior:a}=mD(vg)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",{locale:i}=fb(),s=function(e){let{minValue:t,maxValue:n,step:r,formatOptions:a,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:u,isReadOnly:c,commitBehavior:d="snap"}=e;null===o&&(o=NaN);let m=(0,lr.useCallback)(e=>void 0===r||isNaN(r)?vE(e,t,n):vS(e,t,n,r),[r,t,n]);void 0===o||isNaN(o)||"snap"!==d||(o=m(o)),isNaN(i)||"snap"!==d||(i=m(i));let[p,f]=gz(o,isNaN(i)?NaN:i,s),[h]=(0,lr.useState)(p),[g,y]=(0,lr.useState)(()=>isNaN(p)?"":new(0,y3.K)(l,a).format(p)),v=(0,lr.useMemo)(()=>new(0,wT.d)(l,a),[l,a]),b=(0,lr.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,lr.useMemo)(()=>new(0,y3.K)(l,{...a,numberingSystem:b}),[l,a,b]),x=(0,lr.useMemo)(()=>w.resolvedOptions(),[w]),D=(0,lr.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),E=yB({...e,value:p}),_=void 0===r||isNaN(r)?1:r;"percent"===x.style&&(void 0===r||isNaN(r))&&(_=.01);let[S,C]=(0,lr.useState)(p),[k,P]=(0,lr.useState)(l),[T,R]=(0,lr.useState)(a);Object.is(p,S)&&l===k&&a===T||(y(D(p)),C(p),P(l),R(a));let O=(0,lr.useMemo)(()=>v.parse(g),[v,g]),N=(e,r=0)=>{if(isNaN(O))return vS(isNaN(r)?0:r,t,n,_);{let r=vS(O,t,n,_);return"+"===e&&r>O||"-"===e&&r<O?r:vS(wR(e,O,_),t,n,_)}},$=(0,lr.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===n||isNaN(n)||vS(O,t,n,_)>O||wR("+",O,_)<=n),[u,c,t,n,_,O]),M=(0,lr.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===t||isNaN(t)||vS(O,t,n,_)<O||wR("-",O,_)>=t),[u,c,t,n,_,O]);return{...E,validate:e=>v.isValidPartialNumber(e,t,n),increment:()=>{let e=N("+",t);e===p&&y(D(e)),f(e),E.commitValidation()},incrementToMax:()=>{null!=n&&(f(vS(n,t,n,_)),E.commitValidation())},decrement:()=>{let e=N("-",n);e===p&&y(D(e)),f(e),E.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),E.commitValidation())},canIncrement:$,canDecrement:M,minValue:t,maxValue:n,numberValue:O,defaultNumberValue:isNaN(i)?h:i,setNumberValue:f,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,n=O;if(void 0!==e&&(n=v.parse(t)),!t.length){f(NaN),y(void 0===o?"":D(p));return}if(isNaN(n))return void y(D(p));let r="snap"===d?m(n):n,a=(r=v.parse(D(r)))!==p;f(r),y(D(void 0===o?r:p)),a&&E.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,lr.useRef)(null),[u,c]=m_(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:d,groupProps:m,inputProps:p,incrementButtonProps:f,decrementButtonProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,n){var r,a,o,i,s,l,u,c,d;let m,{id:p,decrementAriaLabel:f,incrementAriaLabel:h,isDisabled:g,isReadOnly:y,isRequired:v,minValue:b,maxValue:w,autoFocus:x,label:D,formatOptions:E,onBlur:_=()=>{},onFocus:S,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:T,errorMessage:R,isWheelDisabled:O,...N}=e,{increment:$,incrementToMax:M,decrement:A,decrementToMin:I,numberValue:j,inputValue:L,commit:F,commitValidation:B}=t,V=fV((r=wD)&&r.__esModule?r.default:r,"@react-aria/numberfield"),U=(0,lr.useCallback)(()=>{let e=n.current?.value??"";(0,pU.flushSync)(()=>{F()}),n.current?.value!==e&&fx(n.current?.value??"","assertive")},[F,n]),W=mh(p),{focusProps:H}=pC({onBlur(){U()}}),z=w_(E),K=(0,lr.useMemo)(()=>z.resolvedOptions(),[z]),Z=w_({...E,currencySign:void 0}),G=(0,lr.useMemo)(()=>isNaN(j)?"":Z.format(j),[Z,j]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=wk({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:$,onIncrementToMax:M,onDecrement:A,onDecrementToMin:I,value:j,textValue:G}),[X,Q]=(0,lr.useState)(!1),{focusWithinProps:ee}=p1({isDisabled:g,onFocusWithinChange:Q});!function(e,t){let{onScroll:n,isDisabled:r}=e,a=(0,lr.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),n&&n({deltaX:e.deltaX,deltaY:e.deltaY}))},[n]);hq(t,"wheel",r?void 0:a)}({onScroll:(0,lr.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?$():e.deltaY<0&&A())},[A,$]),isDisabled:O||g||y||!X},n);let et=(K.maximumFractionDigits??0)>0,en=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,er="numeric";m5()?en?er="text":et&&(er="decimal"):pt()&&(en?er="numeric":et&&(er="decimal"));let ea=mI(e),eo=(0,lr.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,pU.flushSync)(()=>{F()}),B()):e.continuePropagation())},[F,B]),{isInvalid:ei,validationErrors:es,validationDetails:el}=t.displayValidation,{labelProps:eu,inputProps:ec,descriptionProps:ed,errorMessageProps:em}=function(e,t,n){let r=pB(e=>{let r=n.current;if(!r)return;let a=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":a=r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentForward":a=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd+1):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentBackward":a=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart-1)+r.value.slice(r.selectionStart):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":a=r.value.slice(r.selectionStart);break;default:null!=e.data&&(a=r.value.slice(0,r.selectionStart)+e.data+r.value.slice(r.selectionEnd))}null!=a&&t.validate(a)||e.preventDefault()});(0,lr.useEffect)(()=>{if(!wE()||!n.current)return;let e=n.current;return e.addEventListener("beforeinput",r,!1),()=>{e.removeEventListener("beforeinput",r,!1)}},[n]);let a=wE()?null:e=>{let n=mU(e).value.slice(0,mU(e).selectionStart)+e.data+mU(e).value.slice(mU(e).selectionEnd);t.validate(n)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...u}=function(e,t){let{inputElementType:n="input",isDisabled:r=!1,isRequired:a=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,u]=gz(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=pR(e,t),d=yB({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=yk({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=mI(e,{labelable:!0}),w={type:i,pattern:e.pattern},[x]=(0,lr.useState)(l);return yP(t,e.defaultValue??x,u),yT(e,d,t),{labelProps:h,inputProps:mv(b,"input"===n?w:void 0,{disabled:r,readOnly:o,required:a&&"native"===s,"aria-required":a&&"aria"===s||void 0,"aria-invalid":m||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=>u(mU(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(la().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,...c,...g}),descriptionProps:y,errorMessageProps:v,isInvalid:m,validationErrors:p,validationDetails:f}}(e,n),c=(0,lr.useRef)(null);return{inputProps:mv(i,{onBeforeInput:a,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:r}=n.current;c.current={value:e,selectionStart:t,selectionEnd:r}},onCompositionEnd(){if(n.current&&!t.validate(n.current.value)){let{value:e,selectionStart:r,selectionEnd:a}=c.current;n.current.value=e,n.current.setSelectionRange(r,a),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...u}}({...N,...ea,name:void 0,form:void 0,label:D,autoFocus:x,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[yF]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:W,type:"text",inputMode:er,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:_,onFocus:S,onFocusChange:C,onKeyDown:(0,lr.useMemo)(()=>mn(eo,k),[eo,k]),onKeyUp:P,onPaste:t=>{e.onPaste?.(t);let n=mU(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:T,errorMessage:R},t,n);yP(n,t.defaultNumberValue,t.setNumberValue),a=t,o=e.validationBehavior,i=e.commitBehavior,s=n,l=t.minValue,u=t.maxValue,c=e.step,d=t.numberValue,mr(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!wP&&"u">typeof document&&((wP=document.createElement("input")).type="number"),!wP))return;wP.min=null==l||isNaN(l)?"":String(l),wP.max=null==u||isNaN(u)?"":String(u),wP.step=null==c||isNaN(c)?"":String(c),wP.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&wP.validity.valid,n=e.validationMessage||wP.validationMessage,r={isInvalid:!t,validationErrors:n?[n]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:wP.validity.rangeOverflow,rangeUnderflow:wP.validity.rangeUnderflow,stepMismatch:wP.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};a.updateValidation(r),"native"!==o||wP.validity.valid||e.setCustomValidity(wP.validationMessage)});let ep=mv(Y,H,ec,{role:null,"aria-roledescription":m8()?null:V.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(ep["aria-required"]=void 0);let ef=e=>{((e=document)=>e.activeElement)()!==n.current&&("mouse"===e.pointerType?n.current?.focus():e.target.focus())},eh=e["aria-label"]||("string"==typeof e.label?e.label:"");eh||(m=null!=e.label?eu.id:e["aria-labelledby"]);let eg=mh(),ey=mh(),ev=mv(q,{"aria-label":h||V.format("increase",{fieldLabel:eh}).trim(),id:m&&!h?eg:null,"aria-labelledby":m&&!h?`${eg} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:ef}),eb=mv(J,{"aria-label":f||V.format("decrease",{fieldLabel:eh}).trim(),id:m&&!f?ey:null,"aria-labelledby":m&&!f?`${ey} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:ef});return{groupProps:{...ee,role:"group","aria-disabled":g,"aria-invalid":ei?"true":void 0},labelProps:eu,inputProps:ep,incrementButtonProps:ev,decrementButtonProps:eb,errorMessageProps:em,descriptionProps:ed,isInvalid:ei,validationErrors:es,validationDetails:el}}({...mS(e),label:c,validationBehavior:o},s,l),b=mx({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:v.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),w=mI(e);return delete w.id,la().createElement(mw,{values:[[wN,s],[g7,m],[yt,{...p,ref:l}],[vy,{...d,ref:u}],[ft,{slots:{increment:f,decrement:h}}],[fa,{slots:{description:g,errorMessage:y}}],[vp,v]]},la().createElement("div",{...w,...b,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":v.isInvalid||void 0}),e.name&&la().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function wM(e,t){return Number.parseInt(wi(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let wA=(0,lr.forwardRef)(function(e,t){let{className:n}=e,r=(0,lr.useContext)(gQ),a=(0,lr.useContext)(g0),o=r??a,i=(0,lr.useContext)(wb),s=hO(),l=wi(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=wM(o.visibleRange.start.toDate(s),i),c=o.maxValue?wM(o.maxValue.toDate(s),i):void 0,d=o.minValue?wM(o.minValue.toDate(s),i):void 0,m=(0,lr.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,co.jsxs)("span",{ref:t,className:n,children:[(0,co.jsx)("span",{children:l}),(0,co.jsxs)(w$,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,co.jsx)(yn,{}),(0,co.jsxs)(ye,{children:[(0,co.jsx)(fn,{slot:"increment",children:(0,co.jsx)(cj,{size:8})}),(0,co.jsx)(fn,{slot:"decrement",children:(0,co.jsx)(cM,{size:8})})]})]})]})}),wI="-esm-form-engine__datepicker-module__inputGroup___gBam-",wj="-esm-form-engine__datepicker-module__inputSegment___wIJDZ",wL="-esm-form-engine__datepicker-module__dateInputWrapper___LiY68",wF="-esm-form-engine__datepicker-module__invalidText___A4cv4",wB="-esm-form-engine__datepicker-module__flatButton___HcpME",wV="-esm-form-engine__datepicker-module__flatButtonMd___eFpyF",wU="-esm-form-engine__datepicker-module__flatButtonSm___tsawR",wW="-esm-form-engine__datepicker-module__flatButtonLg___4HG5y";function wH({children:e}){let t=(0,lr.useContext)(by),n=(0,lr.useContext)(bv),r=t??n,a=uI(()=>r?.close());return(0,co.jsx)(vm,{className:"-esm-form-engine__datepicker-module__dialog___DaqYi",ref:a,children:e})}let wz=(0,lr.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},a){let o="range"===e;return(0,co.jsx)(bm,{ref:a,className:"-esm-form-engine__datepicker-module__popover___nAPzC",placement:"bottom start",offset:1,isNonModal:!0,children:(0,co.jsx)(wH,{children:(0,co.jsxs)(o?g4:g1,{...o?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,co.jsxs)("header",{className:"-esm-form-engine__datepicker-module__header___rPv3L",children:[(0,co.jsx)(fn,{className:cs()(wB,wV),slot:"previous",children:(0,co.jsx)(cH,{size:16})}),(0,co.jsx)(wA,{className:"-esm-form-engine__datepicker-module__monthYear___Rw4qE"}),(0,co.jsx)(fn,{className:cs()(wB,wV),slot:"next",children:(0,co.jsx)(cz,{size:16})})]}),(0,co.jsx)(g3,{className:"-esm-form-engine__datepicker-module__calendarGrid___yKV-n",children:e=>(0,co.jsx)(g8,{className:cs()("cds--date-picker__day",{"-esm-form-engine__datepicker-module__today___KzMTn":0===t.compare(e)}),date:e},e.toString())})]})})})}),wK=(0,lr.forwardRef)(function(e,t){let n=(0,lr.useContext)(by),[r,a]=mE({slot:e.slot},t,y7),{locale:o}=fb(),i=y8({...r,locale:o,createCalendar:gI}),s=(0,lr.useRef)(null),{fieldProps:l,inputProps:u}=y$({...r,inputRef:s},i,a),c=(0,lr.useCallback)(()=>{i.isDisabled||n.toggle()},[]);return(0,co.jsxs)(mw,{values:[[ve,i],[yt,{...u,ref:s}],[g7,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,co.jsx)(ye,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:c,children:i.segments.map((t,n)=>(0,lr.cloneElement)(e.children(t),{key:n}))}),(0,co.jsx)(yn,{})]})}),wZ=(0,lr.forwardRef)(function(e,t){let n=(0,lr.useContext)(by),r=(0,lr.useContext)(bv);return(n??r).isInvalid?(0,co.jsx)(dQ,{ref:t,size:16,...e}):(0,co.jsx)(c$,{ref:t,size:16,...e})});class wG{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let wY=new Map,wq=(0,lr.forwardRef)(function({segment:e,...t},n){let r=(0,lr.useContext)(ve),a=d7(n),{segmentProps:o}=function(e,t,n){let r,a,o,i,s=(0,lr.useRef)(""),{locale:l,direction:u}=fb(),c=function(){var e;let{locale:t}=fb(),n=fB((e=y_)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,lr.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new wG(t,n)}},[t,n])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=yR.get(t),h=e.isPlaceholder?"":e.text,g=(0,lr.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=fO({month:"long",timeZone:g.timeZone}),v=fO({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(h=v.format(t.dateValue));else{let e=y.format(t.dateValue);h=e!==h?`${h} \u{2013} ${e}`:e}let{spinButtonProps:b}=wk({value:e.value??void 0,textValue:h,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{s.current="",t.increment(e.type)},onDecrement:()=>{s.current="",t.decrement(e.type)},onIncrementPage:()=>{s.current="",t.incrementPage(e.type)},onDecrementPage:()=>{s.current="",t.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",t.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",t.decrementToMin(e.type)}}),w=(0,lr.useMemo)(()=>new(0,wT.d)(l,{maximumFractionDigits:0}),[l]),x=()=>{if(e.text===e.placeholder&&f.focusPrevious(),!w.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let n=e.text.slice(0,-1),r=w.parse(n);0===(n=0===r?"":n).length||0===r?t.clearSegment(e.type):t.setSegment(e.type,r),s.current=n}},{startsWith:D}=(r=function(e){let{locale:t}=fb(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(wY.has(n))return wY.get(n);let r=new Intl.Collator(t,e);return wY.set(n,r),r}({usage:"search",sensitivity:"base"}),a=(0,lr.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===r.compare(e.slice(0,t.length),t)),[r]),o=(0,lr.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===r.compare(e.slice(-t.length),t)),[r]),i=(0,lr.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let n=0,a=(t=t.normalize("NFC")).length;for(;n+a<=e.length;n++){let o=e.slice(n,n+a);if(0===r.compare(t,o))return!0}return!1},[r]),(0,lr.useMemo)(()=>({startsWith:a,endsWith:o,contains:i}),[a,o,i])),E=fO({hour:"numeric",hour12:!0}),_=(0,lr.useMemo)(()=>{let e=new Date;return e.setHours(0),E.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[E]),S=(0,lr.useMemo)(()=>{let e=new Date;return e.setHours(12),E.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[E]),C=fO({year:"numeric",era:"narrow",timeZone:"UTC"}),k=(0,lr.useMemo)(()=>{if("era"!==e.type)return[];let n=hb(new ho(1,1,1),t.calendar),r=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:C.formatToParts(t).find(e=>"era"===e.type).value}}),a=function(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==n[e])return e;return 0}(r.map(e=>e.formatted));if(a)for(let e of r)e.formatted=e.formatted.slice(a);return r},[C,t.calendar,e.type]),P=n=>{if(t.isDisabled||t.isReadOnly)return;let r=s.current+n;switch(e.type){case"dayPeriod":if(D(_,n))t.setSegment("dayPeriod",0);else if(D(S,n))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=k.find(e=>D(e.formatted,n));e&&(t.setSegment("era",e.era),f.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!w.isValidPartialNumber(r))return;let a=w.parse(r),o=a;if(void 0!==e.maxValue&&a>e.maxValue&&(o=w.parse(n)),isNaN(a))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(a+"0")>e.maxValue||r.length>=String(e.maxValue).length)?(s.current="",f.focusNext()):s.current=r}}};hq((0,lr.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mV(n.current,e?.anchorNode)&&e.collapse(n.current)});let T=(0,lr.useRef)("");hq(n,"beforeinput",r=>{if(n.current)switch(r.preventDefault(),r.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&x();break;case"insertCompositionText":T.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:null!=r.data&&P(r.data)}}),hq(n,"input",e=>{let{inputType:t,data:r}=e;"insertCompositionText"===t&&(n.current&&(n.current.textContent=T.current),null!=r&&(D(_,r)||D(S,r))&&P(r))}),mr(()=>{let e=n.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[n,f]);let R=m8()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,lr.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(p=void 0);let O=mh(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,$="literal"===e.type?"":c.of(e.type),M=hz({"aria-label":`${$}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let A={caretColor:"transparent"};if("rtl"===u){A.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(A.direction="ltr")}return{segmentProps:mv(b,M,{id:O,...R,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":p,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?"false":void 0,autoCorrect:N?"off":void 0,[parseInt(la().version,10)>=17?"enterKeyHint":"enterkeyhint"]:N?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!N?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(m6()?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(),x()}},onFocus:()=>{s.current="",n.current&&h1(n.current,{containingElement:hX(n.current)});let e=window.getSelection();e?.collapse(n.current)},style:A,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,r,a),{focusProps:i,isFocused:s,isFocusVisible:l}=p4(),{hoverProps:u,isHovered:c}=p9({...t,isDisabled:r.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:r,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,lr.useMemo)(()=>{let e,l,u;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof n?n({...s,defaultStyle:i||{}}):n,u="function"==typeof r?r({...s,defaultChildren:o}):null==r?o:r,{className:e??a,style:l||i?{...i,...l}:void 0,children:u??o,"data-rac":""}},[t,n,r,a,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:r.isInvalid,isDisabled:r.isDisabled,isHovered:c,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,lr.useCallback)(e=>{e.stopPropagation()},[]);return(0,co.jsx)("span",{...mv(mI(t),o,i,u),...d,ref:a,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":r.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":r.isDisabled||void 0,"data-type":e.type,"data-hovered":c||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),wJ={short:!1,size:"md"},wX=(0,lr.forwardRef)(function(e,t){let{className:n,defaultValue:r,isDisabled:a,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:u,light:c,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:y,...v}={...wJ,...e},{calendar:b,intlLocale:w,today_:x}=ww(),D=(0,lr.useId)(),E=!!(u??l),_=(0,lr.useMemo)(()=>bD(r,b),[r,b]),S=(0,lr.useMemo)(()=>bD(y,b,!0),[y,b]),C=(0,lr.useMemo)(()=>bD(d,b),[d,b]),k=(0,lr.useMemo)(()=>bD(m??wx,b),[m,b]),P=(0,lr.useMemo)(()=>o||s,[o,s]),T=(0,lr.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(bE(e)))),[f,p]);return(0,co.jsx)(bx,{locale:w.toString(),children:(0,co.jsx)("div",{className:cs()("cds--form-item",n),children:(0,co.jsx)(mw,{values:[[wb,w]],children:(0,co.jsxs)(bb,{className:cs()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:_,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:S,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:T,children:[(0,co.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,co.jsx)(vv,{className:cs()("cds--label",{"cds--label--disabled":a}),htmlFor:D,children:u??l}),(0,co.jsxs)(ye,{className:wI,children:[(0,co.jsx)(wK,{id:E?D:void 0,ref:t,className:cs()("cds--date-picker-input__wrapper","-esm-form-engine__datepicker-module__inputWrapper___uKdT1",{"-esm-form-engine__datepicker-module__inputWrapperSm___0RXJc":"sm"===g,"-esm-form-engine__datepicker-module__inputWrapperMd___4Vff1":"md"===g||!g||0===g.length,"-esm-form-engine__datepicker-module__inputWrapperLg___VCRm5":"lg"===g}),children:e=>"era"!==e.type?(0,co.jsx)(wq,{className:wj,segment:e}):(0,co.jsx)(la().Fragment,{})}),(0,co.jsx)(fn,{className:cs()(wB,{[wU]:"sm"===g,[wV]:"md"===g||!g||0===g.length,[wW]:"lg"===g}),children:(0,co.jsx)(wZ,{})})]}),(0,co.jsx)(vf,{className:wF,children:i})]}),(0,co.jsx)(wz,{variant:"single",today_:x})]})})})})}),wQ=(0,lr.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:r,isDisabled:a,isInvalid:o,label:i,labelText:s,light:l,maxDate:u,minDate:c,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:y,intlLocale:v,today_:b}=ww(),w=(0,lr.useId)(),x=!!(s??i),D=(0,lr.useMemo)(()=>{if(f)return{start:bD(f[0],y,!1),end:bD(f[1],y,!1)}},[f,y]),E=(0,lr.useMemo)(()=>{if(t)return{start:bD(t[0],y,!1),end:bD(t[1],y,!1)}},[t,y]),_=(0,lr.useMemo)(()=>bD(c??wx,y,!0),[c,y]),S=(0,lr.useMemo)(()=>bD(u,y,!0),[u,y]),C=(0,lr.useMemo)(()=>n||o,[n,o]),k=(0,lr.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([bE(e.start),bE(e.end)]))),[m,d]);return(0,co.jsx)(bx,{locale:v.toString(),children:(0,co.jsx)("div",{className:cs()("cds--form-item",e),children:(0,co.jsx)(mw,{values:[[wb,v]],children:(0,co.jsx)(bw,{id:x?w:void 0,className:cs()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:S,minValue:_,value:D,defaultValue:E,ref:g,isDisabled:a,...h,onChange:k,children:(0,co.jsxs)("div",{className:"cds--date-picker-container",children:[x&&(0,co.jsx)(vv,{className:cs()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,co.jsxs)(ye,{className:wI,children:[(0,co.jsxs)("div",{className:cs()("-esm-form-engine__datepicker-module__inputsWrapper___xXRQI",{"-esm-form-engine__datepicker-module__inputsWrapperSm___nL+b6":"sm"===p,"-esm-form-engine__datepicker-module__inputsWrapperMd___Kgcps":"md"===p||!p||0===p.length,"-esm-form-engine__datepicker-module__inputsWrapperLg___raaSN":"lg"===p}),children:[(0,co.jsx)(vn,{className:cs()("cds--date-picker-input__wrapper","-esm-form-engine__datepicker-module__startInput___cWw-5",wL),slot:"start",children:e=>(0,co.jsx)(wq,{className:wj,segment:e})}),(0,co.jsx)("div",{className:"-esm-form-engine__datepicker-module__separator___Ddb4g",children:(0,co.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,co.jsx)(vn,{className:cs()("cds--date-picker-input__wrapper","-esm-form-engine__datepicker-module__endInput___xdYOl",wL),slot:"end",children:e=>(0,co.jsx)(wq,{className:wj,segment:e})})]}),(0,co.jsx)(fn,{className:cs()(wB,{[wU]:"sm"===p,[wV]:"md"===p||!p||0===p.length,[wW]:"lg"===p}),children:(0,co.jsx)(wZ,{})})]}),(0,co.jsx)(vf,{className:wF,children:r}),(0,co.jsx)(wz,{variant:"range",today_:b,minDate:_,maxDate:S})]})})})})})}),w0=la().createContext(null);function w1(e){let{children:t}=e,n=(0,lr.useContext)(w0),[r,a]=(0,lr.useState)(0),o=(0,lr.useMemo)(()=>({parent:n,modalCount:r,addModal(){a(e=>e+1),n&&n.addModal()},removeModal(){a(e=>e-1),n&&n.removeModal()}}),[n,r]);return la().createElement(w0.Provider,{value:o},t)}function w4(e){let t,{modalProviderProps:n}={modalProviderProps:{"aria-hidden":!!(t=(0,lr.useContext)(w0))&&t.modalCount>0||void 0}};return la().createElement("div",{"data-overlay-container":!0,...e,...n})}function w2(e){return la().createElement(w1,null,la().createElement(w4,e))}function w3(e){let t=mm(),{portalContainer:n=t?null:document.body,...r}=e,{getContainer:a}=vs();if(!e.portalContainer&&a&&(n=a()),la().useEffect(()=>{if(n?.closest("[data-overlay-container]"))throw Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[n]),!n)return null;let o=la().createElement(w2,r);return pW().createPortal(o,n)}let w6=la().createContext(null),w5=la().forwardRef(function(e,t){let{children:n,...r}=e,a=d7(t),o={...r,ref:a};return la().createElement(w6.Provider,{value:o},n)}),w9={},w8=0,w7=!1,xe=null,xt=null;function xn(e={}){let{delay:t=1500,closeDelay:n=500}=e,{isOpen:r,open:a,close:o}=bu(e),i=(0,lr.useMemo)(()=>`${++w8}`,[]),s=(0,lr.useRef)(null),l=(0,lr.useRef)(o),u=()=>{w9[i]=m},c=()=>{for(let e in w9)e!==i&&(w9[e](!0),delete w9[e])},d=()=>{s.current&&clearTimeout(s.current),s.current=null,c(),u(),w7=!0,a(),xe&&(clearTimeout(xe),xe=null),xt&&(clearTimeout(xt),xt=null)},m=e=>{e||n<=0?(s.current&&clearTimeout(s.current),s.current=null,l.current()):s.current||(s.current=setTimeout(()=>{s.current=null,l.current()},n)),xe&&(clearTimeout(xe),xe=null),w7&&(xt&&clearTimeout(xt),xt=setTimeout(()=>{delete w9[i],xt=null,w7=!1},Math.max(500,n)))};return(0,lr.useEffect)(()=>{l.current=o},[o]),(0,lr.useEffect)(()=>()=>{s.current&&clearTimeout(s.current),w9[i]&&delete w9[i]},[i]),{isOpen:r,open:e=>{e||!(t>0)||s.current?d():(c(),u(),r||w7?r||d():(xe&&clearTimeout(xe),xe=setTimeout(()=>{xe=null,w7=!0,d()},t)))},close:m}}let xr=(0,lr.createContext)(null),xa=(0,lr.createContext)(null);function xo(e){let t=xn(e),n=(0,lr.useRef)(null),{triggerProps:r,tooltipProps:a}=function(e,t,n){let{isDisabled:r,trigger:a,shouldCloseOnPress:o=!0}=e,i=mh(),s=(0,lr.useRef)(!1),l=(0,lr.useRef)(!1),u=()=>{(s.current||l.current)&&t.open(l.current)},c=e=>{s.current||l.current||t.close(e)};(0,lr.useEffect)(()=>{let e=e=>{n&&n.current&&"Escape"===e.key&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[n,t]);let d=()=>{o&&(l.current=!1,s.current=!1,c(!0))},{hoverProps:m}=p9({isDisabled:r,onHoverStart:()=>{"focus"!==a&&("pointer"===po?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=pR({isDisabled:r,onFocus:()=>{pb()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},n);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mv(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,n);return la().createElement(mw,{values:[[xr,t],[xa,{...a,triggerRef:n}]]},la().createElement(w5,{...r,ref:n},e.children))}let xi=(0,lr.forwardRef)(function({UNSTABLE_portalContainer:e,...t},n){[t,n]=mE(t,n,xa);let r=(0,lr.useContext)(xr),a=xn(t),o=null==t.isOpen&&null==t.defaultOpen&&r?r:a,i=v3(n,o.isOpen)||t.isExiting||!1;return o.isOpen||i?la().createElement(w3,{portalContainer:e},la().createElement(xs,{...t,tooltipRef:n,isExiting:i})):null});function xs(e){let t=(0,lr.useContext)(xr),n=(0,lr.useRef)(null),[r,a]=(0,lr.useState)(0);mr(()=>{n.current&&t.isOpen&&a(n.current.getBoundingClientRect().width)},[t.isOpen,n]);let{overlayProps:o,arrowProps:i,placement:s}=vH({placement:e.placement||"top",targetRef:e.triggerRef,overlayRef:e.tooltipRef,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowSize:r,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,onClose:()=>t.close(!0)}),l=v2(e.tooltipRef,!!s)||e.isEntering||!1,u=mx({...e,defaultClassName:"react-aria-Tooltip",values:{placement:s,isEntering:l,isExiting:e.isExiting,state:t}}),{tooltipProps:c}=function(e,t){let n=mI(e,{labelable:!0}),{hoverProps:r}=p9({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mv(n,r,{role:"tooltip"})}}(e=mv(e,o),t);return la().createElement("div",{...c,ref:e.tooltipRef,...u,style:{...o.style,...u.style},"data-placement":null!=s?s:void 0,"data-entering":l||void 0,"data-exiting":e.isExiting||void 0},la().createElement(vb.Provider,{value:{...i,placement:s,ref:n}},u.children))}let xl=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=ur({externalModuleName:"@openmrs/esm-styleguide"});return(0,co.jsx)("div",{className:"-esm-form-engine__diagnosis-tags-module__container___1iigI",children:e.map(e=>{let r=t&&"PROVISIONAL"===e.certainty,a=1===e.rank?n?.primaryColor??"blue":n?.secondaryColor??"gray";return(0,co.jsx)(xu,{color:a,isProvisional:r,name:e.display},e.uuid)})})};function xu({color:e,isProvisional:t,name:n}){let[r,a]=(0,lr.useState)(!1),[o,i]=(0,lr.useState)(!1),[s,l]=(0,lr.useState)(!1),u=s||o,c=(0,lr.useRef)(null);(0,lr.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||a(!1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n,t,u]);let d=cs()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-form-engine__diagnosis-tags-module__diagnosisTag___mQ28X"),m=(0,co.jsxs)(co.Fragment,{children:[t&&(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("span",{"aria-hidden":"true",className:"-esm-form-engine__diagnosis-tags-module__provisionalMark___S+J53",children:"?"}),(0,co.jsxs)("span",{className:"cds--visually-hidden",children:[aL("provisional","Provisional")," "]})]}),(0,co.jsx)("span",{ref:c,className:"cds--tag__label",children:n})]});return u?(0,co.jsxs)(xo,{delay:0,closeDelay:150,isOpen:r,onOpenChange:a,children:[(0,co.jsx)(fn,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,co.jsx)(xi,{className:"-esm-form-engine__diagnosis-tags-module__tagTooltip___50O3+",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,co.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let xc={action:"-esm-form-engine__empty-card-module__action___oG778",content:"-esm-form-engine__empty-card-module__content___YUXvR",desktopHeading:"-esm-form-engine__empty-card-module__desktopHeading___EljiH",tabletHeading:"-esm-form-engine__empty-card-module__tabletHeading___8mc7w",tile:"-esm-form-engine__empty-card-module__tile___3-rRO"},xd=({width:e="64",height:t="64"})=>(0,co.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,co.jsx)("use",{href:"#omrs-empty-data-illustration"})}),xm=e=>{let t="tablet"===uR(),n=e.launchForm;return(0,co.jsx)(cm.Layer,{className:xc.layer,children:(0,co.jsxs)(cm.Tile,{className:xc.tile,children:[(0,co.jsx)("div",{className:t?xc.tabletHeading:xc.desktopHeading,children:(0,co.jsx)("h4",{children:e.headerTitle})}),(0,co.jsx)(xd,{}),(0,co.jsx)("p",{className:xc.content,children:aL("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,co.jsx)("p",{className:xc.action,children:n&&(0,co.jsx)(cm.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:aL("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},xp=({error:e,headerTitle:t})=>{let n="tablet"===uR();return(0,co.jsx)(cm.Layer,{children:(0,co.jsxs)(cm.Tile,{className:"-esm-form-engine__error-state-module__tile___mzWLn",children:[(0,co.jsx)("div",{className:n?"-esm-form-engine__error-state-module__tabletHeading___l7Cpn":"-esm-form-engine__error-state-module__desktopHeading___p57fl",children:(0,co.jsx)("h4",{children:t})}),(0,co.jsxs)("p",{className:"-esm-form-engine__error-state-module__errorMessage___0fU6v",children:[aL("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,co.jsx)("p",{className:"-esm-form-engine__error-state-module__errorCopy___xkVog",children:aL("errorCopy")})]})})},xf=xp,xh=la().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:a,state:o}=u$(),i=window.location??{pathname:""},s=lv(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,co.jsxs)(cm.SideNav,{"aria-label":aL("leftNavigation","Left navigation"),className:"-esm-form-engine__left-nav-module__leftNav___czP9T",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,co.jsx)(lx,{name:"global-nav-menu-slot"}),n?(0,co.jsx)(l4,{value:a,fallback:(0,co.jsx)(lx,{name:n,state:{basePath:r,currentPath:i,...o}}),children:(0,co.jsx)(lo.Provider,{value:a,children:(0,co.jsx)(lx,{name:n,state:{basePath:r,currentPath:i,...o}})})}):null]}):null}),xg=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:r=50,onChange:a})=>{let[o,i]=(0,lr.useState)(""),s=(0,lr.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:r,isLoading:a}=us()(t,a1,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,lr.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?r:null,isLoading:!!t&&a}),[n,a,r,t])}(t),{locations:u,isLoading:c,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,n=""){let r=uo(n),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uD()(function(n,a){if(a){let e=a.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let o=`${aX}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),n&&i.append("_getpagesoffset",""+n*t),e&&i.append("_tag",e),"string"==typeof r&&""!==r&&i.append("name:contains",r),o+i.toString()},a1);return(0,lr.useMemo)(()=>({locations:a?.length?a?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:a?.[0]?.data?.total,hasMore:!!a?.length&&a?.[a.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,a,i,s,l])}(n,r,o),h=(0,lr.useMemo)(()=>l&&!o&&t?[l,...u.filter(({resource:e})=>e.id!==t)]:u??[],[l,u,t,o]),g=(0,lr.useCallback)(e=>{a(),i(e.trim())},[a]),y=uj((0,lr.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),v=d?Math.max(0,Math.floor(h.length-r/2)):-1;return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)(cm.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:aL("searchForLocation"),id:s,placeholder:aL("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__errorNotification___NfvTe",id:`${s}-error`,children:(0,co.jsx)(cm.InlineNotification,{kind:"error",subtitle:aL("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:aL("error","Error")})}),(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__searchResults___agplm",children:c?(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__loadingContainer___EHghS",children:Array.from({length:5}).map((e,t)=>(0,co.jsx)(cm.RadioButtonSkeleton,{className:"-esm-form-engine__location-picker-module__radioButtonSkeleton___up5rH",role:"progressbar"},t))}):(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__locationResultsContainer___06YOS",children:h.length>0?(0,co.jsx)(cm.RadioButtonGroup,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,co.jsx)(cm.RadioButton,{className:"-esm-form-engine__location-picker-module__locationRadioButton___yKif7",id:e.resource.id,labelText:(0,co.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__emptyState___cPWp8",children:(0,co.jsx)("p",{className:"-esm-form-engine__location-picker-module__locationNotFound___b14++",children:aL("noResultsToDisplay")})})}),m&&(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__loadingIcon___GVlrq",children:(0,co.jsx)(cm.InlineLoading,{description:aL("loading")})})]})})]})},xy=V("modalState",{modalContainer:null,modalStack:[]}),xv=0;async function xb(e,t,n={}){let r=sJ(t),a=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=r,i=await o(),s=xv++;a=await s7({...i,name:`${t}-${s}`},{...n,domElement:e})}else P(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function xw(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function xx(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function xD(e){return e.find(e=>!xw(e))}function xE(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let x_=window.getComputedStyle(document.body).overflow;function xS({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",xk),document.body.style.overflow="hidden",t.style.visibility="unset");let n=xD(e);e.forEach(e=>{switch(e.state){case"NEW":{let n=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=n,e.state="MOUNTING",xb(n,e.modalName,e.props).then(r=>{xw(e)?xx(e.modalName,r):r?(e.parcel=r,t.prepend(n),xE(e,xD(xy.getState().modalStack)===e),r.mountPromise.then(()=>{xw(e)||(e.state="MOUNTED")},t=>{P(t),e.parcel=null,xC(e)})):xC(e)},t=>{P(t),xC(e)});break}case"MOUNTING":case"MOUNTED":xE(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),xx(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=xy.getState();xy.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=x_,removeEventListener("keydown",xk)}function xC(e){if(xw(e))return;e.state="TO_BE_DELETED";let t=xy.getState();xy.setState({...t,modalStack:[...t.modalStack]})}function xk(e){"Escape"===e.key&&function(){let[e]=xy.getState().modalStack;e&&xC(e)}()}function xP(e){xy.subscribe(xS),xy.setState({...xy.getState(),modalContainer:e})}function xT(e,t={},n=()=>{}){let r=()=>{let e=xy.getState().modalStack.find(e=>e.onClose===n);e&&xC(e)};if(sJ(e)){var a;let o,i;a={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},i=[a,...(o=xy.getState()).modalStack],xy.setState({...o,modalStack:i})}else P(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var xR=n(5992);let xO=({notification:e})=>{let{description:t,action:n,kind:r,critical:a,title:o,onAction:i}=e;return(0,co.jsx)(cm.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},xN=({subject:e})=>{let[t,n]=(0,lr.useState)([]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(xO,{notification:e},e.id))})},x$=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:r,kind:a,title:o,critical:i,progressActionLabel:s,id:l,...u}=e,[c,d]=(0,lr.useState)(t);return(0,co.jsx)(cm.ActionableNotification,{kind:a||"info",actionButtonLabel:c,ariaLabel:aL("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:aL("actionableNotification","Actionable notification"),subtitle:r,title:o,lowContrast:i,inline:!0,...u})},xM=({subject:e})=>{let[t,n]=(0,lr.useState)([]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(x$,{notification:e},e.id))})};class xA{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"listeners",new Set)}}let xI=new xA,xj=0,xL=new xA,xF=0;function xB(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(xN,{subject:xI}))}function xV(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,xR.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{xI.next({...e,id:xj++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function xU(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(xM,{subject:xL}))}function xW(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,xR.A)(t))?setTimeout(()=>{xL.next({...e,id:xF++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let xH=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],xz=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],xK={container:"-esm-form-engine__numeric-observation-module__container___gS0Wg",card:"-esm-form-engine__numeric-observation-module__card___w0fF5","abnormal-value":"-esm-form-engine__numeric-observation-module__abnormal-value___xuX3W","critical-value":"-esm-form-engine__numeric-observation-module__critical-value___Jynsn",cell:"-esm-form-engine__numeric-observation-module__cell___tMhBJ","critically-high":"-esm-form-engine__numeric-observation-module__critically-high___3L2wx","critically-low":"-esm-form-engine__numeric-observation-module__critically-low___XP+HX",high:"-esm-form-engine__numeric-observation-module__high___JV9do",low:"-esm-form-engine__numeric-observation-module__low___-uDKD","label-container":"-esm-form-engine__numeric-observation-module__label-container___vTf2y","value-container":"-esm-form-engine__numeric-observation-module__value-container___xTUIC",label:"-esm-form-engine__numeric-observation-module__label___-pfmb",value:"-esm-form-engine__numeric-observation-module__value___1A4zt",units:"-esm-form-engine__numeric-observation-module__units___SzvX+","pad-right":"-esm-form-engine__numeric-observation-module__pad-right___ND9XL","off-scale-low":"-esm-form-engine__numeric-observation-module__off-scale-low___gFAv9","off-scale-high":"-esm-form-engine__numeric-observation-module__off-scale-high___aSEmX",arrow:"-esm-form-engine__numeric-observation-module__arrow___9bvsX"},xZ=({value:e,unit:t,label:n,interpretation:r,referenceRange:a,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,lr.useId)(),{referenceRange:u,isLoading:c}=function(e,t){let n=null;e&&(n=t?`${aJ}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${aJ}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:a,isLoading:o}=us()(n,a1),i=r?.data?.results?.[0];return{referenceRange:i?{hiNormal:i.hiNormal??null,hiAbsolute:i.hiAbsolute??null,hiCritical:i.hiCritical??null,lowNormal:i.lowNormal??null,lowAbsolute:i.lowAbsolute??null,lowCritical:i.lowCritical??null}:void 0,error:a,isLoading:o}}(a||r?void 0:o,s),d=a??u,m=(0,lr.useMemo)(()=>{if(r)return r?"--"===r?"normal":xH.includes(r)?r.toLowerCase():xz.includes(r)?r:"normal":void 0;if(d&&!c){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[r,d,e,c])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,v=null!=e&&""!==e,b=v?e:aL("notAvailable","Not available"),w=cs()({[xK["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[xK["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[xK.low]:"low"===m,[xK.high]:"high"===m,[xK["off-scale-low"]]:"off_scale_low"===m,[xK["off-scale-high"]]:"off_scale_high"===m}),x=cs()({[xK.container]:!0,[xK.card]:!0,[xK["critical-value"]]:p,[xK["abnormal-value"]]:f&&!p}),D=cs()({[xK.cell]:!0,[w]:!0});return"cell"===i?(0,co.jsxs)("div",{className:D,children:[b,v&&t?` ${t}`:""]}):(0,co.jsxs)("section",{className:x,"data-testid":"numeric-observation-card",children:[n&&(0,co.jsxs)("div",{className:xK["label-container"],children:[(0,co.jsx)("span",{id:h,className:xK.label,children:n}),f&&(0,co.jsx)("span",{className:xK[m.replace("_","-")],title:aL("abnormalValue","Abnormal value")})]}),(0,co.jsxs)("div",{className:xK["value-container"],children:[(0,co.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:xK.value,children:b}),v&&t&&(0,co.jsx)("span",{id:y,className:xK.units,children:t})]})]})},xG="-esm-form-engine__page-header-module__pageHeader___6TOjO",xY=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,co.jsx)("div",{className:cs()(xG,n),...r,children:t})}{let{title:t,illustration:n,className:r,...a}=e;return(0,co.jsx)("div",{className:cs()(xG,r),...a,children:(0,co.jsx)(xq,{title:t,illustration:n})})}},xq=({title:e,illustration:t,className:n})=>{let[r,a]=(0,lr.useState)(null);return(0,lr.useEffect)(()=>{t9("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,co.jsxs)("div",{className:cs()("-esm-form-engine__page-header-module__pageHeaderContent___mCImT",n),children:[t,(0,co.jsxs)("div",{className:"-esm-form-engine__page-header-module__pageLabels___kqDS+",children:[r?.implementationName&&(0,co.jsx)("p",{children:aL(r.implementationName)}),(0,co.jsx)("h1",{className:"-esm-form-engine__page-header-module__pageName___SbZBC",children:e})]})]})},xJ=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:r,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=uB(t,e,r,o),u="tablet"===uR(),c=aL("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,co.jsx)(co.Fragment,{children:e>0&&(0,co.jsxs)("div",{className:cs()({"-esm-form-engine__pagination-module__tablet___82gj1":u,"-esm-form-engine__pagination-module__desktop___6yI8e":!u}),children:[(0,co.jsxs)("div",{children:[c,a&&(0,co.jsx)(li,{to:a,className:"-esm-form-engine__pagination-module__configurableLink___oIqma",children:i??aL("seeAll","See all")})]}),(0,co.jsx)(cm.Pagination,{className:"-esm-form-engine__pagination-module__pagination___A-Lcg",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>aL("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function xX(e){return x0(x4(e,"usual","official"))}function xQ(e){return xX(e)}function x0(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function x1(e){return x0(e)}function x4(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,r;return t=e,r=n,t.use?t.use===r:"usual"===r});if(t)return t}}function x2(e,t=uG()()){let n=uG()(t),r=wm(e,n);if(null==r)return null;let a=n.diff(r,"hours"),o=n.diff(r,"days"),i=n.diff(r,"weeks"),s=n.diff(r,"months"),l=n.diff(r,"years"),u={};if(a<2)u.minutes=n.diff(r,"minutes");else if(o<2)u.hours=a;else if(i<4)u.days=o;else if(l<1){let e=n.subtract(i,"weeks").diff(r,"days");u.weeks=i,u.days=e}else if(l<2){let e=n.subtract(s,"months").diff(r,"days");u.months=s,u.days=e}else if(l<18){let e=n.subtract(l,"year").diff(r,"months");u.years=l,u.months=e}else u.years=l;return u}function x3(e,t=uG()()){let n=x2(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),wd(n,r)}let x6={container:"-esm-form-engine__patient-banner-patient-info-module__container___iC32K",activePatientContainer:"-esm-form-engine__patient-banner-patient-info-module__activePatientContainer___OoDPd",patientBanner:"-esm-form-engine__patient-banner-patient-info-module__patientBanner___swajU",patientName:"-esm-form-engine__patient-banner-patient-info-module__patientName___+2+Xi",patientAvatar:"-esm-form-engine__patient-banner-patient-info-module__patientAvatar___Rdf75",patientAvatarButton:"-esm-form-engine__patient-banner-patient-info-module__patientAvatarButton___A1q8c",patientInfo:"-esm-form-engine__patient-banner-patient-info-module__patientInfo___L-cOQ",demographics:"-esm-form-engine__patient-banner-patient-info-module__demographics___IDhb0",row:"-esm-form-engine__patient-banner-patient-info-module__row___TP7gU",flexRow:"-esm-form-engine__patient-banner-patient-info-module__flexRow___vNMt2",tagsSlot:"-esm-form-engine__patient-banner-patient-info-module__tagsSlot___0Dvjn",identifiers:"-esm-form-engine__patient-banner-patient-info-module__identifiers___d3GTJ",identifier:"-esm-form-engine__patient-banner-patient-info-module__identifier___kc6eq",primaryIdentifier:"-esm-form-engine__patient-banner-patient-info-module__primaryIdentifier___ZxRUU",secondaryIdentifier:"-esm-form-engine__patient-banner-patient-info-module__secondaryIdentifier___eQh8x",value:"-esm-form-engine__patient-banner-patient-info-module__value___CoAOR",tag:"-esm-form-engine__patient-banner-patient-info-module__tag___InccN",gender:"-esm-form-engine__patient-banner-patient-info-module__gender___vfinx",separator:"-esm-form-engine__patient-banner-patient-info-module__separator___3OIBl",tooltipPadding:"-esm-form-engine__patient-banner-patient-info-module__tooltipPadding___hBqWG",tooltipSmallText:"-esm-form-engine__patient-banner-patient-info-module__tooltipSmallText___bPnkq",actionsButtonText:"-esm-form-engine__patient-banner-patient-info-module__actionsButtonText___VNvm7"};function x5({showIdentifierLabel:e,type:t,value:n}){return(0,co.jsx)("span",{className:x6.primaryIdentifier,children:(0,co.jsxs)(cm.Tag,{className:x6.tag,type:"gray",children:[e&&t?.text&&(0,co.jsxs)("span",{className:x6.label,children:[t.text,": "]}),(0,co.jsx)("span",{className:x6.value,children:n})]})})}function x9({showIdentifierLabel:e,type:t,value:n}){return(0,co.jsxs)(cm.FormLabel,{className:x6.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,co.jsxs)("span",{className:x6.label,children:[t?.text,": "]}),(0,co.jsx)("span",{className:x6.value,children:n})]})}function x8({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=ur(),{primaryIdentifierCode:r}=uW(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,co.jsx)(co.Fragment,{children:a?.length?a.map(({value:e,type:n},o)=>(0,co.jsxs)(la().Fragment,{children:[(0,co.jsx)("span",{className:x6.identifier,children:n?.coding?.[0]?.code===r?(0,co.jsx)(x5,{showIdentifierLabel:t,type:n,value:e}):(0,co.jsx)(x9,{showIdentifierLabel:t,type:n,value:e})}),o<a.length-1&&(0,co.jsx)("span",{className:x6.separator,children:"\xb7"})]},e)):""})}let x7={Female:c2,Male:c3,Other:c6,Unknown:c5},De=({gender:e})=>{let t=x7[e];return t?(0,co.jsx)(t,{fill:"#525252"}):null},Dt={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function Dn({patient:e,renderedFrom:t}){var n;let r,a,o=xX(e),i=e?.gender&&(a=Dt[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:aL(r,n),iconKey:a}),s=(0,lr.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,co.jsxs)("div",{className:x6.patientInfo,children:[(0,co.jsx)("div",{className:cs()(x6.row,x6.patientNameRow),children:(0,co.jsxs)("div",{className:x6.flexRow,children:[(0,co.jsx)("span",{className:x6.patientName,children:o}),i&&(0,co.jsxs)("div",{className:x6.gender,children:[(0,co.jsx)(De,{gender:i.iconKey}),(0,co.jsx)("span",{children:i.displayText})]}),(0,co.jsx)(lx,{className:x6.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,co.jsxs)("div",{className:x6.demographics,children:[e.birthDate&&(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("span",{children:x3(e.birthDate)}),(0,co.jsx)("span",{className:x6.separator,children:"\xb7"}),(0,co.jsx)("span",{children:wo(e.birthDate,{time:!1})}),(0,co.jsx)("span",{className:x6.separator,children:"\xb7"})]}),(0,co.jsx)(x8,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,co.jsx)(lx,{className:x6.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var Dr=n(8282);function Da({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[a,o]=(0,lr.useState)(!1),{extensions:i}=lb(n),s="tablet"===uR(),l=uI(()=>o(!1),a),u=(0,lr.useRef)(null),c=(0,lr.useRef)(null),d=(0,lr.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,lr.useCallback)(()=>o(e=>!e),[]),h=(0,lr.useCallback)(()=>{o(!1),u.current?.focus()},[]),g=(0,lr.useCallback)(e=>{if("Escape"===e.key&&a){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&a){e.preventDefault();let t=c.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let n=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(t).indexOf(n);if(-1===r)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let a=r+("ArrowDown"===e.key?1:-1),o=a<0?t.length-1:a>=t.length?0:a;t[o]?.focus()}},[h,a]);(0,lr.useEffect)(()=>{if(a&&c.current){let e=c.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[a]);let y=(0,lr.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...r}),[t,e,h,r]);return 0===i.length?null:(0,co.jsx)("div",{className:"-esm-form-engine__patient-banner-actions-menu-module__overflowMenuContainer___FbFcO",children:(0,co.jsxs)("div",{"data-overflow-menu":!0,className:cs()("cds--overflow-menu",ch),ref:l,children:[(0,co.jsxs)("button",{className:cs()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cv),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,co.jsx)("span",{className:"-esm-form-engine__patient-banner-actions-menu-module__actionsButtonText___hk4xW",children:aL("actions","Actions")})," ",(0,co.jsx)(Dr.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,co.jsxs)("div",{className:cs()("cds--overflow-menu-options","cds--overflow-menu--flip",cg,{[cy]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,co.jsx)("ul",{className:cs()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,co.jsx)(lx,{name:n,state:y},n)}),(0,co.jsx)("span",{})]})]})})}var Do=n(5570),Di=n.n(Do);function Ds(e){let{patientPhotoConceptUuid:t}=ur({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${aJ}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:a,isLoading:o}=lL()(e?n:null,a1),i=r?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let Dl=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,lI.useTranslation)();return(0,co.jsxs)("svg",{"aria-label":n??r("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,co.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,co.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"})]})},Du="-esm-form-engine__patient-photo-module__avatar___thboZ";function Dc({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:a}=Ds(e),[o,i]=(0,lr.useState)(null),[s,l]=(0,lr.useState)(!1),u=(0,lr.useMemo)(()=>Di().generate(e),[e]);(0,lr.useEffect)(()=>{if(r?.imageSrc){let e=new URL(r.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(i(e),l(!1))},n.onerror=()=>{t||(i(null),l(!1))},n.src=e,()=>{t=!0}}i(null),l(!1)},[r?.imageSrc]);let c=(0,lr.useMemo)(()=>n||(o?aL("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):aL("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,o,t]);return a||s?(0,co.jsx)(cm.SkeletonIcon,{className:"-esm-form-engine__patient-photo-module__skeleton___WWtyX","data-testid":"skeleton-icon"}):r?.imageSrc&&!o?(0,co.jsx)(Dl,{"aria-label":aL("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,co.jsx)("div",{"aria-label":c,children:(0,co.jsx)("img",{className:Du,src:o,alt:c,title:t})}):(0,co.jsx)("div",{"aria-label":c,children:(0,co.jsx)("div",{className:Du,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,co.jsx)("span",{className:"-esm-form-engine__patient-photo-module__initials___xLeEF",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let Dd=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],Dm=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),Dp=Dm,Df=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),Dh=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),Dg=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),Dy=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),Dv=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),Db=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),Dw=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),Dx=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),DD=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),DE=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),D_=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),DS=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),DC=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),Dk=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),DP=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),DT=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),DR=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),DO=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),DN=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),D$=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),DM=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),DA=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),DI=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),Dj=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),DL=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),DF=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),DB=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),DV=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),DU=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),DW=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),DH=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),Dz=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),DK=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),DZ=DS,DG=DA,DY=(0,lr.memo)((0,lr.forwardRef)(function({pictogram:e,fallback:t,...n},r){let a=(0,lr.useRef)(document.getElementById(e));return(0,lr.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(a.current=document.getElementById(e))});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,co.jsx)(l4,{value:a.current,fallback:t,children:(0,co.jsx)(Dq,{ref:r,pictogram:e,pictogramProps:n})})})),Dq=(0,lr.memo)((0,lr.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:r,size:a}=Object.assign({},{size:92},t);return(a<=26||a>144)&&(console.error(`Invalid size '${a}' specified for ${e}. Defaulting to 92.`),a=92),(0,co.jsx)("svg",{ref:n,className:cs()("-esm-form-engine__pictograms-module__pictogram___ooPKM",r),height:a,width:a,children:(0,co.jsx)("use",{href:`#${e}`})})})),DJ=({children:e})=>"tablet"===uR()?(0,co.jsx)(cm.Layer,{children:e}):(0,co.jsx)(co.Fragment,{children:e}),DX=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:r="success",onActionButtonClick:a=()=>{},isLowContrast:o="error"!==r,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:u="error"!==r,title:c,id:d,...m}=e,[p,f]=(0,lr.useState)(n),[h,g]=(0,lr.useState)(!0),[y,v]=(0,lr.useState)(!1),b=(0,lr.useCallback)(()=>{setTimeout(t,250)},[t]),w=(0,lr.useCallback)(()=>{v(!0),b()},[b]);return(0,lr.useEffect)(()=>{if(u){let e=setTimeout(w,l);return()=>clearTimeout(e)}},[l,u,w]),(0,lr.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,co.jsx)(cm.ActionableNotification,{actionButtonLabel:p,"aria-label":aL("closeSnackbar","Close snackbar"),className:cs()("-esm-form-engine__snackbar-module__slideIn___senVE",{"-esm-form-engine__snackbar-module__animated___8eltL":h,"-esm-form-engine__snackbar-module__slideOut___BIIXm":y}),kind:r,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:aL("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},DQ=({subject:e})=>{let[t,n]=(0,lr.useState)([]),r=(0,lr.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(DX,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},D0=new xA,D1=0;function D4(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(DQ,{subject:D0}))}function D2(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{D0.next({...e,id:D1++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let D3=({toast:e,closeToast:t})=>{let{description:n,kind:r,critical:a,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,lr.useCallback)(()=>{s(),t()},[t,s]);return(0,co.jsx)("div",{children:(0,co.jsx)(cm.ActionableNotification,{actionButtonLabel:i,kind:r||"info",lowContrast:a,subtitle:n,title:o||"",onActionButtonClick:l,onClose:t})})},D6=({subject:e})=>{let[t,n]=(0,lr.useState)([]),r=(0,lr.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(D3,{toast:e,closeToast:()=>r(e)},e.id))})},D5=new xA,D9=0;function D8(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(D6,{subject:D5}))}function D7(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,xR.A)(t))?setTimeout(()=>{D5.next({...e,id:D9++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let Ee="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Et=new Uint8Array(16),En=[];for(let e=0;e<256;++e)En.push((e+256).toString(16).slice(1));let Er=function(e,t,n){if(Ee&&!t&&!e)return Ee();let r=(e=e||{}).random??e.rng?.()??function(){if(!d){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");d=crypto.getRandomValues.bind(crypto)}return d(Et)}();if(r.length<16)throw Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((n=n||0)<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return(En[e[t+0]]+En[e[t+1]]+En[e[t+2]]+En[e[t+3]]+"-"+En[e[t+4]]+En[e[t+5]]+"-"+En[e[t+6]]+En[e[t+7]]+"-"+En[e[t+8]]+En[e[t+9]]+"-"+En[e[t+10]]+En[e[t+11]]+En[e[t+12]]+En[e[t+13]]+En[e[t+14]]+En[e[t+15]]).toLowerCase()}(r)};async function Ea(e,t){let{openedGroup:n}=sX.getState();if(n){if(n.groupName===e&&Es(n.props,t))return!0;else if(!await Ec({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return sX.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function Eo(e){let{openedGroup:t,openedWindows:n}=sX.getState();if(t){if(n.length>0&&!(e||await Ec({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;sX.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function Ei(e,t=null,n=null,r=null){let a=sX.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=sQ(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=a,{name:s}=o,l=s0(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=s1(e);if(i&&(i.groupName!==l.name||!Es(i.props,r)))return!!await Ec({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(u>=0){let r=a.openedWindows[u],o=a.openedGroup?.props??{},i=a.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:c}=r;if(Es(r.props,n)){let d=c.find(t=>t.workspaceName===e);return d&&Es(d.props,t)?((i||u!==a.openedWindows.length-1)&&sX.setState(Eg.restoreWindow(a,s)),!0):!!await Ec({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??o},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[Ex(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await Ec({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:o??a?.openedGroup?.props},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(sX.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await Ec({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function Es(e,t){return null==e||null==t||O(e,t)}function El(e,t){let n=[];for(let r=e.openedWorkspaces.length-1;r>=0;r--){let a=e.openedWorkspaces[r];if(a.hasUnsavedChanges&&n.push(a),t&&a.workspaceName===t)break}return n}function Eu(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=xT("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function Ec(e){let{openedWindows:t}=sX.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>El(e));break;case"CLOSE_WINDOW":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=El(r);break}case"CLOSE_WORKSPACE":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=El(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>El(e))}return Eu(n)}function Ed(e,t){return Eu(El(e,t))}function Em(e,t){let n=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return n<0?e:0===n?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,n)}}function Ep(e,t,n,r){let{registeredWorkspacesByName:a}=sX.getState(),o=a[n];if(!o)throw Error(`No workspace named "${n}" registered`);let i=a[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);if(o.window!==e.windowName)throw Error(`Cannot open child workspace ${n} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${n} from parent workspace ${t} as the parent is not opened within the workspace window`);let u=s.slice(0,l+1);return{...e,openedWorkspaces:[...u,Ex(n,r)]}}function Ef(e,t,n){let r=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(r<0)return e;let a=e.openedWorkspaces[r];if(Object.keys(n).every(e=>a[e]===n[e]))return e;let o=[...e.openedWorkspaces];return o[r]={...a,...n},{...e,openedWorkspaces:o}}function Eh(e,t,n){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(r<0)return e;let a=e.openedWindows[r],o=Ef(a,t,n);if(o===a)return e;let i=[...e.openedWindows];return i[r]=o,{...e,openedWindows:i}}let Eg={setWindowMaximized(e,t,n){let r=e.openedWindows.findIndex(e=>e.windowName===t),a=[...e.openedWindows],o={...a[r],maximized:n};return a[r]=o,{...e,openedWindows:a}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),r=e.openedWindows[n],a=[...e.openedWindows.filter((e,t)=>t!==n),r];return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(n<0)return e;let r=Em(e.openedWindows[n],t),a=[...e.openedWindows],o=e.isMostRecentlyOpenedWindowHidden;if(null===r){let t=n===e.openedWindows.length-1;a.splice(n,1),t&&a.length>0&&(o=!1)}else a[n]=r;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,t,n,r){let a=e.registeredWorkspacesByName[n];if(!a)throw Error(`No workspace named "${n}" registered`);let o=e.openedWindows.findIndex(e=>e.windowName===a.window);if(-1==o)throw Error(`Cannot open child workspace ${n} as window ${a.window} is not opened`);let i=[...e.openedWindows];return i[o]=Ep(e.openedWindows[o],t,n,r),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,n)=>Eh(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>Eh(e,t,{title:n})};function Ey(){return lm(sX,Eg)}let Ev=()=>(0,lr.useContext)(lP),Eb=()=>Object.keys(sX.getState().registeredWorkspacesByName);function Ew(e,t,n){let r=e.openedWorkspaces[e.openedWorkspaces.length-1];return(r?t[r.workspaceName]?.width:void 0)??n[e.windowName]?.width??"narrow"}function Ex(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:Er()}}function ED(e,t,n){let r=sX.getState().registeredWorkspacesByName[e];return r?{windowName:r.window,openedWorkspaces:[Ex(e,t)],props:n??null,maximized:!1}:null}let EE=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:r,setWorkspaceTitle:a}=Ev();return(0,lr.useEffect)(()=>{r(n??!1)},[n,r]),(0,lr.useEffect)(()=>{a(e)},[e,a]),(0,co.jsx)(co.Fragment,{children:t})};function E_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ES(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E_(Object(n),!0).forEach(function(t){Ek(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function EC(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ek(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EP(e){return(EP=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ET(e,t){return(ET=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ER(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var EO=function(e){var t=lr.Component;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&ET(i,t);var n,r,a,o=(n=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,t=EP(i);e=n?Reflect.construct(t,arguments,EP(this).constructor):t.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 ER(this)});function i(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,i),Ek(ER(t=o.call(this,e)),"handleRef",function(e){t.el=e}),Ek(ER(t),"addThingToDo",function(e,n){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return n.apply(void 0,arguments)}).catch(function(n){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),n&&n.message&&(n.message="During '".concat(e,"', parcel threw an error: ").concat(n.message)),t.props.handleError?t.props.handleError(n):setTimeout(function(){throw n}),n}))}),Ek(ER(t),"getParcelProps",function(){var e=ES(ES({},t.props),{},{domElement:t.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),t.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 t}return r=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,n=e.props.mountParcel||e.mountParcel;if(!n)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?t=e.el:(e.createdDomElement=t=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(n){t.style[n]=e.props.wrapStyle[n]}),e.props.appendTo.appendChild(t)),e.parcel=n(e.props.config,ES({domElement:t},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 lP&&lP.Consumer?lr.createElement(lP.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=lP&&lP.Consumer?lr.createElement(lP.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return lr.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],EC(i.prototype,r),a&&EC(i,a),i}();Ek(EO,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var EN=n(8742);let E$=la().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?la().createElement(EN.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},ea||(ea=la().createElement("path",{d:"M2 9L2 10 5.3 10 1 14.3 1.7 15 6 10.7 6 14 7 14 7 9zM14 7L14 6 10.7 6 15 1.7 14.3 1 10 5.3 10 2 9 2 9 7z"})),e):la().createElement(EN.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},eo||(eo=la().createElement("path",{d:"M4 18L4 20 10.586 20 2 28.582 3.414 30 12 21.414 12 28 14 28 14 18 4 18zM30 3.416L28.592 2 20 10.586 20 4 18 4 18 14 28 14 28 12 21.414 12 30 3.416z"})),e)});var EM=n(4240),EA=n(8622);let EI={workspaceOuterContainer:"-esm-form-engine__workspace2-module__workspaceOuterContainer___jaqGm",narrowWorkspace:"-esm-form-engine__workspace2-module__narrowWorkspace___o1wsL",widerWorkspace:"-esm-form-engine__workspace2-module__widerWorkspace___gdEOi",extraWideWorkspace:"-esm-form-engine__workspace2-module__extraWideWorkspace___U9xlJ",workspaceMiddleContainer:"-esm-form-engine__workspace2-module__workspaceMiddleContainer___0AdtX",maximized:"-esm-form-engine__workspace2-module__maximized___aKCbE",hidden:"-esm-form-engine__workspace2-module__hidden___n1US5",workspaceInnerContainer:"-esm-form-engine__workspace2-module__workspaceInnerContainer___1g+qk",workspaceSpacer:"-esm-form-engine__workspace2-module__workspaceSpacer___P2T9y",loader:"-esm-form-engine__workspace2-module__loader___fCfzZ",hiddenExtraWorkspace:"-esm-form-engine__workspace2-module__hiddenExtraWorkspace___hvPSi",header:"-esm-form-engine__workspace2-module__header___MXXx9",headerButtons:"-esm-form-engine__workspace2-module__headerButtons___sJdnC",workspaceContent:"-esm-form-engine__workspace2-module__workspaceContent___6NuXT",overlayHeaderSpacer:"-esm-form-engine__workspace2-module__overlayHeaderSpacer___PLO6T",isActionMenuOpened:"-esm-form-engine__workspace2-module__isActionMenuOpened___X3Vj6",showActionMenu:"-esm-form-engine__workspace2-module__showActionMenu___HSun1",marginWorkspaceContent:"-esm-form-engine__workspace2-module__marginWorkspaceContent___DCfWz",workspaceContainerWithActionMenu:"-esm-form-engine__workspace2-module__workspaceContainerWithActionMenu___G9MdI",workspaceFixedContainer:"-esm-form-engine__workspace2-module__workspaceFixedContainer___uIldI",workspaceContainerWithoutActionMenu:"-esm-form-engine__workspace2-module__workspaceContainerWithoutActionMenu___lBudZ"},Ej=e=>e.registeredWorkspacesByName,EL=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:r,actions:a,renderChrome:o,isRootWorkspace:i,isLeafWorkspace:s,showActionMenu:l})=>{let u=(0,lr.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:r=!1,discardUnsavedChanges:o=!1}=e;return r?!!(o||await a.promptForClosingWorkspaces())&&(a.closeWorkspace(n.openedWorkspaces[0].workspaceName),!0):!!(o||await a.promptForClosingWorkspaces(t.workspaceName))&&(a.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,r)=>{let o=t.workspaceName,{openedWorkspaces:i}=n,s=i.findIndex(e=>e.workspaceName===o);-1===s||s!==i.length-1&&i.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await a.promptForClosingWorkspaces(i[s+1].workspaceName)||a.openChildWorkspace(o,e,r||{})},setWorkspaceTitle:e=>a.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>a.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:r,workspaceMeta:sX.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:i,isLeafWorkspace:s,windowName:n.windowName,showActionMenu:l},[t,n,r,a,i,s,l]),c=!o&&!s,d=(0,lr.useMemo)(()=>e?(0,co.jsx)(EO,{config:e,mountParcel:lt,wrapWith:"div",wrapClassName:cs()(EI.workspaceContent,{[EI.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null,[e,t.workspaceName,u,c]);return o?(0,co.jsx)(EF,{openedWorkspace:t,openedWindow:n,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d}):d??(0,co.jsx)(cm.InlineLoading,{className:cs()(EI.loader,{[EI.hiddenExtraWorkspace]:c}),description:`${aL("loading")}`})},EF=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:r,closeWindow:a,children:o})=>{let i=uR(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=Ey(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=Ew(t,c,u),w=v?.icon,x=v?.canMaximize,D=!!s&&d[s.groupName]?.persistence==="closable",E=!!w&&!D,_=l.findIndex(e=>e.windowName===h)<l.length-1||m,S=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,co.jsxs)("div",{className:cs()(EI.workspaceOuterContainer,{[EI.narrowWorkspace]:"narrow"===b,[EI.widerWorkspace]:"wider"===b,[EI.extraWideWorkspace]:"extra-wide"===b,[EI.isActionMenuOpened]:S}),children:[(0,co.jsx)("div",{className:cs()(EI.workspaceSpacer,{[EI.hidden]:_})}),(0,co.jsx)("div",{className:cs()(EI.workspaceMiddleContainer,{[EI.maximized]:g,[EI.hidden]:_,[EI.isRootWorkspace]:n,[EI.showActionMenu]:r}),children:(0,co.jsx)("div",{className:cs()(EI.workspaceInnerContainer,{[EI.maximized]:g,[EI.hidden]:_,[EI.isRootWorkspace]:n}),children:o?(0,co.jsxs)(co.Fragment,{children:[(0,co.jsxs)(cm.Header,{"aria-label":aL("workspaceHeader"),className:EI.header,children:[(0,co.jsx)(cm.HeaderName,{prefix:"",children:y}),(0,co.jsx)("div",{className:EI.overlayHeaderSpacer}),(0,co.jsx)(cm.HeaderGlobalBar,{className:EI.headerButtons,children:uO(i)?(0,co.jsxs)(co.Fragment,{children:[(x||g)&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":g?aL("minimize"):aL("maximize"),onClick:()=>p(h,!g),children:g?(0,co.jsx)(E$,{}):(0,co.jsx)(EM.hz,{})}),E&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("hide"),onClick:()=>f(),children:(0,co.jsx)(cT,{})}),!D&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("close"),onClick:a,children:(0,co.jsx)(cZ,{})})]}):(0,co.jsxs)(co.Fragment,{children:[E&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("hide"),onClick:()=>f(),children:(0,co.jsx)(EA.d3,{})}),(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("close"),onClick:()=>{D?Eo():a()},children:(0,co.jsx)(cZ,{})})]})})]}),o]}):(0,co.jsx)(cm.InlineLoading,{className:EI.loader,description:`${aL("loading")} ...`})})})]})},EB=({openedWindow:e,groupProps:t,actions:n,renderChrome:r,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,lr.useState)({}),l=ld(sX,Ej);return(0,lr.useEffect)(()=>{let e=!1;return Promise.all(o.map(async e=>{let t=l[e.workspaceName];if(!t)return null;let{moduleName:n,component:r}=t;return[e.uuid,await u3(n,r)]})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))}),()=>{e=!0}},[o,l]),(0,co.jsx)(co.Fragment,{children:o.map((s,l)=>(0,co.jsx)(EL,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:n,renderChrome:r,lifeCycle:i[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===o.length-1,showActionMenu:a},s.uuid))})},EV=e=>e.registeredWorkspacesByName,EU=({name:e,workspaceProps:t,windowProps:n,groupProps:r,onWindowChanged:a})=>{let o=ld(sX,EV),i=ld(sX,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),s={name:e,workspaceProps:t,windowProps:n,groupProps:r},l=(0,lr.useRef)(),u=(0,lr.useRef)(null);if(!l.current){let a=ED(e,t,n);l.current=U({openedWindow:a,groupProps:r??null}),a&&(u.current=s)}let c=l.current;(0,lr.useEffect)(()=>{let a=u.current;if(a&&a.name===e&&O(a.workspaceProps,t)&&O(a.windowProps,n)&&O(a.groupProps,r))return;let o=ED(e,t,n);c.setState({openedWindow:o,groupProps:r??null},!0),u.current=o?s:null},[e,t,n,r,o,c]);let d=(0,lr.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let n=t(e.openedWindow);return n===e.openedWindow?e:{...e,openedWindow:n}})}return{closeWorkspace(e){t(t=>Em(t,e))},openChildWorkspace(e,n,r){t(t=>Ep(t,e,n,r))},setWorkspaceTitle(e,n){t(t=>Ef(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>Ef(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?Ed(n,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=ld(c),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",y=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=i?.width??"narrow",b=(0,lr.useRef)(a);return(0,lr.useEffect)(()=>{b.current=a}),(0,lr.useEffect)(()=>{b.current?.({workspaceName:h,windowWidth:v,title:g,hasUnsavedChanges:y})},[h,v,g,y]),(0,co.jsx)("div",{className:"-esm-form-engine__exported-workspace-module__exportedWorkspace___3vwoL",children:m?(0,co.jsx)(EB,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},EW="-esm-form-engine__action-menu-button2-module__container___pahg-",EH="-esm-form-engine__action-menu-button2-module__elementContainer___PzOdc",Ez="-esm-form-engine__action-menu-button2-module__active___4O4Bs",EK="-esm-form-engine__action-menu-button2-module__focused___+k5kD";function EZ({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,co.jsxs)(co.Fragment,{children:[e({size:16}),t?(0,co.jsx)("span",{className:"-esm-form-engine__action-menu-button2-module__interruptedTag___mS2yr",children:"!"}):(0,co.jsx)("span",{className:"-esm-form-engine__action-menu-button2-module__countTag___rb5CW",children:n})]})}let EG=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:a})=>{let o=uR(),{openedWindows:i,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:u}=Ey(),{extension:c}=(0,lr.useContext)(lo),d=i.findIndex(e=>e.windowName===c?.extensionId),m=i[d],p=null!=m,f=p&&(d<i.length-1||u),h=p&&!f,g=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,y=async()=>{if(p)f?s(m.windowName):l();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=r;Ei(e,t,n)}};return"tablet"===o||"phone"===o?(0,co.jsxs)(cm.Button,{className:cs()(EW,{[Ez]:p&&!h,[EK]:h}),iconDescription:t,kind:"ghost",onClick:y,role:"button",tabIndex:0,size:"md",children:[(0,co.jsx)("span",{className:EH,children:(0,co.jsx)(EZ,{hasUnsavedChanges:g,getIcon:e,tagContent:n})}),(0,co.jsx)("span",{children:t})]}):(0,co.jsx)(cm.IconButton,{align:"left","aria-label":t,className:cs()(EW,{[Ez]:p&&!h,[EK]:h}),enterDelayMs:300,kind:"ghost",label:t,onClick:y,size:"md",children:(0,co.jsx)("div",{className:EH,children:(0,co.jsx)(EZ,{hasUnsavedChanges:g,getIcon:e,tagContent:n})})})};function EY({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,co.jsx)(cm.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?cK:cW,children:e?aL("showLess","Show less"):aL("showMore","Show more")})}let Eq={contactDetails:"-esm-form-engine__patient-banner-contact-details-module__contactDetails___rhdjA",deceased:"-esm-form-engine__patient-banner-contact-details-module__deceased___K4NPg",heading:"-esm-form-engine__patient-banner-contact-details-module__heading___zj6Zt",row:"-esm-form-engine__patient-banner-contact-details-module__row___+Bx+P",col:"-esm-form-engine__patient-banner-contact-details-module__col___0H31P",relationship:"-esm-form-engine__patient-banner-contact-details-module__relationship___CZmay"},EJ=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${aJ}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=lL()(t,a1),a=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,lr.useMemo)(()=>({cohorts:a,isLoading:r}),[r,a])}(e);return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsxs)("p",{className:Eq.heading,children:[aL("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>b7(e?.startDate).getTime()-b7(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,co.jsx)("li",{children:(0,co.jsx)(li,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,co.jsx)("li",{children:"--"})})(),t.length>3&&(0,co.jsx)("li",{className:Eq.link,children:(0,co.jsx)(li,{to:`${window.spaBase}/home/patient-lists`,children:aL("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},EX=({patientId:e})=>{let{patient:t,isLoading:n}=uU(e),r=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return n?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("p",{className:Eq.heading,children:aL("address","Address")}),(0,co.jsx)("ul",{children:r?Object.entries(r).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?r.extension?.[0]?.extension?.map((t,n)=>(0,co.jsxs)("li",{children:[aL(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,co.jsxs)("li",{children:[aL(e,e),": ",t]},`address-${e}`)):(0,co.jsx)("li",{children:"--"})})]})},EQ=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=ur({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:r,isLoading:a}=(e=>{let{data:t,error:n,isLoading:r}=us()(`${aJ}/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)))`,a1);return{isLoading:r,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,lr.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:a,error:r}})(e),r=(0,lr.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?aL(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("p",{className:Eq.heading,children:aL("contactDetails","Contact Details")}),t?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsx)("ul",{children:r.length?r.map(([e,t],n)=>(0,co.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,co.jsx)("li",{children:"--"})})]})},E0=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${aJ}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:n,error:r,isLoading:a,isValidating:o}=lL()(e?t:null,a1),i=n?.data?.results?.length?function(e,t){let n=[];for(let r of t)e===r.personA.uuid?n.push({uuid:`${r.uuid}`,display:r.personB.display,relativeAge:r.personB.age,relativeUuid:r.personB.uuid,relationshipType:r.relationshipType.bIsToA}):n.push({uuid:`${r.uuid}`,display:r.personA.display,relativeAge:r.personA.age,relativeUuid:r.personA.uuid,relationshipType:r.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?i:null,error:r,isLoading:a,isValidating:o}}(e);return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("p",{className:Eq.heading,children:aL("relationships","Relationships")}),n?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsx)("ul",{children:t&&t.length>0?(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsxs)("li",{className:Eq.relationship,children:[(0,co.jsx)("div",{children:(0,co.jsx)(li,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,co.jsx)("div",{children:e.relationshipType}),(0,co.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?aL("yearAbbreviation","yr"):aL("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,co.jsx)("li",{children:"--"})})]})};function E1({patientId:e,deceased:t}){return(0,co.jsxs)("div",{className:cs()(Eq.contactDetails,{[Eq.deceased]:t}),children:[(0,co.jsxs)("div",{className:Eq.row,children:[(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(EX,{patientId:e})}),(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(EQ,{patientUuid:e})})]}),(0,co.jsxs)("div",{className:Eq.row,children:[(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(E0,{patientId:e})}),(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(EJ,{patientUuid:e})})]})]})}function E4(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),r=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>r.forEach(e=>e.remove())}return()=>{}}let E2="-esm-form-engine__action-menu2-module__container___5s3CM";function E3({workspaceGroup:e,groupProps:t}){let n=uR(),{persistence:r}=e;return(0,co.jsx)("aside",{className:"-esm-form-engine__action-menu2-module__sideRail___qwAz4",children:(0,co.jsxs)("div",{className:E2,children:["closable"==r&&uO(n)&&(0,co.jsx)(cm.IconButton,{align:"left",onClick:()=>Eo(),label:aL("close"),kind:"ghost",children:(0,co.jsx)(cZ,{})}),(0,co.jsx)(lo.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,co.jsx)(lx,{className:E2,name:e.name,state:{groupProps:t}})})]})})}function E6(e){let t=new URL(e,window.location.origin).pathname,n=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,r=n.endsWith("/")?n.slice(0,-1):n,a=null;return r?r===t?a="/":t.startsWith(`${r}/`)&&(a=t.slice(r.length)):a=t,{full:t,spaRelative:a}}function E5(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(E9,{}))}function E9(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=Ey();if((0,lr.useEffect)(()=>il("before-page-changed",t=>{let{newPage:r,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(r)return void a(Eo().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),a=E6(t),o=E6(n);if(null===a.spaRelative||null===o.spaRelative)return!0;let i=r.exec(a.spaRelative),s=r.exec(o.spaRelative);if(i&&s||(i=r.exec(a.full),s=r.exec(o.full)),!i||!s)return!0;if(i.length>1)return!i.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,o,i)&&a(Eo().then(e=>!e))}),[e,n]),!e)return null;let a=n[e.groupName],o=t.some(e=>e.maximized),{name:i}=a,s=Object.values(r).filter(e=>e.group===i&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,co.jsxs)("div",{className:cs()("-esm-form-engine__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___gN2f4",{"-esm-form-engine__workspace-windows-and-menu-module__overlay___fqI+X":a.overlay,"-esm-form-engine__workspace-windows-and-menu-module__hasMaximizedWindow___J7wBw":o}),children:[(0,co.jsx)("div",{className:"-esm-form-engine__workspace-windows-and-menu-module__workspaceWindowsContainer___zpk7G",children:t.map(t=>(0,co.jsx)(E8,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,co.jsx)(E3,{workspaceGroup:a,groupProps:e.props})]})}function E8({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:r}=e,a=(0,lr.useMemo)(()=>({closeWorkspace(e){sX.setState(t=>Eg.closeWorkspace(t,e))},openChildWorkspace(e,t,n){sX.setState(r=>Eg.openChildWorkspace(r,e,t,n))},setWorkspaceTitle(e,t){sX.setState(n=>Eg.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){sX.setState(n=>Eg.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=sX.getState().openedWindows.find(e=>e.windowName===r);return t?Ed(t,e):Promise.resolve(!0)}}),[r]);return(0,co.jsx)(EB,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:n})}function E7(e,t,n){if(null==e)return n;let r=b_(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let a=[];for(let e of t){let t=b_(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}a.push({canonical:t,original:e})}let o=r;for(;o;){let e=a.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",n=a.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===o){o="fr-HT";continue}let r=o.lastIndexOf("-");if(-1===r)break;let i=(o=o.slice(0,r)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return n}function _e(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function _t(e){return!!e&&e.constructor===Object}var _n=n(7229);function _r(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function _a(e,t){return _n(function(e){let t=e.indexOf("-");if(t>=0){let n=_r(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return _r(e)}(t),e,{includePrerelease:!0})}async function _o(e,t={}){let n,{shouldRetry:r,getDelay:a,onError:o}=t;r=r??(e=>e<=5),a=a??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await _i(a(i)),await e()}catch(e){o?.(e,i),n=e}while(r(i++));throw n}async function _i(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function _s(e,t,n,r){}function _l(e){}function _u(e){return Promise.resolve([])}function _c(e){return Promise.resolve([])}function _d(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function _m(e){return()=>{}}function _p(){return!0}}}]);
39
+ }`.trim(),document.head.prepend(r),o=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let t=((e=document)=>e.activeElement)(),n=null!=t&&vG(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||vQ(this,n)},i=mn(vX(document,"touchstart",t=>{let r=mU(t);e=hJ(r)?r:hX(r,!0),n=!1;let a=r.ownerDocument.defaultView.getSelection();a&&!a.isCollapsed&&a.containsNode(r,!0)&&(n=!0),t.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(n=!0),"selectionStart"in r&&"selectionEnd"in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},{passive:!1,capture:!0}),vX(document,"touchmove",t=>{if(2!==t.touches.length&&!n){if(!e||e===document.documentElement||e===document.body)return void t.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&t.preventDefault()}},{passive:!1,capture:!0}),vX(document,"blur",e=>{let t=mU(e),n=e.relatedTarget;if(n&&vG(n))n.focus({preventScroll:!0}),vQ(n,vG(t));else if(!n){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),r.remove(),HTMLElement.prototype.focus=o}):mn((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?vJ(document.documentElement,"scrollbarGutter","stable"):vJ(document.documentElement,"paddingRight",`${s}px`)),vJ(document.documentElement,"overflow","hidden"))),()=>{0==--vq&&c()}}},[t])}({isDisabled:o||!t.isOpen}),(0,lr.useEffect)(()=>{if(t.isOpen&&r.current)if(o){var e,n,i=a?.current??r.current;let t=vD[vD.length-1];return t&&!t.visibleNodes.has(i)?(t.visibleNodes.add(i),()=>{t.visibleNodes.delete(i)}):void 0}else{let t,o,i,s,l,u,c,d,m,p,f;return e=[a?.current??r.current],o=(n={shouldUseInert:!0})instanceof(t=mB(e?.[0])).Element?{root:n}:n,i=o?.root??document.body,s=o?.shouldUseInert&&vw,l=new Set(e),u=new Set,c=(e,n)=>{s&&e instanceof t.HTMLElement?e.inert=n:n?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},d=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(u.has(e)||l.has(e)||e.parentElement&&u.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(mV(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=yr(mF(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&m(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;null!=e;)m(e),e=n.nextNode()}},m=e=>{let n=vx.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===n||(0===n&&c(e,!0),u.add(e),vx.set(e,n+1))},vD.length&&vD[vD.length-1].disconnect(),d(i),(p=new MutationObserver(e=>{for(let n of e)if("childList"===n.type&&n.target.isConnected&&![...l,...u].some(e=>mV(e,n.target)))for(let e of n.addedNodes){var t;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(t=e).dataset.liveAnnouncer||void 0!==t.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&d(e)}})).observe(i,{childList:!0,subtree:!0}),f={visibleNodes:l,hiddenNodes:u,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}},vD.push(f),()=>{for(let e of(p.disconnect(),u)){let t=vx.get(e);null!=t&&(1===t?(c(e,!1),vx.delete(e)):vx.set(e,t-1))}f===vD[vD.length-1]?(vD.pop(),vD.length&&vD[vD.length-1].observe()):vD.splice(vD.indexOf(f),1)}}},[o,t.isOpen,r,a]),{popoverProps:mv(d,p),arrowProps:f,underlayProps:m,placement:h,triggerAnchorPoint:g}}({...r,offset:null!=(a=r.offset)?a:8,arrowSize:s,groupRef:m?d:u},e),y=r.popoverRef,v=v2(y,!!g)||r.isEntering||!1,b=mx({...r,defaultClassName:"react-aria-Popover",values:{trigger:r.trigger||null,placement:g,isEntering:v,isExiting:t}}),w=!r.isNonModal||"SubmenuTrigger"===r.trigger,[x,D]=(0,lr.useState)(!1);mr(()=>{y.current&&D(w&&!y.current.querySelector("[role=dialog]"))},[y,w]),(0,lr.useEffect)(()=>{var e;let t,n;x&&y.current&&!y.current.contains(document.activeElement)&&(n=((e=document)=>e.activeElement)(t=mF(e=y.current)),"virtual"===v5?p_(()=>{((e=document)=>e.activeElement)(t)===n&&e.isConnected&&mj(e)}):mj(e))},[x,y]);let E={...p.style,...b.style},_=la().createElement("div",{...mv(mI(r),p),...b,role:x?"dialog":void 0,tabIndex:x?-1:void 0,"aria-label":r["aria-label"],"aria-labelledby":r["aria-labelledby"],ref:y,slot:r.slot||void 0,style:E,dir:r.dir,"data-trigger":r.trigger,"data-placement":g,"data-entering":v||void 0,"data-exiting":t||void 0},!r.isNonModal&&la().createElement(v4,{onDismiss:e.close}),la().createElement(vb.Provider,{value:{...h,placement:g,ref:i}},b.children),la().createElement(v4,{onDismiss:e.close}));return m?la().createElement(vu,{...r,shouldContainFocus:x,isExiting:t,portalContainer:null!=(o=null!=n?n:null==d?void 0:d.current)?o:void 0},_):la().createElement(vu,{...r,shouldContainFocus:x,isExiting:t,portalContainer:n},!r.isNonModal&&e.isOpen&&la().createElement("div",{"data-testid":"underlay",...f,style:{position:"fixed",inset:0}}),la().createElement("div",{ref:u,style:{display:"contents"}},la().createElement(bd.Provider,{value:u},_)))}function bf(e){return e?.start!=null&&null!=e.end}let bh=(0,lr.createContext)(null),bg=(0,lr.createContext)(null),by=(0,lr.createContext)(null),bv=(0,lr.createContext)(null),bb=(0,lr.forwardRef)(function(e,t){var n,r;[e,t]=mE(e,t,bh);let{validationBehavior:a}=mD(vg)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bu(e),[n,r]=gz(e.value,e.defaultValue||null,e.onChange),[a]=(0,lr.useState)(n),o=n||e.placeholderValue||null,[i,s]=yQ(o,e.granularity),l=null!=n?n.toDate(s??"UTC"):null,u="hour"===i||"minute"===i||"second"===i,c=e.shouldCloseOnSelect??!0,[d,m]=(0,lr.useState)(null),[p,f]=(0,lr.useState)(null);if(n&&(d=n,"hour"in n&&(p=n)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let h=n?.calendar.identifier==="gregory"&&"BC"===n.era,g=(0,lr.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:h}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,h]),{minValue:y,maxValue:v,isDateUnavailable:b}=e,w=(0,lr.useMemo)(()=>yZ(n,y,v,b,g),[n,y,v,b,g]),x=yB({...e,value:n,builtinValidation:w}),D=x.displayValidation.isInvalid,E=e.validationState||(D?"invalid":null),_=(e,t)=>{r("timeZone"in t?t.set(hy(e)):hv(e,t)),m(null),f(null),x.commitValidation()};return{...x,value:n,defaultValue:e.defaultValue??a,setValue:r,dateValue:d,timeValue:p,setDateValue:n=>{let a="function"==typeof c?c():c;u?p||a?_(n,p||yJ(e.defaultValue||e.placeholderValue)):m(n):(r(n),x.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?_(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(r){!r&&!n&&d&&u&&_(d,p||yJ(e.defaultValue||e.placeholderValue)),t.setOpen(r)},validationState:E,isInvalid:D,formatValue:(e,t)=>l?new fC(e,yq(t,g)).format(l):"",getDateFormatter:(e,t)=>new fC(e,yq({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,lr.useRef)(null),[l,u]=m_(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,fieldProps:m,buttonProps:p,dialogProps:f,calendarProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,n){var r;let a=mh(),o=mh(),i=mh(),s=fV((r=y_)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=yk({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=yS(t,n),g=m["aria-labelledby"]||m.id,{locale:y}=fb(),v=t.formatValue(y,{month:"long"}),b=h3(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,x=mI(e),D=(0,lr.useMemo)(()=>yb(n),[n]),E=(0,lr.useRef)(!1),{focusWithinProps:_}=p1({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mV(document.getElementById(o),t.relatedTarget)||(E.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{E.current||(E.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mv(x,h,m,b,_,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":w,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...d,onClick:()=>{D.focusFirst()}},fieldProps:{...m,id:i,[yO]:"presentation","aria-describedby":w,value:t.value,defaultValue:t.defaultValue,onChange:t.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,[yF]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:p,errorMessageProps:f,buttonProps:{...b,id:a,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${a} ${g}`,"aria-describedby":w,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${a} ${g}`},calendarProps:{autoFocus:!0,value:t.dateValue,onChange:t.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:t.dateValue?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:u,validationDetails:c}}({...mS(e),label:u,validationBehavior:o},i,s),[b,w]=(0,lr.useState)(null),x=(0,lr.useCallback)(()=>{s.current&&w(s.current.offsetWidth+"px")},[]);vU({ref:s,onResize:x});let{focusProps:D,isFocused:E,isFocusVisible:_}=p4({within:!0}),S=mx({...e,values:{state:i,isFocusWithin:E,isFocusVisible:_,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DatePicker"}),C=mI(e);return delete C.id,la().createElement(mw,{values:[[by,i],[g7,{...c,ref:s,isInvalid:i.isInvalid}],[y7,m],[ft,{...p,isPressed:i.isOpen}],[vy,{...d,ref:l,elementType:"span"}],[gJ,h],[vd,i],[bc,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":b}}],[vc,f],[fa,{slots:{description:g,errorMessage:y}}],[vp,v]]},la().createElement("div",{...D,...C,...S,ref:t,slot:e.slot||void 0,"data-focus-within":E||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":_||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))}),bw=(0,lr.forwardRef)(function(e,t){var n,r;[e,t]=mE(e,t,bg);let{validationBehavior:a}=mD(vg)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bu(e),[n,r]=gz(e.value,e.defaultValue||null,e.onChange),[a]=(0,lr.useState)(n),[o,i]=(0,lr.useState)(()=>n||{start:null,end:null});null==n&&o.start&&o.end&&i(o={start:null,end:null});let s=n||o,l=e=>{i(s=e||{start:null,end:null}),bf(s)?r(s):r(null)},[u,c]=yQ(s?.start||s?.end||e.placeholderValue||null,e.granularity),d="hour"===u||"minute"===u||"second"===u,m=e.shouldCloseOnSelect??!0,[p,f]=(0,lr.useState)(null),[h,g]=(0,lr.useState)(null);s&&bf(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(hy(e.start)):hv(e.start,t.start),end:"timeZone"in t.end?t.end.set(hy(e.end)):hv(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=n=>{let r="function"==typeof m?m():m;d?bf(n)&&(r||h?.start&&h?.end)?y(n,{start:h?.start||yJ(e.placeholderValue),end:h?.end||yJ(e.placeholderValue)}):f(n):bf(n)?(l(n),C.commitValidation()):f(n),r&&t.setOpen(!1)},b=e=>{bf(p)&&bf(e)?y(p,e):g(e)},w=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,x=(0,lr.useMemo)(()=>({granularity:u,timeZone:c,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:w}),[u,e.hourCycle,e.shouldForceLeadingZeros,c,e.hideTimeZone,w]),{minValue:D,maxValue:E,isDateUnavailable:_}=e,S=(0,lr.useMemo)(()=>{var e;let t;return e=s,t=yH(yZ(e?.start??null,D,E,_,x),yZ(e?.end??null,D,E,_,x)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(t=yH(t,{isInvalid:!0,validationErrors:[(fA.getGlobalDictionaryForPackage("@react-stately/datepicker")||yz).getStringForLocale("rangeReversed",yK())],validationDetails:{...yA,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),t},[s,D,E,_,x]),C=yB({...e,value:n,name:(0,lr.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:S}),k=C.displayValidation.isInvalid,P=e.validationState||(k?"invalid":null);return{...C,value:s,defaultValue:e.defaultValue??a,setValue:l,dateRange:p,timeRange:h,granularity:u,hasTime:d,setDate(e,t){"start"===e?v({start:t,end:p?.end??null}):v({start:p?.start??null,end:t})},setTime(e,t){"start"===e?b({start:t,end:h?.end??null}):b({start:h?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:v,setTimeRange:b,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&bf(p)&&d&&y(p,{start:h?.start||yJ(e.placeholderValue),end:h?.end||yJ(e.placeholderValue)}),t.setOpen(n)},validationState:P,isInvalid:k,formatValue(t,n){let r;if(!s||!s.start||!s.end)return null;let a="timeZone"in s.start?s.start.timeZone:void 0,o=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),i="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),u=yq(n,{granularity:o,timeZone:a,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}),c=s.start.toDate(a||"UTC"),d=s.end.toDate(i||"UTC"),m=new fC(t,u);if(a===i&&o===l&&0!==s.start.compare(s.end)){try{let e=m.formatRangeToParts(c,d),t=-1;for(let n=0;n<e.length;n++){let r=e[n];if("shared"===r.source&&"literal"===r.type)t=n;else if("endRange"===r.source)break}let n="",r="";for(let a=0;a<e.length;a++)a<t?n+=e[a].value:a>t&&(r+=e[a].value);return{start:n,end:r}}catch{}r=m}else r=new fC(t,yq(n,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:r.format(d)}},getDateFormatter:(e,t)=>new fC(e,yq({},{...x,...t}))}}({...e,validationBehavior:o}),s=(0,lr.useRef)(null),[l,u]=m_(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,startFieldProps:m,endFieldProps:p,buttonProps:f,dialogProps:h,calendarProps:g,descriptionProps:y,errorMessageProps:v,...b}=function(e,t,n){var r;let a=fV((r=y_)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=yk({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fb(),f=t.formatValue(p,{month:"long"}),h=h3(f?a.format("selectedRangeDescription",{startDate:f.start,endDate:f.end}):""),g={"aria-label":a.format("startDate"),"aria-labelledby":m},y={"aria-label":a.format("endDate"),"aria-labelledby":m},v=mh(),b=mh(),w=yS(t,n),x=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,D=(0,lr.useMemo)(()=>yb(n,{accept:e=>e.id!==v}),[n,v]),E={[yN]:D,[yO]:"presentation","aria-describedby":x,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},_=mI(e),S=(0,lr.useRef)(!1),{focusWithinProps:C}=p1({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mV(document.getElementById(b),t.relatedTarget)||(S.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{S.current||(S.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,lr.useRef)(yj),P=(0,lr.useRef)(yj);return{groupProps:mv(_,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":x,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...l,onClick:()=>{D.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":x,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...E,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[yF]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(yH(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...E,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[yF]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(yH(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:c,errorMessageProps:d,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:o,validationErrors:i,validationDetails:s}}({...mS(e),label:u,validationBehavior:o},i,s),[w,x]=(0,lr.useState)(null),D=(0,lr.useCallback)(()=>{s.current&&x(s.current.offsetWidth+"px")},[]);vU({ref:s,onResize:D});let{focusProps:E,isFocused:_,isFocusVisible:S}=p4({within:!0}),C=mx({...e,values:{state:i,isFocusWithin:_,isFocusVisible:S,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DateRangePicker"}),k=mI(e);return delete k.id,la().createElement(mw,{values:[[bv,i],[g7,{...c,ref:s,isInvalid:i.isInvalid}],[ft,{...f,isPressed:i.isOpen}],[vy,{...d,ref:l,elementType:"span"}],[gX,g],[vd,i],[bc,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":w}}],[vc,h],[y7,{slots:{start:m,end:p}}],[fa,{slots:{description:y,errorMessage:v}}],[vp,b]]},la().createElement("div",{...E,...k,...C,ref:t,slot:e.slot||void 0,"data-focus-within":_||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":S||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))});function bx(e){return la().createElement(fv,e)}function bD(e,t,n=!1){if(null==e)return n?e:void 0;if("string"==typeof e&&!e)return n?null:void 0;if(e instanceof ho||e instanceof hs||e instanceof hl)return t?hb(e,t):e;{let n=uG()(e).toDate(),r=new ho(n.getFullYear(),n.getMonth()+1,n.getDate());return t?hb(r,t):r}}function bE(e){if(e)return e.toDate(hO())}function b_(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function bS(e){let t=e??"",n=b_(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function bC(){let e=window.i18next.language,t=b_(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;er=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;er=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var bk=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(er||"en-US"),bP=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},bT={};for(let e=1;e<100;e++)bT[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var bR={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},bO="[1234567890一二三四五六七八九〇\\d]",bN={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},b$={},bM={"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},bA={zone:bM,year:bT,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:{}},bI={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(bM).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,}"},bj={...bI,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}"},bL={},bF=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=bk){return bL[t.toLowerCase()]||(bL[t.toLowerCase()]=new e(t)),bL[t.toLowerCase()]}constructor(e=bk){this.locale=e,this.lookups={...bA},this.vars={...bI};let t=new Intl.NumberFormat(this.locale);this.numberingSystem=t.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 t=parseInt(e,10);if(!isNaN(t))return t}let t="";for(let n=0;n<e.length;n++)t+=String(this.lookups.digit[e[n]]);return parseInt(t,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let t=e.slice(0,3);return 1===t.length?100*this.toInt(t):2===t.length?10*this.toInt(t):this.toInt(t)}monthNameToInt(e){if("string"!=typeof e)return;let t=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[t]||12}h12ToInt(e,t){if("string"!=typeof e)return;let n=this.lookups.meridiem[t?.toLowerCase()]||0,r=this.toInt(e);return r<12&&12===n&&(r+=12),12===r&&0===n&&(r=0),r}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 t=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(t){let[,e,n,r]=t;return("-"===e||"−"===e?-1:1)*(60*this.toInt(n)+this.toInt(r||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=bN:this.buildNumbers(),/^en/i.test(this.locale)||(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:t}=function(e){if(b$[e])return b$[e];if("fullwide"===e||"hanidec"===e)return{group:bO,lookup:{...bN}};let t=bR[e];if(!t)return{group:"\\d",lookup:{...bN}};let n=String.fromCharCode(t),r=String.fromCharCode(t+9),a={};for(let e=0;e<10;e++)a[String.fromCharCode(t+e)]=e;return b$[e]={group:`[${n}-${r}]`,lookup:a},b$[e]}(this.numberingSystem);for(let n in this.lookups.digit=t,bj)bj.hasOwnProperty(n)&&(this.vars[n]=bj[n].replace(/\*/g,e))}buildMonthNames(){let e={},t={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((n,r)=>{["","k","kuu","kuuta"].forEach((a,o)=>{e[n+a+(o<2?"\\.?":"")]=!0,t[n+a]=r+1})});else{let n=[],r=e=>"month"===e.type;for(let e=0;e<12;e++)n.push(new Date(2017,e,1));for(let a of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:a});for(let i=0;i<12;i++){let s=o.formatToParts(n[i]).find(r).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===a?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,t[s]=i+1)}}let a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=a.formatToParts(n[o]).find(r).value.toLocaleLowerCase(this.locale);i=i.replace(/\.$/,""),e[`${i}\\.?`]=!0,t[i]=o+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=t}buildDaynames(){let e=[],t=e=>"weekday"===e.type;for(let t=0;t<7;t++)e.push(new Date(2017,0,t+1));let n=[],r={};for(let a of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t).value.toLocaleLowerCase(this.locale);"short"===a?(s=s.replace(/\.$/,""),n.push(`${s}\\.?`)):n.push(s),r[s]=i}}this.vars.DAYNAME=n.join("|"),this.lookups.dayname=r}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,n=[],r={},a=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=a.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);n.push(s),r[s]=12*o}this.vars.MERIDIEM=n.join("|"),this.lookups.meridiem=r}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,t)=>{if(!this.vars[t])throw Error(`Template string contains invalid variable _${t}_`);return this.vars[t]}),"i")}},bB=["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"],bV={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},bU=()=>new Date;function bW(e){return function(t){let n={};for(let r=0,a=e.length;r<a;r++){let a=e[r];a&&(n[a]=t[r])}return n}}var bH=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:n,formatter:r}){this.doneChecker=e,this.fallback=t,this.patterns=n,this.formatter=r}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),n={},r=!1;for(let e of this.patterns){let a=t.match(e.regex);if(!a)continue;r=!0;let o=e.handler(a);if(o){for(let[e,t]of Object.entries(o))e in n||void 0===t||(n[e]=t);if(t=(t=t.slice(0,a.index)+t.slice(a.index+a[0].length+1)).trim(),this.doneChecker(n,t))break}}return r?this.formatter(n):this.fallback(e)}},bz=["year","month","day","hour","minute","second","millisecond","offset"],bK={};function bZ(e,t){return""===t||/^\s+$/.test(t)||"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 bG=[[/([^\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"]],bY={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," "],...bG],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:bG,id:bG,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function bq(e,t=bk){let n=function(e){if(!bK[e]){var t,n;let r,a,o=bF.factory(e);bK[e]=new bH({doneChecker:bZ,fallback:(t=e,function(e){let n=String(e).slice(0,50);return""===n&&(n="(empty string)"),{invalid:`Unable to parse "${n}" with locale "${t}"`}}),patterns:(r=[{name:"timestampWithOffset",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:bW(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:bW(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:bW(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${bO}{2,4})\\s*\u5E74\\s*(${bO}{1,2})\\s*\u6708\\s*(${bO}{1,2})\\s*\u65E5$`),handler:bW(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:bW(["","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:bW(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=bU(),n=e[1].toLowerCase();switch(n){case"tomorrow":t.setUTCDate(t.getUTCDate()+1);break;case"yesterday":t.setUTCDate(t.getUTCDate()-1)}let r={year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate()};return"now"===n&&(r.hour=t.getUTCHours(),r.minute=t.getUTCMinutes(),r.second=t.getUTCSeconds(),r.millisecond=t.getUTCMilliseconds()),console.log("today=>",n,r),r}},{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,t,n,r]){t=parseFloat(t),"week"===(n=n.length<=2?bV[n]:(n=n.replace(/s$/,"")).toLowerCase())&&(n="day",t*=7),("-"===e||r)&&(t*=-1);let a=bU();return"millisecond"===n?a.setUTCMilliseconds(a.getUTCMilliseconds()+t):"second"===n?a.setUTCSeconds(a.getUTCSeconds()+t):"minute"===n?a.setUTCMinutes(a.getUTCMinutes()+t):"hour"===n?a.setUTCHours(a.getUTCHours()+t):"day"===n?a.setUTCDate(a.getUTCDate()+t):"month"===n?a.setUTCMonth(a.getUTCMonth()+t):"year"===n&&a.setUTCFullYear(a.getUTCFullYear()+t),{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate(),hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let t=new Date(1e3*parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let t=new Date(parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:o.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:bW(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:bW(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:bW(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:bW(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:bW(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:bW(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:bW(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:bW(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:bW(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:bW(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:bW(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:bW(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:bW(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:bW(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:bW(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:bW(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:bW(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:bW(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:bW(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:bW(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:bW(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:bW(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:bW(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:bW(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:bW(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:bW(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:bW(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:bW(["zone"])}],a=o.baseName.slice(0,5),bB.includes(a)?r:r.filter(e=>!["mdy","md"].includes(e.name))),formatter:(n=o,function(e){let t={};for(let[r,a]of Object.entries(e))if("monthname"===r){if(a){let e=n.monthNameToInt(a);void 0!==e&&(t.month=e)}}else if("hour"===r&&e.meridiem){let r=n.h12ToInt(a,e.meridiem);void 0!==r&&(t.hour=r)}else if("zone"===r){if(a){let e=n.zoneToOffset(a);void 0!==e&&(t.offset=e)}}else if("offset"===r){let e=n.offsetToMinutes(a);void 0!==e&&(t.offset=e)}else if("millisecond"===r){let e=n.millisecondToInt(a);"number"==typeof e&&(t.millisecond=e)}else if(bz.includes(r)){let e=n.toInt(a);"number"==typeof e&&(t[r]=e)}return t.year<100&&(t.year=bT[t.year]),t.year&&"buddhist"===n.dateOptions.calendar&&(t.year-=543),t})})}return bK[e]}(t),r=function(e,t){let n=bY[t.slice(0,2).toLowerCase()];if(!n)return e;for(let[t,r]of n)e=e.replace(t,r);return e}(e,t);return n.attempt(r)}function bJ(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new bP(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 bP(t.valueOf()-60*e.offset*1e3):t}function bX(e,t=bk){let n=bq(e,t),r=n.invalid?new bP(NaN):bJ(n);return r.isValid()||(r.invalid=`Unable to parse date "${e}"`),r}function bQ(e,t=bk){return e instanceof Date?new bP(e.valueOf()):"number"==typeof e?new bP(e):bX(e,t)}Date.fromString=bP.fromString=bX,Date.fromAny=bP.fromAny=bQ,"u">typeof window&&(window.anyDateParser={fromString:bX,fromAny:bQ,fromObject:bJ,attempt:bq});var b0=n(4397),b1=n(7657);let b4=function(e){return null==e};function b2(e,t){var n=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return n.get?n.get.call(e):n.value}uG().extend(uY),uG().extend(b1),uG().extend(b0);let b3="YYYY-MM-DDTHH:mm:ss.SSSZZ";function b6(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&uG()(e,b3).isValid()}function b5(e){return uG()(e).isToday()}function b9(e){return b6(e)?uG()(e,b3).toDate():null}function b8(e,t=!1){let n=uG()(e);return t&&(n=n.utc()),n.format(b3)}function b7(e){return uG()(e).toDate()}var we=new WeakMap;let wt=new class{register(e,t){b2(this,we).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(b2(this,we).has(t))return b2(this,we).get(t)}if(e.language&&b2(this,we).has(e.language))return b2(this,we).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return b2(this,we).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,we,{writable:!0,value:new Map})}};function wn(e,t){wt.register(e,t)}function wr(e){let t=e??bC();return wt.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let wa={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function wo(e,t={}){let n=bq(e,bC());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!b4(n.day)&&b4(n.month)&&(n=Object.assign({},tf(n,"day"),{month:n.day})),n.month&&(n.month-=1),n.day&&(n=Object.assign({},tf(n,"day"),{date:n.day}));let r=uG()().set(n).toDate();return b4(n.year)&&(t.year=!1),b4(n.month)&&(t.month=!1),b4(n.date)&&(t.day=!1),wi(r,t)}function wi(e,t){let n,r=t?.locale??bC(),a=new Intl.Locale(r),{calendar:o,mode:i,time:s,day:l,month:u,year:c,noToday:d,numberingSystem:m}={...wa,...{noToday:"am"===a.language},...t},p={calendar:o??wr(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=uG()(e).isToday();if(f&&!d)n=(n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(r)+n.slice(1);else{"en"===a.language&&(r="en-GB");let t=new Intl.DateTimeFormat(r,p).formatToParts(e);("en"===a.language||"am"===a.language)&&"standard"==i&&c&&l&&(t=t.map(ws("-"))),"wide"==i&&(t=t.map(ws(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,n)=>"era"!==e.type&&("literal"!==e.type||!(t<n.length-1)||"era"!==n[t+1].type))),n=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(n+=`, ${wl(e)}`),n}let ws=e=>(t,n,r)=>"literal"!==t.type||" "!==t.value||n<r.length-1&&"era"===r[n+1].type?t:{type:"literal",value:e};function wl(e){return e.toLocaleTimeString(bC(),{hour:"2-digit",minute:"2-digit"})}function wu(e,t){return wi(e,{...t,time:!0})}function wc(e,t){let n=wr("string"==typeof t?new Intl.Locale(t):t);return n?hb(e,gI(n)):e}function wd(e,t){return new Intl.DurationFormat(bC(),t).format(e)}function wm(e,t){if(null==e)return null;if("string"==typeof e){let n=bq(e,bC());return n.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(n.day&&!n.month&&(n={...tf(n,"day"),...{month:n.day}}),n.month&&(n.month-=1),n.day&&(n={...tf(n,"day"),...{date:n.day}}),uG()(t).set(n))}return uG()(e)}let wp=["years","months","days","hours","minutes","seconds"],wf={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},wh={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function wg(e,t=uG()(),n){let r,a=uG()(t),o=wm(e,a);if(null==o)return null;if("string"==typeof n){let e=wf[n]??n;return{[e]:a.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?wf[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=wp.indexOf(n);for(let a=0;a<wp.length;a++){let o=wp[a];if(t.diff(e,o)>0)return a<=r?o:n}return n}(o,a,t??"seconds"):wf[s]??s,function(e,t,n,r){let a=wp.indexOf(n),o=wp.indexOf(r),i=wp.slice(a,o+1),s={},l=e;for(let e of i){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(o,a,e,t??e)}let u=(r=function(e){let t={...wh};if(e)for(let[n,r]of Object.entries(e))void 0!==r&&(t[wf[n]??n]=r);return t}(i),a.diff(o,"seconds")<r.seconds?"seconds":a.diff(o,"minutes")<r.minutes?"minutes":a.diff(o,"hours")<r.hours?"hours":a.diff(o,"days")<r.days?"days":a.diff(o,"months")<r.months?"months":"years");return{[u]:a.diff(o,u)}}let wy={style:"short",localeMatcher:"lookup"};function wv(e,t=uG()(),n){let r=wg(e,t,n);return null==r?null:wd(r,"object"==typeof n&&n.formatOptions?{...wy,...n.formatOptions}:wy)}let wb=(0,lr.createContext)(null);function ww(){let e=ur({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,lr.useMemo)(()=>{let t=bC();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,lr.useMemo)(()=>{let e=wr(t);return void 0!==e?gI(e):void 0},[t]),r=(0,lr.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),a=(0,lr.useMemo)(()=>n?hb(hk(hO()),n):hk(hO()),[n]);return{calendar:n,intlLocale:r,today_:a}}let wx=new ho(1793,1,1);var wD={};function wE(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function w_(e={}){let{locale:t}=fb();return(0,lr.useMemo)(()=>new(0,y3.K)(t,e),[t,e])}wD={"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 wS={};wS={"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 wC=()=>{};function wk(e){var t;let n=(0,lr.useRef)(void 0),{value:r,textValue:a,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:u,onIncrement:c,onIncrementPage:d,onDecrement:m,onDecrementPage:p,onDecrementToMin:f,onIncrementToMax:h}=e,g=fV((t=wS)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,lr.useRef)(!1),v=(0,lr.useCallback)(()=>{clearTimeout(n.current),y.current=!1},[]),b=pB(()=>{v()});(0,lr.useEffect)(()=>()=>b(),[]);let w=(0,lr.useRef)(!1),x=()=>{w.current=!0},D=()=>{w.current=!1},E=""===a?g.format("Empty"):(a||`${r}`).replace("-","−");(0,lr.useEffect)(()=>{w.current&&(fw&&fw.clear("assertive"),fx(E,"assertive"))},[E]);let _=(0,lr.useCallback)(()=>{v()},[v]),S=pB(c??wC),C=pB(m??wC),k=pB(()=>{(void 0===i||isNaN(i)||void 0===r||isNaN(r)||r<i)&&(S(),P(60))}),P=pB(e=>{b(),y.current=!0,n.current=window.setTimeout(k,e)}),T=pB(()=>{(void 0===o||isNaN(o)||void 0===r||isNaN(r)||r>o)&&(C(),R(60))}),R=pB(e=>{b(),y.current=!0,n.current=window.setTimeout(T,e)}),O=e=>{e.preventDefault()},{addGlobalListener:N,removeAllGlobalListeners:$}=pV(),M=(0,lr.useRef)(!1),[A,I]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{"touch"===A?P(600):A&&P(400)},[A]);let[j,L]=(0,lr.useState)(null);return(0,lr.useEffect)(()=>{"touch"===j?R(600):j&&R(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===r||isNaN(r)?void 0:r,"aria-valuetext":E,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":u||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(d){e.preventDefault(),d?.();break}case"ArrowUp":case"Up":c&&(e.preventDefault(),c?.());break;case"PageDown":if(p){e.preventDefault(),p?.();break}case"ArrowDown":case"Down":m&&(e.preventDefault(),m?.());break;case"Home":f&&(e.preventDefault(),f?.());break;case"End":h&&(e.preventDefault(),h?.())}},onFocus:x,onBlur:D},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),I("mouse")):(N(window,"pointercancel",_,{capture:!0}),M.current=!1,I("touch")),N(window,"contextmenu",O)},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),$(),I(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&c?.(),M.current=!1,I(null)},onFocus:x,onBlur:D},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),L("mouse")):(N(window,"pointercancel",_,{capture:!0}),M.current=!1,L("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),$(),L(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&m?.(),M.current=!1,L(null)},onFocus:x,onBlur:D}}}let wP=null;var wT=n(2103);function wR(e,t,n){let r="+"===e?t+n:t-n;if(t%1!=0||n%1!=0){let a=t.toString().split("."),o=n.toString().split("."),i=Math.pow(10,Math.max(a[1]&&a[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),n=Math.round(n*i),r=("+"===e?t+n:t-n)/i}return r}let wO=(0,lr.createContext)(null),wN=(0,lr.createContext)(null),w$=(0,lr.forwardRef)(function(e,t){var n,r;[e,t]=mE(e,t,wO);let{validationBehavior:a}=mD(vg)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",{locale:i}=fb(),s=function(e){let{minValue:t,maxValue:n,step:r,formatOptions:a,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:u,isReadOnly:c,commitBehavior:d="snap"}=e;null===o&&(o=NaN);let m=(0,lr.useCallback)(e=>void 0===r||isNaN(r)?vE(e,t,n):vS(e,t,n,r),[r,t,n]);void 0===o||isNaN(o)||"snap"!==d||(o=m(o)),isNaN(i)||"snap"!==d||(i=m(i));let[p,f]=gz(o,isNaN(i)?NaN:i,s),[h]=(0,lr.useState)(p),[g,y]=(0,lr.useState)(()=>isNaN(p)?"":new(0,y3.K)(l,a).format(p)),v=(0,lr.useMemo)(()=>new(0,wT.d)(l,a),[l,a]),b=(0,lr.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,lr.useMemo)(()=>new(0,y3.K)(l,{...a,numberingSystem:b}),[l,a,b]),x=(0,lr.useMemo)(()=>w.resolvedOptions(),[w]),D=(0,lr.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),E=yB({...e,value:p}),_=void 0===r||isNaN(r)?1:r;"percent"===x.style&&(void 0===r||isNaN(r))&&(_=.01);let[S,C]=(0,lr.useState)(p),[k,P]=(0,lr.useState)(l),[T,R]=(0,lr.useState)(a);Object.is(p,S)&&l===k&&a===T||(y(D(p)),C(p),P(l),R(a));let O=(0,lr.useMemo)(()=>v.parse(g),[v,g]),N=(e,r=0)=>{if(isNaN(O))return vS(isNaN(r)?0:r,t,n,_);{let r=vS(O,t,n,_);return"+"===e&&r>O||"-"===e&&r<O?r:vS(wR(e,O,_),t,n,_)}},$=(0,lr.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===n||isNaN(n)||vS(O,t,n,_)>O||wR("+",O,_)<=n),[u,c,t,n,_,O]),M=(0,lr.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===t||isNaN(t)||vS(O,t,n,_)<O||wR("-",O,_)>=t),[u,c,t,n,_,O]);return{...E,validate:e=>v.isValidPartialNumber(e,t,n),increment:()=>{let e=N("+",t);e===p&&y(D(e)),f(e),E.commitValidation()},incrementToMax:()=>{null!=n&&(f(vS(n,t,n,_)),E.commitValidation())},decrement:()=>{let e=N("-",n);e===p&&y(D(e)),f(e),E.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),E.commitValidation())},canIncrement:$,canDecrement:M,minValue:t,maxValue:n,numberValue:O,defaultNumberValue:isNaN(i)?h:i,setNumberValue:f,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,n=O;if(void 0!==e&&(n=v.parse(t)),!t.length){f(NaN),y(void 0===o?"":D(p));return}if(isNaN(n))return void y(D(p));let r="snap"===d?m(n):n,a=(r=v.parse(D(r)))!==p;f(r),y(D(void 0===o?r:p)),a&&E.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,lr.useRef)(null),[u,c]=m_(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:d,groupProps:m,inputProps:p,incrementButtonProps:f,decrementButtonProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,n){var r,a,o,i,s,l,u,c,d;let m,{id:p,decrementAriaLabel:f,incrementAriaLabel:h,isDisabled:g,isReadOnly:y,isRequired:v,minValue:b,maxValue:w,autoFocus:x,label:D,formatOptions:E,onBlur:_=()=>{},onFocus:S,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:T,errorMessage:R,isWheelDisabled:O,...N}=e,{increment:$,incrementToMax:M,decrement:A,decrementToMin:I,numberValue:j,inputValue:L,commit:F,commitValidation:B}=t,V=fV((r=wD)&&r.__esModule?r.default:r,"@react-aria/numberfield"),U=(0,lr.useCallback)(()=>{let e=n.current?.value??"";(0,pU.flushSync)(()=>{F()}),n.current?.value!==e&&fx(n.current?.value??"","assertive")},[F,n]),W=mh(p),{focusProps:H}=pC({onBlur(){U()}}),z=w_(E),K=(0,lr.useMemo)(()=>z.resolvedOptions(),[z]),Z=w_({...E,currencySign:void 0}),G=(0,lr.useMemo)(()=>isNaN(j)?"":Z.format(j),[Z,j]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=wk({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:$,onIncrementToMax:M,onDecrement:A,onDecrementToMin:I,value:j,textValue:G}),[X,Q]=(0,lr.useState)(!1),{focusWithinProps:ee}=p1({isDisabled:g,onFocusWithinChange:Q});!function(e,t){let{onScroll:n,isDisabled:r}=e,a=(0,lr.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),n&&n({deltaX:e.deltaX,deltaY:e.deltaY}))},[n]);hq(t,"wheel",r?void 0:a)}({onScroll:(0,lr.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?$():e.deltaY<0&&A())},[A,$]),isDisabled:O||g||y||!X},n);let et=(K.maximumFractionDigits??0)>0,en=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,er="numeric";m5()?en?er="text":et&&(er="decimal"):pt()&&(en?er="numeric":et&&(er="decimal"));let ea=mI(e),eo=(0,lr.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,pU.flushSync)(()=>{F()}),B()):e.continuePropagation())},[F,B]),{isInvalid:ei,validationErrors:es,validationDetails:el}=t.displayValidation,{labelProps:eu,inputProps:ec,descriptionProps:ed,errorMessageProps:em}=function(e,t,n){let r=pB(e=>{let r=n.current;if(!r)return;let a=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":a=r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentForward":a=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd+1):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentBackward":a=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart-1)+r.value.slice(r.selectionStart):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":a=r.value.slice(r.selectionStart);break;default:null!=e.data&&(a=r.value.slice(0,r.selectionStart)+e.data+r.value.slice(r.selectionEnd))}null!=a&&t.validate(a)||e.preventDefault()});(0,lr.useEffect)(()=>{if(!wE()||!n.current)return;let e=n.current;return e.addEventListener("beforeinput",r,!1),()=>{e.removeEventListener("beforeinput",r,!1)}},[n]);let a=wE()?null:e=>{let n=mU(e).value.slice(0,mU(e).selectionStart)+e.data+mU(e).value.slice(mU(e).selectionEnd);t.validate(n)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...u}=function(e,t){let{inputElementType:n="input",isDisabled:r=!1,isRequired:a=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,u]=gz(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=pR(e,t),d=yB({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=yk({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=mI(e,{labelable:!0}),w={type:i,pattern:e.pattern},[x]=(0,lr.useState)(l);return yP(t,e.defaultValue??x,u),yT(e,d,t),{labelProps:h,inputProps:mv(b,"input"===n?w:void 0,{disabled:r,readOnly:o,required:a&&"native"===s,"aria-required":a&&"aria"===s||void 0,"aria-invalid":m||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=>u(mU(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(la().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,...c,...g}),descriptionProps:y,errorMessageProps:v,isInvalid:m,validationErrors:p,validationDetails:f}}(e,n),c=(0,lr.useRef)(null);return{inputProps:mv(i,{onBeforeInput:a,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:r}=n.current;c.current={value:e,selectionStart:t,selectionEnd:r}},onCompositionEnd(){if(n.current&&!t.validate(n.current.value)){let{value:e,selectionStart:r,selectionEnd:a}=c.current;n.current.value=e,n.current.setSelectionRange(r,a),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...u}}({...N,...ea,name:void 0,form:void 0,label:D,autoFocus:x,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[yF]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:W,type:"text",inputMode:er,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:_,onFocus:S,onFocusChange:C,onKeyDown:(0,lr.useMemo)(()=>mn(eo,k),[eo,k]),onKeyUp:P,onPaste:t=>{e.onPaste?.(t);let n=mU(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:T,errorMessage:R},t,n);yP(n,t.defaultNumberValue,t.setNumberValue),a=t,o=e.validationBehavior,i=e.commitBehavior,s=n,l=t.minValue,u=t.maxValue,c=e.step,d=t.numberValue,mr(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!wP&&"u">typeof document&&((wP=document.createElement("input")).type="number"),!wP))return;wP.min=null==l||isNaN(l)?"":String(l),wP.max=null==u||isNaN(u)?"":String(u),wP.step=null==c||isNaN(c)?"":String(c),wP.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&wP.validity.valid,n=e.validationMessage||wP.validationMessage,r={isInvalid:!t,validationErrors:n?[n]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:wP.validity.rangeOverflow,rangeUnderflow:wP.validity.rangeUnderflow,stepMismatch:wP.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};a.updateValidation(r),"native"!==o||wP.validity.valid||e.setCustomValidity(wP.validationMessage)});let ep=mv(Y,H,ec,{role:null,"aria-roledescription":m8()?null:V.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(ep["aria-required"]=void 0);let ef=e=>{((e=document)=>e.activeElement)()!==n.current&&("mouse"===e.pointerType?n.current?.focus():e.target.focus())},eh=e["aria-label"]||("string"==typeof e.label?e.label:"");eh||(m=null!=e.label?eu.id:e["aria-labelledby"]);let eg=mh(),ey=mh(),ev=mv(q,{"aria-label":h||V.format("increase",{fieldLabel:eh}).trim(),id:m&&!h?eg:null,"aria-labelledby":m&&!h?`${eg} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:ef}),eb=mv(J,{"aria-label":f||V.format("decrease",{fieldLabel:eh}).trim(),id:m&&!f?ey:null,"aria-labelledby":m&&!f?`${ey} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:ef});return{groupProps:{...ee,role:"group","aria-disabled":g,"aria-invalid":ei?"true":void 0},labelProps:eu,inputProps:ep,incrementButtonProps:ev,decrementButtonProps:eb,errorMessageProps:em,descriptionProps:ed,isInvalid:ei,validationErrors:es,validationDetails:el}}({...mS(e),label:c,validationBehavior:o},s,l),b=mx({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:v.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),w=mI(e);return delete w.id,la().createElement(mw,{values:[[wN,s],[g7,m],[yt,{...p,ref:l}],[vy,{...d,ref:u}],[ft,{slots:{increment:f,decrement:h}}],[fa,{slots:{description:g,errorMessage:y}}],[vp,v]]},la().createElement("div",{...w,...b,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":v.isInvalid||void 0}),e.name&&la().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function wM(e,t){return Number.parseInt(wi(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let wA=(0,lr.forwardRef)(function(e,t){let{className:n}=e,r=(0,lr.useContext)(gQ),a=(0,lr.useContext)(g0),o=r??a,i=(0,lr.useContext)(wb),s=hO(),l=wi(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=wM(o.visibleRange.start.toDate(s),i),c=o.maxValue?wM(o.maxValue.toDate(s),i):void 0,d=o.minValue?wM(o.minValue.toDate(s),i):void 0,m=(0,lr.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,co.jsxs)("span",{ref:t,className:n,children:[(0,co.jsx)("span",{children:l}),(0,co.jsxs)(w$,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,co.jsx)(yn,{}),(0,co.jsxs)(ye,{children:[(0,co.jsx)(fn,{slot:"increment",children:(0,co.jsx)(cj,{size:8})}),(0,co.jsx)(fn,{slot:"decrement",children:(0,co.jsx)(cM,{size:8})})]})]})]})}),wI="-esm-form-engine__datepicker-module__inputGroup___gBam-",wj="-esm-form-engine__datepicker-module__inputSegment___wIJDZ",wL="-esm-form-engine__datepicker-module__dateInputWrapper___LiY68",wF="-esm-form-engine__datepicker-module__invalidText___A4cv4",wB="-esm-form-engine__datepicker-module__flatButton___HcpME",wV="-esm-form-engine__datepicker-module__flatButtonMd___eFpyF",wU="-esm-form-engine__datepicker-module__flatButtonSm___tsawR",wW="-esm-form-engine__datepicker-module__flatButtonLg___4HG5y";function wH({children:e}){let t=(0,lr.useContext)(by),n=(0,lr.useContext)(bv),r=t??n,a=uI(()=>r?.close());return(0,co.jsx)(vm,{className:"-esm-form-engine__datepicker-module__dialog___DaqYi",ref:a,children:e})}let wz=(0,lr.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},a){let o="range"===e;return(0,co.jsx)(bm,{ref:a,className:"-esm-form-engine__datepicker-module__popover___nAPzC",placement:"bottom start",offset:1,isNonModal:!0,children:(0,co.jsx)(wH,{children:(0,co.jsxs)(o?g4:g1,{...o?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,co.jsxs)("header",{className:"-esm-form-engine__datepicker-module__header___rPv3L",children:[(0,co.jsx)(fn,{className:cs()(wB,wV),slot:"previous",children:(0,co.jsx)(cH,{size:16})}),(0,co.jsx)(wA,{className:"-esm-form-engine__datepicker-module__monthYear___Rw4qE"}),(0,co.jsx)(fn,{className:cs()(wB,wV),slot:"next",children:(0,co.jsx)(cz,{size:16})})]}),(0,co.jsx)(g3,{className:"-esm-form-engine__datepicker-module__calendarGrid___yKV-n",children:e=>(0,co.jsx)(g8,{className:cs()("cds--date-picker__day",{"-esm-form-engine__datepicker-module__today___KzMTn":0===t.compare(e)}),date:e},e.toString())})]})})})}),wK=(0,lr.forwardRef)(function(e,t){let n=(0,lr.useContext)(by),[r,a]=mE({slot:e.slot},t,y7),{locale:o}=fb(),i=y8({...r,locale:o,createCalendar:gI}),s=(0,lr.useRef)(null),{fieldProps:l,inputProps:u}=y$({...r,inputRef:s},i,a),c=(0,lr.useCallback)(()=>{i.isDisabled||n.toggle()},[]);return(0,co.jsxs)(mw,{values:[[ve,i],[yt,{...u,ref:s}],[g7,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,co.jsx)(ye,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:c,children:i.segments.map((t,n)=>(0,lr.cloneElement)(e.children(t),{key:n}))}),(0,co.jsx)(yn,{})]})}),wZ=(0,lr.forwardRef)(function(e,t){let n=(0,lr.useContext)(by),r=(0,lr.useContext)(bv);return(n??r).isInvalid?(0,co.jsx)(dQ,{ref:t,size:16,...e}):(0,co.jsx)(c$,{ref:t,size:16,...e})});class wG{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let wY=new Map,wq=(0,lr.forwardRef)(function({segment:e,...t},n){let r=(0,lr.useContext)(ve),a=d7(n),{segmentProps:o}=function(e,t,n){let r,a,o,i,s=(0,lr.useRef)(""),{locale:l,direction:u}=fb(),c=function(){var e;let{locale:t}=fb(),n=fB((e=y_)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,lr.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new wG(t,n)}},[t,n])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=yR.get(t),h=e.isPlaceholder?"":e.text,g=(0,lr.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=fO({month:"long",timeZone:g.timeZone}),v=fO({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(h=v.format(t.dateValue));else{let e=y.format(t.dateValue);h=e!==h?`${h} \u{2013} ${e}`:e}let{spinButtonProps:b}=wk({value:e.value??void 0,textValue:h,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{s.current="",t.increment(e.type)},onDecrement:()=>{s.current="",t.decrement(e.type)},onIncrementPage:()=>{s.current="",t.incrementPage(e.type)},onDecrementPage:()=>{s.current="",t.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",t.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",t.decrementToMin(e.type)}}),w=(0,lr.useMemo)(()=>new(0,wT.d)(l,{maximumFractionDigits:0}),[l]),x=()=>{if(e.text===e.placeholder&&f.focusPrevious(),!w.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let n=e.text.slice(0,-1),r=w.parse(n);0===(n=0===r?"":n).length||0===r?t.clearSegment(e.type):t.setSegment(e.type,r),s.current=n}},{startsWith:D}=(r=function(e){let{locale:t}=fb(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(wY.has(n))return wY.get(n);let r=new Intl.Collator(t,e);return wY.set(n,r),r}({usage:"search",sensitivity:"base"}),a=(0,lr.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===r.compare(e.slice(0,t.length),t)),[r]),o=(0,lr.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===r.compare(e.slice(-t.length),t)),[r]),i=(0,lr.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let n=0,a=(t=t.normalize("NFC")).length;for(;n+a<=e.length;n++){let o=e.slice(n,n+a);if(0===r.compare(t,o))return!0}return!1},[r]),(0,lr.useMemo)(()=>({startsWith:a,endsWith:o,contains:i}),[a,o,i])),E=fO({hour:"numeric",hour12:!0}),_=(0,lr.useMemo)(()=>{let e=new Date;return e.setHours(0),E.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[E]),S=(0,lr.useMemo)(()=>{let e=new Date;return e.setHours(12),E.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[E]),C=fO({year:"numeric",era:"narrow",timeZone:"UTC"}),k=(0,lr.useMemo)(()=>{if("era"!==e.type)return[];let n=hb(new ho(1,1,1),t.calendar),r=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:C.formatToParts(t).find(e=>"era"===e.type).value}}),a=function(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==n[e])return e;return 0}(r.map(e=>e.formatted));if(a)for(let e of r)e.formatted=e.formatted.slice(a);return r},[C,t.calendar,e.type]),P=n=>{if(t.isDisabled||t.isReadOnly)return;let r=s.current+n;switch(e.type){case"dayPeriod":if(D(_,n))t.setSegment("dayPeriod",0);else if(D(S,n))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=k.find(e=>D(e.formatted,n));e&&(t.setSegment("era",e.era),f.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!w.isValidPartialNumber(r))return;let a=w.parse(r),o=a;if(void 0!==e.maxValue&&a>e.maxValue&&(o=w.parse(n)),isNaN(a))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(a+"0")>e.maxValue||r.length>=String(e.maxValue).length)?(s.current="",f.focusNext()):s.current=r}}};hq((0,lr.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mV(n.current,e?.anchorNode)&&e.collapse(n.current)});let T=(0,lr.useRef)("");hq(n,"beforeinput",r=>{if(n.current)switch(r.preventDefault(),r.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&x();break;case"insertCompositionText":T.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:null!=r.data&&P(r.data)}}),hq(n,"input",e=>{let{inputType:t,data:r}=e;"insertCompositionText"===t&&(n.current&&(n.current.textContent=T.current),null!=r&&(D(_,r)||D(S,r))&&P(r))}),mr(()=>{let e=n.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[n,f]);let R=m8()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,lr.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(p=void 0);let O=mh(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,$="literal"===e.type?"":c.of(e.type),M=hz({"aria-label":`${$}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let A={caretColor:"transparent"};if("rtl"===u){A.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(A.direction="ltr")}return{segmentProps:mv(b,M,{id:O,...R,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":p,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?"false":void 0,autoCorrect:N?"off":void 0,[parseInt(la().version,10)>=17?"enterKeyHint":"enterkeyhint"]:N?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!N?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(m6()?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(),x()}},onFocus:()=>{s.current="",n.current&&h1(n.current,{containingElement:hX(n.current)});let e=window.getSelection();e?.collapse(n.current)},style:A,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,r,a),{focusProps:i,isFocused:s,isFocusVisible:l}=p4(),{hoverProps:u,isHovered:c}=p9({...t,isDisabled:r.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:r,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,lr.useMemo)(()=>{let e,l,u;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof n?n({...s,defaultStyle:i||{}}):n,u="function"==typeof r?r({...s,defaultChildren:o}):null==r?o:r,{className:e??a,style:l||i?{...i,...l}:void 0,children:u??o,"data-rac":""}},[t,n,r,a,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:r.isInvalid,isDisabled:r.isDisabled,isHovered:c,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,lr.useCallback)(e=>{e.stopPropagation()},[]);return(0,co.jsx)("span",{...mv(mI(t),o,i,u),...d,ref:a,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":r.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":r.isDisabled||void 0,"data-type":e.type,"data-hovered":c||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),wJ={short:!1,size:"md"},wX=(0,lr.forwardRef)(function(e,t){let{className:n,defaultValue:r,isDisabled:a,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:u,light:c,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:y,...v}={...wJ,...e},{calendar:b,intlLocale:w,today_:x}=ww(),D=(0,lr.useId)(),E=!!(u??l),_=(0,lr.useMemo)(()=>bD(r,b),[r,b]),S=(0,lr.useMemo)(()=>bD(y,b,!0),[y,b]),C=(0,lr.useMemo)(()=>bD(d,b),[d,b]),k=(0,lr.useMemo)(()=>bD(m??wx,b),[m,b]),P=(0,lr.useMemo)(()=>o||s,[o,s]),T=(0,lr.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(bE(e)))),[f,p]);return(0,co.jsx)(bx,{locale:w.toString(),children:(0,co.jsx)("div",{className:cs()("cds--form-item",n),children:(0,co.jsx)(mw,{values:[[wb,w]],children:(0,co.jsxs)(bb,{className:cs()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:_,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:S,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:T,children:[(0,co.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,co.jsx)(vv,{className:cs()("cds--label",{"cds--label--disabled":a}),htmlFor:D,children:u??l}),(0,co.jsxs)(ye,{className:wI,children:[(0,co.jsx)(wK,{id:E?D:void 0,ref:t,className:cs()("cds--date-picker-input__wrapper","-esm-form-engine__datepicker-module__inputWrapper___uKdT1",{"-esm-form-engine__datepicker-module__inputWrapperSm___0RXJc":"sm"===g,"-esm-form-engine__datepicker-module__inputWrapperMd___4Vff1":"md"===g||!g||0===g.length,"-esm-form-engine__datepicker-module__inputWrapperLg___VCRm5":"lg"===g}),children:e=>"era"!==e.type?(0,co.jsx)(wq,{className:wj,segment:e}):(0,co.jsx)(la().Fragment,{})}),(0,co.jsx)(fn,{className:cs()(wB,{[wU]:"sm"===g,[wV]:"md"===g||!g||0===g.length,[wW]:"lg"===g}),children:(0,co.jsx)(wZ,{})})]}),(0,co.jsx)(vf,{className:wF,children:i})]}),(0,co.jsx)(wz,{variant:"single",today_:x})]})})})})}),wQ=(0,lr.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:r,isDisabled:a,isInvalid:o,label:i,labelText:s,light:l,maxDate:u,minDate:c,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:y,intlLocale:v,today_:b}=ww(),w=(0,lr.useId)(),x=!!(s??i),D=(0,lr.useMemo)(()=>{if(f)return{start:bD(f[0],y,!1),end:bD(f[1],y,!1)}},[f,y]),E=(0,lr.useMemo)(()=>{if(t)return{start:bD(t[0],y,!1),end:bD(t[1],y,!1)}},[t,y]),_=(0,lr.useMemo)(()=>bD(c??wx,y,!0),[c,y]),S=(0,lr.useMemo)(()=>bD(u,y,!0),[u,y]),C=(0,lr.useMemo)(()=>n||o,[n,o]),k=(0,lr.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([bE(e.start),bE(e.end)]))),[m,d]);return(0,co.jsx)(bx,{locale:v.toString(),children:(0,co.jsx)("div",{className:cs()("cds--form-item",e),children:(0,co.jsx)(mw,{values:[[wb,v]],children:(0,co.jsx)(bw,{id:x?w:void 0,className:cs()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:S,minValue:_,value:D,defaultValue:E,ref:g,isDisabled:a,...h,onChange:k,children:(0,co.jsxs)("div",{className:"cds--date-picker-container",children:[x&&(0,co.jsx)(vv,{className:cs()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,co.jsxs)(ye,{className:wI,children:[(0,co.jsxs)("div",{className:cs()("-esm-form-engine__datepicker-module__inputsWrapper___xXRQI",{"-esm-form-engine__datepicker-module__inputsWrapperSm___nL+b6":"sm"===p,"-esm-form-engine__datepicker-module__inputsWrapperMd___Kgcps":"md"===p||!p||0===p.length,"-esm-form-engine__datepicker-module__inputsWrapperLg___raaSN":"lg"===p}),children:[(0,co.jsx)(vn,{className:cs()("cds--date-picker-input__wrapper","-esm-form-engine__datepicker-module__startInput___cWw-5",wL),slot:"start",children:e=>(0,co.jsx)(wq,{className:wj,segment:e})}),(0,co.jsx)("div",{className:"-esm-form-engine__datepicker-module__separator___Ddb4g",children:(0,co.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,co.jsx)(vn,{className:cs()("cds--date-picker-input__wrapper","-esm-form-engine__datepicker-module__endInput___xdYOl",wL),slot:"end",children:e=>(0,co.jsx)(wq,{className:wj,segment:e})})]}),(0,co.jsx)(fn,{className:cs()(wB,{[wU]:"sm"===p,[wV]:"md"===p||!p||0===p.length,[wW]:"lg"===p}),children:(0,co.jsx)(wZ,{})})]}),(0,co.jsx)(vf,{className:wF,children:r}),(0,co.jsx)(wz,{variant:"range",today_:b,minDate:_,maxDate:S})]})})})})})}),w0=la().createContext(null);function w1(e){let{children:t}=e,n=(0,lr.useContext)(w0),[r,a]=(0,lr.useState)(0),o=(0,lr.useMemo)(()=>({parent:n,modalCount:r,addModal(){a(e=>e+1),n&&n.addModal()},removeModal(){a(e=>e-1),n&&n.removeModal()}}),[n,r]);return la().createElement(w0.Provider,{value:o},t)}function w4(e){let t,{modalProviderProps:n}={modalProviderProps:{"aria-hidden":!!(t=(0,lr.useContext)(w0))&&t.modalCount>0||void 0}};return la().createElement("div",{"data-overlay-container":!0,...e,...n})}function w2(e){return la().createElement(w1,null,la().createElement(w4,e))}function w3(e){let t=mm(),{portalContainer:n=t?null:document.body,...r}=e,{getContainer:a}=vs();if(!e.portalContainer&&a&&(n=a()),la().useEffect(()=>{if(n?.closest("[data-overlay-container]"))throw Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[n]),!n)return null;let o=la().createElement(w2,r);return pW().createPortal(o,n)}let w6=la().createContext(null),w5=la().forwardRef(function(e,t){let{children:n,...r}=e,a=d7(t),o={...r,ref:a};return la().createElement(w6.Provider,{value:o},n)}),w9={},w8=0,w7=!1,xe=null,xt=null;function xn(e={}){let{delay:t=1500,closeDelay:n=500}=e,{isOpen:r,open:a,close:o}=bu(e),i=(0,lr.useMemo)(()=>`${++w8}`,[]),s=(0,lr.useRef)(null),l=(0,lr.useRef)(o),u=()=>{w9[i]=m},c=()=>{for(let e in w9)e!==i&&(w9[e](!0),delete w9[e])},d=()=>{s.current&&clearTimeout(s.current),s.current=null,c(),u(),w7=!0,a(),xe&&(clearTimeout(xe),xe=null),xt&&(clearTimeout(xt),xt=null)},m=e=>{e||n<=0?(s.current&&clearTimeout(s.current),s.current=null,l.current()):s.current||(s.current=setTimeout(()=>{s.current=null,l.current()},n)),xe&&(clearTimeout(xe),xe=null),w7&&(xt&&clearTimeout(xt),xt=setTimeout(()=>{delete w9[i],xt=null,w7=!1},Math.max(500,n)))};return(0,lr.useEffect)(()=>{l.current=o},[o]),(0,lr.useEffect)(()=>()=>{s.current&&clearTimeout(s.current),w9[i]&&delete w9[i]},[i]),{isOpen:r,open:e=>{e||!(t>0)||s.current?d():(c(),u(),r||w7?r||d():(xe&&clearTimeout(xe),xe=setTimeout(()=>{xe=null,w7=!0,d()},t)))},close:m}}let xr=(0,lr.createContext)(null),xa=(0,lr.createContext)(null);function xo(e){let t=xn(e),n=(0,lr.useRef)(null),{triggerProps:r,tooltipProps:a}=function(e,t,n){let{isDisabled:r,trigger:a,shouldCloseOnPress:o=!0}=e,i=mh(),s=(0,lr.useRef)(!1),l=(0,lr.useRef)(!1),u=()=>{(s.current||l.current)&&t.open(l.current)},c=e=>{s.current||l.current||t.close(e)};(0,lr.useEffect)(()=>{let e=e=>{n&&n.current&&"Escape"===e.key&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[n,t]);let d=()=>{o&&(l.current=!1,s.current=!1,c(!0))},{hoverProps:m}=p9({isDisabled:r,onHoverStart:()=>{"focus"!==a&&("pointer"===po?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=pR({isDisabled:r,onFocus:()=>{pb()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},n);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mv(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,n);return la().createElement(mw,{values:[[xr,t],[xa,{...a,triggerRef:n}]]},la().createElement(w5,{...r,ref:n},e.children))}let xi=(0,lr.forwardRef)(function({UNSTABLE_portalContainer:e,...t},n){[t,n]=mE(t,n,xa);let r=(0,lr.useContext)(xr),a=xn(t),o=null==t.isOpen&&null==t.defaultOpen&&r?r:a,i=v3(n,o.isOpen)||t.isExiting||!1;return o.isOpen||i?la().createElement(w3,{portalContainer:e},la().createElement(xs,{...t,tooltipRef:n,isExiting:i})):null});function xs(e){let t=(0,lr.useContext)(xr),n=(0,lr.useRef)(null),[r,a]=(0,lr.useState)(0);mr(()=>{n.current&&t.isOpen&&a(n.current.getBoundingClientRect().width)},[t.isOpen,n]);let{overlayProps:o,arrowProps:i,placement:s}=vH({placement:e.placement||"top",targetRef:e.triggerRef,overlayRef:e.tooltipRef,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowSize:r,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,onClose:()=>t.close(!0)}),l=v2(e.tooltipRef,!!s)||e.isEntering||!1,u=mx({...e,defaultClassName:"react-aria-Tooltip",values:{placement:s,isEntering:l,isExiting:e.isExiting,state:t}}),{tooltipProps:c}=function(e,t){let n=mI(e,{labelable:!0}),{hoverProps:r}=p9({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mv(n,r,{role:"tooltip"})}}(e=mv(e,o),t);return la().createElement("div",{...c,ref:e.tooltipRef,...u,style:{...o.style,...u.style},"data-placement":null!=s?s:void 0,"data-entering":l||void 0,"data-exiting":e.isExiting||void 0},la().createElement(vb.Provider,{value:{...i,placement:s,ref:n}},u.children))}let xl=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=ur({externalModuleName:"@openmrs/esm-styleguide"});return(0,co.jsx)("div",{className:"-esm-form-engine__diagnosis-tags-module__container___1iigI",children:e.map(e=>{let r=t&&"PROVISIONAL"===e.certainty,a=1===e.rank?n?.primaryColor??"blue":n?.secondaryColor??"gray";return(0,co.jsx)(xu,{color:a,isProvisional:r,name:e.display},e.uuid)})})};function xu({color:e,isProvisional:t,name:n}){let[r,a]=(0,lr.useState)(!1),[o,i]=(0,lr.useState)(!1),[s,l]=(0,lr.useState)(!1),u=s||o,c=(0,lr.useRef)(null);(0,lr.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||a(!1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n,t,u]);let d=cs()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-form-engine__diagnosis-tags-module__diagnosisTag___mQ28X"),m=(0,co.jsxs)(co.Fragment,{children:[t&&(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("span",{"aria-hidden":"true",className:"-esm-form-engine__diagnosis-tags-module__provisionalMark___S+J53",children:"?"}),(0,co.jsxs)("span",{className:"cds--visually-hidden",children:[aL("provisional","Provisional")," "]})]}),(0,co.jsx)("span",{ref:c,className:"cds--tag__label",children:n})]});return u?(0,co.jsxs)(xo,{delay:0,closeDelay:150,isOpen:r,onOpenChange:a,children:[(0,co.jsx)(fn,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,co.jsx)(xi,{className:"-esm-form-engine__diagnosis-tags-module__tagTooltip___50O3+",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,co.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let xc={action:"-esm-form-engine__empty-card-module__action___oG778",content:"-esm-form-engine__empty-card-module__content___YUXvR",desktopHeading:"-esm-form-engine__empty-card-module__desktopHeading___EljiH",tabletHeading:"-esm-form-engine__empty-card-module__tabletHeading___8mc7w",tile:"-esm-form-engine__empty-card-module__tile___3-rRO"},xd=({width:e="64",height:t="64"})=>(0,co.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,co.jsx)("use",{href:"#omrs-empty-data-illustration"})}),xm=e=>{let t="tablet"===uR(),n=e.launchForm;return(0,co.jsx)(cm.Layer,{className:xc.layer,children:(0,co.jsxs)(cm.Tile,{className:xc.tile,children:[(0,co.jsx)("div",{className:t?xc.tabletHeading:xc.desktopHeading,children:(0,co.jsx)("h4",{children:e.headerTitle})}),(0,co.jsx)(xd,{}),(0,co.jsx)("p",{className:xc.content,children:aL("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,co.jsx)("p",{className:xc.action,children:n&&(0,co.jsx)(cm.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:aL("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},xp=({error:e,headerTitle:t})=>{let n="tablet"===uR();return(0,co.jsx)(cm.Layer,{children:(0,co.jsxs)(cm.Tile,{className:"-esm-form-engine__error-state-module__tile___mzWLn",children:[(0,co.jsx)("div",{className:n?"-esm-form-engine__error-state-module__tabletHeading___l7Cpn":"-esm-form-engine__error-state-module__desktopHeading___p57fl",children:(0,co.jsx)("h4",{children:t})}),(0,co.jsxs)("p",{className:"-esm-form-engine__error-state-module__errorMessage___0fU6v",children:[aL("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,co.jsx)("p",{className:"-esm-form-engine__error-state-module__errorCopy___xkVog",children:aL("errorCopy")})]})})},xf=xp,xh=la().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:a,state:o}=u$(),i=window.location??{pathname:""},s=lv(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,co.jsxs)(cm.SideNav,{"aria-label":aL("leftNavigation","Left navigation"),className:"-esm-form-engine__left-nav-module__leftNav___czP9T",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,co.jsx)(lx,{name:"global-nav-menu-slot"}),n?(0,co.jsx)(l4,{value:a,fallback:(0,co.jsx)(lx,{name:n,state:{basePath:r,currentPath:i,...o}}),children:(0,co.jsx)(lo.Provider,{value:a,children:(0,co.jsx)(lx,{name:n,state:{basePath:r,currentPath:i,...o}})})}):null]}):null}),xg=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:r=50,onChange:a})=>{let[o,i]=(0,lr.useState)(""),s=(0,lr.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:r,isLoading:a}=us()(t,a1,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,lr.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?r:null,isLoading:!!t&&a}),[n,a,r,t])}(t),{locations:u,isLoading:c,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,n=""){let r=uo(n),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uD()(function(n,a){if(a){let e=a.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let o=`${aX}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),n&&i.append("_getpagesoffset",""+n*t),e&&i.append("_tag",e),"string"==typeof r&&""!==r&&i.append("name:contains",r),o+i.toString()},a1);return(0,lr.useMemo)(()=>({locations:a?.length?a?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:a?.[0]?.data?.total,hasMore:!!a?.length&&a?.[a.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,a,i,s,l])}(n,r,o),h=(0,lr.useMemo)(()=>l&&!o&&t?[l,...u.filter(({resource:e})=>e.id!==t)]:u??[],[l,u,t,o]),g=(0,lr.useCallback)(e=>{a(),i(e.trim())},[a]),y=uj((0,lr.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),v=d?Math.max(0,Math.floor(h.length-r/2)):-1;return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)(cm.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:aL("searchForLocation"),id:s,placeholder:aL("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__errorNotification___NfvTe",id:`${s}-error`,children:(0,co.jsx)(cm.InlineNotification,{kind:"error",subtitle:aL("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:aL("error","Error")})}),(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__searchResults___agplm",children:c?(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__loadingContainer___EHghS",children:Array.from({length:5}).map((e,t)=>(0,co.jsx)(cm.RadioButtonSkeleton,{className:"-esm-form-engine__location-picker-module__radioButtonSkeleton___up5rH",role:"progressbar"},t))}):(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__locationResultsContainer___06YOS",children:h.length>0?(0,co.jsx)(cm.RadioButtonGroup,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,co.jsx)(cm.RadioButton,{className:"-esm-form-engine__location-picker-module__locationRadioButton___yKif7",id:e.resource.id,labelText:(0,co.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__emptyState___cPWp8",children:(0,co.jsx)("p",{className:"-esm-form-engine__location-picker-module__locationNotFound___b14++",children:aL("noResultsToDisplay")})})}),m&&(0,co.jsx)("div",{className:"-esm-form-engine__location-picker-module__loadingIcon___GVlrq",children:(0,co.jsx)(cm.InlineLoading,{description:aL("loading")})})]})})]})},xy=V("modalState",{modalContainer:null,modalStack:[]}),xv=0;async function xb(e,t,n={}){let r=sJ(t),a=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=r,i=await o(),s=xv++;a=await s7({...i,name:`${t}-${s}`},{...n,domElement:e})}else P(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function xw(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function xx(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function xD(e){return e.find(e=>!xw(e))}function xE(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let x_=window.getComputedStyle(document.body).overflow;function xS({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",xk),document.body.style.overflow="hidden",t.style.visibility="unset");let n=xD(e);e.forEach(e=>{switch(e.state){case"NEW":{let n=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=n,e.state="MOUNTING",xb(n,e.modalName,e.props).then(r=>{xw(e)?xx(e.modalName,r):r?(e.parcel=r,t.prepend(n),xE(e,xD(xy.getState().modalStack)===e),r.mountPromise.then(()=>{xw(e)||(e.state="MOUNTED")},t=>{P(t),e.parcel=null,xC(e)})):xC(e)},t=>{P(t),xC(e)});break}case"MOUNTING":case"MOUNTED":xE(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),xx(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=xy.getState();xy.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=x_,removeEventListener("keydown",xk)}function xC(e){if(xw(e))return;e.state="TO_BE_DELETED";let t=xy.getState();xy.setState({...t,modalStack:[...t.modalStack]})}function xk(e){"Escape"===e.key&&function(){let[e]=xy.getState().modalStack;e&&xC(e)}()}function xP(e){xy.subscribe(xS),xy.setState({...xy.getState(),modalContainer:e})}function xT(e,t={},n=()=>{}){let r=()=>{let e=xy.getState().modalStack.find(e=>e.onClose===n);e&&xC(e)};if(sJ(e)){var a;let o,i;a={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},i=[a,...(o=xy.getState()).modalStack],xy.setState({...o,modalStack:i})}else P(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var xR=n(5992);let xO=({notification:e})=>{let{description:t,action:n,kind:r,critical:a,title:o,onAction:i}=e;return(0,co.jsx)(cm.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},xN=({subject:e})=>{let[t,n]=(0,lr.useState)([]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(xO,{notification:e},e.id))})},x$=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:r,kind:a,title:o,critical:i,progressActionLabel:s,id:l,...u}=e,[c,d]=(0,lr.useState)(t);return(0,co.jsx)(cm.ActionableNotification,{kind:a||"info",actionButtonLabel:c,ariaLabel:aL("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:aL("actionableNotification","Actionable notification"),subtitle:r,title:o,lowContrast:i,inline:!0,...u})},xM=({subject:e})=>{let[t,n]=(0,lr.useState)([]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(x$,{notification:e},e.id))})};class xA{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"listeners",new Set)}}let xI=new xA,xj=0,xL=new xA,xF=0;function xB(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(xN,{subject:xI}))}function xV(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,xR.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{xI.next({...e,id:xj++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function xU(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(xM,{subject:xL}))}function xW(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,xR.A)(t))?setTimeout(()=>{xL.next({...e,id:xF++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let xH=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],xz=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],xK={container:"-esm-form-engine__numeric-observation-module__container___gS0Wg",card:"-esm-form-engine__numeric-observation-module__card___w0fF5","abnormal-value":"-esm-form-engine__numeric-observation-module__abnormal-value___xuX3W","critical-value":"-esm-form-engine__numeric-observation-module__critical-value___Jynsn",cell:"-esm-form-engine__numeric-observation-module__cell___tMhBJ","critically-high":"-esm-form-engine__numeric-observation-module__critically-high___3L2wx","critically-low":"-esm-form-engine__numeric-observation-module__critically-low___XP+HX",high:"-esm-form-engine__numeric-observation-module__high___JV9do",low:"-esm-form-engine__numeric-observation-module__low___-uDKD","label-container":"-esm-form-engine__numeric-observation-module__label-container___vTf2y","value-container":"-esm-form-engine__numeric-observation-module__value-container___xTUIC",label:"-esm-form-engine__numeric-observation-module__label___-pfmb",value:"-esm-form-engine__numeric-observation-module__value___1A4zt",units:"-esm-form-engine__numeric-observation-module__units___SzvX+","pad-right":"-esm-form-engine__numeric-observation-module__pad-right___ND9XL","off-scale-low":"-esm-form-engine__numeric-observation-module__off-scale-low___gFAv9","off-scale-high":"-esm-form-engine__numeric-observation-module__off-scale-high___aSEmX",arrow:"-esm-form-engine__numeric-observation-module__arrow___9bvsX"},xZ=({value:e,unit:t,label:n,interpretation:r,referenceRange:a,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,lr.useId)(),{referenceRange:u,isLoading:c}=function(e,t){let n=null;e&&(n=t?`${aJ}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${aJ}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:a,isLoading:o}=us()(n,a1),i=r?.data?.results?.[0];return{referenceRange:i?{hiNormal:i.hiNormal??null,hiAbsolute:i.hiAbsolute??null,hiCritical:i.hiCritical??null,lowNormal:i.lowNormal??null,lowAbsolute:i.lowAbsolute??null,lowCritical:i.lowCritical??null}:void 0,error:a,isLoading:o}}(a||r?void 0:o,s),d=a??u,m=(0,lr.useMemo)(()=>{if(r)return r?"--"===r?"normal":xH.includes(r)?r.toLowerCase():xz.includes(r)?r:"normal":void 0;if(d&&!c){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[r,d,e,c])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,v=null!=e&&""!==e,b=v?e:aL("notAvailable","Not available"),w=cs()({[xK["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[xK["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[xK.low]:"low"===m,[xK.high]:"high"===m,[xK["off-scale-low"]]:"off_scale_low"===m,[xK["off-scale-high"]]:"off_scale_high"===m}),x=cs()({[xK.container]:!0,[xK.card]:!0,[xK["critical-value"]]:p,[xK["abnormal-value"]]:f&&!p}),D=cs()({[xK.cell]:!0,[w]:!0});return"cell"===i?(0,co.jsxs)("div",{className:D,children:[b,v&&t?` ${t}`:""]}):(0,co.jsxs)("section",{className:x,"data-testid":"numeric-observation-card",children:[n&&(0,co.jsxs)("div",{className:xK["label-container"],children:[(0,co.jsx)("span",{id:h,className:xK.label,children:n}),f&&(0,co.jsx)("span",{className:xK[m.replace("_","-")],title:aL("abnormalValue","Abnormal value")})]}),(0,co.jsxs)("div",{className:xK["value-container"],children:[(0,co.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:xK.value,children:b}),v&&t&&(0,co.jsx)("span",{id:y,className:xK.units,children:t})]})]})},xG="-esm-form-engine__page-header-module__pageHeader___6TOjO",xY=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,co.jsx)("div",{className:cs()(xG,n),...r,children:t})}{let{title:t,illustration:n,className:r,...a}=e;return(0,co.jsx)("div",{className:cs()(xG,r),...a,children:(0,co.jsx)(xq,{title:t,illustration:n})})}},xq=({title:e,illustration:t,className:n})=>{let[r,a]=(0,lr.useState)(null);return(0,lr.useEffect)(()=>{t9("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,co.jsxs)("div",{className:cs()("-esm-form-engine__page-header-module__pageHeaderContent___mCImT",n),children:[t,(0,co.jsxs)("div",{className:"-esm-form-engine__page-header-module__pageLabels___kqDS+",children:[r?.implementationName&&(0,co.jsx)("p",{children:aL(r.implementationName)}),(0,co.jsx)("h1",{className:"-esm-form-engine__page-header-module__pageName___SbZBC",children:e})]})]})},xJ=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:r,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=uB(t,e,r,o),u="tablet"===uR(),c=aL("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,co.jsx)(co.Fragment,{children:e>0&&(0,co.jsxs)("div",{className:cs()({"-esm-form-engine__pagination-module__tablet___82gj1":u,"-esm-form-engine__pagination-module__desktop___6yI8e":!u}),children:[(0,co.jsxs)("div",{children:[c,a&&(0,co.jsx)(li,{to:a,className:"-esm-form-engine__pagination-module__configurableLink___oIqma",children:i??aL("seeAll","See all")})]}),(0,co.jsx)(cm.Pagination,{className:"-esm-form-engine__pagination-module__pagination___A-Lcg",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>aL("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function xX(e){return x0(x4(e,"usual","official"))}function xQ(e){return xX(e)}function x0(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function x1(e){return x0(e)}function x4(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,r;return t=e,r=n,t.use?t.use===r:"usual"===r});if(t)return t}}function x2(e,t=uG()()){let n=uG()(t),r=wm(e,n);if(null==r)return null;let a=n.diff(r,"hours"),o=n.diff(r,"days"),i=n.diff(r,"weeks"),s=n.diff(r,"months"),l=n.diff(r,"years"),u={};if(a<2)u.minutes=n.diff(r,"minutes");else if(o<2)u.hours=a;else if(i<4)u.days=o;else if(l<1){let e=n.subtract(i,"weeks").diff(r,"days");u.weeks=i,u.days=e}else if(l<2){let e=n.subtract(s,"months").diff(r,"days");u.months=s,u.days=e}else if(l<18){let e=n.subtract(l,"year").diff(r,"months");u.years=l,u.months=e}else u.years=l;return u}function x3(e,t=uG()()){let n=x2(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),wd(n,r)}let x6={container:"-esm-form-engine__patient-banner-patient-info-module__container___iC32K",activePatientContainer:"-esm-form-engine__patient-banner-patient-info-module__activePatientContainer___OoDPd",patientBanner:"-esm-form-engine__patient-banner-patient-info-module__patientBanner___swajU",patientName:"-esm-form-engine__patient-banner-patient-info-module__patientName___+2+Xi",patientAvatar:"-esm-form-engine__patient-banner-patient-info-module__patientAvatar___Rdf75",patientAvatarButton:"-esm-form-engine__patient-banner-patient-info-module__patientAvatarButton___A1q8c",patientInfo:"-esm-form-engine__patient-banner-patient-info-module__patientInfo___L-cOQ",demographics:"-esm-form-engine__patient-banner-patient-info-module__demographics___IDhb0",row:"-esm-form-engine__patient-banner-patient-info-module__row___TP7gU",flexRow:"-esm-form-engine__patient-banner-patient-info-module__flexRow___vNMt2",tagsSlot:"-esm-form-engine__patient-banner-patient-info-module__tagsSlot___0Dvjn",identifiers:"-esm-form-engine__patient-banner-patient-info-module__identifiers___d3GTJ",identifier:"-esm-form-engine__patient-banner-patient-info-module__identifier___kc6eq",primaryIdentifier:"-esm-form-engine__patient-banner-patient-info-module__primaryIdentifier___ZxRUU",secondaryIdentifier:"-esm-form-engine__patient-banner-patient-info-module__secondaryIdentifier___eQh8x",value:"-esm-form-engine__patient-banner-patient-info-module__value___CoAOR",tag:"-esm-form-engine__patient-banner-patient-info-module__tag___InccN",gender:"-esm-form-engine__patient-banner-patient-info-module__gender___vfinx",separator:"-esm-form-engine__patient-banner-patient-info-module__separator___3OIBl",tooltipPadding:"-esm-form-engine__patient-banner-patient-info-module__tooltipPadding___hBqWG",tooltipSmallText:"-esm-form-engine__patient-banner-patient-info-module__tooltipSmallText___bPnkq",actionsButtonText:"-esm-form-engine__patient-banner-patient-info-module__actionsButtonText___VNvm7"};function x5({showIdentifierLabel:e,type:t,value:n}){return(0,co.jsx)("span",{className:x6.primaryIdentifier,children:(0,co.jsxs)(cm.Tag,{className:x6.tag,type:"gray",children:[e&&t?.text&&(0,co.jsxs)("span",{className:x6.label,children:[t.text,": "]}),(0,co.jsx)("span",{className:x6.value,children:n})]})})}function x9({showIdentifierLabel:e,type:t,value:n}){return(0,co.jsxs)(cm.FormLabel,{className:x6.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,co.jsxs)("span",{className:x6.label,children:[t?.text,": "]}),(0,co.jsx)("span",{className:x6.value,children:n})]})}function x8({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=ur(),{primaryIdentifierCode:r}=uW(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,co.jsx)(co.Fragment,{children:a?.length?a.map(({value:e,type:n},o)=>(0,co.jsxs)(la().Fragment,{children:[(0,co.jsx)("span",{className:x6.identifier,children:n?.coding?.[0]?.code===r?(0,co.jsx)(x5,{showIdentifierLabel:t,type:n,value:e}):(0,co.jsx)(x9,{showIdentifierLabel:t,type:n,value:e})}),o<a.length-1&&(0,co.jsx)("span",{className:x6.separator,children:"\xb7"})]},e)):""})}let x7={Female:c2,Male:c3,Other:c6,Unknown:c5},De=({gender:e})=>{let t=x7[e];return t?(0,co.jsx)(t,{fill:"#525252"}):null},Dt={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function Dn({patient:e,renderedFrom:t}){var n;let r,a,o=xX(e),i=e?.gender&&(a=Dt[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:aL(r,n),iconKey:a}),s=(0,lr.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,co.jsxs)("div",{className:x6.patientInfo,children:[(0,co.jsx)("div",{className:cs()(x6.row,x6.patientNameRow),children:(0,co.jsxs)("div",{className:x6.flexRow,children:[(0,co.jsx)("span",{className:x6.patientName,children:o}),i&&(0,co.jsxs)("div",{className:x6.gender,children:[(0,co.jsx)(De,{gender:i.iconKey}),(0,co.jsx)("span",{children:i.displayText})]}),(0,co.jsx)(lx,{className:x6.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,co.jsxs)("div",{className:x6.demographics,children:[e.birthDate&&(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("span",{children:x3(e.birthDate)}),(0,co.jsx)("span",{className:x6.separator,children:"\xb7"}),(0,co.jsx)("span",{children:wo(e.birthDate,{time:!1})}),(0,co.jsx)("span",{className:x6.separator,children:"\xb7"})]}),(0,co.jsx)(x8,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,co.jsx)(lx,{className:x6.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var Dr=n(8282);function Da({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[a,o]=(0,lr.useState)(!1),{extensions:i}=lb(n),s="tablet"===uR(),l=uI(()=>o(!1),a),u=(0,lr.useRef)(null),c=(0,lr.useRef)(null),d=(0,lr.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,lr.useCallback)(()=>o(e=>!e),[]),h=(0,lr.useCallback)(()=>{o(!1),u.current?.focus()},[]),g=(0,lr.useCallback)(e=>{if("Escape"===e.key&&a){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&a){e.preventDefault();let t=c.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let n=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(t).indexOf(n);if(-1===r)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let a=r+("ArrowDown"===e.key?1:-1),o=a<0?t.length-1:a>=t.length?0:a;t[o]?.focus()}},[h,a]);(0,lr.useEffect)(()=>{if(a&&c.current){let e=c.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[a]);let y=(0,lr.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...r}),[t,e,h,r]);return 0===i.length?null:(0,co.jsx)("div",{className:"-esm-form-engine__patient-banner-actions-menu-module__overflowMenuContainer___FbFcO",children:(0,co.jsxs)("div",{"data-overflow-menu":!0,className:cs()("cds--overflow-menu",ch),ref:l,children:[(0,co.jsxs)("button",{className:cs()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cv),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,co.jsx)("span",{className:"-esm-form-engine__patient-banner-actions-menu-module__actionsButtonText___hk4xW",children:aL("actions","Actions")})," ",(0,co.jsx)(Dr.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,co.jsxs)("div",{className:cs()("cds--overflow-menu-options","cds--overflow-menu--flip",cg,{[cy]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,co.jsx)("ul",{className:cs()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,co.jsx)(lx,{name:n,state:y},n)}),(0,co.jsx)("span",{})]})]})})}var Do=n(5570),Di=n.n(Do);function Ds(e){let{patientPhotoConceptUuid:t}=ur({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${aJ}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:a,isLoading:o}=lL()(e?n:null,a1),i=r?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let Dl=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,lI.useTranslation)();return(0,co.jsxs)("svg",{"aria-label":n??r("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,co.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,co.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"})]})},Du="-esm-form-engine__patient-photo-module__avatar___thboZ";function Dc({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:a}=Ds(e),[o,i]=(0,lr.useState)(null),[s,l]=(0,lr.useState)(!1),u=(0,lr.useMemo)(()=>Di().generate(e),[e]);(0,lr.useEffect)(()=>{if(r?.imageSrc){let e=new URL(r.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(i(e),l(!1))},n.onerror=()=>{t||(i(null),l(!1))},n.src=e,()=>{t=!0}}i(null),l(!1)},[r?.imageSrc]);let c=(0,lr.useMemo)(()=>n||(o?aL("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):aL("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,o,t]);return a||s?(0,co.jsx)(cm.SkeletonIcon,{className:"-esm-form-engine__patient-photo-module__skeleton___WWtyX","data-testid":"skeleton-icon"}):r?.imageSrc&&!o?(0,co.jsx)(Dl,{"aria-label":aL("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,co.jsx)("div",{"aria-label":c,children:(0,co.jsx)("img",{className:Du,src:o,alt:c,title:t})}):(0,co.jsx)("div",{"aria-label":c,children:(0,co.jsx)("div",{className:Du,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,co.jsx)("span",{className:"-esm-form-engine__patient-photo-module__initials___xLeEF",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let Dd=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],Dm=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),Dp=Dm,Df=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),Dh=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),Dg=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),Dy=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),Dv=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),Db=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),Dw=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),Dx=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),DD=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),DE=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),D_=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),DS=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),DC=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),Dk=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),DP=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),DT=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),DR=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),DO=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),DN=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),D$=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),DM=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),DA=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),DI=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),Dj=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),DL=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),DF=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),DB=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),DV=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),DU=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),DW=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),DH=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),Dz=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),DK=(0,lr.memo)((0,lr.forwardRef)(function(e,t){return(0,co.jsx)(Dq,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),DZ=DS,DG=DA,DY=(0,lr.memo)((0,lr.forwardRef)(function({pictogram:e,fallback:t,...n},r){let a=(0,lr.useRef)(document.getElementById(e));return(0,lr.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(a.current=document.getElementById(e))});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,co.jsx)(l4,{value:a.current,fallback:t,children:(0,co.jsx)(Dq,{ref:r,pictogram:e,pictogramProps:n})})})),Dq=(0,lr.memo)((0,lr.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:r,size:a}=Object.assign({},{size:92},t);return(a<=26||a>144)&&(console.error(`Invalid size '${a}' specified for ${e}. Defaulting to 92.`),a=92),(0,co.jsx)("svg",{ref:n,className:cs()("-esm-form-engine__pictograms-module__pictogram___ooPKM",r),height:a,width:a,children:(0,co.jsx)("use",{href:`#${e}`})})})),DJ=({children:e})=>"tablet"===uR()?(0,co.jsx)(cm.Layer,{children:e}):(0,co.jsx)(co.Fragment,{children:e}),DX=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:r="success",onActionButtonClick:a=()=>{},isLowContrast:o="error"!==r,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:u="error"!==r,title:c,id:d,...m}=e,[p,f]=(0,lr.useState)(n),[h,g]=(0,lr.useState)(!0),[y,v]=(0,lr.useState)(!1),b=(0,lr.useCallback)(()=>{setTimeout(t,250)},[t]),w=(0,lr.useCallback)(()=>{v(!0),b()},[b]);return(0,lr.useEffect)(()=>{if(u){let e=setTimeout(w,l);return()=>clearTimeout(e)}},[l,u,w]),(0,lr.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,co.jsx)(cm.ActionableNotification,{actionButtonLabel:p,"aria-label":aL("closeSnackbar","Close snackbar"),className:cs()("-esm-form-engine__snackbar-module__slideIn___senVE",{"-esm-form-engine__snackbar-module__animated___8eltL":h,"-esm-form-engine__snackbar-module__slideOut___BIIXm":y}),kind:r,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:aL("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},DQ=({subject:e})=>{let[t,n]=(0,lr.useState)([]),r=(0,lr.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(DX,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},D0=new xA,D1=0;function D4(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(DQ,{subject:D0}))}function D2(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{D0.next({...e,id:D1++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let D3=({toast:e,closeToast:t})=>{let{description:n,kind:r,critical:a,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,lr.useCallback)(()=>{s(),t()},[t,s]);return(0,co.jsx)("div",{children:(0,co.jsx)(cm.ActionableNotification,{actionButtonLabel:i,kind:r||"info",lowContrast:a,subtitle:n,title:o||"",onActionButtonClick:l,onClose:t})})},D6=({subject:e})=>{let[t,n]=(0,lr.useState)([]),r=(0,lr.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,lr.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsx)(D3,{toast:e,closeToast:()=>r(e)},e.id))})},D5=new xA,D9=0;function D8(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(D6,{subject:D5}))}function D7(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,xR.A)(t))?setTimeout(()=>{D5.next({...e,id:D9++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let Ee="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Et=new Uint8Array(16),En=[];for(let e=0;e<256;++e)En.push((e+256).toString(16).slice(1));let Er=function(e,t,n){if(Ee&&!t&&!e)return Ee();let r=(e=e||{}).random??e.rng?.()??function(){if(!d){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");d=crypto.getRandomValues.bind(crypto)}return d(Et)}();if(r.length<16)throw Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((n=n||0)<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return(En[e[t+0]]+En[e[t+1]]+En[e[t+2]]+En[e[t+3]]+"-"+En[e[t+4]]+En[e[t+5]]+"-"+En[e[t+6]]+En[e[t+7]]+"-"+En[e[t+8]]+En[e[t+9]]+"-"+En[e[t+10]]+En[e[t+11]]+En[e[t+12]]+En[e[t+13]]+En[e[t+14]]+En[e[t+15]]).toLowerCase()}(r)};async function Ea(e,t){let{openedGroup:n}=sX.getState();if(n){if(n.groupName===e&&Es(n.props,t))return!0;else if(!await Ec({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return sX.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function Eo(e){let{openedGroup:t,openedWindows:n}=sX.getState();if(t){if(n.length>0&&!(e||await Ec({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;sX.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function Ei(e,t=null,n=null,r=null){let a=sX.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=sQ(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=a,{name:s}=o,l=s0(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=s1(e);if(i&&(i.groupName!==l.name||!Es(i.props,r)))return!!await Ec({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(u>=0){let r=a.openedWindows[u],o=a.openedGroup?.props??{},i=a.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:c}=r;if(Es(r.props,n)){let d=c.find(t=>t.workspaceName===e);return d&&Es(d.props,t)?((i||u!==a.openedWindows.length-1)&&sX.setState(Eg.restoreWindow(a,s)),!0):!!await Ec({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??o},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[Ex(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await Ec({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:o??a?.openedGroup?.props},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(sX.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await Ec({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(sX.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[Ex(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function Es(e,t){return null==e||null==t||O(e,t)}function El(e,t){let n=[];for(let r=e.openedWorkspaces.length-1;r>=0;r--){let a=e.openedWorkspaces[r];if(a.hasUnsavedChanges&&n.push(a),t&&a.workspaceName===t)break}return n}function Eu(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=xT("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function Ec(e){let{openedWindows:t}=sX.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>El(e));break;case"CLOSE_WINDOW":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=El(r);break}case"CLOSE_WORKSPACE":{let r=t.find(t=>t.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);n=El(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>El(e))}return Eu(n)}function Ed(e,t){return Eu(El(e,t))}function Em(e,t){let n=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return n<0?e:0===n?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,n)}}function Ep(e,t,n,r){let{registeredWorkspacesByName:a}=sX.getState(),o=a[n];if(!o)throw Error(`No workspace named "${n}" registered`);let i=a[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);if(o.window!==e.windowName)throw Error(`Cannot open child workspace ${n} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${n} from parent workspace ${t} as the parent is not opened within the workspace window`);let u=s.slice(0,l+1);return{...e,openedWorkspaces:[...u,Ex(n,r)]}}function Ef(e,t,n){let r=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(r<0)return e;let a=e.openedWorkspaces[r];if(Object.keys(n).every(e=>a[e]===n[e]))return e;let o=[...e.openedWorkspaces];return o[r]={...a,...n},{...e,openedWorkspaces:o}}function Eh(e,t,n){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(r<0)return e;let a=e.openedWindows[r],o=Ef(a,t,n);if(o===a)return e;let i=[...e.openedWindows];return i[r]=o,{...e,openedWindows:i}}let Eg={setWindowMaximized(e,t,n){let r=e.openedWindows.findIndex(e=>e.windowName===t),a=[...e.openedWindows],o={...a[r],maximized:n};return a[r]=o,{...e,openedWindows:a}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),r=e.openedWindows[n],a=[...e.openedWindows.filter((e,t)=>t!==n),r];return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(n<0)return e;let r=Em(e.openedWindows[n],t),a=[...e.openedWindows],o=e.isMostRecentlyOpenedWindowHidden;if(null===r){let t=n===e.openedWindows.length-1;a.splice(n,1),t&&a.length>0&&(o=!1)}else a[n]=r;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,t,n,r){let a=e.registeredWorkspacesByName[n];if(!a)throw Error(`No workspace named "${n}" registered`);let o=e.openedWindows.findIndex(e=>e.windowName===a.window);if(-1==o)throw Error(`Cannot open child workspace ${n} as window ${a.window} is not opened`);let i=[...e.openedWindows];return i[o]=Ep(e.openedWindows[o],t,n,r),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,n)=>Eh(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>Eh(e,t,{title:n})};function Ey(){return lm(sX,Eg)}let Ev=()=>(0,lr.useContext)(lP),Eb=()=>Object.keys(sX.getState().registeredWorkspacesByName);function Ew(e,t,n){let r=e.openedWorkspaces[e.openedWorkspaces.length-1];return(r?t[r.workspaceName]?.width:void 0)??n[e.windowName]?.width??"narrow"}function Ex(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:Er()}}function ED(e,t,n){let r=sX.getState().registeredWorkspacesByName[e];return r?{windowName:r.window,openedWorkspaces:[Ex(e,t)],props:n??null,maximized:!1}:null}let EE=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:r,setWorkspaceTitle:a}=Ev();return(0,lr.useEffect)(()=>{r(n??!1)},[n,r]),(0,lr.useEffect)(()=>{a(e)},[e,a]),(0,co.jsx)(co.Fragment,{children:t})};function E_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ES(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E_(Object(n),!0).forEach(function(t){Ek(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function EC(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ek(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EP(e){return(EP=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ET(e,t){return(ET=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ER(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var EO=function(e){var t=lr.Component;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&ET(i,t);var n,r,a,o=(n=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,t=EP(i);e=n?Reflect.construct(t,arguments,EP(this).constructor):t.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 ER(this)});function i(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,i),Ek(ER(t=o.call(this,e)),"handleRef",function(e){t.el=e}),Ek(ER(t),"addThingToDo",function(e,n){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return n.apply(void 0,arguments)}).catch(function(n){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),n&&n.message&&(n.message="During '".concat(e,"', parcel threw an error: ").concat(n.message)),t.props.handleError?t.props.handleError(n):setTimeout(function(){throw n}),n}))}),Ek(ER(t),"getParcelProps",function(){var e=ES(ES({},t.props),{},{domElement:t.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),t.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 t}return r=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,n=e.props.mountParcel||e.mountParcel;if(!n)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?t=e.el:(e.createdDomElement=t=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(n){t.style[n]=e.props.wrapStyle[n]}),e.props.appendTo.appendChild(t)),e.parcel=n(e.props.config,ES({domElement:t},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 lP&&lP.Consumer?lr.createElement(lP.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=lP&&lP.Consumer?lr.createElement(lP.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return lr.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],EC(i.prototype,r),a&&EC(i,a),i}();Ek(EO,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var EN=n(8742);let E$=la().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?la().createElement(EN.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},ea||(ea=la().createElement("path",{d:"M2 9L2 10 5.3 10 1 14.3 1.7 15 6 10.7 6 14 7 14 7 9zM14 7L14 6 10.7 6 15 1.7 14.3 1 10 5.3 10 2 9 2 9 7z"})),e):la().createElement(EN.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},eo||(eo=la().createElement("path",{d:"M4 18L4 20 10.586 20 2 28.582 3.414 30 12 21.414 12 28 14 28 14 18 4 18zM30 3.416L28.592 2 20 10.586 20 4 18 4 18 14 28 14 28 12 21.414 12 30 3.416z"})),e)});var EM=n(4240),EA=n(8622);let EI={workspaceOuterContainer:"-esm-form-engine__workspace2-module__workspaceOuterContainer___jaqGm",narrowWorkspace:"-esm-form-engine__workspace2-module__narrowWorkspace___o1wsL",widerWorkspace:"-esm-form-engine__workspace2-module__widerWorkspace___gdEOi",extraWideWorkspace:"-esm-form-engine__workspace2-module__extraWideWorkspace___U9xlJ",workspaceMiddleContainer:"-esm-form-engine__workspace2-module__workspaceMiddleContainer___0AdtX",maximized:"-esm-form-engine__workspace2-module__maximized___aKCbE",hidden:"-esm-form-engine__workspace2-module__hidden___n1US5",workspaceInnerContainer:"-esm-form-engine__workspace2-module__workspaceInnerContainer___1g+qk",workspaceSpacer:"-esm-form-engine__workspace2-module__workspaceSpacer___P2T9y",loader:"-esm-form-engine__workspace2-module__loader___fCfzZ",hiddenExtraWorkspace:"-esm-form-engine__workspace2-module__hiddenExtraWorkspace___hvPSi",header:"-esm-form-engine__workspace2-module__header___MXXx9",headerButtons:"-esm-form-engine__workspace2-module__headerButtons___sJdnC",workspaceContent:"-esm-form-engine__workspace2-module__workspaceContent___6NuXT",overlayHeaderSpacer:"-esm-form-engine__workspace2-module__overlayHeaderSpacer___PLO6T",isActionMenuOpened:"-esm-form-engine__workspace2-module__isActionMenuOpened___X3Vj6",showActionMenu:"-esm-form-engine__workspace2-module__showActionMenu___HSun1",marginWorkspaceContent:"-esm-form-engine__workspace2-module__marginWorkspaceContent___DCfWz",workspaceContainerWithActionMenu:"-esm-form-engine__workspace2-module__workspaceContainerWithActionMenu___G9MdI",workspaceFixedContainer:"-esm-form-engine__workspace2-module__workspaceFixedContainer___uIldI",workspaceContainerWithoutActionMenu:"-esm-form-engine__workspace2-module__workspaceContainerWithoutActionMenu___lBudZ"},Ej=e=>e.registeredWorkspacesByName,EL=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:r,actions:a,renderChrome:o,isRootWorkspace:i,isLeafWorkspace:s,showActionMenu:l})=>{let u=(0,lr.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:r=!1,discardUnsavedChanges:o=!1}=e;return r?!!(o||await a.promptForClosingWorkspaces())&&(a.closeWorkspace(n.openedWorkspaces[0].workspaceName),!0):!!(o||await a.promptForClosingWorkspaces(t.workspaceName))&&(a.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,r)=>{let o=t.workspaceName,{openedWorkspaces:i}=n,s=i.findIndex(e=>e.workspaceName===o);-1===s||s!==i.length-1&&i.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await a.promptForClosingWorkspaces(i[s+1].workspaceName)||a.openChildWorkspace(o,e,r||{})},setWorkspaceTitle:e=>a.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>a.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:r,workspaceMeta:sX.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:i,isLeafWorkspace:s,windowName:n.windowName,showActionMenu:l},[t,n,r,a,i,s,l]),c=!o&&!s,d=(0,lr.useMemo)(()=>e?(0,co.jsx)(EO,{config:e,mountParcel:lt,wrapWith:"div",wrapClassName:cs()(EI.workspaceContent,{[EI.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null,[e,t.workspaceName,u,c]);return o?(0,co.jsx)("div",{children:(0,co.jsx)(EF,{openedWorkspace:t,openedWindow:n,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,co.jsx)(cm.InlineLoading,{className:cs()(EI.loader,{[EI.hiddenExtraWorkspace]:c}),description:`${aL("loading")}`})},EF=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:r,closeWindow:a,children:o})=>{let i=uR(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=Ey(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=Ew(t,c,u),w=v?.icon,x=v?.canMaximize,D=!!s&&d[s.groupName]?.persistence==="closable",E=!!w&&!D,_=l.findIndex(e=>e.windowName===h)<l.length-1||m,S=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,co.jsxs)("div",{className:cs()(EI.workspaceOuterContainer,{[EI.narrowWorkspace]:"narrow"===b,[EI.widerWorkspace]:"wider"===b,[EI.extraWideWorkspace]:"extra-wide"===b,[EI.isActionMenuOpened]:S}),children:[(0,co.jsx)("div",{className:cs()(EI.workspaceSpacer,{[EI.hidden]:_})}),(0,co.jsx)("div",{className:cs()(EI.workspaceMiddleContainer,{[EI.maximized]:g,[EI.hidden]:_,[EI.isRootWorkspace]:n,[EI.showActionMenu]:r}),children:(0,co.jsx)("div",{className:cs()(EI.workspaceInnerContainer,{[EI.maximized]:g,[EI.hidden]:_,[EI.isRootWorkspace]:n}),children:o?(0,co.jsxs)(co.Fragment,{children:[(0,co.jsxs)(cm.Header,{"aria-label":aL("workspaceHeader"),className:EI.header,children:[(0,co.jsx)(cm.HeaderName,{prefix:"",children:y}),(0,co.jsx)("div",{className:EI.overlayHeaderSpacer}),(0,co.jsx)(cm.HeaderGlobalBar,{className:EI.headerButtons,children:uO(i)?(0,co.jsxs)(co.Fragment,{children:[(x||g)&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":g?aL("minimize"):aL("maximize"),onClick:()=>p(h,!g),children:g?(0,co.jsx)(E$,{}):(0,co.jsx)(EM.hz,{})}),E&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("hide"),onClick:()=>f(),children:(0,co.jsx)(cT,{})}),!D&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("close"),onClick:a,children:(0,co.jsx)(cZ,{})})]}):(0,co.jsxs)(co.Fragment,{children:[E&&(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("hide"),onClick:()=>f(),children:(0,co.jsx)(EA.d3,{})}),(0,co.jsx)(cm.HeaderGlobalAction,{"aria-label":aL("close"),onClick:()=>{D?Eo():a()},children:(0,co.jsx)(cZ,{})})]})})]}),o]}):(0,co.jsx)(cm.InlineLoading,{className:EI.loader,description:`${aL("loading")} ...`})})})]})},EB=({openedWindow:e,groupProps:t,actions:n,renderChrome:r,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,lr.useState)({}),l=ld(sX,Ej);return(0,lr.useEffect)(()=>{let e=!1;return Promise.all(o.map(async e=>{let t=l[e.workspaceName];if(!t)return null;let{moduleName:n,component:r}=t;return[e.uuid,await u3(n,r)]})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))}),()=>{e=!0}},[o,l]),(0,co.jsx)(co.Fragment,{children:o.map((s,l)=>(0,co.jsx)(EL,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:n,renderChrome:r,lifeCycle:i[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===o.length-1,showActionMenu:a},s.uuid))})},EV=e=>e.registeredWorkspacesByName,EU=({name:e,workspaceProps:t,windowProps:n,groupProps:r,onWindowChanged:a})=>{let o=ld(sX,EV),i=ld(sX,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),s={name:e,workspaceProps:t,windowProps:n,groupProps:r},l=(0,lr.useRef)(),u=(0,lr.useRef)(null);if(!l.current){let a=ED(e,t,n);l.current=U({openedWindow:a,groupProps:r??null}),a&&(u.current=s)}let c=l.current;(0,lr.useEffect)(()=>{let a=u.current;if(a&&a.name===e&&O(a.workspaceProps,t)&&O(a.windowProps,n)&&O(a.groupProps,r))return;let o=ED(e,t,n);c.setState({openedWindow:o,groupProps:r??null},!0),u.current=o?s:null},[e,t,n,r,o,c]);let d=(0,lr.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let n=t(e.openedWindow);return n===e.openedWindow?e:{...e,openedWindow:n}})}return{closeWorkspace(e){t(t=>Em(t,e))},openChildWorkspace(e,n,r){t(t=>Ep(t,e,n,r))},setWorkspaceTitle(e,n){t(t=>Ef(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>Ef(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?Ed(n,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=ld(c),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",y=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=i?.width??"narrow",b=(0,lr.useRef)(a);return(0,lr.useEffect)(()=>{b.current=a}),(0,lr.useEffect)(()=>{b.current?.({workspaceName:h,windowWidth:v,title:g,hasUnsavedChanges:y})},[h,v,g,y]),(0,co.jsx)("div",{className:"-esm-form-engine__exported-workspace-module__exportedWorkspace___3vwoL",children:m?(0,co.jsx)(EB,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},EW="-esm-form-engine__action-menu-button2-module__container___pahg-",EH="-esm-form-engine__action-menu-button2-module__elementContainer___PzOdc",Ez="-esm-form-engine__action-menu-button2-module__active___4O4Bs",EK="-esm-form-engine__action-menu-button2-module__focused___+k5kD";function EZ({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,co.jsxs)(co.Fragment,{children:[e({size:16}),t?(0,co.jsx)("span",{className:"-esm-form-engine__action-menu-button2-module__interruptedTag___mS2yr",children:"!"}):(0,co.jsx)("span",{className:"-esm-form-engine__action-menu-button2-module__countTag___rb5CW",children:n})]})}let EG=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:a})=>{let o=uR(),{openedWindows:i,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:u}=Ey(),{extension:c}=(0,lr.useContext)(lo),d=i.findIndex(e=>e.windowName===c?.extensionId),m=i[d],p=null!=m,f=p&&(d<i.length-1||u),h=p&&!f,g=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,y=async()=>{if(p)f?s(m.windowName):l();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=r;Ei(e,t,n)}};return"tablet"===o||"phone"===o?(0,co.jsxs)(cm.Button,{className:cs()(EW,{[Ez]:p&&!h,[EK]:h}),iconDescription:t,kind:"ghost",onClick:y,role:"button",tabIndex:0,size:"md",children:[(0,co.jsx)("span",{className:EH,children:(0,co.jsx)(EZ,{hasUnsavedChanges:g,getIcon:e,tagContent:n})}),(0,co.jsx)("span",{children:t})]}):(0,co.jsx)(cm.IconButton,{align:"left","aria-label":t,className:cs()(EW,{[Ez]:p&&!h,[EK]:h}),enterDelayMs:300,kind:"ghost",label:t,onClick:y,size:"md",children:(0,co.jsx)("div",{className:EH,children:(0,co.jsx)(EZ,{hasUnsavedChanges:g,getIcon:e,tagContent:n})})})};function EY({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,co.jsx)(cm.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?cK:cW,children:e?aL("showLess","Show less"):aL("showMore","Show more")})}let Eq={contactDetails:"-esm-form-engine__patient-banner-contact-details-module__contactDetails___rhdjA",deceased:"-esm-form-engine__patient-banner-contact-details-module__deceased___K4NPg",heading:"-esm-form-engine__patient-banner-contact-details-module__heading___zj6Zt",row:"-esm-form-engine__patient-banner-contact-details-module__row___+Bx+P",col:"-esm-form-engine__patient-banner-contact-details-module__col___0H31P",relationship:"-esm-form-engine__patient-banner-contact-details-module__relationship___CZmay"},EJ=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${aJ}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=lL()(t,a1),a=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,lr.useMemo)(()=>({cohorts:a,isLoading:r}),[r,a])}(e);return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsxs)("p",{className:Eq.heading,children:[aL("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>b7(e?.startDate).getTime()-b7(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,co.jsx)("li",{children:(0,co.jsx)(li,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,co.jsx)("li",{children:"--"})})(),t.length>3&&(0,co.jsx)("li",{className:Eq.link,children:(0,co.jsx)(li,{to:`${window.spaBase}/home/patient-lists`,children:aL("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},EX=({patientId:e})=>{let{patient:t,isLoading:n}=uU(e),r=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return n?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("p",{className:Eq.heading,children:aL("address","Address")}),(0,co.jsx)("ul",{children:r?Object.entries(r).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?r.extension?.[0]?.extension?.map((t,n)=>(0,co.jsxs)("li",{children:[aL(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,co.jsxs)("li",{children:[aL(e,e),": ",t]},`address-${e}`)):(0,co.jsx)("li",{children:"--"})})]})},EQ=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=ur({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:r,isLoading:a}=(e=>{let{data:t,error:n,isLoading:r}=us()(`${aJ}/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)))`,a1);return{isLoading:r,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,lr.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:a,error:r}})(e),r=(0,lr.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?aL(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("p",{className:Eq.heading,children:aL("contactDetails","Contact Details")}),t?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsx)("ul",{children:r.length?r.map(([e,t],n)=>(0,co.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,co.jsx)("li",{children:"--"})})]})},E0=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${aJ}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:n,error:r,isLoading:a,isValidating:o}=lL()(e?t:null,a1),i=n?.data?.results?.length?function(e,t){let n=[];for(let r of t)e===r.personA.uuid?n.push({uuid:`${r.uuid}`,display:r.personB.display,relativeAge:r.personB.age,relativeUuid:r.personB.uuid,relationshipType:r.relationshipType.bIsToA}):n.push({uuid:`${r.uuid}`,display:r.personA.display,relativeAge:r.personA.age,relativeUuid:r.personA.uuid,relationshipType:r.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?i:null,error:r,isLoading:a,isValidating:o}}(e);return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)("p",{className:Eq.heading,children:aL("relationships","Relationships")}),n?(0,co.jsx)(cm.InlineLoading,{description:`${aL("loading","Loading")} ...`,role:"progressbar"}):(0,co.jsx)("ul",{children:t&&t.length>0?(0,co.jsx)(co.Fragment,{children:t.map(e=>(0,co.jsxs)("li",{className:Eq.relationship,children:[(0,co.jsx)("div",{children:(0,co.jsx)(li,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,co.jsx)("div",{children:e.relationshipType}),(0,co.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?aL("yearAbbreviation","yr"):aL("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,co.jsx)("li",{children:"--"})})]})};function E1({patientId:e,deceased:t}){return(0,co.jsxs)("div",{className:cs()(Eq.contactDetails,{[Eq.deceased]:t}),children:[(0,co.jsxs)("div",{className:Eq.row,children:[(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(EX,{patientId:e})}),(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(EQ,{patientUuid:e})})]}),(0,co.jsxs)("div",{className:Eq.row,children:[(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(E0,{patientId:e})}),(0,co.jsx)("div",{className:Eq.col,children:(0,co.jsx)(EJ,{patientUuid:e})})]})]})}function E4(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),r=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>r.forEach(e=>e.remove())}return()=>{}}let E2="-esm-form-engine__action-menu2-module__container___5s3CM";function E3({workspaceGroup:e,groupProps:t}){let n=uR(),{persistence:r}=e;return(0,co.jsx)("aside",{className:"-esm-form-engine__action-menu2-module__sideRail___qwAz4",children:(0,co.jsxs)("div",{className:E2,children:["closable"==r&&uO(n)&&(0,co.jsx)(cm.IconButton,{align:"left",onClick:()=>Eo(),label:aL("close"),kind:"ghost",children:(0,co.jsx)(cZ,{})}),(0,co.jsx)(lo.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,co.jsx)(lx,{className:E2,name:e.name,state:{groupProps:t}})})]})})}function E6(e){let t=new URL(e,window.location.origin).pathname,n=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,r=n.endsWith("/")?n.slice(0,-1):n,a=null;return r?r===t?a="/":t.startsWith(`${r}/`)&&(a=t.slice(r.length)):a=t,{full:t,spaRelative:a}}function E5(e){e&&(0,lD.createRoot)(e).render((0,co.jsx)(E9,{}))}function E9(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=Ey();if((0,lr.useEffect)(()=>il("before-page-changed",t=>{let{newPage:r,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(r)return void a(Eo().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),a=E6(t),o=E6(n);if(null===a.spaRelative||null===o.spaRelative)return!0;let i=r.exec(a.spaRelative),s=r.exec(o.spaRelative);if(i&&s||(i=r.exec(a.full),s=r.exec(o.full)),!i||!s)return!0;if(i.length>1)return!i.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,o,i)&&a(Eo().then(e=>!e))}),[e,n]),!e)return null;let a=n[e.groupName],o=t.some(e=>e.maximized),{name:i}=a,s=Object.values(r).filter(e=>e.group===i&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,co.jsxs)("div",{className:cs()("-esm-form-engine__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___gN2f4",{"-esm-form-engine__workspace-windows-and-menu-module__overlay___fqI+X":a.overlay,"-esm-form-engine__workspace-windows-and-menu-module__hasMaximizedWindow___J7wBw":o}),children:[(0,co.jsx)("div",{className:"-esm-form-engine__workspace-windows-and-menu-module__workspaceWindowsContainer___zpk7G",children:t.map(t=>(0,co.jsx)(E8,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,co.jsx)(E3,{workspaceGroup:a,groupProps:e.props})]})}function E8({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:r}=e,a=(0,lr.useMemo)(()=>({closeWorkspace(e){sX.setState(t=>Eg.closeWorkspace(t,e))},openChildWorkspace(e,t,n){sX.setState(r=>Eg.openChildWorkspace(r,e,t,n))},setWorkspaceTitle(e,t){sX.setState(n=>Eg.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){sX.setState(n=>Eg.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=sX.getState().openedWindows.find(e=>e.windowName===r);return t?Ed(t,e):Promise.resolve(!0)}}),[r]);return(0,co.jsx)(EB,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:n})}function E7(e,t,n){if(null==e)return n;let r=b_(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let a=[];for(let e of t){let t=b_(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}a.push({canonical:t,original:e})}let o=r;for(;o;){let e=a.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",n=a.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===o){o="fr-HT";continue}let r=o.lastIndexOf("-");if(-1===r)break;let i=(o=o.slice(0,r)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return n}function _e(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function _t(e){return!!e&&e.constructor===Object}var _n=n(7229);function _r(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function _a(e,t){return _n(function(e){let t=e.indexOf("-");if(t>=0){let n=_r(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return _r(e)}(t),e,{includePrerelease:!0})}async function _o(e,t={}){let n,{shouldRetry:r,getDelay:a,onError:o}=t;r=r??(e=>e<=5),a=a??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await _i(a(i)),await e()}catch(e){o?.(e,i),n=e}while(r(i++));throw n}async function _i(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function _s(e,t,n,r){}function _l(e){}function _u(e){return Promise.resolve([])}function _c(e){return Promise.resolve([])}function _d(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function _m(e){return()=>{}}function _p(){return!0}}}]);