@openmrs/esm-patient-immunizations-app 13.0.2-pre.12921 → 13.0.2-pre.12934
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/4163.js
CHANGED
|
@@ -12,8 +12,8 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
|
|
|
12
12
|
${t}`)}return r}let nj=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let r=n[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=a._default);let e=a._elements;if(r&&nL(e)){if(a._type===tU.Array&&Array.isArray(r)){let a=r.map(t=>nj(e,t));n[t]=a}else if(a._type===tU.Object)for(let t of Object.keys(r))r[t]=nj(e,r[t])}}else if(nF(a)){let e=r??{};nF(e)&&(n[t]=nj(a,e))}}return n};function nL(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function nF(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function nB(e,t){let n=`${e}:::${t}`;nu.has(n)||(console.error(t),nu.add(n))}function nV(e){e?nu.forEach(t=>{t.startsWith(e)&&nu.delete(t)}):nu.clear()}function nU(){nl.forEach(e=>e()),nl.length=0,nf.clear(),nC.clear(),nP.clear(),nk.clear(),nc=null,nd=new WeakMap,nm()}let nz={"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:tU.Object,_default:{},_validators:[tz(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let t=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${t.join(", ")}.`})]}},nW={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:tU.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:tU.String,_default:void 0}},...nz},nH=(e,t)=>tz(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),nK=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return tz(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,r=n.exec(e);for(;r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},nG=nK([]),nZ=e=>tz(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),nY={inRange:nH,isUrl:nG,isUrlWithTemplateParameters:nK,oneOf:nZ};var nq=n(2034);let nJ=V("breadcrumbs",[]);function nX(e){return nQ([e])}function nQ(e){let t=[...n0(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,nq.pathToRegexp)(e.matcher).regexp:(0,nq.pathToRegexp)(e.path).regexp,settings:e}))];nJ.setState(t,!0)}function n0(){return nJ.getState()}function n1(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=n1(e,n.join("/"));if(t)return t}}(e,t)}function n4(e,t){if(e.length>0){let n=n1(e,t);if(n){let t=[n],r=n1(e,n.settings.parent);for(;void 0!==r;)t.push(r),r=n1(e,r.settings.parent);return t.reverse()}}return[]}function n2(e){return n4(n0(),e)}var n3=Object.freeze({__proto__:null,get start(){return av},get ensureJQuerySupport(){return r2},get setBootstrapMaxTime(){return rL},get setMountMaxTime(){return rF},get setUnmountMaxTime(){return rB},get setUnloadMaxTime(){return rV},get registerApplication(){return aa},get unregisterApplication(){return ai},get getMountedApps(){return ae},get getAppStatus(){return an},get unloadApplication(){return as},get checkActivityFunctions(){return ao},get getAppNames(){return at},get pathToActiveWhen(){return ac},get navigateToUrl(){return rZ},get patchHistoryApi(){return r0},get triggerAppChange(){return af},get addErrorHandler(){return n7},get removeErrorHandler(){return re},get mountRootParcel(){return rN},get NOT_LOADED(){return rr},get LOADING_SOURCE_CODE(){return ra},get NOT_BOOTSTRAPPED(){return ro},get BOOTSTRAPPING(){return ri},get NOT_MOUNTED(){return rs},get MOUNTING(){return rl},get UPDATING(){return rc},get LOAD_ERROR(){return rp},get MOUNTED(){return ru},get UNLOADING(){return rm},get UNMOUNTING(){return rd},get SKIP_BECAUSE_BROKEN(){return rf}}),n6=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,n5=!function(){try{var e=new n6("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?"u">typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=!!t.bubbles,n.cancelable=!!t.cancelable,n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}:n6;let n9=[];function n8(e,t,n){let r=rn(e,t,n);n9.length?n9.forEach(e=>e(r)):setTimeout(()=>{throw r})}function n7(e){if("function"!=typeof e)throw Error(rt(28,!1));n9.push(e)}function re(e){if("function"!=typeof e)throw Error(rt(29,!1));let t=!1;return n9=n9.filter(n=>{let r=n===e;return t=t||r,!r}),t}function rt(e,t,...n){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${n.length?`&arg=${n.join("&arg=")}`:""}`}function rn(e,t,n){let r,a=`${rb(t)} '${ry(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=a+e.message}catch(e){}r=e}else{console.warn(rt(30,!1,t.status,ry(t)));try{r=Error(a+JSON.stringify(e))}catch(t){r=e}}return r.appOrParcelName=ry(t),t.status=n,r}let rr="NOT_LOADED",ra="LOADING_SOURCE_CODE",ro="NOT_BOOTSTRAPPED",ri="BOOTSTRAPPING",rs="NOT_MOUNTED",rl="MOUNTING",ru="MOUNTED",rc="UPDATING",rd="UNMOUNTING",rm="UNLOADING",rp="LOAD_ERROR",rf="SKIP_BECAUSE_BROKEN";function rh(e){return e.status===ru}function rg(e){try{return e.activeWhen(window.location)}catch(t){return n8(t,e,rf),!1}}function ry(e){return e.name}function rv(e){return!!e.unmountThisParcel}function rb(e){return rv(e)?"parcel":"application"}function rw(){for(let e=arguments.length-1;e>0;e--)for(let t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function rE(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function rx(e){return e&&("function"==typeof e||Array.isArray(e)&&!rE(e,e=>"function"!=typeof e))}function rD(e,t){let n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[()=>Promise.resolve()]);let r=rb(e),a=ry(e);return function(e){return n.reduce((n,o,i)=>n.then(()=>{let n=o(e);return rS(n)?n:Promise.reject(rt(15,!1,r,a,t,i))}),Promise.resolve())}}function rS(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let r_=[];function rC(e,t){return Promise.resolve().then(()=>e.status!==ro?e:(e.status=ri,e.bootstrap?rU(e,"bootstrap").then(n).catch(n=>{if(t)throw rn(n,e,rf);return n8(n,e,rf),e}):Promise.resolve().then(n)));function n(){return e.status=rs,e}}function rk(e,t){return Promise.resolve().then(()=>{if(e.status!==ru)return e;return e.status=rd,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(n,r=>n().then(()=>{let n=Error(r.message);if(t)throw rn(n,e,rf);n8(n,e,rf)})).then(()=>e);function n(){return rU(e,"unmount").then(()=>{e.status=rs},n=>{if(t)throw rn(n,e,rf);n8(n,e,rf)})}})}let rP=!1,rR=!1;function rT(e,t){return Promise.resolve().then(()=>e.status!==rs?e:(rP||(window.dispatchEvent(new n5("single-spa:before-first-mount")),rP=!0),e.status=rl,rU(e,"mount").then(()=>(e.status=ru,rR||(window.dispatchEvent(new n5("single-spa:first-mount")),rR=!0),e)).catch(n=>{return e.status=ru,rk(e,!0).then(r,r);function r(){if(t)throw rn(n,e,rf);return n8(n,e,rf),e}})))}let rO=0,r$={parcels:{}};function rN(){return rA.apply(r$,arguments)}function rA(e,t){let n,r,a,o=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(rt(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(rt(3,!1,typeof e.name));let i=rO++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(rt(4,!1,s,typeof t));if(!t.domElement)throw Error(rt(5,!1,s));let l="function"==typeof e,u=l?e:()=>Promise.resolve(e),c={id:i,parcels:{},status:l?ra:ro,customProps:t,parentName:ry(o),unmountThisParcel:()=>p.then(()=>{if(c.status!==ru)throw Error(rt(6,!1,s,c.status));return rk(c,!0)}).then(e=>(c.parentName&&delete o.parcels[c.id],e)).then(e=>(r(e),e)).catch(e=>{throw c.status=rf,a(e),e})};o.parcels[i]=c;let d=u();if(!d||"function"!=typeof d.then)throw Error(rt(7,!1));let m=(d=d.then(e=>{if(!e)throw Error(rt(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!rx(e.bootstrap))throw Error(rt(9,!1,s));if(!rx(e.mount))throw Error(rt(10,!1,s));if(!rx(e.unmount))throw Error(rt(11,!1,s));if(e.update&&!rx(e.update))throw Error(rt(12,!1,s));let t=rD(e,"bootstrap"),r=rD(e,"mount"),a=rD(e,"unmount");c.status=ro,c.name=s,c.bootstrap=t,c.mount=r,c.unmount=a,c.timeouts=rz(e.timeouts),e.update&&(c.update=rD(e,"update"),n.update=function(e){return c.customProps=e,rI(Promise.resolve().then(()=>{if(c.status!==ru)throw Error(rt(32,!1,ry(c)));return c.status=rc,rU(c,"update").then(()=>(c.status=ru,c)).catch(e=>{throw rn(e,c,rf)})}))})})).then(()=>rC(c,!0)),p=m.then(()=>rT(c,!0)),f=new Promise((e,t)=>{r=e,a=t});return n={mount:()=>rI(Promise.resolve().then(()=>{if(c.status!==rs)throw Error(rt(13,!1,s,c.status));return o.parcels[i]=c,rT(c)})),unmount:()=>rI(c.unmountThisParcel()),getStatus:()=>c.status,loadPromise:rI(d),bootstrapPromise:rI(m),mountPromise:rI(p),unmountPromise:rI(f)}}function rI(e){return e.then(()=>null)}function rM(e){let t=ry(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(rt(40,!1),t,n));let r=rw({},n,{name:t,mountParcel:rA.bind(e),singleSpa:n3});return rv(e)&&(r.unmountSelf=e.unmountThisParcel),r}let rj={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function rL(e,t,n){if("number"!=typeof e||e<=0)throw Error(rt(16,!1));rj.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rF(e,t,n){if("number"!=typeof e||e<=0)throw Error(rt(17,!1));rj.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rB(e,t,n){if("number"!=typeof e||e<=0)throw Error(rt(18,!1));rj.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rV(e,t,n){if("number"!=typeof e||e<=0)throw Error(rt(19,!1));rj.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rU(e,t){let n=e.timeouts[t],r=n.warningMillis,a=rb(e);return new Promise((o,i)=>{let s=!1,l=!1;e[t](rM(e)).then(e=>{s=!0,o(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>c(1),r),setTimeout(()=>c(!0),n.millis);let u=rt(31,!1,t,a,ry(e),n.millis);function c(e){s||(!0===e?(l=!0,n.dieOnTimeout?i(Error(u)):console.error(u)):!l&&(console.warn(u),e*r+r<n.millis&&setTimeout(()=>c(e+1),r)))}})}function rz(e){let t={};for(let n in rj)t[n]=rw({},rj[n],e&&e[n]||{});return t}function rW(e){return Promise.resolve().then(()=>{let t,n;return e.loadPromise?e.loadPromise:e.status!==rr&&e.status!==rp?e:(e.status=ra,e.loadPromise=Promise.resolve().then(()=>{let r=e.loadApp(rM(e));if(!rS(r))throw n=!0,Error(rt(33,!1,ry(e)));return r.then(n=>{let r;e.loadErrorTime=null,"object"!=typeof(t=n)&&(r=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!rx(t.bootstrap)&&(r=35),rx(t.mount)||(r=36),rx(t.unmount)||(r=37);let a=rb(t);if(r){let n;try{n=JSON.stringify(t)}catch(e){}return console.error(rt(r,!1,a,ry(e),n),t),n8(void 0,e,rf),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=rw({},e.devtools.overlays,t.devtools.overlays)),e.status=ro,e.bootstrap=rD(t,"bootstrap"),e.mount=rD(t,"mount"),e.unmount=rD(t,"unmount"),e.unload=rD(t,"unload"),e.timeouts=rz(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let r;return delete e.loadPromise,n?r=rf:(r=rp,e.loadErrorTime=(new Date).getTime()),n8(t,e,r),e}))})}let rH="u">typeof window,rK={hashchange:[],popstate:[]},rG=["hashchange","popstate"];function rZ(e){let t;if("string"==typeof e)t=e;else if(this&&this.href)t=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(rt(14,!1));t=e.currentTarget.href,e.preventDefault()}let n=r1(window.location.href),r=r1(t);0===t.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=t:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,t)}function rY(e){if(e){let t=e[0].type;rG.indexOf(t)>=0&&rK[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function rq(){ah([],arguments)}function rJ(e,t){return function(){let n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return a&&n===o||window.dispatchEvent(function(e,t){let n;try{n=new PopStateEvent("popstate",{state:e})}catch(t){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return n.singleSpa=!0,n.singleSpaTrigger=t,n}(window.history.state,t)),r}}let rX=null,rQ=!1;function r0(e){if(rQ)throw Error(rt(43,!1));a=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,rQ=!0,rX=window.history.replaceState,window.addEventListener("hashchange",rq),window.addEventListener("popstate",rq);let t=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(e,n){if(!("function"==typeof n&&rG.indexOf(e)>=0)||rE(rK[e],e=>e===n))return t.apply(this,arguments);rK[e].push(n)},window.removeEventListener=function(e,t){return"function"==typeof t&&rG.indexOf(e)>=0&&(rK[e]=rK[e].filter(e=>e!==t)),n.apply(this,arguments)},window.history.pushState=rJ(window.history.pushState,"pushState"),window.history.replaceState=rJ(rX,"replaceState")}function r1(e){let t=document.createElement("a");return t.href=e,t}rH&&(window.singleSpaNavigate?console.warn(rt(41,!1)):window.singleSpaNavigate=rZ);let r4=!1;function r2(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!r4){let t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return r3.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return r3.call(this,n,window.removeEventListener,e,t,arguments)},r4=!0}}function r3(e,t,n,r,a){return"string"!=typeof n?e.apply(this,a):(n.split(/\s+/).forEach(e=>{rG.indexOf(e)>=0&&(t(e,r),n=n.replace(e,""))}),""===n.trim()?this:e.apply(this,a))}let r6={};function r5(e){return Promise.resolve().then(()=>{let t=r6[ry(e)];if(!t)return e;if(e.status===rr)return r9(e,t),e;if(e.status===rm)return t.promise.then(()=>e);if(e.status!==rs&&e.status!==rp)return e;let n=e.status===rp?Promise.resolve():rU(e,"unload");return e.status=rm,n.then(()=>(r9(e,t),e)).catch(n=>(delete r6[ry(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,n8(n,e,rf),t.reject(n),e))})}function r9(e,t){delete r6[ry(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=rr,t.resolve()}function r8(e,t,n,r){r6[ry(e)]={app:e,resolve:n,reject:r},Object.defineProperty(r6[ry(e)],"promise",{get:t})}let r7=[];function ae(){return r7.filter(rh).map(ry)}function at(){return r7.map(ry)}function an(e){let t=rE(r7,t=>ry(t)===e);return t?t.status:null}let ar=!1;function aa(e,t,n,r){var a,o;let i,s,l=(i={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(rt(39,!1));let t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((e,n)=>t.indexOf(n)>=0?e:e.concat(n),[]);if(0!==n.length)throw Error(rt(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(rt(20,!1));let r=e=>"string"==typeof e||"function"==typeof e;if(!(r(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(r)))throw Error(rt(24,!1));if(!au(e.customProps))throw Error(rt(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,r){if("string"!=typeof e||0===e.length)throw Error(rt(20,!1));if(!t)throw Error(rt(23,!1));if("function"!=typeof n)throw Error(rt(24,!1));if(!au(r))throw Error(rt(22,!1))}(e,t,n,r),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(a=i.loadApp)?()=>Promise.resolve(a):a,i.customProps=i.customProps||{},s=(s=Array.isArray(o=i.activeWhen)?o:[o]).map(e=>"function"==typeof e?e:ac(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(ay||ar||(ar=!0,setTimeout(()=>{ay||console.warn(rt(1,!1))},5e3)),-1!==at().indexOf(l.name))throw Error(rt(21,!1,l.name));r7.push(rw({loadErrorTime:null,status:rr,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),rH&&(r2(),ah())}function ao(e=window.location){return r7.filter(t=>t.activeWhen(e)).map(ry)}function ai(e){if(0===r7.filter(t=>ry(t)===e).length)throw Error(rt(25,!1,e));return(rH?as(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=r7.map(ry).indexOf(e);r7.splice(t,1)})}function as(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(rt(26,!1));let n=rE(r7,t=>ry(t)===e);if(!n)throw Error(rt(27,!1,e));let r=r6[ry(n)];if(t&&t.waitForUnmount){if(r)return r.promise;{let e=new Promise((t,r)=>{r8(n,()=>e,t,r)});return e}}{let e;return r?(e=r.promise,al(n,r.resolve,r.reject)):e=new Promise((t,r)=>{r8(n,()=>e,t,r),al(n,t,r)}),e}}function al(e,t,n){Promise.resolve().then(()=>{if(rE(ao(),t=>t===ry(e)))return af()}).then(()=>rk(e).then(r5).then(()=>{t(),setTimeout(()=>{ah()})})).catch(n)}function au(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function ac(e,t){let n=function(e,t){let n=0,r=!1,a="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let n=e[t],a=r&&"/"===n;(!r&&":"===n||a)&&o(t)}return o(e.length),RegExp(a,"i");function o(o){let i=e.slice(n,o).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(a+=r?"[^/]+/?":i,o===e.length)if(r)t&&(a+="$");else{let e=t?"":".*";a="/"===a.charAt(a.length-1)?`${a}${e}$`:`${a}(/${e})?(#.*)?$`}r=!r,n=o}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let r=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(r)}}let ad=!1,am=[],ap=rH&&window.location.href;function af(){return ah()}function ah(e=[],t,n=!1){let r,a,o,i,s;if(ad)return new Promise((e,n)=>{am.push({resolve:e,reject:n,eventArguments:t})});let{appsToUnload:l,appsToUnmount:u,appsToLoad:c,appsToMount:d}=(r=[],a=[],o=[],i=[],s=(new Date).getTime(),r7.forEach(e=>{let t=e.status!==rf&&rg(e);switch(e.status){case rp:t&&s-e.loadErrorTime>=200&&o.push(e);break;case rr:case ra:t&&o.push(e);break;case ro:case rs:!t&&r6[ry(e)]?r.push(e):t&&i.push(e);break;case ru:t||a.push(e)}}),{appsToUnload:r,appsToUnmount:a,appsToLoad:o,appsToMount:i}),m,p=[],f=ap,h=ap=window.location.href;return ay?(ad=!0,m=l.concat(c,u,d),Promise.resolve().then(()=>(w(0===m.length?"before-no-app-change":"before-app-change",b(!0)),w("before-routing-event",b(!0,{cancelNavigation:g})),Promise.all(p).then(n=>{if(n.some(e=>e))return rX.call(window.history,history.state,"",f.substring(location.origin.length)),ap=location.href,ad=!1,ah(e,t,!0);let r=l.map(r5),a=Promise.all(u.map(rk).map(e=>e.then(r5)).concat(r));a.then(()=>{w("before-mount-routing-event",b(!0))},e=>{throw e});let o=c.map(e=>rW(e).then(e=>ag(e,a))),i=d.filter(e=>0>c.indexOf(e)).map(e=>ag(e,a));return a.catch(e=>{throw v(),e}).then(()=>(v(),Promise.all(o.concat(i)).catch(t=>{throw e.forEach(e=>e.reject(t)),t}).then(y).then(()=>{},e=>{throw e})))})))):(m=c,Promise.resolve().then(()=>Promise.all(c.map(rW)).then(v).then(()=>[]).catch(e=>{throw v(),e}).finally(()=>{})));function g(e=!0){let t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);p.push(t.catch(e=>(console.warn(Error(rt(42,!1))),console.warn(e),!1)))}function y(){let t=ae();e.forEach(e=>e.resolve(t));try{w(0===m.length?"no-app-change":"app-change",b()),w("routing-event",b())}catch(e){setTimeout(()=>{throw e})}if(ad=!1,am.length>0){let e=am;am=[],ah(e)}return t}function v(){n||(e.forEach(e=>{rY(e.eventArguments)}),rY(t))}function b(e=!1,n){let r={},a={[ru]:[],[rs]:[],[rr]:[],[rf]:[]};e?(c.concat(d).forEach((e,t)=>{i(e,ru)}),l.forEach(e=>{i(e,rr)}),u.forEach(e=>{i(e,rs)})):m.forEach(e=>{i(e)});let o={detail:{newAppStatuses:r,appsByNewStatus:a,totalAppChanges:m.length,originalEvent:null==t?void 0:t[0],oldUrl:f,newUrl:h}};return n&&rw(o.detail,n),o;function i(e,t){let n=ry(e);t=t||an(n),r[n]=t,(a[t]=a[t]||[]).push(n)}}function w(e,t){n||window.dispatchEvent(new n5(`single-spa:${e}`,t))}}function ag(e,t){return rg(e)?rC(e).then(e=>t.then(()=>rg(e)?rT(e):e)):t.then(()=>e)}let ay=!1;function av(e){ay=!0,rH&&(r0(e),ah())}rH&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...r7]},reroute:ah,NOT_LOADED:rr,toLoadPromise:rW,toBootstrapPromise:rC,unregisterApplication:ai,getProfilerData:function(){return r_}});let ab={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",applicationError:"Application Error",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",clearDevOverrides:"Clear dev overrides",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",copied:"Copied!",copyToClipboard:"Copy to clipboard",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",navigateNonHttp:"Could not navigate to the requested page as it is not a safe URL",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",provisional:"Provisional",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",reload:"Reload",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",serverStartingUp:"The server is starting",serverStartingUpExplainer:"This can take a few minutes. OpenMRS will open automatically when the server is ready.",serverStartingUpSlowExplainer:"This is taking longer than usual. First startup after an upgrade can take 10 minutes or more. You can leave this page open.",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",somethingWentWrongTryReloading:"Something went wrong. Please try reloading.",toggleDevTools:"Toggle dev tools",unknown:"Unknown",viewSetupProgress:"View setup progress",waitingForServer:"Waiting for the server",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},aw=e=>"string"==typeof e,aE=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ax=e=>null==e?"":""+e,aD=/###/g,aS=e=>e&&e.indexOf("###")>-1?e.replace(aD,"."):e,a_=e=>!e||aw(e),aC=(e,t,n)=>{let r=aw(t)?t.split("."):t,a=0;for(;a<r.length-1;){if(a_(e))return{};let t=aS(r[a]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return a_(e)?{}:{obj:e,k:aS(r[a])}},ak=(e,t,n)=>{let{obj:r,k:a}=aC(e,t,Object);if(void 0!==r||1===t.length){r[a]=n;return}let o=t[t.length-1],i=t.slice(0,t.length-1),s=aC(e,i,Object);for(;void 0===s.obj&&i.length;)o=`${i[i.length-1]}.${o}`,s=aC(e,i=i.slice(0,i.length-1),Object),s?.obj&&void 0!==s.obj[`${s.k}.${o}`]&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=n},aP=(e,t)=>{let{obj:n,k:r}=aC(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},aR=(e,t,n)=>{for(let r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?aw(e[r])||e[r]instanceof String||aw(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):aR(e[r],t[r],n):e[r]=t[r]);return e};var aT={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};let aO=e=>aw(e)?e.replace(/[&<>"'\/]/g,e=>aT[e]):e,a$=[" ",",","?","!",";"],aN=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(void 0!==t)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),aA=(e,t,n=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}let r=t.split(n),a=e;for(let e=0;e<r.length;){let t;if(!a||"object"!=typeof a)return;let o="";for(let i=e;i<r.length;++i)if(i!==e&&(o+=n),o+=r[i],void 0!==(t=a[o])){if(["string","number","boolean"].indexOf(typeof t)>-1&&i<r.length-1)continue;e+=i-e+1;break}a=t}return a},aI=e=>e?.replace("_","-"),aM={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class aj{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||aM,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(aw(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new aj(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new aj(this.logger,e)}}var aL=new aj;class aF{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t)return void delete this.observers[e];this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([n,r])=>{for(let a=0;a<r;a++)n.apply(n,[e,...t])})}}class aB extends aF{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let a,o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],n&&(Array.isArray(n)?a.push(...n):aw(n)&&o?a.push(...n.split(o)):a.push(n)));let s=aP(this.data,a);return(!s&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),!s&&i&&aw(n))?aA(this.data?.[e]?.[t],n,o):s}addResource(e,t,n,r,a={silent:!1}){let o=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,i=[e,t];n&&(i=i.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(i=e.split("."),r=t,t=i[1]),this.addNamespaces(t),ak(this.data,i,r),a.silent||this.emit("added",e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(aw(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,a,o={silent:!1,skipCopy:!1}){let i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),r=n,n=t,t=i[1]),this.addNamespaces(t);let s=aP(this.data,i)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?aR(s,n,a):s={...s,...n},ak(this.data,i,s),o.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var aV={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,a)??t}),t}};let aU=Symbol("i18next/PATH_KEY");function az(e,t){let n,r,a,{[aU]:o}=e((r=[],(a=Object.create(null)).get=(e,t)=>(n?.revoke?.(),t===aU)?r:(r.push(t),(n=Proxy.revocable(e,a)).proxy),Proxy.revocable(Object.create(null),a).proxy));return o.join(t?.keySeparator??".")}let aW={},aH=e=>!aw(e)&&"boolean"!=typeof e&&"number"!=typeof e;class aK extends aF{constructor(e,t={}){super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=aL.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(null==e)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let a=aH(r.res);return!1!==n.returnObjects||!a}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");let r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,i=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!((e,t,n)=>{t=t||"",n=n||"";let r=a$.filter(e=>0>t.indexOf(e)&&0>n.indexOf(e));if(0===r.length)return!0;let a=aN.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`),o=!a.test(e);if(!o){let t=e.indexOf(n);t>0&&!a.test(e.substring(0,t))&&(o=!0)}return o})(e,n,r);if(o&&!i){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:aw(a)?[a]:a};let o=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(r)}return{key:e,namespaces:aw(a)?[a]:a}}translate(e,t,n){let r="object"==typeof t?{...t}:t;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=az(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);let a=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:i,namespaces:s}=this.extractFromKey(e[e.length-1],r),l=s[s.length-1],u=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===u&&(u=":");let c=r.lng||this.language,d=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c?.toLowerCase()==="cimode")return d?a?{res:`${l}${u}${i}`,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${u}${i}`:a?{res:i,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:i;let m=this.resolve(e,r),p=m?.res,f=m?.usedKey||i,h=m?.exactUsedKey||i,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,v=void 0!==r.count&&!aw(r.count),b=aK.hasDefaultValue(r),w=v?this.pluralResolver.getSuffix(c,r.count,r):"",E=r.ordinal&&v?this.pluralResolver.getSuffix(c,r.count,{ordinal:!1}):"",x=v&&!r.ordinal&&0===r.count,D=x&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${w}`]||r[`defaultValue${E}`]||r.defaultValue,S=p;y&&!p&&b&&(S=D);let _=aH(S),C=Object.prototype.toString.apply(S);if(y&&S&&_&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(C)&&!(aw(g)&&Array.isArray(S))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,S,{...r,ns:s}):`key '${i} (${this.language})' returned an object instead of string.`;return a?(m.res=e,m.usedParams=this.getUsedParamsDetails(r),m):e}if(o){let e=Array.isArray(S),t=e?[]:{},n=e?h:f;for(let e in S)if(Object.prototype.hasOwnProperty.call(S,e)){let a=`${n}${o}${e}`;b&&!p?t[e]=this.translate(a,{...r,defaultValue:aH(D)?D[e]:void 0,...{joinArrays:!1,ns:s}}):t[e]=this.translate(a,{...r,joinArrays:!1,ns:s}),t[e]===a&&(t[e]=S[e])}p=t}}else if(y&&aw(g)&&Array.isArray(p))(p=p.join(g))&&(p=this.extendTranslation(p,e,r,n));else{let t=!1,a=!1;!this.isValidLookup(p)&&b&&(t=!0,p=D),this.isValidLookup(p)||(a=!0,p=i);let s=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:p,d=b&&D!==p&&this.options.updateMissing;if(a||t||d){if(this.logger.log(d?"updateKey":"missingKey",c,l,i,d?D:p),o){let e=this.resolve(i,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(r.lng||this.language):e.push(r.lng||this.language);let n=(e,t,n)=>{let a=b&&n!==p?n:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,a,d,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,a,d,r),this.emit("missingKey",e,l,t,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,r);x&&r[`defaultValue${this.options.pluralSeparator}zero`]&&0>t.indexOf(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],i+t,r[`defaultValue${t}`]||D)})}):n(e,i,D))}p=this.extendTranslation(p,e,r,m,n),a&&p===i&&this.options.appendNamespaceToMissingKey&&(p=`${l}${u}${i}`),(a||t)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${i}`:i,t?p:void 0,r))}return a?(m.res=p,m.usedParams=this.getUsedParamsDetails(r),m):p}extendTranslation(e,t,n,r,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){let o;n.interpolation&&this.interpolator.init({...n,...{interpolation:{...this.options.interpolation,...n.interpolation}}});let i=aw(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(i){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!aw(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),i){let t=e.match(this.interpolator.nestingRegexp);o<(t&&t.length)&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(...e)=>a?.[0]!==e[0]||n.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,i=aw(o)?[o]:o;return null!=e&&i?.length&&!1!==n.applyPostProcessor&&(e=aV.handle(i,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,a,o,i;return aw(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),l=s.key;r=l;let u=s.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let c=void 0!==t.count&&!aw(t.count),d=c&&!t.ordinal&&0===t.count,m=void 0!==t.context&&(aw(t.context)||"number"==typeof t.context)&&""!==t.context,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);u.forEach(e=>{this.isValidLookup(n)||(i=e,!aW[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(i)&&(aW[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(r=>{let i;if(this.isValidLookup(n))return;o=r;let s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,r,e,t);else{let e;c&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(t.ordinal&&0===e.indexOf(a)&&s.push(l+e.replace(a,this.options.pluralSeparator)),s.push(l+e),d&&s.push(l+n)),m){let r=`${l}${this.options.contextSeparator||"_"}${t.context}`;s.push(r),c&&(t.ordinal&&0===e.indexOf(a)&&s.push(r+e.replace(a,this.options.pluralSeparator)),s.push(r+e),d&&s.push(r+n))}}for(;i=s.pop();)this.isValidLookup(n)||(a=i,n=this.getResource(r,e,i,t))}))})}),{res:n,usedKey:r,exactUsedKey:a,usedLng:o,usedNS:i}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=e.replace&&!aw(e.replace),n=t?e.replace:e;if(t&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!t)for(let e of(n={...n},["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"]))delete n[e];return n}static hasDefaultValue(e){let t="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}class aG{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=aL.create("languageUtils")}getScriptPartFromCode(e){if(!(e=aI(e))||0>e.indexOf("-"))return null;let t=e.split("-");return 2===t.length||(t.pop(),"x"===t[t.length-1].toLowerCase())?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(!(e=aI(e))||0>e.indexOf("-"))return e;let t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(aw(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)?t:this.options.lowerCaseLng?e.toLowerCase():e}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){let t;return e?(e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(0>e.indexOf("-")&&0>r.indexOf("-"))&&(e.indexOf("-")>0&&0>r.indexOf("-")&&e.substring(0,e.indexOf("-"))===r||0===e.indexOf(r)&&r.length>1))return e})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),aw(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),r=[],a=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return aw(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&a(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&a(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&a(this.getLanguagePartFromCode(e))):aw(e)&&a(this.formatLanguageCode(e)),n.forEach(e=>{0>r.indexOf(e)&&a(this.formatLanguageCode(e))}),r}}let aZ={zero:0,one:1,two:2,few:3,many:4,other:5},aY={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class aq{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=aL.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n,r=aI("dev"===e?"en":e),a=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];try{n=new Intl.PluralRules(r,{type:a})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),aY;if(!e.match(/-|_/))return aY;let r=this.languageUtils.getLanguagePartFromCode(e);n=this.getRule(r,t)}return this.pluralRulesCache[o]=n,n}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return(n||(n=this.getRule("dev",t)),n)?n.resolvedOptions().pluralCategories.sort((e,t)=>aZ[e]-aZ[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}let aJ=(e,t,n,r=".",a=!0)=>{let o,i=void 0!==(o=aP(e,n))?o:aP(t,n);return!i&&a&&aw(n)&&void 0===(i=aA(e,n,r))&&(i=aA(t,n,r)),i};class aX{constructor(e={}){this.logger=aL.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:a,prefixEscaped:o,suffix:i,suffixEscaped:s,formatSeparator:l,unescapeSuffix:u,unescapePrefix:c,nestingPrefix:d,nestingPrefixEscaped:m,nestingSuffix:p,nestingSuffixEscaped:f,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:y}=e.interpolation;this.escape=void 0!==t?t:aO,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=a?a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):o||"{{",this.suffix=i?i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=d?d.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):m||"$t(".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingSuffix=p?p.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):f||")".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingOptionsSeparator=h||",",this.maxReplaces=g||1e3,this.alwaysFormat=void 0!==y&&y,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let a,o,i,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(0>e.indexOf(this.formatSeparator)){let a=aJ(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(a,void 0,n,{...r,...t,interpolationkey:e}):a}let a=e.split(this.formatSeparator),o=a.shift().trim(),i=a.join(this.formatSeparator).trim();return this.format(aJ(t,s,o,this.options.keySeparator,this.options.ignoreJSONStructure),i,n,{...r,...t,interpolationkey:o})};this.resetRegExp();let u=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e.replace(/\$/g,"$$$$")},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e).replace(/\$/g,"$$$$"):e.replace(/\$/g,"$$$$")}].forEach(t=>{for(i=0;a=t.regex.exec(e);){let n=a[1].trim();if(void 0===(o=l(n)))if("function"==typeof u){let t=u(e,a,r);o=aw(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))o="";else if(c){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),o="";else aw(o)||this.useRawValueToEscape||(o=ax(o));let s=t.safeValue(o);if(e=e.replace(a[0],s),c?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,++i>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,a,o,i=(e,t)=>{let n=this.nestingOptionsSeparator;if(0>e.indexOf(n))return e;let r=e.split(RegExp(`${n}[ ]*{`)),a=`{${r[1]}`;e=r[0];let i=(a=this.interpolate(a,o)).match(/'/g),s=a.match(/"/g);((i?.length??0)%2!=0||s)&&s.length%2==0||(a=a.replace(/'/g,'"'));try{o=JSON.parse(a),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${a}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];(o=(o={...n}).replace&&!aw(o.replace)?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;let l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==l&&(s=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),(a=t(i.call(this,r[1].trim(),o),o))&&r[0]===e&&!aw(a))return a;aw(a)||(a=ax(a)),a||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),a=""),s.length&&(a=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),a.trim())),e=e.replace(r[0],a),this.regexp.lastIndex=0}return e}}let aQ=e=>{let t={};return(n,r,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});let i=r+JSON.stringify(o),s=t[i];return s||(s=e(aI(r),a),t[i]=s),s(n)}},a0=e=>(t,n,r)=>e(aI(n),r)(t);class a1{constructor(e={}){this.logger=aL.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";let n=t.cacheInBuiltFormats?aQ:a0;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=aQ(t)}format(e,t,n,r={}){let a=t.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&0>a[0].indexOf(")")&&a.find(e=>e.indexOf(")")>-1)){let e=a.findIndex(e=>e.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,e)].join(this.formatSeparator)}return a.reduce((e,t)=>{let{formatName:a,formatOptions:o}=(e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){let r=e.split("(");t=r[0].toLowerCase().trim();let a=r[1].substring(0,r[1].length-1);"currency"===t&&0>a.indexOf(":")?n.currency||(n.currency=a.trim()):"relativetime"===t&&0>a.indexOf(":")?n.range||(n.range=a.trim()):a.split(";").forEach(e=>{if(e){let[t,...r]=e.split(":"),a=r.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();n[o]||(n[o]=a),"false"===a&&(n[o]=!1),"true"===a&&(n[o]=!0),isNaN(a)||(n[o]=parseInt(a,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[a]){let t=e;try{let i=r?.formatParams?.[r.interpolationkey]||{},s=i.locale||i.lng||r.locale||r.lng||n;t=this.formats[a](e,s,{...o,...r,...i})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${a}`),e},e)}}class a4 extends aF{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=aL.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let a={},o={},i={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let i=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[i]=2:this.state[i]<0||(1===this.state[i]?void 0===o[i]&&(o[i]=!0):(this.state[i]=1,r=!1,void 0===o[i]&&(o[i]=!0),void 0===a[i]&&(a[i]=!0),void 0===s[t]&&(s[t]=!0)))}),r||(i[e]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split("|"),a=r[0],o=r[1];t&&this.emit("failedLoading",a,o,t),!t&&n&&this.store.addResourceBundle(a,o,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let i={};this.queue.forEach(n=>{((e,t,n,r)=>{let{obj:a,k:o}=aC(e,t,Object);a[o]=a[o]||[],a[o].push(n)})(n.loaded,[a],o),void 0!==n.pending[e]&&(delete n.pending[e],n.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{i[e]||(i[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{void 0===i[e][t]&&(i[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,a=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:a,callback:o});this.readingCalls++;let i=(i,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}i&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*a,o)},a):o(i,s)},s=this.backend[n].bind(this.backend);if(2===s.length){try{let n=s(e,t);n&&"function"==typeof n.then?n.then(e=>i(null,e)).catch(i):i(null,n)}catch(e){i(e)}return}return s(e,t,i)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();aw(e)&&(e=this.languageUtils.toResolveHierarchy(e)),aw(t)&&(t=[t]);let a=this.queueLoad(e,t,n,r);if(!a.toLoad.length)return a.pending.length||r(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){let n=e.split("|"),r=n[0],a=n[1];this.read(r,a,"read",void 0,void 0,(n,o)=>{n&&this.logger.warn(`${t}loading namespace ${a} for language ${r} failed`,n),!n&&o&&this.logger.log(`${t}loaded namespace ${a} for language ${r}`,o),this.loaded(e,n,o)})}saveMissing(e,t,n,r,a,o={},i=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t))return void this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");if(null!=n&&""!==n){if(this.backend?.create){let s={...o,isUpdate:a},l=this.backend.create.bind(this.backend);if(l.length<6)try{let a;(a=5===l.length?l(e,t,n,r,s):l(e,t,n,r))&&"function"==typeof a.then?a.then(e=>i(null,e)).catch(i):i(null,a)}catch(e){i(e)}else l(e,t,n,r,i,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}let a2=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),aw(e[1])&&(t.defaultValue=e[1]),aw(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),a3=e=>(aw(e.ns)&&(e.ns=[e.ns]),aw(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),aw(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),a6=()=>{};class a5 extends aF{constructor(e={},t){if(super(),this.options=a3(e),this.services={},this.logger=aL,this.modules={external:[]},(e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{"function"==typeof e[t]&&(e[t]=e[t].bind(e))})})(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(aw(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let n=a2();this.options={...n,...this.options,...a3(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);let r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?aL.init(r(this.modules.logger),this.options):aL.init(null,this.options),e=this.modules.formatter?this.modules.formatter:a1;let t=new aG(this.options);this.store=new aB(this.options.resources,this.options);let a=this.services;a.logger=aL,a.resourceStore=this.store,a.languageUtils=t,a.pluralResolver=new aq(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(a.formatter=r(e),a.formatter.init&&a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new aX(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new a4(r(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(a.languageDetector=r(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=r(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new aK(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=a6),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let a=aE(),o=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),a}loadResources(e,t=a6){let n=t,r=aw(e)?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||0===this.options.preload.length))return n();let e=[],t=t=>{t&&"cimode"!==t&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&0>e.indexOf(t)&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=aE();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=a6),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&aV.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&0>this.languages.indexOf(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=aE();this.emit("languageChanging",e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},a=(a,o)=>{o?this.isLanguageChangingTo===e&&(r(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(a,(...e)=>this.t(...e))},o=t=>{e||t||!this.services.languageDetector||(t=[]);let n=aw(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(aw(t)?[t]:t);o&&(this.language||r(o),this.translator.language||this.translator.changeLanguage(o),this.services.languageDetector?.cacheUserLanguage?.(o)),this.loadResources(o,e=>{a(e,o)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),n}getFixedT(e,t,n){let r=(e,t,...a)=>{let o,i;(o="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(a)):{...t}).lng=o.lng||r.lng,o.lngs=o.lngs||r.lngs,o.ns=o.ns||r.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||n||r.keyPrefix);let s=this.options.keySeparator||".";return o.keyPrefix&&Array.isArray(e)?i=e.map(e=>("function"==typeof e&&(e=az(e,{...this.options,...t})),`${o.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=az(e,{...this.options,...t})),i=o.keyPrefix?`${o.keyPrefix}${s}${e}`:e),this.t(i,o)};return aw(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,a=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;let o=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return -1===n||0===n||2===n};if(t.precheck){let e=t.precheck(this,o);if(void 0!==e)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!r||o(a,e)))}loadNamespaces(e,t){let n=aE();return this.options.ns?(aw(e)&&(e=[e]),e.forEach(e=>{0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=aE();aw(e)&&(e=[e]);let r=this.options.preload||[],a=e.filter(e=>0>r.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return a.length?(this.options.preload=r.concat(a),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}let t=this.services?.languageUtils||new aG(a2());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new a5(e,t)}cloneInstance(e={},t=a6){let n=e.forkResourceStore;n&&delete e.forkResourceStore;let r={...this.options,...e,isClone:!0},a=new a5(r);return(void 0!==e.debug||void 0!==e.prefix)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n&&(a.store=new aB(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),r),a.services.resourceStore=a.store),a.translator=new aK(a.services,r),a.translator.on("*",(e,...t)=>{a.emit(e,...t)}),a.init(r,t),a.translator.options=r,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}let a9=a5.createInstance();a9.createInstance=a5.createInstance,a9.createInstance,a9.dir,a9.init,a9.loadResources,a9.reloadResources,a9.use,a9.changeLanguage,a9.getFixedT,a9.t,a9.exists,a9.setDefaultNamespace,a9.hasLoadedNamespace,a9.loadNamespaces,a9.loadLanguages;let a8=a9.default||a9;function a7(e,t,n,r){return a8.t(t,{ns:e,defaultValue:n,...r})}function oe(e,t,n){return ab[e]?a7("core",e,t??ab[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function ot(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=on(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t});return e.startsWith("//")?r:r.replace(/^\/\//,"/")}function on(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function or({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=ot(e,t).replace(window.location.origin,""),a=new URL(r,window.location.origin);if("http:"!=a.protocol&&"https:"!=a.protocol)throw console.error(`Received request to navigate to non-http URL: ${a.toString()}`),Error(oe("navigateNonHttp"));r.startsWith(n)?rZ(r):window.location.assign(r)}a8.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let oa="openmrs:history";function oo(e){let t=JSON.parse(sessionStorage.getItem(oa)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(oa,JSON.stringify(t))}function oi(){0===JSON.parse(sessionStorage.getItem(oa)??"[]").length&&document.referrer&&oo(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=os();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(oa,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?ol({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&oo(window.location.href)})}function os(){return JSON.parse(sessionStorage.getItem(oa)??"[]")}function ol({toUrl:e}){let t=os(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);or({to:t[n]}),sessionStorage.setItem(oa,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function ou(){sessionStorage.removeItem(oa)}let oc="${openmrsSpaBase}/login",od={redirectAuthFailure:{enabled:{_type:tU.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:tU.String,_default:oc,_validators:[nY.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:tU.Array,_default:[401],_elements:{_type:tU.Number,_validators:[nY.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:tU.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:tU.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function om(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let op="/ws/rest/v1",of="/ws/fhir2/R4",oh=`${op}/session`;function og(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function oy(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let n=og(e);t.headers||(t.headers={}),ed(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept;let r=!1;try{let e=new URL(n,window.location.href),t=new URL(og(op),window.location.href),a=e.pathname.replace(/\/{2,}/g,"/"),o=t.pathname.replace(/\/{2,}/g,"/");r=e.origin===t.origin&&(a===o||a.startsWith(`${o}/`))}catch{}if(r){let e=!1;for(let[n,r]of Object.entries(t.headers))"disable-www-authenticate"===n.toLowerCase()&&(void 0===r?delete t.headers[n]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(of)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let a=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:r,followRedirects:o}=await nD("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(o&&t&&(n===og(oh)||204===e.status)&&or({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return(n===og(oh)&&403===e.status||r.enabled&&r.errors.includes(e.status))&&(ou(),or({to:r.url||e.headers.get("location")||oc}),!0!==t.rejectAuthFailure)?r.resolvePromise?Promise.resolve():new Promise(()=>{}):e.clone().text().then(t=>{let r=t;try{r=JSON.parse(t)}catch(e){}throw new ov(n,e,r,a)},()=>{throw new ov(n,e,null,a)})})}class ov extends Error{constructor(e,t,n,r){super(),om(this,"response",void 0),om(this,"responseBody",void 0),this.message=`Server responded with ${t.status} (${t.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,r.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
|
|
13
13
|
${r.stack}
|
|
14
14
|
Stacktrace for incoming response:
|
|
15
|
-
${this.stack}`}}let ob=V("session",{loaded:!1,session:null}),ow=0,oE=null;function ox(){return oE||(ob.getState().loaded&&ow>=Date.now()-6e4?null:oC())}function oD(e){let t=e?.includeAuthStatus??!0,n=e=>t?e:e.user,r=ox();return r?new Promise(e=>{let t=()=>{let t=ob.getState();t.loaded&&(a(),e(n(t.session)))},a=ob.subscribe(t);r.then(t,t)}):Promise.resolve(n(ob.getState().session))}function oS(){return ox(),ob}function o_(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function oC(e,t){ow=Date.now(),o??(o=ow);let n={};e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let r=oM(oy(oh,{headers:n,rejectAuthFailure:!0})),a=()=>{oE===r&&(oE=null)};return r.then(a,a),oE=r,r}function ok(){ob.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function oP(e,t){var n,r;if(void 0===t)return!e;if(!e)return!0;return n=e,r=t,("string"==typeof n?!(0,er.A)(r.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!(0,er.A)(r.privileges.find(t=>e===t.display))):((0,er.A)(n)||console.error(`Could not understand privileges "${n}"`),!0))||!(0,er.A)(t.roles.find(e=>"System Developer"===e.display))}function oR(){let e,t;return new Promise(n=>{let r=r=>{r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};r(ob.getState()),e||(t=ob.subscribe(r))})}async function oT(){return(await oD()).sessionLocation}async function oO(e,t){return oM(oy(oh,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function o$(e,t){return await oy(oh,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),oC()}async function oN(e,t,n){return n||(n=new AbortController),await oy(`${op}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),oC()}async function oA(e,t=!1){let n=await oy(t?`${oh}?rememberMe=true`:oh,{headers:{"X-Totp-Code":e}});return n.data?.authenticated?(await oC()).session:n.data}async function oI(){try{await oy(oh,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!oj(e))throw e}ok(),await oC().catch(()=>{})}function oM(e){return new Promise((t,n)=>{e.then(e=>{if("object"==typeof e?.data){let n={loaded:!0,session:e.data};ob.setState(n,!0),t(n)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?n(oL(Error("The session endpoint did not respond with a session"))):n(oL(Error("The server is still starting up"),!0))}).catch(e=>{var r,a;if(oj(e)){"object"==typeof(r=e.responseBody)&&null!==r&&!1===r.authenticated?ob.setState({loaded:!0,session:e.responseBody},!0):ok(),t(ob.getState());return}(a=e)instanceof ov&&502===a.response.status&&!ob.getState().loaded&&void 0!==o&&Date.now()-o<18e4?n(oL(e,!0)):(P(`Failed to fetch new session information: ${e}`),n(oL(e)))})})}function oj(e){return e instanceof ov&&(401===e.response.status||403===e.response.status)}function oL(e,t=!1){return ob.getState().loaded||ob.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),ob.getState()}function oF(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}ob.subscribe(e=>{e.loaded&&e.session&&o_(e.session)});let oB={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function oV(){ng("@openmrs/esm-api",od),oC()}let oU="import-map-override:",oz="import-map-overrides-disabled",oW="import-map-overrides:change",oH=!1,oK=null,oG=null;async function oZ(){return oG??(oG=oY().then(({map:e,complete:t})=>(t||(oG=null),e))),oG}async function oY(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){n=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${r}`,e)}}return{map:oq(t),complete:n}}function oq(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function oJ(){let e={};try{let t=o4();for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);if(r?.startsWith(oU)){let n=r.slice(oU.length);if(!t.includes(n)){let t=localStorage.getItem(r);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function oX(){let e=await oZ();return oH?oq([e,oK??oJ()]):e}async function oQ(){return oZ()}async function o0(){return oH?oq([await oZ(),oJ()]):oZ()}function o1(e){if(!oH)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(oU)){let t=localStorage.getItem(n);t&&(e[n.slice(oU.length)]=t)}}return{imports:e}}return oJ()}function o4(){if(!oH)return[];try{let e=localStorage.getItem(oz);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function o2(e){return!!oH&&o4().includes(e)}function o3(e,t){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(oU+e,t),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function o6(e){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(oU+e);let t=o4().filter(t=>t!==e);t.length>0?localStorage.setItem(oz,JSON.stringify(t)):localStorage.removeItem(oz),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function o5(){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(oU)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(oz),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function o9(e){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=o4().filter(t=>t!==e);t.length>0?localStorage.setItem(oz,JSON.stringify(t)):localStorage.removeItem(oz),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let o8=!1;function o7(){!o8&&(o8=!0,(oH="development"===window.spaEnv)&&(oK=oJ()))}function ie(e){return e.replace(/[\/\-@]/g,"_")}async function it(e,t="./start",r){var a;let o,i=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([ir(e,r?.importMap),new Promise((t,n)=>{o=setTimeout(()=>{var t;n(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=ie(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(n.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function ir(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let n=ie(e);if(!window[n]){let n=t??await ia();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let r=n.imports[e];r.startsWith("./")&&(r=window.spaBase+r.substring(1));let a=e in o1().imports;try{return await function(e){var t;let n=(t=window)[io]??(t[io]=new Map),r=n.get(e);if(r)return r;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,r)=>{let o=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function i(){clearTimeout(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),n.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),r(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return n.set(e,o),o}(r)}catch(e){return a&&x({kind:"error",title:oe("scriptLoadingFailed","Error: Script failed to load"),description:oe("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:r}),actionButtonLabel:oe("resetOverrides","Reset overrides"),onActionButtonClick(){o5(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function ia(){return oX()}let io=Symbol.for("__openmrs_script_loading");function ii(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function is(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&ii(t))}let il="openmrs-routes:",iu="openmrs-routes:change",ic=!1,id=null,im=null;async function ip(){return im??(im=ih().then(({map:e,complete:t})=>(t||(im=null),e))),im}async function ih(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&is(e)&&t.push(e)}catch(e){n=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${r}`,e)}}return{map:ig(t),complete:n}}function ig(e){let t={routes:{}};for(let n of e)n&&"object"==typeof n&&!Array.isArray(n)&&(Object.assign(t.routes,n.routes),void 0===t.version&&void 0!==n.version&&(t.version=n.version));return t}async function iy(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(il)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(il.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(ii(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),r=await t.json();if(ii(r))return{moduleName:e,routes:r};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e.routes[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function iv(){let e=await ip();return ic?ig([e,id??await iy()]):e}async function ib(){return ip()}async function iw(){return ic?ig([await ip(),await iy()]):ip()}function iE(){if(!ic)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(il)){let t=localStorage.getItem(n);t&&(e[n.slice(il.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function ix(e,t){if(!ic)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(il+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!ii(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(il+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(il+e,JSON.stringify(t.toString()));else{if(!ii(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(il+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(iu))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function iD(e){if(!ic)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(il+e),window.dispatchEvent(new CustomEvent(iu))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function iS(){if(!ic)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(il)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(iu))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let i_=null;function iC(){return i_||(i_=(ic="development"===window.spaEnv)?iy().then(e=>{id=e}):Promise.resolve())}let ik=`${op}/attachment`;function iP(e,t){return oy(`${ik}/${e}`,{signal:t.signal})}function iR(e,t,n,r){return oy(iT(e,t,r),{signal:n.signal})}function iT(e,t,n){return n?`${ik}?patient=${e}&encounter=${n}`:`${ik}?patient=${e}&includeEncounterless=${t}`}async function iO(e,t,n){let r=new FormData;return r.append("fileCaption",t.fileDescription),r.append("patient",e),n&&r.append("encounter",n),t.file?r.append("file",t.file,t.fileName):(r.append("file",new File([""],t.fileName),t.fileName),r.append("base64Content",t.base64Content)),oy(`${ik}`,{method:"POST",body:r})}function i$(e,t){return oy(`${ik}/${e}`,{method:"DELETE",signal:t.signal})}async function iN(e,t){return e?(await oy(`${of}/Patient/${e}`,t)).data:null}function iA(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function iI(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}function iM(e){return{uuid:e.uuid,display:e.display}}function ij(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let r=n.toString();return oy(`${op}/location${r?"?"+r:""}`).then(e=>e.data.results.map(iM))}function iL(e){return{uuid:e.uuid,display:e.display,name:e.name}}let iF=`${op}/visittype`;function iB(e=iF){return oy(e).then(e=>e.data.results.map(iL))}var iV=((J={}).NEWVISIT="startVisit",J.EDITVISIT="editVisit",J.LOADING="loadingVisit",J),iU=((X={}).NOTSTARTED="notStarted",X.ONGOING="ongoing",X);let iz="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",iW=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function iH(){return W("visit",iW)}function iK(e,t){iH().setState({patientUuid:e,manuallySetVisitUuid:t})}function iG(e,t){return oy(`${op}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function iZ(e,t,n){return oy(`${op}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function iY(e,t,n){return oy(`${op}/visit?patient=${e}&v=${n??iz}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}iH().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iq{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iq.version}static addUnaryOp(e){return iq.max_unop_len=Math.max(e.length,iq.max_unop_len),iq.unary_ops[e]=1,iq}static addBinaryOp(e,t,n){return iq.max_binop_len=Math.max(e.length,iq.max_binop_len),iq.binary_ops[e]=t,n?iq.right_associative.add(e):iq.right_associative.delete(e),iq}static addIdentifierChar(e){return iq.additional_identifier_chars.add(e),iq}static addLiteral(e,t){return iq.literals[e]=t,iq}static removeUnaryOp(e){return delete iq.unary_ops[e],e.length===iq.max_unop_len&&(iq.max_unop_len=iq.getMaxKeyLen(iq.unary_ops)),iq}static removeAllUnaryOps(){return iq.unary_ops={},iq.max_unop_len=0,iq}static removeIdentifierChar(e){return iq.additional_identifier_chars.delete(e),iq}static removeBinaryOp(e){return delete iq.binary_ops[e],e.length===iq.max_binop_len&&(iq.max_binop_len=iq.getMaxKeyLen(iq.binary_ops)),iq.right_associative.delete(e),iq}static removeAllBinaryOps(){return iq.binary_ops={},iq.max_binop_len=0,iq}static removeLiteral(e){return delete iq.literals[e],iq}static removeAllLiterals(){return iq.literals={},iq}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new iq(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return iq.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iq.binary_ops[String.fromCharCode(e)]||iq.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iq.isIdentifierStart(e)||iq.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(iq.hooks[e]){let n={context:this,node:t};return iq.hooks.run(e,n),n.node}return t}searchHook(e){if(iq.hooks[e]){let t={context:this};return iq.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iq.SPACE_CODE||e===iq.TAB_CODE||e===iq.LF_CODE||e===iq.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:iq.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],n,r;for(;this.index<this.expr.length;)if((n=this.code)===iq.SEMCOL_CODE||n===iq.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())t.push(r);else if(this.index<this.expr.length){if(n===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,iq.max_binop_len),t=e.length;for(;t>0;){if(iq.binary_ops.hasOwnProperty(e)&&(!iq.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iq.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,r,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iq.binaryPrecedence(t),right_a:iq.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),r=[o,a,i];t=this.gobbleBinaryOp();){if(0===(n=iq.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:n,right_a:iq.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;r.length>2&&s(r[r.length-2]);)i=r.pop(),t=r.pop().value,o=r.pop(),e={type:iq.BINARY_EXP,operator:t,left:o,right:i},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),r.push(a,e)}for(s=r.length-1,e=r[s];s>1;)e={type:iq.BINARY_EXP,operator:r[s-1].value,left:r[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,iq.isDecimalDigit(e)||e===iq.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iq.SQUOTE_CODE||e===iq.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===iq.OBRACK_CODE)r=this.gobbleArray();else{for(n=(t=this.expr.substr(this.index,iq.max_unop_len)).length;n>0;){if(iq.unary_ops.hasOwnProperty(t)&&(!iq.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iq.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:iq.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}iq.isIdentifierStart(e)?(r=this.gobbleIdentifier(),iq.literals.hasOwnProperty(r.name)?r={type:iq.LITERAL,value:iq.literals[r.name],raw:r.name}:r.name===iq.this_str&&(r={type:iq.THIS_EXP})):e===iq.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===iq.PERIOD_CODE||t===iq.OBRACK_CODE||t===iq.OPAREN_CODE||t===iq.QUMARK_CODE;){let n;if(t===iq.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iq.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iq.OBRACK_CODE?((e={type:iq.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iq.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iq.OPAREN_CODE?e={type:iq.CALL_EXP,arguments:this.gobbleArguments(iq.CPAREN_CODE),callee:e}:(t===iq.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:iq.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,n;for(;iq.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iq.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iq.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));iq.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iq.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return n=this.code,iq.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(n===iq.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iq.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iq.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,n=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){r=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:iq.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iq.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iq.isIdentifierPart(e))this.index++;else break;return{type:iq.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],n=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){n=!0,this.index++,e===iq.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iq.COMMA_CODE){if(this.index++,++r!==t.length){if(e===iq.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iq.CBRACK_CODE)for(let e=t.length;e<r;e++)t.push(null)}}else if(t.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==iq.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iq.CPAREN_CODE);if(this.code===iq.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iq.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iq.ARRAY_EXP,elements:this.gobbleArguments(iq.CBRACK_CODE)}}}Object.assign(iq,{hooks:new class{add(e,t,n){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(iq),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),iq.max_unop_len=iq.getMaxKeyLen(iq.unary_ops),iq.max_binop_len=iq.getMaxKeyLen(iq.binary_ops);let iJ=e=>new iq(e).parse(),iX=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iq).filter(e=>!iX.includes(e)&&void 0===iJ[e]).forEach(e=>{iJ[e]=iq[e]}),iJ.Jsep=iq,iJ.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}});let iQ="ArrowFunctionExpression",i0={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},i1={...i0,Promise};function i4(e,t={}){return i8(e,t,st)}async function i2(e,t={}){return i7(e,t,st)}function i3(e,t={}){return i8(e,t,sn)}function i6(e,t={}){return i7(e,t,sn)}function i5(e,t={}){return i8(e,t,sr)}function i9(e,t={}){return i7(e,t,sr)}function i8(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let r=sl(t,i0),a=sa("string"==typeof e?iJ(e):e,r);if(n(a))return a;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function i7(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let r=sl(t,i1);return Promise.resolve(sa("string"==typeof e?iJ(e):e,r)).then(t=>{if(n(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function se(e){return iJ(e)}function st(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function sn(e){return"boolean"==typeof e}function sr(e){return"number"==typeof e}function sa(e,t){switch(e.type){case"UnaryExpression":var n,r,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=sa(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return sa(v.left,b)&&sa(v.right,b);case"||":return sa(v.left,b)||sa(v.right,b);case"??":return sa(v.left,b)??sa(v.right,b)}let w=sa(v.left,b),E=sa(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return n=e,r=t,sa(n.test,r)?sa(n.consequent,r):sa(n.alternate,r);case"CallExpression":return sd(si(e,t));case"ArrowFunctionExpression":let x;return a=e,o=t,x=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<x.length)throw`Required argument(s) ${x.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(x.reduce((t,n,r)=>{let a=e[r];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(a)&&t.push([n,a]),t},[]));return sa(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return sd(ss(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(sm(s));case"SequenceExpression":let D;return l=e,u=t,(D=l.expressions.map(sm(u)))[D.length-1];case"NewExpression":var S=e,_=t;if(S.callee&&"Identifier"===S.callee.type){let e=S.arguments?.map(sm(_));switch(S.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${S.callee.name}`}}if(S.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(sp(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return m=e,p=t,C=m.expressions?.map(sm(p))??[],(k=m.quasis?.map(sm(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function so(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return so(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function si(e,t){let n=sc(e.callee,t);if(n===su||e.optional&&null==n)return su;let r=e.arguments?.map(sm(t));if(n){if("function"!=typeof n)throw`${sg(e.callee)} is not a function`}else throw`No function named ${sg(e.callee)} is defined in this context`;return n(...r)}function ss(e,t){let n=sc(e.object,t);if(n===su||e.optional&&null==n)return su;if(null===n)throw TypeError(`TypeError: cannot read properties of null (reading '${sh(e.property,t)}')`);if(void 0===n)switch(e.object.type){case"Identifier":{let n=so(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${sh(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof n&&"function"!=typeof n&&"string"!=typeof n&&"number"!=typeof n)throw`VisitMemberExpression does not support member access on type ${typeof n}`;let r=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(sa(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);sp(r),function(e,t){if(sf.has(String(t)))return;let n=Object(e);for(;null!==n;){if(Object.hasOwn(n,t)){if(n===Object.prototype||n===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}n=Object.getPrototypeOf(n)}}(n,r);let a=n[r];return"function"==typeof a?a.bind(n):a}function sl(e,t){let n={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}iJ.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let n=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let n=this.gobbleBinaryExpression();n||this.throwError("Expected expression after "+e),t.node={type:iQ,params:null,body:n};return}}this.index=n}}),e.hooks.add("after-expression",function(t){!function t(n){n&&(Object.values(n).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===n.operator&&(n.type=iQ,n.params=n.left?[n.left]:null,n.body=n.right,n.params&&n.params[0].type===e.SEQUENCE_EXP&&(n.params=n.params[0].expressions),delete n.left,delete n.right,delete n.operator))}(t.node)})}}),iJ.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let r=t.node;for(;r.type===e.MEMBER_EXP||r.type===e.CALL_EXP&&r.callee.type===e.MEMBER_EXP;)r=r.type===e.MEMBER_EXP?r.object:r.callee.object;r.type="NewExpression"}})}}),iJ.plugins.register({name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function n(t){let n=this.index,r="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:r+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(r+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(r+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(r+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+r+this.char+")");else if(i===e.PERIOD_CODE){r.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:r},null,2)}`),this.index=n;return}t.node={type:e.LITERAL,value:parseFloat(r),raw:this.expr.substring(n,this.index)}}e.hooks.add("gobble-token",function(r){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,n.call(this,r);return}this.throwError("unexpected char within number")}r.node={type:e.LITERAL,value:parseInt(c,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&n.call(this,r)})}}),iJ.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let n=++this.index,r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){let r,a=this.expr.slice(n,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{r=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?r=!0:r&&this.code===e.CBRACK_CODE&&(r=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),iJ.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}}),iJ.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,n=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},r="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:r},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,n&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",r="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+=" ";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:r+=i}else r+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(n){if((n.node.type===e.IDENTIFIER||n.node.type===e.MEMBER_EXP)&&96===this.code)return n.node={type:"TaggedTemplateExpression",tag:n.node,quasi:t.bind(this)(n,!1)},n.node=this.gobbleTokenProperty(n.node),n.node})}}),iJ.addBinaryOp("in",7),iJ.addBinaryOp("??",1);let su=Symbol("optional chain short-circuited");function sc(e,t){switch(e.type){case"MemberExpression":return ss(e,t);case"CallExpression":return si(e,t);default:return sa(e,t)}}function sd(e){return e===su?void 0:e}function sm(e){return function(t){return null===t?null:sa(t,e)}}function sp(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let sf=new Set(["toString","valueOf","hasOwnProperty"]);function sh(e,t){try{return so(e,t)}catch{return"<computed>"}}function sg(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function sy(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...i1},boundNames:new Set,variables:new Set};return sv("string"==typeof e?iJ(e):e,t),[...t.variables]}function sv(e,t){switch(e.type){case"UnaryExpression":return n=e,r=t,void sv(n.argument,r);case"BinaryExpression":return a=e,o=t,void(sv(a.left,o),sv(a.right,o));case"ConditionalExpression":return i=e,s=t,void(sv(i.consequent,s),sv(i.test,s),sv(i.alternate,s));case"CallExpression":return l=e,u=t,void(sv(l.callee,u),l.arguments?.map(sb(u)));case"ArrowFunctionExpression":var n,r,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,E,x=e,D=t;let S=new Set(D.boundNames);for(let e of x.params??[])e?.type==="Identifier"&&S.add(e.name);sv(x.body,{...D,boundNames:S});return;case"MemberExpression":return c=e,d=t,void(sv(c.object,d),c.computed&&sv(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(sb(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(sb(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(sb(y));case"Literal":case"TemplateElement":return;case"Identifier":return v=e,b=t,void(v.name in b.globals||b.boundNames.has(v.name)||b.variables.add(v.name));case"TemplateLiteral":return w=e,E=t,void(w.expressions?.map(sb(E)),w.quasis?.map(sb(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function sb(e){return function(t){return null===t?null:sv(t,e)}}let sw=W("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),r=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...r}}return e}()});function sE(e,t,n){sw.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:t,description:n}}}))}function sx(){let e=sw.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function sD(e){return sw.getState().flags[e].enabled}function sS(e,t){sw.subscribe(n=>{t(n.flags[e].enabled)})}function s_(e,t){sw.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}sw.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});var sC=e6(function(e,t,n){eZ(e,t,n)});let sk=V("extensionsInternal",{slots:{},extensions:{}}),sP=V("extensionRenderings",{renderings:new Map}),sR=()=>W("extensionsInternal",{slots:{},extensions:{}}),sT=()=>W("extensionRenderings",{renderings:new Map});function sO(e){let t=sk.getState(),n=e(t);n!==t&&sk.setState(n)}let s$=null,sN=null;function sA(){let e=sP.getState();return s$&&e===sN||(s$=new Map(e.renderings),sN=e,function(e){for(let t of(sW.clear(),e.values()))sK(t,1);sH=!0}(s$)),s$}function sI(e){sN={renderings:e},sP.setState(sN,!0)}function sM(e){let t=sA();t.has(e.renderingId)||(t.set(e.renderingId,e),sK(e,1),sI(t))}function sj(e){let t=sA(),n=t.get(e);n&&(t.delete(e),sK(n,-1),sI(t))}let sL=()=>W("extensions",{slots:{}}),sF=0,sB=new Set;function sV(e){sF++;try{return e()}finally{if(0==--sF&&sB.size>0){let e=Array.from(sB);for(let t of(sB.clear(),e))sU(t)}}}function sU(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sz(e){sF>0?sB.add(e):sU(e)}let sW=new Map,sH=!1;function sK(e,t){let n=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),r=sW.get(n);if(!r){if(t<0)return;sW.set(n,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sH=!0;return}r.count+=t,r.count<1&&(sW.delete(n),sH=!0)}function sG(){var e,t;if(sA(),!sH)return;sH=!1;let n=Array.from(sW.values(),({record:e})=>e);n.sort(sZ),e=tX.getState().mountedExtensions,t=n,e.length===t.length&&e.every((e,n)=>0===sZ(e,t[n]))||tX.setState({mountedExtensions:n})}function sZ(e,t){return sY(e.slotName,t.slotName)||sY(e.extensionId,t.extensionId)||sY(e.slotModuleName,t.slotModuleName)||sY(e.extensionModuleName,t.extensionModuleName)}function sY(e,t){return e===t?0:e<t?-1:1}sG(),sP.subscribe(()=>sz(sG));let sq=sR(),sJ=sL(),sX=t0(),sQ=t2(),s0=new Set,s1=!1;function s4(e){if(null===e)s0=null;else if(null!==s0)for(let t of e)s0.add(t);sz(s2)}function s2(){if(!s1){s1=!0;try{for(let e=1;;e++){let t=s0;if(null!==t&&0===t.size)return;s0=new Set;try{!function(e,t,n,r,a,o=null){let i=sJ.getState().slots,s={},l=!1,u=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,c]of Object.entries(e.slots)){let d=i[r];if(d&&o&&!o.has(r)){s[r]=d;continue}let{config:m}=t4(t,c.name),p=function(e,t,n,r,a,o){let i=function(e,t){let n=e.add||[],r=e.remove||[],a=e.order||[],{extensions:o}=sq.getState(),i=new Set(r),s=[...t,...n].filter(e=>!i.has(e)),l=lr(a),u=lr(t),c=new Map(s.map(e=>[e,function(e,t,n,r){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==n)return 1e3+n;let t=r.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[s5(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(n,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=t3(r,e,l),u=t6(n,e,l),c=u?sC({},i,u):i,d=s5(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!oP(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(r,e,m,n,u,a.session);d&&d.moduleName===c.moduleName&&e8(d.candidateExtensions,p)?s[r]=d:(s[r]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sJ.setState({slots:s})}(sq.getState(),sX.getState(),sQ.getState(),sw.getState(),ob.getState(),t)}catch(e){throw s0=null===t||null===s0?null:new Set([...t,...s0]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{s1=!1}}}function s3(e,t){let n=new Set;for(let r of Object.keys(e))e[r]!==t[r]&&n.add(r);for(let r of Object.keys(t))r in e||n.add(r);return n}function s6(e,t){return{moduleName:t,name:e,attachedIds:[]}}function s5(e){let[t]=e.split("#");return t}function s9(e,t){let n=s5(t);return e.extensions[n]}function s8(e){return s9(sq.getState(),e)}sq.subscribe((e,t)=>{s4(e.extensions!==t.extensions?null:s3(e.slots,t.slots))}),sX.subscribe((e,t)=>{s4(s3(e.slots,t.slots))}),sQ.subscribe((e,t)=>{s4(s3(e.configs,t.configs))}),sw.subscribe(()=>s4(null)),ob.subscribe(()=>s4(null)),s4(null);let s7=e=>sO(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function le(e,t){sO(n=>{let r=n.slots[e];return r?{...n,slots:{...n.slots,[e]:{...r,attachedIds:[...r.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...s6(e),attachedIds:[t]}}}})}function lt(e,t){sO(n=>{let r=n.slots[e];return r&&r.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...r,attachedIds:r.attachedIds.filter(e=>e!==t)}}}:n})}function ln(e){sO(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function lr(e){let t=new Map;return e.forEach((e,n)=>{t.has(e)||t.set(e,n)}),t}function la(e,t){return function(e,t,n=null,r){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:n,...t}:{session:n});try{return!!i3(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(r?` in ${r}`:""),t),!1}})}(lo(e),t,ob.getState().session,e)}function lo(e){return sJ.getState().slots[e]?.candidateExtensions??[]}let li=(e,t)=>sq.setState(n=>{let r=n.slots[t]?.moduleName;if(r&&r!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${r}.`),n;if(r&&r==e)return n;if(n.slots[t])return{...n,slots:{...n.slots,[t]:{...n.slots[t],moduleName:e}}};let a=s6(t,e);return{...n,slots:{...n.slots,[t]:{...a}}}}),ls=()=>{s0=null,sO(()=>({slots:{},extensions:{}})),sT().setState({renderings:new Map}),sJ.setState({slots:{}})},ll=V("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function lu({name:e,basePath:t,mode:n,componentContext:r,state:a}){ll.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:r,state:a})}function lc(e){ll.getState().slotName===e&&ll.setState(ll.getInitialState(),!0)}let ld=V("modalRegistry",{modals:{}});function lm(e){ld.setState(t=>(t.modals[e.name]=e,t))}function lp(e){let t=ld.getState().modals[e];if(!t){let n=s8(e);n&&(t={name:e,load:n.load,moduleName:n.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),lm(t))}return t}let lf=V("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function lh(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=lf.getState(),r=t[e];if(r){let t=n[r.window];if(t)return t;throw Error(`No workspace window found with name: ${r.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function lg(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=lf.getState(),r=n[e];if(r){let n=t[r.group];if(n)return n;throw Error(`No workspace group found with name: ${r.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function ly(e){let{openedWindows:t}=lf.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function lv(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=lf.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);r[n.name]={...n,moduleName:e}}lf.setState({registeredGroupsByName:r})}function lb(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=lf.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}lf.setState({registeredWindowsByName:r})}function lw(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=lf.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}lf.setState({registeredWorkspacesByName:r})}let lE=0,lx=null,lD={bootstrap:15e3,mount:15e3,unmount:15e3};function lS(e,t){if(e.timeouts)return e;let n=e.name??"parcel",r=Object.fromEntries(Object.keys(lD).filter(t=>e[t]).map(r=>{var a,o;let i,s;return[r,(a=e[r],o=lD[r],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${r} at array index ${o} for parcel ${n} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${r} for parcel ${n} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(r,!1),e),e=>{throw t(r,!0),e})})]}));return{...e,...r}}async function l_(e,t){var n,r;let a,o,i,s,l,u=await (lx??(lx=new Promise((e,t)=>{rN({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),rN))),lx),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return r=u((n=d.onSettled,"function"==typeof e?()=>e().then(e=>lS(e,n)):lS(e,n)),c),s=e=>t=>e.call(r,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===r.getStatus()&&d.release(),e}),l=r.update&&s(r.update),Object.defineProperty(r,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function lC(){return lk}function lk(e,t){let n,r=l_(e,t).then(e=>n=e);return{mount:()=>r.then(e=>e.mount()),unmount:()=>r.then(e=>e.unmount()),update:e=>r.then(t=>t.update?.(e)),getStatus:()=>n?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return r.then(e=>e.loadPromise)},get bootstrapPromise(){return r.then(e=>e.bootstrapPromise)},get mountPromise(){return r.then(e=>e.mountPromise)},get unmountPromise(){return r.then(e=>e.unmountPromise)}}}async function lP(e,t,n,r,a=e=>e,o={}){let i=s5(r),s=s8(r),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:m}=s,p=lE++,f=`${t}/${r}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{sj(f)}catch(t){console.error(e,t)}};try{sM({renderingId:f,extensionName:i,extensionModuleName:d,extensionId:r,slotName:t,slotModuleName:n})}catch(e){throw h(`Recomputing configuration after registering '${r}' failed also failed`),e}try{u=await m()}catch(e){throw h(`Recomputing configuration after '${r}' failed to load also failed`),e}try{l=await l_(a({...u,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:r,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${r}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${r}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${r}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${r}' failed`),e=>{console.error(`Extension '${r}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${r}' failed to unmount also failed`)})}else console.warn(`Tried to render ${r} into ${t} but no DOM element was available.`);return l}var lR=n(5399),lT=n.n(lR);let lO=(0,lR.createContext)({moduleName:"",featureName:""});var l$=n(3338);function lN({to:e,templateParams:t,onBeforeNavigate:n,children:r,...a}){return(0,lR.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),(0,l$.jsx)("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),n?.(r),or({to:e,templateParams:t})),0===r.button&&(r.ctrlKey||r.metaKey)&&n?.(r),0===r.button&&r.shiftKey&&n?.(r),1===r.button&&n?.(r)},href:ot(e,t),...a,children:r})}let lA=({state:e,children:t,...n})=>{let{extension:r}=(0,lR.useContext)(lO),a=(0,lR.useRef)(null),o=(0,lR.useRef)(Promise.resolve()),i=(0,lR.useRef)(!1),s=(0,lR.useRef)(!1),l=(0,lR.useRef)(e),u=(0,lR.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,lR.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${r?.extensionId}' failed to update`,e)}))},[]),d=(0,lR.useCallback)(t=>{t&&!a.current&&!s.current&&r?.extensionSlotName&&r.extensionSlotModuleName&&(s.current=!0,lP(t,r.extensionSlotName,r.extensionSlotModuleName,r.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,lR.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,lR.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),r?(0,l$.jsx)("div",{ref:d,"data-extension-id":r?.extensionId,style:{position:"relative"},...n}):null};function lI(e){let t=(0,lR.useRef)(e);return O(t.current,e)||(t.current=e),t.current}function lM(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[r,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};n[r]=t}return n}let lj=e=>e;function lL(e,t=lj,n){let r=(0,lR.useCallback)(t=>e.subscribe(t),[e]),a=(0,lR.useCallback)(()=>t(e.getState()),[e,t]),o=(0,lR.useSyncExternalStore)(r,a,a),i=(0,lR.useMemo)(()=>n?lM(e,n):null,[e,n]);return(0,lR.useMemo)(()=>i?{...o,...i}:o,[o,i])}function lF(e,t){return lL(e,lj,t)}function lB(e){return function(t){let n=(0,lR.useCallback)(t=>e.subscribe(t),[]),r=(0,lR.useCallback)(()=>e.getState(),[]),a=(0,lR.useSyncExternalStore)(n,r,r),o=(0,lR.useMemo)(()=>t?lM(e,t):null,[t]);return(0,lR.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let lV=[];Object.freeze(lV);let lU={candidateExtensions:lV};Object.freeze(lU);let lz=e=>{let t=(0,lR.useCallback)(t=>t.slots?.[e]??lU,[e]);return lL(sL(),t)},lW=e=>e.session;function lH(e,t){let{candidateExtensions:n}=lz(e),r=lL(ob,lW),a=lI(t);return(0,lR.useMemo)(()=>la(e,a),[e,a,r,n])}function lK(e,t){let{moduleName:n}=(0,lR.useContext)(lO);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,lR.useEffect)(()=>{li(n,e)},[n,e]),{extensions:lH(e,t),extensionSlotName:e,extensionSlotModuleName:n}}function lG(e){return e}function lZ({name:e,extensionSlotName:t,select:n=lG,children:r,state:a,style:o,...i}){if(r&&a)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??t,l=(0,lR.useRef)(null),{extensions:u,extensionSlotModuleName:c}=lK(s,a),d=(0,lR.useMemo)(()=>n(u),[n,u]),m=(0,lR.useMemo)(()=>{if("function"==typeof r&&!lT().isValidElement(r))return d.map(e=>r(e,a))},[r,d]);return(0,l$.jsx)("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i,children:s&&d?.map((e,t)=>(0,l$.jsx)(lO.Provider,{value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}},children:m?.[t]??("function"!=typeof r?r:null)??(0,l$.jsx)(lA,{state:a})},e.id))})}var lY=n(6442),lq=n.n(lY);function lJ(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 lX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lJ(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],a in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function lQ(e){return(lQ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l0(e){return(l0="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l1(e,t){var n;if("function"!=typeof(n=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(l0(n)));return function(){var e=n(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(l0(e)));return e}}var l4=null;try{l4=require("react").createContext()}catch(e){}var l2={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function l3(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function l6(e,t){return new Promise(function(n,r){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=l7(e,t,function(){n(this)}),i=l1(e,t)(),s=function(e){var t=e.reactDom,n=e.renderType,r=e.elementToRender,a=e.domElement,o=t[n];if("function"!=typeof o)throw Error('renderType "'.concat(n,'" did not return a function.'));switch(n){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(r),i;case"hydrateRoot":return o(a,r);default:return o(r,a),null}}({elementToRender:o,domElement:i,reactDom:l8(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function l5(e,t){return new Promise(function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():l8(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function l9(e,t){return new Promise(function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=l7(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(r);else{var o=l1(e,t)();l8(e).render(r,o)}})}function l8(e){return e.ReactDOMClient||e.ReactDOM}function l7(e,t,n){var r=e.React.createElement(e.rootComponent,t),a=l4?e.React.createElement(l4.Provider,{value:t},r):r;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function n(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},n}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lX(lX({},t),{},{mountFinished:n,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var ue=n(7807),ut=n(1619),un=n.n(ut),ur=n(3432);let ua={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},uo=new Map;(0,ur.initCache)(uo);let ui={errorRetryCount:3,fetcher:oy,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof ov){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>uo};function us(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},ua,e),n={...ui,...t.swrConfig};return function(e){var r,a,o,i,s;return o=a=class extends(r=lT().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return(0,l$.jsx)("div",{children:"An error has occurred. Please try reloading the page."});{let r=(0,l$.jsx)(lR.Suspense,{fallback:null,children:(0,l$.jsx)(ut.SWRConfig,{value:n,children:(0,l$.jsx)(lO.Provider,{value:this.state.config,children:t.disableTranslations?(0,l$.jsx)(e,{...this.props}):(0,l$.jsx)(ue.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName,children:(0,l$.jsx)(e,{...this.props})})})})});return t.strictMode&&lT().StrictMode?(0,l$.jsx)(lT().StrictMode,{children:r}):r}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function ul(e,t){return function(e){if("object"!==lQ(e))throw Error("single-spa-react requires a configuration object");var t,n=lX(lX({},l2),e);if(!n.React)throw Error("single-spa-react must be passed opts.React");if(!n.ReactDOM&&!n.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(n.renderType||(null!=(t=n.ReactDOMClient)&&t.createRoot?n.renderType="createRoot":n.renderType="render"),!n.rootComponent&&!n.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(n.errorBoundary&&"function"!=typeof n.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!l4&&n.React.createContext&&(l4=n.React.createContext()),n.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(n);var r={bootstrap:l3.bind(null,n),mount:l6.bind(null,n),unmount:l5.bind(null,n)};return n.parcelCanUpdate&&(r.update=l9.bind(null,n)),r}({React:lT(),ReactDOMClient:lq(),rootComponent:us(t)(e)})}function uu(e,t){return()=>e().then(({default:e})=>ul(e,t))}function uc(e,t){return()=>Promise.resolve(ul(e,t))}let ud=uu,um=I()(()=>({}));z("openmrs-app-context",um);let up={};function uf(e,t=e=>e){let n=um.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function uh(e,t){um.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function ug(e){return null===e?null:Object.freeze(Object.assign({},e))}let uy=new Map;function uv(e,t){let n=(0,lR.useRef)(t??{}),r=(0,lR.useRef)(t=>uh(e,t)),a=(0,lR.useRef)(Symbol());return(0,lR.useEffect)(()=>{let n=t??{},r=a.current;return null===uf(e)?!function(e,t=up){um.setState(n=>{if(e in n)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},n,{[e]:t===up?{}:t})})}(e,n):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),uh(e,()=>n)),uy.set(e,r),()=>{uy.get(e)===r&&(um.setState(t=>(e in t&&delete t[e],t)),uy.delete(e))}},[e]),(0,lR.useEffect)(()=>{let r=t??{};O(n.current,r)||(uh(e,()=>r),n.current=r)},[t]),r.current}function ub({namespace:e,value:t}){return uv(e,t),null}let uw=({children:e,value:t,fallback:n})=>t?(0,l$.jsx)(l$.Fragment,{children:e}):n?(0,l$.jsx)(l$.Fragment,{children:n}):null;function uE(){let e=(0,lR.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,lR.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function ux(e,t=e=>e??{}){let[n,r]=(0,lR.useState)(()=>{if(uD(e))return;let n=uf(e);if(null!==n)return t?t(n):n});return(0,lR.useEffect)(()=>{if(uD(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,lR.useEffect)(()=>{var n;let a;return(n=e=>{if(null==e)return void r(void 0);let n=t?t(e):e;r(e=>O(e,n)?e:n)})(ug(a=uf(e))),um.subscribe(t=>{let r=e in t?t[e]:null;r!==a&&(a=r,n(ug(r)))})},[e,t]),n}function uD(e){return"string"!=typeof e||0===e.trim().length}function uS(e){let t=lH(e);return(0,lR.useMemo)(()=>t.map(e=>e.id),[t])}function u_(e){return lz(e).candidateExtensions}function uC(e,t,n){let{data:r,error:a,mutate:o,isLoading:i,isValidating:s}=un()(e?iT(e,t,n):null,oy);return(0,lR.useMemo)(()=>({isLoading:i,data:r?.data.results??[],error:a,mutate:o,isValidating:s}),[r,a,i,s,o])}function uk(e){(0,lR.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let uP={},uR=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
|
|
16
|
-
Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function uT(e,t,n){let r=uP[e];if(r)return r;let a=new Promise(e=>{let r=n(t.getState());if(r)return void e(r);let a=t.subscribe(t=>{let r=n(t);r&&(a(),e(r))})});return uP[e]=a,a.then(()=>{uP[e]===a&&delete uP[e]}),a}function uO(e){let{moduleName:t,extension:n}=(0,lR.useContext)(lO),r=e?.externalModuleName??t;if(!r&&!n)throw Error(uR);let a=function(e){let t=(0,lR.useMemo)(()=>tQ(e),[e]),n=function(e){let[t,n]=(0,lR.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,lR.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&n(e.config)}),[e]),t}(t);if(!n)throw uT(e,t,e=>e.loaded?e.config:null);return n}(r),o=function(e){let t=(0,lR.useMemo)(t2,[]),n=function(e,t){let[n,r]=(0,lR.useState)(t?()=>{let n=t3(e.getState(),t.extensionSlotName,t.extensionId);if(n.loaded&&n.config)return n.config}:null);return(0,lR.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=t3(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!e8(a.config,n)&&r(a.config)})},[e,t,n]),n}(t,e);if(!n&&e)throw uT(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let n=t3(t,e.extensionSlotName,e.extensionId);return n.loaded?n.config:null});return n||{}}(n);return(0,lR.useMemo)(()=>e?.externalModuleName&&r===e.externalModuleName?{...a}:{...a,...o},[r,e?.externalModuleName,a,o])}let u$=lH;function uN(e,t=300){let[n,r]=(0,lR.useState)(e);return(0,lR.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var uA=n(3660),uI=n.n(uA);let uM=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function uj(){let e=`${op}/emrapi/configuration?v=${uM}`,t=uI()(e,oy);return(0,lR.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}function uL(){return(0,lR.useContext)(lO).extension}let uF=lB(sR());function uB(e){let t=lH(e);return(0,lR.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let uV=lB(sL());function uU(e){let{flags:t}=lL(sw);return t[e]?.enabled??!1}function uz(){let[,e]=(0,lR.useState)(0);return(0,lR.useCallback)(()=>{e(e=>e+1)},[])}function uW(e,t,n={}){return uK(e,t,uH,n)}let uH={getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(og(e.toString()),window.location.toString());return r.searchParams.set("limit",""+t),r.searchParams.set("startIndex",""+n),r.searchParams.set("totalCount","true"),r.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function uK(e,t,n,r={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=n,{immutable:l,swrConfig:u}=r,c=r.fetcher??oy,[d,m]=(0,lR.useState)(1),p=(0,lR.useRef)(NaN),f=(0,lR.useRef)(NaN),h=(0,lR.useRef)(d),g=(0,lR.useRef)(!1),y=(0,lR.useRef)(!1),v=e?.toString()??"",[b,w]=(0,lR.useState)(v);v!==b&&(w(v),m(1),h.current=1,p.current=NaN,f.current=NaN,g.current=!1,y.current=!1);let E=(d-1)*t,x=(0,lR.useMemo)(()=>a(e,t,E),[e,t,E]),{data:D,...S}=(l?uI():un())(x,c,u);D?.data&&(p.current=o(D?.data),f.current=i(D?.data),g.current=!0);let _=Math.ceil(p.current/t),C=(0,lR.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let n=Math.ceil(p.current/t);!g.current||Number.isNaN(n)||e<=n?(h.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,lR.useEffect)(()=>{if(!g.current)return;if(Number.isNaN(p.current)){y.current||(y.current=!0,console.warn(`useServerPagination: ${v} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(p.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),h.current=e,m(e))},[d,t,v,D]);let k=(0,lR.useCallback)(()=>{C(h.current+1)},[C]),P=(0,lR.useCallback)(()=>{C(h.current-1)},[C]);return{data:s(D?.data),totalPages:_,totalCount:p.current,currentPage:d,currentPageSize:f.current,paginated:_>1,showNextButton:d<_,showPreviousButton:d>1,goTo:C,goToNext:k,goToPrevious:P,...S}}function uG(e,t,n={}){return uK(e,t,uZ(),n)}function uZ(){return{getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(og(e.toString()),window.location.toString());return r.searchParams.set("_count",""+t),r.searchParams.set("_getpagesoffset",""+n),r.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var uY=n(682),uq=n.n(uY);function uJ(e,t={}){return uX(e,uH,t)}function uX(e,t,n={}){let{swrInfiniteConfig:r,immutable:a}=n,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=n.fetcher??oy,u=(0,lR.useCallback)((n,r)=>0==n?e?.toString()??null:t.getNextUrl(r.data),[e]),{data:c,size:d,setSize:m,...p}=uq()(u,l,{...r,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),f=o(c?.[c.length-1].data),h=i(c?.[0]?.data);return{data:c?.flatMap(e=>s(e.data)),totalCount:h,hasMore:null!=f,loadMore:()=>{m((c?.length??0)+1)},nextUri:f,...p}}function uQ(e,t={}){return u0(e,uH,t)}function u0(e,t,n={}){let r=uX(e,t,n),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:u}=r;return((0,lR.useEffect)(()=>{a&&!o&&s()},[a,u]),n.partialData)?r:{...r,data:a||o?void 0:i,isLoading:l||a}}function u1(e,t={}){return u0(e,uZ(),t)}function u4(e,t={}){return uX(e,uZ(),t)}function u2(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function u3(){let[e,t]=(0,lR.useState)(u2);return(0,lR.useEffect)(()=>{let e=()=>{t(u2())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let u6=e=>"small-desktop"===e||"large-desktop"===e;function u5(e){let t=(0,lR.useContext)(lO);(0,lR.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),lu(e),()=>{lc(e.name)}),[t,e])}function u9(){return lL(ll)}let u8=[];function u7(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let r=n.toString(),{data:a}=uQ(`${op}/location${r?"?"+r:""}`,{immutable:!0});return a??u8}function ce(e,t=!0){let n=(0,lR.useRef)(null);return(0,lR.useEffect)(()=>{let r=r=>{t&&n.current&&r.target&&r.target instanceof Node&&(n.current.contains(r.target)||e(r))};return window.addEventListener("mousedown",r),window.addEventListener("touchstart",r),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("touchstart",r)}},[e,t]),n}function ct(e){let t=(0,lR.useRef)();return(0,lR.useEffect)(()=>{let n=new IntersectionObserver(t=>{for(let n of t)if(n.isIntersecting)return void e()},{threshold:1});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current,e]),t}function cn(e,t={}){let{abortController:n,fetchInit:r,url:a,swrConfig:o}=t,i=uE(),s=(0,lR.useMemo)(()=>r?.signal??n?.signal??i.signal,[n?.signal,r?.signal,i.signal]),l=(0,lR.useCallback)(e=>oy(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,a),{...r,signal:s}),[s,r,a]);return un()(e,l,o)}function cr(e=[],t=10){let[n,r]=(0,lR.useState)(1),a=(0,lR.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);n>a&&r(a);let o=Math.min(Math.max(1,n),a),i=(0,lR.useMemo)(()=>{let n=(o-1)*t,r=(o+0)*t;return e.slice(n,r)},[e,o,t]),s=(0,lR.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):r(e)},[]),l=(0,lR.useCallback)(()=>{r(e=>e+1)},[]),u=(0,lR.useCallback)(()=>{r(e=>Math.max(1,e-1))},[]);return(0,lR.useMemo)(()=>({results:i,totalPages:a,currentPage:o,paginated:e.length>t,showNextButton:o<a,showPreviousButton:o>1,goTo:s,goToNext:l,goToPrevious:u}),[i,a,e.length,t,o,s,l,u])}function ca(e,t,n,r){return{pageSizes:(0,lR.useMemo)(()=>{let n=Math.ceil(t/e);return isNaN(n)&&(n=0),[...Array(n).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,lR.useMemo)(()=>e>t?t:e*n>t?e*(n-1)+r:e*n,[e,t,n,r])}}function co(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function ci(e){let[t,n]=(0,lR.useState)(e??co()),{data:r,error:a,isValidating:o}=un()(t?["patient",t]:null,()=>iN(t,{}));return(0,lR.useEffect)(()=>{let e=()=>{let e=co();e!==t&&n(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,lR.useMemo)(()=>({isLoading:o&&!a&&!r,patient:r,patientUuid:t,error:a}),[o,a,r,t])}function cs(){let e=`${op}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:n,isLoading:r}=un()(e,oy);return(0,lR.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:r,error:n}),[t,n,r])}function cl(e,t,n,r){let a=e?.slotName===t&&e.slotModuleName===n?e.components:null,o=new Map;for(let e of r)o.set(e,a?.get(e)??function(e,t,n){let r=s5(n),a=e=>e.extensions[r]?.meta,o=({state:r})=>{let o=lL(sR(),a),i=(0,lR.useMemo)(()=>({moduleName:t,featureName:"",extension:{extensionId:n,extensionSlotName:e,extensionSlotModuleName:t,extensionMeta:o}}),[o]);return(0,l$.jsx)(lO.Provider,{value:i,children:(0,l$.jsx)(lA,{state:r})})};return o.displayName=`RenderableExtension(${n})`,o}(t,n,e));return{slotName:t,slotModuleName:n,components:o}}function cu(e){let{extensions:t,extensionSlotModuleName:n}=lK(e),r=(0,lR.useMemo)(()=>new Set(e?t.map(e=>e.id):[]),[e,t]),[a,o]=(0,lR.useState)(()=>cl(null,e,n,r)),i=a;return a.slotName===e&&a.slotModuleName===n&&a.components.size===r.size&&[...r].every(e=>a.components.has(e))||o(i=cl(a,e,n,r)),(0,lR.useMemo)(()=>e?t.flatMap(e=>{let t=i.components.get(e.id);return t?[t]:[]}):[],[e,t,i])}function cc(){let e=(0,lR.useRef)(),[t,n]=(0,lR.useState)(null),r=null;if(!t){if(i){let e=oS().getState();e.loaded&&(r=e.session)}else i=new Promise(t=>{let n=({loaded:n,session:a})=>{n&&(t(a),r=a,e.current&&(e.current(),e.current=void 0))};n(oS().getState()),r||(e.current=oS().subscribe(n))});if(r)n(r);else throw i}(0,lR.useEffect)(()=>(e.current||(e.current=oS().subscribe(({loaded:e,session:t})=>{e&&(r=t,n(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let a=t||r;if(!a)if(i)throw console.warn("useSession is in an unexpected state. Attempting to recover."),i;else throw Error("useSession is in an invalid state.");return a}let cd=({privilege:e,fallback:t,children:n})=>{let[r,a]=(0,lR.useState)(null);return((0,lR.useEffect)(()=>{let e=oS(),t=e.subscribe(({loaded:e,session:t})=>{a(e?t?.user??null:null)}),{loaded:n,session:r}=e.getState();return n&&a(r?.user??null),t},[]),r&&oP(e,r))?(0,l$.jsx)(l$.Fragment,{children:n}):t?(0,l$.jsx)(l$.Fragment,{children:t}):null};var cm=n(222),cp=n.n(cm),cf=n(5602);let ch=new Map;function cg(){for(let e of Array.from(ch.values()))e()}let cy={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function cv(e){let t=(0,lR.useId)();return(0,lR.useEffect)(()=>{if(e)return ch.set(t,e),()=>{ch.delete(t)}},[t,e]),{...lF(iH(),cy),mutateVisit:cg}}function cb(e,t=iz){let n=(0,lR.useRef)(void 0),{patientUuid:r,manuallySetVisitUuid:a,setVisitContext:o}=cv((0,lR.useCallback)(()=>n.current?.(),[])),i=e&&r==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:m}=un()(e?`${op}/visit${s}`:null,oy),{data:p,error:f,mutate:h,isValidating:g}=un()(e&&i?`${op}/visit${l}`:null,oy),y=(0,lR.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,lR.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,lR.useRef)(null);(0,lR.useEffect)(()=>{!m&&y&&r===e&&null===a&&o(y),g||(b.current&&v&&b.current.uuid===v.uuid&&!b.current.stopDatetime&&v.stopDatetime&&o(null),b.current=v)},[v,a,y,m,g,r]);let w=(0,lR.useCallback)(()=>{d(),h()},[d,h]);(0,lR.useEffect)(()=>{n.current=w},[w]);let E=!!(!u||i&&!p),x=!!(i?f:c);return{error:c||f,mutate:w,isValidating:m||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:E&&!x}}cp().extend(cf);let cw=[];function cE(){let{data:e}=uI()(iF,iB);return e??cw}let cx=new Map;async function cD(e,t){let n=t.indexOf("#"),r=n>=0,a=r?t.substring(0,n):e,o=r?t.substring(n+1):t,i=await it(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?c_(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),cS)}let cS={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function c_(e,t){if(e in cx)await cx[e];else{let n=t??await it(e);await (cx[e]=new Promise((t,r)=>{if(Object.hasOwn(n,"startupApp")){let a=n.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{nv(e),t(null)}).catch(r)}nv(e),t(null)}))}}function cC(e,t){let n=t.name;if(!n)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
|
|
15
|
+
${this.stack}`}}let ob=V("session",{loaded:!1,session:null}),ow=0,oE=null;function ox(){return oE||(ob.getState().loaded&&ow>=Date.now()-6e4?null:oC())}function oD(e){let t=e?.includeAuthStatus??!0,n=e=>t?e:e.user,r=ox();return r?new Promise(e=>{let t=()=>{let t=ob.getState();t.loaded&&(a(),e(n(t.session)))},a=ob.subscribe(t);r.then(t,t)}):Promise.resolve(n(ob.getState().session))}function oS(){return ox(),ob}function o_(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function oC(e,t){ow=Date.now(),o??(o=ow);let n={};e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let r=oM(oy(oh,{headers:n,rejectAuthFailure:!0})),a=()=>{oE===r&&(oE=null)};return r.then(a,a),oE=r,r}function ok(){ob.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function oP(e,t){var n,r;if(void 0===t)return!e;if(!e)return!0;return n=e,r=t,("string"==typeof n?!(0,er.A)(r.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!(0,er.A)(r.privileges.find(t=>e===t.display))):((0,er.A)(n)||console.error(`Could not understand privileges "${n}"`),!0))||!(0,er.A)(t.roles.find(e=>"System Developer"===e.display))}function oR(){let e,t;return new Promise(n=>{let r=r=>{r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};r(ob.getState()),e||(t=ob.subscribe(r))})}async function oT(){return(await oD()).sessionLocation}async function oO(e,t){return oM(oy(oh,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function o$(e,t){return await oy(oh,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),oC()}async function oN(e,t,n){return n||(n=new AbortController),await oy(`${op}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),oC()}async function oA(e,t=!1){let n=await oy(t?`${oh}?rememberMe=true`:oh,{headers:{"X-Totp-Code":e}});return n.data?.authenticated?(await oC()).session:n.data}async function oI(){try{await oy(oh,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!oj(e))throw e}ok(),await oC().catch(()=>{})}function oM(e){return new Promise((t,n)=>{e.then(e=>{if("object"==typeof e?.data){let n={loaded:!0,session:e.data};ob.setState(n,!0),t(n)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?n(oL(Error("The session endpoint did not respond with a session"))):n(oL(Error("The server is still starting up"),!0))}).catch(e=>{var r,a;if(oj(e)){"object"==typeof(r=e.responseBody)&&null!==r&&!1===r.authenticated?ob.setState({loaded:!0,session:e.responseBody},!0):ok(),t(ob.getState());return}(a=e)instanceof ov&&502===a.response.status&&!ob.getState().loaded&&void 0!==o&&Date.now()-o<18e4?n(oL(e,!0)):(P(`Failed to fetch new session information: ${e}`),n(oL(e)))})})}function oj(e){return e instanceof ov&&(401===e.response.status||403===e.response.status)}function oL(e,t=!1){return ob.getState().loaded||ob.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),ob.getState()}function oF(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}ob.subscribe(e=>{e.loaded&&e.session&&o_(e.session)});let oB={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function oV(){ng("@openmrs/esm-api",od),oC()}let oU="import-map-override:",oz="import-map-overrides-disabled",oW="import-map-overrides:change",oH=!1,oK=null,oG=null;async function oZ(){return oG??(oG=oY().then(({map:e,complete:t})=>(t||(oG=null),e))),oG}async function oY(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){n=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${r}`,e)}}return{map:oq(t),complete:n}}function oq(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function oJ(){let e={};try{let t=o4();for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);if(r?.startsWith(oU)){let n=r.slice(oU.length);if(!t.includes(n)){let t=localStorage.getItem(r);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function oX(){let e=await oZ();return oH?oq([e,oK??oJ()]):e}async function oQ(){return oZ()}async function o0(){return oH?oq([await oZ(),oJ()]):oZ()}function o1(e){if(!oH)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(oU)){let t=localStorage.getItem(n);t&&(e[n.slice(oU.length)]=t)}}return{imports:e}}return oJ()}function o4(){if(!oH)return[];try{let e=localStorage.getItem(oz);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function o2(e){return!!oH&&o4().includes(e)}function o3(e,t){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(oU+e,t),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function o6(e){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(oU+e);let t=o4().filter(t=>t!==e);t.length>0?localStorage.setItem(oz,JSON.stringify(t)):localStorage.removeItem(oz),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function o5(){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(oU)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(oz),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function o9(e){if(!oH)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=o4().filter(t=>t!==e);t.length>0?localStorage.setItem(oz,JSON.stringify(t)):localStorage.removeItem(oz),window.dispatchEvent(new CustomEvent(oW))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let o8=!1;function o7(){!o8&&(o8=!0,(oH="development"===window.spaEnv)&&(oK=oJ()))}function ie(e){return e.replace(/[\/\-@]/g,"_")}async function it(e,t="./start",r){var a;let o,i=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([ir(e,r?.importMap),new Promise((t,n)=>{o=setTimeout(()=>{var t;n(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=ie(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(n.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function ir(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let n=ie(e);if(!window[n]){let n=t??await ia();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let r=n.imports[e];r.startsWith("./")&&(r=window.spaBase+r.substring(1));let a=e in o1().imports;try{return await function(e){var t;let n=(t=window)[io]??(t[io]=new Map),r=n.get(e);if(r)return r;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,r)=>{let o=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function i(){clearTimeout(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),n.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),r(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return n.set(e,o),o}(r)}catch(e){return a&&x({kind:"error",title:oe("scriptLoadingFailed","Error: Script failed to load"),description:oe("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:r}),actionButtonLabel:oe("resetOverrides","Reset overrides"),onActionButtonClick(){o5(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function ia(){return oX()}let io=Symbol.for("__openmrs_script_loading");function ii(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function is(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&ii(t))}let il="openmrs-routes:",iu="openmrs-routes:change",ic=!1,id=null,im=null;async function ip(){return im??(im=ih().then(({map:e,complete:t})=>(t||(im=null),e))),im}async function ih(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&is(e)&&t.push(e)}catch(e){n=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${r}`,e)}}return{map:ig(t),complete:n}}function ig(e){let t={routes:{}};for(let n of e)n&&"object"==typeof n&&!Array.isArray(n)&&(Object.assign(t.routes,n.routes),void 0===t.version&&void 0!==n.version&&(t.version=n.version));return t}async function iy(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(il)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(il.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(ii(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),r=await t.json();if(ii(r))return{moduleName:e,routes:r};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e.routes[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function iv(){let e=await ip();return ic?ig([e,id??await iy()]):e}async function ib(){return ip()}async function iw(){return ic?ig([await ip(),await iy()]):ip()}function iE(){if(!ic)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(il)){let t=localStorage.getItem(n);t&&(e[n.slice(il.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function ix(e,t){if(!ic)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(il+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!ii(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(il+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(il+e,JSON.stringify(t.toString()));else{if(!ii(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(il+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(iu))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function iD(e){if(!ic)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(il+e),window.dispatchEvent(new CustomEvent(iu))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function iS(){if(!ic)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(il)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(iu))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let i_=null;function iC(){return i_||(i_=(ic="development"===window.spaEnv)?iy().then(e=>{id=e}):Promise.resolve())}let ik=`${op}/attachment`;function iP(e,t){return oy(`${ik}/${e}`,{signal:t.signal})}function iR(e,t,n,r){return oy(iT(e,t,r),{signal:n.signal})}function iT(e,t,n){return n?`${ik}?patient=${e}&encounter=${n}`:`${ik}?patient=${e}&includeEncounterless=${t}`}async function iO(e,t,n){let r=new FormData;return r.append("fileCaption",t.fileDescription),r.append("patient",e),n&&r.append("encounter",n),t.file?r.append("file",t.file,t.fileName):(r.append("file",new File([""],t.fileName),t.fileName),r.append("base64Content",t.base64Content)),oy(`${ik}`,{method:"POST",body:r})}function i$(e,t){return oy(`${ik}/${e}`,{method:"DELETE",signal:t.signal})}async function iN(e,t){return e?(await oy(`${of}/Patient/${e}`,t)).data:null}function iA(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function iI(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}function iM(e){return{uuid:e.uuid,display:e.display}}function ij(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let r=n.toString();return oy(`${op}/location${r?"?"+r:""}`).then(e=>e.data.results.map(iM))}function iL(e){return{uuid:e.uuid,display:e.display,name:e.name}}let iF=`${op}/visittype`;function iB(e=iF){return oy(e).then(e=>e.data.results.map(iL))}var iV=((J={}).NEWVISIT="startVisit",J.EDITVISIT="editVisit",J.LOADING="loadingVisit",J),iU=((X={}).NOTSTARTED="notStarted",X.ONGOING="ongoing",X);let iz="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",iW=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function iH(){return W("visit",iW)}function iK(e,t){iH().setState({patientUuid:e,manuallySetVisitUuid:t})}function iG(e,t){return oy(`${op}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function iZ(e,t,n){return oy(`${op}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function iY(e,t,n){return oy(`${op}/visit?patient=${e}&v=${n??iz}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}iH().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iq{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iq.version}static addUnaryOp(e){return iq.max_unop_len=Math.max(e.length,iq.max_unop_len),iq.unary_ops[e]=1,iq}static addBinaryOp(e,t,n){return iq.max_binop_len=Math.max(e.length,iq.max_binop_len),iq.binary_ops[e]=t,n?iq.right_associative.add(e):iq.right_associative.delete(e),iq}static addIdentifierChar(e){return iq.additional_identifier_chars.add(e),iq}static addLiteral(e,t){return iq.literals[e]=t,iq}static removeUnaryOp(e){return delete iq.unary_ops[e],e.length===iq.max_unop_len&&(iq.max_unop_len=iq.getMaxKeyLen(iq.unary_ops)),iq}static removeAllUnaryOps(){return iq.unary_ops={},iq.max_unop_len=0,iq}static removeIdentifierChar(e){return iq.additional_identifier_chars.delete(e),iq}static removeBinaryOp(e){return delete iq.binary_ops[e],e.length===iq.max_binop_len&&(iq.max_binop_len=iq.getMaxKeyLen(iq.binary_ops)),iq.right_associative.delete(e),iq}static removeAllBinaryOps(){return iq.binary_ops={},iq.max_binop_len=0,iq}static removeLiteral(e){return delete iq.literals[e],iq}static removeAllLiterals(){return iq.literals={},iq}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new iq(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return iq.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iq.binary_ops[String.fromCharCode(e)]||iq.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iq.isIdentifierStart(e)||iq.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(iq.hooks[e]){let n={context:this,node:t};return iq.hooks.run(e,n),n.node}return t}searchHook(e){if(iq.hooks[e]){let t={context:this};return iq.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iq.SPACE_CODE||e===iq.TAB_CODE||e===iq.LF_CODE||e===iq.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:iq.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],n,r;for(;this.index<this.expr.length;)if((n=this.code)===iq.SEMCOL_CODE||n===iq.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())t.push(r);else if(this.index<this.expr.length){if(n===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,iq.max_binop_len),t=e.length;for(;t>0;){if(iq.binary_ops.hasOwnProperty(e)&&(!iq.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iq.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,r,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iq.binaryPrecedence(t),right_a:iq.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),r=[o,a,i];t=this.gobbleBinaryOp();){if(0===(n=iq.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:n,right_a:iq.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;r.length>2&&s(r[r.length-2]);)i=r.pop(),t=r.pop().value,o=r.pop(),e={type:iq.BINARY_EXP,operator:t,left:o,right:i},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),r.push(a,e)}for(s=r.length-1,e=r[s];s>1;)e={type:iq.BINARY_EXP,operator:r[s-1].value,left:r[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,iq.isDecimalDigit(e)||e===iq.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iq.SQUOTE_CODE||e===iq.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===iq.OBRACK_CODE)r=this.gobbleArray();else{for(n=(t=this.expr.substr(this.index,iq.max_unop_len)).length;n>0;){if(iq.unary_ops.hasOwnProperty(t)&&(!iq.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iq.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:iq.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}iq.isIdentifierStart(e)?(r=this.gobbleIdentifier(),iq.literals.hasOwnProperty(r.name)?r={type:iq.LITERAL,value:iq.literals[r.name],raw:r.name}:r.name===iq.this_str&&(r={type:iq.THIS_EXP})):e===iq.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===iq.PERIOD_CODE||t===iq.OBRACK_CODE||t===iq.OPAREN_CODE||t===iq.QUMARK_CODE;){let n;if(t===iq.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iq.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iq.OBRACK_CODE?((e={type:iq.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iq.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iq.OPAREN_CODE?e={type:iq.CALL_EXP,arguments:this.gobbleArguments(iq.CPAREN_CODE),callee:e}:(t===iq.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:iq.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,n;for(;iq.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iq.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iq.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));iq.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iq.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return n=this.code,iq.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(n===iq.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iq.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iq.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,n=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){r=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:iq.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iq.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iq.isIdentifierPart(e))this.index++;else break;return{type:iq.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],n=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){n=!0,this.index++,e===iq.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iq.COMMA_CODE){if(this.index++,++r!==t.length){if(e===iq.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iq.CBRACK_CODE)for(let e=t.length;e<r;e++)t.push(null)}}else if(t.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==iq.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iq.CPAREN_CODE);if(this.code===iq.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iq.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iq.ARRAY_EXP,elements:this.gobbleArguments(iq.CBRACK_CODE)}}}Object.assign(iq,{hooks:new class{add(e,t,n){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(iq),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),iq.max_unop_len=iq.getMaxKeyLen(iq.unary_ops),iq.max_binop_len=iq.getMaxKeyLen(iq.binary_ops);let iJ=e=>new iq(e).parse(),iX=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iq).filter(e=>!iX.includes(e)&&void 0===iJ[e]).forEach(e=>{iJ[e]=iq[e]}),iJ.Jsep=iq,iJ.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}});let iQ="ArrowFunctionExpression",i0={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},i1={...i0,Promise};function i4(e,t={}){return i8(e,t,st)}async function i2(e,t={}){return i7(e,t,st)}function i3(e,t={}){return i8(e,t,sn)}function i6(e,t={}){return i7(e,t,sn)}function i5(e,t={}){return i8(e,t,sr)}function i9(e,t={}){return i7(e,t,sr)}function i8(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let r=sl(t,i0),a=sa("string"==typeof e?iJ(e):e,r);if(n(a))return a;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function i7(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let r=sl(t,i1);return Promise.resolve(sa("string"==typeof e?iJ(e):e,r)).then(t=>{if(n(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function se(e){return iJ(e)}function st(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function sn(e){return"boolean"==typeof e}function sr(e){return"number"==typeof e}function sa(e,t){switch(e.type){case"UnaryExpression":var n,r,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=sa(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return sa(v.left,b)&&sa(v.right,b);case"||":return sa(v.left,b)||sa(v.right,b);case"??":return sa(v.left,b)??sa(v.right,b)}let w=sa(v.left,b),E=sa(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return n=e,r=t,sa(n.test,r)?sa(n.consequent,r):sa(n.alternate,r);case"CallExpression":return sd(si(e,t));case"ArrowFunctionExpression":let x;return a=e,o=t,x=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<x.length)throw`Required argument(s) ${x.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(x.reduce((t,n,r)=>{let a=e[r];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(a)&&t.push([n,a]),t},[]));return sa(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return sd(ss(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(sm(s));case"SequenceExpression":let D;return l=e,u=t,(D=l.expressions.map(sm(u)))[D.length-1];case"NewExpression":var S=e,_=t;if(S.callee&&"Identifier"===S.callee.type){let e=S.arguments?.map(sm(_));switch(S.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${S.callee.name}`}}if(S.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(sp(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return m=e,p=t,C=m.expressions?.map(sm(p))??[],(k=m.quasis?.map(sm(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function so(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return so(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function si(e,t){let n=sc(e.callee,t);if(n===su||e.optional&&null==n)return su;let r=e.arguments?.map(sm(t));if(n){if("function"!=typeof n)throw`${sg(e.callee)} is not a function`}else throw`No function named ${sg(e.callee)} is defined in this context`;return n(...r)}function ss(e,t){let n=sc(e.object,t);if(n===su||e.optional&&null==n)return su;if(null===n)throw TypeError(`TypeError: cannot read properties of null (reading '${sh(e.property,t)}')`);if(void 0===n)switch(e.object.type){case"Identifier":{let n=so(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${sh(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof n&&"function"!=typeof n&&"string"!=typeof n&&"number"!=typeof n)throw`VisitMemberExpression does not support member access on type ${typeof n}`;let r=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(sa(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);sp(r),function(e,t){if(sf.has(String(t)))return;let n=Object(e);for(;null!==n;){if(Object.hasOwn(n,t)){if(n===Object.prototype||n===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}n=Object.getPrototypeOf(n)}}(n,r);let a=n[r];return"function"==typeof a?a.bind(n):a}function sl(e,t){let n={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}iJ.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let n=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let n=this.gobbleBinaryExpression();n||this.throwError("Expected expression after "+e),t.node={type:iQ,params:null,body:n};return}}this.index=n}}),e.hooks.add("after-expression",function(t){!function t(n){n&&(Object.values(n).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===n.operator&&(n.type=iQ,n.params=n.left?[n.left]:null,n.body=n.right,n.params&&n.params[0].type===e.SEQUENCE_EXP&&(n.params=n.params[0].expressions),delete n.left,delete n.right,delete n.operator))}(t.node)})}}),iJ.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let r=t.node;for(;r.type===e.MEMBER_EXP||r.type===e.CALL_EXP&&r.callee.type===e.MEMBER_EXP;)r=r.type===e.MEMBER_EXP?r.object:r.callee.object;r.type="NewExpression"}})}}),iJ.plugins.register({name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function n(t){let n=this.index,r="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:r+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(r+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(r+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(r+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+r+this.char+")");else if(i===e.PERIOD_CODE){r.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:r},null,2)}`),this.index=n;return}t.node={type:e.LITERAL,value:parseFloat(r),raw:this.expr.substring(n,this.index)}}e.hooks.add("gobble-token",function(r){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,n.call(this,r);return}this.throwError("unexpected char within number")}r.node={type:e.LITERAL,value:parseInt(c,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&n.call(this,r)})}}),iJ.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let n=++this.index,r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){let r,a=this.expr.slice(n,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{r=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?r=!0:r&&this.code===e.CBRACK_CODE&&(r=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),iJ.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}}),iJ.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,n=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},r="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:r},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,n&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",r="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+=" ";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:r+=i}else r+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(n){if((n.node.type===e.IDENTIFIER||n.node.type===e.MEMBER_EXP)&&96===this.code)return n.node={type:"TaggedTemplateExpression",tag:n.node,quasi:t.bind(this)(n,!1)},n.node=this.gobbleTokenProperty(n.node),n.node})}}),iJ.addBinaryOp("in",7),iJ.addBinaryOp("??",1);let su=Symbol("optional chain short-circuited");function sc(e,t){switch(e.type){case"MemberExpression":return ss(e,t);case"CallExpression":return si(e,t);default:return sa(e,t)}}function sd(e){return e===su?void 0:e}function sm(e){return function(t){return null===t?null:sa(t,e)}}function sp(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let sf=new Set(["toString","valueOf","hasOwnProperty"]);function sh(e,t){try{return so(e,t)}catch{return"<computed>"}}function sg(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function sy(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...i1},boundNames:new Set,variables:new Set};return sv("string"==typeof e?iJ(e):e,t),[...t.variables]}function sv(e,t){switch(e.type){case"UnaryExpression":return n=e,r=t,void sv(n.argument,r);case"BinaryExpression":return a=e,o=t,void(sv(a.left,o),sv(a.right,o));case"ConditionalExpression":return i=e,s=t,void(sv(i.consequent,s),sv(i.test,s),sv(i.alternate,s));case"CallExpression":return l=e,u=t,void(sv(l.callee,u),l.arguments?.map(sb(u)));case"ArrowFunctionExpression":var n,r,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,E,x=e,D=t;let S=new Set(D.boundNames);for(let e of x.params??[])e?.type==="Identifier"&&S.add(e.name);sv(x.body,{...D,boundNames:S});return;case"MemberExpression":return c=e,d=t,void(sv(c.object,d),c.computed&&sv(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(sb(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(sb(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(sb(y));case"Literal":case"TemplateElement":return;case"Identifier":return v=e,b=t,void(v.name in b.globals||b.boundNames.has(v.name)||b.variables.add(v.name));case"TemplateLiteral":return w=e,E=t,void(w.expressions?.map(sb(E)),w.quasis?.map(sb(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function sb(e){return function(t){return null===t?null:sv(t,e)}}let sw=W("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),r=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...r}}return e}()});function sE(e,t,n){sw.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:t,description:n}}}))}function sx(){let e=sw.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function sD(e){return sw.getState().flags[e].enabled}function sS(e,t){sw.subscribe(n=>{t(n.flags[e].enabled)})}function s_(e,t){sw.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}sw.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});var sC=e6(function(e,t,n){eZ(e,t,n)});let sk=V("extensionsInternal",{slots:{},extensions:{}}),sP=V("extensionRenderings",{renderings:new Map}),sR=()=>W("extensionsInternal",{slots:{},extensions:{}}),sT=()=>W("extensionRenderings",{renderings:new Map});function sO(e){let t=sk.getState(),n=e(t);n!==t&&sk.setState(n)}let s$=null,sN=null;function sA(){let e=sP.getState();return s$&&e===sN||(s$=new Map(e.renderings),sN=e,function(e){for(let t of(sW.clear(),e.values()))sK(t,1);sH=!0}(s$)),s$}function sI(e){sN={renderings:e},sP.setState(sN,!0)}function sM(e){let t=sA();t.has(e.renderingId)||(t.set(e.renderingId,e),sK(e,1),sI(t))}function sj(e){let t=sA(),n=t.get(e);n&&(t.delete(e),sK(n,-1),sI(t))}let sL=()=>W("extensions",{slots:{}}),sF=0,sB=new Set;function sV(e){sF++;try{return e()}finally{if(0==--sF&&sB.size>0){let e=Array.from(sB);for(let t of(sB.clear(),e))sU(t)}}}function sU(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sz(e){sF>0?sB.add(e):sU(e)}let sW=new Map,sH=!1;function sK(e,t){let n=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),r=sW.get(n);if(!r){if(t<0)return;sW.set(n,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sH=!0;return}r.count+=t,r.count<1&&(sW.delete(n),sH=!0)}function sG(){var e,t;if(sA(),!sH)return;sH=!1;let n=Array.from(sW.values(),({record:e})=>e);n.sort(sZ),e=tX.getState().mountedExtensions,t=n,e.length===t.length&&e.every((e,n)=>0===sZ(e,t[n]))||tX.setState({mountedExtensions:n})}function sZ(e,t){return sY(e.slotName,t.slotName)||sY(e.extensionId,t.extensionId)||sY(e.slotModuleName,t.slotModuleName)||sY(e.extensionModuleName,t.extensionModuleName)}function sY(e,t){return e===t?0:e<t?-1:1}sG(),sP.subscribe(()=>sz(sG));let sq=sR(),sJ=sL(),sX=t0(),sQ=t2(),s0=new Set,s1=!1;function s4(e){if(null===e)s0=null;else if(null!==s0)for(let t of e)s0.add(t);sz(s2)}function s2(){if(!s1){s1=!0;try{for(let e=1;;e++){let t=s0;if(null!==t&&0===t.size)return;s0=new Set;try{!function(e,t,n,r,a,o=null){let i=sJ.getState().slots,s={},l=!1,u=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,c]of Object.entries(e.slots)){let d=i[r];if(d&&o&&!o.has(r)){s[r]=d;continue}let{config:m}=t4(t,c.name),p=function(e,t,n,r,a,o){let i=function(e,t){let n=e.add||[],r=e.remove||[],a=e.order||[],{extensions:o}=sq.getState(),i=new Set(r),s=[...t,...n].filter(e=>!i.has(e)),l=lr(a),u=lr(t),c=new Map(s.map(e=>[e,function(e,t,n,r){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==n)return 1e3+n;let t=r.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[s5(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(n,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=t3(r,e,l),u=t6(n,e,l),c=u?sC({},i,u):i,d=s5(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!oP(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(r,e,m,n,u,a.session);d&&d.moduleName===c.moduleName&&e8(d.candidateExtensions,p)?s[r]=d:(s[r]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sJ.setState({slots:s})}(sq.getState(),sX.getState(),sQ.getState(),sw.getState(),ob.getState(),t)}catch(e){throw s0=null===t||null===s0?null:new Set([...t,...s0]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{s1=!1}}}function s3(e,t){let n=new Set;for(let r of Object.keys(e))e[r]!==t[r]&&n.add(r);for(let r of Object.keys(t))r in e||n.add(r);return n}function s6(e,t){return{moduleName:t,name:e,attachedIds:[]}}function s5(e){let[t]=e.split("#");return t}function s9(e,t){let n=s5(t);return e.extensions[n]}function s8(e){return s9(sq.getState(),e)}sq.subscribe((e,t)=>{s4(e.extensions!==t.extensions?null:s3(e.slots,t.slots))}),sX.subscribe((e,t)=>{s4(s3(e.slots,t.slots))}),sQ.subscribe((e,t)=>{s4(s3(e.configs,t.configs))}),sw.subscribe(()=>s4(null)),ob.subscribe(()=>s4(null)),s4(null);let s7=e=>sO(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function le(e,t){sO(n=>{let r=n.slots[e];return r?{...n,slots:{...n.slots,[e]:{...r,attachedIds:[...r.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...s6(e),attachedIds:[t]}}}})}function lt(e,t){sO(n=>{let r=n.slots[e];return r&&r.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...r,attachedIds:r.attachedIds.filter(e=>e!==t)}}}:n})}function ln(e){sO(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function lr(e){let t=new Map;return e.forEach((e,n)=>{t.has(e)||t.set(e,n)}),t}function la(e,t){return function(e,t,n=null,r){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:n,...t}:{session:n});try{return!!i3(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(r?` in ${r}`:""),t),!1}})}(lo(e),t,ob.getState().session,e)}function lo(e){return sJ.getState().slots[e]?.candidateExtensions??[]}let li=(e,t)=>sq.setState(n=>{let r=n.slots[t]?.moduleName;if(r&&r!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${r}.`),n;if(r&&r==e)return n;if(n.slots[t])return{...n,slots:{...n.slots,[t]:{...n.slots[t],moduleName:e}}};let a=s6(t,e);return{...n,slots:{...n.slots,[t]:{...a}}}}),ls=()=>{s0=null,sO(()=>({slots:{},extensions:{}})),sT().setState({renderings:new Map}),sJ.setState({slots:{}})},ll=V("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function lu({name:e,basePath:t,mode:n,componentContext:r,state:a}){ll.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:r,state:a})}function lc(e){ll.getState().slotName===e&&ll.setState(ll.getInitialState(),!0)}let ld=V("modalRegistry",{modals:{}});function lm(e){ld.setState(t=>(t.modals[e.name]=e,t))}function lp(e){let t=ld.getState().modals[e];if(!t){let n=s8(e);n&&(t={name:e,load:n.load,moduleName:n.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),lm(t))}return t}let lf=V("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function lh(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=lf.getState(),r=t[e];if(r){let t=n[r.window];if(t)return t;throw Error(`No workspace window found with name: ${r.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function lg(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=lf.getState(),r=n[e];if(r){let n=t[r.group];if(n)return n;throw Error(`No workspace group found with name: ${r.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function ly(e){let{openedWindows:t}=lf.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function lv(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=lf.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);r[n.name]={...n,moduleName:e}}lf.setState({registeredGroupsByName:r})}function lb(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=lf.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}lf.setState({registeredWindowsByName:r})}function lw(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=lf.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}lf.setState({registeredWorkspacesByName:r})}let lE=0,lx=null,lD={bootstrap:15e3,mount:15e3,unmount:15e3};function lS(e,t){if(e.timeouts)return e;let n=e.name??"parcel",r=Object.fromEntries(Object.keys(lD).filter(t=>e[t]).map(r=>{var a,o;let i,s;return[r,(a=e[r],o=lD[r],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${r} at array index ${o} for parcel ${n} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${r} for parcel ${n} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(r,!1),e),e=>{throw t(r,!0),e})})]}));return{...e,...r}}async function l_(e,t){var n,r;let a,o,i,s,l,u=await (lx??(lx=new Promise((e,t)=>{rN({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),rN))),lx),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return r=u((n=d.onSettled,"function"==typeof e?()=>e().then(e=>lS(e,n)):lS(e,n)),c),s=e=>t=>e.call(r,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===r.getStatus()&&d.release(),e}),l=r.update&&s(r.update),Object.defineProperty(r,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function lC(){return lk}function lk(e,t){let n,r=l_(e,t).then(e=>n=e);return{mount:()=>r.then(e=>e.mount()),unmount:()=>r.then(e=>e.unmount()),update:e=>r.then(t=>t.update?.(e)),getStatus:()=>n?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return r.then(e=>e.loadPromise)},get bootstrapPromise(){return r.then(e=>e.bootstrapPromise)},get mountPromise(){return r.then(e=>e.mountPromise)},get unmountPromise(){return r.then(e=>e.unmountPromise)}}}async function lP(e,t,n,r,a=e=>e,o={}){let i=s5(r),s=s8(r),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:m}=s,p=lE++,f=`${t}/${r}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{sj(f)}catch(t){console.error(e,t)}};try{sM({renderingId:f,extensionName:i,extensionModuleName:d,extensionId:r,slotName:t,slotModuleName:n})}catch(e){throw h(`Recomputing configuration after registering '${r}' failed also failed`),e}try{u=await m()}catch(e){throw h(`Recomputing configuration after '${r}' failed to load also failed`),e}try{l=await l_(a({...u,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:r,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${r}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${r}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${r}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${r}' failed`),e=>{console.error(`Extension '${r}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${r}' failed to unmount also failed`)})}else console.warn(`Tried to render ${r} into ${t} but no DOM element was available.`);return l}var lR=n(5399),lT=n.n(lR);let lO=(0,lR.createContext)({moduleName:"",featureName:""});var l$=n(3338);function lN({to:e,templateParams:t,onBeforeNavigate:n,children:r,...a}){return(0,lR.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),(0,l$.jsx)("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),n?.(r),or({to:e,templateParams:t})),0===r.button&&(r.ctrlKey||r.metaKey)&&n?.(r),0===r.button&&r.shiftKey&&n?.(r),1===r.button&&n?.(r)},href:ot(e,t),...a,children:r})}let lA=({state:e,children:t,...n})=>{let{extension:r}=(0,lR.useContext)(lO),a=(0,lR.useRef)(null),o=(0,lR.useRef)(Promise.resolve()),i=(0,lR.useRef)(!1),s=(0,lR.useRef)(!1),l=(0,lR.useRef)(e),u=(0,lR.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,lR.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${r?.extensionId}' failed to update`,e)}))},[]),d=(0,lR.useCallback)(t=>{t&&!a.current&&!s.current&&r?.extensionSlotName&&r.extensionSlotModuleName&&(s.current=!0,lP(t,r.extensionSlotName,r.extensionSlotModuleName,r.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,lR.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,lR.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),r?(0,l$.jsx)("div",{ref:d,"data-extension-id":r?.extensionId,style:{position:"relative"},...n}):null};function lI(e){let t=(0,lR.useRef)(e);return O(t.current,e)||(t.current=e),t.current}function lM(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[r,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};n[r]=t}return n}let lj=e=>e;function lL(e,t=lj,n){let r=(0,lR.useCallback)(t=>e.subscribe(t),[e]),a=(0,lR.useCallback)(()=>t(e.getState()),[e,t]),o=(0,lR.useSyncExternalStore)(r,a,a),i=(0,lR.useMemo)(()=>n?lM(e,n):null,[e,n]);return(0,lR.useMemo)(()=>i?{...o,...i}:o,[o,i])}function lF(e,t){return lL(e,lj,t)}function lB(e){return function(t){let n=(0,lR.useCallback)(t=>e.subscribe(t),[]),r=(0,lR.useCallback)(()=>e.getState(),[]),a=(0,lR.useSyncExternalStore)(n,r,r),o=(0,lR.useMemo)(()=>t?lM(e,t):null,[t]);return(0,lR.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let lV=[];Object.freeze(lV);let lU={candidateExtensions:lV};Object.freeze(lU);let lz=e=>{let t=(0,lR.useCallback)(t=>t.slots?.[e]??lU,[e]);return lL(sL(),t)},lW=e=>e.session;function lH(e,t){let{candidateExtensions:n}=lz(e),r=lL(ob,lW),a=lI(t);return(0,lR.useMemo)(()=>la(e,a),[e,a,r,n])}function lK(e,t){let{moduleName:n}=(0,lR.useContext)(lO);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,lR.useEffect)(()=>{li(n,e)},[n,e]),{extensions:lH(e,t),extensionSlotName:e,extensionSlotModuleName:n}}function lG(e){return e}function lZ({name:e,extensionSlotName:t,select:n=lG,children:r,state:a,style:o,...i}){if(r&&a)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??t,l=(0,lR.useRef)(null),{extensions:u,extensionSlotModuleName:c}=lK(s,a),d=(0,lR.useMemo)(()=>n(u),[n,u]),m=(0,lR.useMemo)(()=>{if("function"==typeof r&&!lT().isValidElement(r))return d.map(e=>r(e,a))},[r,d]);return(0,l$.jsx)("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i,children:s&&d?.map((e,t)=>(0,l$.jsx)(lO.Provider,{value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}},children:m?.[t]??("function"!=typeof r?r:null)??(0,l$.jsx)(lA,{state:a})},e.id))})}var lY=n(6442),lq=n.n(lY);function lJ(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 lX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lJ(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],a in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function lQ(e){return(lQ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l0(e){return(l0="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l1(e,t){var n;if("function"!=typeof(n=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(l0(n)));return function(){var e=n(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(l0(e)));return e}}var l4=null;try{l4=require("react").createContext()}catch(e){}var l2={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function l3(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function l6(e,t){return new Promise(function(n,r){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=l7(e,t,function(){n(this)}),i=l1(e,t)(),s=function(e){var t=e.reactDom,n=e.renderType,r=e.elementToRender,a=e.domElement,o=t[n];if("function"!=typeof o)throw Error('renderType "'.concat(n,'" did not return a function.'));switch(n){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(r),i;case"hydrateRoot":return o(a,r);default:return o(r,a),null}}({elementToRender:o,domElement:i,reactDom:l8(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function l5(e,t){return new Promise(function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():l8(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function l9(e,t){return new Promise(function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=l7(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(r);else{var o=l1(e,t)();l8(e).render(r,o)}})}function l8(e){return e.ReactDOMClient||e.ReactDOM}function l7(e,t,n){var r=e.React.createElement(e.rootComponent,t),a=l4?e.React.createElement(l4.Provider,{value:t},r):r;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function n(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},n}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lX(lX({},t),{},{mountFinished:n,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var ue=n(7807),ut=n(1619),un=n.n(ut),ur=n(3432);let ua={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},uo=new Map;(0,ur.initCache)(uo);let ui={errorRetryCount:3,fetcher:oy,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof ov){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>uo};function us(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},ua,e),n={...ui,...t.swrConfig};return function(e){var r,a,o,i,s;return o=a=class extends(r=lT().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return(0,l$.jsx)("div",{children:"An error has occurred. Please try reloading the page."});{let r=(0,l$.jsx)(lR.Suspense,{fallback:null,children:(0,l$.jsx)(ut.SWRConfig,{value:n,children:(0,l$.jsx)(lO.Provider,{value:this.state.config,children:t.disableTranslations?(0,l$.jsx)(e,{...this.props}):(0,l$.jsx)(ue.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName,children:(0,l$.jsx)(e,{...this.props})})})})});return t.strictMode&&lT().StrictMode?(0,l$.jsx)(lT().StrictMode,{children:r}):r}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function ul(e,t){return function(e){if("object"!==lQ(e))throw Error("single-spa-react requires a configuration object");var t,n=lX(lX({},l2),e);if(!n.React)throw Error("single-spa-react must be passed opts.React");if(!n.ReactDOM&&!n.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(n.renderType||(null!=(t=n.ReactDOMClient)&&t.createRoot?n.renderType="createRoot":n.renderType="render"),!n.rootComponent&&!n.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(n.errorBoundary&&"function"!=typeof n.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!l4&&n.React.createContext&&(l4=n.React.createContext()),n.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(n);var r={bootstrap:l3.bind(null,n),mount:l6.bind(null,n),unmount:l5.bind(null,n)};return n.parcelCanUpdate&&(r.update=l9.bind(null,n)),r}({React:lT(),ReactDOMClient:lq(),rootComponent:us(t)(e)})}function uu(e,t){return()=>e().then(({default:e})=>ul(e,t))}function uc(e,t){return()=>Promise.resolve(ul(e,t))}let ud=uu,um=I()(()=>({}));z("openmrs-app-context",um);let up={};function uf(e,t=e=>e){let n=um.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function uh(e,t){um.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function ug(e){return null===e?null:Object.freeze(Object.assign({},e))}let uy=new Map;function uv(e,t){let n=(0,lR.useRef)(t??{}),r=(0,lR.useRef)(t=>uh(e,t)),a=(0,lR.useRef)(Symbol());return(0,lR.useEffect)(()=>{let n=t??{},r=a.current;return null===uf(e)?!function(e,t=up){um.setState(n=>{if(e in n)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},n,{[e]:t===up?{}:t})})}(e,n):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),uh(e,()=>n)),uy.set(e,r),()=>{uy.get(e)===r&&(um.setState(t=>(e in t&&delete t[e],t)),uy.delete(e))}},[e]),(0,lR.useEffect)(()=>{let r=t??{};O(n.current,r)||(uh(e,()=>r),n.current=r)},[t]),r.current}function ub({namespace:e,value:t}){return uv(e,t),null}let uw=({children:e,value:t,fallback:n})=>t?(0,l$.jsx)(l$.Fragment,{children:e}):n?(0,l$.jsx)(l$.Fragment,{children:n}):null;function uE(){let e=(0,lR.useRef)(null);return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,lR.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function ux(e,t=e=>e??{}){let[n,r]=(0,lR.useState)(()=>{if(uD(e))return;let n=uf(e);if(null!==n)return t?t(n):n});return(0,lR.useEffect)(()=>{if(uD(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,lR.useEffect)(()=>{var n;let a;return(n=e=>{if(null==e)return void r(void 0);let n=t?t(e):e;r(e=>O(e,n)?e:n)})(ug(a=uf(e))),um.subscribe(t=>{let r=e in t?t[e]:null;r!==a&&(a=r,n(ug(r)))})},[e,t]),n}function uD(e){return"string"!=typeof e||0===e.trim().length}function uS(e){let t=lH(e);return(0,lR.useMemo)(()=>t.map(e=>e.id),[t])}function u_(e){return lz(e).candidateExtensions}function uC(e,t,n){let{data:r,error:a,mutate:o,isLoading:i,isValidating:s}=un()(e?iT(e,t,n):null,oy);return(0,lR.useMemo)(()=>({isLoading:i,data:r?.data.results??[],error:a,mutate:o,isValidating:s}),[r,a,i,s,o])}function uk(e){(0,lR.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let uP={},uR=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
|
|
16
|
+
Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function uT(e,t,n){let r=uP[e];if(r)return r;let a=new Promise(e=>{let r=n(t.getState());if(r)return void e(r);let a=t.subscribe(t=>{let r=n(t);r&&(a(),e(r))})});return uP[e]=a,a.then(()=>{uP[e]===a&&delete uP[e]}),a}function uO(e){let{moduleName:t,extension:n}=(0,lR.useContext)(lO),r=e?.externalModuleName??t;if(!r&&!n)throw Error(uR);let a=function(e){let t=(0,lR.useMemo)(()=>tQ(e),[e]),n=function(e){let[t,n]=(0,lR.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,lR.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&n(e.config)}),[e]),t}(t);if(!n)throw uT(e,t,e=>e.loaded?e.config:null);return n}(r),o=function(e){let t=(0,lR.useMemo)(t2,[]),n=function(e,t){let[n,r]=(0,lR.useState)(t?()=>{let n=t3(e.getState(),t.extensionSlotName,t.extensionId);if(n.loaded&&n.config)return n.config}:null);return(0,lR.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=t3(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!e8(a.config,n)&&r(a.config)})},[e,t,n]),n}(t,e);if(!n&&e)throw uT(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let n=t3(t,e.extensionSlotName,e.extensionId);return n.loaded?n.config:null});return n||{}}(n);return(0,lR.useMemo)(()=>e?.externalModuleName&&r===e.externalModuleName?{...a}:{...a,...o},[r,e?.externalModuleName,a,o])}let u$=lH;function uN(e,t=300){let[n,r]=(0,lR.useState)(e);return(0,lR.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var uA=n(3660),uI=n.n(uA);let uM=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function uj(){let e=`${op}/emrapi/configuration?v=${uM}`,t=uI()(e,oy);return(0,lR.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}function uL(){return(0,lR.useContext)(lO).extension}let uF=lB(sR());function uB(e){let t=lH(e);return(0,lR.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let uV=lB(sL());function uU(e){let{flags:t}=lL(sw);return t[e]?.enabled??!1}function uz(){let[,e]=(0,lR.useState)(0);return(0,lR.useCallback)(()=>{e(e=>e+1)},[])}function uW(e,t,n={}){return uK(e,t,uH,n)}let uH={getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(og(e.toString()),window.location.toString());return r.searchParams.set("limit",""+t),r.searchParams.set("startIndex",""+n),r.searchParams.set("totalCount","true"),r.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function uK(e,t,n,r={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=n,{immutable:l,swrConfig:u}=r,c=r.fetcher??oy,[d,m]=(0,lR.useState)(1),p=(0,lR.useRef)(NaN),f=(0,lR.useRef)(NaN),h=(0,lR.useRef)(d),g=(0,lR.useRef)(!1),y=(0,lR.useRef)(!1),v=e?.toString()??"",[b,w]=(0,lR.useState)(v);v!==b&&(w(v),m(1),h.current=1,p.current=NaN,f.current=NaN,g.current=!1,y.current=!1);let E=(d-1)*t,x=(0,lR.useMemo)(()=>a(e,t,E),[e,t,E]),{data:D,...S}=(l?uI():un())(x,c,u);D?.data&&(p.current=o(D?.data),f.current=i(D?.data),g.current=!0);let _=Math.ceil(p.current/t),C=(0,lR.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let n=Math.ceil(p.current/t);!g.current||Number.isNaN(n)||e<=n?(h.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,lR.useEffect)(()=>{if(!g.current)return;if(Number.isNaN(p.current)){y.current||(y.current=!0,console.warn(`useServerPagination: ${v} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(p.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),h.current=e,m(e))},[d,t,v,D]);let k=(0,lR.useCallback)(()=>{C(h.current+1)},[C]),P=(0,lR.useCallback)(()=>{C(h.current-1)},[C]);return{data:s(D?.data),totalPages:_,totalCount:p.current,currentPage:d,currentPageSize:f.current,paginated:_>1,showNextButton:d<_,showPreviousButton:d>1,goTo:C,goToNext:k,goToPrevious:P,...S}}function uG(e,t,n={}){return uK(e,t,uZ(),n)}function uZ(){return{getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(og(e.toString()),window.location.toString());return r.searchParams.set("_count",""+t),r.searchParams.set("_getpagesoffset",""+n),r.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var uY=n(682),uq=n.n(uY);function uJ(e,t={}){return uX(e,uH,t)}function uX(e,t,n={}){let{swrInfiniteConfig:r,immutable:a}=n,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=n.fetcher??oy,u=(0,lR.useCallback)((n,r)=>0==n?e?.toString()??null:t.getNextUrl(r.data),[e]),{data:c,size:d,setSize:m,...p}=uq()(u,l,{...r,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),f=o(c?.[c.length-1].data),h=i(c?.[0]?.data);return{data:c?.flatMap(e=>s(e.data)),totalCount:h,hasMore:null!=f,loadMore:()=>{m((c?.length??0)+1)},nextUri:f,...p}}function uQ(e,t={}){return u0(e,uH,t)}function u0(e,t,n={}){let r=uX(e,t,n),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:u}=r;return((0,lR.useEffect)(()=>{a&&!o&&s()},[a,u]),n.partialData)?r:{...r,data:a||o?void 0:i,isLoading:l||a}}function u1(e,t={}){return u0(e,uZ(),t)}function u4(e,t={}){return uX(e,uZ(),t)}function u2(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function u3(){let[e,t]=(0,lR.useState)(u2);return(0,lR.useEffect)(()=>{let e=()=>{t(u2())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let u6=e=>"small-desktop"===e||"large-desktop"===e;function u5(e){let t=(0,lR.useContext)(lO);(0,lR.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),lu(e),()=>{lc(e.name)}),[t,e])}function u9(){return lL(ll)}let u8=[];function u7(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let r=n.toString(),{data:a}=uQ(`${op}/location${r?"?"+r:""}`,{immutable:!0});return a??u8}function ce(e,t=!0){let n=(0,lR.useRef)(null);return(0,lR.useEffect)(()=>{let r=r=>{t&&n.current&&r.target&&r.target instanceof Node&&(n.current.contains(r.target)||e(r))};return window.addEventListener("mousedown",r),window.addEventListener("touchstart",r),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("touchstart",r)}},[e,t]),n}function ct(e){let t=(0,lR.useRef)(null);return(0,lR.useEffect)(()=>{let n=new IntersectionObserver(t=>{for(let n of t)if(n.isIntersecting)return void e()},{threshold:1});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current,e]),t}function cn(e,t={}){let{abortController:n,fetchInit:r,url:a,swrConfig:o}=t,i=uE(),s=(0,lR.useMemo)(()=>r?.signal??n?.signal??i.signal,[n?.signal,r?.signal,i.signal]),l=(0,lR.useCallback)(e=>oy(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,a),{...r,signal:s}),[s,r,a]);return un()(e,l,o)}function cr(e=[],t=10){let[n,r]=(0,lR.useState)(1),a=(0,lR.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);n>a&&r(a);let o=Math.min(Math.max(1,n),a),i=(0,lR.useMemo)(()=>{let n=(o-1)*t,r=(o+0)*t;return e.slice(n,r)},[e,o,t]),s=(0,lR.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):r(e)},[]),l=(0,lR.useCallback)(()=>{r(e=>e+1)},[]),u=(0,lR.useCallback)(()=>{r(e=>Math.max(1,e-1))},[]);return(0,lR.useMemo)(()=>({results:i,totalPages:a,currentPage:o,paginated:e.length>t,showNextButton:o<a,showPreviousButton:o>1,goTo:s,goToNext:l,goToPrevious:u}),[i,a,e.length,t,o,s,l,u])}function ca(e,t,n,r){return{pageSizes:(0,lR.useMemo)(()=>{let n=Math.ceil(t/e);return isNaN(n)&&(n=0),[...Array(n).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,lR.useMemo)(()=>e>t?t:e*n>t?e*(n-1)+r:e*n,[e,t,n,r])}}function co(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function ci(e){let[t,n]=(0,lR.useState)(e??co()),{data:r,error:a,isValidating:o}=un()(t?["patient",t]:null,()=>iN(t,{}));return(0,lR.useEffect)(()=>{let e=()=>{let e=co();e!==t&&n(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,lR.useMemo)(()=>({isLoading:o&&!a&&!r,patient:r,patientUuid:t,error:a}),[o,a,r,t])}function cs(){let e=`${op}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:n,isLoading:r}=un()(e,oy);return(0,lR.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:r,error:n}),[t,n,r])}function cl(e,t,n,r){let a=e?.slotName===t&&e.slotModuleName===n?e.components:null,o=new Map;for(let e of r)o.set(e,a?.get(e)??function(e,t,n){let r=s5(n),a=e=>e.extensions[r]?.meta,o=({state:r})=>{let o=lL(sR(),a),i=(0,lR.useMemo)(()=>({moduleName:t,featureName:"",extension:{extensionId:n,extensionSlotName:e,extensionSlotModuleName:t,extensionMeta:o}}),[o]);return(0,l$.jsx)(lO.Provider,{value:i,children:(0,l$.jsx)(lA,{state:r})})};return o.displayName=`RenderableExtension(${n})`,o}(t,n,e));return{slotName:t,slotModuleName:n,components:o}}function cu(e){let{extensions:t,extensionSlotModuleName:n}=lK(e),r=(0,lR.useMemo)(()=>new Set(e?t.map(e=>e.id):[]),[e,t]),[a,o]=(0,lR.useState)(()=>cl(null,e,n,r)),i=a;return a.slotName===e&&a.slotModuleName===n&&a.components.size===r.size&&[...r].every(e=>a.components.has(e))||o(i=cl(a,e,n,r)),(0,lR.useMemo)(()=>e?t.flatMap(e=>{let t=i.components.get(e.id);return t?[t]:[]}):[],[e,t,i])}function cc(){let e=(0,lR.useRef)(null),[t,n]=(0,lR.useState)(null),r=null;if(!t){if(i){let e=oS().getState();e.loaded&&(r=e.session)}else i=new Promise(t=>{let n=({loaded:n,session:a})=>{n&&(t(a),r=a,e.current&&(e.current(),e.current=null))};n(oS().getState()),r||(e.current=oS().subscribe(n))});if(r)n(r);else throw i}(0,lR.useEffect)(()=>(e.current||(e.current=oS().subscribe(({loaded:e,session:t})=>{e&&(r=t,n(t))})),()=>{e.current&&(e.current(),e.current=null)}),[]);let a=t||r;if(!a)if(i)throw console.warn("useSession is in an unexpected state. Attempting to recover."),i;else throw Error("useSession is in an invalid state.");return a}let cd=({privilege:e,fallback:t,children:n})=>{let[r,a]=(0,lR.useState)(null);return((0,lR.useEffect)(()=>{let e=oS(),t=e.subscribe(({loaded:e,session:t})=>{a(e?t?.user??null:null)}),{loaded:n,session:r}=e.getState();return n&&a(r?.user??null),t},[]),r&&oP(e,r))?(0,l$.jsx)(l$.Fragment,{children:n}):t?(0,l$.jsx)(l$.Fragment,{children:t}):null};var cm=n(222),cp=n.n(cm),cf=n(5602);let ch=new Map;function cg(){for(let e of Array.from(ch.values()))e()}let cy={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function cv(e){let t=(0,lR.useId)();return(0,lR.useEffect)(()=>{if(e)return ch.set(t,e),()=>{ch.delete(t)}},[t,e]),{...lF(iH(),cy),mutateVisit:cg}}function cb(e,t=iz){let n=(0,lR.useRef)(void 0),{patientUuid:r,manuallySetVisitUuid:a,setVisitContext:o}=cv((0,lR.useCallback)(()=>n.current?.(),[])),i=e&&r==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:m}=un()(e?`${op}/visit${s}`:null,oy),{data:p,error:f,mutate:h,isValidating:g}=un()(e&&i?`${op}/visit${l}`:null,oy),y=(0,lR.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,lR.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,lR.useRef)(null);(0,lR.useEffect)(()=>{!m&&y&&r===e&&null===a&&o(y),g||(b.current&&v&&b.current.uuid===v.uuid&&!b.current.stopDatetime&&v.stopDatetime&&o(null),b.current=v)},[v,a,y,m,g,r]);let w=(0,lR.useCallback)(()=>{d(),h()},[d,h]);(0,lR.useEffect)(()=>{n.current=w},[w]);let E=!!(!u||i&&!p),x=!!(i?f:c);return{error:c||f,mutate:w,isValidating:m||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:E&&!x}}cp().extend(cf);let cw=[];function cE(){let{data:e}=uI()(iF,iB);return e??cw}let cx=new Map;async function cD(e,t){let n=t.indexOf("#"),r=n>=0,a=r?t.substring(0,n):e,o=r?t.substring(n+1):t,i=await it(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?c_(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),cS)}let cS={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function c_(e,t){if(e in cx)await cx[e];else{let n=t??await it(e);await (cx[e]=new Promise((t,r)=>{if(Object.hasOwn(n,"startupApp")){let a=n.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{nv(e),t(null)}).catch(r)}nv(e),t(null)}))}}function cC(e,t){let n=t.name;if(!n)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
|
|
17
17
|
registered. To fix this, ensure that you define the "name" field inside the
|
|
18
18
|
extension definition.`,t);t.slots&&t.slot&&console.warn(`The extension ${n} from ${e} declares both a 'slots' property and
|
|
19
19
|
a 'slot' property. Only the 'slots' property will be honored.`);let r=t.slots?t.slots:t.slot?[t.slot]:[];if(!t.component)return void console.error(`The extension ${n} from ${e} is missing a 'component' entry and thus cannot be registered.
|
|
@@ -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&&bm(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||by(this,n)},i=mT(bg(document,"touchstart",t=>{let r=pi(t);e=gh(r)?r:gg(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}),bg(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}),bg(document,"blur",e=>{let t=pi(e),n=e.relatedTarget;if(n&&bm(n))n.focus({preventScroll:!0}),by(n,bm(t));else if(!n){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),r.remove(),HTMLElement.prototype.focus=o}):mT((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?bh(document.documentElement,"scrollbarGutter","stable"):bh(document.documentElement,"paddingRight",`${s}px`)),bh(document.documentElement,"overflow","hidden"))),()=>{0==--bf&&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=vq[vq.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=pa(e?.[0])).Element?{root:n}:n,i=o?.root??document.body,s=o?.shouldUseInert&&vZ,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(po(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=yO(pr(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=vY.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),vY.set(e,n+1))},vq.length&&vq[vq.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=>po(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()}},vq.push(f),()=>{for(let e of(p.disconnect(),u)){let t=vY.get(e);null!=t&&(1===t?(c(e,!1),vY.delete(e)):vY.set(e,t-1))}f===vq[vq.length-1]?(vq.pop(),vq.length&&vq[vq.length-1].observe()):vq.splice(vq.indexOf(f),1)}}},[o,t.isOpen,r,a]),{popoverProps:mK(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=bE(y,!!g)||r.isEntering||!1,b=mY({...r,defaultClassName:"react-aria-Popover",values:{trigger:r.trigger||null,placement:g,isEntering:v,isExiting:t}}),w=!r.isNonModal||"SubmenuTrigger"===r.trigger,[E,x]=(0,lR.useState)(!1);mO(()=>{y.current&&x(w&&!y.current.querySelector("[role=dialog]"))},[y,w]),(0,lR.useEffect)(()=>{var e;let t,n;E&&y.current&&!y.current.contains(document.activeElement)&&(n=((e=document)=>e.activeElement)(t=pr(e=y.current)),"virtual"===bS?pX(()=>{((e=document)=>e.activeElement)(t)===n&&e.isConnected&&pt(e)}):pt(e))},[E,y]);let D={...p.style,...b.style},S=lT().createElement("div",{...mK(pe(r),p),...b,role:E?"dialog":void 0,tabIndex:E?-1:void 0,"aria-label":r["aria-label"],"aria-labelledby":r["aria-labelledby"],ref:y,slot:r.slot||void 0,style:D,dir:r.dir,"data-trigger":r.trigger,"data-placement":g,"data-entering":v||void 0,"data-exiting":t||void 0},!r.isNonModal&&lT().createElement(bw,{onDismiss:e.close}),lT().createElement(vG.Provider,{value:{...h,placement:g,ref:i}},b.children),lT().createElement(bw,{onDismiss:e.close}));return m?lT().createElement(vj,{...r,shouldContainFocus:E,isExiting:t,portalContainer:null!=(o=null!=n?n:null==d?void 0:d.current)?o:void 0},S):lT().createElement(vj,{...r,shouldContainFocus:E,isExiting:t,portalContainer:n},!r.isNonModal&&e.isOpen&&lT().createElement("div",{"data-testid":"underlay",...f,style:{position:"fixed",inset:0}}),lT().createElement("div",{ref:u,style:{display:"contents"}},lT().createElement(bF.Provider,{value:u},S)))}function bU(e){return e?.start!=null&&null!=e.end}let bz=(0,lR.createContext)(null),bW=(0,lR.createContext)(null),bH=(0,lR.createContext)(null),bK=(0,lR.createContext)(null),bG=(0,lR.forwardRef)(function(e,t){var n,r;[e,t]=mJ(e,t,bz);let{validationBehavior:a}=mq(vW)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bj(e),[n,r]=yu(e.value,e.defaultValue||null,e.onChange),[a]=(0,lR.useState)(n),o=n||e.placeholderValue||null,[i,s]=vy(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)(()=>vd(n,y,v,b,g),[n,y,v,b,g]),E=va({...e,value:n,builtinValidation:w}),x=E.displayValidation.isInvalid,D=e.validationState||(x?"invalid":null),S=(e,t)=>{r("timeZone"in t?t.set(hH(e)):hK(e,t)),m(null),f(null),E.commitValidation()};return{...E,value:n,defaultValue:e.defaultValue??a,setValue:r,dateValue:d,timeValue:p,setDateValue:n=>{let a="function"==typeof c?c():c;u?p||a?S(n,p||vh(e.defaultValue||e.placeholderValue)):m(n):(r(n),E.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?S(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(r){!r&&!n&&d&&u&&S(d,p||vh(e.defaultValue||e.placeholderValue)),t.setOpen(r)},validationState:D,isInvalid:x,formatValue:(e,t)=>l?new f0(e,vf(t,g)).format(l):"",getDateFormatter:(e,t)=>new f0(e,vf({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,lR.useRef)(null),[l,u]=mX(!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=mz(),o=mz(),i=mz(),s=ho((r=yX)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=y1({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=yQ(t,n),g=m["aria-labelledby"]||m.id,{locale:y}=fG(),v=t.formatValue(y,{month:"long"}),b=gx(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,E=pe(e),x=(0,lR.useMemo)(()=>yG(n),[n]),D=(0,lR.useRef)(!1),{focusWithinProps:S}=fb({...e,isDisabled:t.isOpen,onBlurWithin:t=>{po(document.getElementById(o),t.relatedTarget)||(D.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{D.current||(D.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mK(E,h,m,b,S,{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:()=>{x.focusFirst()}},fieldProps:{...m,id:i,[y6]:"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,[vr]: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}}({...mQ(e),label:u,validationBehavior:o},i,s),[b,w]=(0,lR.useState)(null),E=(0,lR.useCallback)(()=>{s.current&&w(s.current.offsetWidth+"px")},[]);bi({ref:s,onResize:E});let{focusProps:x,isFocused:D,isFocusVisible:S}=fw({within:!0}),_=mY({...e,values:{state:i,isFocusWithin:D,isFocusVisible:S,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DatePicker"}),C=pe(e);return delete C.id,lT().createElement(mZ,{values:[[bH,i],[yk,{...c,ref:s,isInvalid:i.isInvalid}],[vk,m],[fR,{...p,isPressed:i.isOpen}],[vH,{...d,ref:l,elementType:"span"}],[yh,h],[vF,i],[bL,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":b}}],[vL,f],[f$,{slots:{description:g,errorMessage:y}}],[vV,v]]},lT().createElement("div",{...x,...C,..._,ref:t,slot:e.slot||void 0,"data-focus-within":D||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}))}),bZ=(0,lR.forwardRef)(function(e,t){var n,r;[e,t]=mJ(e,t,bW);let{validationBehavior:a}=mq(vW)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bj(e),[n,r]=yu(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}),bU(s)?r(s):r(null)},[u,c]=vy(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&&bU(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(hH(e.start)):hK(e.start,t.start),end:"timeZone"in t.end?t.end.set(hH(e.end)):hK(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=n=>{let r="function"==typeof m?m():m;d?bU(n)&&(r||h?.start&&h?.end)?y(n,{start:h?.start||vh(e.placeholderValue),end:h?.end||vh(e.placeholderValue)}):f(n):bU(n)?(l(n),C.commitValidation()):f(n),r&&t.setOpen(!1)},b=e=>{bU(p)&&bU(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,E=(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:x,maxValue:D,isDateUnavailable:S}=e,_=(0,lR.useMemo)(()=>{var e;let t;return e=s,t=vl(vd(e?.start??null,x,D,S,E),vd(e?.end??null,x,D,S,E)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(t=vl(t,{isInvalid:!0,validationErrors:[(f7.getGlobalDictionaryForPackage("@react-stately/datepicker")||vu).getStringForLocale("rangeReversed",vc())],validationDetails:{...y7,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),t},[s,x,D,S,E]),C=va({...e,value:n,name:(0,lR.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:_}),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)&&bU(p)&&d&&y(p,{start:h?.start||vh(e.placeholderValue),end:h?.end||vh(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=vf(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 f0(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 f0(t,vf(n,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:r.format(d)}},getDateFormatter:(e,t)=>new f0(e,vf({},{...E,...t}))}}({...e,validationBehavior:o}),s=(0,lR.useRef)(null),[l,u]=mX(!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=ho((r=yX)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=y1({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fG(),f=t.formatValue(p,{month:"long"}),h=gx(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=mz(),b=mz(),w=yQ(t,n),E=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,x=(0,lR.useMemo)(()=>yG(n,{accept:e=>e.id!==v}),[n,v]),D={[y5]:x,[y6]:"presentation","aria-describedby":E,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},S=pe(e),_=(0,lR.useRef)(!1),{focusWithinProps:C}=fb({...e,isDisabled:t.isOpen,onBlurWithin:t=>{po(document.getElementById(b),t.relatedTarget)||(_.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{_.current||(_.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,lR.useRef)(vt),P=(0,lR.useRef)(vt);return{groupProps:mK(S,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":E,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...l,onClick:()=>{x.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":E,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...D,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[vr]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(vl(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...D,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[vr]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(vl(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}}({...mQ(e),label:u,validationBehavior:o},i,s),[w,E]=(0,lR.useState)(null),x=(0,lR.useCallback)(()=>{s.current&&E(s.current.offsetWidth+"px")},[]);bi({ref:s,onResize:x});let{focusProps:D,isFocused:S,isFocusVisible:_}=fw({within:!0}),C=mY({...e,values:{state:i,isFocusWithin:S,isFocusVisible:_,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DateRangePicker"}),k=pe(e);return delete k.id,lT().createElement(mZ,{values:[[bK,i],[yk,{...c,ref:s,isInvalid:i.isInvalid}],[fR,{...f,isPressed:i.isOpen}],[vH,{...d,ref:l,elementType:"span"}],[yg,g],[vF,i],[bL,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":w}}],[vL,h],[vk,{slots:{start:m,end:p}}],[f$,{slots:{description:y,errorMessage:v}}],[vV,b]]},lT().createElement("div",{...D,...k,...C,ref:t,slot:e.slot||void 0,"data-focus-within":S||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}))});function bY(e){return lT().createElement(fK,e)}function bq(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 hN||e instanceof hI||e instanceof hM)return t?hG(e,t):e;{let n=cp()(e).toDate(),r=new hN(n.getFullYear(),n.getMonth()+1,n.getDate());return t?hG(r,t):r}}function bJ(e){if(e)return e.toDate(h6())}function bX(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function bQ(e){let t=e??"",n=bX(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function b0(){let e=window.i18next.language,t=bX(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;ee=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;ee=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var b1=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(ee||"en-US"),b4=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},b2={};for(let e=1;e<100;e++)b2[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var b3={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},b6="[1234567890一二三四五六七八九〇\\d]",b5={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},b9={},b8={"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},b7={zone:b8,year:b2,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:{}},we={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(b8).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,}"},wt={...we,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}"},wn={},wr=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=b1){return wn[t.toLowerCase()]||(wn[t.toLowerCase()]=new e(t)),wn[t.toLowerCase()]}constructor(e=b1){this.locale=e,this.lookups={...b7},this.vars={...we};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=b5: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(b9[e])return b9[e];if("fullwide"===e||"hanidec"===e)return{group:b6,lookup:{...b5}};let t=b3[e];if(!t)return{group:"\\d",lookup:{...b5}};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 b9[e]={group:`[${n}-${r}]`,lookup:a},b9[e]}(this.numberingSystem);for(let n in this.lookups.digit=t,wt)wt.hasOwnProperty(n)&&(this.vars[n]=wt[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")}},wa=["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"],wo={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},wi=()=>new Date;function ws(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 wl=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)}},wu=["year","month","day","hour","minute","second","millisecond","offset"],wc={};function wd(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 wm=[[/([^\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"]],wp={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," "],...wm],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:wm,id:wm,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function wf(e,t=b1){let n=function(e){if(!wc[e]){var t,n;let r,a,o=wr.factory(e);wc[e]=new wl({doneChecker:wd,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:ws(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:ws(["","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:ws(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${b6}{2,4})\\s*\u5E74\\s*(${b6}{1,2})\\s*\u6708\\s*(${b6}{1,2})\\s*\u65E5$`),handler:ws(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:ws(["","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:ws(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=wi(),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?wo[n]:(n=n.replace(/s$/,"")).toLowerCase())&&(n="day",t*=7),("-"===e||r)&&(t*=-1);let a=wi();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:ws(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:ws(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:ws(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:ws(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:ws(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:ws(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:ws(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:ws(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:ws(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:ws(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:ws(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:ws(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:ws(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:ws(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:ws(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:ws(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:ws(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:ws(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:ws(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:ws(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:ws(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:ws(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:ws(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:ws(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:ws(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:ws(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:ws(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:ws(["zone"])}],a=o.baseName.slice(0,5),wa.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(wu.includes(r)){let e=n.toInt(a);"number"==typeof e&&(t[r]=e)}return t.year<100&&(t.year=b2[t.year]),t.year&&"buddhist"===n.dateOptions.calendar&&(t.year-=543),t})})}return wc[e]}(t),r=function(e,t){let n=wp[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 wh(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new b4(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 b4(t.valueOf()-60*e.offset*1e3):t}function wg(e,t=b1){let n=wf(e,t),r=n.invalid?new b4(NaN):wh(n);return r.isValid()||(r.invalid=`Unable to parse date "${e}"`),r}function wy(e,t=b1){return e instanceof Date?new b4(e.valueOf()):"number"==typeof e?new b4(e):wg(e,t)}Date.fromString=b4.fromString=wg,Date.fromAny=b4.fromAny=wy,"u">typeof window&&(window.anyDateParser={fromString:wg,fromAny:wy,fromObject:wh,attempt:wf});var wv=n(4397),wb=n(7657);let ww=function(e){return null==e};function wE(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}cp().extend(cf),cp().extend(wb),cp().extend(wv);let wx="YYYY-MM-DDTHH:mm:ss.SSSZZ",wD=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function wS(e,t){let n=wD.exec(e);if(!n)return wf(e,t);let r=Number(n[1]),a=void 0===n[2]?void 0:Number(n[2]),o=void 0===n[3]?void 0:Number(n[3]),i=new Date(0);return(i.setUTCFullYear(r,(a??1)-1,o??1),i.getUTCFullYear()!==r||i.getUTCMonth()!==(a??1)-1||i.getUTCDate()!==(o??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:r,...void 0!==a&&{month:a},...void 0!==o&&{day:o}}}function w_(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&cp()(e,wx).isValid()}function wC(e){return cp()(e).isToday()}function wk(e){return w_(e)?cp()(e,wx).toDate():null}function wP(e,t=!1){let n=cp()(e);return t&&(n=n.utc()),n.format(wx)}function wR(e){return cp()(e).toDate()}var wT=new WeakMap;let wO=new class{register(e,t){wE(this,wT).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(wE(this,wT).has(t))return wE(this,wT).get(t)}if(e.language&&wE(this,wT).has(e.language))return wE(this,wT).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wE(this,wT).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,wT,{writable:!0,value:new Map})}};function w$(e,t){wO.register(e,t)}function wN(e){let t=e??b0();return wO.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 wI(e,t={}){let n=wS(e,b0());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!ww(n.day)&&ww(n.month)&&(n=Object.assign({},tV(n,"day"),{month:n.day})),n.month&&(n.month-=1),n.day&&(n=Object.assign({},tV(n,"day"),{date:n.day}));let r=cp()().set(n).toDate();return ww(n.year)&&(t.year=!1),ww(n.month)&&(t.month=!1),ww(n.date)&&(t.day=!1),wM(r,t)}function wM(e,t){let n,r=t?.locale??b0(),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??wN(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=cp()(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(wj("-"))),"wide"==i&&(t=t.map(wj(" — "))),"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 wj=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(b0(),{hour:"2-digit",minute:"2-digit"})}function wF(e,t){return wM(e,{...t,time:!0})}function wB(e,t){let n=wN("string"==typeof t?new Intl.Locale(t):t);return n?hG(e,ye(n)):e}function wV(e,t){return new Intl.DurationFormat(b0(),t).format(e)}function wU(e,t){if(null==e)return null;if("string"==typeof e){let n=wS(e,b0());return n.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(n.day&&!n.month&&(n={...tV(n,"day"),...{month:n.day}}),n.month&&(n.month-=1),n.day&&(n={...tV(n,"day"),...{date:n.day}}),cp()(t).set(n))}return cp()(e)}let wz=["years","months","days","hours","minutes","seconds"],wW={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 wK(e,t=cp()(),n){let r,a=cp()(t),o=wU(e,a);if(null==o)return null;if("string"==typeof n){let e=wW[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?wW[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=wz.indexOf(n);for(let a=0;a<wz.length;a++){let o=wz[a];if(t.diff(e,o)>0)return a<=r?o:n}return n}(o,a,t??"seconds"):wW[s]??s,function(e,t,n,r){let a=wz.indexOf(n),o=wz.indexOf(r),i=wz.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[wW[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 wG={style:"short",localeMatcher:"lookup"};function wZ(e,t=cp()(),n){let r=wK(e,t,n);return null==r?null:wV(r,"object"==typeof n&&n.formatOptions?{...wG,...n.formatOptions}:wG)}let wY=(0,lR.createContext)(null);function wq(){let e=uO({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,lR.useMemo)(()=>{let t=b0();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,lR.useMemo)(()=>{let e=wN(t);return void 0!==e?ye(e):void 0},[t]),r=(0,lR.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),a=(0,lR.useMemo)(()=>n?hG(h1(h6()),n):h1(h6()),[n]);return{calendar:n,intlLocale:r,today_:a}}let wJ=new hN(1793,1,1);var wX={};function wQ(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function w0(e={}){let{locale:t}=fG();return(0,lR.useMemo)(()=>new(0,vx.K)(t,e),[t,e])}wX={"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 w1={};w1={"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 w4=()=>{};function w2(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=ho((t=w1)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,lR.useRef)(!1),v=(0,lR.useCallback)(()=>{clearTimeout(n.current),y.current=!1},[]),b=fa(()=>{v()});(0,lR.useEffect)(()=>()=>b(),[]);let w=(0,lR.useRef)(!1),E=()=>{w.current=!0},x=()=>{w.current=!1},D=""===a?g.format("Empty"):(a||`${r}`).replace("-","−");(0,lR.useEffect)(()=>{w.current&&(fZ&&fZ.clear("assertive"),fY(D,"assertive"))},[D]);let S=(0,lR.useCallback)(()=>{v()},[v]),_=fa(c??w4),C=fa(m??w4),k=fa(()=>{(void 0===i||isNaN(i)||void 0===r||isNaN(r)||r<i)&&(_(),P(60))}),P=fa(e=>{b(),y.current=!0,n.current=window.setTimeout(k,e)}),R=fa(()=>{(void 0===o||isNaN(o)||void 0===r||isNaN(r)||r>o)&&(C(),T(60))}),T=fa(e=>{b(),y.current=!0,n.current=window.setTimeout(R,e)}),O=e=>{e.preventDefault()},{addGlobalListener:$,removeAllGlobalListeners:N}=fo(),A=(0,lR.useRef)(!1),[I,M]=(0,lR.useState)(null);(0,lR.useEffect)(()=>{"touch"===I?P(600):I&&P(400)},[I]);let[j,L]=(0,lR.useState)(null);return(0,lR.useEffect)(()=>{"touch"===j?T(600):j&&T(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===r||isNaN(r)?void 0:r,"aria-valuetext":D,"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:E,onBlur:x},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),M("mouse")):($(window,"pointercancel",S,{capture:!0}),A.current=!1,M("touch")),$(window,"contextmenu",O)},onPressUp:e=>{v(),"touch"===e.pointerType&&(A.current=!0),N(),M(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&A.current&&c?.(),A.current=!1,M(null)},onFocus:E,onBlur:x},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),L("mouse")):($(window,"pointercancel",S,{capture:!0}),A.current=!1,L("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(A.current=!0),N(),L(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&A.current&&m?.(),A.current=!1,L(null)},onFocus:E,onBlur:x}}}let w3=null;var w6=n(2103);function w5(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 w9=(0,lR.createContext)(null),w8=(0,lR.createContext)(null),w7=(0,lR.forwardRef)(function(e,t){var n,r;[e,t]=mJ(e,t,w9);let{validationBehavior:a}=mq(vW)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",{locale:i}=fG(),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)?vJ(e,t,n):vQ(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]=yu(o,isNaN(i)?NaN:i,s),[h]=(0,lR.useState)(p),[g,y]=(0,lR.useState)(()=>isNaN(p)?"":new(0,vx.K)(l,a).format(p)),v=(0,lR.useMemo)(()=>new(0,w6.d)(l,a),[l,a]),b=(0,lR.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,lR.useMemo)(()=>new(0,vx.K)(l,{...a,numberingSystem:b}),[l,a,b]),E=(0,lR.useMemo)(()=>w.resolvedOptions(),[w]),x=(0,lR.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),D=va({...e,value:p}),S=void 0===r||isNaN(r)?1:r;"percent"===E.style&&(void 0===r||isNaN(r))&&(S=.01);let[_,C]=(0,lR.useState)(p),[k,P]=(0,lR.useState)(l),[R,T]=(0,lR.useState)(a);Object.is(p,_)&&l===k&&a===R||(y(x(p)),C(p),P(l),T(a));let O=(0,lR.useMemo)(()=>v.parse(g),[v,g]),$=(e,r=0)=>{if(isNaN(O))return vQ(isNaN(r)?0:r,t,n,S);{let r=vQ(O,t,n,S);return"+"===e&&r>O||"-"===e&&r<O?r:vQ(w5(e,O,S),t,n,S)}},N=(0,lR.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===n||isNaN(n)||vQ(O,t,n,S)>O||w5("+",O,S)<=n),[u,c,t,n,S,O]),A=(0,lR.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===t||isNaN(t)||vQ(O,t,n,S)<O||w5("-",O,S)>=t),[u,c,t,n,S,O]);return{...D,validate:e=>v.isValidPartialNumber(e,t,n),increment:()=>{let e=$("+",t);e===p&&y(x(e)),f(e),D.commitValidation()},incrementToMax:()=>{null!=n&&(f(vQ(n,t,n,S)),D.commitValidation())},decrement:()=>{let e=$("-",n);e===p&&y(x(e)),f(e),D.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),D.commitValidation())},canIncrement:N,canDecrement:A,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?"":x(p));return}if(isNaN(n))return void y(x(p));let r="snap"===d?m(n):n,a=(r=v.parse(x(r)))!==p;f(r),y(x(void 0===o?r:p)),a&&D.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,lR.useRef)(null),[u,c]=mX(!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:E,label:x,formatOptions:D,onBlur:S=()=>{},onFocus:_,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:R,errorMessage:T,isWheelDisabled:O,...$}=e,{increment:N,incrementToMax:A,decrement:I,decrementToMin:M,numberValue:j,inputValue:L,commit:F,commitValidation:B}=t,V=ho((r=wX)&&r.__esModule?r.default:r,"@react-aria/numberfield"),U=(0,lR.useCallback)(()=>{let e=n.current?.value??"";(0,fi.flushSync)(()=>{F()}),n.current?.value!==e&&fY(n.current?.value??"","assertive")},[F,n]),z=mz(p),{focusProps:W}=p0({onBlur(){U()}}),H=w0(D),K=(0,lR.useMemo)(()=>H.resolvedOptions(),[H]),G=w0({...D,currencySign:void 0}),Z=(0,lR.useMemo)(()=>isNaN(j)?"":G.format(j),[G,j]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=w2({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:N,onIncrementToMax:A,onDecrement:I,onDecrementToMin:M,value:j,textValue:Z}),[X,Q]=(0,lR.useState)(!1),{focusWithinProps:ee}=fb({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]);gf(t,"wheel",r?void 0:a)}({onScroll:(0,lR.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?N():e.deltaY<0&&I())},[I,N]),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";pS()?en?er="text":et&&(er="decimal"):pR()&&(en?er="numeric":et&&(er="decimal"));let ea=pe(e),eo=(0,lR.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,fi.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=fa(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(!wQ()||!n.current)return;let e=n.current;return e.addEventListener("beforeinput",r,!1),()=>{e.removeEventListener("beforeinput",r,!1)}},[n]);let a=wQ()?null:e=>{let n=pi(e).value.slice(0,pi(e).selectionStart)+e.data+pi(e).value.slice(pi(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]=yu(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=p3(e,t),d=va({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=y1({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=pe(e,{labelable:!0}),w={type:i,pattern:e.pattern},[E]=(0,lR.useState)(l);return y4(t,e.defaultValue??E,u),y2(e,d,t),{labelProps:h,inputProps:mK(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(pi(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(lT().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:mK(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}}({...$,...ea,name:void 0,form:void 0,label:x,autoFocus:E,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[vr]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:z,type:"text",inputMode:er,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:S,onFocus:_,onFocusChange:C,onKeyDown:(0,lR.useMemo)(()=>mT(eo,k),[eo,k]),onKeyUp:P,onPaste:t=>{e.onPaste?.(t);let n=pi(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:R,errorMessage:T},t,n);y4(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,mO(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!w3&&"u">typeof document&&((w3=document.createElement("input")).type="number"),!w3))return;w3.min=null==l||isNaN(l)?"":String(l),w3.max=null==u||isNaN(u)?"":String(u),w3.step=null==c||isNaN(c)?"":String(c),w3.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&w3.validity.valid,n=e.validationMessage||w3.validationMessage,r={isInvalid:!t,validationErrors:n?[n]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:w3.validity.rangeOverflow,rangeUnderflow:w3.validity.rangeUnderflow,stepMismatch:w3.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||w3.validity.valid||e.setCustomValidity(w3.validationMessage)});let ep=mK(Y,W,ec,{role:null,"aria-roledescription":pC()?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=mz(),ey=mz(),ev=mK(q,{"aria-label":h||V.format("increase",{fieldLabel:eh}).trim(),id:m&&!h?eg:null,"aria-labelledby":m&&!h?`${eg} ${m}`:null,"aria-controls":z,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:ef}),eb=mK(J,{"aria-label":f||V.format("decrease",{fieldLabel:eh}).trim(),id:m&&!f?ey:null,"aria-labelledby":m&&!f?`${ey} ${m}`:null,"aria-controls":z,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}}({...mQ(e),label:c,validationBehavior:o},s,l),b=mY({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:v.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),w=pe(e);return delete w.id,lT().createElement(mZ,{values:[[w8,s],[yk,m],[yR,{...p,ref:l}],[vH,{...d,ref:u}],[fR,{slots:{increment:f,decrement:h}}],[f$,{slots:{description:g,errorMessage:y}}],[vV,v]]},lT().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&&lT().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function Ee(e,t){return Number.parseInt(wM(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let Et=(0,lR.forwardRef)(function(e,t){let{className:n}=e,r=(0,lR.useContext)(yy),a=(0,lR.useContext)(yv),o=r??a,i=(0,lR.useContext)(wY),s=h6(),l=wM(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=Ee(o.visibleRange.start.toDate(s),i),c=o.maxValue?Ee(o.maxValue.toDate(s),i):void 0,d=o.minValue?Ee(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,l$.jsxs)("span",{ref:t,className:n,children:[(0,l$.jsx)("span",{children:l}),(0,l$.jsxs)(w7,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,l$.jsx)(yT,{}),(0,l$.jsxs)(yP,{children:[(0,l$.jsx)(fT,{slot:"increment",children:(0,l$.jsx)(dt,{size:8})}),(0,l$.jsx)(fT,{slot:"decrement",children:(0,l$.jsx)(c8,{size:8})})]})]})]})}),En="-esm-patient-immunizations__datepicker-module__inputGroup___gBam-",Er="-esm-patient-immunizations__datepicker-module__inputSegment___wIJDZ",Ea="-esm-patient-immunizations__datepicker-module__dateInputWrapper___LiY68",Eo="-esm-patient-immunizations__datepicker-module__invalidText___A4cv4",Ei="-esm-patient-immunizations__datepicker-module__flatButton___HcpME",Es="-esm-patient-immunizations__datepicker-module__flatButtonMd___eFpyF",El="-esm-patient-immunizations__datepicker-module__flatButtonSm___tsawR",Eu="-esm-patient-immunizations__datepicker-module__flatButtonLg___4HG5y";function Ec({children:e}){let t=(0,lR.useContext)(bH),n=(0,lR.useContext)(bK),r=t??n,a=ce(()=>r?.close());return(0,l$.jsx)(vB,{className:"-esm-patient-immunizations__datepicker-module__dialog___DaqYi",ref:a,children:e})}let Ed=(0,lR.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},a){let o="range"===e;return(0,l$.jsx)(bB,{ref:a,className:"-esm-patient-immunizations__datepicker-module__popover___nAPzC",placement:"bottom start",offset:1,isNonModal:!0,children:(0,l$.jsx)(Ec,{children:(0,l$.jsxs)(o?yw:yb,{...o?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,l$.jsxs)("header",{className:"-esm-patient-immunizations__datepicker-module__header___rPv3L",children:[(0,l$.jsx)(fT,{className:cI()(Ei,Es),slot:"previous",children:(0,l$.jsx)(du,{size:16})}),(0,l$.jsx)(Et,{className:"-esm-patient-immunizations__datepicker-module__monthYear___Rw4qE"}),(0,l$.jsx)(fT,{className:cI()(Ei,Es),slot:"next",children:(0,l$.jsx)(dc,{size:16})})]}),(0,l$.jsx)(yx,{className:"-esm-patient-immunizations__datepicker-module__calendarGrid___yKV-n",children:e=>(0,l$.jsx)(yC,{className:cI()("cds--date-picker__day",{"-esm-patient-immunizations__datepicker-module__today___KzMTn":0===t.compare(e)}),date:e},e.toString())})]})})})}),Em=(0,lR.forwardRef)(function(e,t){let n=(0,lR.useContext)(bH),[r,a]=mJ({slot:e.slot},t,vk),{locale:o}=fG(),i=vC({...r,locale:o,createCalendar:ye}),s=(0,lR.useRef)(null),{fieldProps:l,inputProps:u}=y9({...r,inputRef:s},i,a),c=(0,lR.useCallback)(()=>{i.isDisabled||n.toggle()},[]);return(0,l$.jsxs)(mZ,{values:[[vP,i],[yR,{...u,ref:s}],[yk,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,l$.jsx)(yP,{...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,l$.jsx)(yT,{})]})}),Ep=(0,lR.forwardRef)(function(e,t){let n=(0,lR.useContext)(bH),r=(0,lR.useContext)(bK);return(n??r).isInvalid?(0,l$.jsx)(my,{ref:t,size:16,...e}):(0,l$.jsx)(c9,{ref:t,size:16,...e})});class Ef{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let Eh=new Map,Eg=(0,lR.forwardRef)(function({segment:e,...t},n){let r=(0,lR.useContext)(vP),a=mk(n),{segmentProps:o}=function(e,t,n){let r,a,o,i,s=(0,lR.useRef)(""),{locale:l,direction:u}=fG(),c=function(){var e;let{locale:t}=fG(),n=ha((e=yX)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,lR.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new Ef(t,n)}},[t,n])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=y3.get(t),h=e.isPlaceholder?"":e.text,g=(0,lR.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=f6({month:"long",timeZone:g.timeZone}),v=f6({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}=w2({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,w6.d)(l,{maximumFractionDigits:0}),[l]),E=()=>{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:x}=(r=function(e){let{locale:t}=fG(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(Eh.has(n))return Eh.get(n);let r=new Intl.Collator(t,e);return Eh.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])),D=f6({hour:"numeric",hour12:!0}),S=(0,lR.useMemo)(()=>{let e=new Date;return e.setHours(0),D.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[D]),_=(0,lR.useMemo)(()=>{let e=new Date;return e.setHours(12),D.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[D]),C=f6({year:"numeric",era:"narrow",timeZone:"UTC"}),k=(0,lR.useMemo)(()=>{if("era"!==e.type)return[];let n=hG(new hN(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(x(S,n))t.setSegment("dayPeriod",0);else if(x(_,n))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=k.find(e=>x(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}}};gf((0,lR.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&po(n.current,e?.anchorNode)&&e.collapse(n.current)});let R=(0,lR.useRef)("");gf(n,"beforeinput",r=>{if(n.current)switch(r.preventDefault(),r.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&E();break;case"insertCompositionText":R.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:null!=r.data&&P(r.data)}}),gf(n,"input",e=>{let{inputType:t,data:r}=e;"insertCompositionText"===t&&(n.current&&(n.current.textContent=R.current),null!=r&&(x(S,r)||x(_,r))&&P(r))}),mO(()=>{let e=n.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[n,f]);let T=pC()||"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=mz(),$=!t.isDisabled&&!t.isReadOnly&&e.isEditable,N="literal"===e.type?"":c.of(e.type),A=gu({"aria-label":`${N}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===u){I.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(I.direction="ltr")}return{segmentProps:mK(b,A,{id:O,...T,"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:$,suppressContentEditableWarning:$,spellCheck:$?"false":void 0,autoCorrect:$?"off":void 0,[parseInt(lT().version,10)>=17?"enterKeyHint":"enterkeyhint"]:$?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!$?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(pD()?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(),E()}},onFocus:()=>{s.current="",n.current&&gb(n.current,{containingElement:gg(n.current)});let e=window.getSelection();e?.collapse(n.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,r,a),{focusProps:i,isFocused:s,isFocusVisible:l}=fw(),{hoverProps:u,isHovered:c}=f_({...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,l$.jsx)("span",{...mK(pe(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})}),Ey={short:!1,size:"md"},Ev=(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}={...Ey,...e},{calendar:b,intlLocale:w,today_:E}=wq(),x=(0,lR.useId)(),D=!!(u??l),S=(0,lR.useMemo)(()=>bq(r,b),[r,b]),_=(0,lR.useMemo)(()=>bq(y,b,!0),[y,b]),C=(0,lR.useMemo)(()=>bq(d,b),[d,b]),k=(0,lR.useMemo)(()=>bq(m??wJ,b),[m,b]),P=(0,lR.useMemo)(()=>o||s,[o,s]),R=(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?.(bJ(e)))),[f,p]);return(0,l$.jsx)(bY,{locale:w.toString(),children:(0,l$.jsx)("div",{className:cI()("cds--form-item",n),children:(0,l$.jsx)(mZ,{values:[[wY,w]],children:(0,l$.jsxs)(bG,{className:cI()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:S,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:_,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:R,children:[(0,l$.jsxs)("div",{className:"cds--date-picker-container",children:[D&&(0,l$.jsx)(vK,{className:cI()("cds--label",{"cds--label--disabled":a}),htmlFor:x,children:u??l}),(0,l$.jsxs)(yP,{className:En,children:[(0,l$.jsx)(Em,{id:D?x:void 0,ref:t,className:cI()("cds--date-picker-input__wrapper","-esm-patient-immunizations__datepicker-module__inputWrapper___uKdT1",{"-esm-patient-immunizations__datepicker-module__inputWrapperSm___0RXJc":"sm"===g,"-esm-patient-immunizations__datepicker-module__inputWrapperMd___4Vff1":"md"===g||!g||0===g.length,"-esm-patient-immunizations__datepicker-module__inputWrapperLg___VCRm5":"lg"===g}),children:e=>"era"!==e.type?(0,l$.jsx)(Eg,{className:Er,segment:e}):(0,l$.jsx)(lT().Fragment,{})}),(0,l$.jsx)(fT,{className:cI()(Ei,{[El]:"sm"===g,[Es]:"md"===g||!g||0===g.length,[Eu]:"lg"===g}),children:(0,l$.jsx)(Ep,{})})]}),(0,l$.jsx)(vU,{className:Eo,children:i})]}),(0,l$.jsx)(Ed,{variant:"single",today_:E})]})})})})}),Eb=(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}=wq(),w=(0,lR.useId)(),E=!!(s??i),x=(0,lR.useMemo)(()=>{if(f)return{start:bq(f[0],y,!1),end:bq(f[1],y,!1)}},[f,y]),D=(0,lR.useMemo)(()=>{if(t)return{start:bq(t[0],y,!1),end:bq(t[1],y,!1)}},[t,y]),S=(0,lR.useMemo)(()=>bq(c??wJ,y,!0),[c,y]),_=(0,lR.useMemo)(()=>bq(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?.([bJ(e.start),bJ(e.end)]))),[m,d]);return(0,l$.jsx)(bY,{locale:v.toString(),children:(0,l$.jsx)("div",{className:cI()("cds--form-item",e),children:(0,l$.jsx)(mZ,{values:[[wY,v]],children:(0,l$.jsx)(bZ,{id:E?w:void 0,className:cI()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:_,minValue:S,value:x,defaultValue:D,ref:g,isDisabled:a,...h,onChange:k,children:(0,l$.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,l$.jsx)(vK,{className:cI()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,l$.jsxs)(yP,{className:En,children:[(0,l$.jsxs)("div",{className:cI()("-esm-patient-immunizations__datepicker-module__inputsWrapper___xXRQI",{"-esm-patient-immunizations__datepicker-module__inputsWrapperSm___nL+b6":"sm"===p,"-esm-patient-immunizations__datepicker-module__inputsWrapperMd___Kgcps":"md"===p||!p||0===p.length,"-esm-patient-immunizations__datepicker-module__inputsWrapperLg___raaSN":"lg"===p}),children:[(0,l$.jsx)(vT,{className:cI()("cds--date-picker-input__wrapper","-esm-patient-immunizations__datepicker-module__startInput___cWw-5",Ea),slot:"start",children:e=>(0,l$.jsx)(Eg,{className:Er,segment:e})}),(0,l$.jsx)("div",{className:"-esm-patient-immunizations__datepicker-module__separator___Ddb4g",children:(0,l$.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,l$.jsx)(vT,{className:cI()("cds--date-picker-input__wrapper","-esm-patient-immunizations__datepicker-module__endInput___xdYOl",Ea),slot:"end",children:e=>(0,l$.jsx)(Eg,{className:Er,segment:e})})]}),(0,l$.jsx)(fT,{className:cI()(Ei,{[El]:"sm"===p,[Es]:"md"===p||!p||0===p.length,[Eu]:"lg"===p}),children:(0,l$.jsx)(Ep,{})})]}),(0,l$.jsx)(vU,{className:Eo,children:r}),(0,l$.jsx)(Ed,{variant:"range",today_:b,minDate:S,maxDate:_})]})})})})})}),Ew=lT().createContext(null);function EE(e){let{children:t}=e,n=(0,lR.useContext)(Ew),[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 lT().createElement(Ew.Provider,{value:o},t)}function Ex(e){let t,{modalProviderProps:n}={modalProviderProps:{"aria-hidden":!!(t=(0,lR.useContext)(Ew))&&t.modalCount>0||void 0}};return lT().createElement("div",{"data-overlay-container":!0,...e,...n})}function ED(e){return lT().createElement(EE,null,lT().createElement(Ex,e))}function ES(e){let t=mB(),{portalContainer:n=t?null:document.body,...r}=e,{getContainer:a}=vI();if(!e.portalContainer&&a&&(n=a()),lT().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=lT().createElement(ED,r);return fs().createPortal(o,n)}let E_=lT().createContext(null),EC=lT().forwardRef(function(e,t){let{children:n,...r}=e,a=mk(t),o={...r,ref:a};return lT().createElement(E_.Provider,{value:o},n)}),Ek={},EP=0,ER=!1,ET=null,EO=null;function E$(e={}){let{delay:t=1500,closeDelay:n=500}=e,{isOpen:r,open:a,close:o}=bj(e),i=(0,lR.useMemo)(()=>`${++EP}`,[]),s=(0,lR.useRef)(null),l=(0,lR.useRef)(o),u=()=>{Ek[i]=m},c=()=>{for(let e in Ek)e!==i&&(Ek[e](!0),delete Ek[e])},d=()=>{s.current&&clearTimeout(s.current),s.current=null,c(),u(),ER=!0,a(),ET&&(clearTimeout(ET),ET=null),EO&&(clearTimeout(EO),EO=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)),ET&&(clearTimeout(ET),ET=null),ER&&(EO&&clearTimeout(EO),EO=setTimeout(()=>{delete Ek[i],EO=null,ER=!1},Math.max(500,n)))};return(0,lR.useEffect)(()=>{l.current=o},[o]),(0,lR.useEffect)(()=>()=>{s.current&&clearTimeout(s.current),Ek[i]&&delete Ek[i]},[i]),{isOpen:r,open:e=>{e||!(t>0)||s.current?d():(c(),u(),r||ER?r||d():(ET&&clearTimeout(ET),ET=setTimeout(()=>{ET=null,ER=!0,d()},t)))},close:m}}let EN=(0,lR.createContext)(null),EA=(0,lR.createContext)(null);function EI(e){let t=E$(e),n=(0,lR.useRef)(null),{triggerProps:r,tooltipProps:a}=function(e,t,n){let{isDisabled:r,trigger:a,shouldCloseOnPress:o=!0}=e,i=mz(),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}=f_({isDisabled:r,onHoverStart:()=>{"focus"!==a&&("pointer"===pN?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=p3({isDisabled:r,onFocus:()=>{pG()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},n);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mK(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,n);return lT().createElement(mZ,{values:[[EN,t],[EA,{...a,triggerRef:n}]]},lT().createElement(EC,{...r,ref:n},e.children))}let EM=(0,lR.forwardRef)(function({UNSTABLE_portalContainer:e,...t},n){[t,n]=mJ(t,n,EA);let r=(0,lR.useContext)(EN),a=E$(t),o=null==t.isOpen&&null==t.defaultOpen&&r?r:a,i=bx(n,o.isOpen)||t.isExiting||!1;return o.isOpen||i?lT().createElement(ES,{portalContainer:e},lT().createElement(Ej,{...t,tooltipRef:n,isExiting:i})):null});function Ej(e){let t=(0,lR.useContext)(EN),n=(0,lR.useRef)(null),[r,a]=(0,lR.useState)(0);mO(()=>{n.current&&t.isOpen&&a(n.current.getBoundingClientRect().width)},[t.isOpen,n]);let{overlayProps:o,arrowProps:i,placement:s}=bl({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=bE(e.tooltipRef,!!s)||e.isEntering||!1,u=mY({...e,defaultClassName:"react-aria-Tooltip",values:{placement:s,isEntering:l,isExiting:e.isExiting,state:t}}),{tooltipProps:c}=function(e,t){let n=pe(e,{labelable:!0}),{hoverProps:r}=f_({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mK(n,r,{role:"tooltip"})}}(e=mK(e,o),t);return lT().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},lT().createElement(vG.Provider,{value:{...i,placement:s,ref:n}},u.children))}let EL=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=uO({externalModuleName:"@openmrs/esm-styleguide"});return(0,l$.jsx)("div",{className:"-esm-patient-immunizations__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,l$.jsx)(EF,{color:a,isProvisional:r,name:e.display},e.uuid)})})};function EF({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=cI()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-patient-immunizations__diagnosis-tags-module__diagnosisTag___mQ28X"),m=(0,l$.jsxs)(l$.Fragment,{children:[t&&(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("span",{"aria-hidden":"true",className:"-esm-patient-immunizations__diagnosis-tags-module__provisionalMark___S+J53",children:"?"}),(0,l$.jsxs)("span",{className:"cds--visually-hidden",children:[oe("provisional","Provisional")," "]})]}),(0,l$.jsx)("span",{ref:c,className:"cds--tag__label",children:n})]});return u?(0,l$.jsxs)(EI,{delay:0,closeDelay:150,isOpen:r,onOpenChange:a,children:[(0,l$.jsx)(fT,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,l$.jsx)(EM,{className:"-esm-patient-immunizations__diagnosis-tags-module__tagTooltip___50O3+",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,l$.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let EB={action:"-esm-patient-immunizations__empty-card-module__action___oG778",content:"-esm-patient-immunizations__empty-card-module__content___YUXvR",desktopHeading:"-esm-patient-immunizations__empty-card-module__desktopHeading___EljiH",tabletHeading:"-esm-patient-immunizations__empty-card-module__tabletHeading___8mc7w",tile:"-esm-patient-immunizations__empty-card-module__tile___3-rRO"},EV=({width:e="64",height:t="64"})=>(0,l$.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,l$.jsx)("use",{href:"#omrs-empty-data-illustration"})}),EU=e=>{let t="tablet"===u3(),n=e.launchForm;return(0,l$.jsx)(cB.Layer,{className:EB.layer,children:(0,l$.jsxs)(cB.Tile,{className:EB.tile,children:[(0,l$.jsx)("div",{className:t?EB.tabletHeading:EB.desktopHeading,children:(0,l$.jsx)("h4",{children:e.headerTitle})}),(0,l$.jsx)(EV,{}),(0,l$.jsx)("p",{className:EB.content,children:oe("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,l$.jsx)("p",{className:EB.action,children:n&&(0,l$.jsx)(cB.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:oe("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},Ez=({error:e,headerTitle:t})=>{let n="tablet"===u3();return(0,l$.jsx)(cB.Layer,{children:(0,l$.jsxs)(cB.Tile,{className:"-esm-patient-immunizations__error-state-module__tile___mzWLn",children:[(0,l$.jsx)("div",{className:n?"-esm-patient-immunizations__error-state-module__tabletHeading___l7Cpn":"-esm-patient-immunizations__error-state-module__desktopHeading___p57fl",children:(0,l$.jsx)("h4",{children:t})}),(0,l$.jsxs)("p",{className:"-esm-patient-immunizations__error-state-module__errorMessage___0fU6v",children:[oe("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,l$.jsx)("p",{className:"-esm-patient-immunizations__error-state-module__errorCopy___xkVog",children:oe("errorCopy")})]})})},EW=Ez,EH=lT().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:a,state:o}=u9(),i=window.location??{pathname:""},s=lH(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,l$.jsxs)(cB.SideNav,{"aria-label":oe("leftNavigation","Left navigation"),className:"-esm-patient-immunizations__left-nav-module__leftNav___czP9T",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,l$.jsx)(lZ,{name:"global-nav-menu-slot"}),n?(0,l$.jsx)(uw,{value:a,fallback:(0,l$.jsx)(lZ,{name:n,state:{basePath:r,currentPath:i,...o}}),children:(0,l$.jsx)(lO.Provider,{value:a,children:(0,l$.jsx)(lZ,{name:n,state:{basePath:r,currentPath:i,...o}})})}):null]}):null}),EK=({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}=uI()(t,oy,{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=uN(n),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uq()(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=`${of}/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()},oy);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=ct((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,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)(cB.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:oe("searchForLocation"),id:s,placeholder:oe("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__errorNotification___NfvTe",id:`${s}-error`,children:(0,l$.jsx)(cB.InlineNotification,{kind:"error",subtitle:oe("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:oe("error","Error")})}),(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__searchResults___agplm",children:c?(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__loadingContainer___EHghS",children:Array.from({length:5}).map((e,t)=>(0,l$.jsx)(cB.RadioButtonSkeleton,{className:"-esm-patient-immunizations__location-picker-module__radioButtonSkeleton___up5rH",role:"progressbar"},t))}):(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__locationResultsContainer___06YOS",children:h.length>0?(0,l$.jsx)(cB.RadioButtonGroup,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,l$.jsx)(cB.RadioButton,{className:"-esm-patient-immunizations__location-picker-module__locationRadioButton___yKif7",id:e.resource.id,labelText:(0,l$.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__emptyState___cPWp8",children:(0,l$.jsx)("p",{className:"-esm-patient-immunizations__location-picker-module__locationNotFound___b14++",children:oe("noResultsToDisplay")})})}),m&&(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__loadingIcon___GVlrq",children:(0,l$.jsx)(cB.InlineLoading,{description:oe("loading")})})]})})]})},EG=V("modalState",{modalContainer:null,modalStack:[]}),EZ=0;async function EY(e,t,n={}){let r=lp(t),a=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=r,i=await o(),s=EZ++;a=await l_({...i,name:`${t}-${s}`},{...n,domElement:e})}else P(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function Eq(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function EJ(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function EX(e){return e.find(e=>!Eq(e))}function EQ(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let E0=window.getComputedStyle(document.body).overflow;function E1({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",E2),document.body.style.overflow="hidden",t.style.visibility="unset");let n=EX(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",EY(n,e.modalName,e.props).then(r=>{Eq(e)?EJ(e.modalName,r):r?(e.parcel=r,t.prepend(n),EQ(e,EX(EG.getState().modalStack)===e),r.mountPromise.then(()=>{Eq(e)||(e.state="MOUNTED")},t=>{P(t),e.parcel=null,E4(e)})):E4(e)},t=>{P(t),E4(e)});break}case"MOUNTING":case"MOUNTED":EQ(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),EJ(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=EG.getState();EG.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=E0,removeEventListener("keydown",E2)}function E4(e){if(Eq(e))return;e.state="TO_BE_DELETED";let t=EG.getState();EG.setState({...t,modalStack:[...t.modalStack]})}function E2(e){"Escape"===e.key&&function(){let[e]=EG.getState().modalStack;e&&E4(e)}()}function E3(e){EG.subscribe(E1),EG.setState({...EG.getState(),modalContainer:e})}function E6(e,t={},n=()=>{}){let r=()=>{let e=EG.getState().modalStack.find(e=>e.onClose===n);e&&E4(e)};if(lp(e)){var a;let o,i;a={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},i=[a,...(o=EG.getState()).modalStack],EG.setState({...o,modalStack:i})}else P(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var E5=n(3264),E9=Object.prototype.hasOwnProperty;let E8=function(e){if(null==e)return!0;if((0,eA.A)(e)&&((0,eN.A)(e)||"string"==typeof e||"function"==typeof e.splice||(0,eI.A)(e)||(0,ej.A)(e)||(0,e$.A)(e)))return!e.length;var t=(0,tu.A)(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if((0,eT.A)(e))return!(0,E5.A)(e).length;for(var n in e)if(E9.call(e,n))return!1;return!0},E7=({notification:e})=>{let{description:t,action:n,kind:r,critical:a,title:o,onAction:i}=e;return(0,l$.jsx)(cB.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},xe=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(E7,{notification:e},e.id))})},xt=({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,l$.jsx)(cB.ActionableNotification,{kind:a||"info",actionButtonLabel:c,ariaLabel:oe("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:oe("actionableNotification","Actionable notification"),subtitle:r,title:o,lowContrast:i,inline:!0,...u})},xn=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(xt,{notification:e},e.id))})};class xr{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 xa=new xr,xo=0,xi=new xr,xs=0;function xl(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(xe,{subject:xa}))}function xu(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!E8(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{xa.next({...e,id:xo++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function xc(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(xn,{subject:xi}))}function xd(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!E8(t))?setTimeout(()=>{xi.next({...e,id:xs++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let xm=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],xp=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],xf={container:"-esm-patient-immunizations__numeric-observation-module__container___gS0Wg",card:"-esm-patient-immunizations__numeric-observation-module__card___w0fF5","abnormal-value":"-esm-patient-immunizations__numeric-observation-module__abnormal-value___xuX3W","critical-value":"-esm-patient-immunizations__numeric-observation-module__critical-value___Jynsn",cell:"-esm-patient-immunizations__numeric-observation-module__cell___tMhBJ","critically-high":"-esm-patient-immunizations__numeric-observation-module__critically-high___3L2wx","critically-low":"-esm-patient-immunizations__numeric-observation-module__critically-low___XP+HX",high:"-esm-patient-immunizations__numeric-observation-module__high___JV9do",low:"-esm-patient-immunizations__numeric-observation-module__low___-uDKD","label-container":"-esm-patient-immunizations__numeric-observation-module__label-container___vTf2y","value-container":"-esm-patient-immunizations__numeric-observation-module__value-container___xTUIC",label:"-esm-patient-immunizations__numeric-observation-module__label___-pfmb",value:"-esm-patient-immunizations__numeric-observation-module__value___1A4zt",units:"-esm-patient-immunizations__numeric-observation-module__units___SzvX+","pad-right":"-esm-patient-immunizations__numeric-observation-module__pad-right___ND9XL","off-scale-low":"-esm-patient-immunizations__numeric-observation-module__off-scale-low___gFAv9","off-scale-high":"-esm-patient-immunizations__numeric-observation-module__off-scale-high___aSEmX",arrow:"-esm-patient-immunizations__numeric-observation-module__arrow___9bvsX"},xh=({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?`${op}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${op}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:a,isLoading:o}=uI()(n,oy),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":xm.includes(r)?r.toLowerCase():xp.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:oe("notAvailable","Not available"),w=cI()({[xf["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[xf["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[xf.low]:"low"===m,[xf.high]:"high"===m,[xf["off-scale-low"]]:"off_scale_low"===m,[xf["off-scale-high"]]:"off_scale_high"===m}),E=cI()({[xf.container]:!0,[xf.card]:!0,[xf["critical-value"]]:p,[xf["abnormal-value"]]:f&&!p}),x=cI()({[xf.cell]:!0,[w]:!0});return"cell"===i?(0,l$.jsxs)("div",{className:x,children:[b,v&&t?` ${t}`:""]}):(0,l$.jsxs)("section",{className:E,"data-testid":"numeric-observation-card",children:[n&&(0,l$.jsxs)("div",{className:xf["label-container"],children:[(0,l$.jsx)("span",{id:h,className:xf.label,children:n}),f&&(0,l$.jsx)("span",{className:xf[m.replace("_","-")],title:oe("abnormalValue","Abnormal value")})]}),(0,l$.jsxs)("div",{className:xf["value-container"],children:[(0,l$.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:xf.value,children:b}),v&&t&&(0,l$.jsx)("span",{id:y,className:xf.units,children:t})]})]})},xg="-esm-patient-immunizations__page-header-module__pageHeader___6TOjO",xy=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,l$.jsx)("div",{className:cI()(xg,n),...r,children:t})}{let{title:t,illustration:n,className:r,...a}=e;return(0,l$.jsx)("div",{className:cI()(xg,r),...a,children:(0,l$.jsx)(xv,{title:t,illustration:n})})}},xv=({title:e,illustration:t,className:n})=>{let[r,a]=(0,lR.useState)(null);return(0,lR.useEffect)(()=>{nD("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,l$.jsxs)("div",{className:cI()("-esm-patient-immunizations__page-header-module__pageHeaderContent___mCImT",n),children:[t,(0,l$.jsxs)("div",{className:"-esm-patient-immunizations__page-header-module__pageLabels___kqDS+",children:[r?.implementationName&&(0,l$.jsx)("p",{children:oe(r.implementationName)}),(0,l$.jsx)("h1",{className:"-esm-patient-immunizations__page-header-module__pageName___SbZBC",children:e})]})]})},xb=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:r,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=ca(t,e,r,o),u="tablet"===u3(),c=oe("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,l$.jsx)(l$.Fragment,{children:e>0&&(0,l$.jsxs)("div",{className:cI()({"-esm-patient-immunizations__pagination-module__tablet___82gj1":u,"-esm-patient-immunizations__pagination-module__desktop___6yI8e":!u}),children:[(0,l$.jsxs)("div",{children:[c,a&&(0,l$.jsx)(lN,{to:a,className:"-esm-patient-immunizations__pagination-module__configurableLink___oIqma",children:i??oe("seeAll","See all")})]}),(0,l$.jsx)(cB.Pagination,{className:"-esm-patient-immunizations__pagination-module__pagination___A-Lcg",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>oe("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function xw(e){return xx(xS(e,"usual","official"))}function xE(e){return xw(e)}function xx(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function xD(e){return xx(e)}function xS(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 x_(e,t=cp()()){let n=cp()(t),r=wU(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 xC(e,t=cp()()){let n=x_(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),wV(n,r)}let xk={container:"-esm-patient-immunizations__patient-banner-patient-info-module__container___iC32K",activePatientContainer:"-esm-patient-immunizations__patient-banner-patient-info-module__activePatientContainer___OoDPd",patientBanner:"-esm-patient-immunizations__patient-banner-patient-info-module__patientBanner___swajU",patientName:"-esm-patient-immunizations__patient-banner-patient-info-module__patientName___+2+Xi",patientAvatar:"-esm-patient-immunizations__patient-banner-patient-info-module__patientAvatar___Rdf75",patientAvatarButton:"-esm-patient-immunizations__patient-banner-patient-info-module__patientAvatarButton___A1q8c",patientInfo:"-esm-patient-immunizations__patient-banner-patient-info-module__patientInfo___L-cOQ",demographics:"-esm-patient-immunizations__patient-banner-patient-info-module__demographics___IDhb0",row:"-esm-patient-immunizations__patient-banner-patient-info-module__row___TP7gU",flexRow:"-esm-patient-immunizations__patient-banner-patient-info-module__flexRow___vNMt2",tagsSlot:"-esm-patient-immunizations__patient-banner-patient-info-module__tagsSlot___0Dvjn",identifiers:"-esm-patient-immunizations__patient-banner-patient-info-module__identifiers___d3GTJ",identifier:"-esm-patient-immunizations__patient-banner-patient-info-module__identifier___kc6eq",primaryIdentifier:"-esm-patient-immunizations__patient-banner-patient-info-module__primaryIdentifier___ZxRUU",secondaryIdentifier:"-esm-patient-immunizations__patient-banner-patient-info-module__secondaryIdentifier___eQh8x",value:"-esm-patient-immunizations__patient-banner-patient-info-module__value___CoAOR",tag:"-esm-patient-immunizations__patient-banner-patient-info-module__tag___InccN",gender:"-esm-patient-immunizations__patient-banner-patient-info-module__gender___vfinx",separator:"-esm-patient-immunizations__patient-banner-patient-info-module__separator___3OIBl",tooltipPadding:"-esm-patient-immunizations__patient-banner-patient-info-module__tooltipPadding___hBqWG",tooltipSmallText:"-esm-patient-immunizations__patient-banner-patient-info-module__tooltipSmallText___bPnkq",actionsButtonText:"-esm-patient-immunizations__patient-banner-patient-info-module__actionsButtonText___VNvm7"};function xP({showIdentifierLabel:e,type:t,value:n}){return(0,l$.jsx)("span",{className:xk.primaryIdentifier,children:(0,l$.jsxs)(cB.Tag,{className:xk.tag,type:"gray",children:[e&&t?.text&&(0,l$.jsxs)("span",{className:xk.label,children:[t.text,": "]}),(0,l$.jsx)("span",{className:xk.value,children:n})]})})}function xR({showIdentifierLabel:e,type:t,value:n}){return(0,l$.jsxs)(cB.FormLabel,{className:xk.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,l$.jsxs)("span",{className:xk.label,children:[t?.text,": "]}),(0,l$.jsx)("span",{className:xk.value,children:n})]})}function xT({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=uO(),{primaryIdentifierCode:r}=cs(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,l$.jsx)(l$.Fragment,{children:a?.length?a.map(({value:e,type:n},o)=>(0,l$.jsxs)(lT().Fragment,{children:[(0,l$.jsx)("span",{className:xk.identifier,children:n?.coding?.[0]?.code===r?(0,l$.jsx)(xP,{showIdentifierLabel:t,type:n,value:e}):(0,l$.jsx)(xR,{showIdentifierLabel:t,type:n,value:e})}),o<a.length-1&&(0,l$.jsx)("span",{className:xk.separator,children:"\xb7"})]},e)):""})}let xO={Female:dx,Male:dD,Other:dS,Unknown:d_},x$=({gender:e})=>{let t=xO[e];return t?(0,l$.jsx)(t,{fill:"#525252"}):null},xN={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function xA({patient:e,renderedFrom:t}){var n;let r,a,o=xw(e),i=e?.gender&&(a=xN[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:oe(r,n),iconKey:a}),s=(0,lR.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,l$.jsxs)("div",{className:xk.patientInfo,children:[(0,l$.jsx)("div",{className:cI()(xk.row,xk.patientNameRow),children:(0,l$.jsxs)("div",{className:xk.flexRow,children:[(0,l$.jsx)("span",{className:xk.patientName,children:o}),i&&(0,l$.jsxs)("div",{className:xk.gender,children:[(0,l$.jsx)(x$,{gender:i.iconKey}),(0,l$.jsx)("span",{children:i.displayText})]}),(0,l$.jsx)(lZ,{className:xk.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,l$.jsxs)("div",{className:xk.demographics,children:[e.birthDate&&(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("span",{children:xC(e.birthDate)}),(0,l$.jsx)("span",{className:xk.separator,children:"\xb7"}),(0,l$.jsx)("span",{children:wI(e.birthDate,{time:!1,noToday:!0})}),(0,l$.jsx)("span",{className:xk.separator,children:"\xb7"})]}),(0,l$.jsx)(xT,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,l$.jsx)(lZ,{className:xk.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var xI=n(8282);function xM({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[a,o]=(0,lR.useState)(!1),{extensions:i}=lK(n),s="tablet"===u3(),l=ce(()=>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,l$.jsx)("div",{className:"-esm-patient-immunizations__patient-banner-actions-menu-module__overflowMenuContainer___FbFcO",children:(0,l$.jsxs)("div",{"data-overflow-menu":!0,className:cI()("cds--overflow-menu",cz),ref:l,children:[(0,l$.jsxs)("button",{className:cI()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cK),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,l$.jsx)("span",{className:"-esm-patient-immunizations__patient-banner-actions-menu-module__actionsButtonText___hk4xW",children:oe("actions","Actions")})," ",(0,l$.jsx)(xI.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,l$.jsxs)("div",{className:cI()("cds--overflow-menu-options","cds--overflow-menu--flip",cW,{[cH]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,l$.jsx)("ul",{className:cI()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,l$.jsx)(lZ,{name:n,state:y},n)}),(0,l$.jsx)("span",{})]})]})})}var xj=n(5570),xL=n.n(xj);function xF(e){let{patientPhotoConceptUuid:t}=uO({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${op}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:a,isLoading:o}=un()(e?n:null,oy),i=r?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let xB=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,ue.useTranslation)();return(0,l$.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,l$.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,l$.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"})]})},xV="-esm-patient-immunizations__patient-photo-module__avatar___thboZ";function xU({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:a}=xF(e),[o,i]=(0,lR.useState)(null),[s,l]=(0,lR.useState)(!1),u=(0,lR.useMemo)(()=>xL().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?oe("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):oe("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,o,t]);return a||s?(0,l$.jsx)(cB.SkeletonIcon,{className:"-esm-patient-immunizations__patient-photo-module__skeleton___WWtyX","data-testid":"skeleton-icon"}):r?.imageSrc&&!o?(0,l$.jsx)(xB,{"aria-label":oe("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,l$.jsx)("div",{"aria-label":c,children:(0,l$.jsx)("img",{className:xV,src:o,alt:c,title:t})}):(0,l$.jsx)("div",{"aria-label":c,children:(0,l$.jsx)("div",{className:xV,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,l$.jsx)("span",{className:"-esm-patient-immunizations__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 xz=["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"],xW=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),xH=xW,xK=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),xG=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),xZ=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),xY=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),xq=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),xJ=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),xX=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),xQ=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),x0=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),x1=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),x4=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),x2=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),x3=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),x6=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),x5=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),x9=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),x8=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),x7=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),De=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),Dt=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),Dn=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),Dr=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),Da=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),Do=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),Di=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),Ds=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),Dl=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),Du=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),Dc=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),Dd=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),Dm=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),Dp=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),Df=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),Dh=x2,Dg=Dr,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,l$.jsx)(uw,{value:a.current,fallback:t,children:(0,l$.jsx)(Dv,{ref:r,pictogram:e,pictogramProps:n})})})),Dv=(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,l$.jsx)("svg",{ref:n,className:cI()("-esm-patient-immunizations__pictograms-module__pictogram___ooPKM",r),height:a,width:a,children:(0,l$.jsx)("use",{href:`#${e}`})})})),Db=({children:e})=>"tablet"===u3()?(0,l$.jsx)(cB.Layer,{children:e}):(0,l$.jsx)(l$.Fragment,{children:e}),Dw=({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,l$.jsx)(cB.ActionableNotification,{actionButtonLabel:p,"aria-label":oe("closeSnackbar","Close snackbar"),className:cI()("-esm-patient-immunizations__snackbar-module__slideIn___senVE",{"-esm-patient-immunizations__snackbar-module__animated___8eltL":h,"-esm-patient-immunizations__snackbar-module__slideOut___BIIXm":y}),kind:r,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:oe("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},DE=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(Dw,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},Dx=new xr,DD=0;function DS(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(DE,{subject:Dx}))}function D_(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{Dx.next({...e,id:DD++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let DC=({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,l$.jsx)("div",{children:(0,l$.jsx)(cB.ActionableNotification,{actionButtonLabel:i,kind:r||"info",lowContrast:a,subtitle:n,title:o||"",onActionButtonClick:l,onClose:t})})},Dk=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(DC,{toast:e,closeToast:()=>r(e)},e.id))})},DP=new xr,DR=0;function DT(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(Dk,{subject:DP}))}function DO(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!E8(t))?setTimeout(()=>{DP.next({...e,id:DR++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let D$="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),DN=new Uint8Array(16),DA=[];for(let e=0;e<256;++e)DA.push((e+256).toString(16).slice(1));let DI=function(e,t,n){if(D$&&!t&&!e)return D$();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(DN)}();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(DA[e[t+0]]+DA[e[t+1]]+DA[e[t+2]]+DA[e[t+3]]+"-"+DA[e[t+4]]+DA[e[t+5]]+"-"+DA[e[t+6]]+DA[e[t+7]]+"-"+DA[e[t+8]]+DA[e[t+9]]+"-"+DA[e[t+10]]+DA[e[t+11]]+DA[e[t+12]]+DA[e[t+13]]+DA[e[t+14]]+DA[e[t+15]]).toLowerCase()}(r)};async function DM(e,t){let{openedGroup:n}=lf.getState();if(n){if(n.groupName===e&&DF(n.props,t))return!0;else if(!await DU({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return lf.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function Dj(e){let{openedGroup:t,openedWindows:n}=lf.getState();if(t){if(n.length>0&&!(e||await DU({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;lf.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function DL(e,t=null,n=null,r=null){let a=lf.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=lh(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=lg(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=ly(e);if(i&&(i.groupName!==l.name||!DF(i.props,r)))return!!await DU({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[DQ(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(DF(r.props,n)){let d=c.find(t=>t.workspaceName===e);return d&&DF(d.props,t)?((i||u!==a.openedWindows.length-1)&&lf.setState(DZ.restoreWindow(a,s)),!0):!!await DU({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??o},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[DQ(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await DU({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:o??a?.openedGroup?.props},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[DQ(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(lf.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[DQ(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await DU({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[DQ(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function DF(e,t){return null==e||null==t||O(e,t)}function DB(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 DV(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=E6("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function DU(e){let{openedWindows:t}=lf.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>DB(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=DB(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=DB(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>DB(e))}return DV(n)}function Dz(e,t){return DV(DB(e,t))}function DW(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 DH(e,t,n,r){let{registeredWorkspacesByName:a}=lf.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,DQ(n,r)]}}function DK(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 DG(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=DK(a,t,n);if(o===a)return e;let i=[...e.openedWindows];return i[r]=o,{...e,openedWindows:i}}let DZ={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=DW(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]=DH(e.openedWindows[o],t,n,r),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,n)=>DG(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>DG(e,t,{title:n})};function DY(){return lF(lf,DZ)}let Dq=()=>(0,lR.useContext)(l4),DJ=()=>Object.keys(lf.getState().registeredWorkspacesByName);function DX(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 DQ(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:DI()}}function D0(e,t,n){let r=lf.getState().registeredWorkspacesByName[e];return r?{windowName:r.window,openedWorkspaces:[DQ(e,t)],props:n??null,maximized:!1}:null}let D1=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:r,setWorkspaceTitle:a}=Dq();return(0,lR.useEffect)(()=>{r(n??!1)},[n,r]),(0,lR.useEffect)(()=>{a(e)},[e,a]),(0,l$.jsx)(l$.Fragment,{children:t})};function D4(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 D2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D4(Object(n),!0).forEach(function(t){D6(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D3(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 D6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D5(e){return(D5=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D9(e,t){return(D9=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D8(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var D7=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&&D9(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=D5(i);e=n?Reflect.construct(t,arguments,D5(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 D8(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),D6(D8(t=o.call(this,e)),"handleRef",function(e){t.el=e}),D6(D8(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}))}),D6(D8(t),"getParcelProps",function(){var e=D2(D2({},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,D2({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 l4&&l4.Consumer?lR.createElement(l4.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=l4&&l4.Consumer?lR.createElement(l4.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)}}],D3(i.prototype,r),a&&D3(i,a),i}();D6(D7,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var Se=n(8742);let St=lT().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?lT().createElement(Se.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},et||(et=lT().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):lT().createElement(Se.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},en||(en=lT().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 Sn=n(4240),Sr=n(8622);let Sa={workspaceOuterContainer:"-esm-patient-immunizations__workspace2-module__workspaceOuterContainer___jaqGm",narrowWorkspace:"-esm-patient-immunizations__workspace2-module__narrowWorkspace___o1wsL",widerWorkspace:"-esm-patient-immunizations__workspace2-module__widerWorkspace___gdEOi",extraWideWorkspace:"-esm-patient-immunizations__workspace2-module__extraWideWorkspace___U9xlJ",workspaceMiddleContainer:"-esm-patient-immunizations__workspace2-module__workspaceMiddleContainer___0AdtX",maximized:"-esm-patient-immunizations__workspace2-module__maximized___aKCbE",hidden:"-esm-patient-immunizations__workspace2-module__hidden___n1US5",workspaceInnerContainer:"-esm-patient-immunizations__workspace2-module__workspaceInnerContainer___1g+qk",workspaceSpacer:"-esm-patient-immunizations__workspace2-module__workspaceSpacer___P2T9y",loader:"-esm-patient-immunizations__workspace2-module__loader___fCfzZ",hiddenExtraWorkspace:"-esm-patient-immunizations__workspace2-module__hiddenExtraWorkspace___hvPSi",header:"-esm-patient-immunizations__workspace2-module__header___MXXx9",headerButtons:"-esm-patient-immunizations__workspace2-module__headerButtons___sJdnC",workspaceContent:"-esm-patient-immunizations__workspace2-module__workspaceContent___6NuXT",overlayHeaderSpacer:"-esm-patient-immunizations__workspace2-module__overlayHeaderSpacer___PLO6T",isActionMenuOpened:"-esm-patient-immunizations__workspace2-module__isActionMenuOpened___X3Vj6",showActionMenu:"-esm-patient-immunizations__workspace2-module__showActionMenu___HSun1",marginWorkspaceContent:"-esm-patient-immunizations__workspace2-module__marginWorkspaceContent___DCfWz",workspaceContainerWithActionMenu:"-esm-patient-immunizations__workspace2-module__workspaceContainerWithActionMenu___G9MdI",workspaceFixedContainer:"-esm-patient-immunizations__workspace2-module__workspaceFixedContainer___uIldI",workspaceContainerWithoutActionMenu:"-esm-patient-immunizations__workspace2-module__workspaceContainerWithoutActionMenu___lBudZ"},So=e=>e.registeredWorkspacesByName,Si=({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:lf.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,l$.jsx)(D7,{config:e,mountParcel:lk,wrapWith:"div",wrapClassName:cI()(Sa.workspaceContent,{[Sa.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null===e?(0,l$.jsx)("div",{className:cI()(Sa.workspaceContent,{[Sa.hiddenExtraWorkspace]:c}),children:(0,l$.jsx)(cB.InlineNotification,{kind:"error",title:oe("error"),subtitle:oe("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,u,c]);return o?(0,l$.jsx)("div",{children:(0,l$.jsx)(Ss,{openedWorkspace:t,openedWindow:n,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,l$.jsx)(cB.InlineLoading,{className:cI()(Sa.loader,{[Sa.hiddenExtraWorkspace]:c}),description:`${oe("loading")}`})},Ss=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:r,closeWindow:a,children:o})=>{let i=u3(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=DY(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=DX(t,c,u),w=v?.icon,E=v?.canMaximize,x=!!s&&d[s.groupName]?.persistence==="closable",D=!!w&&!x,S=l.findIndex(e=>e.windowName===h)<l.length-1||m,_=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,l$.jsxs)("div",{className:cI()(Sa.workspaceOuterContainer,{[Sa.narrowWorkspace]:"narrow"===b,[Sa.widerWorkspace]:"wider"===b,[Sa.extraWideWorkspace]:"extra-wide"===b,[Sa.isActionMenuOpened]:_}),children:[(0,l$.jsx)("div",{className:cI()(Sa.workspaceSpacer,{[Sa.hidden]:S})}),(0,l$.jsx)("div",{className:cI()(Sa.workspaceMiddleContainer,{[Sa.maximized]:g,[Sa.hidden]:S,[Sa.isRootWorkspace]:n,[Sa.showActionMenu]:r}),children:(0,l$.jsx)("div",{className:cI()(Sa.workspaceInnerContainer,{[Sa.maximized]:g,[Sa.hidden]:S,[Sa.isRootWorkspace]:n}),children:o?(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsxs)(cB.Header,{"aria-label":oe("workspaceHeader"),className:Sa.header,children:[(0,l$.jsx)(cB.HeaderName,{prefix:"",children:y}),(0,l$.jsx)("div",{className:Sa.overlayHeaderSpacer}),(0,l$.jsx)(cB.HeaderGlobalBar,{className:Sa.headerButtons,children:u6(i)?(0,l$.jsxs)(l$.Fragment,{children:[(E||g)&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":g?oe("minimize"):oe("maximize"),onClick:()=>p(h,!g),children:g?(0,l$.jsx)(St,{}):(0,l$.jsx)(Sn.hz,{})}),D&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("hide"),onClick:()=>f(),children:(0,l$.jsx)(c2,{})}),!x&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("close"),onClick:a,children:(0,l$.jsx)(dm,{})})]}):(0,l$.jsxs)(l$.Fragment,{children:[D&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("hide"),onClick:()=>f(),children:(0,l$.jsx)(Sr.d3,{})}),(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("close"),onClick:()=>{x?Dj():a()},children:(0,l$.jsx)(dm,{})})]})})]}),o]}):(0,l$.jsx)(cB.InlineLoading,{className:Sa.loader,description:`${oe("loading")} ...`})})})]})},Sl=({openedWindow:e,groupProps:t,actions:n,renderChrome:r,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,lR.useState)({}),l=lL(lf,So),u=(0,lR.useRef)(new Set);return(0,lR.useEffect)(()=>{let e=!1;return Promise.all(o.map(async t=>{let n=l[t.workspaceName];if(!n)return null;let{moduleName:r,component:a}=n;try{return[t.uuid,await cD(r,a)]}catch(n){return e||u.current.has(t.uuid)||(u.current.add(t.uuid),P(n)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},P),()=>{e=!0}},[o,l]),(0,l$.jsx)(l$.Fragment,{children:o.map((s,l)=>(0,l$.jsx)(Si,{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))})},Su=e=>e.registeredWorkspacesByName,Sc=({name:e,workspaceProps:t,windowProps:n,groupProps:r,onWindowChanged:a})=>{let o=lL(lf,Su),i=lL(lf,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=D0(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=D0(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=>DW(t,e))},openChildWorkspace(e,n,r){t(t=>DH(t,e,n,r))},setWorkspaceTitle(e,n){t(t=>DK(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>DK(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?Dz(n,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=lL(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,l$.jsx)("div",{className:"-esm-patient-immunizations__exported-workspace-module__exportedWorkspace___3vwoL",children:m?(0,l$.jsx)(Sl,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},Sd="-esm-patient-immunizations__action-menu-button2-module__container___pahg-",Sm="-esm-patient-immunizations__action-menu-button2-module__elementContainer___PzOdc",Sp="-esm-patient-immunizations__action-menu-button2-module__active___4O4Bs",Sf="-esm-patient-immunizations__action-menu-button2-module__focused___+k5kD";function Sh({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,l$.jsxs)(l$.Fragment,{children:[e({size:16}),t?(0,l$.jsx)("span",{className:"-esm-patient-immunizations__action-menu-button2-module__interruptedTag___mS2yr",children:"!"}):(0,l$.jsx)("span",{className:"-esm-patient-immunizations__action-menu-button2-module__countTag___rb5CW",children:n})]})}let Sg=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:a,hidden:o,disabled:i})=>{let s=u3(),{openedWindows:l,restoreWindow:u,hideWindow:c,isMostRecentlyOpenedWindowHidden:d}=DY(),{extension:m}=(0,lR.useContext)(lO),p=l.findIndex(e=>e.windowName===m?.extensionId),f=l[p],h=null!=f,g=h&&(p<l.length-1||d),y=h&&!g,v=f?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(h)g?u(f.windowName):c();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=r;DL(e,t,n)}};return o?.(l)?null:"tablet"===s||"phone"===s?(0,l$.jsxs)(cB.Button,{className:cI()(Sd,{[Sp]:h&&!y,[Sf]:y}),iconDescription:t,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",disabled:i?.(l),children:[(0,l$.jsx)("span",{className:Sm,children:(0,l$.jsx)(Sh,{hasUnsavedChanges:v,getIcon:e,tagContent:n})}),(0,l$.jsx)("span",{children:t})]}):(0,l$.jsx)(cB.IconButton,{align:"left","aria-label":t,className:cI()(Sd,{[Sp]:h&&!y,[Sf]:y}),enterDelayMs:300,kind:"ghost",label:t,onClick:b,size:"md",disabled:i?.(l),children:(0,l$.jsx)("div",{className:Sm,children:(0,l$.jsx)(Sh,{hasUnsavedChanges:v,getIcon:e,tagContent:n})})})};function Sy({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,l$.jsx)(cB.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?dd:dl,children:e?oe("showLess","Show less"):oe("showMore","Show more")})}let Sv={contactDetails:"-esm-patient-immunizations__patient-banner-contact-details-module__contactDetails___rhdjA",deceased:"-esm-patient-immunizations__patient-banner-contact-details-module__deceased___K4NPg",heading:"-esm-patient-immunizations__patient-banner-contact-details-module__heading___zj6Zt",row:"-esm-patient-immunizations__patient-banner-contact-details-module__row___+Bx+P",col:"-esm-patient-immunizations__patient-banner-contact-details-module__col___0H31P",relationship:"-esm-patient-immunizations__patient-banner-contact-details-module__relationship___CZmay"},Sb=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${op}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=un()(t,oy),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,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsxs)("p",{className:Sv.heading,children:[oe("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>wR(e?.startDate).getTime()-wR(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,l$.jsx)("li",{children:(0,l$.jsx)(lN,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,l$.jsx)("li",{children:"--"})})(),t.length>3&&(0,l$.jsx)("li",{className:Sv.link,children:(0,l$.jsx)(lN,{to:`${window.spaBase}/home/patient-lists`,children:oe("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},Sw=({patientId:e})=>{let{patient:t,isLoading:n}=ci(e),r=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return n?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("p",{className:Sv.heading,children:oe("address","Address")}),(0,l$.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,l$.jsxs)("li",{children:[oe(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,l$.jsxs)("li",{children:[oe(e,e),": ",t]},`address-${e}`)):(0,l$.jsx)("li",{children:"--"})})]})},SE=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=uO({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:r,isLoading:a}=(e=>{let{data:t,error:n,isLoading:r}=uI()(`${op}/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)))`,oy);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?oe(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("p",{className:Sv.heading,children:oe("contactDetails","Contact Details")}),t?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsx)("ul",{children:r.length?r.map(([e,t],n)=>(0,l$.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,l$.jsx)("li",{children:"--"})})]})},Sx=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${op}/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}=un()(e?t:null,oy),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,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("p",{className:Sv.heading,children:oe("relationships","Relationships")}),n?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsx)("ul",{children:t&&t.length>0?(0,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsxs)("li",{className:Sv.relationship,children:[(0,l$.jsx)("div",{children:(0,l$.jsx)(lN,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,l$.jsx)("div",{children:e.relationshipType}),(0,l$.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?oe("yearAbbreviation","yr"):oe("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,l$.jsx)("li",{children:"--"})})]})};function SD({patientId:e,deceased:t}){return(0,l$.jsxs)("div",{className:cI()(Sv.contactDetails,{[Sv.deceased]:t}),children:[(0,l$.jsxs)("div",{className:Sv.row,children:[(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(Sw,{patientId:e})}),(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(SE,{patientUuid:e})})]}),(0,l$.jsxs)("div",{className:Sv.row,children:[(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(Sx,{patientId:e})}),(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(Sb,{patientUuid:e})})]})]})}function SS(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 S_="-esm-patient-immunizations__action-menu2-module__container___5s3CM";function SC({workspaceGroup:e,groupProps:t}){let n=u3(),{persistence:r}=e;return(0,l$.jsx)("aside",{className:"-esm-patient-immunizations__action-menu2-module__sideRail___qwAz4",children:(0,l$.jsxs)("div",{className:S_,children:["closable"==r&&u6(n)&&(0,l$.jsx)(cB.IconButton,{align:"left",onClick:()=>Dj(),label:oe("close"),kind:"ghost",children:(0,l$.jsx)(dm,{})}),(0,l$.jsx)(lO.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,l$.jsx)(lZ,{className:S_,name:e.name,state:{groupProps:t}})})]})})}function Sk(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 SP(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(SR,{}))}function SR(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=DY();if((0,lR.useEffect)(()=>iI("before-page-changed",t=>{let{newPage:r,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(r)return void a(Dj().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),a=Sk(t),o=Sk(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(Dj().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,l$.jsxs)("div",{className:cI()("-esm-patient-immunizations__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___gN2f4",{"-esm-patient-immunizations__workspace-windows-and-menu-module__overlay___fqI+X":a.overlay,"-esm-patient-immunizations__workspace-windows-and-menu-module__hasMaximizedWindow___J7wBw":o}),children:[(0,l$.jsx)("div",{className:"-esm-patient-immunizations__workspace-windows-and-menu-module__workspaceWindowsContainer___zpk7G",children:t.map(t=>(0,l$.jsx)(ST,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,l$.jsx)(SC,{workspaceGroup:a,groupProps:e.props})]})}function ST({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:r}=e,a=(0,lR.useMemo)(()=>({closeWorkspace(e){lf.setState(t=>DZ.closeWorkspace(t,e))},openChildWorkspace(e,t,n){lf.setState(r=>DZ.openChildWorkspace(r,e,t,n))},setWorkspaceTitle(e,t){lf.setState(n=>DZ.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){lf.setState(n=>DZ.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=lf.getState().openedWindows.find(e=>e.windowName===r);return t?Dz(t,e):Promise.resolve(!0)}}),[r]);return(0,l$.jsx)(Sl,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:n})}function SO(e,t,n){if(null==e)return n;let r=bX(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let a=[];for(let e of t){let t=bX(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 S$(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function SN(e){return!!e&&e.constructor===Object}var SA=n(7229);function SI(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function SM(e,t){return SA(function(e){let t=e.indexOf("-");if(t>=0){let n=SI(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return SI(e)}(t),e,{includePrerelease:!0})}async function Sj(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 SL(a(i)),await e()}catch(e){o?.(e,i),n=e}while(r(i++));throw n}async function SL(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function SF(e,t,n,r){}function SB(e){}function SV(e){return Promise.resolve([])}function SU(e){return Promise.resolve([])}function Sz(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 SW(e){return()=>{}}function SH(){return!0}},9271(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(1758);let a=function(e,t,n){"__proto__"==t&&r.A?(0,r.A)(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},670(e,t,n){"use strict";n.d(t,{A:()=>r});let r=function(e,t,n){for(var r=-1,a=Object(e),o=n(e),i=o.length;i--;){var s=o[++r];if(!1===t(a[s],s,a))break}return e}},1758(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(1982);let a=function(){try{var e=(0,r.A)(Object,"defineProperty");return e({},"",{}),e}catch(e){}}()},4501(e,t,n){"use strict";n.d(t,{A:()=>r});let r=function(e){return void 0===e}}}]);
|
|
39
|
+
}`.trim(),document.head.prepend(r),o=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let t=((e=document)=>e.activeElement)(),n=null!=t&&bm(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||by(this,n)},i=mT(bg(document,"touchstart",t=>{let r=pi(t);e=gh(r)?r:gg(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}),bg(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}),bg(document,"blur",e=>{let t=pi(e),n=e.relatedTarget;if(n&&bm(n))n.focus({preventScroll:!0}),by(n,bm(t));else if(!n){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),r.remove(),HTMLElement.prototype.focus=o}):mT((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?bh(document.documentElement,"scrollbarGutter","stable"):bh(document.documentElement,"paddingRight",`${s}px`)),bh(document.documentElement,"overflow","hidden"))),()=>{0==--bf&&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=vq[vq.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=pa(e?.[0])).Element?{root:n}:n,i=o?.root??document.body,s=o?.shouldUseInert&&vZ,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(po(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=yO(pr(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=vY.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),vY.set(e,n+1))},vq.length&&vq[vq.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=>po(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()}},vq.push(f),()=>{for(let e of(p.disconnect(),u)){let t=vY.get(e);null!=t&&(1===t?(c(e,!1),vY.delete(e)):vY.set(e,t-1))}f===vq[vq.length-1]?(vq.pop(),vq.length&&vq[vq.length-1].observe()):vq.splice(vq.indexOf(f),1)}}},[o,t.isOpen,r,a]),{popoverProps:mK(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=bE(y,!!g)||r.isEntering||!1,b=mY({...r,defaultClassName:"react-aria-Popover",values:{trigger:r.trigger||null,placement:g,isEntering:v,isExiting:t}}),w=!r.isNonModal||"SubmenuTrigger"===r.trigger,[E,x]=(0,lR.useState)(!1);mO(()=>{y.current&&x(w&&!y.current.querySelector("[role=dialog]"))},[y,w]),(0,lR.useEffect)(()=>{var e;let t,n;E&&y.current&&!y.current.contains(document.activeElement)&&(n=((e=document)=>e.activeElement)(t=pr(e=y.current)),"virtual"===bS?pX(()=>{((e=document)=>e.activeElement)(t)===n&&e.isConnected&&pt(e)}):pt(e))},[E,y]);let D={...p.style,...b.style},S=lT().createElement("div",{...mK(pe(r),p),...b,role:E?"dialog":void 0,tabIndex:E?-1:void 0,"aria-label":r["aria-label"],"aria-labelledby":r["aria-labelledby"],ref:y,slot:r.slot||void 0,style:D,dir:r.dir,"data-trigger":r.trigger,"data-placement":g,"data-entering":v||void 0,"data-exiting":t||void 0},!r.isNonModal&&lT().createElement(bw,{onDismiss:e.close}),lT().createElement(vG.Provider,{value:{...h,placement:g,ref:i}},b.children),lT().createElement(bw,{onDismiss:e.close}));return m?lT().createElement(vj,{...r,shouldContainFocus:E,isExiting:t,portalContainer:null!=(o=null!=n?n:null==d?void 0:d.current)?o:void 0},S):lT().createElement(vj,{...r,shouldContainFocus:E,isExiting:t,portalContainer:n},!r.isNonModal&&e.isOpen&&lT().createElement("div",{"data-testid":"underlay",...f,style:{position:"fixed",inset:0}}),lT().createElement("div",{ref:u,style:{display:"contents"}},lT().createElement(bF.Provider,{value:u},S)))}function bU(e){return e?.start!=null&&null!=e.end}let bz=(0,lR.createContext)(null),bW=(0,lR.createContext)(null),bH=(0,lR.createContext)(null),bK=(0,lR.createContext)(null),bG=(0,lR.forwardRef)(function(e,t){var n,r;[e,t]=mJ(e,t,bz);let{validationBehavior:a}=mq(vW)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bj(e),[n,r]=yu(e.value,e.defaultValue||null,e.onChange),[a]=(0,lR.useState)(n),o=n||e.placeholderValue||null,[i,s]=vy(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)(()=>vd(n,y,v,b,g),[n,y,v,b,g]),E=va({...e,value:n,builtinValidation:w}),x=E.displayValidation.isInvalid,D=e.validationState||(x?"invalid":null),S=(e,t)=>{r("timeZone"in t?t.set(hH(e)):hK(e,t)),m(null),f(null),E.commitValidation()};return{...E,value:n,defaultValue:e.defaultValue??a,setValue:r,dateValue:d,timeValue:p,setDateValue:n=>{let a="function"==typeof c?c():c;u?p||a?S(n,p||vh(e.defaultValue||e.placeholderValue)):m(n):(r(n),E.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?S(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(r){!r&&!n&&d&&u&&S(d,p||vh(e.defaultValue||e.placeholderValue)),t.setOpen(r)},validationState:D,isInvalid:x,formatValue:(e,t)=>l?new f0(e,vf(t,g)).format(l):"",getDateFormatter:(e,t)=>new f0(e,vf({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,lR.useRef)(null),[l,u]=mX(!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=mz(),o=mz(),i=mz(),s=ho((r=yX)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=y1({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=yQ(t,n),g=m["aria-labelledby"]||m.id,{locale:y}=fG(),v=t.formatValue(y,{month:"long"}),b=gx(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,E=pe(e),x=(0,lR.useMemo)(()=>yG(n),[n]),D=(0,lR.useRef)(!1),{focusWithinProps:S}=fb({...e,isDisabled:t.isOpen,onBlurWithin:t=>{po(document.getElementById(o),t.relatedTarget)||(D.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{D.current||(D.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mK(E,h,m,b,S,{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:()=>{x.focusFirst()}},fieldProps:{...m,id:i,[y6]:"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,[vr]: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}}({...mQ(e),label:u,validationBehavior:o},i,s),[b,w]=(0,lR.useState)(null),E=(0,lR.useCallback)(()=>{s.current&&w(s.current.offsetWidth+"px")},[]);bi({ref:s,onResize:E});let{focusProps:x,isFocused:D,isFocusVisible:S}=fw({within:!0}),_=mY({...e,values:{state:i,isFocusWithin:D,isFocusVisible:S,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DatePicker"}),C=pe(e);return delete C.id,lT().createElement(mZ,{values:[[bH,i],[yk,{...c,ref:s,isInvalid:i.isInvalid}],[vk,m],[fR,{...p,isPressed:i.isOpen}],[vH,{...d,ref:l,elementType:"span"}],[yh,h],[vF,i],[bL,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":b}}],[vL,f],[f$,{slots:{description:g,errorMessage:y}}],[vV,v]]},lT().createElement("div",{...x,...C,..._,ref:t,slot:e.slot||void 0,"data-focus-within":D||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}))}),bZ=(0,lR.forwardRef)(function(e,t){var n,r;[e,t]=mJ(e,t,bW);let{validationBehavior:a}=mq(vW)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",i=function(e){let t=bj(e),[n,r]=yu(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}),bU(s)?r(s):r(null)},[u,c]=vy(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&&bU(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(hH(e.start)):hK(e.start,t.start),end:"timeZone"in t.end?t.end.set(hH(e.end)):hK(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=n=>{let r="function"==typeof m?m():m;d?bU(n)&&(r||h?.start&&h?.end)?y(n,{start:h?.start||vh(e.placeholderValue),end:h?.end||vh(e.placeholderValue)}):f(n):bU(n)?(l(n),C.commitValidation()):f(n),r&&t.setOpen(!1)},b=e=>{bU(p)&&bU(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,E=(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:x,maxValue:D,isDateUnavailable:S}=e,_=(0,lR.useMemo)(()=>{var e;let t;return e=s,t=vl(vd(e?.start??null,x,D,S,E),vd(e?.end??null,x,D,S,E)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(t=vl(t,{isInvalid:!0,validationErrors:[(f7.getGlobalDictionaryForPackage("@react-stately/datepicker")||vu).getStringForLocale("rangeReversed",vc())],validationDetails:{...y7,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),t},[s,x,D,S,E]),C=va({...e,value:n,name:(0,lR.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:_}),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)&&bU(p)&&d&&y(p,{start:h?.start||vh(e.placeholderValue),end:h?.end||vh(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=vf(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 f0(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 f0(t,vf(n,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:r.format(d)}},getDateFormatter:(e,t)=>new f0(e,vf({},{...E,...t}))}}({...e,validationBehavior:o}),s=(0,lR.useRef)(null),[l,u]=mX(!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=ho((r=yX)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=y1({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fG(),f=t.formatValue(p,{month:"long"}),h=gx(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=mz(),b=mz(),w=yQ(t,n),E=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,x=(0,lR.useMemo)(()=>yG(n,{accept:e=>e.id!==v}),[n,v]),D={[y5]:x,[y6]:"presentation","aria-describedby":E,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},S=pe(e),_=(0,lR.useRef)(!1),{focusWithinProps:C}=fb({...e,isDisabled:t.isOpen,onBlurWithin:t=>{po(document.getElementById(b),t.relatedTarget)||(_.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{_.current||(_.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,lR.useRef)(vt),P=(0,lR.useRef)(vt);return{groupProps:mK(S,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":E,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...l,onClick:()=>{x.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":E,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...D,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[vr]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(vl(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...D,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[vr]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(vl(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}}({...mQ(e),label:u,validationBehavior:o},i,s),[w,E]=(0,lR.useState)(null),x=(0,lR.useCallback)(()=>{s.current&&E(s.current.offsetWidth+"px")},[]);bi({ref:s,onResize:x});let{focusProps:D,isFocused:S,isFocusVisible:_}=fw({within:!0}),C=mY({...e,values:{state:i,isFocusWithin:S,isFocusVisible:_,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DateRangePicker"}),k=pe(e);return delete k.id,lT().createElement(mZ,{values:[[bK,i],[yk,{...c,ref:s,isInvalid:i.isInvalid}],[fR,{...f,isPressed:i.isOpen}],[vH,{...d,ref:l,elementType:"span"}],[yg,g],[vF,i],[bL,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":w}}],[vL,h],[vk,{slots:{start:m,end:p}}],[f$,{slots:{description:y,errorMessage:v}}],[vV,b]]},lT().createElement("div",{...D,...k,...C,ref:t,slot:e.slot||void 0,"data-focus-within":S||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}))});function bY(e){return lT().createElement(fK,e)}function bq(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 hN||e instanceof hI||e instanceof hM)return t?hG(e,t):e;{let n=cp()(e).toDate(),r=new hN(n.getFullYear(),n.getMonth()+1,n.getDate());return t?hG(r,t):r}}function bJ(e){if(e)return e.toDate(h6())}function bX(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function bQ(e){let t=e??"",n=bX(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function b0(){let e=window.i18next.language,t=bX(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;ee=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;ee=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var b1=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(ee||"en-US"),b4=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},b2={};for(let e=1;e<100;e++)b2[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var b3={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},b6="[1234567890一二三四五六七八九〇\\d]",b5={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},b9={},b8={"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},b7={zone:b8,year:b2,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:{}},we={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(b8).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,}"},wt={...we,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}"},wn={},wr=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=b1){return wn[t.toLowerCase()]||(wn[t.toLowerCase()]=new e(t)),wn[t.toLowerCase()]}constructor(e=b1){this.locale=e,this.lookups={...b7},this.vars={...we};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=b5: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(b9[e])return b9[e];if("fullwide"===e||"hanidec"===e)return{group:b6,lookup:{...b5}};let t=b3[e];if(!t)return{group:"\\d",lookup:{...b5}};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 b9[e]={group:`[${n}-${r}]`,lookup:a},b9[e]}(this.numberingSystem);for(let n in this.lookups.digit=t,wt)wt.hasOwnProperty(n)&&(this.vars[n]=wt[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")}},wa=["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"],wo={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},wi=()=>new Date;function ws(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 wl=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)}},wu=["year","month","day","hour","minute","second","millisecond","offset"],wc={};function wd(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 wm=[[/([^\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"]],wp={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," "],...wm],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:wm,id:wm,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function wf(e,t=b1){let n=function(e){if(!wc[e]){var t,n;let r,a,o=wr.factory(e);wc[e]=new wl({doneChecker:wd,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:ws(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:ws(["","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:ws(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${b6}{2,4})\\s*\u5E74\\s*(${b6}{1,2})\\s*\u6708\\s*(${b6}{1,2})\\s*\u65E5$`),handler:ws(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:ws(["","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:ws(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=wi(),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?wo[n]:(n=n.replace(/s$/,"")).toLowerCase())&&(n="day",t*=7),("-"===e||r)&&(t*=-1);let a=wi();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:ws(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:ws(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:ws(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:ws(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:ws(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:ws(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:ws(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:ws(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:ws(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:ws(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:ws(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:ws(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:ws(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:ws(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:ws(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:ws(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:ws(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:ws(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:ws(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:ws(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:ws(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:ws(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:ws(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:ws(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:ws(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:ws(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:ws(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:ws(["zone"])}],a=o.baseName.slice(0,5),wa.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(wu.includes(r)){let e=n.toInt(a);"number"==typeof e&&(t[r]=e)}return t.year<100&&(t.year=b2[t.year]),t.year&&"buddhist"===n.dateOptions.calendar&&(t.year-=543),t})})}return wc[e]}(t),r=function(e,t){let n=wp[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 wh(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new b4(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 b4(t.valueOf()-60*e.offset*1e3):t}function wg(e,t=b1){let n=wf(e,t),r=n.invalid?new b4(NaN):wh(n);return r.isValid()||(r.invalid=`Unable to parse date "${e}"`),r}function wy(e,t=b1){return e instanceof Date?new b4(e.valueOf()):"number"==typeof e?new b4(e):wg(e,t)}Date.fromString=b4.fromString=wg,Date.fromAny=b4.fromAny=wy,"u">typeof window&&(window.anyDateParser={fromString:wg,fromAny:wy,fromObject:wh,attempt:wf});var wv=n(4397),wb=n(7657);let ww=function(e){return null==e};function wE(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}cp().extend(cf),cp().extend(wb),cp().extend(wv);let wx="YYYY-MM-DDTHH:mm:ss.SSSZZ",wD=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function wS(e,t){let n=wD.exec(e);if(!n)return wf(e,t);let r=Number(n[1]),a=void 0===n[2]?void 0:Number(n[2]),o=void 0===n[3]?void 0:Number(n[3]),i=new Date(0);return(i.setUTCFullYear(r,(a??1)-1,o??1),i.getUTCFullYear()!==r||i.getUTCMonth()!==(a??1)-1||i.getUTCDate()!==(o??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:r,...void 0!==a&&{month:a},...void 0!==o&&{day:o}}}function w_(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&cp()(e,wx).isValid()}function wC(e){return cp()(e).isToday()}function wk(e){return w_(e)?cp()(e,wx).toDate():null}function wP(e,t=!1){let n=cp()(e);return t&&(n=n.utc()),n.format(wx)}function wR(e){return cp()(e).toDate()}var wT=new WeakMap;let wO=new class{register(e,t){wE(this,wT).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(wE(this,wT).has(t))return wE(this,wT).get(t)}if(e.language&&wE(this,wT).has(e.language))return wE(this,wT).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wE(this,wT).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,wT,{writable:!0,value:new Map})}};function w$(e,t){wO.register(e,t)}function wN(e){let t=e??b0();return wO.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 wI(e,t={}){let n=wS(e,b0());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!ww(n.day)&&ww(n.month)&&(n=Object.assign({},tV(n,"day"),{month:n.day})),n.month&&(n.month-=1),n.day&&(n=Object.assign({},tV(n,"day"),{date:n.day}));let r=cp()().set(n).toDate();return ww(n.year)&&(t.year=!1),ww(n.month)&&(t.month=!1),ww(n.date)&&(t.day=!1),wM(r,t)}function wM(e,t){let n,r=t?.locale??b0(),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??wN(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=cp()(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(wj("-"))),"wide"==i&&(t=t.map(wj(" — "))),"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 wj=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(b0(),{hour:"2-digit",minute:"2-digit"})}function wF(e,t){return wM(e,{...t,time:!0})}function wB(e,t){let n=wN("string"==typeof t?new Intl.Locale(t):t);return n?hG(e,ye(n)):e}function wV(e,t){return new Intl.DurationFormat(b0(),t).format(e)}function wU(e,t){if(null==e)return null;if("string"==typeof e){let n=wS(e,b0());return n.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(n.day&&!n.month&&(n={...tV(n,"day"),...{month:n.day}}),n.month&&(n.month-=1),n.day&&(n={...tV(n,"day"),...{date:n.day}}),cp()(t).set(n))}return cp()(e)}let wz=["years","months","days","hours","minutes","seconds"],wW={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 wK(e,t=cp()(),n){let r,a=cp()(t),o=wU(e,a);if(null==o)return null;if("string"==typeof n){let e=wW[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?wW[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let r=wz.indexOf(n);for(let a=0;a<wz.length;a++){let o=wz[a];if(t.diff(e,o)>0)return a<=r?o:n}return n}(o,a,t??"seconds"):wW[s]??s,function(e,t,n,r){let a=wz.indexOf(n),o=wz.indexOf(r),i=wz.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[wW[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 wG={style:"short",localeMatcher:"lookup"};function wZ(e,t=cp()(),n){let r=wK(e,t,n);return null==r?null:wV(r,"object"==typeof n&&n.formatOptions?{...wG,...n.formatOptions}:wG)}let wY=(0,lR.createContext)(null);function wq(){let e=uO({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,lR.useMemo)(()=>{let t=b0();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,lR.useMemo)(()=>{let e=wN(t);return void 0!==e?ye(e):void 0},[t]),r=(0,lR.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),a=(0,lR.useMemo)(()=>n?hG(h1(h6()),n):h1(h6()),[n]);return{calendar:n,intlLocale:r,today_:a}}let wJ=new hN(1793,1,1);var wX={};function wQ(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function w0(e={}){let{locale:t}=fG();return(0,lR.useMemo)(()=>new(0,vx.K)(t,e),[t,e])}wX={"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 w1={};w1={"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 w4=()=>{};function w2(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=ho((t=w1)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,lR.useRef)(!1),v=(0,lR.useCallback)(()=>{clearTimeout(n.current),y.current=!1},[]),b=fa(()=>{v()});(0,lR.useEffect)(()=>()=>b(),[]);let w=(0,lR.useRef)(!1),E=()=>{w.current=!0},x=()=>{w.current=!1},D=""===a?g.format("Empty"):(a||`${r}`).replace("-","−");(0,lR.useEffect)(()=>{w.current&&(fZ&&fZ.clear("assertive"),fY(D,"assertive"))},[D]);let S=(0,lR.useCallback)(()=>{v()},[v]),_=fa(c??w4),C=fa(m??w4),k=fa(()=>{(void 0===i||isNaN(i)||void 0===r||isNaN(r)||r<i)&&(_(),P(60))}),P=fa(e=>{b(),y.current=!0,n.current=window.setTimeout(k,e)}),R=fa(()=>{(void 0===o||isNaN(o)||void 0===r||isNaN(r)||r>o)&&(C(),T(60))}),T=fa(e=>{b(),y.current=!0,n.current=window.setTimeout(R,e)}),O=e=>{e.preventDefault()},{addGlobalListener:$,removeAllGlobalListeners:N}=fo(),A=(0,lR.useRef)(!1),[I,M]=(0,lR.useState)(null);(0,lR.useEffect)(()=>{"touch"===I?P(600):I&&P(400)},[I]);let[j,L]=(0,lR.useState)(null);return(0,lR.useEffect)(()=>{"touch"===j?T(600):j&&T(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===r||isNaN(r)?void 0:r,"aria-valuetext":D,"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:E,onBlur:x},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),M("mouse")):($(window,"pointercancel",S,{capture:!0}),A.current=!1,M("touch")),$(window,"contextmenu",O)},onPressUp:e=>{v(),"touch"===e.pointerType&&(A.current=!0),N(),M(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&A.current&&c?.(),A.current=!1,M(null)},onFocus:E,onBlur:x},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),L("mouse")):($(window,"pointercancel",S,{capture:!0}),A.current=!1,L("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(A.current=!0),N(),L(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&A.current&&m?.(),A.current=!1,L(null)},onFocus:E,onBlur:x}}}let w3=null;var w6=n(2103);function w5(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 w9=(0,lR.createContext)(null),w8=(0,lR.createContext)(null),w7=(0,lR.forwardRef)(function(e,t){var n,r;[e,t]=mJ(e,t,w9);let{validationBehavior:a}=mq(vW)||{},o=null!=(r=null!=(n=e.validationBehavior)?n:a)?r:"native",{locale:i}=fG(),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)?vJ(e,t,n):vQ(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]=yu(o,isNaN(i)?NaN:i,s),[h]=(0,lR.useState)(p),[g,y]=(0,lR.useState)(()=>isNaN(p)?"":new(0,vx.K)(l,a).format(p)),v=(0,lR.useMemo)(()=>new(0,w6.d)(l,a),[l,a]),b=(0,lR.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,lR.useMemo)(()=>new(0,vx.K)(l,{...a,numberingSystem:b}),[l,a,b]),E=(0,lR.useMemo)(()=>w.resolvedOptions(),[w]),x=(0,lR.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),D=va({...e,value:p}),S=void 0===r||isNaN(r)?1:r;"percent"===E.style&&(void 0===r||isNaN(r))&&(S=.01);let[_,C]=(0,lR.useState)(p),[k,P]=(0,lR.useState)(l),[R,T]=(0,lR.useState)(a);Object.is(p,_)&&l===k&&a===R||(y(x(p)),C(p),P(l),T(a));let O=(0,lR.useMemo)(()=>v.parse(g),[v,g]),$=(e,r=0)=>{if(isNaN(O))return vQ(isNaN(r)?0:r,t,n,S);{let r=vQ(O,t,n,S);return"+"===e&&r>O||"-"===e&&r<O?r:vQ(w5(e,O,S),t,n,S)}},N=(0,lR.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===n||isNaN(n)||vQ(O,t,n,S)>O||w5("+",O,S)<=n),[u,c,t,n,S,O]),A=(0,lR.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===t||isNaN(t)||vQ(O,t,n,S)<O||w5("-",O,S)>=t),[u,c,t,n,S,O]);return{...D,validate:e=>v.isValidPartialNumber(e,t,n),increment:()=>{let e=$("+",t);e===p&&y(x(e)),f(e),D.commitValidation()},incrementToMax:()=>{null!=n&&(f(vQ(n,t,n,S)),D.commitValidation())},decrement:()=>{let e=$("-",n);e===p&&y(x(e)),f(e),D.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),D.commitValidation())},canIncrement:N,canDecrement:A,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?"":x(p));return}if(isNaN(n))return void y(x(p));let r="snap"===d?m(n):n,a=(r=v.parse(x(r)))!==p;f(r),y(x(void 0===o?r:p)),a&&D.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,lR.useRef)(null),[u,c]=mX(!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:E,label:x,formatOptions:D,onBlur:S=()=>{},onFocus:_,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:R,errorMessage:T,isWheelDisabled:O,...$}=e,{increment:N,incrementToMax:A,decrement:I,decrementToMin:M,numberValue:j,inputValue:L,commit:F,commitValidation:B}=t,V=ho((r=wX)&&r.__esModule?r.default:r,"@react-aria/numberfield"),U=(0,lR.useCallback)(()=>{let e=n.current?.value??"";(0,fi.flushSync)(()=>{F()}),n.current?.value!==e&&fY(n.current?.value??"","assertive")},[F,n]),z=mz(p),{focusProps:W}=p0({onBlur(){U()}}),H=w0(D),K=(0,lR.useMemo)(()=>H.resolvedOptions(),[H]),G=w0({...D,currencySign:void 0}),Z=(0,lR.useMemo)(()=>isNaN(j)?"":G.format(j),[G,j]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=w2({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:N,onIncrementToMax:A,onDecrement:I,onDecrementToMin:M,value:j,textValue:Z}),[X,Q]=(0,lR.useState)(!1),{focusWithinProps:ee}=fb({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]);gf(t,"wheel",r?void 0:a)}({onScroll:(0,lR.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?N():e.deltaY<0&&I())},[I,N]),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";pS()?en?er="text":et&&(er="decimal"):pR()&&(en?er="numeric":et&&(er="decimal"));let ea=pe(e),eo=(0,lR.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,fi.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=fa(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(!wQ()||!n.current)return;let e=n.current;return e.addEventListener("beforeinput",r,!1),()=>{e.removeEventListener("beforeinput",r,!1)}},[n]);let a=wQ()?null:e=>{let n=pi(e).value.slice(0,pi(e).selectionStart)+e.data+pi(e).value.slice(pi(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]=yu(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=p3(e,t),d=va({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=y1({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=pe(e,{labelable:!0}),w={type:i,pattern:e.pattern},[E]=(0,lR.useState)(l);return y4(t,e.defaultValue??E,u),y2(e,d,t),{labelProps:h,inputProps:mK(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(pi(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(lT().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:mK(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}}({...$,...ea,name:void 0,form:void 0,label:x,autoFocus:E,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[vr]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:z,type:"text",inputMode:er,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:S,onFocus:_,onFocusChange:C,onKeyDown:(0,lR.useMemo)(()=>mT(eo,k),[eo,k]),onKeyUp:P,onPaste:t=>{e.onPaste?.(t);let n=pi(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:R,errorMessage:T},t,n);y4(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,mO(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!w3&&"u">typeof document&&((w3=document.createElement("input")).type="number"),!w3))return;w3.min=null==l||isNaN(l)?"":String(l),w3.max=null==u||isNaN(u)?"":String(u),w3.step=null==c||isNaN(c)?"":String(c),w3.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&w3.validity.valid,n=e.validationMessage||w3.validationMessage,r={isInvalid:!t,validationErrors:n?[n]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:w3.validity.rangeOverflow,rangeUnderflow:w3.validity.rangeUnderflow,stepMismatch:w3.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||w3.validity.valid||e.setCustomValidity(w3.validationMessage)});let ep=mK(Y,W,ec,{role:null,"aria-roledescription":pC()?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=mz(),ey=mz(),ev=mK(q,{"aria-label":h||V.format("increase",{fieldLabel:eh}).trim(),id:m&&!h?eg:null,"aria-labelledby":m&&!h?`${eg} ${m}`:null,"aria-controls":z,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:ef}),eb=mK(J,{"aria-label":f||V.format("decrease",{fieldLabel:eh}).trim(),id:m&&!f?ey:null,"aria-labelledby":m&&!f?`${ey} ${m}`:null,"aria-controls":z,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}}({...mQ(e),label:c,validationBehavior:o},s,l),b=mY({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:v.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),w=pe(e);return delete w.id,lT().createElement(mZ,{values:[[w8,s],[yk,m],[yR,{...p,ref:l}],[vH,{...d,ref:u}],[fR,{slots:{increment:f,decrement:h}}],[f$,{slots:{description:g,errorMessage:y}}],[vV,v]]},lT().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&&lT().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function Ee(e,t){return Number.parseInt(wM(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let Et=(0,lR.forwardRef)(function(e,t){let{className:n}=e,r=(0,lR.useContext)(yy),a=(0,lR.useContext)(yv),o=r??a,i=(0,lR.useContext)(wY),s=h6(),l=wM(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=Ee(o.visibleRange.start.toDate(s),i),c=o.maxValue?Ee(o.maxValue.toDate(s),i):void 0,d=o.minValue?Ee(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,l$.jsxs)("span",{ref:t,className:n,children:[(0,l$.jsx)("span",{children:l}),(0,l$.jsxs)(w7,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,l$.jsx)(yT,{}),(0,l$.jsxs)(yP,{children:[(0,l$.jsx)(fT,{slot:"increment",children:(0,l$.jsx)(dt,{size:8})}),(0,l$.jsx)(fT,{slot:"decrement",children:(0,l$.jsx)(c8,{size:8})})]})]})]})}),En="-esm-patient-immunizations__datepicker-module__inputGroup___gBam-",Er="-esm-patient-immunizations__datepicker-module__inputSegment___wIJDZ",Ea="-esm-patient-immunizations__datepicker-module__dateInputWrapper___LiY68",Eo="-esm-patient-immunizations__datepicker-module__invalidText___A4cv4",Ei="-esm-patient-immunizations__datepicker-module__flatButton___HcpME",Es="-esm-patient-immunizations__datepicker-module__flatButtonMd___eFpyF",El="-esm-patient-immunizations__datepicker-module__flatButtonSm___tsawR",Eu="-esm-patient-immunizations__datepicker-module__flatButtonLg___4HG5y";function Ec({children:e}){let t=(0,lR.useContext)(bH),n=(0,lR.useContext)(bK),r=t??n,a=ce(()=>r?.close());return(0,l$.jsx)(vB,{className:"-esm-patient-immunizations__datepicker-module__dialog___DaqYi",ref:a,children:e})}let Ed=(0,lR.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:r},a){let o="range"===e;return(0,l$.jsx)(bB,{ref:a,className:"-esm-patient-immunizations__datepicker-module__popover___nAPzC",placement:"bottom start",offset:1,isNonModal:!0,children:(0,l$.jsx)(Ec,{children:(0,l$.jsxs)(o?yw:yb,{...o?{minValue:n,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,l$.jsxs)("header",{className:"-esm-patient-immunizations__datepicker-module__header___rPv3L",children:[(0,l$.jsx)(fT,{className:cI()(Ei,Es),slot:"previous",children:(0,l$.jsx)(du,{size:16})}),(0,l$.jsx)(Et,{className:"-esm-patient-immunizations__datepicker-module__monthYear___Rw4qE"}),(0,l$.jsx)(fT,{className:cI()(Ei,Es),slot:"next",children:(0,l$.jsx)(dc,{size:16})})]}),(0,l$.jsx)(yx,{className:"-esm-patient-immunizations__datepicker-module__calendarGrid___yKV-n",children:e=>(0,l$.jsx)(yC,{className:cI()("cds--date-picker__day",{"-esm-patient-immunizations__datepicker-module__today___KzMTn":0===t.compare(e)}),date:e},e.toString())})]})})})}),Em=(0,lR.forwardRef)(function(e,t){let n=(0,lR.useContext)(bH),[r,a]=mJ({slot:e.slot},t,vk),{locale:o}=fG(),i=vC({...r,locale:o,createCalendar:ye}),s=(0,lR.useRef)(null),{fieldProps:l,inputProps:u}=y9({...r,inputRef:s},i,a),c=(0,lR.useCallback)(()=>{i.isDisabled||n.toggle()},[]);return(0,l$.jsxs)(mZ,{values:[[vP,i],[yR,{...u,ref:s}],[yk,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,l$.jsx)(yP,{...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,l$.jsx)(yT,{})]})}),Ep=(0,lR.forwardRef)(function(e,t){let n=(0,lR.useContext)(bH),r=(0,lR.useContext)(bK);return(n??r).isInvalid?(0,l$.jsx)(my,{ref:t,size:16,...e}):(0,l$.jsx)(c9,{ref:t,size:16,...e})});class Ef{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let Eh=new Map,Eg=(0,lR.forwardRef)(function({segment:e,...t},n){let r=(0,lR.useContext)(vP),a=mk(n),{segmentProps:o}=function(e,t,n){let r,a,o,i,s=(0,lR.useRef)(""),{locale:l,direction:u}=fG(),c=function(){var e;let{locale:t}=fG(),n=ha((e=yX)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,lR.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new Ef(t,n)}},[t,n])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=y3.get(t),h=e.isPlaceholder?"":e.text,g=(0,lR.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=f6({month:"long",timeZone:g.timeZone}),v=f6({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}=w2({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,w6.d)(l,{maximumFractionDigits:0}),[l]),E=()=>{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:x}=(r=function(e){let{locale:t}=fG(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(Eh.has(n))return Eh.get(n);let r=new Intl.Collator(t,e);return Eh.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])),D=f6({hour:"numeric",hour12:!0}),S=(0,lR.useMemo)(()=>{let e=new Date;return e.setHours(0),D.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[D]),_=(0,lR.useMemo)(()=>{let e=new Date;return e.setHours(12),D.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[D]),C=f6({year:"numeric",era:"narrow",timeZone:"UTC"}),k=(0,lR.useMemo)(()=>{if("era"!==e.type)return[];let n=hG(new hN(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(x(S,n))t.setSegment("dayPeriod",0);else if(x(_,n))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=k.find(e=>x(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}}};gf((0,lR.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&po(n.current,e?.anchorNode)&&e.collapse(n.current)});let R=(0,lR.useRef)("");gf(n,"beforeinput",r=>{if(n.current)switch(r.preventDefault(),r.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&E();break;case"insertCompositionText":R.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:null!=r.data&&P(r.data)}}),gf(n,"input",e=>{let{inputType:t,data:r}=e;"insertCompositionText"===t&&(n.current&&(n.current.textContent=R.current),null!=r&&(x(S,r)||x(_,r))&&P(r))}),mO(()=>{let e=n.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[n,f]);let T=pC()||"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=mz(),$=!t.isDisabled&&!t.isReadOnly&&e.isEditable,N="literal"===e.type?"":c.of(e.type),A=gu({"aria-label":`${N}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===u){I.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(I.direction="ltr")}return{segmentProps:mK(b,A,{id:O,...T,"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:$,suppressContentEditableWarning:$,spellCheck:$?"false":void 0,autoCorrect:$?"off":void 0,[parseInt(lT().version,10)>=17?"enterKeyHint":"enterkeyhint"]:$?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!$?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(pD()?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(),E()}},onFocus:()=>{s.current="",n.current&&gb(n.current,{containingElement:gg(n.current)});let e=window.getSelection();e?.collapse(n.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,r,a),{focusProps:i,isFocused:s,isFocusVisible:l}=fw(),{hoverProps:u,isHovered:c}=f_({...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,l$.jsx)("span",{...mK(pe(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})}),Ey={short:!1,size:"md"},Ev=(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}={...Ey,...e},{calendar:b,intlLocale:w,today_:E}=wq(),x=(0,lR.useId)(),D=!!(u??l),S=(0,lR.useMemo)(()=>bq(r,b),[r,b]),_=(0,lR.useMemo)(()=>bq(y,b,!0),[y,b]),C=(0,lR.useMemo)(()=>bq(d,b),[d,b]),k=(0,lR.useMemo)(()=>bq(m??wJ,b),[m,b]),P=(0,lR.useMemo)(()=>o||s,[o,s]),R=(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?.(bJ(e)))),[f,p]);return(0,l$.jsx)(bY,{locale:w.toString(),children:(0,l$.jsx)("div",{className:cI()("cds--form-item",n),children:(0,l$.jsx)(mZ,{values:[[wY,w]],children:(0,l$.jsxs)(bG,{className:cI()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:S,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:_,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:R,children:[(0,l$.jsxs)("div",{className:"cds--date-picker-container",children:[D&&(0,l$.jsx)(vK,{className:cI()("cds--label",{"cds--label--disabled":a}),htmlFor:x,children:u??l}),(0,l$.jsxs)(yP,{className:En,children:[(0,l$.jsx)(Em,{id:D?x:void 0,ref:t,className:cI()("cds--date-picker-input__wrapper","-esm-patient-immunizations__datepicker-module__inputWrapper___uKdT1",{"-esm-patient-immunizations__datepicker-module__inputWrapperSm___0RXJc":"sm"===g,"-esm-patient-immunizations__datepicker-module__inputWrapperMd___4Vff1":"md"===g||!g||0===g.length,"-esm-patient-immunizations__datepicker-module__inputWrapperLg___VCRm5":"lg"===g}),children:e=>"era"!==e.type?(0,l$.jsx)(Eg,{className:Er,segment:e}):(0,l$.jsx)(lT().Fragment,{})}),(0,l$.jsx)(fT,{className:cI()(Ei,{[El]:"sm"===g,[Es]:"md"===g||!g||0===g.length,[Eu]:"lg"===g}),children:(0,l$.jsx)(Ep,{})})]}),(0,l$.jsx)(vU,{className:Eo,children:i})]}),(0,l$.jsx)(Ed,{variant:"single",today_:E})]})})})})}),Eb=(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}=wq(),w=(0,lR.useId)(),E=!!(s??i),x=(0,lR.useMemo)(()=>{if(f)return{start:bq(f[0],y,!1),end:bq(f[1],y,!1)}},[f,y]),D=(0,lR.useMemo)(()=>{if(t)return{start:bq(t[0],y,!1),end:bq(t[1],y,!1)}},[t,y]),S=(0,lR.useMemo)(()=>bq(c??wJ,y,!0),[c,y]),_=(0,lR.useMemo)(()=>bq(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?.([bJ(e.start),bJ(e.end)]))),[m,d]);return(0,l$.jsx)(bY,{locale:v.toString(),children:(0,l$.jsx)("div",{className:cI()("cds--form-item",e),children:(0,l$.jsx)(mZ,{values:[[wY,v]],children:(0,l$.jsx)(bZ,{id:E?w:void 0,className:cI()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:_,minValue:S,value:x,defaultValue:D,ref:g,isDisabled:a,...h,onChange:k,children:(0,l$.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,l$.jsx)(vK,{className:cI()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,l$.jsxs)(yP,{className:En,children:[(0,l$.jsxs)("div",{className:cI()("-esm-patient-immunizations__datepicker-module__inputsWrapper___xXRQI",{"-esm-patient-immunizations__datepicker-module__inputsWrapperSm___nL+b6":"sm"===p,"-esm-patient-immunizations__datepicker-module__inputsWrapperMd___Kgcps":"md"===p||!p||0===p.length,"-esm-patient-immunizations__datepicker-module__inputsWrapperLg___raaSN":"lg"===p}),children:[(0,l$.jsx)(vT,{className:cI()("cds--date-picker-input__wrapper","-esm-patient-immunizations__datepicker-module__startInput___cWw-5",Ea),slot:"start",children:e=>(0,l$.jsx)(Eg,{className:Er,segment:e})}),(0,l$.jsx)("div",{className:"-esm-patient-immunizations__datepicker-module__separator___Ddb4g",children:(0,l$.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,l$.jsx)(vT,{className:cI()("cds--date-picker-input__wrapper","-esm-patient-immunizations__datepicker-module__endInput___xdYOl",Ea),slot:"end",children:e=>(0,l$.jsx)(Eg,{className:Er,segment:e})})]}),(0,l$.jsx)(fT,{className:cI()(Ei,{[El]:"sm"===p,[Es]:"md"===p||!p||0===p.length,[Eu]:"lg"===p}),children:(0,l$.jsx)(Ep,{})})]}),(0,l$.jsx)(vU,{className:Eo,children:r}),(0,l$.jsx)(Ed,{variant:"range",today_:b,minDate:S,maxDate:_})]})})})})})}),Ew=lT().createContext(null);function EE(e){let{children:t}=e,n=(0,lR.useContext)(Ew),[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 lT().createElement(Ew.Provider,{value:o},t)}function Ex(e){let t,{modalProviderProps:n}={modalProviderProps:{"aria-hidden":!!(t=(0,lR.useContext)(Ew))&&t.modalCount>0||void 0}};return lT().createElement("div",{"data-overlay-container":!0,...e,...n})}function ED(e){return lT().createElement(EE,null,lT().createElement(Ex,e))}function ES(e){let t=mB(),{portalContainer:n=t?null:document.body,...r}=e,{getContainer:a}=vI();if(!e.portalContainer&&a&&(n=a()),lT().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=lT().createElement(ED,r);return fs().createPortal(o,n)}let E_=lT().createContext(null),EC=lT().forwardRef(function(e,t){let{children:n,...r}=e,a=mk(t),o={...r,ref:a};return lT().createElement(E_.Provider,{value:o},n)}),Ek={},EP=0,ER=!1,ET=null,EO=null;function E$(e={}){let{delay:t=1500,closeDelay:n=500}=e,{isOpen:r,open:a,close:o}=bj(e),i=(0,lR.useMemo)(()=>`${++EP}`,[]),s=(0,lR.useRef)(null),l=(0,lR.useRef)(o),u=()=>{Ek[i]=m},c=()=>{for(let e in Ek)e!==i&&(Ek[e](!0),delete Ek[e])},d=()=>{s.current&&clearTimeout(s.current),s.current=null,c(),u(),ER=!0,a(),ET&&(clearTimeout(ET),ET=null),EO&&(clearTimeout(EO),EO=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)),ET&&(clearTimeout(ET),ET=null),ER&&(EO&&clearTimeout(EO),EO=setTimeout(()=>{delete Ek[i],EO=null,ER=!1},Math.max(500,n)))};return(0,lR.useEffect)(()=>{l.current=o},[o]),(0,lR.useEffect)(()=>()=>{s.current&&clearTimeout(s.current),Ek[i]&&delete Ek[i]},[i]),{isOpen:r,open:e=>{e||!(t>0)||s.current?d():(c(),u(),r||ER?r||d():(ET&&clearTimeout(ET),ET=setTimeout(()=>{ET=null,ER=!0,d()},t)))},close:m}}let EN=(0,lR.createContext)(null),EA=(0,lR.createContext)(null);function EI(e){let t=E$(e),n=(0,lR.useRef)(null),{triggerProps:r,tooltipProps:a}=function(e,t,n){let{isDisabled:r,trigger:a,shouldCloseOnPress:o=!0}=e,i=mz(),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}=f_({isDisabled:r,onHoverStart:()=>{"focus"!==a&&("pointer"===pN?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=p3({isDisabled:r,onFocus:()=>{pG()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},n);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mK(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,n);return lT().createElement(mZ,{values:[[EN,t],[EA,{...a,triggerRef:n}]]},lT().createElement(EC,{...r,ref:n},e.children))}let EM=(0,lR.forwardRef)(function({UNSTABLE_portalContainer:e,...t},n){[t,n]=mJ(t,n,EA);let r=(0,lR.useContext)(EN),a=E$(t),o=null==t.isOpen&&null==t.defaultOpen&&r?r:a,i=bx(n,o.isOpen)||t.isExiting||!1;return o.isOpen||i?lT().createElement(ES,{portalContainer:e},lT().createElement(Ej,{...t,tooltipRef:n,isExiting:i})):null});function Ej(e){let t=(0,lR.useContext)(EN),n=(0,lR.useRef)(null),[r,a]=(0,lR.useState)(0);mO(()=>{n.current&&t.isOpen&&a(n.current.getBoundingClientRect().width)},[t.isOpen,n]);let{overlayProps:o,arrowProps:i,placement:s}=bl({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=bE(e.tooltipRef,!!s)||e.isEntering||!1,u=mY({...e,defaultClassName:"react-aria-Tooltip",values:{placement:s,isEntering:l,isExiting:e.isExiting,state:t}}),{tooltipProps:c}=function(e,t){let n=pe(e,{labelable:!0}),{hoverProps:r}=f_({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mK(n,r,{role:"tooltip"})}}(e=mK(e,o),t);return lT().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},lT().createElement(vG.Provider,{value:{...i,placement:s,ref:n}},u.children))}let EL=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=uO({externalModuleName:"@openmrs/esm-styleguide"});return(0,l$.jsx)("div",{className:"-esm-patient-immunizations__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,l$.jsx)(EF,{color:a,isProvisional:r,name:e.display},e.uuid)})})};function EF({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=cI()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-patient-immunizations__diagnosis-tags-module__diagnosisTag___mQ28X"),m=(0,l$.jsxs)(l$.Fragment,{children:[t&&(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("span",{"aria-hidden":"true",className:"-esm-patient-immunizations__diagnosis-tags-module__provisionalMark___S+J53",children:"?"}),(0,l$.jsxs)("span",{className:"cds--visually-hidden",children:[oe("provisional","Provisional")," "]})]}),(0,l$.jsx)("span",{ref:c,className:"cds--tag__label",children:n})]});return u?(0,l$.jsxs)(EI,{delay:0,closeDelay:150,isOpen:r,onOpenChange:a,children:[(0,l$.jsx)(fT,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,l$.jsx)(EM,{className:"-esm-patient-immunizations__diagnosis-tags-module__tagTooltip___50O3+",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,l$.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let EB={action:"-esm-patient-immunizations__empty-card-module__action___oG778",content:"-esm-patient-immunizations__empty-card-module__content___YUXvR",desktopHeading:"-esm-patient-immunizations__empty-card-module__desktopHeading___EljiH",tabletHeading:"-esm-patient-immunizations__empty-card-module__tabletHeading___8mc7w",tile:"-esm-patient-immunizations__empty-card-module__tile___3-rRO"},EV=({width:e="64",height:t="64"})=>(0,l$.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,l$.jsx)("use",{href:"#omrs-empty-data-illustration"})}),EU=e=>{let t="tablet"===u3(),n=e.launchForm;return(0,l$.jsx)(cB.Layer,{className:EB.layer,children:(0,l$.jsxs)(cB.Tile,{className:EB.tile,children:[(0,l$.jsx)("div",{className:t?EB.tabletHeading:EB.desktopHeading,children:(0,l$.jsx)("h4",{children:e.headerTitle})}),(0,l$.jsx)(EV,{}),(0,l$.jsx)("p",{className:EB.content,children:oe("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,l$.jsx)("p",{className:EB.action,children:n&&(0,l$.jsx)(cB.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:oe("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},Ez=({error:e,headerTitle:t})=>{let n="tablet"===u3();return(0,l$.jsx)(cB.Layer,{children:(0,l$.jsxs)(cB.Tile,{className:"-esm-patient-immunizations__error-state-module__tile___mzWLn",children:[(0,l$.jsx)("div",{className:n?"-esm-patient-immunizations__error-state-module__tabletHeading___l7Cpn":"-esm-patient-immunizations__error-state-module__desktopHeading___p57fl",children:(0,l$.jsx)("h4",{children:t})}),(0,l$.jsxs)("p",{className:"-esm-patient-immunizations__error-state-module__errorMessage___0fU6v",children:[oe("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,l$.jsx)("p",{className:"-esm-patient-immunizations__error-state-module__errorCopy___xkVog",children:oe("errorCopy")})]})})},EW=Ez,EH=lT().forwardRef((e,t)=>{let{slotName:n,basePath:r,componentContext:a,state:o}=u9(),i=window.location??{pathname:""},s=lH(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,l$.jsxs)(cB.SideNav,{"aria-label":oe("leftNavigation","Left navigation"),className:"-esm-patient-immunizations__left-nav-module__leftNav___czP9T",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,l$.jsx)(lZ,{name:"global-nav-menu-slot"}),n?(0,l$.jsx)(uw,{value:a,fallback:(0,l$.jsx)(lZ,{name:n,state:{basePath:r,currentPath:i,...o}}),children:(0,l$.jsx)(lO.Provider,{value:a,children:(0,l$.jsx)(lZ,{name:n,state:{basePath:r,currentPath:i,...o}})})}):null]}):null}),EK=({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}=uI()(t,oy,{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=uN(n),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uq()(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=`${of}/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()},oy);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=ct((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,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)(cB.Search,{"aria-describedby":p?`${s}-error`:void 0,labelText:oe("searchForLocation"),id:s,placeholder:oe("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__errorNotification___NfvTe",id:`${s}-error`,children:(0,l$.jsx)(cB.InlineNotification,{kind:"error",subtitle:oe("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:oe("error","Error")})}),(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__searchResults___agplm",children:c?(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__loadingContainer___EHghS",children:Array.from({length:5}).map((e,t)=>(0,l$.jsx)(cB.RadioButtonSkeleton,{className:"-esm-patient-immunizations__location-picker-module__radioButtonSkeleton___up5rH",role:"progressbar"},t))}):(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__locationResultsContainer___06YOS",children:h.length>0?(0,l$.jsx)(cB.RadioButtonGroup,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,l$.jsx)(cB.RadioButton,{className:"-esm-patient-immunizations__location-picker-module__locationRadioButton___yKif7",id:e.resource.id,labelText:(0,l$.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__emptyState___cPWp8",children:(0,l$.jsx)("p",{className:"-esm-patient-immunizations__location-picker-module__locationNotFound___b14++",children:oe("noResultsToDisplay")})})}),m&&(0,l$.jsx)("div",{className:"-esm-patient-immunizations__location-picker-module__loadingIcon___GVlrq",children:(0,l$.jsx)(cB.InlineLoading,{description:oe("loading")})})]})})]})},EG=V("modalState",{modalContainer:null,modalStack:[]}),EZ=0;async function EY(e,t,n={}){let r=lp(t),a=null;if(e){if(!r)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=r,i=await o(),s=EZ++;a=await l_({...i,name:`${t}-${s}`},{...n,domElement:e})}else P(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function Eq(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function EJ(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function EX(e){return e.find(e=>!Eq(e))}function EQ(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let E0=window.getComputedStyle(document.body).overflow;function E1({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",E2),document.body.style.overflow="hidden",t.style.visibility="unset");let n=EX(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",EY(n,e.modalName,e.props).then(r=>{Eq(e)?EJ(e.modalName,r):r?(e.parcel=r,t.prepend(n),EQ(e,EX(EG.getState().modalStack)===e),r.mountPromise.then(()=>{Eq(e)||(e.state="MOUNTED")},t=>{P(t),e.parcel=null,E4(e)})):E4(e)},t=>{P(t),E4(e)});break}case"MOUNTING":case"MOUNTED":EQ(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),EJ(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=EG.getState();EG.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=E0,removeEventListener("keydown",E2)}function E4(e){if(Eq(e))return;e.state="TO_BE_DELETED";let t=EG.getState();EG.setState({...t,modalStack:[...t.modalStack]})}function E2(e){"Escape"===e.key&&function(){let[e]=EG.getState().modalStack;e&&E4(e)}()}function E3(e){EG.subscribe(E1),EG.setState({...EG.getState(),modalContainer:e})}function E6(e,t={},n=()=>{}){let r=()=>{let e=EG.getState().modalStack.find(e=>e.onClose===n);e&&E4(e)};if(lp(e)){var a;let o,i;a={state:"NEW",onClose:n,modalName:e,props:{close:r,...t}},i=[a,...(o=EG.getState()).modalStack],EG.setState({...o,modalStack:i})}else P(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}var E5=n(3264),E9=Object.prototype.hasOwnProperty;let E8=function(e){if(null==e)return!0;if((0,eA.A)(e)&&((0,eN.A)(e)||"string"==typeof e||"function"==typeof e.splice||(0,eI.A)(e)||(0,ej.A)(e)||(0,e$.A)(e)))return!e.length;var t=(0,tu.A)(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if((0,eT.A)(e))return!(0,E5.A)(e).length;for(var n in e)if(E9.call(e,n))return!1;return!0},E7=({notification:e})=>{let{description:t,action:n,kind:r,critical:a,title:o,onAction:i}=e;return(0,l$.jsx)(cB.ActionableNotification,{actionButtonLabel:n,kind:r||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},xe=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(E7,{notification:e},e.id))})},xt=({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,l$.jsx)(cB.ActionableNotification,{kind:a||"info",actionButtonLabel:c,"aria-label":oe("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:oe("actionableNotification","Actionable notification"),subtitle:r,title:o,lowContrast:i,inline:!0,...u})},xn=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(xt,{notification:e},e.id))})};class xr{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 xa=new xr,xo=0,xi=new xr,xs=0;function xl(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(xe,{subject:xa}))}function xu(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!E8(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{xa.next({...e,id:xo++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function xc(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(xn,{subject:xi}))}function xd(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!E8(t))?setTimeout(()=>{xi.next({...e,id:xs++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let xm=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],xp=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],xf={container:"-esm-patient-immunizations__numeric-observation-module__container___gS0Wg",card:"-esm-patient-immunizations__numeric-observation-module__card___w0fF5","abnormal-value":"-esm-patient-immunizations__numeric-observation-module__abnormal-value___xuX3W","critical-value":"-esm-patient-immunizations__numeric-observation-module__critical-value___Jynsn",cell:"-esm-patient-immunizations__numeric-observation-module__cell___tMhBJ","critically-high":"-esm-patient-immunizations__numeric-observation-module__critically-high___3L2wx","critically-low":"-esm-patient-immunizations__numeric-observation-module__critically-low___XP+HX",high:"-esm-patient-immunizations__numeric-observation-module__high___JV9do",low:"-esm-patient-immunizations__numeric-observation-module__low___-uDKD","label-container":"-esm-patient-immunizations__numeric-observation-module__label-container___vTf2y","value-container":"-esm-patient-immunizations__numeric-observation-module__value-container___xTUIC",label:"-esm-patient-immunizations__numeric-observation-module__label___-pfmb",value:"-esm-patient-immunizations__numeric-observation-module__value___1A4zt",units:"-esm-patient-immunizations__numeric-observation-module__units___SzvX+","pad-right":"-esm-patient-immunizations__numeric-observation-module__pad-right___ND9XL","off-scale-low":"-esm-patient-immunizations__numeric-observation-module__off-scale-low___gFAv9","off-scale-high":"-esm-patient-immunizations__numeric-observation-module__off-scale-high___aSEmX",arrow:"-esm-patient-immunizations__numeric-observation-module__arrow___9bvsX"},xh=({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?`${op}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${op}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:a,isLoading:o}=uI()(n,oy),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":xm.includes(r)?r.toLowerCase():xp.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:oe("notAvailable","Not available"),w=cI()({[xf["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[xf["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[xf.low]:"low"===m,[xf.high]:"high"===m,[xf["off-scale-low"]]:"off_scale_low"===m,[xf["off-scale-high"]]:"off_scale_high"===m}),E=cI()({[xf.container]:!0,[xf.card]:!0,[xf["critical-value"]]:p,[xf["abnormal-value"]]:f&&!p}),x=cI()({[xf.cell]:!0,[w]:!0});return"cell"===i?(0,l$.jsxs)("div",{className:x,children:[b,v&&t?` ${t}`:""]}):(0,l$.jsxs)("section",{className:E,"data-testid":"numeric-observation-card",children:[n&&(0,l$.jsxs)("div",{className:xf["label-container"],children:[(0,l$.jsx)("span",{id:h,className:xf.label,children:n}),f&&(0,l$.jsx)("span",{className:xf[m.replace("_","-")],title:oe("abnormalValue","Abnormal value")})]}),(0,l$.jsxs)("div",{className:xf["value-container"],children:[(0,l$.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:xf.value,children:b}),v&&t&&(0,l$.jsx)("span",{id:y,className:xf.units,children:t})]})]})},xg="-esm-patient-immunizations__page-header-module__pageHeader___6TOjO",xy=e=>{if("children"in e){let{children:t,className:n,...r}=e;return(0,l$.jsx)("div",{className:cI()(xg,n),...r,children:t})}{let{title:t,illustration:n,className:r,...a}=e;return(0,l$.jsx)("div",{className:cI()(xg,r),...a,children:(0,l$.jsx)(xv,{title:t,illustration:n})})}},xv=({title:e,illustration:t,className:n})=>{let[r,a]=(0,lR.useState)(null);return(0,lR.useEffect)(()=>{nD("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,l$.jsxs)("div",{className:cI()("-esm-patient-immunizations__page-header-module__pageHeaderContent___mCImT",n),children:[t,(0,l$.jsxs)("div",{className:"-esm-patient-immunizations__page-header-module__pageLabels___kqDS+",children:[r?.implementationName&&(0,l$.jsx)("p",{children:oe(r.implementationName)}),(0,l$.jsx)("h1",{className:"-esm-patient-immunizations__page-header-module__pageName___SbZBC",children:e})]})]})},xb=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:r,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=ca(t,e,r,o),u="tablet"===u3(),c=oe("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,l$.jsx)(l$.Fragment,{children:e>0&&(0,l$.jsxs)("div",{className:cI()({"-esm-patient-immunizations__pagination-module__tablet___82gj1":u,"-esm-patient-immunizations__pagination-module__desktop___6yI8e":!u}),children:[(0,l$.jsxs)("div",{children:[c,a&&(0,l$.jsx)(lN,{to:a,className:"-esm-patient-immunizations__pagination-module__configurableLink___oIqma",children:i??oe("seeAll","See all")})]}),(0,l$.jsx)(cB.Pagination,{className:"-esm-patient-immunizations__pagination-module__pagination___A-Lcg",page:r,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>oe("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function xw(e){return xx(xS(e,"usual","official"))}function xE(e){return xw(e)}function xx(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function xD(e){return xx(e)}function xS(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 x_(e,t=cp()()){let n=cp()(t),r=wU(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 xC(e,t=cp()()){let n=x_(e,t);if(null==n)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(r.minutesDisplay="always"),wV(n,r)}let xk={container:"-esm-patient-immunizations__patient-banner-patient-info-module__container___iC32K",activePatientContainer:"-esm-patient-immunizations__patient-banner-patient-info-module__activePatientContainer___OoDPd",patientBanner:"-esm-patient-immunizations__patient-banner-patient-info-module__patientBanner___swajU",patientName:"-esm-patient-immunizations__patient-banner-patient-info-module__patientName___+2+Xi",patientAvatar:"-esm-patient-immunizations__patient-banner-patient-info-module__patientAvatar___Rdf75",patientAvatarButton:"-esm-patient-immunizations__patient-banner-patient-info-module__patientAvatarButton___A1q8c",patientInfo:"-esm-patient-immunizations__patient-banner-patient-info-module__patientInfo___L-cOQ",demographics:"-esm-patient-immunizations__patient-banner-patient-info-module__demographics___IDhb0",row:"-esm-patient-immunizations__patient-banner-patient-info-module__row___TP7gU",flexRow:"-esm-patient-immunizations__patient-banner-patient-info-module__flexRow___vNMt2",tagsSlot:"-esm-patient-immunizations__patient-banner-patient-info-module__tagsSlot___0Dvjn",identifiers:"-esm-patient-immunizations__patient-banner-patient-info-module__identifiers___d3GTJ",identifier:"-esm-patient-immunizations__patient-banner-patient-info-module__identifier___kc6eq",primaryIdentifier:"-esm-patient-immunizations__patient-banner-patient-info-module__primaryIdentifier___ZxRUU",secondaryIdentifier:"-esm-patient-immunizations__patient-banner-patient-info-module__secondaryIdentifier___eQh8x",value:"-esm-patient-immunizations__patient-banner-patient-info-module__value___CoAOR",tag:"-esm-patient-immunizations__patient-banner-patient-info-module__tag___InccN",gender:"-esm-patient-immunizations__patient-banner-patient-info-module__gender___vfinx",separator:"-esm-patient-immunizations__patient-banner-patient-info-module__separator___3OIBl",tooltipPadding:"-esm-patient-immunizations__patient-banner-patient-info-module__tooltipPadding___hBqWG",tooltipSmallText:"-esm-patient-immunizations__patient-banner-patient-info-module__tooltipSmallText___bPnkq",actionsButtonText:"-esm-patient-immunizations__patient-banner-patient-info-module__actionsButtonText___VNvm7"};function xP({showIdentifierLabel:e,type:t,value:n}){return(0,l$.jsx)("span",{className:xk.primaryIdentifier,children:(0,l$.jsxs)(cB.Tag,{className:xk.tag,type:"gray",children:[e&&t?.text&&(0,l$.jsxs)("span",{className:xk.label,children:[t.text,": "]}),(0,l$.jsx)("span",{className:xk.value,children:n})]})})}function xR({showIdentifierLabel:e,type:t,value:n}){return(0,l$.jsxs)(cB.FormLabel,{className:xk.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,l$.jsxs)("span",{className:xk.label,children:[t?.text,": "]}),(0,l$.jsx)("span",{className:xk.value,children:n})]})}function xT({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=uO(),{primaryIdentifierCode:r}=cs(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,l$.jsx)(l$.Fragment,{children:a?.length?a.map(({value:e,type:n},o)=>(0,l$.jsxs)(lT().Fragment,{children:[(0,l$.jsx)("span",{className:xk.identifier,children:n?.coding?.[0]?.code===r?(0,l$.jsx)(xP,{showIdentifierLabel:t,type:n,value:e}):(0,l$.jsx)(xR,{showIdentifierLabel:t,type:n,value:e})}),o<a.length-1&&(0,l$.jsx)("span",{className:xk.separator,children:"\xb7"})]},e)):""})}let xO={Female:dx,Male:dD,Other:dS,Unknown:d_},x$=({gender:e})=>{let t=xO[e];return t?(0,l$.jsx)(t,{fill:"#525252"}):null},xN={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function xA({patient:e,renderedFrom:t}){var n;let r,a,o=xw(e),i=e?.gender&&(a=xN[r=(n=e.gender).toLowerCase()]??"Unknown",{displayText:oe(r,n),iconKey:a}),s=(0,lR.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,l$.jsxs)("div",{className:xk.patientInfo,children:[(0,l$.jsx)("div",{className:cI()(xk.row,xk.patientNameRow),children:(0,l$.jsxs)("div",{className:xk.flexRow,children:[(0,l$.jsx)("span",{className:xk.patientName,children:o}),i&&(0,l$.jsxs)("div",{className:xk.gender,children:[(0,l$.jsx)(x$,{gender:i.iconKey}),(0,l$.jsx)("span",{children:i.displayText})]}),(0,l$.jsx)(lZ,{className:xk.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,l$.jsxs)("div",{className:xk.demographics,children:[e.birthDate&&(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("span",{children:xC(e.birthDate)}),(0,l$.jsx)("span",{className:xk.separator,children:"\xb7"}),(0,l$.jsx)("span",{children:wI(e.birthDate,{time:!1,noToday:!0})}),(0,l$.jsx)("span",{className:xk.separator,children:"\xb7"})]}),(0,l$.jsx)(xT,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,l$.jsx)(lZ,{className:xk.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var xI=n(8282);function xM({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:r}){let[a,o]=(0,lR.useState)(!1),{extensions:i}=lK(n),s="tablet"===u3(),l=ce(()=>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,l$.jsx)("div",{className:"-esm-patient-immunizations__patient-banner-actions-menu-module__overflowMenuContainer___FbFcO",children:(0,l$.jsxs)("div",{"data-overflow-menu":!0,className:cI()("cds--overflow-menu",cz),ref:l,children:[(0,l$.jsxs)("button",{className:cI()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cK),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,l$.jsx)("span",{className:"-esm-patient-immunizations__patient-banner-actions-menu-module__actionsButtonText___hk4xW",children:oe("actions","Actions")})," ",(0,l$.jsx)(xI.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,l$.jsxs)("div",{className:cI()("cds--overflow-menu-options","cds--overflow-menu--flip",cW,{[cH]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,l$.jsx)("ul",{className:cI()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,l$.jsx)(lZ,{name:n,state:y},n)}),(0,l$.jsx)("span",{})]})]})})}var xj=n(5570),xL=n.n(xj);function xF(e){let{patientPhotoConceptUuid:t}=uO({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${op}/obs?patient=${e}&concept=${t}&v=full`:null,{data:r,error:a,isLoading:o}=un()(e?n:null,oy),i=r?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let xB=({width:e=56,height:t=56,"aria-label":n})=>{let{t:r}=(0,ue.useTranslation)();return(0,l$.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,l$.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,l$.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"})]})},xV="-esm-patient-immunizations__patient-photo-module__avatar___thboZ";function xU({patientUuid:e,patientName:t,alt:n}){let{data:r,isLoading:a}=xF(e),[o,i]=(0,lR.useState)(null),[s,l]=(0,lR.useState)(!1),u=(0,lR.useMemo)(()=>xL().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?oe("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):oe("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,o,t]);return a||s?(0,l$.jsx)(cB.SkeletonIcon,{className:"-esm-patient-immunizations__patient-photo-module__skeleton___WWtyX","data-testid":"skeleton-icon"}):r?.imageSrc&&!o?(0,l$.jsx)(xB,{"aria-label":oe("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,l$.jsx)("div",{"aria-label":c,children:(0,l$.jsx)("img",{className:xV,src:o,alt:c,title:t})}):(0,l$.jsx)("div",{"aria-label":c,children:(0,l$.jsx)("div",{className:xV,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,l$.jsx)("span",{className:"-esm-patient-immunizations__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 xz=["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"],xW=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),xH=xW,xK=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),xG=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),xZ=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),xY=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),xq=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),xJ=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),xX=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),xQ=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),x0=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),x1=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),x4=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),x2=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),x3=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),x6=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),x5=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),x9=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),x8=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),x7=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),De=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),Dt=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),Dn=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),Dr=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),Da=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),Do=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),Di=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),Ds=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),Dl=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),Du=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),Dc=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),Dd=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),Dm=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),Dp=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),Df=(0,lR.memo)((0,lR.forwardRef)(function(e,t){return(0,l$.jsx)(Dv,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),Dh=x2,Dg=Dr,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,l$.jsx)(uw,{value:a.current,fallback:t,children:(0,l$.jsx)(Dv,{ref:r,pictogram:e,pictogramProps:n})})})),Dv=(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,l$.jsx)("svg",{ref:n,className:cI()("-esm-patient-immunizations__pictograms-module__pictogram___ooPKM",r),height:a,width:a,children:(0,l$.jsx)("use",{href:`#${e}`})})})),Db=({children:e})=>"tablet"===u3()?(0,l$.jsx)(cB.Layer,{children:e}):(0,l$.jsx)(l$.Fragment,{children:e}),Dw=({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,l$.jsx)(cB.ActionableNotification,{actionButtonLabel:p,"aria-label":oe("closeSnackbar","Close snackbar"),className:cI()("-esm-patient-immunizations__snackbar-module__slideIn___senVE",{"-esm-patient-immunizations__snackbar-module__animated___8eltL":h,"-esm-patient-immunizations__snackbar-module__slideOut___BIIXm":y}),kind:r,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:oe("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},DE=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(Dw,{snackbar:e,closeSnackbar:()=>r(e)},e.id))})},Dx=new xr,DD=0;function DS(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(DE,{subject:Dx}))}function D_(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{Dx.next({...e,id:DD++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let DC=({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,l$.jsx)("div",{children:(0,l$.jsx)(cB.ActionableNotification,{actionButtonLabel:i,kind:r||"info",lowContrast:a,subtitle:n,title:o||"",onActionButtonClick:l,onClose:t})})},Dk=({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,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsx)(DC,{toast:e,closeToast:()=>r(e)},e.id))})},DP=new xr,DR=0;function DT(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(Dk,{subject:DP}))}function DO(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!E8(t))?setTimeout(()=>{DP.next({...e,id:DR++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let D$="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),DN=new Uint8Array(16),DA=[];for(let e=0;e<256;++e)DA.push((e+256).toString(16).slice(1));let DI=function(e,t,n){if(D$&&!t&&!e)return D$();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(DN)}();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(DA[e[t+0]]+DA[e[t+1]]+DA[e[t+2]]+DA[e[t+3]]+"-"+DA[e[t+4]]+DA[e[t+5]]+"-"+DA[e[t+6]]+DA[e[t+7]]+"-"+DA[e[t+8]]+DA[e[t+9]]+"-"+DA[e[t+10]]+DA[e[t+11]]+DA[e[t+12]]+DA[e[t+13]]+DA[e[t+14]]+DA[e[t+15]]).toLowerCase()}(r)};async function DM(e,t){let{openedGroup:n}=lf.getState();if(n){if(n.groupName===e&&DF(n.props,t))return!0;else if(!await DU({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return lf.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function Dj(e){let{openedGroup:t,openedWindows:n}=lf.getState();if(t){if(n.length>0&&!(e||await DU({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;lf.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function DL(e,t=null,n=null,r=null){let a=lf.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=lh(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=lg(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=ly(e);if(i&&(i.groupName!==l.name||!DF(i.props,r)))return!!await DU({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[DQ(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(DF(r.props,n)){let d=c.find(t=>t.workspaceName===e);return d&&DF(d.props,t)?((i||u!==a.openedWindows.length-1)&&lf.setState(DZ.restoreWindow(a,s)),!0):!!await DU({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??o},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[DQ(e,t)],props:r?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await DU({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:o??a?.openedGroup?.props},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[DQ(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(lf.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[DQ(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await DU({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(lf.setState({...a,openedGroup:{groupName:l.name,props:r??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[DQ(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function DF(e,t){return null==e||null==t||O(e,t)}function DB(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 DV(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=E6("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function DU(e){let{openedWindows:t}=lf.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>DB(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=DB(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=DB(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>DB(e))}return DV(n)}function Dz(e,t){return DV(DB(e,t))}function DW(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 DH(e,t,n,r){let{registeredWorkspacesByName:a}=lf.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,DQ(n,r)]}}function DK(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 DG(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=DK(a,t,n);if(o===a)return e;let i=[...e.openedWindows];return i[r]=o,{...e,openedWindows:i}}let DZ={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=DW(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]=DH(e.openedWindows[o],t,n,r),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,n)=>DG(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>DG(e,t,{title:n})};function DY(){return lF(lf,DZ)}let Dq=()=>(0,lR.useContext)(l4),DJ=()=>Object.keys(lf.getState().registeredWorkspacesByName);function DX(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 DQ(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:DI()}}function D0(e,t,n){let r=lf.getState().registeredWorkspacesByName[e];return r?{windowName:r.window,openedWorkspaces:[DQ(e,t)],props:n??null,maximized:!1}:null}let D1=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:r,setWorkspaceTitle:a}=Dq();return(0,lR.useEffect)(()=>{r(n??!1)},[n,r]),(0,lR.useEffect)(()=>{a(e)},[e,a]),(0,l$.jsx)(l$.Fragment,{children:t})};function D4(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 D2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D4(Object(n),!0).forEach(function(t){D6(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D3(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 D6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D5(e){return(D5=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D9(e,t){return(D9=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D8(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var D7=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&&D9(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=D5(i);e=n?Reflect.construct(t,arguments,D5(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 D8(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),D6(D8(t=o.call(this,e)),"handleRef",function(e){t.el=e}),D6(D8(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}))}),D6(D8(t),"getParcelProps",function(){var e=D2(D2({},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,D2({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 l4&&l4.Consumer?lR.createElement(l4.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=l4&&l4.Consumer?lR.createElement(l4.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)}}],D3(i.prototype,r),a&&D3(i,a),i}();D6(D7,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var Se=n(8742);let St=lT().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?lT().createElement(Se.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},et||(et=lT().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):lT().createElement(Se.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},en||(en=lT().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 Sn=n(4240),Sr=n(8622);let Sa={workspaceOuterContainer:"-esm-patient-immunizations__workspace2-module__workspaceOuterContainer___jaqGm",narrowWorkspace:"-esm-patient-immunizations__workspace2-module__narrowWorkspace___o1wsL",widerWorkspace:"-esm-patient-immunizations__workspace2-module__widerWorkspace___gdEOi",extraWideWorkspace:"-esm-patient-immunizations__workspace2-module__extraWideWorkspace___U9xlJ",workspaceMiddleContainer:"-esm-patient-immunizations__workspace2-module__workspaceMiddleContainer___0AdtX",maximized:"-esm-patient-immunizations__workspace2-module__maximized___aKCbE",hidden:"-esm-patient-immunizations__workspace2-module__hidden___n1US5",workspaceInnerContainer:"-esm-patient-immunizations__workspace2-module__workspaceInnerContainer___1g+qk",workspaceSpacer:"-esm-patient-immunizations__workspace2-module__workspaceSpacer___P2T9y",loader:"-esm-patient-immunizations__workspace2-module__loader___fCfzZ",hiddenExtraWorkspace:"-esm-patient-immunizations__workspace2-module__hiddenExtraWorkspace___hvPSi",header:"-esm-patient-immunizations__workspace2-module__header___MXXx9",headerButtons:"-esm-patient-immunizations__workspace2-module__headerButtons___sJdnC",workspaceContent:"-esm-patient-immunizations__workspace2-module__workspaceContent___6NuXT",overlayHeaderSpacer:"-esm-patient-immunizations__workspace2-module__overlayHeaderSpacer___PLO6T",isActionMenuOpened:"-esm-patient-immunizations__workspace2-module__isActionMenuOpened___X3Vj6",showActionMenu:"-esm-patient-immunizations__workspace2-module__showActionMenu___HSun1",marginWorkspaceContent:"-esm-patient-immunizations__workspace2-module__marginWorkspaceContent___DCfWz",workspaceContainerWithActionMenu:"-esm-patient-immunizations__workspace2-module__workspaceContainerWithActionMenu___G9MdI",workspaceFixedContainer:"-esm-patient-immunizations__workspace2-module__workspaceFixedContainer___uIldI",workspaceContainerWithoutActionMenu:"-esm-patient-immunizations__workspace2-module__workspaceContainerWithoutActionMenu___lBudZ"},So=e=>e.registeredWorkspacesByName,Si=({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:lf.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,l$.jsx)(D7,{config:e,mountParcel:lk,wrapWith:"div",wrapClassName:cI()(Sa.workspaceContent,{[Sa.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null===e?(0,l$.jsx)("div",{className:cI()(Sa.workspaceContent,{[Sa.hiddenExtraWorkspace]:c}),children:(0,l$.jsx)(cB.InlineNotification,{kind:"error",title:oe("error"),subtitle:oe("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,u,c]);return o?(0,l$.jsx)("div",{children:(0,l$.jsx)(Ss,{openedWorkspace:t,openedWindow:n,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,l$.jsx)(cB.InlineLoading,{className:cI()(Sa.loader,{[Sa.hiddenExtraWorkspace]:c}),description:`${oe("loading")}`})},Ss=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:r,closeWindow:a,children:o})=>{let i=u3(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=DY(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=DX(t,c,u),w=v?.icon,E=v?.canMaximize,x=!!s&&d[s.groupName]?.persistence==="closable",D=!!w&&!x,S=l.findIndex(e=>e.windowName===h)<l.length-1||m,_=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,l$.jsxs)("div",{className:cI()(Sa.workspaceOuterContainer,{[Sa.narrowWorkspace]:"narrow"===b,[Sa.widerWorkspace]:"wider"===b,[Sa.extraWideWorkspace]:"extra-wide"===b,[Sa.isActionMenuOpened]:_}),children:[(0,l$.jsx)("div",{className:cI()(Sa.workspaceSpacer,{[Sa.hidden]:S})}),(0,l$.jsx)("div",{className:cI()(Sa.workspaceMiddleContainer,{[Sa.maximized]:g,[Sa.hidden]:S,[Sa.isRootWorkspace]:n,[Sa.showActionMenu]:r}),children:(0,l$.jsx)("div",{className:cI()(Sa.workspaceInnerContainer,{[Sa.maximized]:g,[Sa.hidden]:S,[Sa.isRootWorkspace]:n}),children:o?(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsxs)(cB.Header,{"aria-label":oe("workspaceHeader"),className:Sa.header,children:[(0,l$.jsx)(cB.HeaderName,{prefix:"",children:y}),(0,l$.jsx)("div",{className:Sa.overlayHeaderSpacer}),(0,l$.jsx)(cB.HeaderGlobalBar,{className:Sa.headerButtons,children:u6(i)?(0,l$.jsxs)(l$.Fragment,{children:[(E||g)&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":g?oe("minimize"):oe("maximize"),onClick:()=>p(h,!g),children:g?(0,l$.jsx)(St,{}):(0,l$.jsx)(Sn.hz,{})}),D&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("hide"),onClick:()=>f(),children:(0,l$.jsx)(c2,{})}),!x&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("close"),onClick:a,children:(0,l$.jsx)(dm,{})})]}):(0,l$.jsxs)(l$.Fragment,{children:[D&&(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("hide"),onClick:()=>f(),children:(0,l$.jsx)(Sr.d3,{})}),(0,l$.jsx)(cB.HeaderGlobalAction,{"aria-label":oe("close"),onClick:()=>{x?Dj():a()},children:(0,l$.jsx)(dm,{})})]})})]}),o]}):(0,l$.jsx)(cB.InlineLoading,{className:Sa.loader,description:`${oe("loading")} ...`})})})]})},Sl=({openedWindow:e,groupProps:t,actions:n,renderChrome:r,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,lR.useState)({}),l=lL(lf,So),u=(0,lR.useRef)(new Set);return(0,lR.useEffect)(()=>{let e=!1;return Promise.all(o.map(async t=>{let n=l[t.workspaceName];if(!n)return null;let{moduleName:r,component:a}=n;try{return[t.uuid,await cD(r,a)]}catch(n){return e||u.current.has(t.uuid)||(u.current.add(t.uuid),P(n)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},P),()=>{e=!0}},[o,l]),(0,l$.jsx)(l$.Fragment,{children:o.map((s,l)=>(0,l$.jsx)(Si,{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))})},Su=e=>e.registeredWorkspacesByName,Sc=({name:e,workspaceProps:t,windowProps:n,groupProps:r,onWindowChanged:a})=>{let o=lL(lf,Su),i=lL(lf,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)(null),u=(0,lR.useRef)(null);if(!l.current){let a=D0(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=D0(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=>DW(t,e))},openChildWorkspace(e,n,r){t(t=>DH(t,e,n,r))},setWorkspaceTitle(e,n){t(t=>DK(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>DK(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?Dz(n,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=lL(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,l$.jsx)("div",{className:"-esm-patient-immunizations__exported-workspace-module__exportedWorkspace___3vwoL",children:m?(0,l$.jsx)(Sl,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},Sd="-esm-patient-immunizations__action-menu-button2-module__container___pahg-",Sm="-esm-patient-immunizations__action-menu-button2-module__elementContainer___PzOdc",Sp="-esm-patient-immunizations__action-menu-button2-module__active___4O4Bs",Sf="-esm-patient-immunizations__action-menu-button2-module__focused___+k5kD";function Sh({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,l$.jsxs)(l$.Fragment,{children:[e({size:16}),t?(0,l$.jsx)("span",{className:"-esm-patient-immunizations__action-menu-button2-module__interruptedTag___mS2yr",children:"!"}):(0,l$.jsx)("span",{className:"-esm-patient-immunizations__action-menu-button2-module__countTag___rb5CW",children:n})]})}let Sg=({icon:e,label:t,tagContent:n,workspaceToLaunch:r,onBeforeWorkspaceLaunch:a,hidden:o,disabled:i})=>{let s=u3(),{openedWindows:l,restoreWindow:u,hideWindow:c,isMostRecentlyOpenedWindowHidden:d}=DY(),{extension:m}=(0,lR.useContext)(lO),p=l.findIndex(e=>e.windowName===m?.extensionId),f=l[p],h=null!=f,g=h&&(p<l.length-1||d),y=h&&!g,v=f?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(h)g?u(f.windowName):c();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=r;DL(e,t,n)}};return o?.(l)?null:"tablet"===s||"phone"===s?(0,l$.jsxs)(cB.Button,{className:cI()(Sd,{[Sp]:h&&!y,[Sf]:y}),iconDescription:t,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",disabled:i?.(l),children:[(0,l$.jsx)("span",{className:Sm,children:(0,l$.jsx)(Sh,{hasUnsavedChanges:v,getIcon:e,tagContent:n})}),(0,l$.jsx)("span",{children:t})]}):(0,l$.jsx)(cB.IconButton,{align:"left","aria-label":t,className:cI()(Sd,{[Sp]:h&&!y,[Sf]:y}),enterDelayMs:300,kind:"ghost",label:t,onClick:b,size:"md",disabled:i?.(l),children:(0,l$.jsx)("div",{className:Sm,children:(0,l$.jsx)(Sh,{hasUnsavedChanges:v,getIcon:e,tagContent:n})})})};function Sy({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,l$.jsx)(cB.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?dd:dl,children:e?oe("showLess","Show less"):oe("showMore","Show more")})}let Sv={contactDetails:"-esm-patient-immunizations__patient-banner-contact-details-module__contactDetails___rhdjA",deceased:"-esm-patient-immunizations__patient-banner-contact-details-module__deceased___K4NPg",heading:"-esm-patient-immunizations__patient-banner-contact-details-module__heading___zj6Zt",row:"-esm-patient-immunizations__patient-banner-contact-details-module__row___+Bx+P",col:"-esm-patient-immunizations__patient-banner-contact-details-module__col___0H31P",relationship:"-esm-patient-immunizations__patient-banner-contact-details-module__relationship___CZmay"},Sb=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${op}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:r}=un()(t,oy),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,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsxs)("p",{className:Sv.heading,children:[oe("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>wR(e?.startDate).getTime()-wR(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,l$.jsx)("li",{children:(0,l$.jsx)(lN,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,l$.jsx)("li",{children:"--"})})(),t.length>3&&(0,l$.jsx)("li",{className:Sv.link,children:(0,l$.jsx)(lN,{to:`${window.spaBase}/home/patient-lists`,children:oe("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},Sw=({patientId:e})=>{let{patient:t,isLoading:n}=ci(e),r=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return n?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("p",{className:Sv.heading,children:oe("address","Address")}),(0,l$.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,l$.jsxs)("li",{children:[oe(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,l$.jsxs)("li",{children:[oe(e,e),": ",t]},`address-${e}`)):(0,l$.jsx)("li",{children:"--"})})]})},SE=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=uO({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:r,isLoading:a}=(e=>{let{data:t,error:n,isLoading:r}=uI()(`${op}/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)))`,oy);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?oe(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("p",{className:Sv.heading,children:oe("contactDetails","Contact Details")}),t?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsx)("ul",{children:r.length?r.map(([e,t],n)=>(0,l$.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,l$.jsx)("li",{children:"--"})})]})},Sx=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${op}/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}=un()(e?t:null,oy),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,l$.jsxs)(l$.Fragment,{children:[(0,l$.jsx)("p",{className:Sv.heading,children:oe("relationships","Relationships")}),n?(0,l$.jsx)(cB.InlineLoading,{description:`${oe("loading","Loading")} ...`,role:"progressbar"}):(0,l$.jsx)("ul",{children:t&&t.length>0?(0,l$.jsx)(l$.Fragment,{children:t.map(e=>(0,l$.jsxs)("li",{className:Sv.relationship,children:[(0,l$.jsx)("div",{children:(0,l$.jsx)(lN,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,l$.jsx)("div",{children:e.relationshipType}),(0,l$.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?oe("yearAbbreviation","yr"):oe("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,l$.jsx)("li",{children:"--"})})]})};function SD({patientId:e,deceased:t}){return(0,l$.jsxs)("div",{className:cI()(Sv.contactDetails,{[Sv.deceased]:t}),children:[(0,l$.jsxs)("div",{className:Sv.row,children:[(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(Sw,{patientId:e})}),(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(SE,{patientUuid:e})})]}),(0,l$.jsxs)("div",{className:Sv.row,children:[(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(Sx,{patientId:e})}),(0,l$.jsx)("div",{className:Sv.col,children:(0,l$.jsx)(Sb,{patientUuid:e})})]})]})}function SS(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 S_="-esm-patient-immunizations__action-menu2-module__container___5s3CM";function SC({workspaceGroup:e,groupProps:t}){let n=u3(),{persistence:r}=e;return(0,l$.jsx)("aside",{className:"-esm-patient-immunizations__action-menu2-module__sideRail___qwAz4",children:(0,l$.jsxs)("div",{className:S_,children:["closable"==r&&u6(n)&&(0,l$.jsx)(cB.IconButton,{align:"left",onClick:()=>Dj(),label:oe("close"),kind:"ghost",children:(0,l$.jsx)(dm,{})}),(0,l$.jsx)(lO.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,l$.jsx)(lZ,{className:S_,name:e.name,state:{groupProps:t}})})]})})}function Sk(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 SP(e){e&&(0,lY.createRoot)(e).render((0,l$.jsx)(SR,{}))}function SR(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:r}=DY();if((0,lR.useEffect)(()=>iI("before-page-changed",t=>{let{newPage:r,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(r)return void a(Dj().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let r=new RegExp(e),a=Sk(t),o=Sk(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(Dj().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,l$.jsxs)("div",{className:cI()("-esm-patient-immunizations__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___gN2f4",{"-esm-patient-immunizations__workspace-windows-and-menu-module__overlay___fqI+X":a.overlay,"-esm-patient-immunizations__workspace-windows-and-menu-module__hasMaximizedWindow___J7wBw":o}),children:[(0,l$.jsx)("div",{className:"-esm-patient-immunizations__workspace-windows-and-menu-module__workspaceWindowsContainer___zpk7G",children:t.map(t=>(0,l$.jsx)(ST,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,l$.jsx)(SC,{workspaceGroup:a,groupProps:e.props})]})}function ST({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:r}=e,a=(0,lR.useMemo)(()=>({closeWorkspace(e){lf.setState(t=>DZ.closeWorkspace(t,e))},openChildWorkspace(e,t,n){lf.setState(r=>DZ.openChildWorkspace(r,e,t,n))},setWorkspaceTitle(e,t){lf.setState(n=>DZ.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){lf.setState(n=>DZ.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=lf.getState().openedWindows.find(e=>e.windowName===r);return t?Dz(t,e):Promise.resolve(!0)}}),[r]);return(0,l$.jsx)(Sl,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:n})}function SO(e,t,n){if(null==e)return n;let r=bX(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let a=[];for(let e of t){let t=bX(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 S$(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function SN(e){return!!e&&e.constructor===Object}var SA=n(7229);function SI(e){let[t,n,r]=e.split(".");return`${t}.${n}.${r}`}function SM(e,t){return SA(function(e){let t=e.indexOf("-");if(t>=0){let n=SI(e.slice(0,t)),r=e.slice(t+1);return`${n}-${r}`}return SI(e)}(t),e,{includePrerelease:!0})}async function Sj(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 SL(a(i)),await e()}catch(e){o?.(e,i),n=e}while(r(i++));throw n}async function SL(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function SF(e,t,n,r){}function SB(e){}function SV(e){return Promise.resolve([])}function SU(e){return Promise.resolve([])}function Sz(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 SW(e){return()=>{}}function SH(){return!0}},9271(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(1758);let a=function(e,t,n){"__proto__"==t&&r.A?(0,r.A)(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},670(e,t,n){"use strict";n.d(t,{A:()=>r});let r=function(e,t,n){for(var r=-1,a=Object(e),o=n(e),i=o.length;i--;){var s=o[++r];if(!1===t(a[s],s,a))break}return e}},1758(e,t,n){"use strict";n.d(t,{A:()=>a});var r=n(1982);let a=function(){try{var e=(0,r.A)(Object,"defineProperty");return e({},"",{}),e}catch(e){}}()},4501(e,t,n){"use strict";n.d(t,{A:()=>r});let r=function(e){return void 0===e}}}]);
|