@openmrs/esm-api 4.0.0-pre.0 → 4.0.1-pre.206
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 +18 -17
- package/dist/openmrs-esm-api.js +1 -1
- package/dist/openmrs-esm-api.js.map +1 -1
- package/package.json +6 -7
- package/src/fhir.ts +31 -8
- package/src/openmrs-fetch.ts +2 -7
- package/src/shared-api-objects/current-user.ts +19 -5
- package/src/types/fhir-resource.ts +3 -0
- package/src/types/fhir.ts +1 -1
- package/.turbo/turbo-lint.log +0 -2
- package/.turbo/turbo-test.log +0 -10
- package/.turbo/turbo-typescript.log +0 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
[33m@openmrs/esm-api:build
|
|
1
|
+
[33m@openmrs/esm-api:build[0m: cache hit, replaying output [2m1bc4b9f9f978ac88[0m
|
|
2
2
|
[33m@openmrs/esm-api:build: [0m$ webpack --mode=production
|
|
3
|
-
[33m@openmrs/esm-api:build: [0masset
|
|
4
|
-
[33m@openmrs/esm-api:build: [0morphan modules
|
|
5
|
-
[33m@openmrs/esm-api:build: [0mruntime modules 2.
|
|
6
|
-
[33m@openmrs/esm-api:build: [0mbuilt modules
|
|
7
|
-
[33m@openmrs/esm-api:build: [0m modules
|
|
8
|
-
[33m@openmrs/esm-api:build: [0m modules by path ../../../node_modules
|
|
9
|
-
[33m@openmrs/esm-api:build: [0m
|
|
10
|
-
[33m@openmrs/esm-api:build: [0m
|
|
11
|
-
[33m@openmrs/esm-api:build: [0m
|
|
12
|
-
[33m@openmrs/esm-api:build: [0m
|
|
13
|
-
[33m@openmrs/esm-api:build: [0m
|
|
14
|
-
[33m@openmrs/esm-api:build: [0m
|
|
15
|
-
[33m@openmrs/esm-api:build: [0m
|
|
16
|
-
[33m@openmrs/esm-api:build: [0m
|
|
17
|
-
[33m@openmrs/esm-api:build: [0m
|
|
18
|
-
[33m@openmrs/esm-api:build: [
|
|
3
|
+
[33m@openmrs/esm-api:build: [0masset [1m[32mopenmrs-esm-api.js[39m[22m 35.7 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (name: main) 1 related asset
|
|
4
|
+
[33m@openmrs/esm-api:build: [0morphan modules 370 KiB [1m[33m[orphan][39m[22m 227 modules
|
|
5
|
+
[33m@openmrs/esm-api:build: [0mruntime modules 2.02 KiB 7 modules
|
|
6
|
+
[33m@openmrs/esm-api:build: [0mbuilt modules 117 KiB [1m[33m[built][39m[22m
|
|
7
|
+
[33m@openmrs/esm-api:build: [0m cacheable modules 117 KiB
|
|
8
|
+
[33m@openmrs/esm-api:build: [0m modules by path [1m../../../node_modules/[39m[22m 27.5 KiB
|
|
9
|
+
[33m@openmrs/esm-api:build: [0m modules by path [1m../../../node_modules/systemjs-webpack-interop/auto-public-path/*.js[39m[22m 935 bytes
|
|
10
|
+
[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
|
|
11
|
+
[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
|
|
12
|
+
[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
|
|
13
|
+
[33m@openmrs/esm-api:build: [0m [1m../../../node_modules/regenerator-runtime/runtime.js[39m[22m 24.3 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
14
|
+
[33m@openmrs/esm-api:build: [0m [1m./src/index.ts + 45 modules[39m[22m 82.1 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
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 84 bytes
|
|
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
|
+
[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: [0mwebpack 5.74.0 compiled [1m[32msuccessfully[39m[22m in 5320 ms
|
package/dist/openmrs-esm-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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={672:(t,e)=>{!function(){var t=e,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function n(t){this.message=t}n.prototype=new Error,n.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var e,o,i=String(t),u=0,a=r,c="";i.charAt(0|u)||(a="=",u%1);c+=a.charAt(63&e>>8-u%1*8)){if((o=i.charCodeAt(u+=3/4))>255)throw new n("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|o}return c}),t.atob||(t.atob=function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,u=0,a=0,c="";i=e.charAt(a++);~i&&(o=u%4?64*o+i:i,u++%4)?c+=String.fromCharCode(255&o>>(-2*u&6)):0)i=r.indexOf(i);return c})}()},525:function(t){(function(){var e,r;function n(t,o){var i,u=t.data.entry||[],a=[];for(i=0;i<u.length;i++)a.push(u[i].resource);o(a);var c=r.defer();return e.nextPage({bundle:t.data}).then((function(t){n(t,o).then((function(t){c.resolve()}))}),(function(t){c.resolve()})),c.promise}function o(t,o,i,u){r.defer(),e.search(t).then((function(t){n(t,o).then((function(){i()}),(function(t){u(t)}))}),(function(t){u(t)}))}function i(t){var e=r.defer(),n=[];return o(t,(function(t){t.forEach((function(t){n.push(t)}))}),(function(){e.resolve(n)}),(function(t){e.reject(t)})),e.promise}function u(t,n){var o=r.defer();return e.search(t).then((function(t){var r={},i=[function(){o.resolve(t,r)}];function u(){i.pop()()}var a=t.data;a.entry&&a.entry.forEach((function(t){var o=t.resource,c=o.resourceType;n&&n.forEach((function(t){var n=t.split("."),s=n[0],l=n[1],f=o[l];if(c===s&&f){var p=f.reference;r[p]||function(t,n,o){i.push((function(){!function(t,n,o){var i=o.reference;e.resolve({bundle:t,resource:n,reference:o}).then((function(t){var e=t.data||t.content;r[i]=e,u()}))}(t,n,o)}))}(a,o,f)}}))})),u()}),(function(){o.reject("Could not fetch search results")})),o.promise}t.exports=function(t,n){return e=t,r=n,t.drain=o,t.fetchAll=i,t.fetchAllWithReferences=u,t}}).call(this)},256:function(t,e,r){(function(){r(454);var e=r(801),n=r(921),o=r(294),i=r(821),u=r(442),a=r(856),c=r(719),s=r(29),l=r(723),f=r(249),p=r(525);t.exports=function(t,r){var h=e.Middleware,d=e.$$Attr,v=function(t){return d("method",t)},y=function(t,e){return d("headers."+t,e)},b=h(u),m=h(a(t,r)).and(b).and(o.$Basic).and(o.$Bearer).and(o.$Credentials).and(i.$JsonData).and(y("Accept",t.headers&&t.headers.Accept?t.headers.Accept:"application/json")).and(y("Content-Type",t.headers&&t.headers["Content-Type"]?t.headers["Content-Type"]:"application/json")),g=m.and(v("GET")),w=m.and(v("POST")),_=m.and(v("PUT")),S=m.and(v("DELETE")),E=m.and(v("PATCH")),O=i.Http(t,r),x=f.Path,j=x(t.baseUrl),P=j.slash(":type || :resource.resourceType"),T=P.slash("_history"),$=P.slash(":id || :resource.id"),A=$.slash("_history"),k=$.slash(":versionId || :resource.meta.versionId"),L=j.slash(":target.resourceType || :target.type").slash(":target.id").slash(":target.versionId"),D=y("Prefer","return=representation"),R=h(n.$Paging);return p({conformance:g.and(j.slash("metadata")).end(O),document:w.and(j.slash("Document")).end(O),profile:g.and(j.slash("Profile").slash(":type")).end(O),transaction:w.and(j).end(O),history:g.and(j.slash("_history")).and(R).end(O),typeHistory:g.and(T).and(R).end(O),resourceHistory:g.and(A).and(R).end(O),read:g.and(s.$WithPatient).and($).end(O),vread:g.and(k).end(O),delete:S.and($).and(D).end(O),create:w.and(P).and(D).end(O),validate:w.and(P.slash("_validate")).end(O),meta:{add:w.and(L.slash("$meta-add")).end(O),delete:w.and(L.slash("$meta-delete")).end(O),read:g.and(L.slash("$meta")).end(O)},search:g.and(P).and(s.$WithPatient).and(n.$SearchParams).and(R).end(O),update:_.and($).and(D).end(O),conditionalUpdate:_.and(P).and(n.$SearchParams).and(D).end(O),conditionalDelete:S.and(P).and(n.$SearchParams).and(D).end(O),nextPage:g.and(c.$$BundleLinkUrl("next")).end(O),prevPage:g.and(c.$$BundleLinkUrl("previous")).and(c.$$BundleLinkUrl("prev")).end(O),getBundleByUrl:g.and(x(":url")).end(O),resolve:g.and(l.resolve).end(O),patch:E.and($).and(y("Content-Type","application/json-patch+json")).end(O)},r)}}).call(this)},294:function(t,e,r){(function(){var t,n=r(801),o=r(672).btoa;e.$Basic=n.$$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=n.$$Attr("headers.Authorization",(function(t){if(t.auth&&t.auth.bearer)return"Bearer "+t.auth.bearer})),e.$Credentials=n.Middleware(n.$$Attr("credentials",(function(e){return t=e.credentials,""}))).and(n.$$Attr("credentials",(function(e){if(["same-origin","include"].indexOf(t)>-1)return t})))}).call(this)},719:(t,e)=>{e.$$BundleLinkUrl=function(t){return function(e){return function(r){var n=r.bundle&&(r.bundle.link||[]).filter((function(e){return e.relation&&e.relation===t}))[0];return n&&n.url&&(r.url=n.url,r.data=null),e(r)}}}},856:function(t){(function(){var e=function(t,e,r){var n=t[r];return n&&!e[r]&&(e[r]=n),t};t.exports=function(t,r){return function(n){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(r,o,"defer"),e(r,o,"http"),n(o)}}}}).call(this)},801:function(t,e,r){(function(){var t=r(454),n=function(t){return t.and=function(e){return n((r=t,o=e,function(t){return r(o(t))}));var r,o},t.end=function(e){return t(e)},t};e.$$Simple=function(t){return function(e){return function(r){return e(t(r))}}},e.$$Attr=function(e,r){return n((function(n){return function(o){var i;return i="function"==t.type(r)?r(o):r,n(null==i&&null==i?o:function(t,e,r){for(var n=e.split("."),o=t,i=0;i<n.length-1;i++){var u=n[i];(o=t[u])||(o={},t[u]=o)}return o[n[n.length-1]]=r,t}(o,e,i))}}))};var o=function(t,e){return n((function(r){return function(n){return n[t]=e(n),r(n)}}))};e.Middleware=n,e.Attribute=o,e.Method=function(t){return o("method",(e=t,function(){return e}));var e}}).call(this)},442:t=>{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 r=e.defer();return r.reject(t),r.promise}}}},821:function(t,e,r){(function(){var t=r(454);e.Http=function(t,e){return function(r){r.debug&&console.log("\nDEBUG (request):",r.method,r.url,r);var n=(r.http||e.http||t.http)(r);return r.debug&&n&&n.then&&n.then((function(t){console.log("\nDEBUG: (responce)",t)})),n}},e.$JsonData=function(e){return function(r){var n,o=r.bundle||r.data||r.resource;return o&&(r.data=(n=o,"object"==t.type(n)||"array"==t.type(n)?JSON.stringify(n):n)),e(r)}}}).call(this)},29:function(t,e,r){(function(){var t=r(801),n=["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):n.indexOf(e)>=0&&(t.query=t.query||{},t.query.patient=t.patient)),t}))}).call(this)},723:function(t,e,r){(function(){var e=r(454),n=/^#(.*)/,o=function(t){var r=t.cache,o=t.reference,i=t.bundle,u=o;if(!u.reference)return null;if(u.reference.match(n))return function(t,e){var r=t.match(n)[1],o=(e.contained||[]).filter((function(t){return(t.id||t._id)==r}))[0];return o&&{content:o}||null}(u.reference,t.resource);var a=e.absoluteUrl(t.baseUrl,u.reference);return(i&&i.entry||[]).filter((function(t){return t.id===a}))[0]||(null!=r?r[a]:void 0)||null};t.exports.sync=o,t.exports.resolve=function(t){return function(r){var i=o(r),u=r.reference,a=r.defer();if(i){if(!r.defer)throw new Error("I need promise constructor 'adapter.defer' in adapter");return a.resolve(i),a.promise}if(!u)throw new Error("No reference found");if(u&&u.reference.match(n))throw new Error("Contained resource not found");return r.url=e.absoluteUrl(r.baseUrl,u.reference),r.data=null,t(r)}}}).call(this)},921:function(t,e,r){(function(){var t=r(454),n=t.type,o=t.assertArray,i=(t.assertObject,t.reduceMap),u=t.identity,a={$gt:"gt",$lt:"lt",$lte:"lte",$gte:"gte",$ge:"ge",$le:"le"},c={$asc:":asc",$desc:":desc",$exact:":exact",$missing:":missing",$null:":missing",$text:":text"},s=function(t,e){if("$sort"===t)return function(t){var e,r,i,u;for(o(t),i=[],e=0,r=t.length;e<r;e++)switch(u=t[e],n(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 r,o;return r=e[0],o=e[1],t.concat(function(){switch(n(o)){case"array":return o.map((function(t){return{param:"_has",value:r+"="+t}}));case"string":return[{param:"_has",value:r+"="+o}]}}())}));if("$include"===t||"$revInclude"===t)return r=t,i(e,(function(t,e){var o,i;return o=e[0],i=e[1],t.concat(function(){switch(n(i)){case"array":return i.map((function(t){return{param:"$include"===r?"_include":"_revinclude",value:o+":"+t}}));case"string":return[{param:"$include"===r?"_include":"_revinclude",value:o+":"+i}]}}())}));var r;switch(n(e)){case"object":return function(t,e){return i(e,(function(r,i){var u,l,f,p;return u=i[0],p=i[1],r.concat("$and"===u?o(p).reduce((function(e,r){return e.concat(s(t,r))}),[]):"$type"===u?[]:function(t){return 0===t.indexOf("$")}(u)?(l={param:t},"$or"===u?l.value=p:(a[u]&&(l.operator=a[u]),c[u]&&(l.modifier=c[u]),"object"===n(p)&&p.$or?l.value=p.$or:l.value=[p]),[l]):(e.$type&&(f=":"+e.$type),s(""+t+(f||"")+"."+u,p)))}))}(t,e);case"string":case"number":return[{param:t,value:[e]}];case"array":return[{param:t,value:[e.join("|")]}];default:throw"could not linearizeParams "+n(e)}},l=function(t){return i(t,(function(t,e){var r,n;return r=e[0],n=e[1],t.concat(s(r,n))}))},f=function(t){var e,r,n=["_include","_revinclude","_has"];return function(){var o,i,a,c;for(c=[],o=0,i=(a=l(t)).length;o<i;o++)e=a[o],r=-1===n.indexOf(e.param)?encodeURIComponent(e.value):e.value,c.push([e.param,e.modifier,"_has"==e.param?":":"=",e.operator,r].filter(u).join(""));return c}().join("&")};e._query=l,e.query=f;var p=r(801);e.$SearchParams=p.$$Attr("url",(function(t){var e=t.url;return t.query?e+"?"+f(t.query):e})),e.$Paging=function(t){return function(e){var r=e.params||{};return e.since&&(r._since=e.since),e.count&&(r._count=e.count),e.params=r,t(e)}}}).call(this)},249:function(t,e,r){(function(){r(454);var t=r(801),n=function(e,r){var o=function(t){return r&&e.includes("target.versionId")&&!t.target.versionId?r(t):(r&&r(t)+"/"||"")+function(t,e){var r=function(t,e){return 0==t.indexOf(":")?function(t,e){for(var r,n=t.split("||").map((function(t){return t.trim().substring(1)})),o=0;o<n.length;o++){var i=(r=e,n[o].split(".").reduce((function(t,e){return"versionId"===e&&t[e]?"_history/"+t[e]:null==t||null==t?null:t[e]}),r));if(i)return i}return null}(t,e):t}(t.trim(),e);if((null==r||void 0===r)&&0==t.includes("target.versionId"))throw new Error("Parameter "+t+" is required: "+JSON.stringify(e));return r}(e,t)},i=t.Attribute("url",o);return i.slash=function(t){return n(t,o)},i};e.Path=n}).call(this)},454:function(t,e,r){(function(){var t=r(651),n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;e.trim=function(t){return t?t.toString().replace(n,""):""};var o=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=o,e.assertArray=function(t){if("array"!==o(t))throw"not array";return t};var i=function(t){if("object"!==o(t))throw"not object";return t};e.assertObject=i;var u=function(t,e,r){var n,o;return r||(r=[]),i(t),function(){var e;for(n in e=[],t)o=t[n],e.push([n,o]);return e}().reduce(e,r)};e.reduceMap=u,e.identity=function(t){return t};var a=function(){return Array.prototype.slice.call(arguments)};e.argsArray=a,e.mergeLists=function(){var e;return e=function(e,r){var n,o,i;for(n in o=t(!0,e),r)i=r[n],o[n]=(o[n]||[]).concat(i);return o},a.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,r){return e=e.replace(/\/$/,""),(t=t.replace(/^\//,"")).indexOf("/")<0?e+"/"+r+"/"+t:0!==t.indexOf(e)?e+"/"+t:t};var c=function(t,e,r,n){var i;switch(o(r)){case"array":return e(r.map((function(e){return t(e,[r,n])})),n);case"object":return i=function(e,o){var i,u;return i=o[0],u=o[1],e[i]=t(u,[r].concat(n)),e},e(u(r,i,{}),n);default:return e(r,n)}};e.walk=c;var s=function(t,e,r){return e?c(s(t),t,e,r):function(e,r){return s(t,e,r)}};e.postwalk=s}).call(this)},651:(t,e,r)=>{!function(e){var r=function(t){return o(!0===t,!1,arguments)};function n(t,e){if("object"!==i(t))return e;for(var r in e)"object"===i(t[r])&&"object"===i(e[r])?t[r]=n(t[r],e[r]):t[r]=e[r];return t}function o(t,e,o){var u=o[0],a=o.length;(t||"object"!==i(u))&&(u={});for(var c=0;c<a;++c){var s=o[c];if("object"===i(s))for(var l in s)if("__proto__"!==l){var f=t?r.clone(s[l]):s[l];u[l]=e?n(u[l],f):f}}return u}function i(t){return{}.toString.call(t).slice(8,-1).toLowerCase()}r.recursive=function(t){return o(!0===t,!0,arguments)},r.clone=function(t){var e,n,o=t,u=i(t);if("array"===u)for(o=[],n=t.length,e=0;e<n;++e)o[e]=r.clone(t[e]);else if("object"===u)for(e in o={},t)o[e]=r.clone(t[e]);return o},e?t.exports=r:window.merge=r}((t=r.nmd(t))&&"object"==typeof t.exports&&t.exports)},602:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,i=Object.create(o.prototype),u=new T(n||[]);return i._invoke=function(t,e,r){var n=f;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=x(u,r);if(a){if(a===v)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var c=l(t,e,r);if("normal"===c.type){if(n=r.done?d:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=d,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f="suspendedStart",p="suspendedYield",h="executing",d="completed",v={};function y(){}function b(){}function m(){}var g={};c(g,i,(function(){return this}));var w=Object.getPrototypeOf,_=w&&w(w($([])));_&&_!==r&&n.call(_,i)&&(g=_);var S=m.prototype=y.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,i,u,a){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,x(t,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function $(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,u=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return u.next=u}}return{next:A}}function A(){return{value:e,done:!0}}return b.prototype=m,c(S,"constructor",m),c(m,"constructor",b),b.displayName=c(m,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,c(t,a,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},E(O.prototype),c(O.prototype,u,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var u=new O(s(e,r,n,o),i);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},E(S),c(S,a,"Generator"),c(S,i,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=$,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:$(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},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 u=n.slice(0,i+1);return r.protocol+"//"+r.host+u},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 u=r,a=0;a<u.length;a++)u[a](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 u=t.apply(this,o);if(null!=u)return u.then?u.then(r):r(u)}},setState:o,subscribe:function(t){return r.push(t),function(){n(t)}},unsubscribe:n,getState:function(){return e}}},r=function(t,r){var n=s[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 s[t]={value:o,active:!0},o},i=function(t,r){var n=s[t];if(!n){var o=e(r);return s[t]={value:o,active:!1},o}return n.value},u=function(t){return r("app",t)},a=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 u},createGlobalStore:function(){return r},getAppState:function(){return a},getGlobalStore:function(){return i},subscribeTo:function(){return c}});var s={}}(),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 u=n.slice(0,i+1);return r.protocol+"//"+r.host+u};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]={id:e,loaded:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}i.y=e,i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),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})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{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 u={};return(0,i(968).s)(1),(()=>{"use strict";i.r(u),i.d(u,{OpenmrsFetchError:()=>rt,VisitMode:()=>Mt,VisitStatus:()=>Nt,backendDependencies:()=>Yt,clearCurrentUser:()=>ht,defaultVisitCustomRepresentation:()=>Ut,fetchCurrentPatient:()=>_t,fhir:()=>ot,fhirBaseUrl:()=>nt,getCurrentUser:()=>lt,getLocations:()=>Jt,getLoggedInUser:()=>vt,getSessionLocation:()=>yt,getSessionStore:()=>ft,getStartedVisit:()=>Ht,getVisitTypes:()=>Gt,getVisitsForPatient:()=>It,makeUrl:()=>Z,openmrsFetch:()=>tt,openmrsObservableFetch:()=>et,refetchCurrentUser:()=>pt,saveVisit:()=>Bt,sessionEndpoint:()=>X,setSessionLocation:()=>bt,setupApiModule:()=>gt,toLocationObject:()=>qt,toVisitTypeObject:()=>Vt,updateVisit:()=>Ft,userHasAccess:()=>dt});var t=i(602),e=i.n(t),r=function(t,e){return r=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])},r(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t){return"function"==typeof t}var a=!1,c={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,a=t},get useDeprecatedSynchronousErrorHandling(){return a}};function s(t){setTimeout((function(){throw t}),0)}var l={closed:!0,next:function(t){},error:function(t){if(c.useDeprecatedSynchronousErrorHandling)throw t;s(t)},complete:function(){}},f=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}(),p=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}(),h=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r,n=this,i=n._parentOrParents,u=n._ctorUnsubscribe,a=n._unsubscribe,c=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof t)i.remove(this);else if(null!==i)for(var s=0;s<i.length;++s)i[s].remove(this);if(o(a)){u&&(this._unsubscribe=void 0);try{a.call(this)}catch(t){e=t instanceof p?d(t.errors):[t]}}if(f(c)){s=-1;for(var l=c.length;++s<l;){var h=c[s];if(null!==(r=h)&&"object"==typeof r)try{h.unsubscribe()}catch(t){e=e||[],t instanceof p?e=e.concat(d(t.errors)):e.push(t)}}}if(e)throw new p(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function d(t){return t.reduce((function(t,e){return t.concat(e instanceof p?e.errors:e)}),[])}var v=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),y=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=l;break;case 1:if(!r){i.destination=l;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 n(e,t),e.prototype[v]=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}(h),b=function(t){function e(e,r,n,i){var u,a=t.call(this)||this;a._parentSubscriber=e;var c=a;return o(r)?u=r:r&&(u=r.next,n=r.error,i=r.complete,r!==l&&(o((c=Object.create(r)).unsubscribe)&&a.add(c.unsubscribe.bind(c)),c.unsubscribe=a.unsubscribe.bind(a))),a._context=c,a._next=u,a._error=n,a._complete=i,a}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.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,r=c.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):s(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;s(t)}}},e.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)};c.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.useDeprecatedSynchronousErrorHandling)throw t;s(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!c.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return c.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(s(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(y),m=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function g(t){return t}function w(t){return 0===t.length?g:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var _=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,o=function(t,e,r){if(t){if(t instanceof y)return t;if(t[v])return t[v]()}return t||e||r?new y(t,e,r):new y(l)}(t,e,r);if(n?o.add(n.call(o,this.source)):o.add(this.source||c.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),c.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){c.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 y?n:null}return!0}(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=S(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[m]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:w(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=S(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 S(t){if(t||(t=c.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const E="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const x=(E||O||Function("return this")()).Symbol;var j=Object.prototype,P=j.hasOwnProperty,T=j.toString,$=x?x.toStringTag:void 0;var A=Object.prototype.toString;var k=x?x.toStringTag:void 0;const L=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":k&&k in Object(t)?function(t){var e=P.call(t,$),r=t[$];try{t[$]=void 0;var n=!0}catch(t){}var o=T.call(t);return n&&(e?t[$]=r:delete t[$]),o}(t):function(t){return A.call(t)}(t)},D=(R=Object.getPrototypeOf,C=Object,function(t){return R(C(t))});var R,C;var U=Function.prototype,I=Object.prototype,B=U.toString,F=I.hasOwnProperty,M=B.call(Object);const N=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=L(t))return!1;var e=D(t);if(null===e)return!0;var r=F.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&B.call(r)==M};var H=i(824);function V(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function G(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){V(i,n,o,u,a,"next",t)}function a(t){V(i,n,o,u,a,"throw",t)}u(void 0)}))}}function q(){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 J(t,e,r){return J=q()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&W(o,r.prototype),o},J.apply(null,arguments)}function Y(t){return Y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Y(t)}function z(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 W(t,e){return W=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},W(t,e)}var Q=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function K(t){var e="function"==typeof Map?new Map:void 0;return K=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 J(t,arguments,Y(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),W(n,t)},K(t)}var X="/ws/rest/v1/session";function Z(t){return window.openmrsBase+t}function tt(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.");var n=Z(t);r.headers||(r.headers={}),N(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;var o,i=Error();return window.fetch(n,r).then((o=G(e().mark((function t(r){var o,u;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(o=r).ok){t.next=10;break}if(204!==o.status){t.next=7;break}return o.data=null,t.abrupt("return",o);case 7:return t.abrupt("return",o.text().then((function(t){try{t&&(o.data=JSON.parse(t))}catch(t){}return o})));case 8:t.next=19;break;case 10:return t.next=12,(0,H.getConfig)("@openmrs/esm-api");case 12:if(u=t.sent.redirectAuthFailure,!(n===Z(X)&&403===o.status||u.enabled&&u.errors.includes(o.status))){t.next=18;break}return(0,H.navigate)({to:u.url}),t.abrupt("return",u.resolvePromise?Promise.resolve():new Promise((function(){})));case 18:return t.abrupt("return",o.text().then((function(t){var e=t;try{e=JSON.parse(t)}catch(t){}throw new rt(n,o,e,i)}),(function(t){throw new rt(n,o,null,i)})));case 19:case"end":return t.stop()}}),t)}))),function(t){return o.apply(this,arguments)}))}function et(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 _((function(n){var o=!1;return tt(t,e).then((function(t){o=!0,n.next(t),n.complete()}),(function(t){o=!0,n.error(t)})),function(){o||r.abort()}}))}var rt=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&&W(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=Y(e);if(r){var o=Y(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return z(this,t)});function o(t,e,r,i){var u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(u=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=u.message,u.responseBody=r,u.response=e,u.stack="Stacktrace for outgoing request:\n".concat(i.stack,"\nStacktrace for incoming response:\n").concat(u.stack),u}return o}(K(Error)),nt="/ws/fhir2/R4",ot=i(256)({baseUrl:nt},{http:function(t){return tt(t.url,{method:t.method,headers:t.headers}).then((function(e){return{status:e.status,headers:e.headers,data:e.data,config:t}}),(function(e){return{status:e.response.status,headers:e.response.headers,data:e.responseBody,config:t}}))}}),it=i(254);function ut(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function at(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){ut(i,n,o,u,a,"next",t)}function a(t){ut(i,n,o,u,a,"throw",t)}u(void 0)}))}}var ct=(0,i(385).createGlobalStore)("session",{loaded:!1,session:null}),st=0;function lt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(st<Date.now()-6e4||!ct.getState().loaded)&&pt(),new _((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(ct.getState()),ct.subscribe(r)}))}function ft(){return(st<Date.now()-6e4||!ct.getState().loaded)&&pt(),ct}function pt(){return new Promise((function(t,e){st=Date.now(),tt(X).then((function(r){if("object"!=typeof(null==r?void 0:r.data))return e(),Promise.reject();var n,o,i,u,a;(a=null!==(u=null==(n=r.data)||null===(o=n.user)||void 0===o||null===(i=o.userProperties)||void 0===i?void 0:i.defaultLocale)&&void 0!==u?u:n.locale)!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",a),t(r.data),ct.setState({loaded:!0,session:r.data})})).catch((function(t){return(0,it.reportError)("Failed to fetch new session information: ".concat(t)),e(t),{sessionId:"",authenticated:!1}}))}))}function ht(){ct.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function dt(t,e){return function(t,e){return e.privileges.find((function(e){return t===e.display}))}(t,e)||function(t){return 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(ct.getState()),t||(e=ct.subscribe(o))}))}function yt(){return new Promise((function(t,e){var r=lt().subscribe((function(e){t(e.sessionLocation),r.unsubscribe()}),e)}))}function bt(t,e){return mt.apply(this,arguments)}function mt(){return(mt=at(e().mark((function t(r,n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,tt(X,{method:"POST",body:{sessionLocation:r},headers:{"Content-Type":"application/json"},signal:n.signal});case 2:pt();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gt(){(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."}}}),pt()}function wt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _t(t,e){return t?ot.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){wt(t,e,r[e])}))}return t}({type:"Patient",patient:t},e)):Promise.resolve(null)}var St=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),Et=function(t){function e(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return n(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 r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},e}(h),Ot=function(t){function e(e){var r=t.call(this,e)||this;return r.destination=e,r}return n(e,t),e}(y),xt=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 n(e,t),e.prototype[v]=function(){return new Ot(this)},e.prototype.lift=function(t){var e=new jt(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new St;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new St;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},e.prototype.complete=function(){if(this.closed)throw new St;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},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new St;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new St;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new Et(this,t))},e.prototype.asObservable=function(){var t=new _;return t.source=this,t},e.create=function(t,e){return new jt(t,e)},e}(_),jt=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return n(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):h.EMPTY},e}(xt),Pt=function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new St;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(xt),Tt=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}(),$t=new _((function(t){return t.complete()}));function At(t){return function(e){return 0===t?r?function(t){return new _((function(e){return t.schedule((function(){return e.complete()}))}))}(r):$t:e.lift(new kt(t));var r}}var kt=function(){function t(t){if(this.total=t,this.total<0)throw new Tt}return t.prototype.call=function(t,e){return e.subscribe(new Lt(t,this.total))},t}(),Lt=function(t){function e(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return n(e,t),e.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},e}(y);function Dt(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 Rt(t,e))}}var Rt=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Ct(t,this.project,this.thisArg))},t}(),Ct=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return n(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}(y),Ut="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,value),location:(uuid,name,display),startDatetime,stopDatetime)";function It(t,e,r){var n=null!=r?r:Ut;return et("/ws/rest/v1/visit?patient=".concat(t,"&v=").concat(n),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(At(1)).pipe(Dt((function(t){return t})))}function Bt(t,e){return et("/ws/rest/v1/visit",{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function Ft(t,e,r){return et("/ws/rest/v1/visit/".concat(t),{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}var Mt,Nt,Ht=new Pt(null);function Vt(t){return{uuid:t.uuid,display:t.display,name:t.name}}function Gt(){return et("/ws/rest/v1/visittype").pipe(Dt((function(t){return t.data.results.map(Vt)}))).pipe(At(1))}function qt(t){return{uuid:t.uuid,display:t.display}}function Jt(){return et("/ws/rest/v1/location").pipe(Dt((function(t){return t.data.results.map(qt)}))).pipe(At(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(Mt||(Mt={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Nt||(Nt={}));var Yt={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),u})())}}}));
|
|
1
|
+
System.register(["@openmrs/esm-config","@openmrs/esm-error-handling"],(function(t,r){var e={},n={};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}],execute:function(){t((()=>{var t={602:t=>{var r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function a(t,r,e,n){var o=r&&r.prototype instanceof b?r:b,i=Object.create(o.prototype),s=new P(n||[]);return i._invoke=function(t,r,e){var n=f;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return k()}for(e.method=o,e.arg=i;;){var s=e.delegate;if(s){var u=x(s,e);if(u){if(u===y)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===f)throw n=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var c=l(t,r,e);if("normal"===c.type){if(n=e.done?d:p,c.arg===y)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n=d,e.method="throw",e.arg=c.arg)}}}(t,e,s),i}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var f="suspendedStart",p="suspendedYield",h="executing",d="completed",y={};function b(){}function v(){}function g(){}var m={};c(m,i,(function(){return this}));var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==e&&n.call(_,i)&&(m=_);var S=g.prototype=b.prototype=Object.create(m);function E(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function O(t,r){function e(o,i,s,u){var c=l(t[o],t,i);if("throw"!==c.type){var a=c.arg,f=a.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,s,u)}),(function(t){e("throw",t,s,u)})):r.resolve(f).then((function(t){a.value=t,s(a)}),(function(t){return e("throw",t,s,u)}))}u(c.arg)}var o;this._invoke=function(t,n){function i(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,x(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,y;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,y):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function j(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function T(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return s.next=s}}return{next:k}}function k(){return{value:r,done:!0}}return v.prototype=g,c(S,"constructor",g),c(g,"constructor",v),v.displayName=c(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,u,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},E(O.prototype),c(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var s=new O(a(r,e,n,o),i);return t.isGeneratorFunction(e)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},E(S),c(S,u,"Generator"),c(S,i,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=L,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),a=n.call(s,"finallyLoc");if(c&&a){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=r,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),y},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),T(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;T(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},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}},o={};function i(r){var e=o[r];if(void 0!==e)return e.exports;var n=o[r]={exports:{}};return t[r](n,n.exports,i),n.exports}i.y=r,i.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return i.d(r,{a:r}),r},i.d=(t,r)=>{for(var e in r)i.o(r,e)&&!i.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},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,r)=>Object.prototype.hasOwnProperty.call(t,r),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 r=i.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(/\/[^\/]+$/,"/"),i.p=t})();var s={};return(0,i(968).s)(1),(()=>{"use strict";i.r(s),i.d(s,{OpenmrsFetchError:()=>et,VisitMode:()=>It,VisitStatus:()=>Bt,backendDependencies:()=>zt,clearCurrentUser:()=>yt,defaultVisitCustomRepresentation:()=>Ut,fetchCurrentPatient:()=>Et,fhir:()=>ot,fhirBaseUrl:()=>nt,getCurrentUser:()=>pt,getLocations:()=>Wt,getLoggedInUser:()=>vt,getSessionLocation:()=>gt,getSessionStore:()=>ht,getStartedVisit:()=>Yt,getVisitTypes:()=>Jt,getVisitsForPatient:()=>Mt,makeUrl:()=>Z,openmrsFetch:()=>tt,openmrsObservableFetch:()=>rt,refetchCurrentUser:()=>dt,saveVisit:()=>Gt,sessionEndpoint:()=>X,setSessionLocation:()=>mt,setupApiModule:()=>_t,toLocationObject:()=>qt,toVisitTypeObject:()=>$t,updateVisit:()=>Ht,userHasAccess:()=>bt});var t=i(602),r=i.n(t),e=function(t,r){return e=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])},e(t,r)};function n(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function o(t){return"function"==typeof t}var u=!1,c={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,u=t},get useDeprecatedSynchronousErrorHandling(){return u}};function a(t){setTimeout((function(){throw t}),0)}var l={closed:!0,next:function(t){},error:function(t){if(c.useDeprecatedSynchronousErrorHandling)throw t;a(t)},complete:function(){}},f=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}(),p=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}(),h=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var r;if(!this.closed){var e,n=this,i=n._parentOrParents,s=n._ctorUnsubscribe,u=n._unsubscribe,c=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof t)i.remove(this);else if(null!==i)for(var a=0;a<i.length;++a)i[a].remove(this);if(o(u)){s&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){r=t instanceof p?d(t.errors):[t]}}if(f(c)){a=-1;for(var l=c.length;++a<l;){var h=c[a];if(null!==(e=h)&&"object"==typeof e)try{h.unsubscribe()}catch(t){r=r||[],t instanceof p?r=r.concat(d(t.errors)):r.push(t)}}}if(r)throw new p(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 d(t){return t.reduce((function(t,r){return t.concat(r instanceof p?r.errors:r)}),[])}var y=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),b=function(t){function r(e,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=l;break;case 1:if(!e){i.destination=l;break}if("object"==typeof e){e instanceof r?(i.syncErrorThrowable=e.syncErrorThrowable,i.destination=e,e.add(i)):(i.syncErrorThrowable=!0,i.destination=new v(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new v(i,e,n,o)}return i}return n(r,t),r.prototype[y]=function(){return this},r.create=function(t,e,n){var o=new r(t,e,n);return o.syncErrorThrowable=!1,o},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},r.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},r.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},r}(h),v=function(t){function r(r,e,n,i){var s,u=t.call(this)||this;u._parentSubscriber=r;var c=u;return o(e)?s=e:e&&(s=e.next,n=e.error,i=e.complete,e!==l&&(o((c=Object.create(e)).unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=s,u._error=n,u._complete=i,u}return n(r,t),r.prototype.next=function(t){if(!this.isStopped&&this._next){var r=this._parentSubscriber;c.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?this.__tryOrSetError(r,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},r.prototype.error=function(t){if(!this.isStopped){var r=this._parentSubscriber,e=c.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):a(t),this.unsubscribe();else{if(this.unsubscribe(),e)throw t;a(t)}}},r.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)};c.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?(this.__tryOrSetError(r,e),this.unsubscribe()):(this.__tryOrUnsub(e),this.unsubscribe())}else this.unsubscribe()}},r.prototype.__tryOrUnsub=function(t,r){try{t.call(this._context,r)}catch(t){if(this.unsubscribe(),c.useDeprecatedSynchronousErrorHandling)throw t;a(t)}},r.prototype.__tryOrSetError=function(t,r,e){if(!c.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{r.call(this._context,e)}catch(r){return c.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(a(r),!0)}return!1},r.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},r}(b),g=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function m(t){return t}function w(t){return 0===t.length?m:1===t.length?t[0]:function(r){return t.reduce((function(t,r){return r(t)}),r)}}var _=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,o=function(t,r,e){if(t){if(t instanceof b)return t;if(t[y])return t[y]()}return t||r||e?new b(t,r,e):new b(l)}(t,r,e);if(n?o.add(n.call(o,this.source)):o.add(this.source||c.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),c.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){c.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 b?n:null}return!0}(t)?t.error(r):console.warn(r)}},t.prototype.forEach=function(t,r){var e=this;return new(r=S(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[g]=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:w(t)(this)},t.prototype.toPromise=function(t){var r=this;return new(t=S(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 S(t){if(t||(t=c.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const E="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const x=(E||O||Function("return this")()).Symbol;var j=Object.prototype,T=j.hasOwnProperty,P=j.toString,L=x?x.toStringTag:void 0;var k=Object.prototype.toString;var A=x?x.toStringTag:void 0;const D=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":A&&A in Object(t)?function(t){var r=T.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=P.call(t);return n&&(r?t[L]=e:delete t[L]),o}(t):function(t){return k.call(t)}(t)},R=(F=Object.getPrototypeOf,N=Object,function(t){return F(N(t))});var F,N;var C=Function.prototype,V=Object.prototype,U=C.toString,M=V.hasOwnProperty,G=U.call(Object);const H=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=D(t))return!1;var r=R(t);if(null===r)return!0;var e=M.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&U.call(e)==G};var I=i(824);function B(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 Y(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function s(t){B(i,n,o,s,u,"next",t)}function u(t){B(i,n,o,s,u,"throw",t)}s(void 0)}))}}function $(){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 J(t,r,e){return J=$()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(t,n));return e&&z(o,e.prototype),o},J.apply(null,arguments)}function q(t){return q=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},q(t)}function W(t,r){return!r||"object"!==K(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 z(t,r){return z=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},z(t,r)}var K=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 J(t,arguments,q(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),z(n,t)},Q(t)}var X="/ws/rest/v1/session";function Z(t){return window.openmrsBase+t}function tt(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 n=Z(t);e.headers||(e.headers={}),H(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;var o,i=Error();return window.fetch(n,e).then((o=Y(r().mark((function t(e){var o,s;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(o=e).ok){t.next=10;break}if(204!==o.status){t.next=7;break}return o.data=null,t.abrupt("return",o);case 7:return t.abrupt("return",o.text().then((function(t){try{t&&(o.data=JSON.parse(t))}catch(t){}return o})));case 8:t.next=19;break;case 10:return t.next=12,(0,I.getConfig)("@openmrs/esm-api");case 12:if(s=t.sent.redirectAuthFailure,!(n===Z(X)&&403===o.status||s.enabled&&s.errors.includes(o.status))){t.next=18;break}return(0,I.navigate)({to:s.url}),t.abrupt("return",s.resolvePromise?Promise.resolve():new Promise((function(){})));case 18:return t.abrupt("return",o.text().then((function(t){var r=t;try{r=JSON.parse(t)}catch(t){}throw new et(n,o,r,i)}),(function(t){throw new et(n,o,null,i)})));case 19:case"end":return t.stop()}}),t)}))),function(t){return o.apply(this,arguments)}))}function rt(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 _((function(n){var o=!1;return tt(t,r).then((function(t){o=!0,n.next(t),n.complete()}),(function(t){o=!0,n.error(t)})),function(){o||e.abort()}}))}var et=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&&z(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=q(r);if(e){var o=q(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return W(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)),nt="/ws/fhir2/R4",ot={read:function(t){var r,e;return tt((e={url:"".concat(nt,"/").concat(t.type,"/").concat(t.patient),method:"GET",headers:null!==(r=t.headers)&&void 0!==r?r:{}}).url,{method:e.method,headers:e.headers}).then((function(t){return{status:t.status,headers:t.headers,data:t.data,config:e}}),(function(t){return{status:t.response.status,headers:t.response.headers,data:t.responseBody,config:e}}))}},it=i(254),st=i(385);const ut=function(t){return void 0===t};function ct(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 at(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function s(t){ct(i,n,o,s,u,"next",t)}function u(t){ct(i,n,o,s,u,"throw",t)}s(void 0)}))}}var lt=(0,st.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 _((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(),tt(X).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,it.reportError)("Failed to fetch new session information: ".concat(t)),r(t),{sessionId:"",authenticated:!1}}))}))}function yt(){lt.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function bt(t,r){return function(t,r){return"string"==typeof t?!ut(r.privileges.find((function(r){return t===r.display}))):Array.isArray(t)?t.every((function(t){return!ut(r.privileges.find((function(r){return t===r.display})))})):(console.error('Could not understand privileges "'.concat(t,'"')),!0)}(t,r)||function(t){return!ut(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 gt(){return new Promise((function(t,r){var e=pt().subscribe((function(r){t(r.sessionLocation),e.unsubscribe()}),r)}))}function mt(t,r){return wt.apply(this,arguments)}function wt(){return(wt=at(r().mark((function t(e,n){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,tt(X,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:n.signal});case 2:dt();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function _t(){(0,I.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:I.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:I.Type.String,_default:"${openmrsSpaBase}/login",_validators:[I.validators.isUrl]},errors:{_type:I.Type.Array,_default:[401],_elements:{_type:I.Type.Number,_validators:[I.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:I.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 St(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Et(t,r){return t?ot.read(function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{},n=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(e).filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})))),n.forEach((function(r){St(t,r,e[r])}))}return t}({type:"Patient",patient:t},r)):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}(),xt=function(t){function r(r,e){var n=t.call(this)||this;return n.subject=r,n.subscriber=e,n.closed=!1,n}return n(r,t),r.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)}}},r}(h),jt=function(t){function r(r){var e=t.call(this,r)||this;return e.destination=r,e}return n(r,t),r}(b),Tt=function(t){function r(){var r=t.call(this)||this;return r.observers=[],r.closed=!1,r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return n(r,t),r.prototype[y]=function(){return new jt(this)},r.prototype.lift=function(t){var r=new Pt(this,this);return r.operator=t,r},r.prototype.next=function(t){if(this.closed)throw new Ot;if(!this.isStopped)for(var r=this.observers,e=r.length,n=r.slice(),o=0;o<e;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 r=this.observers,e=r.length,n=r.slice(),o=0;o<e;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,r=t.length,e=t.slice(),n=0;n<r;n++)e[n].complete();this.observers.length=0},r.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},r.prototype._trySubscribe=function(r){if(this.closed)throw new Ot;return t.prototype._trySubscribe.call(this,r)},r.prototype._subscribe=function(t){if(this.closed)throw new Ot;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new xt(this,t))},r.prototype.asObservable=function(){var t=new _;return t.source=this,t},r.create=function(t,r){return new Pt(t,r)},r}(_),Pt=function(t){function r(r,e){var n=t.call(this)||this;return n.destination=r,n.source=e,n}return n(r,t),r.prototype.next=function(t){var r=this.destination;r&&r.next&&r.next(t)},r.prototype.error=function(t){var r=this.destination;r&&r.error&&this.destination.error(t)},r.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},r.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):h.EMPTY},r}(Tt),Lt=function(t){function r(r){var e=t.call(this)||this;return e._value=r,e}return n(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),r.prototype._subscribe=function(r){var e=t.prototype._subscribe.call(this,r);return e&&!e.closed&&r.next(this._value),e},r.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new Ot;return this._value},r.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},r}(Tt),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}(),At=new _((function(t){return t.complete()}));function Dt(t){return function(r){return 0===t?e?function(t){return new _((function(r){return t.schedule((function(){return r.complete()}))}))}(e):At:r.lift(new Rt(t));var e}}var Rt=function(){function t(t){if(this.total=t,this.total<0)throw new kt}return t.prototype.call=function(t,r){return r.subscribe(new Ft(t,this.total))},t}(),Ft=function(t){function r(r,e){var n=t.call(this,r)||this;return n.total=e,n.count=0,n}return n(r,t),r.prototype._next=function(t){var r=this.total,e=++this.count;e<=r&&(this.destination.next(t),e===r&&(this.destination.complete(),this.unsubscribe()))},r}(b);function Nt(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 Ct(t,r))}}var Ct=function(){function t(t,r){this.project=t,this.thisArg=r}return t.prototype.call=function(t,r){return r.subscribe(new Vt(t,this.project,this.thisArg))},t}(),Vt=function(t){function r(r,e,n){var o=t.call(this,r)||this;return o.project=e,o.count=0,o.thisArg=n||o,o}return n(r,t),r.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)},r}(b),Ut="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,value),location:(uuid,name,display),startDatetime,stopDatetime)";function Mt(t,r,e){var n=null!=e?e:Ut;return rt("/ws/rest/v1/visit?patient=".concat(t,"&v=").concat(n),{signal:r.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(Dt(1)).pipe(Nt((function(t){return t})))}function Gt(t,r){return rt("/ws/rest/v1/visit",{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function Ht(t,r,e){return rt("/ws/rest/v1/visit/".concat(t),{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:r})}var It,Bt,Yt=new Lt(null);function $t(t){return{uuid:t.uuid,display:t.display,name:t.name}}function Jt(){return rt("/ws/rest/v1/visittype").pipe(Nt((function(t){return t.data.results.map($t)}))).pipe(Dt(1))}function qt(t){return{uuid:t.uuid,display:t.display}}function Wt(){return rt("/ws/rest/v1/location").pipe(Nt((function(t){return t.data.results.map(qt)}))).pipe(Dt(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(It||(It={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Bt||(Bt={}));var zt={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),s})())}}}));
|
|
2
2
|
//# sourceMappingURL=openmrs-esm-api.js.map
|