Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openmrs/esm-api

Package Overview
Dependencies
Maintainers
16
Versions
1245
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openmrs/esm-api - npm Package Compare versions

Comparing version 3.1.6 to 3.1.7

2

dist/openmrs-esm-api.js

@@ -16,3 +16,3 @@ System.register(["@openmrs/esm-config"],(function(t){var e;return{setters:[function(t){e=t}],execute:function(){t(function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=35)}([function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));

***************************************************************************** */
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return f}));var r=n(2);var o=n(9),i=n(14);var u=n(6),c=n(19);function s(t){return 0===t.length?c.a:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var a=n(4),f=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var u=this.operator,c=function(t,e,n){if(t){if(t instanceof r.a)return t;if(t[o.a])return t[o.a]()}return t||e||n?new r.a(t,e,n):new r.a(i.a)}(t,e,n);if(u?c.add(u.call(c,this.source)):c.add(this.source||a.a.useDeprecatedSynchronousErrorHandling&&!c.syncErrorThrowable?this._subscribe(c):this._trySubscribe(c)),a.a.useDeprecatedSynchronousErrorHandling&&c.syncErrorThrowable&&(c.syncErrorThrowable=!1,c.syncErrorThrown))throw c.syncErrorValue;return c},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),!function(t){for(;t;){var e=t,n=e.closed,o=e.destination,i=e.isStopped;if(n||i)return!1;t=o&&o instanceof r.a?o:null}return!0}(t)?console.warn(e):t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=l(e))((function(e,r){var o;o=n.subscribe((function(e){try{t(e)}catch(t){r(t),o&&o.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[u.a]=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:s(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=l(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function l(t){if(t||(t=a.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},function(t,e,n){"use strict";n.d(e,"a",(function(){return f}));var r=n(0),o=n(10),i=n(14),u=n(3),c=n(9),s=n(4),a=n(7),f=function(t){function e(n,r,o){var u=t.call(this)||this;switch(u.syncErrorValue=null,u.syncErrorThrown=!1,u.syncErrorThrowable=!1,u.isStopped=!1,arguments.length){case 0:u.destination=i.a;break;case 1:if(!n){u.destination=i.a;break}if("object"==typeof n){n instanceof e?(u.syncErrorThrowable=n.syncErrorThrowable,u.destination=n,n.add(u)):(u.syncErrorThrowable=!0,u.destination=new l(u,n));break}default:u.syncErrorThrowable=!0,u.destination=new l(u,n,r,o)}return u}return r.a(e,t),e.prototype[c.a]=function(){return this},e.create=function(t,n,r){var o=new e(t,n,r);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(u.a),l=function(t){function e(e,n,r,u){var c,s=t.call(this)||this;s._parentSubscriber=e;var a=s;return Object(o.a)(n)?c=n:n&&(c=n.next,r=n.error,u=n.complete,n!==i.a&&(a=Object.create(n),Object(o.a)(a.unsubscribe)&&s.add(a.unsubscribe.bind(a)),a.unsubscribe=s.unsubscribe.bind(s))),s._context=a,s._next=c,s._error=r,s._complete=u,s}return r.a(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;s.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=s.a.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(a.a)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;Object(a.a)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};s.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),s.a.useDeprecatedSynchronousErrorHandling)throw t;Object(a.a)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!s.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return s.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(Object(a.a)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(f)},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}(),o=n(18),i=n(10),u=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}(),c=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this._parentOrParents,c=this._ctorUnsubscribe,a=this._unsubscribe,f=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(var l=0;l<n.length;++l){n[l].remove(this)}if(Object(i.a)(a)){c&&(this._unsubscribe=void 0);try{a.call(this)}catch(t){e=t instanceof u?s(t.errors):[t]}}if(r(f)){l=-1;for(var h=f.length;++l<h;){var d=f[l];if(Object(o.a)(d))try{d.unsubscribe()}catch(t){e=e||[],t instanceof u?e=e.concat(s(t.errors)):e.push(t)}}}if(e)throw new u(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof t){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function s(t){return t.reduce((function(t,e){return t.concat(e instanceof u?e.errors:e)}),[])}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;r=t},get useDeprecatedSynchronousErrorHandling(){return r}}},function(t,n){t.exports=e},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(t,e,n){"use strict";function r(t){setTimeout((function(){throw t}),0)}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(t,e,n){"use strict";function r(t){return"function"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){(function(){var t=n(40),r=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=function(t){return t?t.toString().replace(r,""):""};e.trim=o;var i=function(t){return null==t&&void 0===t?String(t):{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"}[Object.prototype.toString.call(t)]};e.type=i;e.assertArray=function(t){if("array"!==i(t))throw"not array";return t};var u=function(t){if("object"!==i(t))throw"not object";return t};e.assertObject=u;var c=function(t,e,n){var r,o;return n||(n=[]),u(t),function(){var e;for(r in e=[],t)o=t[r],e.push([r,o]);return e}().reduce(e,n)};e.reduceMap=c;e.identity=function(t){return t};var s=function(){return Array.prototype.slice.call(arguments)};e.argsArray=s;e.mergeLists=function(){var e;return e=function(e,n){var r,o,i;for(r in o=t(!0,e),n)i=n[r],o[r]=(o[r]||[]).concat(i);return o},s.apply(null,arguments).reduce(e,{})};e.absoluteUrl=function(t,e){return e.match(/https?:\/\/./)?e:t+"/"+e};e.relativeUrl=function(t,e){return e.slice(e,t.length+1)===t+"/"?e.slice(t.length+1):e},e.resourceIdToUrl=function(t,e,n){return e=e.replace(/\/$/,""),(t=t.replace(/^\//,"")).indexOf("/")<0?e+"/"+n+"/"+t:0!==t.indexOf(e)?e+"/"+t:t};var a=function(t,e,n,r){var o;switch(i(n)){case"array":return e(n.map((function(e){return t(e,[n,r])})),r);case"object":return o=function(e,o){var i,u;return i=o[0],u=o[1],e[i]=t(u,[n].concat(r)),e},e(c(n,o,{}),r);default:return e(n,r)}};e.walk=a;var f=function(t,e,n){return e?a(f(t),t,e,n):function(e,n){return f(t,e,n)}};e.postwalk=f}).call(this)},function(t,e,n){"use strict";n.d(e,"b",(function(){return O})),n.d(e,"c",(function(){return j})),n.d(e,"a",(function(){return P}));var r=n(1),o=n(32),i="object"==typeof self&&self&&self.Object===Object&&self,u=(o.a||i||Function("return this")()).Symbol,c=Object.prototype,s=c.hasOwnProperty,a=c.toString,f=u?u.toStringTag:void 0;var l=function(t){var e=s.call(t,f),n=t[f];try{t[f]=void 0;var r=!0}catch(t){}var o=a.call(t);return r&&(e?t[f]=n:delete t[f]),o},h=Object.prototype.toString;var d=function(t){return h.call(t)},p=u?u.toStringTag:void 0;var b=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":p&&p in Object(t)?l(t):d(t)};var v=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object);var y=function(t){return null!=t&&"object"==typeof t},m=Function.prototype,w=Object.prototype,g=m.toString,_=w.hasOwnProperty,x=g.call(Object);var E=function(t){if(!y(t)||"[object Object]"!=b(t))return!1;var e=v(t);if(null===e)return!0;var n=_.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&g.call(n)==x},S=n(5);function O(t,e={}){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.");t=window.openmrsBase+t,e.headers||(e.headers={}),E(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;const n=Error();return window.fetch(t,e).then(async e=>{const r=e;if(r.ok)return 204===r.status?(r.data=null,r):r.json().then(t=>(r.data=t,r));{const{redirectAuthFailure:e}=await Object(S.getConfig)("@openmrs/esm-api");return e.enabled&&e.errors.includes(r.status)?(Object(S.navigate)({to:e.url}),e.resolvePromise?Promise.resolve():new Promise(t=>{})):r.text().then(e=>{let o=e;try{o=JSON.parse(e)}catch(t){}throw new P(t,r,o,n)},e=>{throw new P(t,r,null,n)})}})}function j(t,e={}){if("object"!=typeof e)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");const n=new AbortController;return e.signal=n.signal,new r.a(r=>{let o=!1;return O(t,e).then(t=>{o=!0,r.next(t),r.complete()},t=>{o=!0,r.error(t)}),()=>{o||n.abort()}})}class P extends Error{constructor(t,e,n,r){super(),this.message=`Server responded with ${e.status} (${e.statusText}) for url ${t}. Check err.responseBody or network tab in dev tools for more info`,r.message=this.message,this.responseBody=n,this.response=e,this.stack=`Stacktrace for outgoing request:\n${r.stack}\nStacktrace for incoming response:\n${this.stack}`}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(1),o=n(3);function i(t,e){return new r.a((function(n){var r=new o.a,i=0;return r.add(e.schedule((function(){i!==t.length?(n.next(t[i++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(4),o=n(7),i={closed:!0,next:function(t){},error:function(t){if(r.a.useDeprecatedSynchronousErrorHandling)throw t;Object(o.a)(t)},complete:function(){}}},function(t,e,n){(function(){var t=n(11),r=function(t){return t.and=function(e){return r((n=t,o=e,function(t){return n(o(t))}));var n,o},t.end=function(e){return t(e)},t};e.$$Simple=function(t){return function(e){return function(n){return e(t(n))}}};e.$$Attr=function(e,n){return r((function(r){return function(o){var i=null;return i="function"==t.type(n)?n(o):n,r(null==i&&null==i?o:function(t,e,n){for(var r=e.split("."),o=t,i=0;i<r.length-1;i++){var u=r[i];(o=t[u])||(o={},t[u]=o)}return o[r[r.length-1]]=n,t}(o,e,i))}}))};var o=function(t,e){return r((function(n){return function(r){return r[t]=e(r),n(r)}}))};e.Middleware=r,e.Attribute=o,e.Method=function(t){return o("method",(e=t,function(){return e}));var e}}).call(this)},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return i}));var r=n(12);const o="/ws/fhir2/R4",i=n(39)({baseUrl:o},{http:t=>Object(r.b)(t.url,{method:t.method,headers:t.headers}).then(e=>({status:e.status,headers:e.headers,data:e.data,config:t}),e=>({status:e.response.status,headers:e.response.headers,data:e.responseBody,config:t}))})},function(t,e,n){"use strict";n.d(e,"a",(function(){return v})),n.d(e,"b",(function(){return m})),n.d(e,"c",(function(){return w}));var r=n(33),o=n(54),i=n(0),u=n(2);function c(){}var s=n(10);var a=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new f(t,this.nextOrObserver,this.error,this.complete))},t}(),f=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i._tapNext=c,i._tapError=c,i._tapComplete=c,i._tapError=r||c,i._tapComplete=o||c,Object(s.a)(n)?(i._context=i,i._tapNext=n):n&&(i._context=n,i._tapNext=n.next||c,i._tapError=n.error||c,i._tapComplete=n.complete||c),i}return i.a(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(u.a),l=n(24),h=n(53),d=n(12);const p=new r.a(1);let b=0;function v(t={includeAuthStatus:!1}){return b<Date.now()-6e4&&m(),p.asObservable().pipe(Object(o.a)(),(e=y,function(t){return t.lift(new a(e,n,r))}),Object(l.a)(e=>t.includeAuthStatus?e.data:e.data.user),Object(h.a)(Boolean));var e,n,r}function y(t){var e,n,r;if(null==t||null===(e=t.data)||void 0===e||null===(n=e.user)||void 0===n||null===(r=n.userProperties)||void 0===r?void 0:r.defaultLocale){const e=t.data.user.userProperties.defaultLocale;e!=document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",e)}}function m(){b=Date.now(),p.next(Object(d.b)("/ws/rest/v1/session"))}function w(t,e){return function(t,e){return e.privileges.find(e=>t===e.display)}(t,e)||function(t){return t.roles.find(t=>"System Developer"===t.display)}(e)}},function(t,e,n){"use strict";function r(t){return null!==t&&"object"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";function r(t){return t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),o=function(t){function e(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return r.a(e,t),e.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 n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(n(3).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(t){return function(e){for(var n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.complete()}}},,function(t,e,n){"use strict";n.d(e,"a",(function(){return l}));var r=n(0),o=n(1),i=n(2),u=n(3),c=n(8),s=n(20),a=n(9),f=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return r.a(e,t),e}(i.a),l=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r.a(e,t),e.prototype[a.a]=function(){return new f(this)},e.prototype.lift=function(t){var e=new h(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new c.a;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new c.a;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new c.a;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new c.a;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new c.a;return this.hasError?(t.error(this.thrownError),u.a.EMPTY):this.isStopped?(t.complete(),u.a.EMPTY):(this.observers.push(t),new s.a(this,t))},e.prototype.asObservable=function(){var t=new o.a;return t.source=this,t},e.create=function(t,e){return new h(t,e)},e}(o.a),h=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r.a(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):u.a.EMPTY},e}(l)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),o=n(2);function i(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new u(t,e))}}var u=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.project,this.thisArg))},t}(),c=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.project=n,o.count=0,o.thisArg=r||o,o}return r.a(e,t),e.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)},e}(o.a)},function(t,e){},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(5),o=n(17);function i(){Object(r.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:r.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:r.Type.String,_default:"${openmrsSpaBase}/login",_validators:[r.validators.isUrl]},errors:{_type:r.Type.Array,_default:[401],_elements:{_type:r.Type.Number,_validators:[r.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:r.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."}}}),Object(o.b)()}},function(t,e,n){"use strict";n.d(e,"a",(function(){return l})),n.d(e,"c",(function(){return h})),n.d(e,"b",(function(){return d}));var r=n(33),o=n(16),i=n(54),u=n(24),c=n(53);let s;const a=new r.a(1),f=new r.a(1);function l(t={includeConfig:!1}){return f.asObservable().pipe(Object(i.a)(),Object(u.a)(e=>t.includeConfig?e:e.data),Object(c.a)(Boolean))}function h(){f.next(o.a.read({type:"Patient",patient:s}))}function d(){return a.asObservable()}window.addEventListener("single-spa:routing-event",()=>{const t=function(){const t=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return t&&t[1]}();t&&t!==s&&(s=t,a.next(t),t&&f.next(o.a.read({type:"Patient",patient:s})))})},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));const r={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return i}));const r=new(n(23).a);function o(t){r.next(t)}function i(){return r.asObservable()}},function(t,e,n){"use strict";function r(t,e){for(var n in e)t[n]=e[n];return t}n.d(e,"b",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"a",(function(){return s})),n.d(e,"c",(function(){return a}));var o=function(t){var e=[];function n(t){for(var n=[],r=0;r<e.length;r++)e[r]===t?t=null:n.push(e[r]);e=n}function o(n,o,i){t=o?n:r(r({},t),n);for(var u=e,c=0;c<u.length;c++)u[c](t,i)}return t=t||{},{action:function(e){function n(t){o(t,!1,e)}return function(){for(var r=arguments,o=[t],i=0;i<arguments.length;i++)o.push(r[i]);var u=e.apply(this,o);if(null!=u)return u.then?u.then(n):n(u)}},setState:o,subscribe:function(t){return e.push(t),function(){n(t)}},unsubscribe:n,getState:function(){return t}}};const i={};function u(t,e){const n=i[t];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(e,!0),n.active=!0,n.value;{const n=o(e);return i[t]={value:n,active:!0},n}}function c(t,e){const n=i[t];if(!n){const n=o(e);return i[t]={value:n,active:!1},n}return n.value}function s(t){return u("app",t)}function a(){return c("app",{})}},function(t,e,n){function r(t,e){const n=document.createElement("a");n.href=t;const r="/"===n.pathname[0]?n.pathname:"/"+n.pathname;let o=0,i=r.length;for(;o!==e&&i>=0;){"/"===r[--i]&&o++}if(o!==e)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+e+") is greater than the number of directories ("+o+") in the URL path "+t);const u=r.slice(0,i+1);return n.protocol+"//"+n.host+u}e.setPublicPath=function(t,e){if(e||(e=1),"string"!=typeof t||0===t.trim().length)throw Error("systemjs-webpack-interop: setPublicPath(systemjsModuleName) must be called with a non-empty string 'systemjsModuleName'");if("number"!=typeof e||e<=0||!o(e))throw Error("systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'");let i;try{if(i=window.System.resolve(t),!i)throw Error()}catch(e){throw Error("systemjs-webpack-interop: There is no such module '"+t+"' in the SystemJS registry. Did you misspell the name of your module?")}n.p=r(i,e)},e.resolveDirectory=r;const o=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}},function(t,e,n){"use strict";(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.a=n}).call(this,n(38))},function(t,e,n){"use strict";n.d(e,"a",(function(){return S}));var r=n(0),o=n(23),i=n(3),u=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.a(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return r.a(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n=!1,r=void 0;try{this.work(t)}catch(t){n=!0,r=!!t&&t||new Error(t)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,n){return t.call(this)||this}return r.a(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(i.a))),c=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}(),s=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e}(function(t){function e(n,r){void 0===r&&(r=c.now);var o=t.call(this,n,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return r.a(e,t),e.prototype.schedule=function(n,r,o){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,o):t.prototype.schedule.call(this,n,r,o)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(c)))(u),a=n(2),f=n(1),l=new f.a((function(t){return t.complete()}));function h(t){return t?function(t){return new f.a((function(e){return t.schedule((function(){return e.complete()}))}))}(t):l}function d(t){return t&&"function"==typeof t.schedule}var p,b=n(21),v=n(13);function y(t,e){return e?Object(v.a)(t,e):new f.a(Object(b.a)(t))}function m(t){var e=t.error;t.subscriber.error(e)}p||(p={});var w=function(){function t(t,e,n){this.kind=t,this.value=e,this.error=n,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}},t.prototype.accept=function(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)},t.prototype.toObservable=function(){var t,e;switch(this.kind){case"N":return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return d(n)?(t.pop(),Object(v.a)(t,n)):y(t)}(this.value);case"E":return t=this.error,e?new f.a((function(n){return e.schedule(m,0,{error:t,subscriber:n})})):new f.a((function(e){return e.error(t)}));case"C":return h()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();var g=function(t){function e(e,n,r){void 0===r&&(r=0);var o=t.call(this,e)||this;return o.scheduler=n,o.delay=r,o}return r.a(e,t),e.dispatch=function(t){var e=t.notification,n=t.destination;e.observe(n),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new _(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(w.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(w.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(w.createComplete()),this.unsubscribe()},e}(a.a),_=function(){return function(t,e){this.notification=t,this.destination=e}}(),x=n(8),E=n(20),S=function(t){function e(e,n,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=Number.POSITIVE_INFINITY);var o=t.call(this)||this;return o.scheduler=r,o._events=[],o._infiniteTimeWindow=!1,o._bufferSize=e<1?1:e,o._windowTime=n<1?1:n,n===Number.POSITIVE_INFINITY?(o._infiniteTimeWindow=!0,o.next=o.nextInfiniteTimeWindow):o.next=o.nextTimeWindow,o}return r.a(e,t),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var n=this._events;n.push(e),n.length>this._bufferSize&&n.shift()}t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new O(this._getNow(),e)),this._trimBufferThenGetEvents()),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),o=this.scheduler,u=r.length;if(this.closed)throw new x.a;if(this.isStopped||this.hasError?e=i.a.EMPTY:(this.observers.push(t),e=new E.a(this,t)),o&&t.add(t=new g(t,o)),n)for(var c=0;c<u&&!t.closed;c++)t.next(r[c]);else for(c=0;c<u&&!t.closed;c++)t.next(r[c].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||s).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,o=r.length,i=0;i<o&&!(t-r[i].time<n);)i++;return o>e&&(i=Math.max(i,o-e)),i>0&&r.splice(0,i),r},e}(o.a),O=function(){return function(t,e){this.time=t,this.value=e}}()},,function(t,e,n){n(36),t.exports=n(37)},function(t,e,n){"use strict";n.r(e);var r=n(31);Object(r.setPublicPath)("@openmrs/esm-api")},function(t,e,n){"use strict";n.r(e);var r=n(25);for(var o in r)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);var i=n(12);n.d(e,"openmrsFetch",(function(){return i.b})),n.d(e,"openmrsObservableFetch",(function(){return i.c})),n.d(e,"OpenmrsFetchError",(function(){return i.a}));var u=n(16);n.d(e,"fhirBaseUrl",(function(){return u.b})),n.d(e,"fhir",(function(){return u.a}));var c=n(26);n.d(e,"setupApiModule",(function(){return c.a}));var s=n(30);n.d(e,"createGlobalStore",(function(){return s.b})),n.d(e,"getGlobalStore",(function(){return s.d})),n.d(e,"createAppState",(function(){return s.a})),n.d(e,"getAppState",(function(){return s.c}));var a=n(17);n.d(e,"getCurrentUser",(function(){return a.a})),n.d(e,"refetchCurrentUser",(function(){return a.b})),n.d(e,"userHasAccess",(function(){return a.c}));var f=n(27);n.d(e,"getCurrentPatient",(function(){return f.a})),n.d(e,"refetchCurrentPatient",(function(){return f.c})),n.d(e,"getCurrentPatientUuid",(function(){return f.b}));var l=n(28);n.d(e,"backendDependencies",(function(){return l.a}));var h=n(29);n.d(e,"newWorkspaceItem",(function(){return h.b})),n.d(e,"getNewWorkspaceItem",(function(){return h.a}))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(){n(11);var e=n(15),r=n(42),o=n(43),i=n(45),u=n(46),c=n(47),s=n(48),a=n(49),f=n(50),l=n(51),h=n(52);t.exports=function(t,n){var d=e.Middleware,p=e.$$Attr,b=function(t){return p("method",t)},v=function(t,e){return p("headers."+t,e)},y=d(u),m=d(c(t,n)).and(y).and(o.$Basic).and(o.$Bearer).and(o.$Credentials).and(i.$JsonData).and(v("Accept",t.headers&&t.headers.Accept?t.headers.Accept:"application/json")).and(v("Content-Type",t.headers&&t.headers["Content-Type"]?t.headers["Content-Type"]:"application/json")),w=m.and(b("GET")),g=m.and(b("POST")),_=m.and(b("PUT")),x=m.and(b("DELETE")),E=m.and(b("PATCH")),S=i.Http(t,n),O=l.Path,j=O(t.baseUrl),P=j.slash(":type || :resource.resourceType"),T=P.slash("_history"),$=P.slash(":id || :resource.id"),A=$.slash("_history"),I=$.slash(":versionId || :resource.meta.versionId"),N=j.slash(":target.resourceType || :target.type").slash(":target.id").slash(":target.versionId"),C=v("Prefer","return=representation"),k=d(r.$Paging);return h({conformance:w.and(j.slash("metadata")).end(S),document:g.and(j.slash("Document")).end(S),profile:w.and(j.slash("Profile").slash(":type")).end(S),transaction:g.and(j).end(S),history:w.and(j.slash("_history")).and(k).end(S),typeHistory:w.and(T).and(k).end(S),resourceHistory:w.and(A).and(k).end(S),read:w.and(a.$WithPatient).and($).end(S),vread:w.and(I).end(S),delete:x.and($).and(C).end(S),create:g.and(P).and(C).end(S),validate:g.and(P.slash("_validate")).end(S),meta:{add:g.and(N.slash("$meta-add")).end(S),delete:g.and(N.slash("$meta-delete")).end(S),read:w.and(N.slash("$meta")).end(S)},search:w.and(P).and(a.$WithPatient).and(r.$SearchParams).and(k).end(S),update:_.and($).and(C).end(S),conditionalUpdate:_.and(P).and(r.$SearchParams).and(C).end(S),conditionalDelete:x.and(P).and(r.$SearchParams).and(C).end(S),nextPage:w.and(s.$$BundleLinkUrl("next")).end(S),prevPage:w.and(s.$$BundleLinkUrl("previous")).and(s.$$BundleLinkUrl("prev")).end(S),getBundleByUrl:w.and(O(":url")).end(S),resolve:w.and(f.resolve).end(S),patch:E.and($).and(v("Content-Type","application/json-patch+json")).end(S)},n)}}).call(this)},function(t,e,n){(function(t){!function(e){var n=function(t){return o(!0===t,!1,arguments)};function r(t,e){if("object"!==i(t))return e;for(var n in e)"object"===i(t[n])&&"object"===i(e[n])?t[n]=r(t[n],e[n]):t[n]=e[n];return t}function o(t,e,o){var u=o[0],c=o.length;(t||"object"!==i(u))&&(u={});for(var s=0;s<c;++s){var a=o[s];if("object"===i(a))for(var f in a)if("__proto__"!==f){var l=t?n.clone(a[f]):a[f];u[f]=e?r(u[f],l):l}}return u}function i(t){return{}.toString.call(t).slice(8,-1).toLowerCase()}n.recursive=function(t){return o(!0===t,!0,arguments)},n.clone=function(t){var e,r,o=t,u=i(t);if("array"===u)for(o=[],r=t.length,e=0;e<r;++e)o[e]=n.clone(t[e]);else if("object"===u)for(e in o={},t)o[e]=n.clone(t[e]);return o},e?t.exports=n:window.merge=n}(t&&"object"==typeof t.exports&&t.exports)}).call(this,n(41)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){(function(){var t=n(11),r=t.type,o=t.assertArray,i=(t.assertObject,t.reduceMap),u=t.identity,c={$gt:"gt",$lt:"lt",$lte:"lte",$gte:"gte",$ge:"ge",$le:"le"},s={$asc:":asc",$desc:":desc",$exact:":exact",$missing:":missing",$null:":missing",$text:":text"},a=function(t,e){if("$sort"===t)return function(t){var e,n,i,u;for(o(t),i=[],e=0,n=t.length;e<n;e++)switch(u=t[e],r(u)){case"array":i.push({param:"_sort",value:u[0],modifier:":"+u[1]});break;case"string":i.push({param:"_sort",value:u});break;default:i.push(void 0)}return i}(e);if("$has"===t)return i(e,(function(t,e){var n,o;return n=e[0],o=e[1],t.concat(function(){switch(r(o)){case"array":return o.map((function(t){return{param:"_has",value:n+"="+t}}));case"string":return[{param:"_has",value:n+"="+o}]}}())}));if("$include"===t||"$revInclude"===t)return function(t,e){return i(t,(function(t,n){var o,i;return o=n[0],i=n[1],t.concat(function(){switch(r(i)){case"array":return i.map((function(t){return{param:"$include"===e?"_include":"_revinclude",value:o+":"+t}}));case"string":return[{param:"$include"===e?"_include":"_revinclude",value:o+":"+i}]}}())}))}(e,t);switch(r(e)){case"object":return function(t,e){return i(e,(function(n,i){var u,f,l,h;return u=i[0],h=i[1],n.concat("$and"===u?o(h).reduce((function(e,n){return e.concat(a(t,n))}),[]):"$type"===u?[]:function(t){return 0===t.indexOf("$")}(u)?(f={param:t},"$or"===u?f.value=h:(c[u]&&(f.operator=c[u]),s[u]&&(f.modifier=s[u]),"object"===r(h)&&h.$or?f.value=h.$or:f.value=[h]),[f]):(e.$type&&(l=":"+e.$type),a(""+t+(l||"")+"."+u,h)))}))}(t,e);case"string":case"number":return[{param:t,value:[e]}];case"array":return[{param:t,value:[e.join("|")]}];default:throw"could not linearizeParams "+r(e)}},f=function(t){return i(t,(function(t,e){var n,r;return n=e[0],r=e[1],t.concat(a(n,r))}))},l=function(t){var e,n,r=["_include","_revinclude","_has"];return function(){var o,i,c,s;for(s=[],o=0,i=(c=f(t)).length;o<i;o++)e=c[o],n=-1===r.indexOf(e.param)?encodeURIComponent(e.value):e.value,s.push([e.param,e.modifier,"_has"==e.param?":":"=",e.operator,n].filter(u).join(""));return s}().join("&")};e._query=f,e.query=l;var h=n(15);e.$SearchParams=h.$$Attr("url",(function(t){var e=t.url;return t.query?e+"?"+l(t.query):e})),e.$Paging=function(t){return function(e){var n=e.params||{};return e.since&&(n._since=e.since),e.count&&(n._count=e.count),e.params=n,t(e)}}}).call(this)},function(t,e,n){(function(){var t,r=n(15),o=n(44).btoa;e.$Basic=r.$$Attr("headers.Authorization",(function(t){if(t.auth&&t.auth.user&&t.auth.pass)return"Basic "+o(t.auth.user+":"+t.auth.pass)})),e.$Bearer=r.$$Attr("headers.Authorization",(function(t){if(t.auth&&t.auth.bearer)return"Bearer "+t.auth.bearer})),e.$Credentials=r.Middleware(r.$$Attr("credentials",(function(e){return t=e.credentials,""}))).and(r.$$Attr("credentials",(function(e){if(["same-origin","include"].indexOf(t)>-1)return t})))}).call(this)},function(t,e,n){!function(){var t=e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function r(t){this.message=t}r.prototype=new Error,r.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var e,o,i=String(t),u=0,c=n,s="";i.charAt(0|u)||(c="=",u%1);s+=c.charAt(63&e>>8-u%1*8)){if((o=i.charCodeAt(u+=3/4))>255)throw new r("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|o}return s}),t.atob||(t.atob=function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,u=0,c=0,s="";i=e.charAt(c++);~i&&(o=u%4?64*o+i:i,u++%4)?s+=String.fromCharCode(255&o>>(-2*u&6)):0)i=n.indexOf(i);return s})}()},function(t,e,n){(function(){var t=n(11);e.Http=function(t,e){return function(n){n.debug&&console.log("\nDEBUG (request):",n.method,n.url,n);var r=(n.http||e.http||t.http)(n);return n.debug&&r&&r.then&&r.then((function(t){console.log("\nDEBUG: (responce)",t)})),r}};e.$JsonData=function(e){return function(n){var r,o=n.bundle||n.data||n.resource;return o&&(n.data=(r=o,"object"==t.type(r)||"array"==t.type(r)?JSON.stringify(r):r)),e(n)}}}).call(this)},function(t,e){t.exports=function(t){return function(e){try{return t(e)}catch(t){if(e.debug&&(console.log("\nDEBUG: (ERROR in middleware)"),console.log(t.message),console.log(t.stack)),!e.defer)throw console.log("\nDEBUG: (ERROR in middleware)"),console.log(t.message),console.log(t.stack),new Error("I need adapter.defer");var n=e.defer();return n.reject(t),n.promise}}}},function(t,e){(function(){var e=function(t,e,n){var r=t[n];return r&&!e[n]&&(e[n]=r),t};t.exports=function(t,n){return function(r){return function(o){return e(t,o,"baseUrl"),e(t,o,"cache"),e(t,o,"auth"),e(t,o,"patient"),e(t,o,"debug"),e(t,o,"credentials"),e(t,o,"headers"),e(t,o,"agentOptions"),e(n,o,"defer"),e(n,o,"http"),r(o)}}}}).call(this)},function(t,e){e.$$BundleLinkUrl=function(t){return function(e){return function(n){var r=n.bundle&&(n.bundle.link||[]).filter((function(e){return e.relation&&e.relation===t}))[0];return r&&r.url&&(n.url=r.url,n.data=null),e(n)}}}},function(t,e,n){(function(){var t=n(15),r=["Account","AllergyIntolerance","BodySite","CarePlan","Claim","ClinicalImpression","Communication","CommunicationRequest","Composition","Condition","Contract","DetectedIssue","Device","DeviceUseRequest","DeviceUseStatement","DiagnosticOrder","DiagnosticReport","DocumentManifest","DocumentReference","Encounter","EnrollmentRequest","EpisodeOfCare","FamilyMemberHistory","Flag","Goal","ImagingObjectSelection","ImagingStudy","Immunization","ImmunizationRecommendation","List","Media","MedicationAdministration","MedicationDispense","MedicationOrder","MedicationStatement","NutritionOrder","Observation","Order","Procedure","ProcedureRequest","QuestionnaireResponse","ReferralRequest","RelatedPerson","RiskAssessment","Specimen","SupplyDelivery","SupplyRequest","VisionPrescription"];e.$WithPatient=t.$$Simple((function(t){var e=t.type;return t.patient&&("Patient"===e?(t.query=t.query||{},t.query._id=t.patient,t.id=t.patient):r.indexOf(e)>=0&&(t.query=t.query||{},t.query.patient=t.patient)),t}))}).call(this)},function(t,e,n){(function(){var e=n(11),r=/^#(.*)/,o=function(t){var n=t.cache,o=t.reference,i=t.bundle,u=o;if(!u.reference)return null;if(u.reference.match(r))return function(t,e){var n=t.match(r)[1],o=(e.contained||[]).filter((function(t){return(t.id||t._id)==n}))[0];return o&&{content:o}||null}(u.reference,t.resource);var c=e.absoluteUrl(t.baseUrl,u.reference);return(i&&i.entry||[]).filter((function(t){return t.id===c}))[0]||(null!=n?n[c]:void 0)||null};t.exports.sync=o,t.exports.resolve=function(t){return function(n){var i=o(n),u=n.reference,c=n.defer();if(i){if(!n.defer)throw new Error("I need promise constructor 'adapter.defer' in adapter");return c.resolve(i),c.promise}if(!u)throw new Error("No reference found");if(u&&u.reference.match(r))throw new Error("Contained resource not found");return n.url=e.absoluteUrl(n.baseUrl,u.reference),n.data=null,t(n)}}}).call(this)},function(t,e,n){(function(){n(11);var t=n(15),r=function(e,n){var o=function(t){return n&&e.includes("target.versionId")&&!t.target.versionId?n(t):(n&&n(t)+"/"||"")+function(t,e){var n=function(t,e){return 0==t.indexOf(":")?function(t,e){for(var n,r=t.split("||").map((function(t){return t.trim().substring(1)})),o=0;o<r.length;o++){var i=(n=e,r[o].split(".").reduce((function(t,e){return"versionId"===e&&t[e]?"_history/"+t[e]:null==t||null==t?null:t[e]}),n));if(i)return i}return null}(t,e):t}(t.trim(),e);if((null==n||void 0===n)&&0==t.includes("target.versionId"))throw new Error("Parameter "+t+" is required: "+JSON.stringify(e));return n}(e,t)},i=t.Attribute("url",o);return i.slash=function(t){return r(t,o)},i};e.Path=r}).call(this)},function(t,e){(function(){var e,n;function r(t,r,o,i){n.defer();e.search(t).then((function(t){(function t(r,o){var i,u=r.data.entry||[],c=[];for(i=0;i<u.length;i++)c.push(u[i].resource);o(c);var s=n.defer();return e.nextPage({bundle:r.data}).then((function(e){t(e,o).then((function(t){s.resolve()}))}),(function(t){s.resolve()})),s.promise})(t,r).then((function(){o()}),(function(t){i(t)}))}),(function(t){i(t)}))}function o(t){var e=n.defer(),o=[];return r(t,(function(t){t.forEach((function(t){o.push(t)}))}),(function(){e.resolve(o)}),(function(t){e.reject(t)})),e.promise}function i(t,r){var o=n.defer();return e.search(t).then((function(t){var n={},i=[function(){o.resolve(t,n)}];function u(t,r,o){i.push((function(){!function(t,r,o){var i=o.reference;e.resolve({bundle:t,resource:r,reference:o}).then((function(t){var e=t.data||t.content;n[i]=e,c()}))}(t,r,o)}))}function c(){i.pop()()}var s=t.data;s.entry&&s.entry.forEach((function(t){var e=t.resource,o=e.resourceType;r&&r.forEach((function(t){var r=t.split("."),i=r[0],c=r[1],a=e[c];if(o===i&&a){var f=a.reference;n[f]||u(s,e,a)}}))})),c()}),(function(){o.reject("Could not fetch search results")})),o.promise}t.exports=function(t,u){return e=t,n=u,t.drain=r,t.fetchAll=o,t.fetchAllWithReferences=i,t}}).call(this)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),o=n(2);function i(t,e){return function(n){return n.lift(new u(t,e))}}var u=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.predicate,this.thisArg))},t}(),c=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.count=0,o}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(o.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return O}));var r=n(0),o=n(24),i=n(1),u=n(21),c=n(7);function s(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var a=s(),f=n(6),l=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function h(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}var d=n(18),p=function(t){if(t&&"function"==typeof t[f.a])return r=t,function(t){var e=r[f.a]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if(l(t))return Object(u.a)(t);if(h(t))return n=t,function(t){return n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,c.a),t};if(t&&"function"==typeof t[a])return e=t,function(t){for(var n=e[a]();;){var r=void 0;try{r=n.next()}catch(e){return t.error(e),t}if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof n.return&&t.add((function(){n.return&&n.return()})),t};var e,n,r,o=Object(d.a)(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+o+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")},b=n(3);var v=n(13);function y(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[f.a]}(t))return function(t,e){return new i.a((function(n){var r=new b.a;return r.add(e.schedule((function(){var o=t[f.a]();r.add(o.subscribe({next:function(t){r.add(e.schedule((function(){return n.next(t)})))},error:function(t){r.add(e.schedule((function(){return n.error(t)})))},complete:function(){r.add(e.schedule((function(){return n.complete()})))}}))}))),r}))}(t,e);if(h(t))return function(t,e){return new i.a((function(n){var r=new b.a;return r.add(e.schedule((function(){return t.then((function(t){r.add(e.schedule((function(){n.next(t),r.add(e.schedule((function(){return n.complete()})))})))}),(function(t){r.add(e.schedule((function(){return n.error(t)})))}))}))),r}))}(t,e);if(l(t))return Object(v.a)(t,e);if(function(t){return t&&"function"==typeof t[a]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new i.a((function(n){var r,o=new b.a;return o.add((function(){r&&"function"==typeof r.return&&r.return()})),o.add(e.schedule((function(){r=t[a](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var o=r.next();t=o.value,e=o.done}catch(t){return void n.error(t)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}var m=n(2),w=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,n}return r.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(m.a),g=(m.a,function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(m.a));m.a;function _(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(r){return r.pipe(_((function(n,r){return(u=t(n,r),c?y(u,c):u instanceof i.a?u:new i.a(p(u))).pipe(Object(o.a)((function(t,o){return e(n,t,r,o)})));var u,c}),n))}:("number"==typeof e&&(n=e),function(e){return e.lift(new x(t,n))})}var x=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new E(t,this.project,this.concurrent))},t}(),E=function(t){function e(e,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var o=t.call(this,e)||this;return o.project=n,o.concurrent=r,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return r.a(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new w(this),n=this.destination;n.add(e);var r=function(t,e){if(!e.closed)return t instanceof i.a?t.subscribe(e):p(t)(e)}(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(g),S=n(19);function O(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),_(S.a,t)}}]))}}}));
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return f}));var r=n(2);var o=n(10),i=n(14);var u=n(6),c=n(19);function s(t){return 0===t.length?c.a:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var a=n(4),f=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var u=this.operator,c=function(t,e,n){if(t){if(t instanceof r.a)return t;if(t[o.a])return t[o.a]()}return t||e||n?new r.a(t,e,n):new r.a(i.a)}(t,e,n);if(u?c.add(u.call(c,this.source)):c.add(this.source||a.a.useDeprecatedSynchronousErrorHandling&&!c.syncErrorThrowable?this._subscribe(c):this._trySubscribe(c)),a.a.useDeprecatedSynchronousErrorHandling&&c.syncErrorThrowable&&(c.syncErrorThrowable=!1,c.syncErrorThrown))throw c.syncErrorValue;return c},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),!function(t){for(;t;){var e=t,n=e.closed,o=e.destination,i=e.isStopped;if(n||i)return!1;t=o&&o instanceof r.a?o:null}return!0}(t)?console.warn(e):t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=l(e))((function(e,r){var o;o=n.subscribe((function(e){try{t(e)}catch(t){r(t),o&&o.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[u.a]=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:s(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=l(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function l(t){if(t||(t=a.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},function(t,e,n){"use strict";n.d(e,"a",(function(){return f}));var r=n(0),o=n(11),i=n(14),u=n(3),c=n(10),s=n(4),a=n(7),f=function(t){function e(n,r,o){var u=t.call(this)||this;switch(u.syncErrorValue=null,u.syncErrorThrown=!1,u.syncErrorThrowable=!1,u.isStopped=!1,arguments.length){case 0:u.destination=i.a;break;case 1:if(!n){u.destination=i.a;break}if("object"==typeof n){n instanceof e?(u.syncErrorThrowable=n.syncErrorThrowable,u.destination=n,n.add(u)):(u.syncErrorThrowable=!0,u.destination=new l(u,n));break}default:u.syncErrorThrowable=!0,u.destination=new l(u,n,r,o)}return u}return r.a(e,t),e.prototype[c.a]=function(){return this},e.create=function(t,n,r){var o=new e(t,n,r);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(u.a),l=function(t){function e(e,n,r,u){var c,s=t.call(this)||this;s._parentSubscriber=e;var a=s;return Object(o.a)(n)?c=n:n&&(c=n.next,r=n.error,u=n.complete,n!==i.a&&(a=Object.create(n),Object(o.a)(a.unsubscribe)&&s.add(a.unsubscribe.bind(a)),a.unsubscribe=s.unsubscribe.bind(s))),s._context=a,s._next=c,s._error=r,s._complete=u,s}return r.a(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;s.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=s.a.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(a.a)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;Object(a.a)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};s.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),s.a.useDeprecatedSynchronousErrorHandling)throw t;Object(a.a)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!s.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return s.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(Object(a.a)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(f)},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}(),o=n(18),i=n(11),u=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}(),c=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this._parentOrParents,c=this._ctorUnsubscribe,a=this._unsubscribe,f=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(var l=0;l<n.length;++l){n[l].remove(this)}if(Object(i.a)(a)){c&&(this._unsubscribe=void 0);try{a.call(this)}catch(t){e=t instanceof u?s(t.errors):[t]}}if(r(f)){l=-1;for(var h=f.length;++l<h;){var d=f[l];if(Object(o.a)(d))try{d.unsubscribe()}catch(t){e=e||[],t instanceof u?e=e.concat(s(t.errors)):e.push(t)}}}if(e)throw new u(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof t){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function s(t){return t.reduce((function(t,e){return t.concat(e instanceof u?e.errors:e)}),[])}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;r=t},get useDeprecatedSynchronousErrorHandling(){return r}}},function(t,n){t.exports=e},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(t,e,n){"use strict";function r(t){setTimeout((function(){throw t}),0)}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},function(t,e,n){"use strict";n.d(e,"e",(function(){return O})),n.d(e,"b",(function(){return j})),n.d(e,"c",(function(){return P})),n.d(e,"d",(function(){return T})),n.d(e,"a",(function(){return $}));var r=n(1),o=n(32),i="object"==typeof self&&self&&self.Object===Object&&self,u=(o.a||i||Function("return this")()).Symbol,c=Object.prototype,s=c.hasOwnProperty,a=c.toString,f=u?u.toStringTag:void 0;var l=function(t){var e=s.call(t,f),n=t[f];try{t[f]=void 0;var r=!0}catch(t){}var o=a.call(t);return r&&(e?t[f]=n:delete t[f]),o},h=Object.prototype.toString;var d=function(t){return h.call(t)},p=u?u.toStringTag:void 0;var b=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":p&&p in Object(t)?l(t):d(t)};var v=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object);var y=function(t){return null!=t&&"object"==typeof t},m=Function.prototype,w=Object.prototype,g=m.toString,_=w.hasOwnProperty,x=g.call(Object);var E=function(t){if(!y(t)||"[object Object]"!=b(t))return!1;var e=v(t);if(null===e)return!0;var n=_.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&g.call(n)==x},S=n(5);const O="/ws/rest/v1/session";function j(t){return window.openmrsBase+t}function P(t,e={}){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.");const n=j(t);e.headers||(e.headers={}),E(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;const r=Error();return window.fetch(n,e).then(async t=>{const e=t;if(e.ok)return 204===e.status?(e.data=null,e):e.json().then(t=>(e.data=t,e));{const{redirectAuthFailure:t}=await Object(S.getConfig)("@openmrs/esm-api");return n===j(O)&&403===e.status||t.enabled&&t.errors.includes(e.status)?(Object(S.navigate)({to:t.url}),t.resolvePromise?Promise.resolve():new Promise(()=>{})):e.text().then(t=>{let o=t;try{o=JSON.parse(t)}catch(t){}throw new $(n,e,o,r)},t=>{throw new $(n,e,null,r)})}})}function T(t,e={}){if("object"!=typeof e)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");const n=new AbortController;return e.signal=n.signal,new r.a(r=>{let o=!1;return P(t,e).then(t=>{o=!0,r.next(t),r.complete()},t=>{o=!0,r.error(t)}),()=>{o||n.abort()}})}class $ extends Error{constructor(t,e,n,r){super(),this.message=`Server responded with ${e.status} (${e.statusText}) for url ${t}. Check err.responseBody or network tab in dev tools for more info`,r.message=this.message,this.responseBody=n,this.response=e,this.stack=`Stacktrace for outgoing request:\n${r.stack}\nStacktrace for incoming response:\n${this.stack}`}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(t,e,n){"use strict";function r(t){return"function"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){(function(){var t=n(40),r=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=function(t){return t?t.toString().replace(r,""):""};e.trim=o;var i=function(t){return null==t&&void 0===t?String(t):{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"}[Object.prototype.toString.call(t)]};e.type=i;e.assertArray=function(t){if("array"!==i(t))throw"not array";return t};var u=function(t){if("object"!==i(t))throw"not object";return t};e.assertObject=u;var c=function(t,e,n){var r,o;return n||(n=[]),u(t),function(){var e;for(r in e=[],t)o=t[r],e.push([r,o]);return e}().reduce(e,n)};e.reduceMap=c;e.identity=function(t){return t};var s=function(){return Array.prototype.slice.call(arguments)};e.argsArray=s;e.mergeLists=function(){var e;return e=function(e,n){var r,o,i;for(r in o=t(!0,e),n)i=n[r],o[r]=(o[r]||[]).concat(i);return o},s.apply(null,arguments).reduce(e,{})};e.absoluteUrl=function(t,e){return e.match(/https?:\/\/./)?e:t+"/"+e};e.relativeUrl=function(t,e){return e.slice(e,t.length+1)===t+"/"?e.slice(t.length+1):e},e.resourceIdToUrl=function(t,e,n){return e=e.replace(/\/$/,""),(t=t.replace(/^\//,"")).indexOf("/")<0?e+"/"+n+"/"+t:0!==t.indexOf(e)?e+"/"+t:t};var a=function(t,e,n,r){var o;switch(i(n)){case"array":return e(n.map((function(e){return t(e,[n,r])})),r);case"object":return o=function(e,o){var i,u;return i=o[0],u=o[1],e[i]=t(u,[n].concat(r)),e},e(c(n,o,{}),r);default:return e(n,r)}};e.walk=a;var f=function(t,e,n){return e?a(f(t),t,e,n):function(e,n){return f(t,e,n)}};e.postwalk=f}).call(this)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(1),o=n(3);function i(t,e){return new r.a((function(n){var r=new o.a,i=0;return r.add(e.schedule((function(){i!==t.length?(n.next(t[i++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(4),o=n(7),i={closed:!0,next:function(t){},error:function(t){if(r.a.useDeprecatedSynchronousErrorHandling)throw t;Object(o.a)(t)},complete:function(){}}},function(t,e,n){(function(){var t=n(12),r=function(t){return t.and=function(e){return r((n=t,o=e,function(t){return n(o(t))}));var n,o},t.end=function(e){return t(e)},t};e.$$Simple=function(t){return function(e){return function(n){return e(t(n))}}};e.$$Attr=function(e,n){return r((function(r){return function(o){var i=null;return i="function"==t.type(n)?n(o):n,r(null==i&&null==i?o:function(t,e,n){for(var r=e.split("."),o=t,i=0;i<r.length-1;i++){var u=r[i];(o=t[u])||(o={},t[u]=o)}return o[r[r.length-1]]=n,t}(o,e,i))}}))};var o=function(t,e){return r((function(n){return function(r){return r[t]=e(r),n(r)}}))};e.Middleware=r,e.Attribute=o,e.Method=function(t){return o("method",(e=t,function(){return e}));var e}}).call(this)},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return i}));var r=n(9);const o="/ws/fhir2/R4",i=n(39)({baseUrl:o},{http:t=>Object(r.c)(t.url,{method:t.method,headers:t.headers}).then(e=>({status:e.status,headers:e.headers,data:e.data,config:t}),e=>({status:e.response.status,headers:e.response.headers,data:e.responseBody,config:t}))})},function(t,e,n){"use strict";n.d(e,"a",(function(){return v})),n.d(e,"b",(function(){return m})),n.d(e,"c",(function(){return w}));var r=n(33),o=n(54),i=n(0),u=n(2);function c(){}var s=n(11);var a=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new f(t,this.nextOrObserver,this.error,this.complete))},t}(),f=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i._tapNext=c,i._tapError=c,i._tapComplete=c,i._tapError=r||c,i._tapComplete=o||c,Object(s.a)(n)?(i._context=i,i._tapNext=n):n&&(i._context=n,i._tapNext=n.next||c,i._tapError=n.error||c,i._tapComplete=n.complete||c),i}return i.a(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(u.a),l=n(24),h=n(53),d=n(9);const p=new r.a(1);let b=0;function v(t={includeAuthStatus:!1}){return b<Date.now()-6e4&&m(),p.asObservable().pipe(Object(o.a)(),(e=y,function(t){return t.lift(new a(e,n,r))}),Object(l.a)(e=>t.includeAuthStatus?e.data:e.data.user),Object(h.a)(Boolean));var e,n,r}function y(t){var e,n,r;if(null==t||null===(e=t.data)||void 0===e||null===(n=e.user)||void 0===n||null===(r=n.userProperties)||void 0===r?void 0:r.defaultLocale){const e=t.data.user.userProperties.defaultLocale;e!=document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",e)}}function m(){b=Date.now(),p.next(Object(d.c)(d.e))}function w(t,e){return function(t,e){return e.privileges.find(e=>t===e.display)}(t,e)||function(t){return t.roles.find(t=>"System Developer"===t.display)}(e)}},function(t,e,n){"use strict";function r(t){return null!==t&&"object"==typeof t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";function r(t){return t}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),o=function(t){function e(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return r.a(e,t),e.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 n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(n(3).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(t){return function(e){for(var n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.complete()}}},,function(t,e,n){"use strict";n.d(e,"a",(function(){return l}));var r=n(0),o=n(1),i=n(2),u=n(3),c=n(8),s=n(20),a=n(10),f=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return r.a(e,t),e}(i.a),l=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r.a(e,t),e.prototype[a.a]=function(){return new f(this)},e.prototype.lift=function(t){var e=new h(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new c.a;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new c.a;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new c.a;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new c.a;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new c.a;return this.hasError?(t.error(this.thrownError),u.a.EMPTY):this.isStopped?(t.complete(),u.a.EMPTY):(this.observers.push(t),new s.a(this,t))},e.prototype.asObservable=function(){var t=new o.a;return t.source=this,t},e.create=function(t,e){return new h(t,e)},e}(o.a),h=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r.a(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):u.a.EMPTY},e}(l)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),o=n(2);function i(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new u(t,e))}}var u=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.project,this.thisArg))},t}(),c=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.project=n,o.count=0,o.thisArg=r||o,o}return r.a(e,t),e.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)},e}(o.a)},function(t,e){},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(5),o=n(17);function i(){Object(r.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:r.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:r.Type.String,_default:"${openmrsSpaBase}/login",_validators:[r.validators.isUrl]},errors:{_type:r.Type.Array,_default:[401],_elements:{_type:r.Type.Number,_validators:[r.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:r.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."}}}),Object(o.b)()}},function(t,e,n){"use strict";n.d(e,"a",(function(){return l})),n.d(e,"c",(function(){return h})),n.d(e,"b",(function(){return d}));var r=n(33),o=n(16),i=n(54),u=n(24),c=n(53);let s;const a=new r.a(1),f=new r.a(1);function l(t={includeConfig:!1}){return f.asObservable().pipe(Object(i.a)(),Object(u.a)(e=>t.includeConfig?e:e.data),Object(c.a)(Boolean))}function h(){f.next(o.a.read({type:"Patient",patient:s}))}function d(){return a.asObservable()}window.addEventListener("single-spa:routing-event",()=>{const t=function(){const t=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return t&&t[1]}();t&&t!==s&&(s=t,a.next(t),t&&f.next(o.a.read({type:"Patient",patient:s})))})},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));const r={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return i}));const r=new(n(23).a);function o(t){r.next(t)}function i(){return r.asObservable()}},function(t,e,n){"use strict";function r(t,e){for(var n in e)t[n]=e[n];return t}n.d(e,"b",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"a",(function(){return s})),n.d(e,"c",(function(){return a}));var o=function(t){var e=[];function n(t){for(var n=[],r=0;r<e.length;r++)e[r]===t?t=null:n.push(e[r]);e=n}function o(n,o,i){t=o?n:r(r({},t),n);for(var u=e,c=0;c<u.length;c++)u[c](t,i)}return t=t||{},{action:function(e){function n(t){o(t,!1,e)}return function(){for(var r=arguments,o=[t],i=0;i<arguments.length;i++)o.push(r[i]);var u=e.apply(this,o);if(null!=u)return u.then?u.then(n):n(u)}},setState:o,subscribe:function(t){return e.push(t),function(){n(t)}},unsubscribe:n,getState:function(){return t}}};const i={};function u(t,e){const n=i[t];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(e,!0),n.active=!0,n.value;{const n=o(e);return i[t]={value:n,active:!0},n}}function c(t,e){const n=i[t];if(!n){const n=o(e);return i[t]={value:n,active:!1},n}return n.value}function s(t){return u("app",t)}function a(){return c("app",{})}},function(t,e,n){function r(t,e){const n=document.createElement("a");n.href=t;const r="/"===n.pathname[0]?n.pathname:"/"+n.pathname;let o=0,i=r.length;for(;o!==e&&i>=0;){"/"===r[--i]&&o++}if(o!==e)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+e+") is greater than the number of directories ("+o+") in the URL path "+t);const u=r.slice(0,i+1);return n.protocol+"//"+n.host+u}e.setPublicPath=function(t,e){if(e||(e=1),"string"!=typeof t||0===t.trim().length)throw Error("systemjs-webpack-interop: setPublicPath(systemjsModuleName) must be called with a non-empty string 'systemjsModuleName'");if("number"!=typeof e||e<=0||!o(e))throw Error("systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'");let i;try{if(i=window.System.resolve(t),!i)throw Error()}catch(e){throw Error("systemjs-webpack-interop: There is no such module '"+t+"' in the SystemJS registry. Did you misspell the name of your module?")}n.p=r(i,e)},e.resolveDirectory=r;const o=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}},function(t,e,n){"use strict";(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.a=n}).call(this,n(38))},function(t,e,n){"use strict";n.d(e,"a",(function(){return S}));var r=n(0),o=n(23),i=n(3),u=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.a(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return r.a(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n=!1,r=void 0;try{this.work(t)}catch(t){n=!0,r=!!t&&t||new Error(t)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,n){return t.call(this)||this}return r.a(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(i.a))),c=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}(),s=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e}(function(t){function e(n,r){void 0===r&&(r=c.now);var o=t.call(this,n,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return r.a(e,t),e.prototype.schedule=function(n,r,o){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,o):t.prototype.schedule.call(this,n,r,o)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(c)))(u),a=n(2),f=n(1),l=new f.a((function(t){return t.complete()}));function h(t){return t?function(t){return new f.a((function(e){return t.schedule((function(){return e.complete()}))}))}(t):l}function d(t){return t&&"function"==typeof t.schedule}var p,b=n(21),v=n(13);function y(t,e){return e?Object(v.a)(t,e):new f.a(Object(b.a)(t))}function m(t){var e=t.error;t.subscriber.error(e)}p||(p={});var w=function(){function t(t,e,n){this.kind=t,this.value=e,this.error=n,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}},t.prototype.accept=function(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)},t.prototype.toObservable=function(){var t,e;switch(this.kind){case"N":return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return d(n)?(t.pop(),Object(v.a)(t,n)):y(t)}(this.value);case"E":return t=this.error,e?new f.a((function(n){return e.schedule(m,0,{error:t,subscriber:n})})):new f.a((function(e){return e.error(t)}));case"C":return h()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();var g=function(t){function e(e,n,r){void 0===r&&(r=0);var o=t.call(this,e)||this;return o.scheduler=n,o.delay=r,o}return r.a(e,t),e.dispatch=function(t){var e=t.notification,n=t.destination;e.observe(n),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new _(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(w.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(w.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(w.createComplete()),this.unsubscribe()},e}(a.a),_=function(){return function(t,e){this.notification=t,this.destination=e}}(),x=n(8),E=n(20),S=function(t){function e(e,n,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=Number.POSITIVE_INFINITY);var o=t.call(this)||this;return o.scheduler=r,o._events=[],o._infiniteTimeWindow=!1,o._bufferSize=e<1?1:e,o._windowTime=n<1?1:n,n===Number.POSITIVE_INFINITY?(o._infiniteTimeWindow=!0,o.next=o.nextInfiniteTimeWindow):o.next=o.nextTimeWindow,o}return r.a(e,t),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var n=this._events;n.push(e),n.length>this._bufferSize&&n.shift()}t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new O(this._getNow(),e)),this._trimBufferThenGetEvents()),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),o=this.scheduler,u=r.length;if(this.closed)throw new x.a;if(this.isStopped||this.hasError?e=i.a.EMPTY:(this.observers.push(t),e=new E.a(this,t)),o&&t.add(t=new g(t,o)),n)for(var c=0;c<u&&!t.closed;c++)t.next(r[c]);else for(c=0;c<u&&!t.closed;c++)t.next(r[c].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||s).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,o=r.length,i=0;i<o&&!(t-r[i].time<n);)i++;return o>e&&(i=Math.max(i,o-e)),i>0&&r.splice(0,i),r},e}(o.a),O=function(){return function(t,e){this.time=t,this.value=e}}()},,function(t,e,n){n(36),t.exports=n(37)},function(t,e,n){"use strict";n.r(e);var r=n(31);Object(r.setPublicPath)("@openmrs/esm-api")},function(t,e,n){"use strict";n.r(e);var r=n(25);for(var o in r)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);var i=n(9);n.d(e,"sessionEndpoint",(function(){return i.e})),n.d(e,"makeUrl",(function(){return i.b})),n.d(e,"openmrsFetch",(function(){return i.c})),n.d(e,"openmrsObservableFetch",(function(){return i.d})),n.d(e,"OpenmrsFetchError",(function(){return i.a}));var u=n(16);n.d(e,"fhirBaseUrl",(function(){return u.b})),n.d(e,"fhir",(function(){return u.a}));var c=n(26);n.d(e,"setupApiModule",(function(){return c.a}));var s=n(30);n.d(e,"createGlobalStore",(function(){return s.b})),n.d(e,"getGlobalStore",(function(){return s.d})),n.d(e,"createAppState",(function(){return s.a})),n.d(e,"getAppState",(function(){return s.c}));var a=n(17);n.d(e,"getCurrentUser",(function(){return a.a})),n.d(e,"refetchCurrentUser",(function(){return a.b})),n.d(e,"userHasAccess",(function(){return a.c}));var f=n(27);n.d(e,"getCurrentPatient",(function(){return f.a})),n.d(e,"refetchCurrentPatient",(function(){return f.c})),n.d(e,"getCurrentPatientUuid",(function(){return f.b}));var l=n(28);n.d(e,"backendDependencies",(function(){return l.a}));var h=n(29);n.d(e,"newWorkspaceItem",(function(){return h.b})),n.d(e,"getNewWorkspaceItem",(function(){return h.a}))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(){n(12);var e=n(15),r=n(42),o=n(43),i=n(45),u=n(46),c=n(47),s=n(48),a=n(49),f=n(50),l=n(51),h=n(52);t.exports=function(t,n){var d=e.Middleware,p=e.$$Attr,b=function(t){return p("method",t)},v=function(t,e){return p("headers."+t,e)},y=d(u),m=d(c(t,n)).and(y).and(o.$Basic).and(o.$Bearer).and(o.$Credentials).and(i.$JsonData).and(v("Accept",t.headers&&t.headers.Accept?t.headers.Accept:"application/json")).and(v("Content-Type",t.headers&&t.headers["Content-Type"]?t.headers["Content-Type"]:"application/json")),w=m.and(b("GET")),g=m.and(b("POST")),_=m.and(b("PUT")),x=m.and(b("DELETE")),E=m.and(b("PATCH")),S=i.Http(t,n),O=l.Path,j=O(t.baseUrl),P=j.slash(":type || :resource.resourceType"),T=P.slash("_history"),$=P.slash(":id || :resource.id"),A=$.slash("_history"),I=$.slash(":versionId || :resource.meta.versionId"),N=j.slash(":target.resourceType || :target.type").slash(":target.id").slash(":target.versionId"),C=v("Prefer","return=representation"),k=d(r.$Paging);return h({conformance:w.and(j.slash("metadata")).end(S),document:g.and(j.slash("Document")).end(S),profile:w.and(j.slash("Profile").slash(":type")).end(S),transaction:g.and(j).end(S),history:w.and(j.slash("_history")).and(k).end(S),typeHistory:w.and(T).and(k).end(S),resourceHistory:w.and(A).and(k).end(S),read:w.and(a.$WithPatient).and($).end(S),vread:w.and(I).end(S),delete:x.and($).and(C).end(S),create:g.and(P).and(C).end(S),validate:g.and(P.slash("_validate")).end(S),meta:{add:g.and(N.slash("$meta-add")).end(S),delete:g.and(N.slash("$meta-delete")).end(S),read:w.and(N.slash("$meta")).end(S)},search:w.and(P).and(a.$WithPatient).and(r.$SearchParams).and(k).end(S),update:_.and($).and(C).end(S),conditionalUpdate:_.and(P).and(r.$SearchParams).and(C).end(S),conditionalDelete:x.and(P).and(r.$SearchParams).and(C).end(S),nextPage:w.and(s.$$BundleLinkUrl("next")).end(S),prevPage:w.and(s.$$BundleLinkUrl("previous")).and(s.$$BundleLinkUrl("prev")).end(S),getBundleByUrl:w.and(O(":url")).end(S),resolve:w.and(f.resolve).end(S),patch:E.and($).and(v("Content-Type","application/json-patch+json")).end(S)},n)}}).call(this)},function(t,e,n){(function(t){!function(e){var n=function(t){return o(!0===t,!1,arguments)};function r(t,e){if("object"!==i(t))return e;for(var n in e)"object"===i(t[n])&&"object"===i(e[n])?t[n]=r(t[n],e[n]):t[n]=e[n];return t}function o(t,e,o){var u=o[0],c=o.length;(t||"object"!==i(u))&&(u={});for(var s=0;s<c;++s){var a=o[s];if("object"===i(a))for(var f in a)if("__proto__"!==f){var l=t?n.clone(a[f]):a[f];u[f]=e?r(u[f],l):l}}return u}function i(t){return{}.toString.call(t).slice(8,-1).toLowerCase()}n.recursive=function(t){return o(!0===t,!0,arguments)},n.clone=function(t){var e,r,o=t,u=i(t);if("array"===u)for(o=[],r=t.length,e=0;e<r;++e)o[e]=n.clone(t[e]);else if("object"===u)for(e in o={},t)o[e]=n.clone(t[e]);return o},e?t.exports=n:window.merge=n}(t&&"object"==typeof t.exports&&t.exports)}).call(this,n(41)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){(function(){var t=n(12),r=t.type,o=t.assertArray,i=(t.assertObject,t.reduceMap),u=t.identity,c={$gt:"gt",$lt:"lt",$lte:"lte",$gte:"gte",$ge:"ge",$le:"le"},s={$asc:":asc",$desc:":desc",$exact:":exact",$missing:":missing",$null:":missing",$text:":text"},a=function(t,e){if("$sort"===t)return function(t){var e,n,i,u;for(o(t),i=[],e=0,n=t.length;e<n;e++)switch(u=t[e],r(u)){case"array":i.push({param:"_sort",value:u[0],modifier:":"+u[1]});break;case"string":i.push({param:"_sort",value:u});break;default:i.push(void 0)}return i}(e);if("$has"===t)return i(e,(function(t,e){var n,o;return n=e[0],o=e[1],t.concat(function(){switch(r(o)){case"array":return o.map((function(t){return{param:"_has",value:n+"="+t}}));case"string":return[{param:"_has",value:n+"="+o}]}}())}));if("$include"===t||"$revInclude"===t)return function(t,e){return i(t,(function(t,n){var o,i;return o=n[0],i=n[1],t.concat(function(){switch(r(i)){case"array":return i.map((function(t){return{param:"$include"===e?"_include":"_revinclude",value:o+":"+t}}));case"string":return[{param:"$include"===e?"_include":"_revinclude",value:o+":"+i}]}}())}))}(e,t);switch(r(e)){case"object":return function(t,e){return i(e,(function(n,i){var u,f,l,h;return u=i[0],h=i[1],n.concat("$and"===u?o(h).reduce((function(e,n){return e.concat(a(t,n))}),[]):"$type"===u?[]:function(t){return 0===t.indexOf("$")}(u)?(f={param:t},"$or"===u?f.value=h:(c[u]&&(f.operator=c[u]),s[u]&&(f.modifier=s[u]),"object"===r(h)&&h.$or?f.value=h.$or:f.value=[h]),[f]):(e.$type&&(l=":"+e.$type),a(""+t+(l||"")+"."+u,h)))}))}(t,e);case"string":case"number":return[{param:t,value:[e]}];case"array":return[{param:t,value:[e.join("|")]}];default:throw"could not linearizeParams "+r(e)}},f=function(t){return i(t,(function(t,e){var n,r;return n=e[0],r=e[1],t.concat(a(n,r))}))},l=function(t){var e,n,r=["_include","_revinclude","_has"];return function(){var o,i,c,s;for(s=[],o=0,i=(c=f(t)).length;o<i;o++)e=c[o],n=-1===r.indexOf(e.param)?encodeURIComponent(e.value):e.value,s.push([e.param,e.modifier,"_has"==e.param?":":"=",e.operator,n].filter(u).join(""));return s}().join("&")};e._query=f,e.query=l;var h=n(15);e.$SearchParams=h.$$Attr("url",(function(t){var e=t.url;return t.query?e+"?"+l(t.query):e})),e.$Paging=function(t){return function(e){var n=e.params||{};return e.since&&(n._since=e.since),e.count&&(n._count=e.count),e.params=n,t(e)}}}).call(this)},function(t,e,n){(function(){var t,r=n(15),o=n(44).btoa;e.$Basic=r.$$Attr("headers.Authorization",(function(t){if(t.auth&&t.auth.user&&t.auth.pass)return"Basic "+o(t.auth.user+":"+t.auth.pass)})),e.$Bearer=r.$$Attr("headers.Authorization",(function(t){if(t.auth&&t.auth.bearer)return"Bearer "+t.auth.bearer})),e.$Credentials=r.Middleware(r.$$Attr("credentials",(function(e){return t=e.credentials,""}))).and(r.$$Attr("credentials",(function(e){if(["same-origin","include"].indexOf(t)>-1)return t})))}).call(this)},function(t,e,n){!function(){var t=e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function r(t){this.message=t}r.prototype=new Error,r.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var e,o,i=String(t),u=0,c=n,s="";i.charAt(0|u)||(c="=",u%1);s+=c.charAt(63&e>>8-u%1*8)){if((o=i.charCodeAt(u+=3/4))>255)throw new r("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|o}return s}),t.atob||(t.atob=function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,u=0,c=0,s="";i=e.charAt(c++);~i&&(o=u%4?64*o+i:i,u++%4)?s+=String.fromCharCode(255&o>>(-2*u&6)):0)i=n.indexOf(i);return s})}()},function(t,e,n){(function(){var t=n(12);e.Http=function(t,e){return function(n){n.debug&&console.log("\nDEBUG (request):",n.method,n.url,n);var r=(n.http||e.http||t.http)(n);return n.debug&&r&&r.then&&r.then((function(t){console.log("\nDEBUG: (responce)",t)})),r}};e.$JsonData=function(e){return function(n){var r,o=n.bundle||n.data||n.resource;return o&&(n.data=(r=o,"object"==t.type(r)||"array"==t.type(r)?JSON.stringify(r):r)),e(n)}}}).call(this)},function(t,e){t.exports=function(t){return function(e){try{return t(e)}catch(t){if(e.debug&&(console.log("\nDEBUG: (ERROR in middleware)"),console.log(t.message),console.log(t.stack)),!e.defer)throw console.log("\nDEBUG: (ERROR in middleware)"),console.log(t.message),console.log(t.stack),new Error("I need adapter.defer");var n=e.defer();return n.reject(t),n.promise}}}},function(t,e){(function(){var e=function(t,e,n){var r=t[n];return r&&!e[n]&&(e[n]=r),t};t.exports=function(t,n){return function(r){return function(o){return e(t,o,"baseUrl"),e(t,o,"cache"),e(t,o,"auth"),e(t,o,"patient"),e(t,o,"debug"),e(t,o,"credentials"),e(t,o,"headers"),e(t,o,"agentOptions"),e(n,o,"defer"),e(n,o,"http"),r(o)}}}}).call(this)},function(t,e){e.$$BundleLinkUrl=function(t){return function(e){return function(n){var r=n.bundle&&(n.bundle.link||[]).filter((function(e){return e.relation&&e.relation===t}))[0];return r&&r.url&&(n.url=r.url,n.data=null),e(n)}}}},function(t,e,n){(function(){var t=n(15),r=["Account","AllergyIntolerance","BodySite","CarePlan","Claim","ClinicalImpression","Communication","CommunicationRequest","Composition","Condition","Contract","DetectedIssue","Device","DeviceUseRequest","DeviceUseStatement","DiagnosticOrder","DiagnosticReport","DocumentManifest","DocumentReference","Encounter","EnrollmentRequest","EpisodeOfCare","FamilyMemberHistory","Flag","Goal","ImagingObjectSelection","ImagingStudy","Immunization","ImmunizationRecommendation","List","Media","MedicationAdministration","MedicationDispense","MedicationOrder","MedicationStatement","NutritionOrder","Observation","Order","Procedure","ProcedureRequest","QuestionnaireResponse","ReferralRequest","RelatedPerson","RiskAssessment","Specimen","SupplyDelivery","SupplyRequest","VisionPrescription"];e.$WithPatient=t.$$Simple((function(t){var e=t.type;return t.patient&&("Patient"===e?(t.query=t.query||{},t.query._id=t.patient,t.id=t.patient):r.indexOf(e)>=0&&(t.query=t.query||{},t.query.patient=t.patient)),t}))}).call(this)},function(t,e,n){(function(){var e=n(12),r=/^#(.*)/,o=function(t){var n=t.cache,o=t.reference,i=t.bundle,u=o;if(!u.reference)return null;if(u.reference.match(r))return function(t,e){var n=t.match(r)[1],o=(e.contained||[]).filter((function(t){return(t.id||t._id)==n}))[0];return o&&{content:o}||null}(u.reference,t.resource);var c=e.absoluteUrl(t.baseUrl,u.reference);return(i&&i.entry||[]).filter((function(t){return t.id===c}))[0]||(null!=n?n[c]:void 0)||null};t.exports.sync=o,t.exports.resolve=function(t){return function(n){var i=o(n),u=n.reference,c=n.defer();if(i){if(!n.defer)throw new Error("I need promise constructor 'adapter.defer' in adapter");return c.resolve(i),c.promise}if(!u)throw new Error("No reference found");if(u&&u.reference.match(r))throw new Error("Contained resource not found");return n.url=e.absoluteUrl(n.baseUrl,u.reference),n.data=null,t(n)}}}).call(this)},function(t,e,n){(function(){n(12);var t=n(15),r=function(e,n){var o=function(t){return n&&e.includes("target.versionId")&&!t.target.versionId?n(t):(n&&n(t)+"/"||"")+function(t,e){var n=function(t,e){return 0==t.indexOf(":")?function(t,e){for(var n,r=t.split("||").map((function(t){return t.trim().substring(1)})),o=0;o<r.length;o++){var i=(n=e,r[o].split(".").reduce((function(t,e){return"versionId"===e&&t[e]?"_history/"+t[e]:null==t||null==t?null:t[e]}),n));if(i)return i}return null}(t,e):t}(t.trim(),e);if((null==n||void 0===n)&&0==t.includes("target.versionId"))throw new Error("Parameter "+t+" is required: "+JSON.stringify(e));return n}(e,t)},i=t.Attribute("url",o);return i.slash=function(t){return r(t,o)},i};e.Path=r}).call(this)},function(t,e){(function(){var e,n;function r(t,r,o,i){n.defer();e.search(t).then((function(t){(function t(r,o){var i,u=r.data.entry||[],c=[];for(i=0;i<u.length;i++)c.push(u[i].resource);o(c);var s=n.defer();return e.nextPage({bundle:r.data}).then((function(e){t(e,o).then((function(t){s.resolve()}))}),(function(t){s.resolve()})),s.promise})(t,r).then((function(){o()}),(function(t){i(t)}))}),(function(t){i(t)}))}function o(t){var e=n.defer(),o=[];return r(t,(function(t){t.forEach((function(t){o.push(t)}))}),(function(){e.resolve(o)}),(function(t){e.reject(t)})),e.promise}function i(t,r){var o=n.defer();return e.search(t).then((function(t){var n={},i=[function(){o.resolve(t,n)}];function u(t,r,o){i.push((function(){!function(t,r,o){var i=o.reference;e.resolve({bundle:t,resource:r,reference:o}).then((function(t){var e=t.data||t.content;n[i]=e,c()}))}(t,r,o)}))}function c(){i.pop()()}var s=t.data;s.entry&&s.entry.forEach((function(t){var e=t.resource,o=e.resourceType;r&&r.forEach((function(t){var r=t.split("."),i=r[0],c=r[1],a=e[c];if(o===i&&a){var f=a.reference;n[f]||u(s,e,a)}}))})),c()}),(function(){o.reject("Could not fetch search results")})),o.promise}t.exports=function(t,u){return e=t,n=u,t.drain=r,t.fetchAll=o,t.fetchAllWithReferences=i,t}}).call(this)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0),o=n(2);function i(t,e){return function(n){return n.lift(new u(t,e))}}var u=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.predicate,this.thisArg))},t}(),c=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.count=0,o}return r.a(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(o.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return O}));var r=n(0),o=n(24),i=n(1),u=n(21),c=n(7);function s(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var a=s(),f=n(6),l=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function h(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}var d=n(18),p=function(t){if(t&&"function"==typeof t[f.a])return r=t,function(t){var e=r[f.a]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if(l(t))return Object(u.a)(t);if(h(t))return n=t,function(t){return n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,c.a),t};if(t&&"function"==typeof t[a])return e=t,function(t){for(var n=e[a]();;){var r=void 0;try{r=n.next()}catch(e){return t.error(e),t}if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof n.return&&t.add((function(){n.return&&n.return()})),t};var e,n,r,o=Object(d.a)(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+o+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")},b=n(3);var v=n(13);function y(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[f.a]}(t))return function(t,e){return new i.a((function(n){var r=new b.a;return r.add(e.schedule((function(){var o=t[f.a]();r.add(o.subscribe({next:function(t){r.add(e.schedule((function(){return n.next(t)})))},error:function(t){r.add(e.schedule((function(){return n.error(t)})))},complete:function(){r.add(e.schedule((function(){return n.complete()})))}}))}))),r}))}(t,e);if(h(t))return function(t,e){return new i.a((function(n){var r=new b.a;return r.add(e.schedule((function(){return t.then((function(t){r.add(e.schedule((function(){n.next(t),r.add(e.schedule((function(){return n.complete()})))})))}),(function(t){r.add(e.schedule((function(){return n.error(t)})))}))}))),r}))}(t,e);if(l(t))return Object(v.a)(t,e);if(function(t){return t&&"function"==typeof t[a]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new i.a((function(n){var r,o=new b.a;return o.add((function(){r&&"function"==typeof r.return&&r.return()})),o.add(e.schedule((function(){r=t[a](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var o=r.next();t=o.value,e=o.done}catch(t){return void n.error(t)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}var m=n(2),w=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,n}return r.a(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(m.a),g=(m.a,function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.a(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(m.a));m.a;function _(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(r){return r.pipe(_((function(n,r){return(u=t(n,r),c?y(u,c):u instanceof i.a?u:new i.a(p(u))).pipe(Object(o.a)((function(t,o){return e(n,t,r,o)})));var u,c}),n))}:("number"==typeof e&&(n=e),function(e){return e.lift(new x(t,n))})}var x=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new E(t,this.project,this.concurrent))},t}(),E=function(t){function e(e,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var o=t.call(this,e)||this;return o.project=n,o.concurrent=r,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return r.a(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new w(this),n=this.destination;n.add(e);var r=function(t,e){if(!e.closed)return t instanceof i.a?t.subscribe(e):p(t)(e)}(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(g),S=n(19);function O(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),_(S.a,t)}}]))}}}));
//# sourceMappingURL=openmrs-esm-api.js.map
{
"name": "@openmrs/esm-api",
"version": "3.1.6",
"version": "3.1.7",
"license": "MPL-2.0",

@@ -46,4 +46,4 @@ "description": "The javascript module for interacting with the OpenMRS API",

"devDependencies": {
"@openmrs/esm-config": "^3.1.6",
"@openmrs/esm-error-handling": "^3.1.6",
"@openmrs/esm-config": "^3.1.7",
"@openmrs/esm-error-handling": "^3.1.7",
"@types/fhir": "0.0.31",

@@ -55,3 +55,3 @@ "rxjs": "^6.5.3"

},
"gitHead": "d5efde6b10eb2c7bbd8798dcbf19d278c017c959"
"gitHead": "7c5de2b0cdcab1a2a3fd67cc79a9f4a924f40b5a"
}

@@ -6,7 +6,13 @@ import { Observable } from "rxjs";

export const sessionEndpoint = "/ws/rest/v1/session";
export function makeUrl(path: string) {
return window.openmrsBase + path;
}
export function openmrsFetch<T = any>(
url: string,
path: string,
fetchInit: FetchConfig = {}
): Promise<FetchResponse<T>> {
if (typeof url !== "string") {
if (typeof path !== "string") {
throw Error(

@@ -32,3 +38,3 @@ "The first argument to @openmrs/api's openmrsFetch function must be a url string"

// @ts-ignore
url = window.openmrsBase + url;
const url = makeUrl(path);

@@ -96,5 +102,7 @@ // We're going to need some headers

const { redirectAuthFailure } = await getConfig("@openmrs/esm-api");
if (
redirectAuthFailure.enabled &&
redirectAuthFailure.errors.includes(response.status)
(url === makeUrl(sessionEndpoint) && response.status === 403) ||
(redirectAuthFailure.enabled &&
redirectAuthFailure.errors.includes(response.status))
) {

@@ -109,3 +117,3 @@ navigate({ to: redirectAuthFailure.url });

? ((Promise.resolve() as unknown) as Promise<FetchResponse>)
: new Promise<FetchResponse>((resolve) => {});
: new Promise<FetchResponse>(() => {});
} else {

@@ -112,0 +120,0 @@ // Attempt to download a response body, if it has one

import { Observable, ReplaySubject } from "rxjs";
import { filter, map, tap, mergeAll } from "rxjs/operators";
import { openmrsFetch } from "../openmrs-fetch";
import { openmrsFetch, sessionEndpoint } from "../openmrs-fetch";
import {

@@ -63,3 +63,3 @@ LoggedInUserFetchResponse,

lastFetchTimeMillis = Date.now();
userSubject.next(openmrsFetch("/ws/rest/v1/session"));
userSubject.next(openmrsFetch(sessionEndpoint));
}

@@ -66,0 +66,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc