UNPKG

@ugandaemr/esm-ugandaemr-app

Version:

UgandaEMR microfrontend built on top of OpenMRS 3.x and OHRI

2 lines 1.62 MB
/*! For license information please see 817.js.LICENSE.txt */ (globalThis.webpackChunk_ugandaemr_esm_ugandaemr_app=globalThis.webpackChunk_ugandaemr_esm_ugandaemr_app||[]).push([[817],{5566:(e,t,n)=>{function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function a(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}System.register(["@openmrs/esm-config","@openmrs/esm-navigation","@openmrs/esm-error-handling","@openmrs/esm-offline"],(function(e,t){var u={},s={},c={},l={};return{setters:[function(e){u.Type=e.Type,u.defineConfigSchema=e.defineConfigSchema,u.getConfig=e.getConfig,u.validators=e.validators},function(e){s.navigate=e.navigate},function(e){c.reportError=e.reportError},function(e){l.getSynchronizationItems=e.getSynchronizationItems}],execute:function(){e(function(){var e={385:function(){System.register(["@openmrs/esm-utils"],(function(e,t){var n={};return{setters:[function(e){n.shallowEqual=e.shallowEqual}],execute:function(){e(function(){"use strict";var e={618:function(e){e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){var e=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},t=function(e,t){var n=l[e];if(n)return n.active?console.error("Attempted to override the existing store ".concat(e,". Make sure that stores are only created once.")):n.value.setState(t,!0),n.active=!0,n.value;var r=c()((function(){return t}));return l[e]={value:r,active:!0},r},n=function(e,t){var n=l[e];return n?(n.active?console.error("Attempted to override the existing store ".concat(e,". Make sure that stores are only created once.")):n.value=t,n.active=!0,n.value):(l[e]={value:t,active:!0},t)},i=function(e,t){var n=l[e];if(!n){var r=c()((function(){return null!=t?t:{}}));return l[e]={value:r,active:!1},r}return n.value},a=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o,i=function(e){if(Array.isArray(e))return e}(o=n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),3!==i.length);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(o)||function(t,n){if(t){if("string"==typeof t)return e(t,3);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,3):void 0}}(o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=i[0],s=i[1],c=i[2],l=void 0===c?s:c,f=void 0===c?function(e){return e}:s;return l(f(a.getState())),a.subscribe((function(e,t){var n=f(e);(0,u.shallowEqual)(t,n)||l(n)}))};r.r(o),r.d(o,{createGlobalStore:function(){return t},getGlobalStore:function(){return i},registerGlobalStore:function(){return n},subscribeTo:function(){return a}});var u=r(618),s=function(e){var t,n=new Set,r=function(e,r){var o="function"==typeof e?e(t):e;if(!Object.is(o,t)){var i=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach((function(e){return e(t,i)}))}},o=function(){return t},i={setState:r,getState:o,getInitialState:function(){return a},subscribe:function(e){return n.add(e),function(){return n.delete(e)}},destroy:function(){console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(r,o,i);return i},c=function(e){return e?s(e):s},l={};setTimeout((function(){"development"===window.spaEnv&&(window.stores=l)}),1e3)}(),o}())}}}))},824:function(e){"use strict";e.exports=u},254:function(e){"use strict";e.exports=c},513:function(e){"use strict";e.exports=s},738:function(e){"use strict";e.exports=l}},t={};function f(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,f),o.exports}f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};return function(){"use strict";var e=function(e,t){function n(){this.constructor=e}st(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},t=function(e){return"function"==typeof e},u=function(e){setTimeout((function(){throw e}),0)},s=function(e){return null!==e&&"object"==typeof e},c=function(e){return e.reduce((function(e,t){return e.concat(i(t,pt)?t.errors:t)}),[])},l=function(e){return e},h=function(e){if(e||(e=lt.Promise||Promise),!e)throw new Error("no Promise impl found");return e},p=function(e,t,n){var r=g(e,t,n);Kt.length?Kt.forEach((function(e){return e(r)})):setTimeout((function(){throw r}))},y=function(e){if("function"!=typeof e)throw Error(m(28,!1));Kt.push(e)},v=function(e){if("function"!=typeof e)throw Error(m(29,!1));var t=!1;return Kt=Kt.filter((function(n){var r=n===e;return t=t||r,!r})),t},m=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return"single-spa minified message #".concat(e,": ").concat(t?t+" ":"","See https://single-spa.js.org/error/?code=").concat(e).concat(r.length?"&arg=".concat(r.join("&arg=")):"")},g=function(e,t,n){var r,o="".concat(E(t)," '").concat(_(t),"' died in status ").concat(t.status,": ");if(i(e,Error)){try{e.message=o+e.message}catch(e){}r=e}else{console.warn(m(30,!1,t.status,_(t)));try{r=Error(o+JSON.stringify(e))}catch(t){r=e}}return r.appOrParcelName=_(t),t.status=n,r},b=function(e){return e.status===Zt},w=function(e){try{return e.activeWhen(window.location)}catch(t){return p(t,e,nn),!1}},_=function(e){return e.name},S=function(e){return Boolean(e.unmountThisParcel)},E=function(e){return S(e)?"parcel":"application"},O=function(){for(var e=arguments.length-1;e>0;e--)for(var t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]},x=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n];return null},A=function(e){return e&&("function"==typeof e||(t=e,Array.isArray(t)&&!x(t,(function(e){return"function"!=typeof e}))));var t},k=function(e,t){var n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[function(){return Promise.resolve()}]);var r=E(e),o=_(e);return function(e){return n.reduce((function(n,i,a){return n.then((function(){var n=i(e);return T(n)?n:Promise.reject(m(15,!1,r,o,t,a))}))}),Promise.resolve())}},T=function(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch},j=function(e,t){return Promise.resolve().then((function(){return e.status!==Wt?e:(e.status=Yt,e.bootstrap?U(e,"bootstrap").then(n).catch((function(n){if(t)throw g(n,e,nn);return p(n,e,nn),e})):Promise.resolve().then(n))}));function n(){return e.status=$t,e}},P=function(e,t){return Promise.resolve().then((function(){if(e.status!==Zt)return e;e.status=Xt;var n=Object.keys(e.parcels).map((function(t){return e.parcels[t].unmountThisParcel()}));return Promise.all(n).then(r,(function(n){return r().then((function(){var r=Error(n.message);if(t)throw g(r,e,nn);p(r,e,nn)}))})).then((function(){return e}));function r(){return U(e,"unmount").then((function(){e.status=$t}),(function(n){if(t)throw g(n,e,nn);p(n,e,nn)}))}}))},D=function(e,t){return Promise.resolve().then((function(){return e.status!==$t?e:(on||(window.dispatchEvent(new Ht("single-spa:before-first-mount")),on=!0),e.status=Jt,U(e,"mount").then((function(){return e.status=Zt,an||(window.dispatchEvent(new Ht("single-spa:first-mount")),an=!0),e})).catch((function(n){return e.status=Zt,P(e,!0).then(r,r);function r(){if(t)throw g(n,e,nn);return p(n,e,nn),e}})))}))},C=function(){return I.apply(sn,arguments)},I=function(e,t){var n=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(m(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(m(3,!1,a(e.name)));var r=un++,o=e.name||"parcel-".concat(r);if("object"!=typeof t)throw Error(m(4,!1,o,void 0===t?"undefined":a(t)));if(!t.domElement)throw Error(m(5,!1,o));var i,u="function"==typeof e,s=u?e:function(){return Promise.resolve(e)},c={id:r,parcels:{},status:u?qt:Wt,customProps:t,parentName:_(n),unmountThisParcel:function(){return p.then((function(){if(c.status!==Zt)throw Error(m(6,!1,o,c.status));return P(c,!0)})).then((function(e){return c.parentName&&delete n.parcels[c.id],e})).then((function(e){return f(e),e})).catch((function(e){throw c.status=nn,d(e),e}))}};n.parcels[r]=c;var l=s();if(!l||"function"!=typeof l.then)throw Error(m(7,!1));l=l.then((function(e){if(!e)throw Error(m(8,!1));if(o=e.name||"parcel-".concat(r),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!A(e.bootstrap))throw Error(m(9,!1,o));if(!A(e.mount))throw Error(m(10,!1,o));if(!A(e.unmount))throw Error(m(11,!1,o));if(e.update&&!A(e.update))throw Error(m(12,!1,o));var t=k(e,"bootstrap"),n=k(e,"mount"),a=k(e,"unmount");c.status=Wt,c.name=o,c.bootstrap=t,c.mount=n,c.unmount=a,c.timeouts=z(e.timeouts),e.update&&(c.update=k(e,"update"),i.update=function(e){return c.customProps=e,M((t=c,Promise.resolve().then((function(){if(t.status!==Zt)throw Error(m(32,!1,_(t)));return t.status=Qt,U(t,"update").then((function(){return t.status=Zt,t})).catch((function(e){throw g(e,t,nn)}))}))));var t})}));var f,d,h=l.then((function(){return j(c,!0)})),p=h.then((function(){return D(c,!0)})),y=new Promise((function(e,t){f=e,d=t}));return i={mount:function(){return M(Promise.resolve().then((function(){if(c.status!==$t)throw Error(m(13,!1,o,c.status));return n.parcels[r]=c,D(c)})))},unmount:function(){return M(c.unmountThisParcel())},getStatus:function(){return c.status},loadPromise:M(l),bootstrapPromise:M(h),mountPromise:M(p),unmountPromise:M(y)}},M=function(e){return e.then((function(){return null}))},N=function(e){var t=_(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(m(40,!1),t,n));var r=O({},n,{name:t,mountParcel:I.bind(e),singleSpa:zt});return S(e)&&(r.unmountSelf=e.unmountThisParcel),r},R=function(e,t,n){if("number"!=typeof e||e<=0)throw Error(m(16,!1));cn.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}},L=function(e,t,n){if("number"!=typeof e||e<=0)throw Error(m(17,!1));cn.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}},F=function(e,t,n){if("number"!=typeof e||e<=0)throw Error(m(18,!1));cn.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}},B=function(e,t,n){if("number"!=typeof e||e<=0)throw Error(m(19,!1));cn.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}},U=function(e,t){var n=e.timeouts[t],r=n.warningMillis,o=E(e);return new Promise((function(i,a){var u=!1,s=!1;e[t](N(e)).then((function(e){u=!0,i(e)})).catch((function(e){u=!0,a(e)})),setTimeout((function(){return l(1)}),r),setTimeout((function(){return l(!0)}),n.millis);var c=m(31,!1,t,o,_(e),n.millis);function l(e){if(!u)if(!0===e)s=!0,n.dieOnTimeout?a(Error(c)):console.error(c);else if(!s){var t=e,o=t*r;console.warn(c),o+r<n.millis&&setTimeout((function(){return l(t+1)}),r)}}}))},z=function(e){var t={};for(var n in cn)t[n]=O({},cn[n],e&&e[n]||{});return t},G=function(e){return Promise.resolve().then((function(){return e.loadPromise?e.loadPromise:e.status!==Vt&&e.status!==tn?e:(e.status=qt,e.loadPromise=Promise.resolve().then((function(){var r=e.loadApp(N(e));if(!T(r))throw n=!0,Error(m(33,!1,_(e)));return r.then((function(n){var r;e.loadErrorTime=null,"object"!=typeof(t=n)&&(r=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!A(t.bootstrap)&&(r=35),A(t.mount)||(r=36),A(t.unmount)||(r=37);var o=E(t);if(r){var i;try{i=JSON.stringify(t)}catch(e){}return console.error(m(r,!1,o,_(e),i),t),p(void 0,e,nn),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=O({},e.devtools.overlays,t.devtools.overlays)),e.status=Wt,e.bootstrap=k(t,"bootstrap"),e.mount=k(t,"mount"),e.unmount=k(t,"unmount"),e.unload=k(t,"unload"),e.timeouts=z(t.timeouts),delete e.loadPromise,e}))})).catch((function(t){var r;return delete e.loadPromise,n?r=nn:(r=tn,e.loadErrorTime=(new Date).getTime()),p(t,e,r),e})));var t,n}))},H=function(e){var 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(m(14,!1));t=e.currentTarget.href,e.preventDefault()}var n=Y(window.location.href),r=Y(t);0===t.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=t:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,t)},K=function(e){var t=this;if(e){var n=e[0].type;dn.indexOf(n)>=0&&fn[n].forEach((function(n){try{n.apply(t,e)}catch(e){setTimeout((function(){throw e}))}}))}},V=function(){Sn([],arguments)},q=function(e,t){return function(){var n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return Ut&&n===o||window.dispatchEvent(function(e,t){var n;try{n=new PopStateEvent("popstate",{state:e})}catch(t){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return n.singleSpa=!0,n.singleSpaTrigger=t,n}(window.history.state,t)),r}},W=function(e){if(pn)throw Error(m(43,!1));Ut=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,pn=!0,hn=window.history.replaceState,window.addEventListener("hashchange",V),window.addEventListener("popstate",V);var t=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(e,n){if(!("function"==typeof n&&dn.indexOf(e)>=0)||x(fn[e],(function(e){return e===n})))return t.apply(this,arguments);fn[e].push(n)},window.removeEventListener=function(e,t){return"function"==typeof t&&dn.indexOf(e)>=0&&(fn[e]=fn[e].filter((function(e){return e!==t}))),n.apply(this,arguments)},window.history.pushState=q(window.history.pushState,"pushState"),window.history.replaceState=q(hn,"replaceState")},Y=function(e){var t=document.createElement("a");return t.href=e,t},$=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!yn){var t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return J.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return J.call(this,n,window.removeEventListener,e,t,arguments)},yn=!0}},J=function(e,t,n,r,o){return"string"!=typeof n?e.apply(this,o):(n.split(/\s+/).forEach((function(e){dn.indexOf(e)>=0&&(t(e,r),n=n.replace(e,""))})),""===n.trim()?this:e.apply(this,o))},Z=function(e){return Promise.resolve().then((function(){var t=vn[_(e)];if(!t)return e;if(e.status===Vt)return Q(e,t),e;if(e.status===en)return t.promise.then((function(){return e}));if(e.status!==$t&&e.status!==tn)return e;var n=e.status===tn?Promise.resolve():U(e,"unload");return e.status=en,n.then((function(){return Q(e,t),e})).catch((function(n){return function(e,t,n){delete vn[_(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,p(n,e,nn),t.reject(n)}(e,t,n),e}))}))},Q=function(e,t){delete vn[_(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=Vt,t.resolve()},X=function(e,t,n,r){vn[_(e)]={app:e,resolve:n,reject:r},Object.defineProperty(vn[_(e)],"promise",{get:t})},ee=function(e){return vn[e]},te=function(){return mn.filter(b).map(_)},ne=function(){return mn.map(_)},re=function(e){var t=x(mn,(function(t){return _(t)===e}));return t?t.status:null},oe=function(e,t,n,r){var o=function(e,t,n,r){var o,i={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(m(39,!1));var t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((function(e,n){return t.indexOf(n)>=0?e:e.concat(n)}),[]);if(0!==n.length)throw Error(m(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length)throw Error(m(20,!1));if("object"!=typeof e.app&&"function"!=typeof e.app)throw Error(m(20,!1));var r=function(e){return"string"==typeof e||"function"==typeof e};if(!(r(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(r)))throw Error(m(24,!1));if(!ce(e.customProps))throw Error(m(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,r){if("string"!=typeof e||0===e.length)throw Error(m(20,!1));if(!t)throw Error(m(23,!1));if("function"!=typeof n)throw Error(m(24,!1));if(!ce(r))throw Error(m(22,!1))}(e,t,n,r),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(o=i.loadApp)?function(){return Promise.resolve(o)}:o,i.customProps=function(e){return e||{}}(i.customProps),i.activeWhen=function(e){var t=Array.isArray(e)?e:[e];return t=t.map((function(e){return"function"==typeof e?e:le(e)})),function(e){return t.some((function(t){return t(e)}))}}(i.activeWhen),i}(e,t,n,r);if(pe()||gn||(gn=!0,setTimeout((function(){pe()||console.warn(m(1,!1))}),5e3)),-1!==ne().indexOf(o.name))throw Error(m(21,!1,o.name));mn.push(O({loadErrorTime:null,status:Vt,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),ln&&($(),Sn())},ie=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return mn.filter((function(t){return t.activeWhen(e)})).map(_)},ae=function(e){if(0===mn.filter((function(t){return _(t)===e})).length)throw Error(m(25,!1,e));return(ln?ue(e,{waitForUnmount:!1}):Promise.resolve()).then((function(){var t=mn.map(_).indexOf(e);mn.splice(t,1)}))},ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof e)throw Error(m(26,!1));var n=x(mn,(function(t){return _(t)===e}));if(!n)throw Error(m(27,!1,e));var r,o=ee(_(n));if(t&&t.waitForUnmount){if(o)return o.promise;var i=new Promise((function(e,t){X(n,(function(){return i}),e,t)}));return i}return o?(r=o.promise,se(n,o.resolve,o.reject)):r=new Promise((function(e,t){X(n,(function(){return r}),e,t),se(n,e,t)})),r},se=function(e,t,n){Promise.resolve().then((function(){if(x(ie(),(function(t){return t===_(e)})))return fe()})).then((function(){return P(e).then(Z).then((function(){t(),setTimeout((function(){Sn()}))}))})).catch(n)},ce=function(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},le=function(e,t){var n=function(e,t){var n=0,r=!1,o="^";"/"!==e[0]&&(e="/"+e);for(var i=0;i<e.length;i++){var a=e[i];(!r&&":"===a||r&&"/"===a)&&u(i)}return u(e.length),new RegExp(o,"i");function u(i){var a=e.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":a,i===e.length)if(r)t&&(o+="$");else{var u=t?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(u,"$"):"".concat(o,"(/").concat(u,")?(#.*)?$")}r=!r,n=i}}(e,t);return function(e){var t=e.origin;t||(t="".concat(e.protocol,"//").concat(e.host));var r=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(r)}},fe=function(){return Sn()},de=function(e,t){return w(e)?j(e).then((function(e){return t.then((function(){return w(e)?D(e):e}))})):t.then((function(){return e}))},he=function(e){En=!0,ln&&(W(e),Sn())},pe=function(){return En},ye=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},ve=function(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)},me=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},ge=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},be=function(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)},we=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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.");var n=be(e);if(t.headers||(t.headers={}),Rt(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,e.startsWith(Pn)&&void 0===t.headers["Disable-WWW-Authenticate"]&&(t.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(Dn)){var r=new URL(n,window.location.toString());r.searchParams.has("_summary")||(r.searchParams.set("_summary","data"),n=r.toString())}var o,i,a=Error();return window.fetch(n,t).then((o=function(e){var t,r,o;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(i){switch(i.label){case 0:return(t=e).ok?204!==t.status?[3,2]:[4,(0,Lt.getConfig)("@openmrs/esm-api")]:[3,4];case 1:return i.sent().followRedirects&&t.headers.has("location")&&(r=t.headers.get("location"))&&(0,Ft.navigate)({to:r}),t.data=null,[2,t];case 2:return[2,t.clone().text().then((function(e){try{e&&(t.data=JSON.parse(e))}catch(e){}return t}))];case 3:return[3,6];case 4:return[4,(0,Lt.getConfig)("@openmrs/esm-api")];case 5:return o=i.sent().redirectAuthFailure,n===be(Cn)&&403===t.status||o.enabled&&o.errors.includes(t.status)?(sessionStorage.removeItem(xn),(0,Ft.navigate)({to:o.url}),[2,o.resolvePromise?Promise.resolve():new Promise((function(){}))]):[2,t.clone().text().then((function(e){var r=e;try{r=JSON.parse(e)}catch(e){}throw new In(n,t,r,a)}),(function(e){throw new In(n,t,null,a)}))];case 6:return[2]}}))},i=function(){var e=this,t=arguments;return new Promise((function(n,r){var i=o.apply(e,t);function a(e){ve(i,n,r,a,u,"next",e)}function u(e){ve(i,n,r,a,u,"throw",e)}a(void 0)}))},function(e){return i.apply(this,arguments)}))},_e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof t)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");var n=new AbortController;return t.signal=n.signal,new wt((function(r){var o=!1;return we(e,t).then((function(e){o=!0,r.next(e),r.complete()}),(function(e){o=!0,r.error(e)})),function(){o||n.abort()}}))},Se=function(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)},Ee=function(e,t){return we("".concat(Mn,"/").concat(e),{signal:t.signal})},Oe=function(e,t,n){return we("".concat(Mn,"?patient=").concat(e,"&includeEncounterless=").concat(t),{signal:n.signal})},xe=function(e,t){return Nn.apply(this,arguments)},Ae=function(e,t){return we("".concat(Mn,"/").concat(e),{method:"DELETE",signal:t.signal})},ke=function(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)},Te=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){ke(i,r,o,a,u,"next",e)}function u(e){ke(i,r,o,a,u,"throw",e)}a(void 0)}))}},je=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},Pe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(Bn<Date.now()-6e4||!Fn.getState().loaded)&&Ie(),new wt((function(t){var n=function(n){var r;n.loaded&&(e.includeAuthStatus?t.next(n.session):t.next(null===(r=n.session)||void 0===r?void 0:r.user))};return n(Fn.getState()),Fn.subscribe(n)}))},De=function(){return(Bn<Date.now()-6e4||!Fn.getState().loaded)&&Ie(),Fn},Ce=function(e){var t,n,r,o=null!==(r=null===(t=e.user)||void 0===t||null===(n=t.userProperties)||void 0===n?void 0:n.defaultLocale)&&void 0!==r?r:e.locale;o&&o.includes("_")&&(o=o.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(o)&&o!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",o)},Ie=function(e,t){Bn=Date.now();var n={};return e&&t&&(n.Authorization="Basic ".concat(window.btoa("".concat(e,":").concat(t)))),Ue(we(Cn,{headers:n}))},Me=function(){Fn.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})},Ne=function(e,t){return void 0===t?Boolean(e):!Boolean(e)||function(e,t){return"string"==typeof e?!Ln(t.privileges.find((function(t){return e===t.display}))):Array.isArray(e)?e.every((function(e){return!Ln(t.privileges.find((function(t){return e===t.display})))})):(Ln(e)||console.error('Could not understand privileges "'.concat(e,'"')),!0)}(e,t)||function(e){return!Ln(e.roles.find((function(e){return"System Developer"===e.display})))}(t)},Re=function(){var e,t;return new Promise((function(n){var r=function(r){r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};r(Fn.getState()),e||(t=Fn.subscribe(r))}))},Le=function(){return new Promise((function(e,t){Pe().subscribe((function(t){e(t.sessionLocation)}),t).unsubscribe()}))},Fe=function(e,t){return Un.apply(this,arguments)},Be=function(e,t,n){return zn.apply(this,arguments)},Ue=function(e){return new Promise((function(t,n){e.then((function(e){var r;"object"==typeof(null==e?void 0:e.data)?(r={loaded:!0,session:e.data},Fn.setState(r),t(r)):(r={loaded:!1,session:null},Fn.setState(r),n(r))})).catch((function(e){(0,Rn.reportError)("Failed to fetch new session information: ".concat(e));var t={loaded:!1,session:null};Fn.setState(t),n(t)}))}))},ze=function(){(0,Lt.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:Lt.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:Lt.Type.String,_default:"${openmrsSpaBase}/login",_validators:[Lt.validators.isUrl]},errors:{_type:Lt.Type.Array,_default:[401],_elements:{_type:Lt.Type.Number,_validators:[Lt.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:Lt.Type.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:Lt.Type.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}}),Ie()},Ge=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},He=function(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)},Ke=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){He(i,r,o,a,u,"next",e)}function u(e){He(i,r,o,a,u,"throw",e)}a(void 0)}))}},Ve=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ge(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ge(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()},qe=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},We=function(e,t){return Hn.apply(this,arguments)},Ye=function(e){return Kn.apply(this,arguments)},$e=function(){return(0,Bt.getGlobalStore)("visit",er)},Je=function(e,t){$e().setState({patientUuid:e,manuallySetVisitUuid:t})},Ze=function(e,t){return we("".concat(Pn,"/visit"),{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})},Qe=function(e,t,n){return we("".concat(Pn,"/visit/").concat(e),{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})},Xe=function(e,t,n){var r=null!=n?n:Xn;return we("".concat(Pn,"/visit?patient=").concat(e,"&v=").concat(r),{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})},et=function(e,t){return function(n){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new nr(e,t))}},tt=function(e){return function(t){return 0===e?ir:t.lift(new ar(e))}},nt=function(e){return{uuid:e.uuid,display:e.display,name:e.name}},rt=function(){return _e("".concat(Pn,"/visittype")).pipe(et((function(e){return e.data.results.map(nt)}))).pipe(tt(1))},ot=function(e){return{uuid:e.uuid,display:e.display}},it=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);var r=n.toString();return _e("".concat(Pn,"/location").concat(r?"?"+r:"")).pipe(et((function(e){return e.data.results.map(ot)}))).pipe(tt(1))};f.r(d),f.d(d,{OpenmrsFetchError:function(){return In},VisitMode:function(){return Vn},VisitStatus:function(){return qn},attachmentUrl:function(){return Mn},backendDependencies:function(){return sr},clearCurrentUser:function(){return Me},createAttachment:function(){return xe},defaultVisitCustomRepresentation:function(){return Xn},deleteAttachmentPermanently:function(){return Ae},fetchCurrentPatient:function(){return We},fhirBaseUrl:function(){return Dn},getAttachmentByUuid:function(){return Ee},getAttachments:function(){return Oe},getCurrentUser:function(){return Pe},getLocations:function(){return it},getLoggedInUser:function(){return Re},getSessionLocation:function(){return Le},getSessionStore:function(){return De},getStartedVisit:function(){return tr},getVisitStore:function(){return $e},getVisitTypes:function(){return rt},getVisitsForPatient:function(){return Xe},makeUrl:function(){return be},openmrsFetch:function(){return we},openmrsObservableFetch:function(){return _e},refetchCurrentUser:function(){return Ie},restBaseUrl:function(){return Pn},saveVisit:function(){return Ze},sessionEndpoint:function(){return Cn},sessionStore:function(){return Fn},setCurrentVisit:function(){return Je},setSessionLocation:function(){return Fe},setUserLanguage:function(){return Ce},setUserProperties:function(){return Be},setupApiModule:function(){return ze},toLocationObject:function(){return ot},toVisitTypeObject:function(){return nt},updateVisit:function(){return Qe},userHasAccess:function(){return Ne}});var at,ut,st=function(e,t){return st=Object.setPrototypeOf||i({__proto__:[]},Array)&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},st(e,t)},ct=!1,lt={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack,ct=e},get useDeprecatedSynchronousErrorHandling(){return ct}},ft={closed:!0,next:function(e){},error:function(e){if(lt.useDeprecatedSynchronousErrorHandling)throw e;u(e)},complete:function(){}},dt=Array.isArray||function(e){return e&&"number"==typeof e.length},ht=function(){var e=function(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this};return e.prototype=Object.create(Error.prototype),e}(),pt=ht,yt=function(){var e=function(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)};return e.prototype.unsubscribe=function(){var n;if(!this.closed){var r=this,o=r._parentOrParents,a=r._ctorUnsubscribe,u=r._unsubscribe,l=r._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i(o,e))o.remove(this);else if(null!==o)for(var f=0;f<o.length;++f)o[f].remove(this);if(t(u)){a&&(this._unsubscribe=void 0);try{u.call(this)}catch(e){n=i(e,pt)?c(e.errors):[e]}}if(dt(l)){f=-1;for(var d=l.length;++f<d;){var h=l[f];if(s(h))try{h.unsubscribe()}catch(e){n=n||[],i(e,pt)?n=n.concat(c(e.errors)):n.push(e)}}}if(n)throw new pt(n)}},e.prototype.add=function(t){var n=t;if(!t)return e.EMPTY;switch(void 0===t?"undefined":a(t)){case"function":n=new e(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!i(n,e)){var r=n;(n=new e)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(i(o,e)){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var u=this._subscriptions;return null===u?this._subscriptions=[n]:u.push(n),n},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}(),vt="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),mt=function(t){function n(e,r,o){var a=t.call(this)||this;switch(a.syncErrorValue=null,a.syncErrorThrown=!1,a.syncErrorThrowable=!1,a.isStopped=!1,arguments.length){case 0:a.destination=ft;break;case 1:if(!e){a.destination=ft;break}if("object"==typeof e){i(e,n)?(a.syncErrorThrowable=e.syncErrorThrowable,a.destination=e,e.add(a)):(a.syncErrorThrowable=!0,a.destination=new gt(a,e));break}default:a.syncErrorThrowable=!0,a.destination=new gt(a,e,r,o)}return a}return e(n,t),n.prototype[vt]=function(){return this},n.create=function(e,t,r){var o=new n(e,t,r);return o.syncErrorThrowable=!1,o},n.prototype.next=function(e){this.isStopped||this._next(e)},n.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},n.prototype._next=function(e){this.destination.next(e)},n.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},n.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},n.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},n}(yt),gt=function(n){var r=function(e,r,o,i){var a,u=n.call(this)||this;u._parentSubscriber=e;var s=u;return t(r)?a=r:r&&(a=r.next,o=r.error,i=r.complete,r!==ft&&(t((s=Object.create(r)).unsubscribe)&&u.add(s.unsubscribe.bind(s)),s.unsubscribe=u.unsubscribe.bind(u))),u._context=s,u._next=a,u._error=o,u._complete=i,u};return e(r,n),r.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;lt.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},r.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,n=lt.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)n?(t.syncErrorValue=e,t.syncErrorThrown=!0):u(e),this.unsubscribe();else{if(this.unsubscribe(),n)throw e;u(e)}}},r.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return e._complete.call(e._context)};lt.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},r.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),lt.useDeprecatedSynchronousErrorHandling)throw e;u(e)}},r.prototype.__tryOrSetError=function(e,t,n){if(!lt.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,n)}catch(t){return lt.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(u(t),!0)}return!1},r.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},r}(mt),bt="function"==typeof Symbol&&Symbol.observable||"@@observable",wt=function(){var e=function(e){this._isScalar=!1,e&&(this._subscribe=e)};return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this.operator,o=function(e,t,n){if(e){if(i(e,mt))return e;if(e[vt])return e[vt]()}return e||t||n?new mt(e,t,n):new mt(ft)}(e,t,n);if(r?o.add(r.call(o,this.source)):o.add(this.source||lt.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),lt.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){lt.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),function(e){for(;e;){var t=e,n=t.closed,r=t.destination,o=t.isStopped;if(n||o)return!1;e=r&&i(r,mt)?r:null}return!0}(e)?e.error(t):console.warn(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=h(t))((function(t,r){var o;o=n.subscribe((function(t){try{e(t)}catch(e){r(e),o&&o.unsubscribe()}}),r,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[bt]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:(0===(n=e).length?l:1===n.length?n[0]:function(e){return n.reduce((function(e,t){return t(e)}),e)})(this);var n},e.prototype.toPromise=function(e){var t=this;return new(e=h(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}(),_t="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,St="object"==typeof self&&self&&self.Object===Object&&self,Et=(_t||St||Function("return this")()).Symbol,Ot=Object.prototype,xt=Ot.hasOwnProperty,At=Ot.toString,kt=Et?Et.toStringTag:void 0,Tt=Object.prototype.toString,jt=Et?Et.toStringTag:void 0,Pt=(at=Object.getPrototypeOf,ut=Object,function(e){return at(ut(e))}),Dt=Function.prototype,Ct=Object.prototype,It=Dt.toString,Mt=Ct.hasOwnProperty,Nt=It.call(Object),Rt=function(e){if(!function(e){return null!=e&&"object"==typeof e}(e)||"[object Object]"!=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":jt&&jt in Object(e)?function(e){var t=xt.call(e,kt),n=e[kt];try{e[kt]=void 0;var r=!0}catch(e){}var o=At.call(e);return r&&(t?e[kt]=n:delete e[kt]),o}(e):function(e){return Tt.call(e)}(e)}(e))return!1;var t=Pt(e);if(null===t)return!0;var n=Mt.call(t,"constructor")&&t.constructor;return"function"==typeof n&&i(n,n)&&It.call(n)==Nt},Lt=f(824),Ft=f(513),Bt=f(385);(0,Bt.createGlobalStore)("breadcrumbs",[]);var Ut,zt=Object.freeze({__proto__:null,get start(){return he},get ensureJQuerySupport(){return $},get setBootstrapMaxTime(){return R},get setMountMaxTime(){return L},get setUnmountMaxTime(){return F},get setUnloadMaxTime(){return B},get registerApplication(){return oe},get unregisterApplication(){return ae},get getMountedApps(){return te},get getAppStatus(){return re},get unloadApplication(){return ue},get checkActivityFunctions(){return ie},get getAppNames(){return ne},get pathToActiveWhen(){return le},get navigateToUrl(){return H},get patchHistoryApi(){return W},get triggerAppChange(){return fe},get addErrorHandler(){return y},get removeErrorHandler(){return v},get mountRootParcel(){return C},get NOT_LOADED(){return Vt},get LOADING_SOURCE_CODE(){return qt},get NOT_BOOTSTRAPPED(){return Wt},get BOOTSTRAPPING(){return Yt},get NOT_MOUNTED(){return $t},get MOUNTING(){return Jt},get UPDATING(){return Qt},get LOAD_ERROR(){return tn},get MOUNTED(){return Zt},get UNLOADING(){return en},get UNMOUNTING(){return Xt},get SKIP_BECAUSE_BROKEN(){return nn}}),Gt=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{}).CustomEvent,Ht=function(){try{var e=new Gt("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?Gt:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=Boolean(t.bubbles),n.cancelable=Boolean(t.cancelable),n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n},Kt=[],Vt="NOT_LOADED",qt="LOADING_SOURCE_CODE",Wt="NOT_BOOTSTRAPPED",Yt="BOOTSTRAPPING",$t="NOT_MOUNTED",Jt="MOUNTING",Zt="MOUNTED",Qt="UPDATING",Xt="UNMOUNTING",en="UNLOADING",tn="LOAD_ERROR",nn="SKIP_BECAUSE_BROKEN",rn=[],on=!1,an=!1,un=0,sn={parcels:{}},cn={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}},ln="undefined"!=typeof window,fn={hashchange:[],popstate:[]},dn=["hashchange","popstate"],hn=null,pn=!1;ln&&(window.singleSpaNavigate?console.warn(m(41,!1)):window.singleSpaNavigate=H);var yn=!1,vn={},mn=[],gn=!1,bn=!1,wn=[],_n=ln&&window.location.href;function Sn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(bn)return new Promise((function(e,n){wn.push({resolve:e,reject:n,eventArguments:t})}));var r,i=function(){var e=[],t=[],n=[],r=[],o=(new Date).getTime();return mn.forEach((function(i){var a=i.status!==nn&&w(i);switch(i.status){case tn:a&&o-i.loadErrorTime>=200&&n.push(i);break;case Vt:case qt:a&&n.push(i);break;case Wt:case $t:!a&&ee(_(i))?e.push(i):a&&r.push(i);break;case Zt:a||t.push(i)}})),{appsToUnload:e,appsToUnmount:t,appsToLoad:n,appsToMount:r}}(),a=i.appsToUnload,u=i.appsToUnmount,s=i.appsToLoad,c=i.appsToMount,l=[],f=_n,d=_n=window.location.href;return pe()?(bn=!0,r=a.concat(s,u,c),Promise.resolve().then((function(){return g(0===r.length?"before-no-app-change":"before-app-change",v(!0)),g("before-routing-event",v(!0,{cancelNavigation:h})),Promise.all(l).then((function(n){if(n.some((function(e){return e})))return hn.call(window.history,history.state,"",f.substring(location.origin.length)),_n=location.href,bn=!1,Sn(e,t,!0);var r=a.map(Z),o=u.map(P).map((function(e){return e.then(Z)})).concat(r),i=Promise.all(o);i.then((function(){g("before-mount-routing-event",v(!0))}),(function(e){throw e}));var l=s.map((function(e){return G(e).then((function(e){return de(e,i)}))})),d=c.filter((function(e){return s.indexOf(e)<0})).map((function(e){return de(e,i)}));return i.catch((function(e){throw y(),e})).then((function(){return y(),Promise.all(l.concat(d)).catch((function(t){throw e.forEach((function(e){return e.reject(t)})),t})).then(p).then((function(){}),(function(e){throw e}))}))}))}))):(r=s,Promise.resolve().then((function(){var e=s.map(G);return Promise.all(e).then(y).then((function(){return[]})).catch((function(e){throw y(),e})).finally((function(){}))})));function h(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);l.push(t.catch((function(e){return console.warn(Error(m(42,!1))),console.warn(e),!1})))}function p(){var t=te();e.forEach((function(e){return e.resolve(t)}));try{g(0===r.length?"no-app-change":"app-change",v()),g("routing-event",v())}catch(e){setTimeout((function(){throw e}))}if(bn=!1,wn.length>0){var n=wn;wn=[],Sn(n)}return t}function y(){n||(e.forEach((function(e){K(e.eventArguments)})),K(t))}function v(){var e,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1?arguments[1]:void 0,l={},h=(o(e={},Zt,[]),o(e,$t,[]),o(e,Vt,[]),o(e,nn,[]),e);n?(s.concat(c).forEach((function(e,t){y(e,Zt)})),a.forEach((function(e){y(e,Vt)})),u.forEach((function(e){y(e,$t)}))):r.forEach((function(e){y(e)}));var p={detail:{newAppStatuses:l,appsByNewStatus:h,totalAppChanges:r.length,originalEvent:null==t?void 0:t[0],oldUrl:f,newUrl:d}};return i&&O(p.detail,i),p;function y(e,t){var n=_(e);t=t||re(n),l[n]=t,(h[t]=h[t]||[]).push(n)}}function g(e,t){n||window.dispatchEvent(new Ht("single-spa:".concat(e),t))}}var En=!1,On={getRawAppData:function(){return function(e){if(Array.isArray(e))return r(e)}(e=mn)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var e},reroute:Sn,NOT_LOADED:Vt,toLoadPromise:G,toBootstrapPromise:j,unregisterApplication:ae,getProfilerData:function(){return rn}};ln&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=On);var xn="openmrs:history";function An(e,t,n){return An=ge()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Tn(o,n.prototype),o},An.apply(null,arguments)}function kn(e){return kn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPr