@openmrs/esm-form-builder-app 3.6.1-pre.3916 → 3.6.1-pre.3918

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/1850.js CHANGED
@@ -12,7 +12,7 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
12
12
  ${t}`)}return n}let tG=(e,t)=>{let r=structuredClone(t);if(!e)return r;for(let t of Object.keys(e)){let n=r[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){r.hasOwnProperty(t)||(r[t]=a._default);let e=a._elements;if(n&&tY(e)){if(a._type===tr.Array&&Array.isArray(n)){let a=n.map(t=>tG(e,t));r[t]=a}else if(a._type===tr.Object)for(let t of Object.keys(n))n[t]=tG(e,n[t])}}else if(tq(a)){let e=n??{};tq(e)&&(r[t]=tG(a,e))}}return r};function tY(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function tq(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function tJ(e,t){let r=`${e}:::${t}`;tS.has(r)||(console.error(t),tS.add(r))}let tQ={"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:tr.Object,_default:{},_validators:[tn(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(", ")}.`})]}},tX={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:tr.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:tr.String,_default:void 0}},...tQ},t0=(e,t)=>tn(r=>e<=r&&r<=t,`must be between ${e} and ${t}`),t1=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return tn(e=>{if(!e||"string"!=typeof e)return!1;let r=/\${(.*?)}/g,n=r.exec(e);for(;n;){if(!t.includes(n[1]))return!1;n=r.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},t4=t1([]),t2=e=>tn(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),t3={inRange:t0,isUrl:t4,isUrlWithTemplateParameters:t1,oneOf:t2};var t6=r(48067);let t5=L("breadcrumbs",[]);function t9(e){return t8([e])}function t8(e){let t=[...t7(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,t6.pathToRegexp)(e.matcher).regexp:(0,t6.pathToRegexp)(e.path).regexp,settings:e}))];t5.setState(t,!0)}function t7(){return t5.getState()}function re(e,t){if(t)return function(e,t){let[r]=e.filter(e=>e.matcher.test(t));return r}(e,t)||function(e,t){let r=t.split("/");for(;r.length>1;){r.pop();let t=re(e,r.join("/"));if(t)return t}}(e,t)}function rt(e,t){if(e.length>0){let r=re(e,t);if(r){let t=[r],n=re(e,r.settings.parent);for(;void 0!==n;)t.push(n),n=re(e,n.settings.parent);return t.reverse()}}return[]}function rr(e){return rt(t7(),e)}var rn=Object.freeze({__proto__:null,get start(){return nk},get ensureJQuerySupport(){return nr},get setBootstrapMaxTime(){return rZ},get setMountMaxTime(){return rG},get setUnmountMaxTime(){return rY},get setUnloadMaxTime(){return rq},get registerApplication(){return np},get unregisterApplication(){return nh},get getMountedApps(){return nu},get getAppStatus(){return nd},get unloadApplication(){return ng},get checkActivityFunctions(){return nf},get getAppNames(){return nc},get pathToActiveWhen(){return nb},get navigateToUrl(){return r2},get patchHistoryApi(){return r7},get triggerAppChange(){return nE},get addErrorHandler(){return rl},get removeErrorHandler(){return ru},get mountRootParcel(){return rU},get NOT_LOADED(){return rm},get LOADING_SOURCE_CODE(){return rp},get NOT_BOOTSTRAPPED(){return rf},get BOOTSTRAPPING(){return rh},get NOT_MOUNTED(){return rg},get MOUNTING(){return ry},get UPDATING(){return rb},get LOAD_ERROR(){return rD},get MOUNTED(){return rv},get UNLOADING(){return rx},get UNMOUNTING(){return rw},get SKIP_BECAUSE_BROKEN(){return rE}}),ra=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,ro=!function(){try{var e=new ra("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 r=document.createEvent("CustomEvent");return t?r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):r.initCustomEvent(e,!1,!1,void 0),r}:function(e,t){var r=document.createEventObject();return r.type=e,t?(r.bubbles=!!t.bubbles,r.cancelable=!!t.cancelable,r.detail=t.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r}:ra;let ri=[];function rs(e,t,r){let n=rd(e,t,r);ri.length?ri.forEach(e=>e(n)):setTimeout(()=>{throw n})}function rl(e){if("function"!=typeof e)throw Error(rc(28,!1));ri.push(e)}function ru(e){if("function"!=typeof e)throw Error(rc(29,!1));let t=!1;return ri=ri.filter(r=>{let n=r===e;return t=t||n,!n}),t}function rc(e,t,...r){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${r.length?`&arg=${r.join("&arg=")}`:""}`}function rd(e,t,r){let n,a=`${rP(t)} '${rS(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=a+e.message}catch(e){}n=e}else{console.warn(rc(30,!1,t.status,rS(t)));try{n=Error(a+JSON.stringify(e))}catch(t){n=e}}return n.appOrParcelName=rS(t),t.status=r,n}let rm="NOT_LOADED",rp="LOADING_SOURCE_CODE",rf="NOT_BOOTSTRAPPED",rh="BOOTSTRAPPING",rg="NOT_MOUNTED",ry="MOUNTING",rv="MOUNTED",rb="UPDATING",rw="UNMOUNTING",rx="UNLOADING",rD="LOAD_ERROR",rE="SKIP_BECAUSE_BROKEN";function r_(e){return e.status===rv}function rC(e){try{return e.activeWhen(window.location)}catch(t){return rs(t,e,rE),!1}}function rS(e){return e.name}function rk(e){return!!e.unmountThisParcel}function rP(e){return rk(e)?"parcel":"application"}function rT(){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 rR(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r];return null}function rO(e){return e&&("function"==typeof e||Array.isArray(e)&&!rR(e,e=>"function"!=typeof e))}function rN(e,t){let r=e[t]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[()=>Promise.resolve()]);let n=rP(e),a=rS(e);return function(e){return r.reduce((r,o,i)=>r.then(()=>{let r=o(e);return r$(r)?r:Promise.reject(rc(15,!1,n,a,t,i))}),Promise.resolve())}}function r$(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let rM=[];function rA(e,t){return Promise.resolve().then(()=>e.status!==rf?e:(e.status=rh,e.bootstrap?rJ(e,"bootstrap").then(r).catch(r=>{if(t)throw rd(r,e,rE);return rs(r,e,rE),e}):Promise.resolve().then(r)));function r(){return e.status=rg,e}}function rj(e,t){return Promise.resolve().then(()=>{if(e.status!==rv)return e;return e.status=rw,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(r,n=>r().then(()=>{let r=Error(n.message);if(t)throw rd(r,e,rE);rs(r,e,rE)})).then(()=>e);function r(){return rJ(e,"unmount").then(()=>{e.status=rg},r=>{if(t)throw rd(r,e,rE);rs(r,e,rE)})}})}let rI=!1,rL=!1;function rF(e,t){return Promise.resolve().then(()=>e.status!==rg?e:(rI||(window.dispatchEvent(new ro("single-spa:before-first-mount")),rI=!0),e.status=ry,rJ(e,"mount").then(()=>(e.status=rv,rL||(window.dispatchEvent(new ro("single-spa:first-mount")),rL=!0),e)).catch(r=>{return e.status=rv,rj(e,!0).then(n,n);function n(){if(t)throw rd(r,e,rE);return rs(r,e,rE),e}})))}let rB=0,rV={parcels:{}};function rU(){return rW.apply(rV,arguments)}function rW(e,t){let r,n,a,o=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(rc(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(rc(3,!1,typeof e.name));let i=rB++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(rc(4,!1,s,typeof t));if(!t.domElement)throw Error(rc(5,!1,s));let l="function"==typeof e,u=l?e:()=>Promise.resolve(e),c={id:i,parcels:{},status:l?rp:rf,customProps:t,parentName:rS(o),unmountThisParcel:()=>p.then(()=>{if(c.status!==rv)throw Error(rc(6,!1,s,c.status));return rj(c,!0)}).then(e=>(c.parentName&&delete o.parcels[c.id],e)).then(e=>(n(e),e)).catch(e=>{throw c.status=rE,a(e),e})};o.parcels[i]=c;let d=u();if(!d||"function"!=typeof d.then)throw Error(rc(7,!1));let m=(d=d.then(e=>{if(!e)throw Error(rc(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!rO(e.bootstrap))throw Error(rc(9,!1,s));if(!rO(e.mount))throw Error(rc(10,!1,s));if(!rO(e.unmount))throw Error(rc(11,!1,s));if(e.update&&!rO(e.update))throw Error(rc(12,!1,s));let t=rN(e,"bootstrap"),n=rN(e,"mount"),a=rN(e,"unmount");c.status=rf,c.name=s,c.bootstrap=t,c.mount=n,c.unmount=a,c.timeouts=rQ(e.timeouts),e.update&&(c.update=rN(e,"update"),r.update=function(e){return c.customProps=e,rH(Promise.resolve().then(()=>{if(c.status!==rv)throw Error(rc(32,!1,rS(c)));return c.status=rb,rJ(c,"update").then(()=>(c.status=rv,c)).catch(e=>{throw rd(e,c,rE)})}))})})).then(()=>rA(c,!0)),p=m.then(()=>rF(c,!0)),f=new Promise((e,t)=>{n=e,a=t});return r={mount:()=>rH(Promise.resolve().then(()=>{if(c.status!==rg)throw Error(rc(13,!1,s,c.status));return o.parcels[i]=c,rF(c)})),unmount:()=>rH(c.unmountThisParcel()),getStatus:()=>c.status,loadPromise:rH(d),bootstrapPromise:rH(m),mountPromise:rH(p),unmountPromise:rH(f)}}function rH(e){return e.then(()=>null)}function rz(e){let t=rS(e),r="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(rc(40,!1),t,r));let n=rT({},r,{name:t,mountParcel:rW.bind(e),singleSpa:rn});return rk(e)&&(n.unmountSelf=e.unmountThisParcel),n}let rK={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 rZ(e,t,r){if("number"!=typeof e||e<=0)throw Error(rc(16,!1));rK.bootstrap={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function rG(e,t,r){if("number"!=typeof e||e<=0)throw Error(rc(17,!1));rK.mount={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function rY(e,t,r){if("number"!=typeof e||e<=0)throw Error(rc(18,!1));rK.unmount={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function rq(e,t,r){if("number"!=typeof e||e<=0)throw Error(rc(19,!1));rK.unload={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function rJ(e,t){let r=e.timeouts[t],n=r.warningMillis,a=rP(e);return new Promise((o,i)=>{let s=!1,l=!1;e[t](rz(e)).then(e=>{s=!0,o(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>c(1),n),setTimeout(()=>c(!0),r.millis);let u=rc(31,!1,t,a,rS(e),r.millis);function c(e){s||(!0===e?(l=!0,r.dieOnTimeout?i(Error(u)):console.error(u)):!l&&(console.warn(u),e*n+n<r.millis&&setTimeout(()=>c(e+1),n)))}})}function rQ(e){let t={};for(let r in rK)t[r]=rT({},rK[r],e&&e[r]||{});return t}function rX(e){return Promise.resolve().then(()=>{let t,r;return e.loadPromise?e.loadPromise:e.status!==rm&&e.status!==rD?e:(e.status=rp,e.loadPromise=Promise.resolve().then(()=>{let n=e.loadApp(rz(e));if(!r$(n))throw r=!0,Error(rc(33,!1,rS(e)));return n.then(r=>{let n;e.loadErrorTime=null,"object"!=typeof(t=r)&&(n=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!rO(t.bootstrap)&&(n=35),rO(t.mount)||(n=36),rO(t.unmount)||(n=37);let a=rP(t);if(n){let r;try{r=JSON.stringify(t)}catch(e){}return console.error(rc(n,!1,a,rS(e),r),t),rs(void 0,e,rE),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=rT({},e.devtools.overlays,t.devtools.overlays)),e.status=rf,e.bootstrap=rN(t,"bootstrap"),e.mount=rN(t,"mount"),e.unmount=rN(t,"unmount"),e.unload=rN(t,"unload"),e.timeouts=rQ(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let n;return delete e.loadPromise,r?n=rE:(n=rD,e.loadErrorTime=(new Date).getTime()),rs(t,e,n),e}))})}let r0="u">typeof window,r1={hashchange:[],popstate:[]},r4=["hashchange","popstate"];function r2(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(rc(14,!1));t=e.currentTarget.href,e.preventDefault()}let r=ne(window.location.href),n=ne(t);0===t.indexOf("#")?window.location.hash=n.hash:r.host!==n.host&&n.host?window.location.href=t:n.pathname===r.pathname&&n.search===r.search?window.location.hash=n.hash:window.history.pushState(null,null,t)}function r3(e){if(e){let t=e[0].type;r4.indexOf(t)>=0&&r1[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function r6(){n_([],arguments)}function r5(e,t){return function(){let r=window.location.href,n=e.apply(this,arguments),o=window.location.href;return a&&r===o||window.dispatchEvent(function(e,t){let r;try{r=new PopStateEvent("popstate",{state:e})}catch(t){(r=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return r.singleSpa=!0,r.singleSpaTrigger=t,r}(window.history.state,t)),n}}let r9=null,r8=!1;function r7(e){if(r8)throw Error(rc(43,!1));a=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,r8=!0,r9=window.history.replaceState,window.addEventListener("hashchange",r6),window.addEventListener("popstate",r6);let t=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(e,r){if(!("function"==typeof r&&r4.indexOf(e)>=0)||rR(r1[e],e=>e===r))return t.apply(this,arguments);r1[e].push(r)},window.removeEventListener=function(e,t){return"function"==typeof t&&r4.indexOf(e)>=0&&(r1[e]=r1[e].filter(e=>e!==t)),r.apply(this,arguments)},window.history.pushState=r5(window.history.pushState,"pushState"),window.history.replaceState=r5(r9,"replaceState")}function ne(e){let t=document.createElement("a");return t.href=e,t}r0&&(window.singleSpaNavigate?console.warn(rc(41,!1)):window.singleSpaNavigate=r2);let nt=!1;function nr(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!nt){let t=e.fn.on,r=e.fn.off;e.fn.on=function(e,r){return nn.call(this,t,window.addEventListener,e,r,arguments)},e.fn.off=function(e,t){return nn.call(this,r,window.removeEventListener,e,t,arguments)},nt=!0}}function nn(e,t,r,n,a){return"string"!=typeof r?e.apply(this,a):(r.split(/\s+/).forEach(e=>{r4.indexOf(e)>=0&&(t(e,n),r=r.replace(e,""))}),""===r.trim()?this:e.apply(this,a))}let na={};function no(e){return Promise.resolve().then(()=>{let t=na[rS(e)];if(!t)return e;if(e.status===rm)return ni(e,t),e;if(e.status===rx)return t.promise.then(()=>e);if(e.status!==rg&&e.status!==rD)return e;let r=e.status===rD?Promise.resolve():rJ(e,"unload");return e.status=rx,r.then(()=>(ni(e,t),e)).catch(r=>(delete na[rS(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,rs(r,e,rE),t.reject(r),e))})}function ni(e,t){delete na[rS(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=rm,t.resolve()}function ns(e,t,r,n){na[rS(e)]={app:e,resolve:r,reject:n},Object.defineProperty(na[rS(e)],"promise",{get:t})}let nl=[];function nu(){return nl.filter(r_).map(rS)}function nc(){return nl.map(rS)}function nd(e){let t=rR(nl,t=>rS(t)===e);return t?t.status:null}let nm=!1;function np(e,t,r,n){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(rc(39,!1));let t=["name","app","activeWhen","customProps"],r=Object.keys(e).reduce((e,r)=>t.indexOf(r)>=0?e:e.concat(r),[]);if(0!==r.length)throw Error(rc(38,!1,t.join(", "),r.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(rc(20,!1));let n=e=>"string"==typeof e||"function"==typeof e;if(!(n(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(n)))throw Error(rc(24,!1));if(!nv(e.customProps))throw Error(rc(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,r,n){if("string"!=typeof e||0===e.length)throw Error(rc(20,!1));if(!t)throw Error(rc(23,!1));if("function"!=typeof r)throw Error(rc(24,!1));if(!nv(n))throw Error(rc(22,!1))}(e,t,r,n),i.name=e,i.loadApp=t,i.activeWhen=r,i.customProps=n),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:nb(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(nS||nm||(nm=!0,setTimeout(()=>{nS||console.warn(rc(1,!1))},5e3)),-1!==nc().indexOf(l.name))throw Error(rc(21,!1,l.name));nl.push(rT({loadErrorTime:null,status:rm,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),r0&&(nr(),n_())}function nf(e=window.location){return nl.filter(t=>t.activeWhen(e)).map(rS)}function nh(e){if(0===nl.filter(t=>rS(t)===e).length)throw Error(rc(25,!1,e));return(r0?ng(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=nl.map(rS).indexOf(e);nl.splice(t,1)})}function ng(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(rc(26,!1));let r=rR(nl,t=>rS(t)===e);if(!r)throw Error(rc(27,!1,e));let n=na[rS(r)];if(t&&t.waitForUnmount){if(n)return n.promise;{let e=new Promise((t,n)=>{ns(r,()=>e,t,n)});return e}}{let e;return n?(e=n.promise,ny(r,n.resolve,n.reject)):e=new Promise((t,n)=>{ns(r,()=>e,t,n),ny(r,t,n)}),e}}function ny(e,t,r){Promise.resolve().then(()=>{if(rR(nf(),t=>t===rS(e)))return nE()}).then(()=>rj(e).then(no).then(()=>{t(),setTimeout(()=>{n_()})})).catch(r)}function nv(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function nb(e,t){let r=function(e,t){let r=0,n=!1,a="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let r=e[t],a=n&&"/"===r;(!n&&":"===r||a)&&o(t)}return o(e.length),RegExp(a,"i");function o(o){let i=e.slice(r,o).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(a+=n?"[^/]+/?":i,o===e.length)if(n)t&&(a+="$");else{let e=t?"":".*";a="/"===a.charAt(a.length-1)?`${a}${e}$`:`${a}(/${e})?(#.*)?$`}n=!n,r=o}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let n=e.href.replace(t,"").replace(e.search,"").split("?")[0];return r.test(n)}}let nw=!1,nx=[],nD=r0&&window.location.href;function nE(){return n_()}function n_(e=[],t,r=!1){let n,a,o,i,s;if(nw)return new Promise((e,r)=>{nx.push({resolve:e,reject:r,eventArguments:t})});let{appsToUnload:l,appsToUnmount:u,appsToLoad:c,appsToMount:d}=(n=[],a=[],o=[],i=[],s=(new Date).getTime(),nl.forEach(e=>{let t=e.status!==rE&&rC(e);switch(e.status){case rD:t&&s-e.loadErrorTime>=200&&o.push(e);break;case rm:case rp:t&&o.push(e);break;case rf:case rg:!t&&na[rS(e)]?n.push(e):t&&i.push(e);break;case rv:t||a.push(e)}}),{appsToUnload:n,appsToUnmount:a,appsToLoad:o,appsToMount:i}),m,p=[],f=nD,h=nD=window.location.href;return nS?(nw=!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(r=>{if(r.some(e=>e))return r9.call(window.history,history.state,"",f.substring(location.origin.length)),nD=location.href,nw=!1,n_(e,t,!0);let n=l.map(no),a=Promise.all(u.map(rj).map(e=>e.then(no)).concat(n));a.then(()=>{w("before-mount-routing-event",b(!0))},e=>{throw e});let o=c.map(e=>rX(e).then(e=>nC(e,a))),i=d.filter(e=>0>c.indexOf(e)).map(e=>nC(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(rX)).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(rc(42,!1))),console.warn(e),!1)))}function y(){let t=nu();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(nw=!1,nx.length>0){let e=nx;nx=[],n_(e)}return t}function v(){r||(e.forEach(e=>{r3(e.eventArguments)}),r3(t))}function b(e=!1,r){let n={},a={[rv]:[],[rg]:[],[rm]:[],[rE]:[]};e?(c.concat(d).forEach((e,t)=>{i(e,rv)}),l.forEach(e=>{i(e,rm)}),u.forEach(e=>{i(e,rg)})):m.forEach(e=>{i(e)});let o={detail:{newAppStatuses:n,appsByNewStatus:a,totalAppChanges:m.length,originalEvent:null==t?void 0:t[0],oldUrl:f,newUrl:h}};return r&&rT(o.detail,r),o;function i(e,t){let r=rS(e);t=t||nd(r),n[r]=t,(a[t]=a[t]||[]).push(r)}}function w(e,t){r||window.dispatchEvent(new ro(`single-spa:${e}`,t))}}function nC(e,t){return rC(e)?rA(e).then(e=>t.then(()=>rC(e)?rF(e):e)):t.then(()=>e)}let nS=!1;function nk(e){nS=!0,r0&&(r7(e),n_())}r0&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...nl]},reroute:n_,NOT_LOADED:rm,toLoadPromise:rX,toBootstrapPromise:rA,unregisterApplication:nh,getProfilerData:function(){return rM}});let nP={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"},nT=e=>"string"==typeof e,nR=()=>{let e,t,r=new Promise((r,n)=>{e=r,t=n});return r.resolve=e,r.reject=t,r},nO=e=>null==e?"":""+e,nN=/###/g,n$=e=>e&&e.indexOf("###")>-1?e.replace(nN,"."):e,nM=e=>!e||nT(e),nA=(e,t,r)=>{let n=nT(t)?t.split("."):t,a=0;for(;a<n.length-1;){if(nM(e))return{};let t=n$(n[a]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return nM(e)?{}:{obj:e,k:n$(n[a])}},nj=(e,t,r)=>{let{obj:n,k:a}=nA(e,t,Object);if(void 0!==n||1===t.length){n[a]=r;return}let o=t[t.length-1],i=t.slice(0,t.length-1),s=nA(e,i,Object);for(;void 0===s.obj&&i.length;)o=`${i[i.length-1]}.${o}`,s=nA(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}`]=r},nI=(e,t)=>{let{obj:r,k:n}=nA(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},nL=(e,t,r)=>{for(let n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?nT(e[n])||e[n]instanceof String||nT(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):nL(e[n],t[n],r):e[n]=t[n]);return e};var nF={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let nB=e=>nT(e)?e.replace(/[&<>"'\/]/g,e=>nF[e]):e,nV=[" ",",","?","!",";"],nU=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 r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}(20),nW=(e,t,r=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}let n=t.split(r),a=e;for(let e=0;e<n.length;){let t;if(!a||"object"!=typeof a)return;let o="";for(let i=e;i<n.length;++i)if(i!==e&&(o+=r),o+=n[i],void 0!==(t=a[o])){if(["string","number","boolean"].indexOf(typeof t)>-1&&i<n.length-1)continue;e+=i-e+1;break}a=t}return a},nH=e=>e?.replace("_","-"),nz={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 nK{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||nz,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,r,n){return n&&!this.debug?null:(nT(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new nK(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new nK(this.logger,e)}}var nZ=new nK;class nG{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let r=this.observers[e].get(t)||0;this.observers[e].set(t,r+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,r])=>{for(let n=0;n<r;n++)e(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([r,n])=>{for(let a=0;a<n;a++)r.apply(r,[e,...t])})}}class nY extends nG{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,r,n={}){let a,o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,i=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],r&&(Array.isArray(r)?a.push(...r):nT(r)&&o?a.push(...r.split(o)):a.push(r)));let s=nI(this.data,a);return(!s&&!t&&!r&&e.indexOf(".")>-1&&(e=a[0],t=a[1],r=a.slice(2).join(".")),!s&&i&&nT(r))?nW(this.data?.[e]?.[t],r,o):s}addResource(e,t,r,n,a={silent:!1}){let o=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,i=[e,t];r&&(i=i.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(i=e.split("."),n=t,t=i[1]),this.addNamespaces(t),nj(this.data,i,n),a.silent||this.emit("added",e,t,r,n)}addResources(e,t,r,n={silent:!1}){for(let n in r)(nT(r[n])||Array.isArray(r[n]))&&this.addResource(e,t,n,r[n],{silent:!0});n.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,n,a,o={silent:!1,skipCopy:!1}){let i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),n=r,r=t,t=i[1]),this.addNamespaces(t);let s=nI(this.data,i)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?nL(s,r,a):s={...s,...r},nj(this.data,i,s),o.silent||this.emit("added",e,t,r)}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 nq={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,a){return e.forEach(e=>{t=this.processors[e]?.process(t,r,n,a)??t}),t}};let nJ=Symbol("i18next/PATH_KEY");function nQ(e,t){let r,n,a,{[nJ]:o}=e((n=[],(a=Object.create(null)).get=(e,t)=>(r?.revoke?.(),t===nJ)?n:(n.push(t),(r=Proxy.revocable(e,a)).proxy),Proxy.revocable(Object.create(null),a).proxy));return o.join(t?.keySeparator??".")}let nX={},n0=e=>!nT(e)&&"boolean"!=typeof e&&"number"!=typeof e;class n1 extends nG{constructor(e,t={}){super(),((e,t,r)=>{e.forEach(e=>{t[e]&&(r[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=nZ.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let r={...t};if(null==e)return!1;let n=this.resolve(e,r);if(n?.res===void 0)return!1;let a=n0(n.res);return!1!==r.returnObjects||!a}extractFromKey(e,t){let r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");let n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=t.ns||this.options.defaultNS||[],o=r&&e.indexOf(r)>-1,i=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!((e,t,r)=>{t=t||"",r=r||"";let n=nV.filter(e=>0>t.indexOf(e)&&0>r.indexOf(e));if(0===n.length)return!0;let a=nU.getRegExp(`(${n.map(e=>"?"===e?"\\?":e).join("|")})`),o=!a.test(e);if(!o){let t=e.indexOf(r);t>0&&!a.test(e.substring(0,t))&&(o=!0)}return o})(e,r,n);if(o&&!i){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:nT(a)?[a]:a};let o=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(n)}return{key:e,namespaces:nT(a)?[a]:a}}translate(e,t,r){let n="object"==typeof t?{...t}:t;if("object"!=typeof n&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof n&&(n={...n}),n||(n={}),null==e)return"";"function"==typeof e&&(e=nQ(e,{...this.options,...n})),Array.isArray(e)||(e=[String(e)]);let a=void 0!==n.returnDetails?n.returnDetails:this.options.returnDetails,o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,{key:i,namespaces:s}=this.extractFromKey(e[e.length-1],n),l=s[s.length-1],u=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===u&&(u=":");let c=n.lng||this.language,d=n.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(n)}:`${l}${u}${i}`:a?{res:i,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:i;let m=this.resolve(e,n),p=m?.res,f=m?.usedKey||i,h=m?.exactUsedKey||i,g=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,v=void 0!==n.count&&!nT(n.count),b=n1.hasDefaultValue(n),w=v?this.pluralResolver.getSuffix(c,n.count,n):"",x=n.ordinal&&v?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",D=v&&!n.ordinal&&0===n.count,E=D&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${w}`]||n[`defaultValue${x}`]||n.defaultValue,_=p;y&&!p&&b&&(_=E);let C=n0(_),S=Object.prototype.toString.apply(_);if(y&&_&&C&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(S)&&!(nT(g)&&Array.isArray(_))){if(!n.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,_,{...n,ns:s}):`key '${i} (${this.language})' returned an object instead of string.`;return a?(m.res=e,m.usedParams=this.getUsedParamsDetails(n),m):e}if(o){let e=Array.isArray(_),t=e?[]:{},r=e?h:f;for(let e in _)if(Object.prototype.hasOwnProperty.call(_,e)){let a=`${r}${o}${e}`;b&&!p?t[e]=this.translate(a,{...n,defaultValue:n0(E)?E[e]:void 0,...{joinArrays:!1,ns:s}}):t[e]=this.translate(a,{...n,joinArrays:!1,ns:s}),t[e]===a&&(t[e]=_[e])}p=t}}else if(y&&nT(g)&&Array.isArray(p))(p=p.join(g))&&(p=this.extendTranslation(p,e,n,r));else{let t=!1,a=!1;!this.isValidLookup(p)&&b&&(t=!0,p=E),this.isValidLookup(p)||(a=!0,p=i);let s=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:p,d=b&&E!==p&&this.options.updateMissing;if(a||t||d){if(this.logger.log(d?"updateKey":"missingKey",c,l,i,d?E:p),o){let e=this.resolve(i,{...n,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,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let r=0;r<t.length;r++)e.push(t[r]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(n.lng||this.language):e.push(n.lng||this.language);let r=(e,t,r)=>{let a=b&&r!==p?r:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,a,d,n):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,a,d,n),this.emit("missingKey",e,l,t,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,n);D&&n[`defaultValue${this.options.pluralSeparator}zero`]&&0>t.indexOf(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{r([e],i+t,n[`defaultValue${t}`]||E)})}):r(e,i,E))}p=this.extendTranslation(p,e,n,m,r),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,n))}return a?(m.res=p,m.usedParams=this.getUsedParamsDetails(n),m):p}extendTranslation(e,t,r,n,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){let o;r.interpolation&&this.interpolator.init({...r,...{interpolation:{...this.options.interpolation,...r.interpolation}}});let i=nT(e)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(i){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=r.replace&&!nT(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,r.lng||this.language||n.usedLng,r),i){let t=e.match(this.interpolator.nestingRegexp);o<(t&&t.length)&&(r.nest=!1)}!r.lng&&n&&n.res&&(r.lng=this.language||n.usedLng),!1!==r.nest&&(e=this.interpolator.nest(e,(...e)=>a?.[0]!==e[0]||r.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),r)),r.interpolation&&this.interpolator.reset()}let o=r.postProcess||this.options.postProcess,i=nT(o)?[o]:o;return null!=e&&i?.length&&!1!==r.applyPostProcessor&&(e=nq.handle(i,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,t={}){let r,n,a,o,i;return nT(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(r))return;let s=this.extractFromKey(e,t),l=s.key;n=l;let u=s.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let c=void 0!==t.count&&!nT(t.count),d=c&&!t.ordinal&&0===t.count,m=void 0!==t.context&&(nT(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(r)||(i=e,!nX[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(i)&&(nX[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${n}" 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(n=>{let i;if(this.isValidLookup(r))return;o=n;let s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,n,e,t);else{let e;c&&(e=this.pluralResolver.getSuffix(n,t.count,t));let r=`${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+r)),m){let n=`${l}${this.options.contextSeparator||"_"}${t.context}`;s.push(n),c&&(t.ordinal&&0===e.indexOf(a)&&s.push(n+e.replace(a,this.options.pluralSeparator)),s.push(n+e),d&&s.push(n+r))}}for(;i=s.pop();)this.isValidLookup(r)||(a=i,r=this.getResource(n,e,i,t))}))})}),{res:r,usedKey:n,exactUsedKey:a,usedLng:o,usedNS:i}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,t,r,n={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}getUsedParamsDetails(e={}){let t=e.replace&&!nT(e.replace),r=t?e.replace:e;if(t&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!t)for(let e of(r={...r},["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"]))delete r[e];return r}static hasDefaultValue(e){let t="defaultValue";for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,t.length)&&void 0!==e[r])return!0;return!1}}class n4{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=nZ.create("languageUtils")}getScriptPartFromCode(e){if(!(e=nH(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=nH(e))||0>e.indexOf("-"))return e;let t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(nT(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 r=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let r=this.getScriptPartFromCode(e);if(this.isSupportedCode(r))return t=r;let n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>{if(e===n||!(0>e.indexOf("-")&&0>n.indexOf("-"))&&(e.indexOf("-")>0&&0>n.indexOf("-")&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.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)),nT(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){let r=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),n=[],a=e=>{e&&(this.isSupportedCode(e)?n.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return nT(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))):nT(e)&&a(this.formatLanguageCode(e)),r.forEach(e=>{0>n.indexOf(e)&&a(this.formatLanguageCode(e))}),n}}let n2={zero:0,one:1,two:2,few:3,many:4,other:5},n3={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class n6{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=nZ.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let r,n=nH("dev"===e?"en":e),a=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];try{r=new Intl.PluralRules(n,{type:a})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),n3;if(!e.match(/-|_/))return n3;let n=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(n,t)}return this.pluralRulesCache[o]=r,r}needsPlural(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,r={}){return this.getSuffixes(e,r).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let r=this.getRule(e,t);return(r||(r=this.getRule("dev",t)),r)?r.resolvedOptions().pluralCategories.sort((e,t)=>n2[e]-n2[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,r={}){let n=this.getRule(e,r);return n?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,r))}}let n5=(e,t,r,n=".",a=!0)=>{let o,i=void 0!==(o=nI(e,r))?o:nI(t,r);return!i&&a&&nT(r)&&void 0===(i=nW(e,r,n))&&(i=nW(t,r,n)),i};class n9{constructor(e={}){this.logger=nZ.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:r,useRawValueToEscape:n,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:nB,this.escapeValue=void 0===r||r,this.useRawValueToEscape=void 0!==n&&n,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,r,n){let a,o,i,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(0>e.indexOf(this.formatSeparator)){let a=n5(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(a,void 0,r,{...n,...t,interpolationkey:e}):a}let a=e.split(this.formatSeparator),o=a.shift().trim(),i=a.join(this.formatSeparator).trim();return this.format(n5(t,s,o,this.options.keySeparator,this.options.ignoreJSONStructure),i,r,{...n,...t,interpolationkey:o})};this.resetRegExp();let u=n?.missingInterpolationHandler||this.options.missingInterpolationHandler,c=n?.interpolation?.skipOnVariables!==void 0?n.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 r=a[1].trim();if(void 0===(o=l(r)))if("function"==typeof u){let t=u(e,a,n);o=nT(t)?t:""}else if(n&&Object.prototype.hasOwnProperty.call(n,r))o="";else if(c){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${r} for interpolating ${e}`),o="";else nT(o)||this.useRawValueToEscape||(o=nO(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,r={}){let n,a,o,i=(e,t)=>{let r=this.nestingOptionsSeparator;if(0>e.indexOf(r))return e;let n=e.split(RegExp(`${r}[ ]*{`)),a=`{${n[1]}`;e=n[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}${r}${a}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let s=[];(o=(o={...r}).replace&&!nT(o.replace)?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;let l=/{.*}/.test(n[1])?n[1].lastIndexOf("}")+1:n[1].indexOf(this.formatSeparator);if(-1!==l&&(s=n[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),n[1]=n[1].slice(0,l)),(a=t(i.call(this,n[1].trim(),o),o))&&n[0]===e&&!nT(a))return a;nT(a)||(a=nO(a)),a||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),a=""),s.length&&(a=s.reduce((e,t)=>this.format(e,t,r.lng,{...r,interpolationkey:n[1].trim()}),a.trim())),e=e.replace(n[0],a),this.regexp.lastIndex=0}return e}}let n8=e=>{let t={};return(r,n,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});let i=n+JSON.stringify(o),s=t[i];return s||(s=e(nH(n),a),t[i]=s),s(r)}},n7=e=>(t,r,n)=>e(nH(r),n)(t);class ae{constructor(e={}){this.logger=nZ.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";let r=t.cacheInBuiltFormats?n8:n7;this.formats={number:r((e,t)=>{let r=new Intl.NumberFormat(e,{...t});return e=>r.format(e)}),currency:r((e,t)=>{let r=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>r.format(e)}),datetime:r((e,t)=>{let r=new Intl.DateTimeFormat(e,{...t});return e=>r.format(e)}),relativetime:r((e,t)=>{let r=new Intl.RelativeTimeFormat(e,{...t});return e=>r.format(e,t.range||"day")}),list:r((e,t)=>{let r=new Intl.ListFormat(e,{...t});return e=>r.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=n8(t)}format(e,t,r,n={}){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(),r={};if(e.indexOf("(")>-1){let n=e.split("(");t=n[0].toLowerCase().trim();let a=n[1].substring(0,n[1].length-1);"currency"===t&&0>a.indexOf(":")?r.currency||(r.currency=a.trim()):"relativetime"===t&&0>a.indexOf(":")?r.range||(r.range=a.trim()):a.split(";").forEach(e=>{if(e){let[t,...n]=e.split(":"),a=n.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();r[o]||(r[o]=a),"false"===a&&(r[o]=!1),"true"===a&&(r[o]=!0),isNaN(a)||(r[o]=parseInt(a,10))}})}return{formatName:t,formatOptions:r}})(t);if(this.formats[a]){let t=e;try{let i=n?.formatParams?.[n.interpolationkey]||{},s=i.locale||i.lng||n.locale||n.lng||r;t=this.formats[a](e,s,{...o,...n,...i})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${a}`),e},e)}}class at extends nG{constructor(e,t,r,n={}){super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=n,this.logger=nZ.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,n.backend,n)}queueLoad(e,t,r,n){let a={},o={},i={},s={};return e.forEach(e=>{let n=!0;t.forEach(t=>{let i=`${e}|${t}`;!r.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,n=!1,void 0===o[i]&&(o[i]=!0),void 0===a[i]&&(a[i]=!0),void 0===s[t]&&(s[t]=!0)))}),n||(i[e]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(s)}}loaded(e,t,r){let n=e.split("|"),a=n[0],o=n[1];t&&this.emit("failedLoading",a,o,t),!t&&r&&this.store.addResourceBundle(a,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0);let i={};this.queue.forEach(r=>{((e,t,r,n)=>{let{obj:a,k:o}=nA(e,t,Object);a[o]=a[o]||[],a[o].push(r)})(r.loaded,[a],o),void 0!==r.pending[e]&&(delete r.pending[e],r.pendingCount--),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(e=>{i[e]||(i[e]={});let t=r.loaded[e];t.length&&t.forEach(t=>{void 0===i[e][t]&&(i[e][t]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(e=>!e.done)}read(e,t,r,n=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:r,tried:n,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&&n<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,r,n+1,2*a,o)},a):o(i,s)},s=this.backend[r].bind(this.backend);if(2===s.length){try{let r=s(e,t);r&&"function"==typeof r.then?r.then(e=>i(null,e)).catch(i):i(null,r)}catch(e){i(e)}return}return s(e,t,i)}prepareLoading(e,t,r={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();nT(e)&&(e=this.languageUtils.toResolveHierarchy(e)),nT(t)&&(t=[t]);let a=this.queueLoad(e,t,r,n);if(!a.toLoad.length)return a.pending.length||n(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e,t=""){let r=e.split("|"),n=r[0],a=r[1];this.read(n,a,"read",void 0,void 0,(r,o)=>{r&&this.logger.warn(`${t}loading namespace ${a} for language ${n} failed`,r),!r&&o&&this.logger.log(`${t}loaded namespace ${a} for language ${n}`,o),this.loaded(e,r,o)})}saveMissing(e,t,r,n,a,o={},i=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t))return void this.logger.warn(`did not save key "${r}" 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!=r&&""!==r){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,r,n,s):l(e,t,r,n))&&"function"==typeof a.then?a.then(e=>i(null,e)).catch(i):i(null,a)}catch(e){i(e)}else l(e,t,r,n,i,s)}e&&e[0]&&this.store.addResource(e[0],t,r,n)}}}let ar=()=>({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]),nT(e[1])&&(t.defaultValue=e[1]),nT(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){let r=e[3]||e[2];Object.keys(r).forEach(e=>{t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),an=e=>(nT(e.ns)&&(e.ns=[e.ns]),nT(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),nT(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),aa=()=>{};class ao extends nG{constructor(e={},t){if(super(),this.options=an(e),this.services={},this.logger=nZ,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&&(nT(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let r=ar();this.options={...r,...this.options,...an(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);let n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?nZ.init(n(this.modules.logger),this.options):nZ.init(null,this.options),e=this.modules.formatter?this.modules.formatter:ae;let t=new n4(this.options);this.store=new nY(this.options.resources,this.options);let a=this.services;a.logger=nZ,a.resourceStore=this.store,a.languageUtils=t,a.pluralResolver=new n6(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.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===r.interpolation.format)&&(a.formatter=n(e),a.formatter.init&&a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new n9(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new at(n(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(a.languageDetector=n(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=n(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new n1(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=aa),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=nR(),o=()=>{let e=(e,r)=>{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(r),t(e,r)};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=aa){let r=t,n=nT(e)?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(n?.toLowerCase()==="cimode"&&(!this.options.preload||0===this.options.preload.length))return r();let e=[],t=t=>{t&&"cimode"!==t&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&0>e.indexOf(t)&&e.push(t)})};n?t(n):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),r(e)})}else r(null)}reloadResources(e,t,r){let n=nR();return"function"==typeof e&&(r=e,e=void 0),"function"==typeof t&&(r=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),r||(r=aa),this.services.backendConnector.reload(e,t,e=>{n.resolve(),r(e)}),n}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&&nq.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 r=nR();this.emit("languageChanging",e);let n=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&&(n(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,r.resolve((...e)=>this.t(...e)),t&&t(a,(...e)=>this.t(...e))},o=t=>{e||t||!this.services.languageDetector||(t=[]);let r=nT(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(nT(t)?[t]:t);o&&(this.language||n(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()),r}getFixedT(e,t,r){let n=(e,t,...a)=>{let o,i;(o="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(a)):{...t}).lng=o.lng||n.lng,o.lngs=o.lngs||n.lngs,o.ns=o.ns||n.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||r||n.keyPrefix);let s=this.options.keySeparator||".";return o.keyPrefix&&Array.isArray(e)?i=e.map(e=>("function"==typeof e&&(e=nQ(e,{...this.options,...t})),`${o.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=nQ(e,{...this.options,...t})),i=o.keyPrefix?`${o.keyPrefix}${s}${e}`:e),this.t(i,o)};return nT(e)?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=r,n}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 r=t.lng||this.resolvedLanguage||this.languages[0],n=!!this.options&&this.options.fallbackLng,a=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;let o=(e,t)=>{let r=this.services.backendConnector.state[`${e}|${t}`];return -1===r||0===r||2===r};if(t.precheck){let e=t.precheck(this,o);if(void 0!==e)return e}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!n||o(a,e)))}loadNamespaces(e,t){let r=nR();return this.options.ns?(nT(e)&&(e=[e]),e.forEach(e=>{0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){let r=nR();nT(e)&&(e=[e]);let n=this.options.preload||[],a=e.filter(e=>0>n.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return a.length?(this.options.preload=n.concat(a),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(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 n4(ar());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 ao(e,t)}cloneInstance(e={},t=aa){let r=e.forkResourceStore;r&&delete e.forkResourceStore;let n={...this.options,...e,isClone:!0},a=new ao(n);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)},r&&(a.store=new nY(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((r,n)=>(r[n]={...e[t][n]},r),e[t]),e),{}),n),a.services.resourceStore=a.store),a.translator=new n1(a.services,n),a.translator.on("*",(e,...t)=>{a.emit(e,...t)}),a.init(n,t),a.translator.options=n,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 ai=ao.createInstance();ai.createInstance=ao.createInstance,ai.createInstance,ai.dir,ai.init,ai.loadResources,ai.reloadResources,ai.use,ai.changeLanguage,ai.getFixedT,ai.t,ai.exists,ai.setDefaultNamespace,ai.hasLoadedNamespace,ai.loadNamespaces,ai.loadLanguages;let as=ai.default||ai;function al(e,t,r,n){return as.t(t,{ns:e,defaultValue:r,...n})}function au(e,t,r){return nP[e]?al("core",e,t??nP[e],r):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function ac(e,t){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=ad(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:r,...t});return e.startsWith("//")?n:n.replace(/^\/\//,"/")}function ad(e,t){return Object.keys(t).reduce((e,r)=>e.split("${"+r+"}").join(t[r]),e)}function am({to:e,templateParams:t}){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=ac(e,t).replace(window.location.origin,""),a=new URL(n,window.location.origin);if("http:"!=a.protocol&&"https:"!=a.protocol)throw console.error(`Received request to navigate to non-http URL: ${a.toString()}`),Error(au("navigateNonHttp"));n.startsWith(r)?r2(n):window.location.assign(n)}as.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let ap="openmrs:history";function af(){return JSON.parse(sessionStorage.getItem(ap)??"[]")}function ah({toUrl:e}){let t=af(),r=t.lastIndexOf(e);if(-1!=r){let e=t.slice(0,r+1);am({to:t[r]}),sessionStorage.setItem(ap,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function ag(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}tr.Boolean,tr.String,t3.isUrl,tr.Array,tr.Number,t3.inRange(100,600),tr.Boolean,tr.Boolean;let ay="/ws/rest/v1",av="/ws/fhir2/R4",ab=`${ay}/session`;function aw(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function ax(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 r=aw(e);t.headers||(t.headers={}),es(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 n=!1;try{let e=new URL(r,window.location.href),t=new URL(aw(ay),window.location.href),a=e.pathname.replace(/\/{2,}/g,"/"),o=t.pathname.replace(/\/{2,}/g,"/");n=e.origin===t.origin&&(a===o||a.startsWith(`${o}/`))}catch{}if(n){let e=!1;for(let[r,n]of Object.entries(t.headers))"disable-www-authenticate"===r.toLowerCase()&&(void 0===n?delete t.headers[r]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(av)){let e=new URL(r,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),r=e.toString())}let a=Error();return window.fetch(r,t).then(async e=>{let{redirectAuthFailure:n,followRedirects:o}=await tj("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(o&&t&&(r===aw(ab)||204===e.status)&&am({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(r===aw(ab)&&403===e.status||n.enabled&&n.errors.includes(e.status))&&(sessionStorage.removeItem(ap),am({to:n.url||e.headers.get("location")||"${openmrsSpaBase}/login"}),!0!==t.rejectAuthFailure)?n.resolvePromise?Promise.resolve():new Promise(()=>{}):e.clone().text().then(t=>{let n=t;try{n=JSON.parse(t)}catch(e){}throw new aD(r,e,n,a)},()=>{throw new aD(r,e,null,a)})})}class aD extends Error{constructor(e,t,r,n){super(),ag(this,"response",void 0),ag(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`,n.message=this.message,this.responseBody=r,this.response=t,this.stack=`Stacktrace for outgoing request:
13
13
  ${n.stack}
14
14
  Stacktrace for incoming response:
15
- ${this.stack}`}}let aE=L("session",{loaded:!1,session:null}),a_=0,aC=null;function aS(){return aC||(aE.getState().loaded&&a_>=Date.now()-6e4?null:aR())}function ak(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=aS();return n?new Promise(e=>{let t=()=>{let t=aE.getState();t.loaded&&(a(),e(r(t.session)))},a=aE.subscribe(t);n.then(t,t)}):Promise.resolve(r(aE.getState().session))}function aP(){return aS(),aE}function aT(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 aR(e,t){a_=Date.now(),o??(o=a_);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=aI(ax(ab,{headers:r,rejectAuthFailure:!0})),a=()=>{aC===n&&(aC=null)};return n.then(a,a),aC=n,n}function aO(){aE.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function aN(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!W(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!W(n.privileges.find(t=>e===t.display))):(W(r)||console.error(`Could not understand privileges "${r}"`),!0))||!W(t.roles.find(e=>"System Developer"===e.display))}function a$(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(aE.getState()),e||(t=aE.subscribe(n))})}async function aM(){return(await ak()).sessionLocation}async function aA(e,t){return aI(ax(ab,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function aj(e,t,r){return r||(r=new AbortController),await ax(`${ay}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),aR()}function aI(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};aE.setState(r,!0),t(r)}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)?r(aL(Error("The session endpoint did not respond with a session"))):r(aL(Error("The server is still starting up"),!0))}).catch(e=>{var n,a,i;if((n=e)instanceof aD&&(401===n.response.status||403===n.response.status)){"object"==typeof(a=e.responseBody)&&null!==a&&!1===a.authenticated?aE.setState({loaded:!0,session:e.responseBody},!0):aO(),t(aE.getState());return}(i=e)instanceof aD&&502===i.response.status&&!aE.getState().loaded&&void 0!==o&&Date.now()-o<18e4?r(aL(e,!0)):(C(`Failed to fetch new session information: ${e}`),r(aL(e)))})})}function aL(e,t=!1){return aE.getState().loaded||aE.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),aE.getState()}function aF(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}aE.subscribe(e=>{e.loaded&&e.session&&aT(e.session)});let aB={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"},aV=N()(()=>({}));F("openmrs-app-context",aV);let aU={};function aW(e,t=aU){aV.setState(r=>{if(e in r)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({},r,{[e]:t===aU?{}:t})})}function aH(e){aV.setState(t=>(e in t&&delete t[e],t))}function az(e,t=e=>e){let r=aV.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function aK(e,t){aV.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function aZ(e,t){let r=az(e);return t(aG(r)),aV.subscribe(n=>{let a=e in n?n[e]:null;a!==r&&(r=a,t(aG(a)))})}function aG(e){return null===e?null:Object.freeze(Object.assign({},e))}let aY=null;async function aq(){return aY??(aY=aJ().then(({map:e,complete:t})=>(t||(aY=null),e))),aY}async function aJ(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];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){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:function(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}(t),complete:r}}async function aQ(){return await aq()}function aX(e){return e.replace(/[\/\-@]/g,"_")}async function a0(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([a1(e,n?.importMap),new Promise((t,r)=>{o=setTimeout(()=>{var t;r(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=aX(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(r.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 a1(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 r=aX(e);if(!window[r]){let r=t??await a4();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let a=e in{};try{return await function(e){var t;let r=(t=window)[a2]??(t[a2]=new Map),n=r.get(e);if(n)return n;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,n)=>{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(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&b({kind:"error",title:au("scriptLoadingFailed","Error: Script failed to load"),description:au("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:n}),actionButtonLabel:au("resetOverrides","Reset overrides"),onActionButtonClick(){console.warn("[Security] Import map overrides are disabled in production mode."),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function a4(){return aQ()}let a2=Symbol.for("__openmrs_script_loading"),a3=`${ay}/attachment`;function a6(e,t){return ax(`${a3}/${e}`,{signal:t.signal})}function a5(e,t,r,n){return ax(a9(e,t,n),{signal:r.signal})}function a9(e,t,r){return r?`${a3}?patient=${e}&encounter=${r}`:`${a3}?patient=${e}&includeEncounterless=${t}`}async function a8(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),ax(`${a3}`,{method:"POST",body:n})}function a7(e,t){return ax(`${a3}/${e}`,{method:"DELETE",signal:t.signal})}async function oe(e,t){return e?(await ax(`${av}/Patient/${e}`,t)).data:null}function ot(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}var or=((q={}).NEWVISIT="startVisit",q.EDITVISIT="editVisit",q.LOADING="loadingVisit",q),on=((J={}).NOTSTARTED="notStarted",J.ONGOING="ongoing",J);let oa="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))",oo=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function oi(){return B("visit",oo)}function os(e,t){oi().setState({patientUuid:e,manuallySetVisitUuid:t})}function ol(e,t){return ax(`${ay}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ou(e,t,r){return ax(`${ay}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function oc(e,t,r){return ax(`${ay}/visit?patient=${e}&v=${r??oa}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}function od(e){return{uuid:e.uuid,display:e.display,name:e.name}}oi().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});let om=`${ay}/visittype`;function op(e=om){return ax(e).then(e=>e.data.results.map(od))}function of(e){return{uuid:e.uuid,display:e.display}}function oh(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return ax(`${ay}/location${n?"?"+n:""}`).then(e=>e.data.results.map(of))}class og{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+og.version}static addUnaryOp(e){return og.max_unop_len=Math.max(e.length,og.max_unop_len),og.unary_ops[e]=1,og}static addBinaryOp(e,t,r){return og.max_binop_len=Math.max(e.length,og.max_binop_len),og.binary_ops[e]=t,r?og.right_associative.add(e):og.right_associative.delete(e),og}static addIdentifierChar(e){return og.additional_identifier_chars.add(e),og}static addLiteral(e,t){return og.literals[e]=t,og}static removeUnaryOp(e){return delete og.unary_ops[e],e.length===og.max_unop_len&&(og.max_unop_len=og.getMaxKeyLen(og.unary_ops)),og}static removeAllUnaryOps(){return og.unary_ops={},og.max_unop_len=0,og}static removeIdentifierChar(e){return og.additional_identifier_chars.delete(e),og}static removeBinaryOp(e){return delete og.binary_ops[e],e.length===og.max_binop_len&&(og.max_binop_len=og.getMaxKeyLen(og.binary_ops)),og.right_associative.delete(e),og}static removeAllBinaryOps(){return og.binary_ops={},og.max_binop_len=0,og}static removeLiteral(e){return delete og.literals[e],og}static removeAllLiterals(){return og.literals={},og}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 og(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 og.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!og.binary_ops[String.fromCharCode(e)]||og.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return og.isIdentifierStart(e)||og.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(og.hooks[e]){let r={context:this,node:t};return og.hooks.run(e,r),r.node}return t}searchHook(e){if(og.hooks[e]){let t={context:this};return og.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===og.SPACE_CODE||e===og.TAB_CODE||e===og.LF_CODE||e===og.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:og.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===og.SEMCOL_CODE||r===og.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===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,og.max_binop_len),t=e.length;for(;t>0;){if(og.binary_ops.hasOwnProperty(e)&&(!og.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!og.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:og.binaryPrecedence(t),right_a:og.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=og.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:og.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,o=n.pop(),e={type:og.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:og.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,og.isDecimalDigit(e)||e===og.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===og.SQUOTE_CODE||e===og.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===og.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,og.max_unop_len)).length;r>0;){if(og.unary_ops.hasOwnProperty(t)&&(!og.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!og.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:og.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}og.isIdentifierStart(e)?(n=this.gobbleIdentifier(),og.literals.hasOwnProperty(n.name)?n={type:og.LITERAL,value:og.literals[n.name],raw:n.name}:n.name===og.this_str&&(n={type:og.THIS_EXP})):e===og.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===og.PERIOD_CODE||t===og.OBRACK_CODE||t===og.OPAREN_CODE||t===og.QUMARK_CODE;){let r;if(t===og.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==og.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===og.OBRACK_CODE?((e={type:og.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==og.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===og.OPAREN_CODE?e={type:og.CALL_EXP,arguments:this.gobbleArguments(og.CPAREN_CODE),callee:e}:(t===og.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:og.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;og.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===og.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);og.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++));og.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);og.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,og.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===og.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===og.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:og.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!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 n||this.throwError('Unclosed quote after "'+e+'"'),{type:og.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(og.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,og.isIdentifierPart(e))this.index++;else break;return{type:og.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){r=!0,this.index++,e===og.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===og.COMMA_CODE){if(this.index++,++n!==t.length){if(e===og.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===og.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==og.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(og.CPAREN_CODE);if(this.code===og.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:og.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:og.ARRAY_EXP,elements:this.gobbleArguments(og.CBRACK_CODE)}}}Object.assign(og,{hooks:new class{add(e,t,r){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][r?"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)})}}(og),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"}),og.max_unop_len=og.getMaxKeyLen(og.unary_ops),og.max_binop_len=og.getMaxKeyLen(og.binary_ops);let oy=e=>new og(e).parse(),ov=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(og).filter(e=>!ov.includes(e)&&void 0===oy[e]).forEach(e=>{oy[e]=og[e]}),oy.Jsep=og,oy.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||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:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let ob="ArrowFunctionExpression",ow={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)}},ox={...ow,Promise};function oD(e,t={}){return oP(e,t,oO)}async function oE(e,t={}){return oT(e,t,oO)}function o_(e,t={}){return oP(e,t,oN)}function oC(e,t={}){return oT(e,t,oN)}function oS(e,t={}){return oP(e,t,o$)}function ok(e,t={}){return oT(e,t,o$)}function oP(e,t={},r){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 n=oL(t,ow),a=oM("string"==typeof e?oy(e):e,n);if(r(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 oT(e,t={},r){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 n=oL(t,ox);return Promise.resolve(oM("string"==typeof e?oy(e):e,n)).then(t=>{if(r(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 oR(e){return oy(e)}function oO(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function oN(e){return"boolean"==typeof e}function o$(e){return"number"==typeof e}function oM(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=oM(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 oM(v.left,b)&&oM(v.right,b);case"||":return oM(v.left,b)||oM(v.right,b);case"??":return oM(v.left,b)??oM(v.right,b)}let w=oM(v.left,b),x=oM(v.right,b);switch(v.operator){case"+":return w+x;case"-":return w-x;case"*":return w*x;case"/":return w/x;case"%":return w%x;case"**":return w**x;case"==":return w==x;case"===":return w===x;case"!=":return w!=x;case"!==":return w!==x;case">":return w>x;case">=":return w>=x;case"<":return w<x;case"<=":return w<=x;case"in":return w in x;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,oM(r.test,n)?oM(r.consequent,n):oM(r.alternate,n);case"CallExpression":return oV(oj(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=e[n];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 r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(a)&&t.push([r,a]),t},[]));return oM(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return oV(oI(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(oU(s));case"SequenceExpression":let E;return l=e,u=t,(E=l.expressions.map(oU(u)))[E.length-1];case"NewExpression":var _=e,C=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(oU(C));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.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,(oW(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 S,k;return m=e,p=t,S=m.expressions?.map(oU(p))??[],(k=m.quasis?.map(oU(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+S.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 oA(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return oA(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function oj(e,t){let r=oB(e.callee,t);if(r===oF||e.optional&&null==r)return oF;let n=e.arguments?.map(oU(t));if(r){if("function"!=typeof r)throw`${oK(e.callee)} is not a function`}else throw`No function named ${oK(e.callee)} is defined in this context`;return r(...n)}function oI(e,t){let r=oB(e.object,t);if(r===oF||e.optional&&null==r)return oF;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${oz(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=oA(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${oz(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=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}(oM(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);oW(n),function(e,t){if(oH.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let a=r[n];return"function"==typeof a?a.bind(r):a}function oL(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}oy.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 r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:ob,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=ob,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),oy.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),oy.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 r(t){let r=this.index,n="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){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,r.call(this,n);return}this.throwError("unexpected char within number")}n.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)&&r.call(this,n)})}}),oy.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,a=this.expr.slice(r,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{n=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),oy.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||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:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),oy.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},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,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",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":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),oy.addBinaryOp("in",7),oy.addBinaryOp("??",1);let oF=Symbol("optional chain short-circuited");function oB(e,t){switch(e.type){case"MemberExpression":return oI(e,t);case"CallExpression":return oj(e,t);default:return oM(e,t)}}function oV(e){return e===oF?void 0:e}function oU(e){return function(t){return null===t?null:oM(t,e)}}function oW(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let oH=new Set(["toString","valueOf","hasOwnProperty"]);function oz(e,t){try{return oA(e,t)}catch{return"<computed>"}}function oK(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function oZ(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:{...ox},isLocalExpression:!1,variables:new Set};return oG("string"==typeof e?oy(e):e,t),[...t.variables]}function oG(e,t){switch(e.type){case"UnaryExpression":return n=e,a=t,oG(n.argument,a);case"BinaryExpression":return o=e,i=t,[oG(o.left,i),oG(o.right,i)].filter(Boolean);case"ConditionalExpression":return s=e,l=t,[oG(s.consequent,l),oG(s.test,l),oG(s.alternate,l)].filter(Boolean);case"CallExpression":let r;return u=e,c=t,r=oG(u.callee,c),u.arguments?.map(oY(c)),r;case"ArrowFunctionExpression":var n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b=e,w=t;let x={...w};x.isLocalExpression=!0;let D=b.params?.map(oY(x))??[],E=oG(b.body,x)??[];if(E&&Array.isArray(E))for(let e of E)D.includes(e)||w.variables.add(e);return;case"MemberExpression":var _=e,C=t;if(oG(_.object,C),_.computed)return void oG(_.property,C);let S={...C};S.isLocalExpression=!0,oG(_.property,S);return;case"ArrayExpression":return d=e,m=t,void d.elements?.map(oY(m));case"SequenceExpression":return p=e,f=t,void p.expressions?.map(oY(f));case"NewExpression":return h=e,g=t,void h.arguments?.map(oY(g));case"Literal":case"TemplateElement":return;case"Identifier":var k=e,P=t;if(!(k.name in P.globals))if(P.isLocalExpression)return k.name;else P.variables.add(k.name);return;case"TemplateLiteral":return y=e,v=t,void(y.expressions?.map(oY(v)),y.quasis?.map(oY(v)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function oY(e){return function(t){return null===t?null:oG(t,e)}}let oq=B("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function oJ(e,t,r){oq.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function oQ(e){return oq.getState().flags[e].enabled}oq.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var oX=eF(function(e,t,r){eP(e,t,r)});let o0=L("extensionsInternal",{slots:{},extensions:{}}),o1=L("extensionRenderings",{renderings:new Map}),o4=()=>B("extensionsInternal",{slots:{},extensions:{}});function o2(e){let t=o0.getState(),r=e(t);r!==t&&o0.setState(r)}let o3=null,o6=null;function o5(){let e=o1.getState();return o3&&e===o6||(o3=new Map(e.renderings),o6=e,function(e){for(let t of(ie.clear(),e.values()))ir(t,1);it=!0}(o3)),o3}function o9(e){o6={renderings:e},o1.setState(o6,!0)}let o8=()=>B("extensions",{slots:{}});function o7(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}let ie=new Map,it=!1;function ir(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=ie.get(r);if(!n){if(t<0)return;ie.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),it=!0;return}n.count+=t,n.count<1&&(ie.delete(r),it=!0)}function ia(){var e,t;if(o5(),!it)return;it=!1;let r=Array.from(ie.values(),({record:e})=>e);r.sort(io),e=tm.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===io(e,t[r]))||tm.setState({mountedExtensions:r})}function io(e,t){return ii(e.slotName,t.slotName)||ii(e.extensionId,t.extensionId)||ii(e.slotModuleName,t.slotModuleName)||ii(e.extensionModuleName,t.extensionModuleName)}function ii(e,t){return e===t?0:e<t?-1:1}ia(),o1.subscribe(()=>o7(ia));let is=o4(),il=o8(),iu=tf(),ic=th(),id=new Set,im=!1;function ip(e){if(null===e)id=null;else if(null!==id)for(let t of e)id.add(t);o7(ih)}function ih(){if(!im){im=!0;try{for(let e=1;;e++){let t=id;if(null!==t&&0===t.size)return;id=new Set;try{!function(e,t,r,n,a,o=null){let i=il.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,d]of Object.entries(e.slots)){var c;let m=i[n];if(m&&o&&!o.has(n)){s[n]=m;continue}let{config:p}=(c=d.name,t.slots[c]??{loaded:!1,config:{}}),f=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=is.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=i_(a),u=i_(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[iv(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=tg(n,e,l),u=r.configure?.[l]??null,c=u?oX({},i,u):i,d=iv(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||!aN(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}(n,e,p,r,u,a.session);m&&m.moduleName===d.moduleName&&(0,eV.A)(m.candidateExtensions,f)?s[n]=m:(s[n]={moduleName:d.moduleName,candidateExtensions:f},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&il.setState({slots:s})}(is.getState(),iu.getState(),ic.getState(),oq.getState(),aE.getState(),t)}catch(e){throw id=null===t||null===id?null:new Set([...t,...id]),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{im=!1}}}function ig(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function iy(e,t){return{moduleName:t,name:e,attachedIds:[]}}function iv(e){let[t]=e.split("#");return t}function ib(e){var t;let r;return t=is.getState(),r=iv(e),t.extensions[r]}is.subscribe((e,t)=>{ip(e.extensions!==t.extensions?null:ig(e.slots,t.slots))}),iu.subscribe((e,t)=>{ip(ig(e.slots,t.slots))}),ic.subscribe((e,t)=>{ip(ig(e.configs,t.configs))}),oq.subscribe(()=>ip(null)),aE.subscribe(()=>ip(null)),ip(null);let iw=e=>o2(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function ix(e,t){o2(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...iy(e),attachedIds:[t]}}}})}function iD(e,t){o2(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function iE(e){o2(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function i_(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function iC(e,t){var r;return function(e,t,r=null,n){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:r,...t}:{session:r});try{return!!o_(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}((r=e,il.getState().slots[r]?.candidateExtensions??[]),t,aE.getState().session,e)}let iS=(e,t)=>is.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=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 ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let a=iy(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),ik=L("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function iP({name:e,basePath:t,mode:r,componentContext:n,state:a}){ik.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function iT(e){ik.getState().slotName===e&&ik.setState(ik.getInitialState(),!0)}let iR=0,iO=null,iN={bootstrap:15e3,mount:15e3,unmount:15e3};function i$(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(iN).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=iN[n],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 ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function iM(e,t){var r,n;let a,o,i,s,l,u=await (iO??(iO=new Promise((e,t)=>{rU({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),rU))),iO),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 n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>i$(e,r)):i$(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function iA(e,t){let r,n=iM(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function ij(e,t,r,n,a=e=>e,o={}){let i=iv(n),s=ib(n),l=null;if(e){let c;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:d,moduleName:m,load:p}=s,f=iR++,h=`${t}/${n}-${f}`;e.dataset.extensionRenderingId=h;let g=e=>{try{let e,t;(t=(e=o5()).get(h))&&(e.delete(h),ir(t,-1),o9(e))}catch(t){console.error(e,t)}};try{var u;let e;u={renderingId:h,extensionName:i,extensionModuleName:m,extensionId:n,slotName:t,slotModuleName:r},(e=o5()).has(u.renderingId)||(e.set(u.renderingId,u),ir(u,1),o9(e))}catch(e){throw g(`Recomputing configuration after registering '${n}' failed also failed`),e}try{c=await p()}catch(e){throw g(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await iM(a({...c,name:`${t}/${i}-${f}`}),{...o,_meta:d,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:m,extensionMeta:d},domElement:e})}catch(e){throw g(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),g(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>g(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),g(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var iI=r(47499),iL=r.n(iI);function iF({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,iI.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}`)},[]),iL().createElement("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),am({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:ac(e,t),...a},n)}let iB=L("modalRegistry",{modals:{}}),iV=L("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1}),iU=(0,iI.createContext)({moduleName:"",featureName:""});function iW(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let iH=e=>e;function iz(e,t=iH,r){let n=(0,iI.useCallback)(t=>e.subscribe(t),[e]),a=(0,iI.useCallback)(()=>t(e.getState()),[e,t]),o=(0,iI.useSyncExternalStore)(n,a,a),i=(0,iI.useMemo)(()=>r?iW(e,r):null,[e,r]);return(0,iI.useMemo)(()=>i?{...o,...i}:o,[o,i])}function iK(e,t){return iz(e,iH,t)}function iZ(e){return function(t){let r=(0,iI.useCallback)(t=>e.subscribe(t),[]),n=(0,iI.useCallback)(()=>e.getState(),[]),a=(0,iI.useSyncExternalStore)(r,n,n),o=(0,iI.useMemo)(()=>t?iW(e,t):null,[t]);return(0,iI.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let iG=[];Object.freeze(iG);let iY={candidateExtensions:iG};Object.freeze(iY);let iq=e=>{let t=(0,iI.useCallback)(t=>t.slots?.[e]??iY,[e]);return iz(o8(),t)},iJ=e=>e.session;function iQ(e,t){let r,{candidateExtensions:n}=iq(e),a=iz(aE,iJ),o=(P((r=(0,iI.useRef)(t)).current,t)||(r.current=t),r.current);return(0,iI.useMemo)(()=>iC(e,o),[e,o,a,n])}function iX(e,t){let{moduleName:r}=(0,iI.useContext)(iU);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,iI.useEffect)(()=>{iS(r,e)},[r,e]),{extensions:iQ(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function i0(e){return e}function i1({name:e,extensionSlotName:t,select:r=i0,children:n,state:a,style:o,...i}){if(n&&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,iI.useRef)(null),{extensions:u,extensionSlotModuleName:c}=iX(s,a),d=(0,iI.useMemo)(()=>r(u),[r,u]),m=(0,iI.useMemo)(()=>{if("function"==typeof n&&!iL().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return iL().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i},s&&d?.map((e,t)=>iL().createElement(iU.Provider,{key:e.id,value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}}},m?.[t]??("function"!=typeof n?n:null)??iL().createElement(lb,{state:a}))))}var i4=r(5338);function i2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i2(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i2(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i6(e){return(i6="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 i5(e){return(i5="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 i9(e,t){var r;if("function"!=typeof(r=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 r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,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(i5(r)));return function(){var e=r(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(i5(e)));return e}}var i8=null;try{i8=require("react").createContext()}catch(e){}var i7={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 se(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function st(e,t){return new Promise(function(r,n){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=so(e,t,function(){r(this)}),i=i9(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:sa(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function sr(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():sa(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function sn(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=so(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=i9(e,t)();sa(e).render(n,o)}})}function sa(e){return e.ReactDOMClient||e.ReactDOM}function so(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=i8?e.React.createElement(i8.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,i3(i3({},t),{},{mountFinished:r,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 si=r(58779),ss=r(73391),sl=r.n(ss),su=r(25952);let sc={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},sd=new Map;(0,su.initCache)(sd);let sm={errorRetryCount:3,fetcher:ax,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof aD){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>sd};function sp(e,t){return function(e){if("object"!==i6(e))throw Error("single-spa-react requires a configuration object");var t,r=i3(i3({},i7),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!i8&&r.React.createContext&&(i8=r.React.createContext()),r.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}(r);var n={bootstrap:se.bind(null,r),mount:st.bind(null,r),unmount:sr.bind(null,r)};return r.parcelCanUpdate&&(n.update=sn.bind(null,r)),n}({React:iL(),ReactDOMClient:i4,rootComponent:(function(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},sc,e),r={...sm,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=iL().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return iL().createElement("div",null,"An error has occurred. Please try reloading the page.");{let n=iL().createElement(iI.Suspense,{fallback:null},iL().createElement(ss.SWRConfig,{value:r},iL().createElement(iU.Provider,{value:this.state.config},t.disableTranslations?iL().createElement(e,this.props):iL().createElement(si.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},iL().createElement(e,this.props)))));return t.strictMode&&iL().StrictMode?iL().createElement(iL().StrictMode,null,n):n}}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}})(t)(e)})}function sf(e,t){return()=>e().then(({default:e})=>sp(e,t))}function sh(e,t){return()=>Promise.resolve(sp(e,t))}let sg=sf,sy=new Map;function sv(e,t){let r=(0,iI.useRef)(t??{}),n=(0,iI.useRef)(t=>aK(e,t)),a=(0,iI.useRef)(Symbol());return(0,iI.useEffect)(()=>{let r=t??{},n=a.current;return null===az(e)?aW(e,r):(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.`),aK(e,()=>r)),sy.set(e,n),()=>{sy.get(e)===n&&(aH(e),sy.delete(e))}},[e]),(0,iI.useEffect)(()=>{let n=t??{};P(r.current,n)||(aK(e,()=>n),r.current=n)},[t]),n.current}function sb({namespace:e,value:t}){return sv(e,t),null}let sw=({children:e,value:t,fallback:r})=>t?iL().createElement(iL().Fragment,null,e):r?iL().createElement(iL().Fragment,null,r):null;function sx(){let e=(0,iI.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,iI.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function sD(e,t=e=>e??{}){let[r,n]=(0,iI.useState)(()=>{if(sE(e))return;let r=az(e);if(null!==r)return t?t(r):r});return(0,iI.useEffect)(()=>{if(sE(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,iI.useEffect)(()=>aZ(e,e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>P(e,r)?e:r)}),[e,t]),r}function sE(e){return"string"!=typeof e||0===e.trim().length}function s_(e){let t=iQ(e);return(0,iI.useMemo)(()=>t.map(e=>e.id),[t])}function sC(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=sl()(e?a9(e,t,r):null,ax);return(0,iI.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function sS(e){(0,iI.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let sk={},sP=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
15
+ ${this.stack}`}}let aE=L("session",{loaded:!1,session:null}),a_=0,aC=null;function aS(){return aC||(aE.getState().loaded&&a_>=Date.now()-6e4?null:aR())}function ak(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=aS();return n?new Promise(e=>{let t=()=>{let t=aE.getState();t.loaded&&(a(),e(r(t.session)))},a=aE.subscribe(t);n.then(t,t)}):Promise.resolve(r(aE.getState().session))}function aP(){return aS(),aE}function aT(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 aR(e,t){a_=Date.now(),o??(o=a_);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=aI(ax(ab,{headers:r,rejectAuthFailure:!0})),a=()=>{aC===n&&(aC=null)};return n.then(a,a),aC=n,n}function aO(){aE.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function aN(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!W(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!W(n.privileges.find(t=>e===t.display))):(W(r)||console.error(`Could not understand privileges "${r}"`),!0))||!W(t.roles.find(e=>"System Developer"===e.display))}function a$(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(aE.getState()),e||(t=aE.subscribe(n))})}async function aM(){return(await ak()).sessionLocation}async function aA(e,t){return aI(ax(ab,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function aj(e,t,r){return r||(r=new AbortController),await ax(`${ay}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),aR()}function aI(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};aE.setState(r,!0),t(r)}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)?r(aL(Error("The session endpoint did not respond with a session"))):r(aL(Error("The server is still starting up"),!0))}).catch(e=>{var n,a,i;if((n=e)instanceof aD&&(401===n.response.status||403===n.response.status)){"object"==typeof(a=e.responseBody)&&null!==a&&!1===a.authenticated?aE.setState({loaded:!0,session:e.responseBody},!0):aO(),t(aE.getState());return}(i=e)instanceof aD&&502===i.response.status&&!aE.getState().loaded&&void 0!==o&&Date.now()-o<18e4?r(aL(e,!0)):(C(`Failed to fetch new session information: ${e}`),r(aL(e)))})})}function aL(e,t=!1){return aE.getState().loaded||aE.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),aE.getState()}function aF(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}aE.subscribe(e=>{e.loaded&&e.session&&aT(e.session)});let aB={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"},aV=N()(()=>({}));F("openmrs-app-context",aV);let aU={};function aW(e,t=aU){aV.setState(r=>{if(e in r)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({},r,{[e]:t===aU?{}:t})})}function aH(e){aV.setState(t=>(e in t&&delete t[e],t))}function az(e,t=e=>e){let r=aV.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function aK(e,t){aV.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function aZ(e,t){let r=az(e);return t(aG(r)),aV.subscribe(n=>{let a=e in n?n[e]:null;a!==r&&(r=a,t(aG(a)))})}function aG(e){return null===e?null:Object.freeze(Object.assign({},e))}let aY=null;async function aq(){return aY??(aY=aJ().then(({map:e,complete:t})=>(t||(aY=null),e))),aY}async function aJ(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];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){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:function(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}(t),complete:r}}async function aQ(){return await aq()}function aX(e){return e.replace(/[\/\-@]/g,"_")}async function a0(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([a1(e,n?.importMap),new Promise((t,r)=>{o=setTimeout(()=>{var t;r(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=aX(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(r.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 a1(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 r=aX(e);if(!window[r]){let r=t??await a4();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let a=e in{};try{return await function(e){var t;let r=(t=window)[a2]??(t[a2]=new Map),n=r.get(e);if(n)return n;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,n)=>{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(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&b({kind:"error",title:au("scriptLoadingFailed","Error: Script failed to load"),description:au("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:n}),actionButtonLabel:au("resetOverrides","Reset overrides"),onActionButtonClick(){console.warn("[Security] Import map overrides are disabled in production mode."),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function a4(){return aQ()}let a2=Symbol.for("__openmrs_script_loading"),a3=`${ay}/attachment`;function a6(e,t){return ax(`${a3}/${e}`,{signal:t.signal})}function a5(e,t,r,n){return ax(a9(e,t,n),{signal:r.signal})}function a9(e,t,r){return r?`${a3}?patient=${e}&encounter=${r}`:`${a3}?patient=${e}&includeEncounterless=${t}`}async function a8(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),ax(`${a3}`,{method:"POST",body:n})}function a7(e,t){return ax(`${a3}/${e}`,{method:"DELETE",signal:t.signal})}async function oe(e,t){return e?(await ax(`${av}/Patient/${e}`,t)).data:null}function ot(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}var or=((q={}).NEWVISIT="startVisit",q.EDITVISIT="editVisit",q.LOADING="loadingVisit",q),on=((J={}).NOTSTARTED="notStarted",J.ONGOING="ongoing",J);let oa="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))",oo=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function oi(){return B("visit",oo)}function os(e,t){oi().setState({patientUuid:e,manuallySetVisitUuid:t})}function ol(e,t){return ax(`${ay}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ou(e,t,r){return ax(`${ay}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function oc(e,t,r){return ax(`${ay}/visit?patient=${e}&v=${r??oa}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}function od(e){return{uuid:e.uuid,display:e.display,name:e.name}}oi().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});let om=`${ay}/visittype`;function op(e=om){return ax(e).then(e=>e.data.results.map(od))}function of(e){return{uuid:e.uuid,display:e.display}}function oh(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return ax(`${ay}/location${n?"?"+n:""}`).then(e=>e.data.results.map(of))}class og{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+og.version}static addUnaryOp(e){return og.max_unop_len=Math.max(e.length,og.max_unop_len),og.unary_ops[e]=1,og}static addBinaryOp(e,t,r){return og.max_binop_len=Math.max(e.length,og.max_binop_len),og.binary_ops[e]=t,r?og.right_associative.add(e):og.right_associative.delete(e),og}static addIdentifierChar(e){return og.additional_identifier_chars.add(e),og}static addLiteral(e,t){return og.literals[e]=t,og}static removeUnaryOp(e){return delete og.unary_ops[e],e.length===og.max_unop_len&&(og.max_unop_len=og.getMaxKeyLen(og.unary_ops)),og}static removeAllUnaryOps(){return og.unary_ops={},og.max_unop_len=0,og}static removeIdentifierChar(e){return og.additional_identifier_chars.delete(e),og}static removeBinaryOp(e){return delete og.binary_ops[e],e.length===og.max_binop_len&&(og.max_binop_len=og.getMaxKeyLen(og.binary_ops)),og.right_associative.delete(e),og}static removeAllBinaryOps(){return og.binary_ops={},og.max_binop_len=0,og}static removeLiteral(e){return delete og.literals[e],og}static removeAllLiterals(){return og.literals={},og}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 og(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 og.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!og.binary_ops[String.fromCharCode(e)]||og.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return og.isIdentifierStart(e)||og.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(og.hooks[e]){let r={context:this,node:t};return og.hooks.run(e,r),r.node}return t}searchHook(e){if(og.hooks[e]){let t={context:this};return og.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===og.SPACE_CODE||e===og.TAB_CODE||e===og.LF_CODE||e===og.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:og.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===og.SEMCOL_CODE||r===og.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===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,og.max_binop_len),t=e.length;for(;t>0;){if(og.binary_ops.hasOwnProperty(e)&&(!og.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!og.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:og.binaryPrecedence(t),right_a:og.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=og.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:og.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,o=n.pop(),e={type:og.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:og.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,og.isDecimalDigit(e)||e===og.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===og.SQUOTE_CODE||e===og.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===og.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,og.max_unop_len)).length;r>0;){if(og.unary_ops.hasOwnProperty(t)&&(!og.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!og.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:og.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}og.isIdentifierStart(e)?(n=this.gobbleIdentifier(),og.literals.hasOwnProperty(n.name)?n={type:og.LITERAL,value:og.literals[n.name],raw:n.name}:n.name===og.this_str&&(n={type:og.THIS_EXP})):e===og.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===og.PERIOD_CODE||t===og.OBRACK_CODE||t===og.OPAREN_CODE||t===og.QUMARK_CODE;){let r;if(t===og.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==og.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===og.OBRACK_CODE?((e={type:og.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==og.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===og.OPAREN_CODE?e={type:og.CALL_EXP,arguments:this.gobbleArguments(og.CPAREN_CODE),callee:e}:(t===og.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:og.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;og.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===og.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);og.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++));og.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);og.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,og.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===og.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===og.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:og.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!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 n||this.throwError('Unclosed quote after "'+e+'"'),{type:og.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(og.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,og.isIdentifierPart(e))this.index++;else break;return{type:og.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){r=!0,this.index++,e===og.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===og.COMMA_CODE){if(this.index++,++n!==t.length){if(e===og.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===og.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==og.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(og.CPAREN_CODE);if(this.code===og.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:og.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:og.ARRAY_EXP,elements:this.gobbleArguments(og.CBRACK_CODE)}}}Object.assign(og,{hooks:new class{add(e,t,r){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][r?"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)})}}(og),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"}),og.max_unop_len=og.getMaxKeyLen(og.unary_ops),og.max_binop_len=og.getMaxKeyLen(og.binary_ops);let oy=e=>new og(e).parse(),ov=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(og).filter(e=>!ov.includes(e)&&void 0===oy[e]).forEach(e=>{oy[e]=og[e]}),oy.Jsep=og,oy.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||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:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let ob="ArrowFunctionExpression",ow={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)}},ox={...ow,Promise};function oD(e,t={}){return oP(e,t,oO)}async function oE(e,t={}){return oT(e,t,oO)}function o_(e,t={}){return oP(e,t,oN)}function oC(e,t={}){return oT(e,t,oN)}function oS(e,t={}){return oP(e,t,o$)}function ok(e,t={}){return oT(e,t,o$)}function oP(e,t={},r){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 n=oL(t,ow),a=oM("string"==typeof e?oy(e):e,n);if(r(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 oT(e,t={},r){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 n=oL(t,ox);return Promise.resolve(oM("string"==typeof e?oy(e):e,n)).then(t=>{if(r(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 oR(e){return oy(e)}function oO(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function oN(e){return"boolean"==typeof e}function o$(e){return"number"==typeof e}function oM(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=oM(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 oM(v.left,b)&&oM(v.right,b);case"||":return oM(v.left,b)||oM(v.right,b);case"??":return oM(v.left,b)??oM(v.right,b)}let w=oM(v.left,b),x=oM(v.right,b);switch(v.operator){case"+":return w+x;case"-":return w-x;case"*":return w*x;case"/":return w/x;case"%":return w%x;case"**":return w**x;case"==":return w==x;case"===":return w===x;case"!=":return w!=x;case"!==":return w!==x;case">":return w>x;case">=":return w>=x;case"<":return w<x;case"<=":return w<=x;case"in":return w in x;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,oM(r.test,n)?oM(r.consequent,n):oM(r.alternate,n);case"CallExpression":return oV(oj(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=e[n];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 r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(a)&&t.push([r,a]),t},[]));return oM(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return oV(oI(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(oU(s));case"SequenceExpression":let E;return l=e,u=t,(E=l.expressions.map(oU(u)))[E.length-1];case"NewExpression":var _=e,C=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(oU(C));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.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,(oW(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 S,k;return m=e,p=t,S=m.expressions?.map(oU(p))??[],(k=m.quasis?.map(oU(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+S.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 oA(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return oA(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function oj(e,t){let r=oB(e.callee,t);if(r===oF||e.optional&&null==r)return oF;let n=e.arguments?.map(oU(t));if(r){if("function"!=typeof r)throw`${oK(e.callee)} is not a function`}else throw`No function named ${oK(e.callee)} is defined in this context`;return r(...n)}function oI(e,t){let r=oB(e.object,t);if(r===oF||e.optional&&null==r)return oF;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${oz(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=oA(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${oz(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=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}(oM(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);oW(n),function(e,t){if(oH.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let a=r[n];return"function"==typeof a?a.bind(r):a}function oL(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}oy.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 r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:ob,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=ob,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),oy.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),oy.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 r(t){let r=this.index,n="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){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,r.call(this,n);return}this.throwError("unexpected char within number")}n.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)&&r.call(this,n)})}}),oy.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,a=this.expr.slice(r,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{n=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),oy.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||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:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),oy.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},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,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",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":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),oy.addBinaryOp("in",7),oy.addBinaryOp("??",1);let oF=Symbol("optional chain short-circuited");function oB(e,t){switch(e.type){case"MemberExpression":return oI(e,t);case"CallExpression":return oj(e,t);default:return oM(e,t)}}function oV(e){return e===oF?void 0:e}function oU(e){return function(t){return null===t?null:oM(t,e)}}function oW(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let oH=new Set(["toString","valueOf","hasOwnProperty"]);function oz(e,t){try{return oA(e,t)}catch{return"<computed>"}}function oK(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function oZ(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:{...ox},boundNames:new Set,variables:new Set};return oG("string"==typeof e?oy(e):e,t),[...t.variables]}function oG(e,t){switch(e.type){case"UnaryExpression":return r=e,n=t,void oG(r.argument,n);case"BinaryExpression":return a=e,o=t,void(oG(a.left,o),oG(a.right,o));case"ConditionalExpression":return i=e,s=t,void(oG(i.consequent,s),oG(i.test,s),oG(i.alternate,s));case"CallExpression":return l=e,u=t,void(oG(l.callee,u),l.arguments?.map(oY(u)));case"ArrowFunctionExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,x,D=e,E=t;let _=new Set(E.boundNames);for(let e of D.params??[])e?.type==="Identifier"&&_.add(e.name);oG(D.body,{...E,boundNames:_});return;case"MemberExpression":return c=e,d=t,void(oG(c.object,d),c.computed&&oG(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(oY(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(oY(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(oY(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,x=t,void(w.expressions?.map(oY(x)),w.quasis?.map(oY(x)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function oY(e){return function(t){return null===t?null:oG(t,e)}}let oq=B("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function oJ(e,t,r){oq.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function oQ(e){return oq.getState().flags[e].enabled}oq.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var oX=eF(function(e,t,r){eP(e,t,r)});let o0=L("extensionsInternal",{slots:{},extensions:{}}),o1=L("extensionRenderings",{renderings:new Map}),o4=()=>B("extensionsInternal",{slots:{},extensions:{}});function o2(e){let t=o0.getState(),r=e(t);r!==t&&o0.setState(r)}let o3=null,o6=null;function o5(){let e=o1.getState();return o3&&e===o6||(o3=new Map(e.renderings),o6=e,function(e){for(let t of(ie.clear(),e.values()))ir(t,1);it=!0}(o3)),o3}function o9(e){o6={renderings:e},o1.setState(o6,!0)}let o8=()=>B("extensions",{slots:{}});function o7(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}let ie=new Map,it=!1;function ir(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=ie.get(r);if(!n){if(t<0)return;ie.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),it=!0;return}n.count+=t,n.count<1&&(ie.delete(r),it=!0)}function ia(){var e,t;if(o5(),!it)return;it=!1;let r=Array.from(ie.values(),({record:e})=>e);r.sort(io),e=tm.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===io(e,t[r]))||tm.setState({mountedExtensions:r})}function io(e,t){return ii(e.slotName,t.slotName)||ii(e.extensionId,t.extensionId)||ii(e.slotModuleName,t.slotModuleName)||ii(e.extensionModuleName,t.extensionModuleName)}function ii(e,t){return e===t?0:e<t?-1:1}ia(),o1.subscribe(()=>o7(ia));let is=o4(),il=o8(),iu=tf(),ic=th(),id=new Set,im=!1;function ip(e){if(null===e)id=null;else if(null!==id)for(let t of e)id.add(t);o7(ih)}function ih(){if(!im){im=!0;try{for(let e=1;;e++){let t=id;if(null!==t&&0===t.size)return;id=new Set;try{!function(e,t,r,n,a,o=null){let i=il.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,d]of Object.entries(e.slots)){var c;let m=i[n];if(m&&o&&!o.has(n)){s[n]=m;continue}let{config:p}=(c=d.name,t.slots[c]??{loaded:!1,config:{}}),f=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=is.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=i_(a),u=i_(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[iv(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=tg(n,e,l),u=r.configure?.[l]??null,c=u?oX({},i,u):i,d=iv(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||!aN(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}(n,e,p,r,u,a.session);m&&m.moduleName===d.moduleName&&(0,eV.A)(m.candidateExtensions,f)?s[n]=m:(s[n]={moduleName:d.moduleName,candidateExtensions:f},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&il.setState({slots:s})}(is.getState(),iu.getState(),ic.getState(),oq.getState(),aE.getState(),t)}catch(e){throw id=null===t||null===id?null:new Set([...t,...id]),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{im=!1}}}function ig(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function iy(e,t){return{moduleName:t,name:e,attachedIds:[]}}function iv(e){let[t]=e.split("#");return t}function ib(e){var t;let r;return t=is.getState(),r=iv(e),t.extensions[r]}is.subscribe((e,t)=>{ip(e.extensions!==t.extensions?null:ig(e.slots,t.slots))}),iu.subscribe((e,t)=>{ip(ig(e.slots,t.slots))}),ic.subscribe((e,t)=>{ip(ig(e.configs,t.configs))}),oq.subscribe(()=>ip(null)),aE.subscribe(()=>ip(null)),ip(null);let iw=e=>o2(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function ix(e,t){o2(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...iy(e),attachedIds:[t]}}}})}function iD(e,t){o2(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function iE(e){o2(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function i_(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function iC(e,t){var r;return function(e,t,r=null,n){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:r,...t}:{session:r});try{return!!o_(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}((r=e,il.getState().slots[r]?.candidateExtensions??[]),t,aE.getState().session,e)}let iS=(e,t)=>is.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=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 ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let a=iy(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),ik=L("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function iP({name:e,basePath:t,mode:r,componentContext:n,state:a}){ik.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function iT(e){ik.getState().slotName===e&&ik.setState(ik.getInitialState(),!0)}let iR=0,iO=null,iN={bootstrap:15e3,mount:15e3,unmount:15e3};function i$(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(iN).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=iN[n],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 ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function iM(e,t){var r,n;let a,o,i,s,l,u=await (iO??(iO=new Promise((e,t)=>{rU({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),rU))),iO),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 n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>i$(e,r)):i$(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function iA(e,t){let r,n=iM(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function ij(e,t,r,n,a=e=>e,o={}){let i=iv(n),s=ib(n),l=null;if(e){let c;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:d,moduleName:m,load:p}=s,f=iR++,h=`${t}/${n}-${f}`;e.dataset.extensionRenderingId=h;let g=e=>{try{let e,t;(t=(e=o5()).get(h))&&(e.delete(h),ir(t,-1),o9(e))}catch(t){console.error(e,t)}};try{var u;let e;u={renderingId:h,extensionName:i,extensionModuleName:m,extensionId:n,slotName:t,slotModuleName:r},(e=o5()).has(u.renderingId)||(e.set(u.renderingId,u),ir(u,1),o9(e))}catch(e){throw g(`Recomputing configuration after registering '${n}' failed also failed`),e}try{c=await p()}catch(e){throw g(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await iM(a({...c,name:`${t}/${i}-${f}`}),{...o,_meta:d,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:m,extensionMeta:d},domElement:e})}catch(e){throw g(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),g(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>g(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),g(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var iI=r(47499),iL=r.n(iI);function iF({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,iI.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}`)},[]),iL().createElement("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),am({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:ac(e,t),...a},n)}let iB=L("modalRegistry",{modals:{}}),iV=L("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1}),iU=(0,iI.createContext)({moduleName:"",featureName:""});function iW(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let iH=e=>e;function iz(e,t=iH,r){let n=(0,iI.useCallback)(t=>e.subscribe(t),[e]),a=(0,iI.useCallback)(()=>t(e.getState()),[e,t]),o=(0,iI.useSyncExternalStore)(n,a,a),i=(0,iI.useMemo)(()=>r?iW(e,r):null,[e,r]);return(0,iI.useMemo)(()=>i?{...o,...i}:o,[o,i])}function iK(e,t){return iz(e,iH,t)}function iZ(e){return function(t){let r=(0,iI.useCallback)(t=>e.subscribe(t),[]),n=(0,iI.useCallback)(()=>e.getState(),[]),a=(0,iI.useSyncExternalStore)(r,n,n),o=(0,iI.useMemo)(()=>t?iW(e,t):null,[t]);return(0,iI.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let iG=[];Object.freeze(iG);let iY={candidateExtensions:iG};Object.freeze(iY);let iq=e=>{let t=(0,iI.useCallback)(t=>t.slots?.[e]??iY,[e]);return iz(o8(),t)},iJ=e=>e.session;function iQ(e,t){let r,{candidateExtensions:n}=iq(e),a=iz(aE,iJ),o=(P((r=(0,iI.useRef)(t)).current,t)||(r.current=t),r.current);return(0,iI.useMemo)(()=>iC(e,o),[e,o,a,n])}function iX(e,t){let{moduleName:r}=(0,iI.useContext)(iU);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,iI.useEffect)(()=>{iS(r,e)},[r,e]),{extensions:iQ(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function i0(e){return e}function i1({name:e,extensionSlotName:t,select:r=i0,children:n,state:a,style:o,...i}){if(n&&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,iI.useRef)(null),{extensions:u,extensionSlotModuleName:c}=iX(s,a),d=(0,iI.useMemo)(()=>r(u),[r,u]),m=(0,iI.useMemo)(()=>{if("function"==typeof n&&!iL().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return iL().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i},s&&d?.map((e,t)=>iL().createElement(iU.Provider,{key:e.id,value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}}},m?.[t]??("function"!=typeof n?n:null)??iL().createElement(lb,{state:a}))))}var i4=r(5338);function i2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i2(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i2(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i6(e){return(i6="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 i5(e){return(i5="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 i9(e,t){var r;if("function"!=typeof(r=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 r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,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(i5(r)));return function(){var e=r(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(i5(e)));return e}}var i8=null;try{i8=require("react").createContext()}catch(e){}var i7={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 se(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function st(e,t){return new Promise(function(r,n){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=so(e,t,function(){r(this)}),i=i9(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:sa(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function sr(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():sa(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function sn(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=so(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=i9(e,t)();sa(e).render(n,o)}})}function sa(e){return e.ReactDOMClient||e.ReactDOM}function so(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=i8?e.React.createElement(i8.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,i3(i3({},t),{},{mountFinished:r,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 si=r(58779),ss=r(73391),sl=r.n(ss),su=r(25952);let sc={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},sd=new Map;(0,su.initCache)(sd);let sm={errorRetryCount:3,fetcher:ax,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof aD){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>sd};function sp(e,t){return function(e){if("object"!==i6(e))throw Error("single-spa-react requires a configuration object");var t,r=i3(i3({},i7),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!i8&&r.React.createContext&&(i8=r.React.createContext()),r.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}(r);var n={bootstrap:se.bind(null,r),mount:st.bind(null,r),unmount:sr.bind(null,r)};return r.parcelCanUpdate&&(n.update=sn.bind(null,r)),n}({React:iL(),ReactDOMClient:i4,rootComponent:(function(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},sc,e),r={...sm,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=iL().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return iL().createElement("div",null,"An error has occurred. Please try reloading the page.");{let n=iL().createElement(iI.Suspense,{fallback:null},iL().createElement(ss.SWRConfig,{value:r},iL().createElement(iU.Provider,{value:this.state.config},t.disableTranslations?iL().createElement(e,this.props):iL().createElement(si.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},iL().createElement(e,this.props)))));return t.strictMode&&iL().StrictMode?iL().createElement(iL().StrictMode,null,n):n}}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}})(t)(e)})}function sf(e,t){return()=>e().then(({default:e})=>sp(e,t))}function sh(e,t){return()=>Promise.resolve(sp(e,t))}let sg=sf,sy=new Map;function sv(e,t){let r=(0,iI.useRef)(t??{}),n=(0,iI.useRef)(t=>aK(e,t)),a=(0,iI.useRef)(Symbol());return(0,iI.useEffect)(()=>{let r=t??{},n=a.current;return null===az(e)?aW(e,r):(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.`),aK(e,()=>r)),sy.set(e,n),()=>{sy.get(e)===n&&(aH(e),sy.delete(e))}},[e]),(0,iI.useEffect)(()=>{let n=t??{};P(r.current,n)||(aK(e,()=>n),r.current=n)},[t]),n.current}function sb({namespace:e,value:t}){return sv(e,t),null}let sw=({children:e,value:t,fallback:r})=>t?iL().createElement(iL().Fragment,null,e):r?iL().createElement(iL().Fragment,null,r):null;function sx(){let e=(0,iI.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,iI.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function sD(e,t=e=>e??{}){let[r,n]=(0,iI.useState)(()=>{if(sE(e))return;let r=az(e);if(null!==r)return t?t(r):r});return(0,iI.useEffect)(()=>{if(sE(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,iI.useEffect)(()=>aZ(e,e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>P(e,r)?e:r)}),[e,t]),r}function sE(e){return"string"!=typeof e||0===e.trim().length}function s_(e){let t=iQ(e);return(0,iI.useMemo)(()=>t.map(e=>e.id),[t])}function sC(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=sl()(e?a9(e,t,r):null,ax);return(0,iI.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function sS(e){(0,iI.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let sk={},sP=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
16
  Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function sT(e,t,r){let n=sk[e];if(n)return n;let a=new Promise(e=>{let n=r(t.getState());if(n)return void e(n);let a=t.subscribe(t=>{let n=r(t);n&&(a(),e(n))})});return sk[e]=a,a.then(()=>{sk[e]===a&&delete sk[e]}),a}function sR(e){let{moduleName:t,extension:r}=(0,iI.useContext)(iU),n=e?.externalModuleName??t;if(!n&&!r)throw Error(sP);let a=function(e){let t=(0,iI.useMemo)(()=>tp(e),[e]),r=function(e){let[t,r]=(0,iI.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,iI.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&r(e.config)}),[e]),t}(t);if(!r)throw sT(e,t,e=>e.loaded?e.config:null);return r}(n),o=function(e){let t=(0,iI.useMemo)(th,[]),r=function(e,t){let[r,n]=(0,iI.useState)(t?()=>{let r=tg(e.getState(),t.extensionSlotName,t.extensionId);if(r.loaded&&r.config)return r.config}:null);return(0,iI.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=tg(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!(0,eV.A)(a.config,r)&&n(a.config)})},[e,t,r]),r}(t,e);if(!r&&e)throw sT(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let r=tg(t,e.extensionSlotName,e.extensionId);return r.loaded?r.config:null});return r||{}}(r);return(0,iI.useMemo)(()=>e?.externalModuleName&&n===e.externalModuleName?{...a}:{...a,...o},[n,e?.externalModuleName,a,o])}let sO=iQ;function sN(e,t=300){let[r,n]=(0,iI.useState)(e);return(0,iI.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}var s$=r(66148),sM=r.n(s$);let sA=`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 sj(){let e=`${ay}/emrapi/configuration?v=${sA}`,t=sM()(e,ax);return(0,iI.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}function sI(){return(0,iI.useContext)(iU).extension}function sL(e){let t=iQ(e);return(0,iI.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}iZ(o4());let sF=iZ(o8());function sB(e){let{flags:t}=iz(oq);return t[e]?.enabled??!1}function sV(){let[,e]=(0,iI.useState)(0);return(0,iI.useCallback)(()=>{e(e=>e+1)},[])}function sU(e,t,r={}){return sH(e,t,sW,r)}let sW={getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aw(e.toString()),window.location.toString());return n.searchParams.set("limit",""+t),n.searchParams.set("startIndex",""+r),n.searchParams.set("totalCount","true"),n.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 sH(e,t,r,n={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=r,{immutable:l,swrConfig:u}=n,c=n.fetcher??ax,[d,m]=(0,iI.useState)(1),p=(0,iI.useRef)(NaN),f=(0,iI.useRef)(NaN),h=(0,iI.useRef)(d),g=(0,iI.useRef)(!1),y=(0,iI.useRef)(!1),v=e?.toString()??"",[b,w]=(0,iI.useState)(v);v!==b&&(w(v),m(1),h.current=1,p.current=NaN,f.current=NaN,g.current=!1,y.current=!1);let x=(d-1)*t,D=(0,iI.useMemo)(()=>a(e,t,x),[e,t,x]),{data:E,..._}=(l?sM():sl())(D,c,u);E?.data&&(p.current=o(E?.data),f.current=i(E?.data),g.current=!0);let C=Math.ceil(p.current/t),S=(0,iI.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let r=Math.ceil(p.current/t);!g.current||Number.isNaN(r)||e<=r?(h.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,iI.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,E]);let k=(0,iI.useCallback)(()=>{S(h.current+1)},[S]),P=(0,iI.useCallback)(()=>{S(h.current-1)},[S]);return{data:s(E?.data),totalPages:C,totalCount:p.current,currentPage:d,currentPageSize:f.current,paginated:C>1,showNextButton:d<C,showPreviousButton:d>1,goTo:S,goToNext:k,goToPrevious:P,..._}}function sz(e,t,r={}){return sH(e,t,sK(),r)}function sK(){return{getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aw(e.toString()),window.location.toString());return n.searchParams.set("_count",""+t),n.searchParams.set("_getpagesoffset",""+r),n.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 sZ=r(12786),sG=r.n(sZ);function sY(e,t={}){return sq(e,sW,t)}function sq(e,t,r={}){let{swrInfiniteConfig:n,immutable:a}=r,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=r.fetcher??ax,u=(0,iI.useCallback)((r,n)=>0==r?e?.toString()??null:t.getNextUrl(n.data),[e]),{data:c,size:d,setSize:m,...p}=sG()(u,l,{...n,...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 sJ(e,t={}){return sQ(e,sW,t)}function sQ(e,t,r={}){let n=sq(e,t,r),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:u}=n;return((0,iI.useEffect)(()=>{a&&!o&&s()},[a,u]),r.partialData)?n:{...n,data:a||o?void 0:i,isLoading:l||a}}function sX(e,t={}){return sQ(e,sK(),t)}function s0(e,t={}){return sq(e,sK(),t)}function s1(){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 s4(){let[e,t]=(0,iI.useState)(s1);return(0,iI.useEffect)(()=>{let e=()=>{t(s1())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let s2=e=>"small-desktop"===e||"large-desktop"===e;function s3(e){let t=(0,iI.useContext)(iU);(0,iI.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),iP(e),()=>{iT(e.name)}),[t,e])}function s6(){return iz(ik)}let s5=[];function s9(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString(),{data:a}=sJ(`${ay}/location${n?"?"+n:""}`,{immutable:!0});return a??s5}function s8(e,t=!0){let r=(0,iI.useRef)(null);return(0,iI.useEffect)(()=>{let n=n=>{t&&r.current&&n.target&&n.target instanceof Node&&(r.current.contains(n.target)||e(n))};return window.addEventListener("mousedown",n),window.addEventListener("touchstart",n),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("touchstart",n)}},[e,t]),r}function s7(e){let t=(0,iI.useRef)();return(0,iI.useEffect)(()=>{let r=new IntersectionObserver(t=>{for(let r of t)if(r.isIntersecting)return void e()},{threshold:1});return t.current&&r.observe(t.current),()=>{t.current&&r.unobserve(t.current)}},[t.current,e]),t}function le(e,t={}){let{abortController:r,fetchInit:n,url:a,swrConfig:o}=t,i=sx(),s=(0,iI.useMemo)(()=>n?.signal??r?.signal??i.signal,[r?.signal,n?.signal,i.signal]),l=(0,iI.useCallback)(e=>ax(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),{...n,signal:s}),[s,n,a]);return sl()(e,l,o)}function lt(e=[],t=10){let[r,n]=(0,iI.useState)(1),a=(0,iI.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);r>a&&n(a);let o=Math.min(Math.max(1,r),a),i=(0,iI.useMemo)(()=>{let r=(o-1)*t,n=(o+0)*t;return e.slice(r,n)},[e,o,t]),s=(0,iI.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):n(e)},[]),l=(0,iI.useCallback)(()=>{n(e=>e+1)},[]),u=(0,iI.useCallback)(()=>{n(e=>Math.max(1,e-1))},[]);return(0,iI.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 lr(e,t,r,n){return{pageSizes:(0,iI.useMemo)(()=>{let r=Math.ceil(t/e);return isNaN(r)&&(r=0),[...Array(r).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,iI.useMemo)(()=>e>t?t:e*r>t?e*(r-1)+n:e*r,[e,t,r,n])}}function ln(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function la(e){let[t,r]=(0,iI.useState)(e??ln()),{data:n,error:a,isValidating:o}=sl()(t?["patient",t]:null,()=>oe(t,{}));return(0,iI.useEffect)(()=>{let e=()=>{let e=ln();e!==t&&r(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,iI.useMemo)(()=>({isLoading:o&&!a&&!n,patient:n,patientUuid:t,error:a}),[o,a,n,t])}function lo(){let e=`${ay}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:r,isLoading:n}=sl()(e,ax);return(0,iI.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:n,error:r}),[t,r,n])}function li(e){let{extensions:t,extensionSlotModuleName:r}=iX(e);return e?t.map(t=>({state:n})=>iL().createElement(iU.Provider,{value:{moduleName:r,featureName:"",extension:{extensionId:t.id,extensionSlotName:e,extensionSlotModuleName:r,extensionMeta:t.meta}}},iL().createElement(lb,{state:n}))):[]}function ls(){let e=(0,iI.useRef)(),[t,r]=(0,iI.useState)(null),n=null;if(!t){if(i){let e=aP().getState();e.loaded&&(n=e.session)}else i=new Promise(t=>{let r=({loaded:r,session:a})=>{r&&(t(a),n=a,e.current&&(e.current(),e.current=void 0))};r(aP().getState()),n||(e.current=aP().subscribe(r))});if(n)r(n);else throw i}(0,iI.useEffect)(()=>(e.current||(e.current=aP().subscribe(({loaded:e,session:t})=>{e&&(n=t,r(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let a=t||n;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 ll=({privilege:e,fallback:t,children:r})=>{let[n,a]=(0,iI.useState)(null);return((0,iI.useEffect)(()=>{let e=aP(),t=e.subscribe(({loaded:e,session:t})=>{a(e?t?.user??null:null)}),{loaded:r,session:n}=e.getState();return r&&a(n?.user??null),t},[]),n&&aN(e,n))?iL().createElement(iL().Fragment,null,r):t?iL().createElement(iL().Fragment,null,t):null};var lu=r(74353),lc=r.n(lu),ld=r(47581);let lm=new Map;function lp(){for(let e of Array.from(lm.values()))e()}let lf={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function lh(e){let t=(0,iI.useId)();return(0,iI.useEffect)(()=>{if(e)return lm.set(t,e),()=>{lm.delete(t)}},[t,e]),{...iK(oi(),lf),mutateVisit:lp}}function lg(e,t=oa){let r=(0,iI.useRef)(void 0),{patientUuid:n,manuallySetVisitUuid:a,setVisitContext:o}=lh((0,iI.useCallback)(()=>r.current?.(),[])),i=e&&n==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:m}=sl()(e?`${ay}/visit${s}`:null,ax),{data:p,error:f,mutate:h,isValidating:g}=sl()(e&&i?`${ay}/visit${l}`:null,ax),y=(0,iI.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,iI.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,iI.useRef)(null);(0,iI.useEffect)(()=>{!m&&y&&n===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,n]);let w=(0,iI.useCallback)(()=>{d(),h()},[d,h]);(0,iI.useEffect)(()=>{r.current=w},[w]);let x=!!(!u||i&&!p),D=!!(i?f:c);return{error:c||f,mutate:w,isValidating:m||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:x&&!D}}lu.extend(ld);let ly=[];function lv(){let{data:e}=sM()(om,op);return e??ly}let lb=({state:e,children:t,...r})=>{let{extension:n}=(0,iI.useContext)(iU),a=(0,iI.useRef)(null),o=(0,iI.useRef)(Promise.resolve()),i=(0,iI.useRef)(!1),s=(0,iI.useRef)(!1),l=(0,iI.useRef)(e),u=(0,iI.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,iI.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 '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,iI.useCallback)(t=>{t&&!a.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,ij(t,n.extensionSlotName,n.extensionSlotModuleName,n.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,iI.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,iI.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),n?iL().createElement("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};var lw=r(74848),lx=r(46942),lD=r.n(lx);function lE({title:e,children:t}){let r="tablet"===s4();return(0,lw.jsxs)("div",{className:lD()({"-esm-form-builder__card-header-module__tabletHeader___rUYi0":r,"-esm-form-builder__card-header-module__desktopHeader___CDa37":!r}),children:[(0,lw.jsx)("h4",{children:e}),t]})}var l_=r(14968);let lC="-esm-form-builder__custom-overflow-menu-module__container___lY3iq",lS="-esm-form-builder__custom-overflow-menu-module__menu___dReHr",lk="-esm-form-builder__custom-overflow-menu-module__show___48R0e",lP="-esm-form-builder__custom-overflow-menu-module__overflowMenuButton___tsY8r",lT=(0,iI.createContext)(null);function lR(){let e=(0,iI.useContext)(lT);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function lO({menuTitle:e,children:t}){let[r,n]=iL().useState(!1),a=s8(()=>n(!1),r),o="tablet"===s4(),i=(0,iI.useCallback)(()=>n(e=>!e),[]),s=(0,iI.useRef)(null),l=(0,iI.useRef)(null),u=(0,iI.useId)(),c=`custom-overflow-menu-trigger-${u}`,d=`custom-overflow-menu-${u}`,m=(0,iI.useCallback)(()=>{n(!1),s.current?.focus()},[]),p=(0,iI.useMemo)(()=>({closeMenu:m}),[m]),f=(0,iI.useCallback)(e=>{"Escape"===e.key&&r&&(e.stopPropagation(),m())},[m,r]),h=iI.Children.toArray(t);(0,iI.useEffect)(()=>{if(r&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[r]);let g=(0,iI.useCallback)(({currentIndex:e,direction:t})=>{let r=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!r?.length)return;let n=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,a=Array.from(r).indexOf(n);if(-1===a)return void r[t>0?0:r.length-1]?.focus();let o=a+t,i=o<0?r.length-1:o>=r.length?0:o;r[i]?.focus()},[]),y=h.map((e,t)=>(0,iI.isValidElement)(e)?(0,iI.cloneElement)(e,{closeMenu:m,handleOverflowMenuItemFocus:g,index:t}):e);return(0,lw.jsxs)("div",{"data-overflow-menu":!0,className:lD()("cds--overflow-menu",lC),ref:a,children:[(0,lw.jsx)("button",{className:lD()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},lP),"aria-controls":d,"aria-expanded":r,"aria-haspopup":"true",id:c,onClick:i,onKeyDown:f,ref:s,children:e}),(0,lw.jsxs)("div",{className:lD()("cds--overflow-menu-options","cds--overflow-menu--flip",lS,{[lk]:r}),"aria-labelledby":c,"data-floating-menu-direction":"bottom",id:d,onKeyDown:f,ref:l,role:"menu",tabIndex:-1,children:[(0,lw.jsx)("ul",{className:lD()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":o}),children:(0,lw.jsx)(lT.Provider,{value:p,children:y})}),(0,lw.jsx)("span",{})]})]})}function lN(e){let t=(0,iI.useContext)(lT);return(0,lw.jsx)(l_.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}let l$={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},lM=e=>(0,lw.jsx)(l_.TableBatchActions,{translateWithId:(e,t)=>{let r=l$[e];return r?au(r,e,t):e},...e});var lA=r(47767),lj=r(84976);let lI=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],lL=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),lF=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-add",iconProps:e})})),lB=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),lV=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),lU=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),lW=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),lH=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),lz=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),lK=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),lZ=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),lG=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),lY=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),lq=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),lJ=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),lQ=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),lX=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),l0=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),l1=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),l4=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),l2=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),l3=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),l6=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),l5=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-close",iconProps:e})})),l9=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),l8=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),l7=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-document",iconProps:e})})),ue=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),ut=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-download",iconProps:e})})),ur=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),un=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),ua=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),uo=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-events",iconProps:e})})),ui=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),us=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),ul=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),uu=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),uc=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),ud=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-group",iconProps:e})})),um=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),up=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),uf=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),uh=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-information",iconProps:e})})),ug=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),uy=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),uv=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),ub=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),uw=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),ux=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-location",iconProps:e})})),uD=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),uE=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),u_=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),uC=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),uS=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),uk=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),uP=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-money",iconProps:e})})),uT=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),uR=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),uO=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),uN=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),u$=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-password",iconProps:e})})),uM=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),uA=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),uj=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),uI=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),uL=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),uF=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),uB=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),uV=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-report",iconProps:e})})),uU=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),uW=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-save",iconProps:e})})),uH=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-search",iconProps:e})})),uz=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),uK=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),uZ=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),uG=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),uY=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),uq=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),uJ=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),uQ=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-table",iconProps:e})})),uX=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-time",iconProps:e})})),u0=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),u1=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),u4=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),u2=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),u3=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),u6=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),u5=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),u9=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),u8=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-user",iconProps:e})})),u7=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),ce=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-view",iconProps:e})})),ct=(0,iI.memo)((0,iI.forwardRef)(function(e,t){return(0,lw.jsx)(cl,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),cr=ct,cn=ue,ca=uw,co=uf,ci=uG,cs=(0,iI.memo)((0,iI.forwardRef)(function({icon:e,fallback:t,...r},n){let a=(0,iI.useRef)(e?document.getElementById(e):void 0);return(0,iI.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),r=new MutationObserver(t=>{for(let r of t)"childList"===r.type&&(a.current=e?document.getElementById(e):void 0)});return t&&r.observe(t,{childList:!0}),()=>r.disconnect()},[e]),(0,lw.jsx)(sw,{value:a.current,fallback:t,children:(0,lw.jsx)(cl,{ref:n,icon:e,iconProps:r})})})),cl=(0,iI.memo)((0,iI.forwardRef)(function({icon:e,iconProps:t},r){let{className:n,fill:a,size:o}=Object.assign({},{fill:"currentColor",size:20},t);(o<=0||o>72)&&(console.error(`Invalid size '${o}' specified for ${e}. Defaulting to 20.`),o=20);let i=(0,iI.useRef)(null);return(0,iI.useImperativeHandle)(r,()=>i.current),(0,iI.useEffect)(()=>{i.current&&"currentColor"!==a&&i.current.style.setProperty("--omrs-icon-fill",a)},[]),(0,lw.jsx)("svg",{ref:i,className:lD()("omrs-icon","-esm-form-builder__icons-module__icon___sq7Qp",n),height:o,width:o,viewBox:"0 0 16 16",children:(0,lw.jsx)("use",{href:`#${e}`})})})),cu=({path:e,title:t,basePath:r,icon:n})=>{let{t:a}=(0,si.useTranslation)(),o=(0,lA.zy)(),i=(0,iI.useMemo)(()=>{if(!e)return!1;let t=e.startsWith("/")?e.slice(1):e;if(t.startsWith("http"))return t===window.location.href;let r=t.split("/").map(e=>decodeURIComponent(e)),n=(o.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return n.some((e,t)=>r.every((e,r)=>n[t+r]===e))},[o.pathname,e]);return(0,lw.jsx)("div",{children:(0,lw.jsx)(iF,{className:lD()("cds--side-nav__link",{"active-left-nav-link":i}),to:`${r}/${encodeURIComponent(e)}`,children:(0,lw.jsxs)("span",{className:"-esm-form-builder__dashboard-module__menu___Lg1M+",children:[(0,lw.jsx)(cs,{icon:n,className:"-esm-form-builder__dashboard-module__icon___Y2DxK",size:16}),(0,lw.jsx)("span",{children:a(t)})]})})},e)};function cc(e){return function({basePath:t}){return(0,lw.jsx)(lj.Kd,{children:(0,lw.jsx)(cu,{basePath:t,...e})})}}function cd(e){let t=(0,iI.useRef)(null),r=(0,iI.useRef)(void 0),n=(0,iI.useCallback)(t=>{if("function"==typeof e){let r=e(t);return()=>{"function"==typeof r?r():e(null)}}if(e)return e.current=t,()=>{e.current=null}},[e]);return(0,iI.useMemo)(()=>({get current(){return t.current},set current(value){t.current=value,r.current&&(r.current(),r.current=void 0),null!=value&&(r.current=n(value))}}),[n])}function cm(...e){return 1===e.length&&e[0]?e[0]:t=>{let r=!1,n=e.map(e=>{let n=cp(e,t);return r||="function"==typeof n,n});if(r)return()=>{n.forEach((t,r)=>{"function"==typeof t?t():cp(e[r],null)})}}}function cp(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function cf(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}let ch="u">typeof document?iL().useLayoutEffect:()=>{},cg={prefix:String(Math.round(1e10*Math.random())),current:0},cy=iL().createContext(cg),cv=iL().createContext(!1),cb=("u">typeof window&&window.document&&window.document.createElement,new WeakMap),cw="function"==typeof iL().useId?function(e){let t=iL().useId(),[r]=(0,iI.useState)(c_()),n=r?"react-aria":`react-aria${cg.prefix}`;return e||`${n}-${t}`}:function(e){let t=(0,iI.useContext)(cy),r=function(e=!1){let t=(0,iI.useContext)(cy),r=(0,iI.useRef)(null);if(null===r.current&&!e){let e=iL().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let r=cb.get(e);null==r?cb.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==r.state&&(t.current=r.id,cb.delete(e))}r.current=++t.current}return r.current}(!!e),n=`react-aria${t.prefix}`;return e||`${n}-${r}`};function cx(){return!1}function cD(){return!0}function cE(e){return()=>{}}function c_(){return"function"==typeof iL().useSyncExternalStore?iL().useSyncExternalStore(cE,cx,cD):(0,iI.useContext)(cv)}let cC=!!("u">typeof window&&window.document&&window.document.createElement),cS=new Map;function ck(e){let[t,r]=(0,iI.useState)(e),n=(0,iI.useRef)(null),a=cw(t),o=(0,iI.useRef)(null);if(s&&s.register(o,a),cC){let e=cS.get(a);e&&!e.includes(n)?e.push(n):cS.set(a,[n])}return ch(()=>()=>{s&&s.unregister(o),cS.delete(a)},[a]),(0,iI.useEffect)(()=>{let e=n.current;return e&&r(e),()=>{e&&(n.current=null)}}),a}function cP(e=[]){let t=ck(),[r,n]=function(e){let[t,r]=(0,iI.useState)(e),n=(0,iI.useRef)(t),a=(0,iI.useRef)(null),o=(0,iI.useRef)(()=>{if(!a.current)return;let e=a.current.next();if(e.done){a.current=null;return}n.current===e.value?o.current():r(e.value)});return ch(()=>{n.current=t,a.current&&o.current()}),[t,(0,iI.useCallback)(e=>{a.current=e(n.current),o.current()},[o])]}(t),a=(0,iI.useCallback)(()=>{n(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,n]);return ch(a,[t,a,...e]),r}"u">typeof FinalizationRegistry&&(s=new FinalizationRegistry(e=>{cS.delete(e)}));let cT=function(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=function e(t){var r,n,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(r=0;r<o;r++)t[r]&&(n=e(t[r]))&&(a&&(a+=" "),a+=n)}else for(n in t)t[n]&&(a&&(a+=" "),a+=n);return a}(e))&&(n&&(n+=" "),n+=t);return n};function cR(...e){let t={...e[0]};for(let r=1;r<e.length;r++){let n=e[r];for(let e in n){let r=t[e],a=n[e];"function"==typeof r&&"function"==typeof a&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&90>=e.charCodeAt(2)?t[e]=cf(r,a):("className"===e||"UNSAFE_className"===e)&&"string"==typeof r&&"string"==typeof a?t[e]=cT(r,a):"id"===e&&r&&a?t.id=function(e,t){if(e===t)return e;let r=cS.get(e);if(r)return r.forEach(e=>e.current=t),t;let n=cS.get(t);return n?(n.forEach(t=>t.current=e),e):t}(r,a):"ref"===e&&r&&a?t.ref=cm(r,a):t[e]=void 0!==a?a:r}}return t}let cO=Symbol("default");function cN({values:e,children:t}){for(let[r,n]of e)t=iL().createElement(r.Provider,{value:n},t);return t}function c$(e){let{className:t,style:r,children:n,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,iI.useMemo)(()=>{let e,l,u;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof r?r({...s,defaultStyle:i||{}}):r,u="function"==typeof n?n({...s,defaultChildren:o}):null==n?o:n,{className:null!=e?e:a,style:l||i?{...i,...l}:void 0,children:null!=u?u:o,"data-rac":""}},[t,r,n,a,o,i,s])}function cM(e,t){let r=(0,iI.useContext)(e);if(null===t)return null;if(r&&"object"==typeof r&&"slots"in r&&r.slots){let e=t||cO;if(!r.slots[e]){let e=new Intl.ListFormat().format(Object.keys(r.slots).map(e=>`"${e}"`)),n=t?`Invalid slot "${t}".`:"A slot prop is required.";throw Error(`${n} Valid slot names are ${e}.`)}return r.slots[e]}return r}function cA(e,t,r){let{ref:n,...a}=cM(r,e.slot)||{},o=cd((0,iI.useMemo)(()=>cm(t,n),[t,n])),i=cR(a,e);return"style"in a&&a.style&&"style"in e&&e.style&&("function"==typeof a.style||"function"==typeof e.style?i.style=t=>{let r="function"==typeof a.style?a.style(t):a.style,n={...t.defaultStyle,...r},o="function"==typeof e.style?e.style({...t,defaultStyle:n}):e.style;return{...n,...o}}:i.style={...a.style,...e.style}),[i,o]}function cj(e=!0){let[t,r]=(0,iI.useState)(e),n=(0,iI.useRef)(!1),a=(0,iI.useCallback)(e=>{n.current=!0,r(!!e)},[]);return ch(()=>{n.current||r(!1)},[]),[a,t]}function cI(e){let t=/^(data-.*)$/,r={};for(let n in e)t.test(n)||(r[n]=e[n]);return r}let cL=(0,iI.createContext)(null),cF=null;function cB(e,t="assertive",r=7e3){cF?cF.announce(e,t,r):(cF=new cV,("boolean"==typeof IS_REACT_ACT_ENVIRONMENT?IS_REACT_ACT_ENVIRONMENT:"u">typeof jest)?cF.announce(e,t,r):setTimeout(()=>{(null==cF?void 0:cF.isAttached())&&(null==cF||cF.announce(e,t,r))},100))}class cV{isAttached(){var e;return null==(e=this.node)?void 0:e.isConnected}createLog(e){let t=document.createElement("div");return t.setAttribute("role","log"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions"),t}destroy(){this.node&&(document.body.removeChild(this.node),this.node=null)}announce(e,t="assertive",r=7e3){var n,a;if(!this.node)return;let o=document.createElement("div");"object"==typeof e?(o.setAttribute("role","img"),o.setAttribute("aria-labelledby",e["aria-labelledby"])):o.textContent=e,"assertive"===t?null==(n=this.assertiveLog)||n.appendChild(o):null==(a=this.politeLog)||a.appendChild(o),""!==e&&setTimeout(()=>{o.remove()},r)}clear(e){this.node&&((!e||"assertive"===e)&&this.assertiveLog&&(this.assertiveLog.innerHTML=""),(!e||"polite"===e)&&this.politeLog&&(this.politeLog.innerHTML=""))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,"u">typeof document&&(this.node=document.createElement("div"),this.node.dataset.liveAnnouncer="true",Object.assign(this.node.style,{border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"}),this.assertiveLog=this.createLog("assertive"),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog("polite"),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}}let cU=new Set(["id"]),cW=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),cH=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),cz=new Set(["dir","lang","hidden","inert","translate"]),cK=new Set(["onClick","onAuxClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onGotPointerCapture","onLostPointerCapture","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionCancel","onTransitionEnd","onTransitionRun","onTransitionStart"]),cZ=/^(data-.*)$/;function cG(e,t={}){let{labelable:r,isLink:n,global:a,events:o=a,propNames:i}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(cU.has(t)||r&&cW.has(t)||n&&cH.has(t)||a&&cz.has(t)||o&&(cK.has(t)||t.endsWith("Capture")&&cK.has(t.slice(0,-7)))||i?.has(t)||cZ.test(t))&&(s[t]=e[t]);return s}function cY(e){if(function(){if(null==cq){cq=!1;try{document.createElement("div").focus({get preventScroll(){return cq=!0,!0}})}catch{}}return cq}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}(e);e.focus(),function(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}(t)}}let cq=null,cJ=e=>e?.ownerDocument??document,cQ=e=>e&&"window"in e&&e.window===e?e:cJ(e).defaultView||window;function cX(e,t){return!!t&&!!e&&e.contains(t)}function c0(e){return e.target}function c1(e){if(!e)return!1;let t=e.getRootNode(),r=cQ(e);if(!(t instanceof r.Document||t instanceof r.ShadowRoot))return!1;let n=t.activeElement;return null!=n&&e.contains(n)}let c4="u">typeof Element&&"checkVisibility"in Element.prototype;function c2(e,t){return c4?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):"#comment"!==e.nodeName&&function(e){let t=cQ(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:r,visibility:n}=e.style,a="none"!==r&&"hidden"!==n&&"collapse"!==n;if(a){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:r,visibility:n}=t(e);a="none"!==r&&"hidden"!==n&&"collapse"!==n}return a}(e)&&!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))&&(!e.parentElement||c2(e.parentElement,e))}let c3=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],c6=c3.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";c3.push('[tabindex]:not([tabindex="-1"]):not([disabled])');let c5=c3.join(':not([hidden]):not([tabindex="-1"]),');function c9(e,t){return e.matches(c6)&&!c7(e)&&(t?.skipVisibilityCheck||c2(e))}function c8(e){return e.matches(c5)&&c2(e)&&!c7(e)}function c7(e){let t=e;for(;null!=t;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function de(e){return e.nativeEvent=e,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function dt(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function dr(e){let t=(0,iI.useRef)({isFocused:!1,observer:null});return ch(()=>{let e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,iI.useCallback)(r=>{let n=c0(r);(n instanceof HTMLButtonElement||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&(t.current.isFocused=!0,n.addEventListener("focusout",r=>{if(t.current.isFocused=!1,n.disabled){let t=de(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===((e=document)=>e.activeElement)()?null:((e=document)=>e.activeElement)();n.dispatchEvent(new FocusEvent("blur",{relatedTarget:e})),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:["disabled"]}))},[e])}let dn=!1;function da(e){if("u"<typeof window||null==window.navigator)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function di(e){return"u">typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function ds(e){let t=null;return()=>(null==t&&(t=e()),t)}let dl=ds(function(){return di(/^Mac/i)}),du=ds(function(){return di(/^iPhone/i)}),dc=ds(function(){return di(/^iPad/i)||dl()&&navigator.maxTouchPoints>1}),dd=ds(function(){return du()||dc()});ds(function(){return dl()||dd()});let dm=ds(function(){return da(/AppleWebKit/i)&&!dp()}),dp=ds(function(){return da(/Chrome/i)}),df=ds(function(){return da(/Android/i)}),dh=ds(function(){return da(/Firefox/i)});function dg(e){return""===e.pointerType&&!!e.isTrusted||(df()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function dy(e,t,r=!0){let{metaKey:n,ctrlKey:a,altKey:o,shiftKey:i}=t;dh()&&window.event?.type?.startsWith("key")&&"_blank"===e.target&&(dl()?n=!0:a=!0);let s=dm()&&dl()&&!dc()&&1?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:n,ctrlKey:a,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:n,ctrlKey:a,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});dy.isOpening=r,cY(e),e.dispatchEvent(s),dy.isOpening=!1}dy.isOpening=!1;let dv=null,db=new Set,dw=new Map,dx=!1,dD=!1,dE={Tab:!0,Escape:!0};function d_(e,t){for(let r of db)r(e,t)}function dC(e){dx=!0,dy.isOpening||e.metaKey||!dl()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key||(dv="keyboard",d_("keyboard",e))}function dS(e){dv="pointer","pointerType"in e&&e.pointerType,("mousedown"===e.type||"pointerdown"===e.type)&&(dx=!0,d_("pointer",e))}function dk(e){!dy.isOpening&&dg(e)&&(dx=!0,dv="virtual")}function dP(e){let t=cQ(c0(e)),r=cJ(c0(e));c0(e)!==t&&c0(e)!==r&&!dn&&e.isTrusted&&(dx||dD||(dv="virtual",d_("virtual",e)),dx=!1,dD=!1)}function dT(){dn||(dx=!1,dD=!0)}function dR(e){if("u"<typeof window||"u"<typeof document)return;let t=cQ(e),r=cJ(e);if(dw.get(t))return;let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){dx=!0,n.apply(this,arguments)},r.addEventListener("keydown",dC,!0),r.addEventListener("keyup",dC,!0),r.addEventListener("click",dk,!0),t.addEventListener("focus",dP,!0),t.addEventListener("blur",dT,!1),"u">typeof PointerEvent&&(r.addEventListener("pointerdown",dS,!0),r.addEventListener("pointermove",dS,!0),r.addEventListener("pointerup",dS,!0)),t.addEventListener("beforeunload",()=>{dO(e)},{once:!0}),dw.set(t,{focus:n})}let dO=(e,t)=>{let r=cQ(e),n=cJ(e);t&&n.removeEventListener("DOMContentLoaded",t),dw.has(r)&&(r.HTMLElement.prototype.focus=dw.get(r).focus,n.removeEventListener("keydown",dC,!0),n.removeEventListener("keyup",dC,!0),n.removeEventListener("click",dk,!0),r.removeEventListener("focus",dP,!0),r.removeEventListener("blur",dT,!1),"u">typeof PointerEvent&&(n.removeEventListener("pointerdown",dS,!0),n.removeEventListener("pointermove",dS,!0),n.removeEventListener("pointerup",dS,!0)),dw.delete(r))};function dN(){return"pointer"!==dv}"u">typeof document&&("loading"!==(m=cJ(void 0)).readyState?dR(void 0):m.addEventListener("DOMContentLoaded",()=>{dR(void 0)}));let d$=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),dM=new Map,dA=new Set;function dj(){if("u"<typeof window)return;function e(e){return"propertyName"in e}let t=r=>{let n=c0(r);if(!e(r)||!n)return;let a=dM.get(n);if(a&&(a.delete(r.propertyName),0===a.size&&(n.removeEventListener("transitioncancel",t),dM.delete(n)),0===dM.size)){for(let e of dA)e();dA.clear()}};document.body.addEventListener("transitionrun",r=>{let n=c0(r);if(!e(r)||!n)return;let a=dM.get(n);a||(a=new Set,dM.set(n,a),n.addEventListener("transitioncancel",t,{once:!0})),a.add(r.propertyName)}),document.body.addEventListener("transitionend",t)}function dI(e){requestAnimationFrame(()=>{for(let[e]of dM)"isConnected"in e&&!e.isConnected&&dM.delete(e);0===dM.size?e():dA.add(e)})}function dL(e){if(!e.isConnected)return;let t=cJ(e);if("virtual"===dv){let r=((e=document)=>e.activeElement)(t);dI(()=>{let n=((e=document)=>e.activeElement)(t);(n===r||n===t.body)&&e.isConnected&&cY(e)})}else cY(e)}function dF(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:a}=e,o=(0,iI.useCallback)(e=>{if(c0(e)===e.currentTarget)return n&&n(e),a&&a(!1),!0},[n,a]),i=dr(o),s=(0,iI.useCallback)(e=>{let t=c0(e),n=cJ(t),o=n?((e=document)=>e.activeElement)(n):((e=document)=>e.activeElement)();t===e.currentTarget&&t===o&&(r&&r(e),a&&a(!0),i(e))},[a,r,i]);return{focusProps:{onFocus:!t&&(r||a||n)?s:void 0,onBlur:!t&&(n||a)?o:void 0}}}function dB(e){if(!e)return;let t=!0;return r=>{e({...r,preventDefault(){r.preventDefault()},isDefaultPrevented:()=>r.isDefaultPrevented(),stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped:()=>t}),t&&r.stopPropagation()}}function dV(e,t){ch(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}"u">typeof document&&("loading"!==document.readyState?dj():document.addEventListener("DOMContentLoaded",dj));let dU=iL().createContext(null);function dW(e,t){let{focusProps:r}=dF(e),{keyboardProps:n}={keyboardProps:e.isDisabled?{}:{onKeyDown:dB(e.onKeyDown),onKeyUp:dB(e.onKeyUp)}},a=cR(r,n),o=function(e){let t=(0,iI.useContext)(dU)||{};dV(t,e);let{ref:r,...n}=t;return n}(t),i=e.isDisabled?{}:o,s=(0,iI.useRef)(e.autoFocus);(0,iI.useEffect)(()=>{s.current&&t.current&&dL(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:cR({...a,tabIndex:l},i)}}iL().forwardRef(function(e,t){let{children:r,...n}=e,a=cd(t),o={...n,ref:a};return iL().createElement(dU.Provider,{value:o},r)});let dH="default",dz="",dK=new WeakMap;function dZ(e){if(dd())"disabled"===dH&&(dH="restoring",setTimeout(()=>{dI(()=>{if("restoring"===dH){let t=cJ(e);"none"===t.documentElement.style.webkitUserSelect&&(t.documentElement.style.webkitUserSelect=dz||""),dz="",dH="default"}})},300));else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&dK.has(e)){let t=dK.get(e),r="userSelect"in e.style?"userSelect":"webkitUserSelect";"none"===e.style[r]&&(e.style[r]=t),""===e.getAttribute("style")&&e.removeAttribute("style"),dK.delete(e)}}function dG(e){let t=e?.defaultView;return t?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let dY=new WeakMap;function dq(e){let t=e??("u">typeof document?document:void 0);if(!t)return dG(t);if(dY.has(t))return dY.get(t);let r=t.querySelector('meta[property="csp-nonce"]'),n=r&&r instanceof cQ(r).HTMLMetaElement&&(r.nonce||r.content)||dG(t)||void 0;return void 0!==n&&dY.set(t,n),n}let dJ=iL().createContext({register:()=>{}});dJ.displayName="PressResponderContext";let dQ=iL().useInsertionEffect??ch;function dX(e){let t=(0,iI.useRef)(null);return dQ(()=>{t.current=e},[e]),(0,iI.useCallback)((...e)=>{let r=t.current;return r?.(...e)},[])}function d0(){let e=(0,iI.useRef)(new Map),t=(0,iI.useCallback)((t,r,n,a)=>{let o=a?.once?(...t)=>{e.current.delete(n),n(...t)}:n;e.current.set(n,{type:r,eventTarget:t,fn:o,options:a}),t.addEventListener(r,o,a)},[]),r=(0,iI.useCallback)((t,r,n,a)=>{let o=e.current.get(n)?.fn||n;t.removeEventListener(r,o,a),e.current.delete(n)},[]),n=(0,iI.useCallback)(()=>{e.current.forEach((e,t)=>{r(e.eventTarget,e.type,t,e.options)})},[r]);return(0,iI.useEffect)(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}var d1=r(54575),d4=r.n(d1);class d2{#e;constructor(e,t,r,n){this.#e=!0;let a=n?.target??r.currentTarget;const o=a?.getBoundingClientRect();let i,s=0,l,u=null;null!=r.clientX&&null!=r.clientY&&(l=r.clientX,u=r.clientY),o&&(null!=l&&null!=u?(i=l-o.left,s=u-o.top):(i=o.width/2,s=o.height/2)),this.type=e,this.pointerType=t,this.target=r.currentTarget,this.shiftKey=r.shiftKey,this.metaKey=r.metaKey,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.x=i,this.y=s,this.key=r.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}let d3=Symbol("linkClicked"),d6="react-aria-pressable-style",d5="data-react-aria-pressable";function d9(e){let{onPress:t,onPressChange:r,onPressStart:n,onPressEnd:a,onPressUp:o,onClick:i,isDisabled:s,isPressed:l,preventFocusOnPress:u,shouldCancelOnPointerExit:c,allowTextSelectionOnPress:d,ref:m,...p}=function(e){let t=(0,iI.useContext)(dJ);if(t){let{register:r,ref:n,...a}=t;e=cR(a,e),r()}return dV(t,e.ref),e}(e),[f,h]=(0,iI.useState)(!1),g=(0,iI.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:y,removeAllGlobalListeners:v}=d0(),b=(0,iI.useCallback)((e,t)=>{let a=g.current;if(s||a.didFirePressStart)return!1;let o=!0;if(a.isTriggeringEvent=!0,n){let r=new d2("pressstart",t,e);n(r),o=r.shouldStopPropagation}return r&&r(!0),a.isTriggeringEvent=!1,a.didFirePressStart=!0,h(!0),o},[s,n,r]),w=(0,iI.useCallback)((e,n,o=!0)=>{let i=g.current;if(!i.didFirePressStart)return!1;i.didFirePressStart=!1,i.isTriggeringEvent=!0;let l=!0;if(a){let t=new d2("pressend",n,e);a(t),l=t.shouldStopPropagation}if(r&&r(!1),h(!1),t&&o&&!s){let r=new d2("press",n,e);t(r),l&&=r.shouldStopPropagation}return i.isTriggeringEvent=!1,l},[s,a,r,t]),x=dX(w),D=dX((0,iI.useCallback)((e,t)=>{let r=g.current;if(s)return!1;if(o){r.isTriggeringEvent=!0;let n=new d2("pressup",t,e);return o(n),r.isTriggeringEvent=!1,n.shouldStopPropagation}return!0},[s,o])),E=(0,iI.useCallback)(e=>{let t=g.current;if(t.isPressed&&t.target){for(let r of(t.didFirePressStart&&null!=t.pointerType&&w(me(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,v(),d||dZ(t.target),t.disposables))r();t.disposables=[]}},[d,v,w]),_=dX(E),C=(0,iI.useCallback)(e=>{c&&E(e)},[c,E]),S=(0,iI.useCallback)(e=>{s||i?.(e)},[s,i]),k=(0,iI.useCallback)((e,t)=>{if(!s&&i){let r=new MouseEvent("click",e);dt(r,t),i(de(r))}},[s,i]),P=(0,iI.useMemo)(()=>{let e=g.current,t={onKeyDown(t){if(d7(t.nativeEvent,t.currentTarget)&&cX(t.currentTarget,c0(t))){mt(c0(t),t.key)&&t.preventDefault();let n=!0;e.isPressed||t.repeat||(e.target=t.currentTarget,e.isPressed=!0,e.pointerType="keyboard",n=b(t,"keyboard"));let a=t.currentTarget;y(cJ(t.currentTarget),"keyup",cf(t=>{d7(t,a)&&!t.repeat&&cX(a,c0(t))&&e.target&&D(me(e.target,t),"keyboard")},r),!0),n&&t.stopPropagation(),t.metaKey&&dl()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else"Meta"===t.key&&(e.metaKeyEvents=new Map)},onClick(t){if((!t||cX(t.currentTarget,c0(t)))&&t&&0===t.button&&!e.isTriggeringEvent&&!dy.isOpening){let r=!0;if(s&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&("virtual"===e.pointerType||dg(t.nativeEvent))){let e=b(t,"virtual"),n=D(t,"virtual"),a=x(t,"virtual");S(t),r=e&&n&&a}else if(e.isPressed&&"keyboard"!==e.pointerType){let n=e.pointerType||t.nativeEvent.pointerType||"virtual",a=D(me(t.currentTarget,t),n),o=x(me(t.currentTarget,t),n,!0);r=a&&o,e.isOverTarget=!1,S(t),_(t)}e.ignoreEmulatedMouseEvents=!1,r&&t.stopPropagation()}}},r=t=>{if(e.isPressed&&e.target&&d7(t,e.target)){mt(c0(t),t.key)&&t.preventDefault();let r=c0(t),n=cX(e.target,r);x(me(e.target,t),"keyboard",n),n&&k(t,e.target),v(),"Enter"!==t.key&&d8(e.target)&&cX(e.target,r)&&!t[d3]&&(t[d3]=!0,dy(e.target,t,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(t.key)}else if("Meta"===t.key&&e.metaKeyEvents?.size){let t=e.metaKeyEvents;for(let r of(e.metaKeyEvents=void 0,t.values()))e.target?.dispatchEvent(new KeyboardEvent("keyup",r))}};if("u">typeof PointerEvent){t.onPointerDown=t=>{var a;if(0!==t.button||!cX(t.currentTarget,c0(t)))return;if(a=t.nativeEvent,!df()&&0===a.width&&0===a.height||1===a.width&&1===a.height&&0===a.pressure&&0===a.detail&&"mouse"===a.pointerType){e.pointerType="virtual";return}e.pointerType=t.pointerType;let o=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,d||function(e){if(dd()){if("default"===dH){let t=cJ(e);dz=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}dH="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";dK.set(e,e.style[t]),e.style[t]="none"}}(e.target),o=b(t,e.pointerType);let a=c0(t);"releasePointerCapture"in a&&("hasPointerCapture"in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),y(cJ(t.currentTarget),"pointerup",r,!1),y(cJ(t.currentTarget),"pointercancel",n,!1)}o&&t.stopPropagation()},t.onMouseDown=t=>{if(cX(t.currentTarget,c0(t))&&0===t.button){if(u){let r=function(e){for(;e&&!c9(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=cQ(e),r=t.document.activeElement;if(!r||r===e)return;dn=!0;let n=!1,a=e=>{(c0(e)===r||n)&&e.stopImmediatePropagation()},o=t=>{(c0(t)===r||n)&&(t.stopImmediatePropagation(),e||n||(n=!0,cY(r),l()))},i=t=>{(c0(t)===e||n)&&t.stopImmediatePropagation()},s=t=>{(c0(t)===e||n)&&(t.stopImmediatePropagation(),n||(n=!0,cY(r),l()))};t.addEventListener("blur",a,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",s,!0),t.addEventListener("focus",i,!0);let l=()=>{cancelAnimationFrame(u),t.removeEventListener("blur",a,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",s,!0),t.removeEventListener("focus",i,!0),dn=!1,n=!1},u=requestAnimationFrame(l);return l}(t.target);r&&e.disposables.push(r)}t.stopPropagation()}},t.onPointerUp=t=>{cX(t.currentTarget,c0(t))&&"virtual"!==e.pointerType&&(0!==t.button||e.isPressed||D(t,e.pointerType||t.pointerType))},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!0,b(me(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!1,x(me(e.target,t),e.pointerType,!1),C(t))};let r=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&0===t.button&&e.target){if(cX(e.target,c0(t))&&null!=e.pointerType){let r=!1,n=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(r?_(t):(cY(e.target),e.target.click()))},80);y(t.currentTarget,"click",()=>r=!0,!0),e.disposables.push(()=>clearTimeout(n))}else _(t);e.isOverTarget=!1}},n=e=>{_(e)};t.onDragStart=e=>{cX(e.currentTarget,c0(e))&&_(e)}}return t},[y,s,u,v,d,C,b,S,k]);return(0,iI.useEffect)(()=>{if(!m)return;let e=cJ(m.current);if(!e||!e.head||e.getElementById(d6))return;let t=e.createElement("style");t.id=d6;let r=dq(e);r&&(t.nonce=r),t.textContent=`
17
17
  @layer {
18
18
  [${d5}] {