@openmrs/esm-api
Advanced tools
Comparing version 6.0.1-pre.2549 to 6.0.1-pre.2550
/*! For license information please see openmrs-esm-api.js.LICENSE.txt */ | ||
System.register(["@openmrs/esm-config","@openmrs/esm-navigation","@openmrs/esm-error-handling","@openmrs/esm-offline"],(function(t,e){var r={},n={},o={},i={};return{setters:[function(t){r.Type=t.Type,r.defineConfigSchema=t.defineConfigSchema,r.getConfig=t.getConfig,r.validators=t.validators},function(t){n.navigate=t.navigate},function(t){o.reportError=t.reportError},function(t){i.getSynchronizationItems=t.getSynchronizationItems}],execute:function(){t((()=>{var t={385:()=>{System.register(["@openmrs/esm-utils"],(function(t,e){var r={};return{setters:[function(t){r.shallowEqual=t.shallowEqual}],execute:function(){t(function(){"use strict";var t={618:function(t){t.exports=r}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){var t=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},e=function(t,e){var r=l[t];if(r)return r.active?console.error("Attempted to override the existing store ".concat(t,". Make sure that stores are only created once.")):r.value.setState(e,!0),r.active=!0,r.value;var n=c()((function(){return e}));return l[t]={value:n,active:!0},n},r=function(t,e){var r=l[t];return r?(r.active?console.error("Attempted to override the existing store ".concat(t,". Make sure that stores are only created once.")):r.value=e,r.active=!0,r.value):(l[t]={value:e,active:!0},e)},i=function(t,e){var r=l[t];if(!r){var n=c()((function(){return null!=e?e:{}}));return l[t]={value:n,active:!1},n}return r.value},s=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o,i=function(t){if(Array.isArray(t))return t}(o=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,u=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),3!==i.length);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(u)throw o}}return i}}(o)||function(e,r){if(e){if("string"==typeof e)return t(e,3);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)?t(e,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.")}(),s=i[0],a=i[1],c=i[2],l=void 0===c?a:c,f=void 0===c?function(t){return t}:a;return l(f(s.getState())),s.subscribe((function(t,e){var r=f(t);(0,u.shallowEqual)(e,r)||l(r)}))};n.r(o),n.d(o,{createGlobalStore:function(){return e},getGlobalStore:function(){return i},registerGlobalStore:function(){return r},subscribeTo:function(){return s}});var u=n(618),a=function(t){var e,r=new Set,n=function(t,n){var o="function"==typeof t?t(e):t;if(!Object.is(o,e)){var i=e;e=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},e,o),r.forEach((function(t){return t(e,i)}))}},o=function(){return e},i={setState:n,getState:o,getInitialState:function(){return s},subscribe:function(t){return r.add(t),function(){return r.delete(t)}},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."),r.clear()}},s=e=t(n,o,i);return i},c=function(t){return t?a(t):a},l={};setTimeout((function(){"development"===window.spaEnv&&(window.stores=l)}),1e3)}(),o}())}}}))},824:t=>{"use strict";t.exports=r},254:t=>{"use strict";t.exports=o},513:t=>{"use strict";t.exports=n},738:t=>{"use strict";t.exports=i}},e={};function s(r){var n=e[r];if(void 0!==n)return n.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,s),o.exports}s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return(()=>{"use strict";s.r(u),s.d(u,{OpenmrsFetchError:()=>Fe,VisitMode:()=>xr,VisitStatus:()=>Nr,attachmentUrl:()=>Je,backendDependencies:()=>nn,clearCurrentUser:()=>cr,createAttachment:()=>Ye,defaultVisitCustomRepresentation:()=>Lr,deleteAttachmentPermanently:()=>Qe,fetchCurrentPatient:()=>_r,fhirBaseUrl:()=>Be,getAttachmentByUuid:()=>qe,getAttachments:()=>ze,getCurrentUser:()=>ir,getLocations:()=>rn,getLoggedInUser:()=>fr,getSessionLocation:()=>pr,getSessionStore:()=>sr,getStartedVisit:()=>Fr,getVisitStore:()=>Br,getVisitTypes:()=>tn,getVisitsForPatient:()=>Wr,makeUrl:()=>Ge,openmrsFetch:()=>Ve,openmrsObservableFetch:()=>We,refetchCurrentUser:()=>ar,restBaseUrl:()=>Re,saveVisit:()=>Gr,sessionEndpoint:()=>$e,sessionStore:()=>nr,setCurrentVisit:()=>$r,setSessionLocation:()=>hr,setUserLanguage:()=>ur,setUserProperties:()=>yr,setupApiModule:()=>mr,toLocationObject:()=>en,toVisitTypeObject:()=>Zr,updateVisit:()=>Vr,userHasAccess:()=>lr});var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},t(e,r)};function e(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function r(t){return"function"==typeof t}var n=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,n=t},get useDeprecatedSynchronousErrorHandling(){return n}};function i(t){setTimeout((function(){throw t}),0)}var a={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;i(t)},complete:function(){}},c=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function l(t){return null!==t&&"object"==typeof t}var f=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),p=f,h=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this,o=n._parentOrParents,i=n._ctorUnsubscribe,s=n._unsubscribe,u=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,o instanceof t)o.remove(this);else if(null!==o)for(var a=0;a<o.length;++a)o[a].remove(this);if(r(s)){i&&(this._unsubscribe=void 0);try{s.call(this)}catch(t){e=t instanceof p?d(t.errors):[t]}}if(c(u)){a=-1;for(var f=u.length;++a<f;){var h=u[a];if(l(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof p?e=e.concat(d(t.errors)):e.push(t)}}}if(e)throw new p(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function d(t){return t.reduce((function(t,e){return t.concat(e instanceof p?e.errors:e)}),[])}var y=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),b=function(t){function r(e,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=a;break;case 1:if(!e){i.destination=a;break}if("object"==typeof e){e instanceof r?(i.syncErrorThrowable=e.syncErrorThrowable,i.destination=e,e.add(i)):(i.syncErrorThrowable=!0,i.destination=new v(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new v(i,e,n,o)}return i}return e(r,t),r.prototype[y]=function(){return this},r.create=function(t,e,n){var o=new r(t,e,n);return o.syncErrorThrowable=!1,o},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},r.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},r.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},r}(h),v=function(t){function n(e,n,o,i){var s,u=t.call(this)||this;u._parentSubscriber=e;var c=u;return r(n)?s=n:n&&(s=n.next,o=n.error,i=n.complete,n!==a&&(r((c=Object.create(n)).unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=s,u._error=o,u._complete=i,u}return e(n,t),n.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},n.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=o.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):i(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;i(t)}}},n.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},n.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw t;i(t)}},n.prototype.__tryOrSetError=function(t,e,r){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(i(e),!0)}return!1},n.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},n}(b),m=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function w(t){return t}var g=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=function(t,e,r){if(t){if(t instanceof b)return t;if(t[y])return t[y]()}return t||e||r?new b(t,e,r):new b(a)}(t,e,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||o.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),o.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){var e=t,r=e.closed,n=e.destination,o=e.isStopped;if(r||o)return!1;t=n&&n instanceof b?n:null}return!0}(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=E(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[m]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:(0===(r=t).length?w:1===r.length?r[0]:function(t){return r.reduce((function(t,e){return e(t)}),t)})(this);var r},t.prototype.toPromise=function(t){var e=this;return new(t=E(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function E(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const S="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const P=(S||O||Function("return this")()).Symbol;var _=Object.prototype,T=_.hasOwnProperty,A=_.toString,j=P?P.toStringTag:void 0;var x=Object.prototype.toString;var N=P?P.toStringTag:void 0;const D=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":N&&N in Object(t)?function(t){var e=T.call(t,j),r=t[j];try{t[j]=void 0;var n=!0}catch(t){}var o=A.call(t);return n&&(e?t[j]=r:delete t[j]),o}(t):function(t){return x.call(t)}(t)},U=(M=Object.getPrototypeOf,k=Object,function(t){return M(k(t))});var M,k;var C=Function.prototype,I=Object.prototype,L=C.toString,R=I.hasOwnProperty,B=L.call(Object);const $=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=D(t))return!1;var e=U(t);if(null===e)return!0;var r=R.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&L.call(r)==B};var G=s(824),V=s(513),W=s(385);(0,W.createGlobalStore)("breadcrumbs",[]);var F=Object.freeze({__proto__:null,get start(){return Te},get ensureJQuerySupport(){return te},get setBootstrapMaxTime(){return kt},get setMountMaxTime(){return Ct},get setUnmountMaxTime(){return It},get setUnloadMaxTime(){return Lt},get registerApplication(){return pe},get unregisterApplication(){return de},get getMountedApps(){return ae},get getAppStatus(){return le},get unloadApplication(){return ye},get checkActivityFunctions(){return he},get getAppNames(){return ce},get pathToActiveWhen(){return me},get navigateToUrl(){return Ft},get patchHistoryApi(){return Qt},get triggerAppChange(){return Se},get addErrorHandler(){return Y},get removeErrorHandler(){return K},get mountRootParcel(){return xt},get NOT_LOADED(){return Z},get LOADING_SOURCE_CODE(){return tt},get NOT_BOOTSTRAPPED(){return et},get BOOTSTRAPPING(){return rt},get NOT_MOUNTED(){return nt},get MOUNTING(){return ot},get UPDATING(){return st},get LOAD_ERROR(){return ct},get MOUNTED(){return it},get UNLOADING(){return at},get UNMOUNTING(){return ut},get SKIP_BECAUSE_BROKEN(){return lt}}),H=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,J=function(){try{var t=new H("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?H:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var r=document.createEvent("CustomEvent");return e?r.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,e){var r=document.createEventObject();return r.type=t,e?(r.bubbles=Boolean(e.bubbles),r.cancelable=Boolean(e.cancelable),r.detail=e.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r};let q=[];function z(t,e,r){const n=X(t,e,r);q.length?q.forEach((t=>t(n))):setTimeout((()=>{throw n}))}function Y(t){if("function"!=typeof t)throw Error(Q(28,!1));q.push(t)}function K(t){if("function"!=typeof t)throw Error(Q(29,!1));let e=!1;return q=q.filter((r=>{const n=r===t;return e=e||n,!n})),e}function Q(t,e,...r){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${r.length?`&arg=${r.join("&arg=")}`:""}`}function X(t,e,r){const n=`${yt(e)} '${ht(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=n+t.message}catch(t){}o=t}else{console.warn(Q(30,!1,e.status,ht(e)));try{o=Error(n+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=ht(e),e.status=r,o}const Z="NOT_LOADED",tt="LOADING_SOURCE_CODE",et="NOT_BOOTSTRAPPED",rt="BOOTSTRAPPING",nt="NOT_MOUNTED",ot="MOUNTING",it="MOUNTED",st="UPDATING",ut="UNMOUNTING",at="UNLOADING",ct="LOAD_ERROR",lt="SKIP_BECAUSE_BROKEN";function ft(t){return t.status===it}function pt(t){try{return t.activeWhen(window.location)}catch(e){return z(e,t,lt),!1}}function ht(t){return t.name}function dt(t){return Boolean(t.unmountThisParcel)}function yt(t){return dt(t)?"parcel":"application"}function bt(){for(let t=arguments.length-1;t>0;t--)for(let e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function vt(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return t[r];return null}function mt(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!vt(e,(t=>"function"!=typeof t))));var e}function wt(t,e){let r=t[e]||[];r=Array.isArray(r)?r:[r],0===r.length&&(r=[()=>Promise.resolve()]);const n=yt(t),o=ht(t);return function(t){return r.reduce(((r,i,s)=>r.then((()=>{const r=i(t);return gt(r)?r:Promise.reject(Q(15,!1,n,o,e,s))}))),Promise.resolve())}}function gt(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}let Et=[];function St(t,e){return Promise.resolve().then((()=>t.status!==et?t:(t.status=rt,t.bootstrap?Rt(t,"bootstrap").then(r).catch((r=>{if(e)throw X(r,t,lt);return z(r,t,lt),t})):Promise.resolve().then(r))));function r(){return t.status=nt,t}}function Ot(t,e){return Promise.resolve().then((()=>{if(t.status!==it)return t;t.status=ut;const r=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(r).then(n,(r=>n().then((()=>{const n=Error(r.message);if(e)throw X(n,t,lt);z(n,t,lt)})))).then((()=>t));function n(){return Rt(t,"unmount").then((()=>{t.status=nt}),(r=>{if(e)throw X(r,t,lt);z(r,t,lt)}))}}))}let Pt=!1,_t=!1;function Tt(t,e){return Promise.resolve().then((()=>t.status!==nt?t:(Pt||(window.dispatchEvent(new J("single-spa:before-first-mount")),Pt=!0),t.status=ot,Rt(t,"mount").then((()=>(t.status=it,_t||(window.dispatchEvent(new J("single-spa:first-mount")),_t=!0),t))).catch((r=>{return t.status=it,Ot(t,!0).then(n,n);function n(){if(e)throw X(r,t,lt);return z(r,t,lt),t}})))))}let At=0;const jt={parcels:{}};function xt(){return Nt.apply(jt,arguments)}function Nt(t,e){const r=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(Q(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(Q(3,!1,typeof t.name));const n=At++;let o=t.name||`parcel-${n}`;if("object"!=typeof e)throw Error(Q(4,!1,o,typeof e));if(!e.domElement)throw Error(Q(5,!1,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),u={id:n,parcels:{},status:i?tt:et,customProps:e,parentName:ht(r),unmountThisParcel:()=>f.then((()=>{if(u.status!==it)throw Error(Q(6,!1,o,u.status));return Ot(u,!0)})).then((t=>(u.parentName&&delete r.parcels[u.id],t))).then((t=>(p(t),t))).catch((t=>{throw u.status=lt,h(t),t}))};let a;r.parcels[n]=u;let c=s();if(!c||"function"!=typeof c.then)throw Error(Q(7,!1));c=c.then((t=>{if(!t)throw Error(Q(8,!1));if(o=t.name||`parcel-${n}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!mt(t.bootstrap))throw Error(Q(9,!1,o));if(!mt(t.mount))throw Error(Q(10,!1,o));if(!mt(t.unmount))throw Error(Q(11,!1,o));if(t.update&&!mt(t.update))throw Error(Q(12,!1,o));const e=wt(t,"bootstrap"),r=wt(t,"mount"),i=wt(t,"unmount");u.status=et,u.name=o,u.bootstrap=e,u.mount=r,u.unmount=i,u.timeouts=Bt(t.timeouts),t.update&&(u.update=wt(t,"update"),a.update=function(t){return u.customProps=t,Dt((e=u,Promise.resolve().then((()=>{if(e.status!==it)throw Error(Q(32,!1,ht(e)));return e.status=st,Rt(e,"update").then((()=>(e.status=it,e))).catch((t=>{throw X(t,e,lt)}))}))));var e})}));const l=c.then((()=>St(u,!0))),f=l.then((()=>Tt(u,!0)));let p,h;const d=new Promise(((t,e)=>{p=t,h=e}));return a={mount:()=>Dt(Promise.resolve().then((()=>{if(u.status!==nt)throw Error(Q(13,!1,o,u.status));return r.parcels[n]=u,Tt(u)}))),unmount:()=>Dt(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:Dt(c),bootstrapPromise:Dt(l),mountPromise:Dt(f),unmountPromise:Dt(d)},a}function Dt(t){return t.then((()=>null))}function Ut(t){const e=ht(t);let r="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(Q(40,!1),e,r));const n=bt({},r,{name:e,mountParcel:Nt.bind(t),singleSpa:F});return dt(t)&&(n.unmountSelf=t.unmountThisParcel),n}const Mt={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 kt(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(16,!1));Mt.bootstrap={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Ct(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(17,!1));Mt.mount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function It(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(18,!1));Mt.unmount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Lt(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(19,!1));Mt.unload={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Rt(t,e){const r=t.timeouts[e],n=r.warningMillis,o=yt(t);return new Promise(((i,s)=>{let u=!1,a=!1;t[e](Ut(t)).then((t=>{u=!0,i(t)})).catch((t=>{u=!0,s(t)})),setTimeout((()=>l(1)),n),setTimeout((()=>l(!0)),r.millis);const c=Q(31,!1,e,o,ht(t),r.millis);function l(t){if(!u)if(!0===t)a=!0,r.dieOnTimeout?s(Error(c)):console.error(c);else if(!a){const e=t,o=e*n;console.warn(c),o+n<r.millis&&setTimeout((()=>l(e+1)),n)}}}))}function Bt(t){const e={};for(let r in Mt)e[r]=bt({},Mt[r],t&&t[r]||{});return e}function $t(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==Z&&t.status!==ct)return t;let e,r;return t.status=tt,t.loadPromise=Promise.resolve().then((()=>{const n=t.loadApp(Ut(t));if(!gt(n))throw r=!0,Error(Q(33,!1,ht(t)));return n.then((r=>{let n;t.loadErrorTime=null,e=r,"object"!=typeof e&&(n=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!mt(e.bootstrap)&&(n=35),mt(e.mount)||(n=36),mt(e.unmount)||(n=37);const o=yt(e);if(n){let r;try{r=JSON.stringify(e)}catch(t){}return console.error(Q(n,!1,o,ht(t),r),e),z(void 0,t,lt),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=bt({},t.devtools.overlays,e.devtools.overlays)),t.status=et,t.bootstrap=wt(e,"bootstrap"),t.mount=wt(e,"mount"),t.unmount=wt(e,"unmount"),t.unload=wt(e,"unload"),t.timeouts=Bt(e.timeouts),delete t.loadPromise,t}))})).catch((e=>{let n;return delete t.loadPromise,r?n=lt:(n=ct,t.loadErrorTime=(new Date).getTime()),z(e,t,n),t}))}))}const Gt="undefined"!=typeof window,Vt={hashchange:[],popstate:[]},Wt=["hashchange","popstate"];function Ft(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(Q(14,!1));e=t.currentTarget.href,t.preventDefault()}const r=Xt(window.location.href),n=Xt(e);0===e.indexOf("#")?window.location.hash=n.hash:r.host!==n.host&&n.host?window.location.href=e:n.pathname===r.pathname&&n.search===r.search?window.location.hash=n.hash:window.history.pushState(null,null,e)}function Ht(t){if(t){const e=t[0].type;Wt.indexOf(e)>=0&&Vt[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let Jt;function qt(){Oe([],arguments)}function zt(t,e){return function(){const r=window.location.href,n=t.apply(this,arguments),o=window.location.href;return Jt&&r===o||window.dispatchEvent(function(t,e){let r;try{r=new PopStateEvent("popstate",{state:t})}catch(e){r=document.createEvent("PopStateEvent"),r.initPopStateEvent("popstate",!1,!1,t)}return r.singleSpa=!0,r.singleSpaTrigger=e,r}(window.history.state,e)),n}}let Yt=null,Kt=!1;function Qt(t){if(Kt)throw Error(Q(43,!1));Jt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,Kt=!0,Yt=window.history.replaceState,window.addEventListener("hashchange",qt),window.addEventListener("popstate",qt);const e=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(t,r){if(!("function"==typeof r&&Wt.indexOf(t)>=0)||vt(Vt[t],(t=>t===r)))return e.apply(this,arguments);Vt[t].push(r)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&Wt.indexOf(t)>=0))return r.apply(this,arguments);Vt[t]=Vt[t].filter((t=>t!==e))},window.history.pushState=zt(window.history.pushState,"pushState"),window.history.replaceState=zt(Yt,"replaceState")}function Xt(t){const e=document.createElement("a");return e.href=t,e}Gt&&(window.singleSpaNavigate?console.warn(Q(41,!1)):window.singleSpaNavigate=Ft);let Zt=!1;function te(t=window.jQuery){if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!Zt){const e=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return ee.call(this,e,window.addEventListener,t,r,arguments)},t.fn.off=function(t,e){return ee.call(this,r,window.removeEventListener,t,e,arguments)},Zt=!0}}function ee(t,e,r,n,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach((t=>{Wt.indexOf(t)>=0&&(e(t,n),r=r.replace(t,""))})),""===r.trim()?this:t.apply(this,o))}const re={};function ne(t){return Promise.resolve().then((()=>{const e=re[ht(t)];if(!e)return t;if(t.status===Z)return oe(t,e),t;if(t.status===at)return e.promise.then((()=>t));if(t.status!==nt&&t.status!==ct)return t;const r=t.status===ct?Promise.resolve():Rt(t,"unload");return t.status=at,r.then((()=>(oe(t,e),t))).catch((r=>(function(t,e,r){delete re[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,z(r,t,lt),e.reject(r)}(t,e,r),t)))}))}function oe(t,e){delete re[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=Z,e.resolve()}function ie(t,e,r,n){re[ht(t)]={app:t,resolve:r,reject:n},Object.defineProperty(re[ht(t)],"promise",{get:e})}function se(t){return re[t]}const ue=[];function ae(){return ue.filter(ft).map(ht)}function ce(){return ue.map(ht)}function le(t){const e=vt(ue,(e=>ht(e)===t));return e?e.status:null}let fe=!1;function pe(t,e,r,n){const o=function(t,e,r,n){const o={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(Q(39,!1));const e=["name","app","activeWhen","customProps"],r=Object.keys(t).reduce(((t,r)=>e.indexOf(r)>=0?t:t.concat(r)),[]);if(0!==r.length)throw Error(Q(38,!1,e.join(", "),r.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(Q(20,!1));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(Q(20,!1));const n=t=>"string"==typeof t||"function"==typeof t;if(!(n(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(n)))throw Error(Q(24,!1));if(!ve(t.customProps))throw Error(Q(22,!1))}(t),o.name=t.name,o.loadApp=t.app,o.activeWhen=t.activeWhen,o.customProps=t.customProps):(function(t,e,r,n){if("string"!=typeof t||0===t.length)throw Error(Q(20,!1));if(!e)throw Error(Q(23,!1));if("function"!=typeof r)throw Error(Q(24,!1));if(!ve(n))throw Error(Q(22,!1))}(t,e,r,n),o.name=t,o.loadApp=e,o.activeWhen=r,o.customProps=n),o.loadApp="function"!=typeof(i=o.loadApp)?()=>Promise.resolve(i):i,o.customProps=function(t){return t||{}}(o.customProps),o.activeWhen=function(t){let e=Array.isArray(t)?t:[t];return e=e.map((t=>"function"==typeof t?t:me(t))),t=>e.some((e=>e(t)))}(o.activeWhen),o;var i}(t,e,r,n);if(Ae()||fe||(fe=!0,setTimeout((()=>{Ae()||console.warn(Q(1,!1))}),5e3)),-1!==ce().indexOf(o.name))throw Error(Q(21,!1,o.name));ue.push(bt({loadErrorTime:null,status:Z,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),Gt&&(te(),Oe())}function he(t=window.location){return ue.filter((e=>e.activeWhen(t))).map(ht)}function de(t){if(0===ue.filter((e=>ht(e)===t)).length)throw Error(Q(25,!1,t));return(Gt?ye(t,{waitForUnmount:!1}):Promise.resolve()).then((()=>{const e=ue.map(ht).indexOf(t);ue.splice(e,1)}))}function ye(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(Q(26,!1));const r=vt(ue,(e=>ht(e)===t));if(!r)throw Error(Q(27,!1,t));const n=se(ht(r));if(e&&e.waitForUnmount){if(n)return n.promise;{const t=new Promise(((e,n)=>{ie(r,(()=>t),e,n)}));return t}}{let t;return n?(t=n.promise,be(r,n.resolve,n.reject)):t=new Promise(((e,n)=>{ie(r,(()=>t),e,n),be(r,e,n)})),t}}function be(t,e,r){Promise.resolve().then((()=>{if(vt(he(),(e=>e===ht(t))))return Se()})).then((()=>Ot(t).then(ne).then((()=>{e(),setTimeout((()=>{Oe()}))})))).catch(r)}function ve(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function me(t,e){const r=function(t,e){let r=0,n=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const r=t[e];(!n&&":"===r||n&&"/"===r)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(r,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=n?"[^/]+/?":s,i===t.length)if(n)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}n=!n,r=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const n=t.href.replace(e,"").replace(t.search,"").split("?")[0];return r.test(n)}}let we=!1,ge=[],Ee=Gt&&window.location.href;function Se(){return Oe()}function Oe(t=[],e,r=!1){if(we)return new Promise(((t,r)=>{ge.push({resolve:t,reject:r,eventArguments:e})}));const{appsToUnload:n,appsToUnmount:o,appsToLoad:i,appsToMount:s}=function(){const t=[],e=[],r=[],n=[],o=(new Date).getTime();return ue.forEach((i=>{const s=i.status!==lt&&pt(i);switch(i.status){case ct:s&&o-i.loadErrorTime>=200&&r.push(i);break;case Z:case tt:s&&r.push(i);break;case et:case nt:!s&&se(ht(i))?t.push(i):s&&n.push(i);break;case it:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:r,appsToMount:n}}();let u,a=[],c=Ee,l=Ee=window.location.href;return Ae()?(we=!0,u=n.concat(i,o,s),Promise.resolve().then((()=>(y(0===u.length?"before-no-app-change":"before-app-change",d(!0)),y("before-routing-event",d(!0,{cancelNavigation:f})),Promise.all(a).then((r=>{if(r.some((t=>t)))return Yt.call(window.history,history.state,"",c.substring(location.origin.length)),Ee=location.href,we=!1,Oe(t,e,!0);const u=n.map(ne),a=o.map(Ot).map((t=>t.then(ne))).concat(u),l=Promise.all(a);l.then((()=>{y("before-mount-routing-event",d(!0))}),(t=>{throw t}));const f=i.map((t=>$t(t).then((t=>Pe(t,l))))),b=s.filter((t=>i.indexOf(t)<0)).map((t=>Pe(t,l)));return l.catch((t=>{throw h(),t})).then((()=>(h(),Promise.all(f.concat(b)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then(p).then((()=>{}),(t=>{throw t})))))})))))):(u=i,Promise.resolve().then((()=>{const t=i.map($t);return Promise.all(t).then(h).then((()=>[])).catch((t=>{throw h(),t})).finally((()=>{}))})));function f(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);a.push(e.catch((t=>(console.warn(Error(Q(42,!1))),console.warn(t),!1))))}function p(){const e=ae();t.forEach((t=>t.resolve(e)));try{y(0===u.length?"no-app-change":"app-change",d()),y("routing-event",d())}catch(t){setTimeout((()=>{throw t}))}if(we=!1,ge.length>0){const t=ge;ge=[],Oe(t)}return e}function h(){r||(t.forEach((t=>{Ht(t.eventArguments)})),Ht(e))}function d(t=!1,r){const a={},f={[it]:[],[nt]:[],[Z]:[],[lt]:[]};t?(i.concat(s).forEach(((t,e)=>{h(t,it)})),n.forEach((t=>{h(t,Z)})),o.forEach((t=>{h(t,nt)}))):u.forEach((t=>{h(t)}));const p={detail:{newAppStatuses:a,appsByNewStatus:f,totalAppChanges:u.length,originalEvent:null==e?void 0:e[0],oldUrl:c,newUrl:l}};return r&&bt(p.detail,r),p;function h(t,e){const r=ht(t);e=e||le(r),a[r]=e,(f[e]=f[e]||[]).push(r)}}function y(t,e){r||window.dispatchEvent(new J(`single-spa:${t}`,e))}}function Pe(t,e){return pt(t)?St(t).then((t=>e.then((()=>pt(t)?Tt(t):t)))):e.then((()=>t))}let _e=!1;function Te(t){_e=!0,Gt&&(Qt(t),Oe())}function Ae(){return _e}var je={getRawAppData:function(){return[...ue]},reroute:Oe,NOT_LOADED:Z,toLoadPromise:$t,toBootstrapPromise:St,unregisterApplication:de,getProfilerData:function(){return Et}};Gt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=je);var xe="openmrs:history";function Ne(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function De(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function Ue(t,e,r){return Ue=Le()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&Ce(o,r.prototype),o},Ue.apply(null,arguments)}function Me(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ke(t){return ke=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ke(t)}function Ce(t,e){return Ce=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ce(t,e)}function Ie(t){var e="function"==typeof Map?new Map:void 0;return Ie=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return Ue(t,arguments,ke(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ce(n,t)},Ie(t)}function Le(){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(t){return!1}}var Re="/ws/rest/v1",Be="/ws/fhir2/R4",$e="".concat(Re,"/session");function Ge(t){return t&&t.startsWith("http")?t:("/"!==t[0]&&(t="/"+t),window.openmrsBase+t)}function Ve(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof e)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 r=Ge(t);if(e.headers||(e.headers={}),$(e.body)&&(e.body=JSON.stringify(e.body)),void 0===e.headers.Accept&&(e.headers.Accept="application/json"),null===e.headers.Accept&&delete e.headers.Accept,t.startsWith(Re)&&void 0===e.headers["Disable-WWW-Authenticate"]&&(e.headers["Disable-WWW-Authenticate"]="true"),t.startsWith(Be)){var n=new URL(r,window.location.toString());n.searchParams.has("_summary")||(n.searchParams.set("_summary","data"),r=n.toString())}var o,i,s=Error();return window.fetch(r,e).then((o=function(t){var e,n;return function(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(o){switch(o.label){case 0:return(e=t).ok?204===e.status?(e.data=null,[2,e]):[2,e.clone().text().then((function(t){try{t&&(e.data=JSON.parse(t))}catch(t){}return e}))]:[3,1];case 1:return[4,(0,G.getConfig)("@openmrs/esm-api")];case 2:return n=o.sent().redirectAuthFailure,r===Ge($e)&&403===e.status||n.enabled&&n.errors.includes(e.status)?(sessionStorage.removeItem(xe),(0,V.navigate)({to:n.url}),[2,n.resolvePromise?Promise.resolve():new Promise((function(){}))]):[2,e.clone().text().then((function(t){var n=t;try{n=JSON.parse(t)}catch(t){}throw new Fe(r,e,n,s)}),(function(t){throw new Fe(r,e,null,s)}))];case 3:return[2]}}))},i=function(){var t=this,e=arguments;return new Promise((function(r,n){var i=o.apply(t,e);function s(t){De(i,r,n,s,u,"next",t)}function u(t){De(i,r,n,s,u,"throw",t)}s(void 0)}))},function(t){return i.apply(this,arguments)}))}function We(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof e)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");var r=new AbortController;return e.signal=r.signal,new g((function(n){var o=!1;return Ve(t,e).then((function(t){o=!0,n.next(t),n.complete()}),(function(t){o=!0,n.error(t)})),function(){o||r.abort()}}))}var Fe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ce(t,e)}(o,t);var e,r,n=(e=o,r=Le(),function(){var t,n=ke(e);if(r){var o=ke(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return function(t,e){return!e||"object"!=((r=e)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof e?Ne(t):e;var r}(this,t)});function o(t,e,r,i){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),Me(Ne(s=n.call(this)),"response",void 0),Me(Ne(s),"responseBody",void 0),s.message="Server responded with ".concat(e.status," (").concat(e.statusText,") for url ").concat(t,". Check err.responseBody or network tab in dev tools for more info"),i.message=s.message,s.responseBody=r,s.response=e,s.stack="Stacktrace for outgoing request:\n".concat(i.stack,"\nStacktrace for incoming response:\n").concat(s.stack),s}return o}(Ie(Error));function He(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}var Je="".concat(Re,"/attachment");function qe(t,e){return Ve("".concat(Je,"/").concat(t),{signal:e.signal})}function ze(t,e,r){return Ve("".concat(Je,"?patient=").concat(t,"&includeEncounterless=").concat(e),{signal:r.signal})}function Ye(t,e){return Ke.apply(this,arguments)}function Ke(){var t;return t=function(t,e){var r;return function(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(n){return(r=new FormData).append("fileCaption",e.fileDescription),r.append("patient",t),e.file?r.append("file",e.file,e.fileName):(r.append("file",new File([""],e.fileName),e.fileName),r.append("base64Content",e.base64Content)),[2,Ve("".concat(Je),{method:"POST",body:r})]}))},Ke=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){He(i,n,o,s,u,"next",t)}function u(t){He(i,n,o,s,u,"throw",t)}s(void 0)}))},Ke.apply(this,arguments)}function Qe(t,e){return Ve("".concat(Je,"/").concat(t),{method:"DELETE",signal:e.signal})}var Xe=s(254);const Ze=function(t){return void 0===t};function tr(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function er(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){tr(i,n,o,s,u,"next",t)}function u(t){tr(i,n,o,s,u,"throw",t)}s(void 0)}))}}function rr(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var nr=(0,W.createGlobalStore)("session",{loaded:!1,session:null}),or=0;function ir(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(or<Date.now()-6e4||!nr.getState().loaded)&&ar(),new g((function(e){var r=function(r){var n;r.loaded&&(t.includeAuthStatus?e.next(r.session):e.next(null===(n=r.session)||void 0===n?void 0:n.user))};return r(nr.getState()),nr.subscribe(r)}))}function sr(){return(or<Date.now()-6e4||!nr.getState().loaded)&&ar(),nr}function ur(t){var e,r,n,o=null!==(n=null==t||null===(e=t.user)||void 0===e||null===(r=e.userProperties)||void 0===r?void 0:r.defaultLocale)&&void 0!==n?n:t.locale,i=document.documentElement.getAttribute("lang");(function(t){if(void 0===t||"string"!=typeof t)return!1;try{new Intl.Locale(t)}catch(t){return!1}return!0})(o)&&o!==i&&document.documentElement.setAttribute("lang",o)}function ar(t,e){or=Date.now();var r={};return t&&e&&(r.Authorization="Basic ".concat(window.btoa("".concat(t,":").concat(e)))),vr(Ve($e,{headers:r}))}function cr(){nr.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function lr(t,e){return void 0===e?Boolean(t):!Boolean(t)||function(t,e){return"string"==typeof t?!Ze(e.privileges.find((function(e){return t===e.display}))):Array.isArray(t)?t.every((function(t){return!Ze(e.privileges.find((function(e){return t===e.display})))})):(Ze(t)||console.error('Could not understand privileges "'.concat(t,'"')),!0)}(t,e)||function(t){return!Ze(t.roles.find((function(t){return"System Developer"===t.display})))}(e)}function fr(){var t,e;return new Promise((function(r){var n=function(n){n.loaded&&n.session.user&&(t=n.session.user,r(n.session.user),e&&e())};n(nr.getState()),t||(e=nr.subscribe(n))}))}function pr(){return new Promise((function(t,e){ir().subscribe((function(e){t(e.sessionLocation)}),e).unsubscribe()}))}function hr(t,e){return dr.apply(this,arguments)}function dr(){return(dr=er((function(t,e){return rr(this,(function(r){return[2,vr(Ve($e,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:e.signal}))]}))}))).apply(this,arguments)}function yr(t,e,r){return br.apply(this,arguments)}function br(){return(br=er((function(t,e,r){return rr(this,(function(n){switch(n.label){case 0:return r||(r=new AbortController),[4,Ve("".concat(Re,"/user/").concat(t),{method:"POST",body:{userProperties:e},headers:{"Content-Type":"application/json"},signal:r.signal})];case 1:return n.sent(),[2,ar()]}}))}))).apply(this,arguments)}function vr(t){return new Promise((function(e,r){t.then((function(t){var n;"object"==typeof(null==t?void 0:t.data)?(n={loaded:!0,session:t.data},nr.setState(n),e(n)):(n={loaded:!1,session:null},nr.setState(n),r(n))})).catch((function(t){(0,Xe.reportError)("Failed to fetch new session information: ".concat(t));var e={loaded:!1,session:null};nr.setState(e),r(e)}))}))}function mr(){(0,G.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:G.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:G.Type.String,_default:"${openmrsSpaBase}/login",_validators:[G.validators.isUrl]},errors:{_type:G.Type.Array,_default:[401],_elements:{_type:G.Type.Number,_validators:[G.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:G.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."}}}),ar()}nr.subscribe((function(t){return t.session&&ur(t.session)}));var wr=s(738);function gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Er(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function Sr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){Er(i,n,o,s,u,"next",t)}function u(t){Er(i,n,o,s,u,"throw",t)}s(void 0)}))}}function Or(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,u=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return gr(t,e);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)?gr(t,e):void 0}}(t,e)||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.")}()}function Pr(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function _r(t,e){return Tr.apply(this,arguments)}function Tr(){return Tr=Sr((function(t,e){var r,n,o,i,s,u=arguments;return Pr(this,(function(a){switch(a.label){case 0:return r=!(u.length>2&&void 0!==u[2])||u[2],t?(n=null,[4,Promise.all([Ve("".concat(Be,"/Patient/").concat(t),e).catch((function(t){return n=t})),r?Ar(t):Promise.resolve(null)])]):[3,2];case 1:if(o=Or.apply(void 0,[a.sent(),2]),i=o[0],s=o[1],i.ok)return[2,i.data];if(s)return[2,s];if(n)throw n;a.label=2;case 2:return[2,null]}}))})),Tr.apply(this,arguments)}function Ar(t){return jr.apply(this,arguments)}function jr(){return(jr=Sr((function(t){var e,r,n;return Pr(this,(function(o){switch(o.label){case 0:return[4,(0,wr.getSynchronizationItems)("patient-registration")];case 1:return e=o.sent(),r=e.find((function(e){return e.fhirPatient.id===t})),[2,null!==(n=null==r?void 0:r.fhirPatient)&&void 0!==n?n:null]}}))}))).apply(this,arguments)}var xr,Nr,Dr=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),Ur=function(t){function r(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return e(r,t),r.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},r}(h),Mr=function(t){function r(e){var r=t.call(this,e)||this;return r.destination=e,r}return e(r,t),r}(b),kr=function(t){function r(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return e(r,t),r.prototype[y]=function(){return new Mr(this)},r.prototype.lift=function(t){var e=new Cr(this,this);return e.operator=t,e},r.prototype.next=function(t){if(this.closed)throw new Dr;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},r.prototype.error=function(t){if(this.closed)throw new Dr;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].error(t);this.observers.length=0},r.prototype.complete=function(){if(this.closed)throw new Dr;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},r.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},r.prototype._trySubscribe=function(e){if(this.closed)throw new Dr;return t.prototype._trySubscribe.call(this,e)},r.prototype._subscribe=function(t){if(this.closed)throw new Dr;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new Ur(this,t))},r.prototype.asObservable=function(){var t=new g;return t.source=this,t},r.create=function(t,e){return new Cr(t,e)},r}(g),Cr=function(t){function r(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return e(r,t),r.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},r.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},r.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},r.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):h.EMPTY},r}(kr),Ir=function(t){function r(e){var r=t.call(this)||this;return r._value=e,r}return e(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),r.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},r.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new Dr;return this._value},r.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},r}(kr);!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(xr||(xr={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Nr||(Nr={}));var Lr="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))",Rr=function(){try{return JSON.parse(localStorage.getItem("openmrs:visitStoreState")||"null")}catch(t){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function Br(){return(0,W.getGlobalStore)("visit",Rr)}function $r(t,e){Br().setState({patientUuid:t,manuallySetVisitUuid:e})}function Gr(t,e){return Ve("".concat(Re,"/visit"),{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function Vr(t,e,r){return Ve("".concat(Re,"/visit/").concat(t),{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function Wr(t,e,r){var n=null!=r?r:Lr;return Ve("".concat(Re,"/visit?patient=").concat(t,"&v=").concat(n),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}})}Br().subscribe((function(t){var e;e=t,localStorage.setItem("openmrs:visitStoreState",JSON.stringify(e))}));var Fr=new Ir(null);function Hr(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new Jr(t,e))}}var Jr=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new qr(t,this.project,this.thisArg))},t}(),qr=function(t){function r(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return e(r,t),r.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},r}(b),zr=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}(),Yr=new g((function(t){return t.complete()}));function Kr(t){return function(e){return 0===t?r?function(t){return new g((function(e){return t.schedule((function(){return e.complete()}))}))}(r):Yr:e.lift(new Qr(t));var r}}var Qr=function(){function t(t){if(this.total=t,this.total<0)throw new zr}return t.prototype.call=function(t,e){return e.subscribe(new Xr(t,this.total))},t}(),Xr=function(t){function r(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return e(r,t),r.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},r}(b);function Zr(t){return{uuid:t.uuid,display:t.display,name:t.name}}function tn(){return We("".concat(Re,"/visittype")).pipe(Hr((function(t){return t.data.results.map(Zr)}))).pipe(Kr(1))}function en(t){return{uuid:t.uuid,display:t.display}}function rn(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=new URLSearchParams;t&&r.set("tag",t),e&&r.set("q",e);var n=r.toString();return We("".concat(Re,"/location").concat(n?"?"+n:"")).pipe(Hr((function(t){return t.data.results.map(en)}))).pipe(Kr(1))}var nn={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),u})())}}})); | ||
System.register(["@openmrs/esm-config","@openmrs/esm-navigation","@openmrs/esm-error-handling","@openmrs/esm-offline"],(function(t,e){var r={},n={},o={},i={};return{setters:[function(t){r.Type=t.Type,r.defineConfigSchema=t.defineConfigSchema,r.getConfig=t.getConfig,r.validators=t.validators},function(t){n.navigate=t.navigate},function(t){o.reportError=t.reportError},function(t){i.getSynchronizationItems=t.getSynchronizationItems}],execute:function(){t((()=>{var t={385:()=>{System.register(["@openmrs/esm-utils"],(function(t,e){var r={};return{setters:[function(t){r.shallowEqual=t.shallowEqual}],execute:function(){t(function(){"use strict";var t={618:function(t){t.exports=r}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){var t=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},e=function(t,e){var r=l[t];if(r)return r.active?console.error("Attempted to override the existing store ".concat(t,". Make sure that stores are only created once.")):r.value.setState(e,!0),r.active=!0,r.value;var n=c()((function(){return e}));return l[t]={value:n,active:!0},n},r=function(t,e){var r=l[t];return r?(r.active?console.error("Attempted to override the existing store ".concat(t,". Make sure that stores are only created once.")):r.value=e,r.active=!0,r.value):(l[t]={value:e,active:!0},e)},i=function(t,e){var r=l[t];if(!r){var n=c()((function(){return null!=e?e:{}}));return l[t]={value:n,active:!1},n}return r.value},s=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o,i=function(t){if(Array.isArray(t))return t}(o=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,u=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),3!==i.length);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(u)throw o}}return i}}(o)||function(e,r){if(e){if("string"==typeof e)return t(e,3);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)?t(e,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.")}(),s=i[0],a=i[1],c=i[2],l=void 0===c?a:c,f=void 0===c?function(t){return t}:a;return l(f(s.getState())),s.subscribe((function(t,e){var r=f(t);(0,u.shallowEqual)(e,r)||l(r)}))};n.r(o),n.d(o,{createGlobalStore:function(){return e},getGlobalStore:function(){return i},registerGlobalStore:function(){return r},subscribeTo:function(){return s}});var u=n(618),a=function(t){var e,r=new Set,n=function(t,n){var o="function"==typeof t?t(e):t;if(!Object.is(o,e)){var i=e;e=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},e,o),r.forEach((function(t){return t(e,i)}))}},o=function(){return e},i={setState:n,getState:o,getInitialState:function(){return s},subscribe:function(t){return r.add(t),function(){return r.delete(t)}},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."),r.clear()}},s=e=t(n,o,i);return i},c=function(t){return t?a(t):a},l={};setTimeout((function(){"development"===window.spaEnv&&(window.stores=l)}),1e3)}(),o}())}}}))},824:t=>{"use strict";t.exports=r},254:t=>{"use strict";t.exports=o},513:t=>{"use strict";t.exports=n},738:t=>{"use strict";t.exports=i}},e={};function s(r){var n=e[r];if(void 0!==n)return n.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,s),o.exports}s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return(()=>{"use strict";s.r(u),s.d(u,{OpenmrsFetchError:()=>Fe,VisitMode:()=>xr,VisitStatus:()=>Nr,attachmentUrl:()=>Je,backendDependencies:()=>nn,clearCurrentUser:()=>cr,createAttachment:()=>Ye,defaultVisitCustomRepresentation:()=>Lr,deleteAttachmentPermanently:()=>Qe,fetchCurrentPatient:()=>Pr,fhirBaseUrl:()=>Be,getAttachmentByUuid:()=>qe,getAttachments:()=>ze,getCurrentUser:()=>ir,getLocations:()=>rn,getLoggedInUser:()=>fr,getSessionLocation:()=>pr,getSessionStore:()=>sr,getStartedVisit:()=>Fr,getVisitStore:()=>Br,getVisitTypes:()=>tn,getVisitsForPatient:()=>Wr,makeUrl:()=>Ge,openmrsFetch:()=>Ve,openmrsObservableFetch:()=>We,refetchCurrentUser:()=>ar,restBaseUrl:()=>Re,saveVisit:()=>Gr,sessionEndpoint:()=>$e,sessionStore:()=>nr,setCurrentVisit:()=>$r,setSessionLocation:()=>hr,setUserLanguage:()=>ur,setUserProperties:()=>yr,setupApiModule:()=>vr,toLocationObject:()=>en,toVisitTypeObject:()=>Zr,updateVisit:()=>Vr,userHasAccess:()=>lr});var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},t(e,r)};function e(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function r(t){return"function"==typeof t}var n=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,n=t},get useDeprecatedSynchronousErrorHandling(){return n}};function i(t){setTimeout((function(){throw t}),0)}var a={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;i(t)},complete:function(){}},c=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function l(t){return null!==t&&"object"==typeof t}var f=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),p=f,h=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this,o=n._parentOrParents,i=n._ctorUnsubscribe,s=n._unsubscribe,u=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,o instanceof t)o.remove(this);else if(null!==o)for(var a=0;a<o.length;++a)o[a].remove(this);if(r(s)){i&&(this._unsubscribe=void 0);try{s.call(this)}catch(t){e=t instanceof p?d(t.errors):[t]}}if(c(u)){a=-1;for(var f=u.length;++a<f;){var h=u[a];if(l(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof p?e=e.concat(d(t.errors)):e.push(t)}}}if(e)throw new p(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function d(t){return t.reduce((function(t,e){return t.concat(e instanceof p?e.errors:e)}),[])}var y=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),b=function(t){function r(e,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=a;break;case 1:if(!e){i.destination=a;break}if("object"==typeof e){e instanceof r?(i.syncErrorThrowable=e.syncErrorThrowable,i.destination=e,e.add(i)):(i.syncErrorThrowable=!0,i.destination=new m(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new m(i,e,n,o)}return i}return e(r,t),r.prototype[y]=function(){return this},r.create=function(t,e,n){var o=new r(t,e,n);return o.syncErrorThrowable=!1,o},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},r.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},r.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},r}(h),m=function(t){function n(e,n,o,i){var s,u=t.call(this)||this;u._parentSubscriber=e;var c=u;return r(n)?s=n:n&&(s=n.next,o=n.error,i=n.complete,n!==a&&(r((c=Object.create(n)).unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=s,u._error=o,u._complete=i,u}return e(n,t),n.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},n.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=o.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):i(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;i(t)}}},n.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},n.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw t;i(t)}},n.prototype.__tryOrSetError=function(t,e,r){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(i(e),!0)}return!1},n.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},n}(b),v=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function w(t){return t}var g=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=function(t,e,r){if(t){if(t instanceof b)return t;if(t[y])return t[y]()}return t||e||r?new b(t,e,r):new b(a)}(t,e,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||o.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),o.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){var e=t,r=e.closed,n=e.destination,o=e.isStopped;if(r||o)return!1;t=n&&n instanceof b?n:null}return!0}(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=E(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[v]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:(0===(r=t).length?w:1===r.length?r[0]:function(t){return r.reduce((function(t,e){return e(t)}),t)})(this);var r},t.prototype.toPromise=function(t){var e=this;return new(t=E(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function E(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const S="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const _=(S||O||Function("return this")()).Symbol;var P=Object.prototype,T=P.hasOwnProperty,A=P.toString,j=_?_.toStringTag:void 0;var x=Object.prototype.toString;var N=_?_.toStringTag:void 0;const D=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":N&&N in Object(t)?function(t){var e=T.call(t,j),r=t[j];try{t[j]=void 0;var n=!0}catch(t){}var o=A.call(t);return n&&(e?t[j]=r:delete t[j]),o}(t):function(t){return x.call(t)}(t)},U=(M=Object.getPrototypeOf,k=Object,function(t){return M(k(t))});var M,k;var C=Function.prototype,I=Object.prototype,L=C.toString,R=I.hasOwnProperty,B=L.call(Object);const $=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=D(t))return!1;var e=U(t);if(null===e)return!0;var r=R.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&L.call(r)==B};var G=s(824),V=s(513),W=s(385);(0,W.createGlobalStore)("breadcrumbs",[]);var F=Object.freeze({__proto__:null,get start(){return Te},get ensureJQuerySupport(){return te},get setBootstrapMaxTime(){return kt},get setMountMaxTime(){return Ct},get setUnmountMaxTime(){return It},get setUnloadMaxTime(){return Lt},get registerApplication(){return pe},get unregisterApplication(){return de},get getMountedApps(){return ae},get getAppStatus(){return le},get unloadApplication(){return ye},get checkActivityFunctions(){return he},get getAppNames(){return ce},get pathToActiveWhen(){return ve},get navigateToUrl(){return Ft},get patchHistoryApi(){return Qt},get triggerAppChange(){return Se},get addErrorHandler(){return Y},get removeErrorHandler(){return K},get mountRootParcel(){return xt},get NOT_LOADED(){return Z},get LOADING_SOURCE_CODE(){return tt},get NOT_BOOTSTRAPPED(){return et},get BOOTSTRAPPING(){return rt},get NOT_MOUNTED(){return nt},get MOUNTING(){return ot},get UPDATING(){return st},get LOAD_ERROR(){return ct},get MOUNTED(){return it},get UNLOADING(){return at},get UNMOUNTING(){return ut},get SKIP_BECAUSE_BROKEN(){return lt}}),H=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,J=function(){try{var t=new H("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?H:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var r=document.createEvent("CustomEvent");return e?r.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,e){var r=document.createEventObject();return r.type=t,e?(r.bubbles=Boolean(e.bubbles),r.cancelable=Boolean(e.cancelable),r.detail=e.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r};let q=[];function z(t,e,r){const n=X(t,e,r);q.length?q.forEach((t=>t(n))):setTimeout((()=>{throw n}))}function Y(t){if("function"!=typeof t)throw Error(Q(28,!1));q.push(t)}function K(t){if("function"!=typeof t)throw Error(Q(29,!1));let e=!1;return q=q.filter((r=>{const n=r===t;return e=e||n,!n})),e}function Q(t,e,...r){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${r.length?`&arg=${r.join("&arg=")}`:""}`}function X(t,e,r){const n=`${yt(e)} '${ht(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=n+t.message}catch(t){}o=t}else{console.warn(Q(30,!1,e.status,ht(e)));try{o=Error(n+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=ht(e),e.status=r,o}const Z="NOT_LOADED",tt="LOADING_SOURCE_CODE",et="NOT_BOOTSTRAPPED",rt="BOOTSTRAPPING",nt="NOT_MOUNTED",ot="MOUNTING",it="MOUNTED",st="UPDATING",ut="UNMOUNTING",at="UNLOADING",ct="LOAD_ERROR",lt="SKIP_BECAUSE_BROKEN";function ft(t){return t.status===it}function pt(t){try{return t.activeWhen(window.location)}catch(e){return z(e,t,lt),!1}}function ht(t){return t.name}function dt(t){return Boolean(t.unmountThisParcel)}function yt(t){return dt(t)?"parcel":"application"}function bt(){for(let t=arguments.length-1;t>0;t--)for(let e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function mt(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return t[r];return null}function vt(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!mt(e,(t=>"function"!=typeof t))));var e}function wt(t,e){let r=t[e]||[];r=Array.isArray(r)?r:[r],0===r.length&&(r=[()=>Promise.resolve()]);const n=yt(t),o=ht(t);return function(t){return r.reduce(((r,i,s)=>r.then((()=>{const r=i(t);return gt(r)?r:Promise.reject(Q(15,!1,n,o,e,s))}))),Promise.resolve())}}function gt(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}let Et=[];function St(t,e){return Promise.resolve().then((()=>t.status!==et?t:(t.status=rt,t.bootstrap?Rt(t,"bootstrap").then(r).catch((r=>{if(e)throw X(r,t,lt);return z(r,t,lt),t})):Promise.resolve().then(r))));function r(){return t.status=nt,t}}function Ot(t,e){return Promise.resolve().then((()=>{if(t.status!==it)return t;t.status=ut;const r=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(r).then(n,(r=>n().then((()=>{const n=Error(r.message);if(e)throw X(n,t,lt);z(n,t,lt)})))).then((()=>t));function n(){return Rt(t,"unmount").then((()=>{t.status=nt}),(r=>{if(e)throw X(r,t,lt);z(r,t,lt)}))}}))}let _t=!1,Pt=!1;function Tt(t,e){return Promise.resolve().then((()=>t.status!==nt?t:(_t||(window.dispatchEvent(new J("single-spa:before-first-mount")),_t=!0),t.status=ot,Rt(t,"mount").then((()=>(t.status=it,Pt||(window.dispatchEvent(new J("single-spa:first-mount")),Pt=!0),t))).catch((r=>{return t.status=it,Ot(t,!0).then(n,n);function n(){if(e)throw X(r,t,lt);return z(r,t,lt),t}})))))}let At=0;const jt={parcels:{}};function xt(){return Nt.apply(jt,arguments)}function Nt(t,e){const r=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(Q(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(Q(3,!1,typeof t.name));const n=At++;let o=t.name||`parcel-${n}`;if("object"!=typeof e)throw Error(Q(4,!1,o,typeof e));if(!e.domElement)throw Error(Q(5,!1,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),u={id:n,parcels:{},status:i?tt:et,customProps:e,parentName:ht(r),unmountThisParcel:()=>f.then((()=>{if(u.status!==it)throw Error(Q(6,!1,o,u.status));return Ot(u,!0)})).then((t=>(u.parentName&&delete r.parcels[u.id],t))).then((t=>(p(t),t))).catch((t=>{throw u.status=lt,h(t),t}))};let a;r.parcels[n]=u;let c=s();if(!c||"function"!=typeof c.then)throw Error(Q(7,!1));c=c.then((t=>{if(!t)throw Error(Q(8,!1));if(o=t.name||`parcel-${n}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!vt(t.bootstrap))throw Error(Q(9,!1,o));if(!vt(t.mount))throw Error(Q(10,!1,o));if(!vt(t.unmount))throw Error(Q(11,!1,o));if(t.update&&!vt(t.update))throw Error(Q(12,!1,o));const e=wt(t,"bootstrap"),r=wt(t,"mount"),i=wt(t,"unmount");u.status=et,u.name=o,u.bootstrap=e,u.mount=r,u.unmount=i,u.timeouts=Bt(t.timeouts),t.update&&(u.update=wt(t,"update"),a.update=function(t){return u.customProps=t,Dt((e=u,Promise.resolve().then((()=>{if(e.status!==it)throw Error(Q(32,!1,ht(e)));return e.status=st,Rt(e,"update").then((()=>(e.status=it,e))).catch((t=>{throw X(t,e,lt)}))}))));var e})}));const l=c.then((()=>St(u,!0))),f=l.then((()=>Tt(u,!0)));let p,h;const d=new Promise(((t,e)=>{p=t,h=e}));return a={mount:()=>Dt(Promise.resolve().then((()=>{if(u.status!==nt)throw Error(Q(13,!1,o,u.status));return r.parcels[n]=u,Tt(u)}))),unmount:()=>Dt(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:Dt(c),bootstrapPromise:Dt(l),mountPromise:Dt(f),unmountPromise:Dt(d)},a}function Dt(t){return t.then((()=>null))}function Ut(t){const e=ht(t);let r="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(Q(40,!1),e,r));const n=bt({},r,{name:e,mountParcel:Nt.bind(t),singleSpa:F});return dt(t)&&(n.unmountSelf=t.unmountThisParcel),n}const Mt={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 kt(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(16,!1));Mt.bootstrap={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Ct(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(17,!1));Mt.mount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function It(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(18,!1));Mt.unmount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Lt(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(19,!1));Mt.unload={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Rt(t,e){const r=t.timeouts[e],n=r.warningMillis,o=yt(t);return new Promise(((i,s)=>{let u=!1,a=!1;t[e](Ut(t)).then((t=>{u=!0,i(t)})).catch((t=>{u=!0,s(t)})),setTimeout((()=>l(1)),n),setTimeout((()=>l(!0)),r.millis);const c=Q(31,!1,e,o,ht(t),r.millis);function l(t){if(!u)if(!0===t)a=!0,r.dieOnTimeout?s(Error(c)):console.error(c);else if(!a){const e=t,o=e*n;console.warn(c),o+n<r.millis&&setTimeout((()=>l(e+1)),n)}}}))}function Bt(t){const e={};for(let r in Mt)e[r]=bt({},Mt[r],t&&t[r]||{});return e}function $t(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==Z&&t.status!==ct)return t;let e,r;return t.status=tt,t.loadPromise=Promise.resolve().then((()=>{const n=t.loadApp(Ut(t));if(!gt(n))throw r=!0,Error(Q(33,!1,ht(t)));return n.then((r=>{let n;t.loadErrorTime=null,e=r,"object"!=typeof e&&(n=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!vt(e.bootstrap)&&(n=35),vt(e.mount)||(n=36),vt(e.unmount)||(n=37);const o=yt(e);if(n){let r;try{r=JSON.stringify(e)}catch(t){}return console.error(Q(n,!1,o,ht(t),r),e),z(void 0,t,lt),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=bt({},t.devtools.overlays,e.devtools.overlays)),t.status=et,t.bootstrap=wt(e,"bootstrap"),t.mount=wt(e,"mount"),t.unmount=wt(e,"unmount"),t.unload=wt(e,"unload"),t.timeouts=Bt(e.timeouts),delete t.loadPromise,t}))})).catch((e=>{let n;return delete t.loadPromise,r?n=lt:(n=ct,t.loadErrorTime=(new Date).getTime()),z(e,t,n),t}))}))}const Gt="undefined"!=typeof window,Vt={hashchange:[],popstate:[]},Wt=["hashchange","popstate"];function Ft(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(Q(14,!1));e=t.currentTarget.href,t.preventDefault()}const r=Xt(window.location.href),n=Xt(e);0===e.indexOf("#")?window.location.hash=n.hash:r.host!==n.host&&n.host?window.location.href=e:n.pathname===r.pathname&&n.search===r.search?window.location.hash=n.hash:window.history.pushState(null,null,e)}function Ht(t){if(t){const e=t[0].type;Wt.indexOf(e)>=0&&Vt[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let Jt;function qt(){Oe([],arguments)}function zt(t,e){return function(){const r=window.location.href,n=t.apply(this,arguments),o=window.location.href;return Jt&&r===o||window.dispatchEvent(function(t,e){let r;try{r=new PopStateEvent("popstate",{state:t})}catch(e){r=document.createEvent("PopStateEvent"),r.initPopStateEvent("popstate",!1,!1,t)}return r.singleSpa=!0,r.singleSpaTrigger=e,r}(window.history.state,e)),n}}let Yt=null,Kt=!1;function Qt(t){if(Kt)throw Error(Q(43,!1));Jt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,Kt=!0,Yt=window.history.replaceState,window.addEventListener("hashchange",qt),window.addEventListener("popstate",qt);const e=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(t,r){if(!("function"==typeof r&&Wt.indexOf(t)>=0)||mt(Vt[t],(t=>t===r)))return e.apply(this,arguments);Vt[t].push(r)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&Wt.indexOf(t)>=0))return r.apply(this,arguments);Vt[t]=Vt[t].filter((t=>t!==e))},window.history.pushState=zt(window.history.pushState,"pushState"),window.history.replaceState=zt(Yt,"replaceState")}function Xt(t){const e=document.createElement("a");return e.href=t,e}Gt&&(window.singleSpaNavigate?console.warn(Q(41,!1)):window.singleSpaNavigate=Ft);let Zt=!1;function te(t=window.jQuery){if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!Zt){const e=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return ee.call(this,e,window.addEventListener,t,r,arguments)},t.fn.off=function(t,e){return ee.call(this,r,window.removeEventListener,t,e,arguments)},Zt=!0}}function ee(t,e,r,n,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach((t=>{Wt.indexOf(t)>=0&&(e(t,n),r=r.replace(t,""))})),""===r.trim()?this:t.apply(this,o))}const re={};function ne(t){return Promise.resolve().then((()=>{const e=re[ht(t)];if(!e)return t;if(t.status===Z)return oe(t,e),t;if(t.status===at)return e.promise.then((()=>t));if(t.status!==nt&&t.status!==ct)return t;const r=t.status===ct?Promise.resolve():Rt(t,"unload");return t.status=at,r.then((()=>(oe(t,e),t))).catch((r=>(function(t,e,r){delete re[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,z(r,t,lt),e.reject(r)}(t,e,r),t)))}))}function oe(t,e){delete re[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=Z,e.resolve()}function ie(t,e,r,n){re[ht(t)]={app:t,resolve:r,reject:n},Object.defineProperty(re[ht(t)],"promise",{get:e})}function se(t){return re[t]}const ue=[];function ae(){return ue.filter(ft).map(ht)}function ce(){return ue.map(ht)}function le(t){const e=mt(ue,(e=>ht(e)===t));return e?e.status:null}let fe=!1;function pe(t,e,r,n){const o=function(t,e,r,n){const o={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(Q(39,!1));const e=["name","app","activeWhen","customProps"],r=Object.keys(t).reduce(((t,r)=>e.indexOf(r)>=0?t:t.concat(r)),[]);if(0!==r.length)throw Error(Q(38,!1,e.join(", "),r.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(Q(20,!1));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(Q(20,!1));const n=t=>"string"==typeof t||"function"==typeof t;if(!(n(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(n)))throw Error(Q(24,!1));if(!me(t.customProps))throw Error(Q(22,!1))}(t),o.name=t.name,o.loadApp=t.app,o.activeWhen=t.activeWhen,o.customProps=t.customProps):(function(t,e,r,n){if("string"!=typeof t||0===t.length)throw Error(Q(20,!1));if(!e)throw Error(Q(23,!1));if("function"!=typeof r)throw Error(Q(24,!1));if(!me(n))throw Error(Q(22,!1))}(t,e,r,n),o.name=t,o.loadApp=e,o.activeWhen=r,o.customProps=n),o.loadApp="function"!=typeof(i=o.loadApp)?()=>Promise.resolve(i):i,o.customProps=function(t){return t||{}}(o.customProps),o.activeWhen=function(t){let e=Array.isArray(t)?t:[t];return e=e.map((t=>"function"==typeof t?t:ve(t))),t=>e.some((e=>e(t)))}(o.activeWhen),o;var i}(t,e,r,n);if(Ae()||fe||(fe=!0,setTimeout((()=>{Ae()||console.warn(Q(1,!1))}),5e3)),-1!==ce().indexOf(o.name))throw Error(Q(21,!1,o.name));ue.push(bt({loadErrorTime:null,status:Z,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),Gt&&(te(),Oe())}function he(t=window.location){return ue.filter((e=>e.activeWhen(t))).map(ht)}function de(t){if(0===ue.filter((e=>ht(e)===t)).length)throw Error(Q(25,!1,t));return(Gt?ye(t,{waitForUnmount:!1}):Promise.resolve()).then((()=>{const e=ue.map(ht).indexOf(t);ue.splice(e,1)}))}function ye(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(Q(26,!1));const r=mt(ue,(e=>ht(e)===t));if(!r)throw Error(Q(27,!1,t));const n=se(ht(r));if(e&&e.waitForUnmount){if(n)return n.promise;{const t=new Promise(((e,n)=>{ie(r,(()=>t),e,n)}));return t}}{let t;return n?(t=n.promise,be(r,n.resolve,n.reject)):t=new Promise(((e,n)=>{ie(r,(()=>t),e,n),be(r,e,n)})),t}}function be(t,e,r){Promise.resolve().then((()=>{if(mt(he(),(e=>e===ht(t))))return Se()})).then((()=>Ot(t).then(ne).then((()=>{e(),setTimeout((()=>{Oe()}))})))).catch(r)}function me(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function ve(t,e){const r=function(t,e){let r=0,n=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const r=t[e];(!n&&":"===r||n&&"/"===r)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(r,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=n?"[^/]+/?":s,i===t.length)if(n)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}n=!n,r=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const n=t.href.replace(e,"").replace(t.search,"").split("?")[0];return r.test(n)}}let we=!1,ge=[],Ee=Gt&&window.location.href;function Se(){return Oe()}function Oe(t=[],e,r=!1){if(we)return new Promise(((t,r)=>{ge.push({resolve:t,reject:r,eventArguments:e})}));const{appsToUnload:n,appsToUnmount:o,appsToLoad:i,appsToMount:s}=function(){const t=[],e=[],r=[],n=[],o=(new Date).getTime();return ue.forEach((i=>{const s=i.status!==lt&&pt(i);switch(i.status){case ct:s&&o-i.loadErrorTime>=200&&r.push(i);break;case Z:case tt:s&&r.push(i);break;case et:case nt:!s&&se(ht(i))?t.push(i):s&&n.push(i);break;case it:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:r,appsToMount:n}}();let u,a=[],c=Ee,l=Ee=window.location.href;return Ae()?(we=!0,u=n.concat(i,o,s),Promise.resolve().then((()=>(y(0===u.length?"before-no-app-change":"before-app-change",d(!0)),y("before-routing-event",d(!0,{cancelNavigation:f})),Promise.all(a).then((r=>{if(r.some((t=>t)))return Yt.call(window.history,history.state,"",c.substring(location.origin.length)),Ee=location.href,we=!1,Oe(t,e,!0);const u=n.map(ne),a=o.map(Ot).map((t=>t.then(ne))).concat(u),l=Promise.all(a);l.then((()=>{y("before-mount-routing-event",d(!0))}),(t=>{throw t}));const f=i.map((t=>$t(t).then((t=>_e(t,l))))),b=s.filter((t=>i.indexOf(t)<0)).map((t=>_e(t,l)));return l.catch((t=>{throw h(),t})).then((()=>(h(),Promise.all(f.concat(b)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then(p).then((()=>{}),(t=>{throw t})))))})))))):(u=i,Promise.resolve().then((()=>{const t=i.map($t);return Promise.all(t).then(h).then((()=>[])).catch((t=>{throw h(),t})).finally((()=>{}))})));function f(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);a.push(e.catch((t=>(console.warn(Error(Q(42,!1))),console.warn(t),!1))))}function p(){const e=ae();t.forEach((t=>t.resolve(e)));try{y(0===u.length?"no-app-change":"app-change",d()),y("routing-event",d())}catch(t){setTimeout((()=>{throw t}))}if(we=!1,ge.length>0){const t=ge;ge=[],Oe(t)}return e}function h(){r||(t.forEach((t=>{Ht(t.eventArguments)})),Ht(e))}function d(t=!1,r){const a={},f={[it]:[],[nt]:[],[Z]:[],[lt]:[]};t?(i.concat(s).forEach(((t,e)=>{h(t,it)})),n.forEach((t=>{h(t,Z)})),o.forEach((t=>{h(t,nt)}))):u.forEach((t=>{h(t)}));const p={detail:{newAppStatuses:a,appsByNewStatus:f,totalAppChanges:u.length,originalEvent:null==e?void 0:e[0],oldUrl:c,newUrl:l}};return r&&bt(p.detail,r),p;function h(t,e){const r=ht(t);e=e||le(r),a[r]=e,(f[e]=f[e]||[]).push(r)}}function y(t,e){r||window.dispatchEvent(new J(`single-spa:${t}`,e))}}function _e(t,e){return pt(t)?St(t).then((t=>e.then((()=>pt(t)?Tt(t):t)))):e.then((()=>t))}let Pe=!1;function Te(t){Pe=!0,Gt&&(Qt(t),Oe())}function Ae(){return Pe}var je={getRawAppData:function(){return[...ue]},reroute:Oe,NOT_LOADED:Z,toLoadPromise:$t,toBootstrapPromise:St,unregisterApplication:de,getProfilerData:function(){return Et}};Gt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=je);var xe="openmrs:history";function Ne(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function De(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function Ue(t,e,r){return Ue=Le()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&Ce(o,r.prototype),o},Ue.apply(null,arguments)}function Me(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ke(t){return ke=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ke(t)}function Ce(t,e){return Ce=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ce(t,e)}function Ie(t){var e="function"==typeof Map?new Map:void 0;return Ie=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return Ue(t,arguments,ke(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ce(n,t)},Ie(t)}function Le(){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(t){return!1}}var Re="/ws/rest/v1",Be="/ws/fhir2/R4",$e="".concat(Re,"/session");function Ge(t){return t&&t.startsWith("http")?t:("/"!==t[0]&&(t="/"+t),window.openmrsBase+t)}function Ve(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof e)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 r=Ge(t);if(e.headers||(e.headers={}),$(e.body)&&(e.body=JSON.stringify(e.body)),void 0===e.headers.Accept&&(e.headers.Accept="application/json"),null===e.headers.Accept&&delete e.headers.Accept,t.startsWith(Re)&&void 0===e.headers["Disable-WWW-Authenticate"]&&(e.headers["Disable-WWW-Authenticate"]="true"),t.startsWith(Be)){var n=new URL(r,window.location.toString());n.searchParams.has("_summary")||(n.searchParams.set("_summary","data"),r=n.toString())}var o,i,s=Error();return window.fetch(r,e).then((o=function(t){var e,n,o;return function(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=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(e=t).ok?204!==e.status?[3,2]:[4,(0,G.getConfig)("@openmrs/esm-api")]:[3,4];case 1:return i.sent().followRedirects&&e.headers.has("location")&&(n=e.headers.get("location"))&&(0,V.navigate)({to:n}),e.data=null,[2,e];case 2:return[2,e.clone().text().then((function(t){try{t&&(e.data=JSON.parse(t))}catch(t){}return e}))];case 3:return[3,6];case 4:return[4,(0,G.getConfig)("@openmrs/esm-api")];case 5:return o=i.sent().redirectAuthFailure,r===Ge($e)&&403===e.status||o.enabled&&o.errors.includes(e.status)?(sessionStorage.removeItem(xe),(0,V.navigate)({to:o.url}),[2,o.resolvePromise?Promise.resolve():new Promise((function(){}))]):[2,e.clone().text().then((function(t){var n=t;try{n=JSON.parse(t)}catch(t){}throw new Fe(r,e,n,s)}),(function(t){throw new Fe(r,e,null,s)}))];case 6:return[2]}}))},i=function(){var t=this,e=arguments;return new Promise((function(r,n){var i=o.apply(t,e);function s(t){De(i,r,n,s,u,"next",t)}function u(t){De(i,r,n,s,u,"throw",t)}s(void 0)}))},function(t){return i.apply(this,arguments)}))}function We(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof e)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");var r=new AbortController;return e.signal=r.signal,new g((function(n){var o=!1;return Ve(t,e).then((function(t){o=!0,n.next(t),n.complete()}),(function(t){o=!0,n.error(t)})),function(){o||r.abort()}}))}var Fe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ce(t,e)}(o,t);var e,r,n=(e=o,r=Le(),function(){var t,n=ke(e);if(r){var o=ke(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return function(t,e){return!e||"object"!=((r=e)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof e?Ne(t):e;var r}(this,t)});function o(t,e,r,i){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),Me(Ne(s=n.call(this)),"response",void 0),Me(Ne(s),"responseBody",void 0),s.message="Server responded with ".concat(e.status," (").concat(e.statusText,") for url ").concat(t,". Check err.responseBody or network tab in dev tools for more info"),i.message=s.message,s.responseBody=r,s.response=e,s.stack="Stacktrace for outgoing request:\n".concat(i.stack,"\nStacktrace for incoming response:\n").concat(s.stack),s}return o}(Ie(Error));function He(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}var Je="".concat(Re,"/attachment");function qe(t,e){return Ve("".concat(Je,"/").concat(t),{signal:e.signal})}function ze(t,e,r){return Ve("".concat(Je,"?patient=").concat(t,"&includeEncounterless=").concat(e),{signal:r.signal})}function Ye(t,e){return Ke.apply(this,arguments)}function Ke(){var t;return t=function(t,e){var r;return function(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(n){return(r=new FormData).append("fileCaption",e.fileDescription),r.append("patient",t),e.file?r.append("file",e.file,e.fileName):(r.append("file",new File([""],e.fileName),e.fileName),r.append("base64Content",e.base64Content)),[2,Ve("".concat(Je),{method:"POST",body:r})]}))},Ke=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){He(i,n,o,s,u,"next",t)}function u(t){He(i,n,o,s,u,"throw",t)}s(void 0)}))},Ke.apply(this,arguments)}function Qe(t,e){return Ve("".concat(Je,"/").concat(t),{method:"DELETE",signal:e.signal})}var Xe=s(254);const Ze=function(t){return void 0===t};function tr(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function er(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){tr(i,n,o,s,u,"next",t)}function u(t){tr(i,n,o,s,u,"throw",t)}s(void 0)}))}}function rr(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var nr=(0,W.createGlobalStore)("session",{loaded:!1,session:null}),or=0;function ir(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(or<Date.now()-6e4||!nr.getState().loaded)&&ar(),new g((function(e){var r=function(r){var n;r.loaded&&(t.includeAuthStatus?e.next(r.session):e.next(null===(n=r.session)||void 0===n?void 0:n.user))};return r(nr.getState()),nr.subscribe(r)}))}function sr(){return(or<Date.now()-6e4||!nr.getState().loaded)&&ar(),nr}function ur(t){var e,r,n,o=null!==(n=null==t||null===(e=t.user)||void 0===e||null===(r=e.userProperties)||void 0===r?void 0:r.defaultLocale)&&void 0!==n?n:t.locale,i=document.documentElement.getAttribute("lang");(function(t){if(void 0===t||"string"!=typeof t)return!1;try{new Intl.Locale(t)}catch(t){return!1}return!0})(o)&&o!==i&&document.documentElement.setAttribute("lang",o)}function ar(t,e){or=Date.now();var r={};return t&&e&&(r.Authorization="Basic ".concat(window.btoa("".concat(t,":").concat(e)))),mr(Ve($e,{headers:r}))}function cr(){nr.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function lr(t,e){return void 0===e?Boolean(t):!Boolean(t)||function(t,e){return"string"==typeof t?!Ze(e.privileges.find((function(e){return t===e.display}))):Array.isArray(t)?t.every((function(t){return!Ze(e.privileges.find((function(e){return t===e.display})))})):(Ze(t)||console.error('Could not understand privileges "'.concat(t,'"')),!0)}(t,e)||function(t){return!Ze(t.roles.find((function(t){return"System Developer"===t.display})))}(e)}function fr(){var t,e;return new Promise((function(r){var n=function(n){n.loaded&&n.session.user&&(t=n.session.user,r(n.session.user),e&&e())};n(nr.getState()),t||(e=nr.subscribe(n))}))}function pr(){return new Promise((function(t,e){ir().subscribe((function(e){t(e.sessionLocation)}),e).unsubscribe()}))}function hr(t,e){return dr.apply(this,arguments)}function dr(){return(dr=er((function(t,e){return rr(this,(function(r){return[2,mr(Ve($e,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:e.signal}))]}))}))).apply(this,arguments)}function yr(t,e,r){return br.apply(this,arguments)}function br(){return(br=er((function(t,e,r){return rr(this,(function(n){switch(n.label){case 0:return r||(r=new AbortController),[4,Ve("".concat(Re,"/user/").concat(t),{method:"POST",body:{userProperties:e},headers:{"Content-Type":"application/json"},signal:r.signal})];case 1:return n.sent(),[2,ar()]}}))}))).apply(this,arguments)}function mr(t){return new Promise((function(e,r){t.then((function(t){var n;"object"==typeof(null==t?void 0:t.data)?(n={loaded:!0,session:t.data},nr.setState(n),e(n)):(n={loaded:!1,session:null},nr.setState(n),r(n))})).catch((function(t){(0,Xe.reportError)("Failed to fetch new session information: ".concat(t));var e={loaded:!1,session:null};nr.setState(e),r(e)}))}))}function vr(){(0,G.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:G.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:G.Type.String,_default:"${openmrsSpaBase}/login",_validators:[G.validators.isUrl]},errors:{_type:G.Type.Array,_default:[401],_elements:{_type:G.Type.Number,_validators:[G.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:G.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:G.Type.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}}),ar()}nr.subscribe((function(t){return t.session&&ur(t.session)}));var wr=s(738);function gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Er(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function Sr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){Er(i,n,o,s,u,"next",t)}function u(t){Er(i,n,o,s,u,"throw",t)}s(void 0)}))}}function Or(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,u=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return gr(t,e);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)?gr(t,e):void 0}}(t,e)||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.")}()}function _r(t,e){var r,n,o,i,s={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(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function Pr(t,e){return Tr.apply(this,arguments)}function Tr(){return Tr=Sr((function(t,e){var r,n,o,i,s,u=arguments;return _r(this,(function(a){switch(a.label){case 0:return r=!(u.length>2&&void 0!==u[2])||u[2],t?(n=null,[4,Promise.all([Ve("".concat(Be,"/Patient/").concat(t),e).catch((function(t){return n=t})),r?Ar(t):Promise.resolve(null)])]):[3,2];case 1:if(o=Or.apply(void 0,[a.sent(),2]),i=o[0],s=o[1],i.ok)return[2,i.data];if(s)return[2,s];if(n)throw n;a.label=2;case 2:return[2,null]}}))})),Tr.apply(this,arguments)}function Ar(t){return jr.apply(this,arguments)}function jr(){return(jr=Sr((function(t){var e,r,n;return _r(this,(function(o){switch(o.label){case 0:return[4,(0,wr.getSynchronizationItems)("patient-registration")];case 1:return e=o.sent(),r=e.find((function(e){return e.fhirPatient.id===t})),[2,null!==(n=null==r?void 0:r.fhirPatient)&&void 0!==n?n:null]}}))}))).apply(this,arguments)}var xr,Nr,Dr=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),Ur=function(t){function r(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return e(r,t),r.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},r}(h),Mr=function(t){function r(e){var r=t.call(this,e)||this;return r.destination=e,r}return e(r,t),r}(b),kr=function(t){function r(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return e(r,t),r.prototype[y]=function(){return new Mr(this)},r.prototype.lift=function(t){var e=new Cr(this,this);return e.operator=t,e},r.prototype.next=function(t){if(this.closed)throw new Dr;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},r.prototype.error=function(t){if(this.closed)throw new Dr;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].error(t);this.observers.length=0},r.prototype.complete=function(){if(this.closed)throw new Dr;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},r.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},r.prototype._trySubscribe=function(e){if(this.closed)throw new Dr;return t.prototype._trySubscribe.call(this,e)},r.prototype._subscribe=function(t){if(this.closed)throw new Dr;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new Ur(this,t))},r.prototype.asObservable=function(){var t=new g;return t.source=this,t},r.create=function(t,e){return new Cr(t,e)},r}(g),Cr=function(t){function r(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return e(r,t),r.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},r.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},r.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},r.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):h.EMPTY},r}(kr),Ir=function(t){function r(e){var r=t.call(this)||this;return r._value=e,r}return e(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),r.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},r.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new Dr;return this._value},r.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},r}(kr);!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(xr||(xr={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Nr||(Nr={}));var Lr="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))",Rr=function(){try{return JSON.parse(localStorage.getItem("openmrs:visitStoreState")||"null")}catch(t){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function Br(){return(0,W.getGlobalStore)("visit",Rr)}function $r(t,e){Br().setState({patientUuid:t,manuallySetVisitUuid:e})}function Gr(t,e){return Ve("".concat(Re,"/visit"),{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function Vr(t,e,r){return Ve("".concat(Re,"/visit/").concat(t),{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function Wr(t,e,r){var n=null!=r?r:Lr;return Ve("".concat(Re,"/visit?patient=").concat(t,"&v=").concat(n),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}})}Br().subscribe((function(t){var e;e=t,localStorage.setItem("openmrs:visitStoreState",JSON.stringify(e))}));var Fr=new Ir(null);function Hr(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new Jr(t,e))}}var Jr=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new qr(t,this.project,this.thisArg))},t}(),qr=function(t){function r(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return e(r,t),r.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},r}(b),zr=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}(),Yr=new g((function(t){return t.complete()}));function Kr(t){return function(e){return 0===t?r?function(t){return new g((function(e){return t.schedule((function(){return e.complete()}))}))}(r):Yr:e.lift(new Qr(t));var r}}var Qr=function(){function t(t){if(this.total=t,this.total<0)throw new zr}return t.prototype.call=function(t,e){return e.subscribe(new Xr(t,this.total))},t}(),Xr=function(t){function r(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return e(r,t),r.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},r}(b);function Zr(t){return{uuid:t.uuid,display:t.display,name:t.name}}function tn(){return We("".concat(Re,"/visittype")).pipe(Hr((function(t){return t.data.results.map(Zr)}))).pipe(Kr(1))}function en(t){return{uuid:t.uuid,display:t.display}}function rn(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=new URLSearchParams;t&&r.set("tag",t),e&&r.set("q",e);var n=r.toString();return We("".concat(Re,"/location").concat(n?"?"+n:"")).pipe(Hr((function(t){return t.data.results.map(en)}))).pipe(Kr(1))}var nn={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),u})())}}})); | ||
//# sourceMappingURL=openmrs-esm-api.js.map |
{ | ||
"name": "@openmrs/esm-api", | ||
"version": "6.0.1-pre.2549", | ||
"version": "6.0.1-pre.2550", | ||
"license": "MPL-2.0", | ||
@@ -51,6 +51,6 @@ "description": "The javascript module for interacting with the OpenMRS API", | ||
"devDependencies": { | ||
"@openmrs/esm-config": "6.0.1-pre.2549", | ||
"@openmrs/esm-error-handling": "6.0.1-pre.2549", | ||
"@openmrs/esm-navigation": "6.0.1-pre.2549", | ||
"@openmrs/esm-state": "6.0.1-pre.2549", | ||
"@openmrs/esm-config": "6.0.1-pre.2550", | ||
"@openmrs/esm-error-handling": "6.0.1-pre.2550", | ||
"@openmrs/esm-navigation": "6.0.1-pre.2550", | ||
"@openmrs/esm-state": "6.0.1-pre.2550", | ||
"rxjs": "^6.5.3", | ||
@@ -57,0 +57,0 @@ "webpack": "^5.88.0" |
@@ -155,2 +155,10 @@ /** @module @category API */ | ||
if (response.status === 204) { | ||
const { followRedirects } = await getConfig('@openmrs/esm-api'); | ||
if (followRedirects && response.headers.has('location')) { | ||
const location = response.headers.get('location'); | ||
if (location) { | ||
navigate({ to: location }); | ||
} | ||
} | ||
/* HTTP 204 - No Content | ||
@@ -157,0 +165,0 @@ * We should not try to download the empty response as json. Instead, |
@@ -36,2 +36,7 @@ import { defineConfigSchema, Type, validators } from '@openmrs/esm-config'; | ||
}, | ||
followRedirects: { | ||
_type: Type.Boolean, | ||
_default: true, | ||
_description: 'Whether openmrsFetch should support redirects returned from the backend', | ||
}, | ||
}); | ||
@@ -38,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
295777
1910