@openmrs/esm-api 4.3.2-pre.661 → 4.3.2-pre.666
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -8
- package/dist/openmrs-esm-api.js +1 -1
- package/dist/openmrs-esm-api.js.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +7 -6
- package/src/index.ts +0 -1
- package/src/openmrs-fetch.ts +24 -5
- package/src/public.ts +0 -1
- package/src/shared-api-objects/current-patient.test.ts +25 -25
- package/src/shared-api-objects/current-patient.ts +42 -11
- package/src/types/fhir.ts +0 -72
- package/src/fhir.ts +0 -74
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
[33m@openmrs/esm-api:build[0m: cache hit, replaying output [
|
|
1
|
+
[33m@openmrs/esm-api:build[0m: cache hit, replaying output [2m8d8ecd41e99bb751[0m
|
|
2
2
|
[33m@openmrs/esm-api:build: [0mBrowserslist: caniuse-lite is outdated. Please run:
|
|
3
3
|
[33m@openmrs/esm-api:build: [0m npx update-browserslist-db@latest
|
|
4
4
|
[33m@openmrs/esm-api:build: [0m Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
5
|
-
[33m@openmrs/esm-api:build: [0masset [1m[32mopenmrs-esm-api.js[39m[22m
|
|
6
|
-
[33m@openmrs/esm-api:build: [0morphan modules
|
|
5
|
+
[33m@openmrs/esm-api:build: [0masset [1m[32mopenmrs-esm-api.js[39m[22m 34 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (name: main) 2 related assets
|
|
6
|
+
[33m@openmrs/esm-api:build: [0morphan modules 384 KiB [1m[33m[orphan][39m[22m 226 modules
|
|
7
7
|
[33m@openmrs/esm-api:build: [0mruntime modules 1.76 KiB 6 modules
|
|
8
|
-
[33m@openmrs/esm-api:build: [0mbuilt modules
|
|
9
|
-
[33m@openmrs/esm-api:build: [0m cacheable modules
|
|
8
|
+
[33m@openmrs/esm-api:build: [0mbuilt modules 106 KiB [1m[33m[built][39m[22m
|
|
9
|
+
[33m@openmrs/esm-api:build: [0m cacheable modules 106 KiB
|
|
10
10
|
[33m@openmrs/esm-api:build: [0m modules by path [1m../../../node_modules/systemjs-webpack-interop/[39m[22m 3.27 KiB
|
|
11
11
|
[33m@openmrs/esm-api:build: [0m [1m../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js[39m[22m 89 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
12
12
|
[33m@openmrs/esm-api:build: [0m [1m../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js[39m[22m 846 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
13
13
|
[33m@openmrs/esm-api:build: [0m [1m../../../node_modules/systemjs-webpack-interop/public-path.js[39m[22m 2.36 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
14
|
-
[33m@openmrs/esm-api:build: [0m [1m./src/index.ts +
|
|
14
|
+
[33m@openmrs/esm-api:build: [0m [1m./src/index.ts + 44 modules[39m[22m 95.6 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
15
15
|
[33m@openmrs/esm-api:build: [0m [1m../esm-state/dist/openmrs-esm-state.js[39m[22m 7.44 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
16
|
-
[33m@openmrs/esm-api:build: [0m modules by path [1mexternal "@openmrs/[39m[22m
|
|
16
|
+
[33m@openmrs/esm-api:build: [0m modules by path [1mexternal "@openmrs/[39m[22m 126 bytes
|
|
17
17
|
[33m@openmrs/esm-api:build: [0m [1mexternal "@openmrs/esm-config"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
18
18
|
[33m@openmrs/esm-api:build: [0m [1mexternal "@openmrs/esm-error-handling"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
19
|
-
[33m@openmrs/esm-api:build: [
|
|
19
|
+
[33m@openmrs/esm-api:build: [0m [1mexternal "@openmrs/esm-offline"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
20
|
+
[33m@openmrs/esm-api:build: [0mwebpack 5.77.0 compiled [1m[32msuccessfully[39m[22m in 6106 ms
|
package/dist/openmrs-esm-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see openmrs-esm-api.js.LICENSE.txt */
|
|
2
|
-
System.register(["@openmrs/esm-config","@openmrs/esm-error-handling"],(function(t,e){var r={},n={};return{setters:[function(t){r.Type=t.Type,r.defineConfigSchema=t.defineConfigSchema,r.getConfig=t.getConfig,r.navigate=t.navigate,r.validators=t.validators},function(t){n.reportError=t.reportError}],execute:function(){t((()=>{var t={385:()=>{System.register([],(function(t,e){return{execute:function(){t(function(){var t={968:function(t,e,r){var n=r(577).R;e.s=function(t){if(t||(t=1),!r.y.meta||!r.y.meta.url)throw console.error("__system_context__",r.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");r.p=n(r.y.meta.url,t)}},577:function(t,e,r){e.R=function(t,e){var r=document.createElement("a");r.href=t;for(var n="/"===r.pathname[0]?r.pathname:"/"+r.pathname,o=0,i=n.length;o!==e&&i>=0;)"/"===n[--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);var s=n.slice(0,i+1);return r.protocol+"//"+r.host+s},Number.isInteger}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.y=e,n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},function(){var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");r.length&&(t=r[r.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t}();var o={};return(0,n(968).s)(1),function(){"use strict";var t=function(t,e){for(var r in e)t[r]=e[r];return t},e=function(e){var r=[];function n(t){for(var e=[],n=0;n<r.length;n++)r[n]===t?t=null:e.push(r[n]);r=e}function o(n,o,i){e=o?n:t(t({},e),n);for(var s=r,u=0;u<s.length;u++)s[u](e,i)}return e=e||{},{action:function(t){function r(e){o(e,!1,t)}return function(){for(var n=arguments,o=[e],i=0;i<arguments.length;i++)o.push(n[i]);var s=t.apply(this,o);if(null!=s)return s.then?s.then(r):r(s)}},setState:o,subscribe:function(t){return r.push(t),function(){n(t)}},unsubscribe:n,getState:function(){return e}}},r=function(t,r){var n=a[t];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(r,!0),n.active=!0,n.value;var o=e(r);return a[t]={value:o,active:!0},o},i=function(t,r){var n=a[t];if(!n){var o=e(r);return a[t]={value:o,active:!1},o}return n.value},s=function(t){return r("app",t)},u=function(){return i("app",{})},c=function(t,e,r){var n=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==n&&(n=o,r(o))}))};n.r(o),n.d(o,{createAppState:function(){return s},createGlobalStore:function(){return r},getAppState:function(){return u},getGlobalStore:function(){return i},subscribeTo:function(){return c}});var a={}}(),o}())}}}))},968:(t,e,r)=>{const n=r(577).R;e.s=function(t){if(t||(t=1),!r.y.meta||!r.y.meta.url)throw console.error("__system_context__",r.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");r.p=n(r.y.meta.url,t)}},577:(t,e,r)=>{e.R=function(t,e){var r=document.createElement("a");r.href=t;for(var n="/"===r.pathname[0]?r.pathname:"/"+r.pathname,o=0,i=n.length;o!==e&&i>=0;)"/"===n[--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);var s=n.slice(0,i+1);return r.protocol+"//"+r.host+s};Number.isInteger},824:t=>{"use strict";t.exports=r},254:t=>{"use strict";t.exports=n}},o={};function i(e){var r=o[e];if(void 0!==r)return r.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,i),n.exports}i.y=e,i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");r.length&&(t=r[r.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})();var s={};return(0,i(968).s)(1),(()=>{"use strict";i.r(s),i.d(s,{OpenmrsFetchError:()=>et,VisitMode:()=>It,VisitStatus:()=>Gt,backendDependencies:()=>zt,clearCurrentUser:()=>bt,defaultVisitCustomRepresentation:()=>Ht,fetchCurrentPatient:()=>Et,fhir:()=>nt,fhirBaseUrl:()=>rt,getCurrentUser:()=>ft,getLocations:()=>qt,getLoggedInUser:()=>vt,getSessionLocation:()=>gt,getSessionStore:()=>ht,getStartedVisit:()=>Wt,getVisitTypes:()=>Jt,getVisitsForPatient:()=>Mt,makeUrl:()=>X,openmrsFetch:()=>Z,openmrsObservableFetch:()=>tt,refetchCurrentUser:()=>dt,saveVisit:()=>Nt,sessionEndpoint:()=>Q,setSessionLocation:()=>mt,setupApiModule:()=>St,toLocationObject:()=>Yt,toVisitTypeObject:()=>$t,updateVisit:()=>Lt,userHasAccess:()=>yt});var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},t(e,r)};function e(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function r(t){return"function"==typeof t}var n=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,n=t},get useDeprecatedSynchronousErrorHandling(){return n}};function u(t){setTimeout((function(){throw t}),0)}var c={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;u(t)},complete:function(){}},a=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}(),l=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),p=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n,o=this,i=o._parentOrParents,s=o._ctorUnsubscribe,u=o._unsubscribe,c=o._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof t)i.remove(this);else if(null!==i)for(var p=0;p<i.length;++p)i[p].remove(this);if(r(u)){s&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){e=t instanceof l?f(t.errors):[t]}}if(a(c)){p=-1;for(var h=c.length;++p<h;){var d=c[p];if(null!==(n=d)&&"object"==typeof n)try{d.unsubscribe()}catch(t){e=e||[],t instanceof l?e=e.concat(f(t.errors)):e.push(t)}}}if(e)throw new l(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function f(t){return t.reduce((function(t,e){return t.concat(e instanceof l?e.errors:e)}),[])}var h=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),d=function(t){function r(e,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=c;break;case 1:if(!e){i.destination=c;break}if("object"==typeof e){e instanceof r?(i.syncErrorThrowable=e.syncErrorThrowable,i.destination=e,e.add(i)):(i.syncErrorThrowable=!0,i.destination=new b(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new b(i,e,n,o)}return i}return e(r,t),r.prototype[h]=function(){return this},r.create=function(t,e,n){var o=new r(t,e,n);return o.syncErrorThrowable=!1,o},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},r.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},r.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},r}(p),b=function(t){function n(e,n,o,i){var s,u=t.call(this)||this;u._parentSubscriber=e;var a=u;return r(n)?s=n:n&&(s=n.next,o=n.error,i=n.complete,n!==c&&(r((a=Object.create(n)).unsubscribe)&&u.add(a.unsubscribe.bind(a)),a.unsubscribe=u.unsubscribe.bind(u))),u._context=a,u._next=s,u._error=o,u._complete=i,u}return e(n,t),n.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},n.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=o.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):u(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;u(t)}}},n.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},n.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw t;u(t)}},n.prototype.__tryOrSetError=function(t,e,r){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(u(e),!0)}return!1},n.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},n}(d),y=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function v(t){return t}function g(t){return 0===t.length?v:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var m=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=function(t,e,r){if(t){if(t instanceof d)return t;if(t[h])return t[h]()}return t||e||r?new d(t,e,r):new d(c)}(t,e,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||o.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),o.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){var e=t,r=e.closed,n=e.destination,o=e.isStopped;if(r||o)return!1;t=n&&n instanceof d?n:null}return!0}(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=w(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[y]=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:g(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=w(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function w(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const S="object"==typeof global&&global&&global.Object===Object&&global;var _="object"==typeof self&&self&&self.Object===Object&&self;const E=(S||_||Function("return this")()).Symbol;var O=Object.prototype,j=O.hasOwnProperty,T=O.toString,x=E?E.toStringTag:void 0;var P=Object.prototype.toString;var A=E?E.toStringTag:void 0;const k=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":A&&A in Object(t)?function(t){var e=j.call(t,x),r=t[x];try{t[x]=void 0;var n=!0}catch(t){}var o=T.call(t);return n&&(e?t[x]=r:delete t[x]),o}(t):function(t){return P.call(t)}(t)},D=(R=Object.getPrototypeOf,C=Object,function(t){return R(C(t))});var R,C;var V=Function.prototype,U=Object.prototype,F=V.toString,B=U.hasOwnProperty,H=F.call(Object);const M=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=k(t))return!1;var e=D(t);if(null===e)return!0;var r=B.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&F.call(r)==H};var N=i(824);function L(t,e,r,n,o,i,s){try{var u=t[i](s),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function I(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){L(i,n,o,s,u,"next",t)}function u(t){L(i,n,o,s,u,"throw",t)}s(void 0)}))}}function G(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function W(t,e,r){return W=G()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&Y(o,r.prototype),o},W.apply(null,arguments)}function $(t){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$(t)}function J(t,e){return!e||"object"!==q(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Y(t,e){return Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Y(t,e)}var q=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function z(t){var e="function"==typeof Map?new Map:void 0;return z=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return W(t,arguments,$(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Y(n,t)},z(t)}var K=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},Q="/ws/rest/v1/session";function X(t){return window.openmrsBase+t}function Z(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof e)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");var r=X(t);e.headers||(e.headers={}),M(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,void 0===e.headers["Disable-WWW-Authenticate"]&&(e.headers["Disable-WWW-Authenticate"]="true");var n,o=Error();return window.fetch(r,e).then((n=I((function(t){var e,n;return K(this,(function(i){switch(i.label){case 0:return(e=t).ok?204===e.status?(e.data=null,[2,e]):[2,e.text().then((function(t){try{t&&(e.data=JSON.parse(t))}catch(t){}return e}))]:[3,1];case 1:return[4,(0,N.getConfig)("@openmrs/esm-api")];case 2:return n=i.sent().redirectAuthFailure,r===X(Q)&&403===e.status||n.enabled&&n.errors.includes(e.status)?((0,N.navigate)({to:n.url}),[2,n.resolvePromise?Promise.resolve():new Promise((function(){}))]):[2,e.text().then((function(t){var n=t;try{n=JSON.parse(t)}catch(t){}throw new et(r,e,n,o)}),(function(t){throw new et(r,e,null,o)}))];case 3:return[2]}}))})),function(t){return n.apply(this,arguments)}))}function tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof e)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");var r=new AbortController;return e.signal=r.signal,new m((function(n){var o=!1;return Z(t,e).then((function(t){o=!0,n.next(t),n.complete()}),(function(t){o=!0,n.error(t)})),function(){o||r.abort()}}))}var et=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Y(t,e)}(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=$(e);if(r){var o=$(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return J(this,t)});function o(t,e,r,i){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(s=n.call(this)).message="Server responded with ".concat(e.status," (").concat(e.statusText,") for url ").concat(t,". Check err.responseBody or network tab in dev tools for more info"),i.message=s.message,s.responseBody=r,s.response=e,s.stack="Stacktrace for outgoing request:\n".concat(i.stack,"\nStacktrace for incoming response:\n").concat(s.stack),s}return o}(z(Error)),rt="/ws/fhir2/R4",nt={read:function(t){var e,r;return Z((r={url:"".concat(rt,"/").concat(t.type,"/").concat(t.patient),method:"GET",headers:null!==(e=t.headers)&&void 0!==e?e:{}}).url,{method:r.method,headers:r.headers}).then((function(t){return{status:t.status,headers:t.headers,data:t.data,config:r}}),(function(t){return{status:t.response.status,headers:t.response.headers,data:t.responseBody,config:r}}))}},ot=i(254),it=i(385);const st=function(t){return void 0===t};function ut(t,e,r,n,o,i,s){try{var u=t[i](s),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function ct(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){ut(i,n,o,s,u,"next",t)}function u(t){ut(i,n,o,s,u,"throw",t)}s(void 0)}))}}var at=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},lt=(0,it.createGlobalStore)("session",{loaded:!1,session:null}),pt=0;function ft(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(pt<Date.now()-6e4||!lt.getState().loaded)&&dt(),new m((function(e){var r=function(r){var n;r.loaded&&(t.includeAuthStatus?e.next(r.session):e.next(null===(n=r.session)||void 0===n?void 0:n.user))};return r(lt.getState()),lt.subscribe(r)}))}function ht(){return(pt<Date.now()-6e4||!lt.getState().loaded)&&dt(),lt}function dt(){return new Promise((function(t,e){pt=Date.now(),Z(Q).then((function(r){if("object"!=typeof(null==r?void 0:r.data))return e(),Promise.reject();var n,o,i,s,u;(u=null!==(s=null==(n=r.data)||null===(o=n.user)||void 0===o||null===(i=o.userProperties)||void 0===i?void 0:i.defaultLocale)&&void 0!==s?s:n.locale)!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",u),t(r.data),lt.setState({loaded:!0,session:r.data})})).catch((function(t){return(0,ot.reportError)("Failed to fetch new session information: ".concat(t)),e(t),{sessionId:"",authenticated:!1}}))}))}function bt(){lt.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function yt(t,e){return void 0===e?Boolean(t):!Boolean(t)||function(t,e){return"string"==typeof t?!st(e.privileges.find((function(e){return t===e.display}))):Array.isArray(t)?t.every((function(t){return!st(e.privileges.find((function(e){return t===e.display})))})):(st(t)||console.error('Could not understand privileges "'.concat(t,'"')),!0)}(t,e)||function(t){return!st(t.roles.find((function(t){return"System Developer"===t.display})))}(e)}function vt(){var t,e;return new Promise((function(r,n){var o=function(n){n.loaded&&n.session.user&&(t=n.session.user,r(n.session.user),e&&e())};o(lt.getState()),t||(e=lt.subscribe(o))}))}function gt(){return new Promise((function(t,e){ft().subscribe((function(e){t(e.sessionLocation)}),e).unsubscribe()}))}function mt(t,e){return wt.apply(this,arguments)}function wt(){return(wt=ct((function(t,e){return at(this,(function(r){switch(r.label){case 0:return[4,Z(Q,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:e.signal})];case 1:return r.sent(),dt(),[2]}}))}))).apply(this,arguments)}function St(){(0,N.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:N.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:N.Type.String,_default:"${openmrsSpaBase}/login",_validators:[N.validators.isUrl]},errors:{_type:N.Type.Array,_default:[401],_elements:{_type:N.Type.Number,_validators:[N.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:N.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."}}}),dt()}function _t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Et(t,e){return t?nt.read(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){_t(t,e,r[e])}))}return t}({type:"Patient",patient:t},e)):Promise.resolve(null)}var Ot=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),jt=function(t){function r(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return e(r,t),r.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},r}(p),Tt=function(t){function r(e){var r=t.call(this,e)||this;return r.destination=e,r}return e(r,t),r}(d),xt=function(t){function r(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return e(r,t),r.prototype[h]=function(){return new Tt(this)},r.prototype.lift=function(t){var e=new Pt(this,this);return e.operator=t,e},r.prototype.next=function(t){if(this.closed)throw new Ot;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},r.prototype.error=function(t){if(this.closed)throw new Ot;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].error(t);this.observers.length=0},r.prototype.complete=function(){if(this.closed)throw new Ot;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},r.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},r.prototype._trySubscribe=function(e){if(this.closed)throw new Ot;return t.prototype._trySubscribe.call(this,e)},r.prototype._subscribe=function(t){if(this.closed)throw new Ot;return this.hasError?(t.error(this.thrownError),p.EMPTY):this.isStopped?(t.complete(),p.EMPTY):(this.observers.push(t),new jt(this,t))},r.prototype.asObservable=function(){var t=new m;return t.source=this,t},r.create=function(t,e){return new Pt(t,e)},r}(m),Pt=function(t){function r(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return e(r,t),r.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},r.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},r.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},r.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):p.EMPTY},r}(xt),At=function(t){function r(e){var r=t.call(this)||this;return r._value=e,r}return e(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),r.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},r.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new Ot;return this._value},r.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},r}(xt),kt=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}(),Dt=new m((function(t){return t.complete()}));function Rt(t){return function(e){return 0===t?r?function(t){return new m((function(e){return t.schedule((function(){return e.complete()}))}))}(r):Dt:e.lift(new Ct(t));var r}}var Ct=function(){function t(t){if(this.total=t,this.total<0)throw new kt}return t.prototype.call=function(t,e){return e.subscribe(new Vt(t,this.total))},t}(),Vt=function(t){function r(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return e(r,t),r.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},r}(d);function Ut(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new Ft(t,e))}}var Ft=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Bt(t,this.project,this.thisArg))},t}(),Bt=function(t){function r(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return e(r,t),r.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},r}(d),Ht="custom:(uuid,encounters:(uuid,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,uuid),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display),startDatetime,stopDatetime)";function Mt(t,e,r){var n=null!=r?r:Ht;return tt("/ws/rest/v1/visit?patient=".concat(t,"&v=").concat(n),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(Rt(1)).pipe(Ut((function(t){return t})))}function Nt(t,e){return tt("/ws/rest/v1/visit",{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function Lt(t,e,r){return tt("/ws/rest/v1/visit/".concat(t),{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}var It,Gt,Wt=new At(null);function $t(t){return{uuid:t.uuid,display:t.display,name:t.name}}function Jt(){return tt("/ws/rest/v1/visittype").pipe(Ut((function(t){return t.data.results.map($t)}))).pipe(Rt(1))}function Yt(t){return{uuid:t.uuid,display:t.display}}function qt(){return tt("/ws/rest/v1/location").pipe(Ut((function(t){return t.data.results.map(Yt)}))).pipe(Rt(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(It||(It={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Gt||(Gt={}));var zt={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),s})())}}}));
|
|
2
|
+
System.register(["@openmrs/esm-config","@openmrs/esm-error-handling","@openmrs/esm-offline"],(function(t,r){var e={},n={},o={};return{setters:[function(t){e.Type=t.Type,e.defineConfigSchema=t.defineConfigSchema,e.getConfig=t.getConfig,e.navigate=t.navigate,e.validators=t.validators},function(t){n.reportError=t.reportError},function(t){o.getSynchronizationItems=t.getSynchronizationItems}],execute:function(){t((()=>{var t={385:()=>{System.register([],(function(t,r){return{execute:function(){t(function(){var t={968:function(t,r,e){var n=e(577).R;r.s=function(t){if(t||(t=1),!e.y.meta||!e.y.meta.url)throw console.error("__system_context__",e.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");e.p=n(e.y.meta.url,t)}},577:function(t,r,e){r.R=function(t,r){var e=document.createElement("a");e.href=t;for(var n="/"===e.pathname[0]?e.pathname:"/"+e.pathname,o=0,i=n.length;o!==r&&i>=0;)"/"===n[--i]&&o++;if(o!==r)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+r+") is greater than the number of directories ("+o+") in the URL path "+t);var s=n.slice(0,i+1);return e.protocol+"//"+e.host+s},Number.isInteger}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.y=r,n.d=function(t,r){for(var e in r)n.o(r,e)&&!n.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},function(){var t;n.g.importScripts&&(t=n.g.location+"");var r=n.g.document;if(!t&&r&&(r.currentScript&&(t=r.currentScript.src),!t)){var e=r.getElementsByTagName("script");e.length&&(t=e[e.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t}();var o={};return(0,n(968).s)(1),function(){"use strict";var t=function(t,r){for(var e in r)t[e]=r[e];return t},r=function(r){var e=[];function n(t){for(var r=[],n=0;n<e.length;n++)e[n]===t?t=null:r.push(e[n]);e=r}function o(n,o,i){r=o?n:t(t({},r),n);for(var s=e,u=0;u<s.length;u++)s[u](r,i)}return r=r||{},{action:function(t){function e(r){o(r,!1,t)}return function(){for(var n=arguments,o=[r],i=0;i<arguments.length;i++)o.push(n[i]);var s=t.apply(this,o);if(null!=s)return s.then?s.then(e):e(s)}},setState:o,subscribe:function(t){return e.push(t),function(){n(t)}},unsubscribe:n,getState:function(){return r}}},e=function(t,e){var n=a[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;var o=r(e);return a[t]={value:o,active:!0},o},i=function(t,e){var n=a[t];if(!n){var o=r(e);return a[t]={value:o,active:!1},o}return n.value},s=function(t){return e("app",t)},u=function(){return i("app",{})},c=function(t,r,e){var n=r(t.getState());return t.subscribe((function(t){var o=r(t);o!==n&&(n=o,e(o))}))};n.r(o),n.d(o,{createAppState:function(){return s},createGlobalStore:function(){return e},getAppState:function(){return u},getGlobalStore:function(){return i},subscribeTo:function(){return c}});var a={}}(),o}())}}}))},968:(t,r,e)=>{const n=e(577).R;r.s=function(t){if(t||(t=1),!e.y.meta||!e.y.meta.url)throw console.error("__system_context__",e.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");e.p=n(e.y.meta.url,t)}},577:(t,r,e)=>{r.R=function(t,r){var e=document.createElement("a");e.href=t;for(var n="/"===e.pathname[0]?e.pathname:"/"+e.pathname,o=0,i=n.length;o!==r&&i>=0;)"/"===n[--i]&&o++;if(o!==r)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+r+") is greater than the number of directories ("+o+") in the URL path "+t);var s=n.slice(0,i+1);return e.protocol+"//"+e.host+s};Number.isInteger},824:t=>{"use strict";t.exports=e},254:t=>{"use strict";t.exports=n},738:t=>{"use strict";t.exports=o}},i={};function s(r){var e=i[r];if(void 0!==e)return e.exports;var n=i[r]={exports:{}};return t[r](n,n.exports,s),n.exports}s.y=r,s.d=(t,r)=>{for(var e in r)s.o(r,e)&&!s.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;s.g.importScripts&&(t=s.g.location+"");var r=s.g.document;if(!t&&r&&(r.currentScript&&(t=r.currentScript.src),!t)){var e=r.getElementsByTagName("script");e.length&&(t=e[e.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t})();var u={};return(0,s(968).s)(1),(()=>{"use strict";s.r(u),s.d(u,{OpenmrsFetchError:()=>nt,VisitMode:()=>Kt,VisitStatus:()=>Qt,backendDependencies:()=>nr,clearCurrentUser:()=>bt,defaultVisitCustomRepresentation:()=>Jt,fetchCurrentPatient:()=>Pt,fhirBaseUrl:()=>X,getCurrentUser:()=>pt,getLocations:()=>er,getLoggedInUser:()=>vt,getSessionLocation:()=>mt,getSessionStore:()=>ht,getStartedVisit:()=>Xt,getVisitTypes:()=>tr,getVisitsForPatient:()=>Yt,makeUrl:()=>tt,openmrsFetch:()=>rt,openmrsObservableFetch:()=>et,refetchCurrentUser:()=>dt,restBaseUrl:()=>Q,saveVisit:()=>zt,sessionEndpoint:()=>Z,setSessionLocation:()=>wt,setupApiModule:()=>St,toLocationObject:()=>rr,toVisitTypeObject:()=>Zt,updateVisit:()=>qt,userHasAccess:()=>yt});var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])},t(r,e)};function r(r,e){function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function e(t){return"function"==typeof t}var n=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,n=t},get useDeprecatedSynchronousErrorHandling(){return n}};function i(t){setTimeout((function(){throw t}),0)}var c={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;i(t)},complete:function(){}},a=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}(),l=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,r){return r+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),f=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var r;if(!this.closed){var n,o=this,i=o._parentOrParents,s=o._ctorUnsubscribe,u=o._unsubscribe,c=o._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof t)i.remove(this);else if(null!==i)for(var f=0;f<i.length;++f)i[f].remove(this);if(e(u)){s&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){r=t instanceof l?p(t.errors):[t]}}if(a(c)){f=-1;for(var h=c.length;++f<h;){var d=c[f];if(null!==(n=d)&&"object"==typeof n)try{d.unsubscribe()}catch(t){r=r||[],t instanceof l?r=r.concat(p(t.errors)):r.push(t)}}}if(r)throw new l(r)}},t.prototype.add=function(r){var e=r;if(!r)return t.EMPTY;switch(typeof r){case"function":e=new t(r);case"object":if(e===this||e.closed||"function"!=typeof e.unsubscribe)return e;if(this.closed)return e.unsubscribe(),e;if(!(e instanceof t)){var n=e;(e=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+r+" added to Subscription.")}var o=e._parentOrParents;if(null===o)e._parentOrParents=this;else if(o instanceof t){if(o===this)return e;e._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return e;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[e]:i.push(e),e},t.prototype.remove=function(t){var r=this._subscriptions;if(r){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function p(t){return t.reduce((function(t,r){return t.concat(r instanceof l?r.errors:r)}),[])}var h=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),d=function(t){function e(r,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=c;break;case 1:if(!r){i.destination=c;break}if("object"==typeof r){r instanceof e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new b(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new b(i,r,n,o)}return i}return r(e,t),e.prototype[h]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);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}(f),b=function(t){function n(r,n,o,i){var s,u=t.call(this)||this;u._parentSubscriber=r;var a=u;return e(n)?s=n:n&&(s=n.next,o=n.error,i=n.complete,n!==c&&(e((a=Object.create(n)).unsubscribe)&&u.add(a.unsubscribe.bind(a)),a.unsubscribe=u.unsubscribe.bind(u))),u._context=a,u._next=s,u._error=o,u._complete=i,u}return r(n,t),n.prototype.next=function(t){if(!this.isStopped&&this._next){var r=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?this.__tryOrSetError(r,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},n.prototype.error=function(t){if(!this.isStopped){var r=this._parentSubscriber,e=o.useDeprecatedSynchronousErrorHandling;if(this._error)e&&r.syncErrorThrowable?(this.__tryOrSetError(r,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(r.syncErrorThrowable)e?(r.syncErrorValue=t,r.syncErrorThrown=!0):i(t),this.unsubscribe();else{if(this.unsubscribe(),e)throw t;i(t)}}},n.prototype.complete=function(){var t=this;if(!this.isStopped){var r=this._parentSubscriber;if(this._complete){var e=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?(this.__tryOrSetError(r,e),this.unsubscribe()):(this.__tryOrUnsub(e),this.unsubscribe())}else this.unsubscribe()}},n.prototype.__tryOrUnsub=function(t,r){try{t.call(this._context,r)}catch(t){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw t;i(t)}},n.prototype.__tryOrSetError=function(t,r,e){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{r.call(this._context,e)}catch(r){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(i(r),!0)}return!1},n.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},n}(d),y=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function v(t){return t}function m(t){return 0===t.length?v:1===t.length?t[0]:function(r){return t.reduce((function(t,r){return r(t)}),r)}}var w=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(r){var e=new t;return e.source=this,e.operator=r,e},t.prototype.subscribe=function(t,r,e){var n=this.operator,i=function(t,r,e){if(t){if(t instanceof d)return t;if(t[h])return t[h]()}return t||r||e?new d(t,r,e):new d(c)}(t,r,e);if(n?i.add(n.call(i,this.source)):i.add(this.source||o.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),o.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=r),function(t){for(;t;){var r=t,e=r.closed,n=r.destination,o=r.isStopped;if(e||o)return!1;t=n&&n instanceof d?n:null}return!0}(t)?t.error(r):console.warn(r)}},t.prototype.forEach=function(t,r){var e=this;return new(r=g(r))((function(r,n){var o;o=e.subscribe((function(r){try{t(r)}catch(t){n(t),o&&o.unsubscribe()}}),n,r)}))},t.prototype._subscribe=function(t){var r=this.source;return r&&r.subscribe(t)},t.prototype[y]=function(){return this},t.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 0===t.length?this:m(t)(this)},t.prototype.toPromise=function(t){var r=this;return new(t=g(t))((function(t,e){var n;r.subscribe((function(t){return n=t}),(function(t){return e(t)}),(function(){return t(n)}))}))},t.create=function(r){return new t(r)},t}();function g(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const S="object"==typeof global&&global&&global.Object===Object&&global;var _="object"==typeof self&&self&&self.Object===Object&&self;const E=(S||_||Function("return this")()).Symbol;var O=Object.prototype,x=O.hasOwnProperty,T=O.toString,j=E?E.toStringTag:void 0;var P=Object.prototype.toString;var A=E?E.toStringTag:void 0;const k=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":A&&A in Object(t)?function(t){var r=x.call(t,j),e=t[j];try{t[j]=void 0;var n=!0}catch(t){}var o=T.call(t);return n&&(r?t[j]=e:delete t[j]),o}(t):function(t){return P.call(t)}(t)},D=(R=Object.getPrototypeOf,C=Object,function(t){return R(C(t))});var R,C;var U=Function.prototype,V=Object.prototype,I=U.toString,F=V.hasOwnProperty,M=I.call(Object);const B=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=k(t))return!1;var r=D(t);if(null===r)return!0;var e=F.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&I.call(e)==M};var H=s(824);function L(t,r,e,n,o,i,s){try{var u=t[i](s),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function N(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function s(t){L(i,n,o,s,u,"next",t)}function u(t){L(i,n,o,s,u,"throw",t)}s(void 0)}))}}function G(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function W(t,r,e){return W=G()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(t,n));return e&&Y(o,e.prototype),o},W.apply(null,arguments)}function $(t){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$(t)}function J(t,r){return!r||"object"!==z(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):r}function Y(t,r){return Y=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},Y(t,r)}var z=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function q(t){var r="function"==typeof Map?new Map:void 0;return q=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,n)}function n(){return W(t,arguments,$(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Y(n,t)},q(t)}var K=function(t,r){var e,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=r.call(t,s)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},Q="/ws/rest/v1/",X="/ws/fhir2/R4",Z="".concat(Q,"session");function tt(t){return window.openmrsBase+t}function rt(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof r)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[0]&&(t="/"+t);var e=tt(t);if(r.headers||(r.headers={}),B(r.body)&&(r.body=JSON.stringify(r.body)),void 0===r.headers.Accept&&(r.headers.Accept="application/json"),null===r.headers.Accept&&delete r.headers.Accept,t.startsWith(Q)&&void 0===r.headers["Disable-WWW-Authenticate"]&&(r.headers["Disable-WWW-Authenticate"]="true"),t.startsWith(X)){var n=new URL(e,window.location.toString());n.searchParams.has("_summary")||(n.searchParams.set("_summary","data"),e=n.toString())}var o,i=Error();return window.fetch(e,r).then((o=N((function(t){var r,n;return K(this,(function(o){switch(o.label){case 0:return(r=t).ok?204===r.status?(r.data=null,[2,r]):[2,r.text().then((function(t){try{t&&(r.data=JSON.parse(t))}catch(t){}return r}))]:[3,1];case 1:return[4,(0,H.getConfig)("@openmrs/esm-api")];case 2:return n=o.sent().redirectAuthFailure,e===tt(Z)&&403===r.status||n.enabled&&n.errors.includes(r.status)?((0,H.navigate)({to:n.url}),[2,n.resolvePromise?Promise.resolve():new Promise((function(){}))]):[2,r.text().then((function(t){var n=t;try{n=JSON.parse(t)}catch(t){}throw new nt(e,r,n,i)}),(function(t){throw new nt(e,r,null,i)}))];case 3:return[2]}}))})),function(t){return o.apply(this,arguments)}))}function et(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof r)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");var e=new AbortController;return r.signal=e.signal,new w((function(n){var o=!1;return rt(t,r).then((function(t){o=!0,n.next(t),n.complete()}),(function(t){o=!0,n.error(t)})),function(){o||e.abort()}}))}var nt=function(t){!function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&Y(t,r)}(o,t);var r,e,n=(r=o,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=$(r);if(e){var o=$(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return J(this,t)});function o(t,r,e,i){var s;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,o),(s=n.call(this)).message="Server responded with ".concat(r.status," (").concat(r.statusText,") for url ").concat(t,". Check err.responseBody or network tab in dev tools for more info"),i.message=s.message,s.responseBody=e,s.response=r,s.stack="Stacktrace for outgoing request:\n".concat(i.stack,"\nStacktrace for incoming response:\n").concat(s.stack),s}return o}(q(Error)),ot=s(254),it=s(385);const st=function(t){return void 0===t};function ut(t,r,e,n,o,i,s){try{var u=t[i](s),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function ct(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function s(t){ut(i,n,o,s,u,"next",t)}function u(t){ut(i,n,o,s,u,"throw",t)}s(void 0)}))}}var at=function(t,r){var e,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=r.call(t,s)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},lt=(0,it.createGlobalStore)("session",{loaded:!1,session:null}),ft=0;function pt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(ft<Date.now()-6e4||!lt.getState().loaded)&&dt(),new w((function(r){var e=function(e){var n;e.loaded&&(t.includeAuthStatus?r.next(e.session):r.next(null===(n=e.session)||void 0===n?void 0:n.user))};return e(lt.getState()),lt.subscribe(e)}))}function ht(){return(ft<Date.now()-6e4||!lt.getState().loaded)&&dt(),lt}function dt(){return new Promise((function(t,r){ft=Date.now(),rt(Z).then((function(e){if("object"!=typeof(null==e?void 0:e.data))return r(),Promise.reject();var n,o,i,s,u;(u=null!==(s=null==(n=e.data)||null===(o=n.user)||void 0===o||null===(i=o.userProperties)||void 0===i?void 0:i.defaultLocale)&&void 0!==s?s:n.locale)!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",u),t(e.data),lt.setState({loaded:!0,session:e.data})})).catch((function(t){return(0,ot.reportError)("Failed to fetch new session information: ".concat(t)),r(t),{sessionId:"",authenticated:!1}}))}))}function bt(){lt.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function yt(t,r){return void 0===r?Boolean(t):!Boolean(t)||function(t,r){return"string"==typeof t?!st(r.privileges.find((function(r){return t===r.display}))):Array.isArray(t)?t.every((function(t){return!st(r.privileges.find((function(r){return t===r.display})))})):(st(t)||console.error('Could not understand privileges "'.concat(t,'"')),!0)}(t,r)||function(t){return!st(t.roles.find((function(t){return"System Developer"===t.display})))}(r)}function vt(){var t,r;return new Promise((function(e,n){var o=function(n){n.loaded&&n.session.user&&(t=n.session.user,e(n.session.user),r&&r())};o(lt.getState()),t||(r=lt.subscribe(o))}))}function mt(){return new Promise((function(t,r){pt().subscribe((function(r){t(r.sessionLocation)}),r).unsubscribe()}))}function wt(t,r){return gt.apply(this,arguments)}function gt(){return(gt=ct((function(t,r){return at(this,(function(e){switch(e.label){case 0:return[4,rt(Z,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:r.signal})];case 1:return e.sent(),dt(),[2]}}))}))).apply(this,arguments)}function St(){(0,H.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:H.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:H.Type.String,_default:"${openmrsSpaBase}/login",_validators:[H.validators.isUrl]},errors:{_type:H.Type.Array,_default:[401],_elements:{_type:H.Type.Number,_validators:[H.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:H.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."}}}),dt()}var _t=s(738);function Et(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function Ot(t,r,e,n,o,i,s){try{var u=t[i](s),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function xt(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function s(t){Ot(i,n,o,s,u,"next",t)}function u(t){Ot(i,n,o,s,u,"throw",t)}s(void 0)}))}}function Tt(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i=[],s=!0,u=!1;try{for(e=e.call(t);!(s=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==e.return||e.return()}finally{if(u)throw o}}return i}}(t,r)||function(t,r){if(t){if("string"==typeof t)return Et(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Et(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var jt=function(t,r){var e,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=r.call(t,s)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};function Pt(t,r){return At.apply(this,arguments)}function At(){return At=xt((function(t,r){var e,n,o,i,s,u=arguments;return jt(this,(function(c){switch(c.label){case 0:return e=!(u.length>2&&void 0!==u[2])||u[2],t?(n=null,[4,Promise.all([rt("".concat(X,"/Patient/").concat(t),r).catch((function(t){return n=t})),e?kt(t):Promise.resolve(null)])]):[3,2];case 1:if(o=Tt.apply(void 0,[c.sent(),2]),i=o[0],s=o[1],i.ok)return[2,i.data];if(s)return[2,s];if(n)throw n;c.label=2;case 2:return[2,null]}}))})),At.apply(this,arguments)}function kt(t){return Dt.apply(this,arguments)}function Dt(){return(Dt=xt((function(t){var r,e,n;return jt(this,(function(o){switch(o.label){case 0:return[4,(0,_t.getSynchronizationItems)("patient-registration")];case 1:return r=o.sent(),e=r.find((function(r){return r.fhirPatient.id===t})),[2,null!==(n=null==e?void 0:e.fhirPatient)&&void 0!==n?n:null]}}))}))).apply(this,arguments)}var Rt=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),Ct=function(t){function e(r,e){var n=t.call(this)||this;return n.subject=r,n.subscriber=e,n.closed=!1,n}return r(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,r=t.observers;if(this.subject=null,r&&0!==r.length&&!t.isStopped&&!t.closed){var e=r.indexOf(this.subscriber);-1!==e&&r.splice(e,1)}}},e}(f),Ut=function(t){function e(r){var e=t.call(this,r)||this;return e.destination=r,e}return r(e,t),e}(d),Vt=function(t){function e(){var r=t.call(this)||this;return r.observers=[],r.closed=!1,r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return r(e,t),e.prototype[h]=function(){return new Ut(this)},e.prototype.lift=function(t){var r=new It(this,this);return r.operator=t,r},e.prototype.next=function(t){if(this.closed)throw new Rt;if(!this.isStopped)for(var r=this.observers,e=r.length,n=r.slice(),o=0;o<e;o++)n[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new Rt;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var r=this.observers,e=r.length,n=r.slice(),o=0;o<e;o++)n[o].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new Rt;this.isStopped=!0;for(var t=this.observers,r=t.length,e=t.slice(),n=0;n<r;n++)e[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(r){if(this.closed)throw new Rt;return t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(t){if(this.closed)throw new Rt;return this.hasError?(t.error(this.thrownError),f.EMPTY):this.isStopped?(t.complete(),f.EMPTY):(this.observers.push(t),new Ct(this,t))},e.prototype.asObservable=function(){var t=new w;return t.source=this,t},e.create=function(t,r){return new It(t,r)},e}(w),It=function(t){function e(r,e){var n=t.call(this)||this;return n.destination=r,n.source=e,n}return r(e,t),e.prototype.next=function(t){var r=this.destination;r&&r.next&&r.next(t)},e.prototype.error=function(t){var r=this.destination;r&&r.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):f.EMPTY},e}(Vt),Ft=function(t){function e(r){var e=t.call(this)||this;return e._value=r,e}return r(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(r){var e=t.prototype._subscribe.call(this,r);return e&&!e.closed&&r.next(this._value),e},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new Rt;return this._value},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e}(Vt),Mt=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}(),Bt=new w((function(t){return t.complete()}));function Ht(t){return function(r){return 0===t?e?function(t){return new w((function(r){return t.schedule((function(){return r.complete()}))}))}(e):Bt:r.lift(new Lt(t));var e}}var Lt=function(){function t(t){if(this.total=t,this.total<0)throw new Mt}return t.prototype.call=function(t,r){return r.subscribe(new Nt(t,this.total))},t}(),Nt=function(t){function e(r,e){var n=t.call(this,r)||this;return n.total=e,n.count=0,n}return r(e,t),e.prototype._next=function(t){var r=this.total,e=++this.count;e<=r&&(this.destination.next(t),e===r&&(this.destination.complete(),this.unsubscribe()))},e}(d);function Gt(t,r){return function(e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return e.lift(new Wt(t,r))}}var Wt=function(){function t(t,r){this.project=t,this.thisArg=r}return t.prototype.call=function(t,r){return r.subscribe(new $t(t,this.project,this.thisArg))},t}(),$t=function(t){function e(r,e,n){var o=t.call(this,r)||this;return o.project=e,o.count=0,o.thisArg=n||o,o}return r(e,t),e.prototype._next=function(t){var r;try{r=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(r)},e}(d),Jt="custom:(uuid,encounters:(uuid,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,uuid),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display),startDatetime,stopDatetime)";function Yt(t,r,e){var n=null!=e?e:Jt;return et("/ws/rest/v1/visit?patient=".concat(t,"&v=").concat(n),{signal:r.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(Ht(1)).pipe(Gt((function(t){return t})))}function zt(t,r){return et("/ws/rest/v1/visit",{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function qt(t,r,e){return et("/ws/rest/v1/visit/".concat(t),{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:r})}var Kt,Qt,Xt=new Ft(null);function Zt(t){return{uuid:t.uuid,display:t.display,name:t.name}}function tr(){return et("/ws/rest/v1/visittype").pipe(Gt((function(t){return t.data.results.map(Zt)}))).pipe(Ht(1))}function rr(t){return{uuid:t.uuid,display:t.display}}function er(){return et("/ws/rest/v1/location").pipe(Gt((function(t){return t.data.results.map(rr)}))).pipe(Ht(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(Kt||(Kt={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Qt||(Qt={}));var nr={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),u})())}}}));
|
|
3
3
|
//# sourceMappingURL=openmrs-esm-api.js.map
|