@openmrs/esm-patient-registration-app 9.1.1-pre.6553 → 9.1.1

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.
@@ -10,7 +10,7 @@ assets by path *.js 3.61 MiB
10
10
  + 56 assets
11
11
  assets by path *.json 32.4 KiB
12
12
  asset openmrs-esm-patient-registration-app.js.buildmanifest.json 31.4 KiB [emitted]
13
- asset routes.json 1.04 KiB [emitted] [from: src/routes.json] [copied]
13
+ asset routes.json 1.03 KiB [emitted] [from: src/routes.json] [copied]
14
14
  orphan modules 9.62 MiB [orphan] 3106 modules
15
15
  runtime modules 42.6 KiB 30 modules
16
16
  built modules 8.02 MiB (javascript) 336 bytes (share-init) 336 bytes (consume-shared) [built]
@@ -39,4 +39,4 @@ Entrypoints:
39
39
  main (400 KiB)
40
40
  main.js
41
41
 
42
- webpack 5.99.9 compiled with 2 warnings in 111791 ms
42
+ webpack 5.99.9 compiled with 2 warnings in 250805 ms
package/dist/3093.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[3093],{43093:(t,e,n)=>{n.r(e),n.d(e,{default:()=>r});var a=n(1343),o=n.n(a),i=n(83437),s=n(93150);const r=function(t){var e=t.patientUuid,n=t.onTransition,a=(0,s.useTranslation)().t,r=o().useCallback(function(){(0,i.navigate)({to:"${openmrsSpaBase}/patient/".concat(e,"/edit")}),n&&n()},[n,e]);return o().createElement("li",{className:"cds--overflow-menu-options__option"},o().createElement("button",{className:"cds--overflow-menu-options__btn",role:"menuitem","data-floating-menu-primary-focus":!0,onClick:r},o().createElement("span",{className:"cds--overflow-menu-options__option-content"},a("editPatientDetails","Edit patient details"))))}}}]);
1
+ "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[3093],{43093:(t,e,n)=>{n.r(e),n.d(e,{default:()=>r});var a=n(1343),o=n.n(a),i=n(54440),s=n(93150);const r=function(t){var e=t.patientUuid,n=t.onTransition,a=(0,s.useTranslation)().t,r=o().useCallback(function(){(0,i.navigate)({to:"${openmrsSpaBase}/patient/".concat(e,"/edit")}),n&&n()},[n,e]);return o().createElement("li",{className:"cds--overflow-menu-options__option"},o().createElement("button",{className:"cds--overflow-menu-options__btn",role:"menuitem","data-floating-menu-primary-focus":!0,onClick:r},o().createElement("span",{className:"cds--overflow-menu-options__option-content"},a("editPatientDetails","Edit patient details"))))}}}]);
package/dist/3474.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 3474.js.LICENSE.txt */
2
- (globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[320,3474],{5921:(e,t,n)=>{"use strict";n.d(t,{A:()=>g});var r=n(39791),i=n(57812);var o=n(97942);const a=function(e){return e==e&&!(0,o.A)(e)};var u=n(7817);const s=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}},c=function(e){var t=function(e){for(var t=(0,u.A)(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,a(i)]}return t}(e);return 1==t.length&&t[0][2]?s(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,o){var a=n.length,u=a,s=!o;if(null==e)return!u;for(e=Object(e);a--;){var c=n[a];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<u;){var l=(c=n[a])[0],f=e[l],d=c[1];if(s&&c[2]){if(void 0===f&&!(l in e))return!1}else{var p=new r.A;if(o)var h=o(f,d,l,e,t,p);if(!(void 0===h?(0,i.A)(d,f,3,o,p):h))return!1}}return!0}(n,e,t)}};var l=n(55841);const f=function(e,t){return null!=e&&t in Object(e)};var d=n(23017);var p=n(1677),h=n(9322);const y=function(e,t){return(0,p.A)(e)&&a(t)?s((0,h.A)(e),t):function(n){var r=function(e,t,n){var r=null==e?void 0:(0,l.A)(e,t);return void 0===r?n:r}(n,e);return void 0===r&&r===t?function(e,t){return null!=e&&(0,d.A)(e,t,f)}(n,e):(0,i.A)(t,r,3)}};var m=n(14151),b=n(96956);const v=function(e){return(0,p.A)(e)?(t=(0,h.A)(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return(0,l.A)(t,e)}}(e);var t},g=function(e){return"function"==typeof e?e:null==e?m.A:"object"==typeof e?(0,b.A)(e)?y(e[0],e[1]):c(e):v(e)}},16666:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(60587),i=n(8007);var o=n(26207),a=n(74239);const u=function(e){e=(0,r.A)(e);var t,n,u,s,c=(0,o.A)(e)?(0,a.A)(e):void 0,l=c?c[0]:e.charAt(0),f=c?(t=c,n=1,s=t.length,u=void 0===u?s:u,!n&&u>=s?t:(0,i.A)(t,n,u)).join(""):e.slice(1);return l.toUpperCase()+f},s=(0,n(62617).A)(function(e,t,n){return t=t.toLowerCase(),e+(n?(i=t,u((0,r.A)(i).toLowerCase())):t);var i})},18361:(e,t,n)=>{"use strict";n.d(t,{pX:()=>C,qm:()=>E,zL:()=>x,GC:()=>P,Qi:()=>I});var r=n(5921),i=n(31475),o=n(7817);var a=/\s/;var u=/^\s+/;const s=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&a.test(e.charAt(t)););return t}(e)+1).replace(u,""):e};var c=n(97942),l=n(84089),f=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,p=/^0o[0-7]+$/i,h=parseInt;var y=1/0;const m=function(e){return e?(e=function(e){if("number"==typeof e)return e;if((0,l.A)(e))return NaN;if((0,c.A)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,c.A)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=s(e);var n=d.test(e);return n||p.test(e)?h(e.slice(2),n?2:8):f.test(e)?NaN:+e}(e))===y||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var b=Math.max;const v=(g=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o,a,u=null==n?0:(o=m(n),a=o%1,o==o?a?o-a:o:0);return u<0&&(u=b(i+u,0)),function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}(e,(0,r.A)(t,3),u)},function(e,t,n){var a=Object(e);if(!(0,i.A)(e)){var u=(0,r.A)(t,3);e=(0,o.A)(e),t=function(e){return u(a[e],e,a)}}var s=g(e,t,n);return s>-1?a[u?e[s]:s]:void 0});var g,A=n(37127),_=n(16666),w=n(83437),T=n(57691);function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function U(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function O(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){U(o,r,i,a,u,"next",e)}function u(e){U(o,r,i,a,u,"throw",e)}a(void 0)})}}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function P(){return O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/session"))];case 1:return[2,e.sent().data]}})})()}function C(){return O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/addresstemplate"))];case 1:return[2,e.sent().data]}})})()}function x(){return O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/relationshiptype?v=default"))];case 1:return[2,e.sent().data]}})})()}function E(){return O(function(){var e,t;return j(this,function(n){switch(n.label){case 0:return[4,(0,w.getConfig)(T.AO)];case 1:return(e=n.sent()).fieldDefinitions?(t=e.fieldDefinitions.map(function(e){return t=e,O(function(){var e;return j(this,function(n){switch(n.label){case 0:return e="","person attribute"===t.type&&(e="".concat(w.restBaseUrl,"/personattributetype/").concat(t.uuid)),t.answerConceptSetUuid?[4,B("".concat(w.restBaseUrl,"/concept/").concat(t.answerConceptSetUuid))]:[3,2];case 1:n.sent(),n.label=2;case 2:return[4,B(e)];case 3:return[2,n.sent().data]}})})();var t}),[4,Promise.all(t)]):[2];case 2:return[2,n.sent().reduce(function(e,t){return t&&e.push(t),e},[])]}})})()}function I(){return O(function(){var e,t,n,r,i,o,a,u;return j(this,function(s){switch(s.label){case 0:return e=function(e){n[e].identifierSources=a.filter(function(t){return t.identifierType.uuid===n[e].uuid}).map(function(e){var t=v(i.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e})},[4,O(function(){var e,t,n,r,i,o,a,u,s,c;return j(this,function(l){switch(l.label){case 0:return[4,Promise.all([B("".concat(w.restBaseUrl,"/patientidentifiertype?v=custom:(display,uuid,name,format,formatDescription,required,uniquenessBehavior)")),B("".concat(w.restBaseUrl,"/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType"))])];case 1:return e=D.apply(void 0,[l.sent(),2]),t=e[0],n=e[1],t.ok?(u=null==t||null===(r=t.data)||void 0===r?void 0:r.results,s=null==n||null===(a=n.data)||void 0===a||null===(o=a.results)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.metadataUuid,c=(null==n?void 0:n.ok)?[k(null==u?void 0:u.find(function(e){return e.uuid===s}),!0)]:[],u.forEach(function(e){e.uuid!==s&&c.push(k(e,!1))}),[2,c]):[2,[]]}})})()];case 1:return t=s.sent(),n=t.filter(Boolean),[4,Promise.all([O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/idgen/autogenerationoption?v=full"))];case 1:return[2,e.sent()]}})})(),O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/idgen/identifiersource?v=default"))];case 1:return[2,e.sent()]}})})()])];case 2:for(r=D.apply(void 0,[s.sent(),2]),i=r[0],o=r[1],a=o.data.results,u=0;u<(null==n?void 0:n.length);u++)e(u);return[2,n]}})})()}function B(e){return O(function(){var t;return j(this,function(n){switch(n.label){case 0:return t=new AbortController,[4,(0,w.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,A.A)(e)})];case 1:return n.sent(),[4,(0,w.openmrsFetch)(e,{headers:T.v4,signal:null==t?void 0:t.signal})];case 2:return[2,n.sent()]}})})()}function k(e,t){return{name:e.display,fieldName:(0,_.A)(e.name),required:e.required,uuid:e.uuid,format:e.format,formatDescription:e.formatDescription,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},23017:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(50196),i=n(61697),o=n(96956),a=n(85378),u=n(47893),s=n(9322);const c=function(e,t,n){for(var c=-1,l=(t=(0,r.A)(t,e)).length,f=!1;++c<l;){var d=(0,s.A)(t[c]);if(!(f=null!=e&&n(e,d)))break;e=e[d]}return f||++c!=l?f:!!(l=null==e?0:e.length)&&(0,u.A)(l)&&(0,a.A)(d,l)&&((0,o.A)(e)||(0,i.A)(e))}},26207:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const i=function(e){return r.test(e)}},36207:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(30977),i=n.n(r),o=n(95924),a=n.n(o)()(i());a.push([e.id,".-esm-patient-registration__add-patient-link__slotStyles___ejEWZ{background-color:rgba(0,0,0,0)}","",{version:3,sources:["webpack://./src/add-patient-link.scss"],names:[],mappings:"AAAA,iEACE,8BAAA",sourcesContent:[".slotStyles {\n background-color: transparent;\n}\n"],sourceRoot:""}]),a.locals={slotStyles:"-esm-patient-registration__add-patient-link__slotStyles___ejEWZ"};const u=a},49971:(e,t,n)=>{"use strict";n.d(t,{A4:()=>_,G1:()=>b,SE:()=>v,SP:()=>m,SQ:()=>T,Yu:()=>w,Z:()=>d,hz:()=>g,o9:()=>y,oq:()=>S,t2:()=>p,uH:()=>A,zx:()=>h});var r=n(83437),i=n(46372),o=n.n(i);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){u(o,r,i,a,s,"next",e)}function s(e){u(o,r,i,a,s,"throw",e)}a(void 0)})}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function f(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function d(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(t||""),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:n.signal})}function p(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/encounter"),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function h(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/idgen/identifiersource/").concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function y(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person/").concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function m(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship"),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function b(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship/").concat(e),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:t.relationshipType},signal:n.signal})}function v(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship/").concat(e),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:t.signal})}function g(e,t,n,i,o){return s(function(){var a,u;return f(this,function(s){return a=new AbortController,(u=new FormData).append("patient",e),u.append("file",function(e){for(var t=window.atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);var o=new Blob([r],{type:n});return new File([o],"patient-photo.png")}(t)),u.append("json",JSON.stringify({person:e,concept:o,groupMembers:[],obsDatetime:i})),[2,(0,r.openmrsFetch)(n,{method:"POST",signal:a.signal,body:u})]})})()}function A(e,t){return s(function(){var n,i,o,u;return f(this,function(s){switch(s.label){case 0:return[4,Promise.all([(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient?q=").concat(e),{signal:t.signal}),(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person?q=").concat(e),{signal:t.signal})])];case 1:return n=c.apply(void 0,[s.sent(),2]),i=n[0],o=n[1],f=i.data.results,u=function(e){if(Array.isArray(e))return a(e)}(f)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(f)||l(f)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o.data.results.forEach(function(e){u.some(function(t){return t.uuid===e.uuid})||u.push(e)}),[2,u]}var f})})()}function _(e,t){return s(function(){var n;return f(this,function(i){return n=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:t})]})})()}function w(e,t,n){return s(function(){var i;return f(this,function(o){return i=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:{identifier:n}})]})})()}function T(e,t){return s(function(){var n;return f(this,function(i){return n=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/").concat(t,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:n.signal})]})})()}function S(e,t,n){var r=new Date(e),i=c(t.split(":").map(Number),2),a=i[0],u=i[1],s="PM"===n?a%12+12:a%12;return o()(r).hour(s).minute(u).second(0).millisecond(0).toDate()}},57691:(e,t,n)=>{"use strict";n.d(t,{AO:()=>s,DA:()=>u,dR:()=>c,v4:()=>l});var r,i,o,a=n(83437),u="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",s="@openmrs/esm-patient-registration-app",c="patient-registration",l=(r={},o="network-first",(i=a.omrsOfflineCachingStrategyHttpHeaderName)in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r)},62617:(e,t,n)=>{"use strict";n.d(t,{A:()=>B});const r=(i={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},function(e){return null==i?void 0:i[e]});var i,o=n(60587),a=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var s=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var c=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var l="\\ud800-\\udfff",f="\\u2700-\\u27bf",d="a-z\\xdf-\\xf6\\xf8-\\xff",p="A-Z\\xc0-\\xd6\\xd8-\\xde",h="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",y="["+h+"]",m="\\d+",b="["+f+"]",v="["+d+"]",g="[^"+l+h+m+f+d+p+"]",A="(?:\\ud83c[\\udde6-\\uddff]){2}",_="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+p+"]",T="(?:"+v+"|"+g+")",S="(?:"+w+"|"+g+")",U="(?:['’](?:d|ll|m|re|s|t|ve))?",O="(?:['’](?:D|LL|M|RE|S|T|VE))?",D="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",j="[\\ufe0e\\ufe0f]?",P=j+D+"(?:\\u200d(?:"+["[^"+l+"]",A,_].join("|")+")"+j+D+")*",C="(?:"+[b,A,_].join("|")+")"+P,x=RegExp([w+"?"+v+"+"+U+"(?="+[y,w,"$"].join("|")+")",S+"+"+O+"(?="+[y,w+T,"$"].join("|")+")",w+"?"+T+"+"+U,w+"+"+O,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",m,C].join("|"),"g");const E=function(e,t,n){return e=(0,o.A)(e),void 0===(t=n?void 0:t)?function(e){return c.test(e)}(e)?function(e){return e.match(x)||[]}(e):function(e){return e.match(s)||[]}(e):e.match(t)||[]};var I=RegExp("['’]","g");const B=function(e){return function(t){return function(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}(E(function(e){return(e=(0,o.A)(e))&&e.replace(a,r).replace(u,"")}(t).replace(I,"")),e,"")}}},74239:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(26207),i="\\ud800-\\udfff",o="["+i+"]",a="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",u="\\ud83c[\\udffb-\\udfff]",s="[^"+i+"]",c="(?:\\ud83c[\\udde6-\\uddff]){2}",l="[\\ud800-\\udbff][\\udc00-\\udfff]",f="(?:"+a+"|"+u+")?",d="[\\ufe0e\\ufe0f]?",p=d+f+"(?:\\u200d(?:"+[s,c,l].join("|")+")"+d+f+")*",h="(?:"+[s+a+"?",a,c,l,o].join("|")+")",y=RegExp(u+"(?="+u+")|"+h+p,"g");const m=function(e){return(0,r.A)(e)?function(e){return e.match(y)||[]}(e):function(e){return e.split("")}(e)}},84767:(e,t,n)=>{var r={"./am.json":[81197,1197],"./ar.json":[14132,4132],"./ar_SY.json":[37617,7617],"./bn.json":[77159,7159],"./de.json":[34944,4944],"./en.json":[34300,4300],"./en_US.json":[59569,9569],"./es.json":[93099,3099],"./es_MX.json":[88349,8349],"./fr.json":[94055,4055],"./he.json":[84652,4652],"./hi.json":[36840,6840],"./hi_IN.json":[55442,5442],"./id.json":[72690,2690],"./it.json":[9538,9538],"./ka.json":[70795,795],"./km.json":[54335,4335],"./ku.json":[9895,9895],"./ky.json":[88163,8163],"./lg.json":[64618,4618],"./ne.json":[12146,2146],"./pl.json":[41119,1119],"./pt.json":[96679,6679],"./pt_BR.json":[36468,6468],"./qu.json":[35173,5173],"./ro_RO.json":[46022,6022],"./ru_RU.json":[60986,986],"./si.json":[56859,6859],"./sw.json":[89913,9913],"./sw_KE.json":[88618,8618],"./tr.json":[55241,5241],"./tr_TR.json":[99900,9900],"./uk.json":[60723,723],"./uz.json":[43584,3584],"./uz@Latn.json":[27097,7097],"./uz_UZ.json":[70890,890],"./vi.json":[79214,9214],"./zh.json":[35661,5661],"./zh_CN.json":[99879,9879]};function i(e){if(!n.o(r,e))return Promise.resolve().then(()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=r[e],i=t[0];return n.e(t[1]).then(()=>n(i))}i.keys=()=>Object.keys(r),i.id=84767,e.exports=i},87821:(e,t,n)=>{"use strict";n.r(t),n.d(t,{addPatientLink:()=>F,cancelPatientEditModal:()=>$,deleteIdentifierConfirmationModal:()=>z,editPatient:()=>R,editPatientDetailsButton:()=>M,importTranslation:()=>I,patientPhotoExtension:()=>L,root:()=>N,startupApp:()=>k});var r=n(83437),i=n(95008),o=n(57691),a=n(18361),u=n(97e3);function s(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,u,"next",e)}function u(e){s(o,r,i,a,u,"throw",e)}a(void 0)})}}function l(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function f(e){return["".concat(r.fhirBaseUrl,"/Patient/").concat(e),"".concat(r.restBaseUrl,"/relationship?v=").concat(o.DA,"&person=").concat(e),"".concat(r.restBaseUrl,"/person/").concat(e,"/attribute"),"".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map(function(e){return window.origin+(0,r.makeUrl)(e)})}function d(e,t){return c(function(){return l(this,function(n){switch(n.label){case 0:return[4,u.A.savePatientFormOnline(e._patientRegistrationData.isNewPatient,e._patientRegistrationData.formValues,e._patientRegistrationData.patientUuidMap,e._patientRegistrationData.initialAddressFieldValues,e._patientRegistrationData.capturePhotoProps,e._patientRegistrationData.currentLocation,e._patientRegistrationData.initialIdentifierValues,e._patientRegistrationData.currentUser,e._patientRegistrationData.config,e._patientRegistrationData.savePatientTransactionManager,t.abort)];case 1:return n.sent(),[2]}})})()}var p=n(1343),h=n.n(p),y=n(93150),m=n(25626),b=n(85951),v=n(72591),g=n.n(v),A=n(1740),_=n.n(A),w=n(88128),T=n.n(w),S=n(30855),U=n.n(S),O=n(93051),D=n.n(O),j=n(73656),P=n.n(j),C=n(36207),x={};x.styleTagTransform=P(),x.setAttributes=U(),x.insert=T().bind(null,"head"),x.domAPI=_(),x.insertStyleElement=D(),g()(C.A,x);const E=C.A&&C.A.locals?C.A.locals:void 0;var I=n(84767),B={featureName:"Patient Registration",moduleName:o.AO};function k(){(0,r.defineConfigSchema)(o.AO,i.hV),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.dR),title:function(){return Promise.resolve(window.i18next.t("patientRegistrationBreadcrumb",{defaultValue:"Patient Registration",ns:o.AO}))},parent:"".concat(window.spaBase,"/home")},{path:"".concat(window.spaBase,"/patient/:patientUuid/edit"),title:function(){return Promise.resolve(window.i18next.t("editPatientDetailsBreadcrumb",{defaultValue:"Edit patient details",ns:o.AO}))},parent:"".concat(window.spaBase,"/patient/:patientUuid/chart")}]),(0,r.setupOfflineSync)(o.dR,[],d,{onBeginEditSyncItem:function(e){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),c(function(){return l(this,function(e){switch(e.label){case 0:return[4,Promise.all([(0,a.GC)(),(0,a.pX)(),(0,a.zL)(),(0,a.qm)(),(0,a.Qi)()])];case 1:return e.sent(),[2]}})})(),(0,r.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return c(function(){var t,n;return l(this,function(r){switch(r.label){case 0:return t=f(e),[4,caches.open("omrs-spa-cache-v1")];case 1:return[4,r.sent().keys()];case 2:return n=r.sent().map(function(e){return e.url}),[2,t.every(function(e){return n.includes(e)})]}})})()},sync:function(e){return c(function(){var t;return l(this,function(n){switch(n.label){case 0:return t=f(e),[4,Promise.allSettled(t.map(function(e){return c(function(){return l(this,function(t){switch(t.label){case 0:return[4,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:e})];case 1:return t.sent(),[4,fetch(e)];case 2:return t.sent(),[2]}})})()}))];case 1:return n.sent(),[2]}})})()}})}var N=(0,r.getAsyncLifecycle)(function(){return Promise.all([n.e(8727),n.e(6724),n.e(5434),n.e(2086),n.e(627)]).then(n.bind(n,30627))},B),R=(0,r.getAsyncLifecycle)(function(){return Promise.all([n.e(8727),n.e(6724),n.e(5434),n.e(2086),n.e(627)]).then(n.bind(n,30627))},B),F=(0,r.getSyncLifecycle)(function(){var e=(0,y.useTranslation)().t,t=h().useCallback(function(){return(0,r.navigate)({to:"${openmrsSpaBase}/patient-registration"})},[]);return h().createElement(m.V8d,{"aria-label":e("addPatient","Add patient"),"aria-labelledby":e("addPatient","Add patient"),enterDelayMs:500,name:"AddPatientIcon",onClick:t,className:E.slotStyles},h().createElement(b.rs,{size:20}))},B),$=(0,r.getAsyncLifecycle)(function(){return n.e(8434).then(n.bind(n,58434))},B),L=(0,r.getAsyncLifecycle)(function(){return n.e(4463).then(n.bind(n,94463))},B),M=(0,r.getAsyncLifecycle)(function(){return n.e(3093).then(n.bind(n,43093))},B),z=(0,r.getAsyncLifecycle)(function(){return n.e(6276).then(n.bind(n,56276))},B)},90320:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,f=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.suspense_list"):60120,y=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,g=n?Symbol.for("react.responder"):60118,A=n?Symbol.for("react.scope"):60119;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case l:case f:case o:case u:case a:case p:return e;default:switch(e=e&&e.$$typeof){case c:case d:case m:case y:case s:return e;default:return t}}case i:return t}}}function w(e){return _(e)===f}t.AsyncMode=l,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=s,t.Element=r,t.ForwardRef=d,t.Fragment=o,t.Lazy=m,t.Memo=y,t.Portal=i,t.Profiler=u,t.StrictMode=a,t.Suspense=p,t.isAsyncMode=function(e){return w(e)||_(e)===l},t.isConcurrentMode=w,t.isContextConsumer=function(e){return _(e)===c},t.isContextProvider=function(e){return _(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return _(e)===d},t.isFragment=function(e){return _(e)===o},t.isLazy=function(e){return _(e)===m},t.isMemo=function(e){return _(e)===y},t.isPortal=function(e){return _(e)===i},t.isProfiler=function(e){return _(e)===u},t.isStrictMode=function(e){return _(e)===a},t.isSuspense=function(e){return _(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===f||e===u||e===a||e===p||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===y||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===v||e.$$typeof===g||e.$$typeof===A||e.$$typeof===b)},t.typeOf=_},95008:(e,t,n)=>{"use strict";n.d(t,{hV:()=>s,t_:()=>u,yk:()=>a});var r=n(83437);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var a=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone"]},{id:"death",name:"Death Info",fields:["dateAndTimeOfDeath","causeOfDeath"]},{id:"relationships",name:"Relationships",fields:[]}],u=["name","gender","dob","id","address","phone","causeOfDeath","dateAndTimeOfDeath"],s={sections:{_type:r.Type.Array,_default:["demographics","contact","relationships"],_description:"An array of strings which are the keys from 'sectionDefinitions' or any of the following built-in sections: '".concat(a.map(function(e){return e.id}).join("', '"),"'."),_elements:{_type:r.Type.String}},sectionDefinitions:{_type:r.Type.Array,_default:[],_elements:{id:{_type:r.Type.String,_description:"How this section will be referred to in the `sections` configuration. To override a built-in section, use that section's id. The built in section ids are '".concat(a.map(function(e){return e.id}).join("', '"),"'.")},name:{_type:r.Type.String,_description:"The title to display at the top of the section."},fields:{_type:r.Type.Array,_default:[],_description:"The parts to include in the section. Can be any of the following built-in fields: ".concat(u.join(", "),". Can also be an id from an object in the `fieldDefinitions` array, which you can use to define custom fields."),_elements:{_type:r.Type.String}}}},fieldDefinitions:{_type:r.Type.Array,_default:[],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields.",_elements:{id:{_type:r.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:r.Type.String,_description:"How this field's data will be stored—a person attribute or an obs.",_validators:[r.validators.oneOf(["person attribute","obs"])]},uuid:{_type:r.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},showHeading:{_type:r.Type.Boolean,_default:!1,_description:"Whether to show a heading above the person attribute field."},label:{_type:r.Type.String,_default:"",_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:r.Type.String,_default:"",_description:"Placeholder that will appear in the input."},allowFutureDates:{_type:r.Type.Boolean,_default:!0,_description:"Indicates whether the date input field should allow the selection of future dates or not."},allowPastDates:{_type:r.Type.Boolean,_default:!0,_description:"Indicates whether the date input field should allow the selection of past dates or not."},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:"",_description:"Optional RegEx for testing the validity of the input."}},locationTag:{_type:r.Type.String,_default:"",_description:'Only for fields with "person attribute" type `org.openmrs.Location`. This filters the list of location options in the dropdown based on their location tag. By default, all locations are shown.'},answerConceptSetUuid:{_type:r.Type.ConceptUuid,_default:"",_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:r.Type.Array,_default:[],_description:"For coded questions only (obs or person attrbute). A list of custom concept answers. Overrides answers that come from the obs concept or from `answerSetConceptUuid`.",_elements:{uuid:{_type:r.Type.UUID,_description:"Answer concept UUID"},label:{_type:r.Type.String,_default:"",_description:"The custom label for the answer concept."}}}}},fieldConfigurations:{causeOfDeath:{conceptUuid:{_type:r.Type.ConceptUuid,_default:"9272a14b-7260-4353-9e5b-5787b5dead9d",_description:"The concept UUID to get cause of death answers"},required:{_type:r.Type.Boolean,_default:!1}},name:{displayMiddleName:{_type:r.Type.Boolean,_default:!0},allowUnidentifiedPatients:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow registering unidentified patients."},defaultUnknownGivenName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."},displayCapturePhoto:{_type:r.Type.Boolean,_default:!0,_description:"Whether to display capture patient photo slot on name field"},displayReverseFieldOrder:{_type:r.Type.Boolean,_default:!1,_description:"Whether to display the name fields in the order 'Family name' -> 'Middle name' -> 'First name'"}},gender:{_type:r.Type.Array,_default:[{value:"male"},{value:"female"},{value:"other"},{value:"unknown"}],_description:"The options for sex selection during patient registration. This is Administrative Gender as it is called by FHIR (Possible options are limited to those defined in FHIR Administrative Gender, see https://hl7.org/fhir/R4/valueset-administrative-gender.html).",_elements:{value:{_type:r.Type.String,_description:"Value that will be sent to the server. Limited to FHIR-supported values for Administrative Gender",_validators:[r.validators.oneOf(["male","female","other","unknown"])]},label:{_type:r.Type.String,_default:"",_description:'The label displayed for the sex option, if it should be different from the value (the value will be translated; the English "translation" is upper-case).'}}},address:{useAddressHierarchy:{enabled:{_type:r.Type.Boolean,_default:!0,_description:"Whether to use the Address hierarchy in the registration form or not"},useQuickSearch:{_type:r.Type.Boolean,_default:!0,_description:"Whether to use the quick searching through the address saved in the database pre-fill the form."},searchAddressByLevel:{_type:r.Type.Boolean,_default:!1,_description:"Whether to fill the addresses by levels, i.e. County => subCounty, the current field is dependent on it's previous field."}}},dateOfBirth:{allowEstimatedDateOfBirth:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow estimated date of birth for a patient during registration"},useEstimatedDateOfBirth:{enabled:{_type:r.Type.Boolean,_default:!1,_description:"Whether to use a fixed day and month for estimated date of birth"},dayOfMonth:{_type:r.Type.Number,_default:0,_description:"The custom day of the month use on the estimated date of birth (0 = last day of previous month, 1-31 = specific day)",_validators:[r.validators.inRange(0,31)]},month:{_type:r.Type.Number,_default:0,_description:"The custom month to use on the estimated date of birth i.e 0 = Jan & 11 = Dec",_validators:[r.validators.inRange(0,11)]}}},phone:{personAttributeUuid:{_type:r.Type.UUID,_default:"14d4f066-15f5-102d-96e4-000c29c2a5d7",_description:"The UUID of the phone number person attribute type"},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:"",_description:"Optional RegEx for testing the validity of the input."}}}},links:{submitButton:{_type:r.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]}},defaultPatientIdentifierTypes:{_type:r.Type.Array,_default:[],_elements:{_type:r.Type.PatientIdentifierTypeUuid}},registrationObs:{encounterTypeUuid:{_type:r.Type.UUID,_default:"",_description:"Obs created during registration will be associated with an encounter of this type. This must be set in order to use fields of type `obs`."},encounterProviderRoleUuid:{_type:r.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:r.Type.UUID,_default:"",_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},freeTextFieldConceptUuid:{_type:r.Type.ConceptUuid,_default:"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},_validators:[(0,r.validator)(function(e){return!e.fieldDefinitions.some(function(e){return"obs"==e.type})||null!=e.registrationObs.encounterTypeUuid},"If fieldDefinitions contains any fields of type 'obs', `registrationObs.encounterTypeUuid` must be specified."),(0,r.validator)(function(e){return e.sections.every(function(t){return o(a).concat(o(e.sectionDefinitions)).map(function(e){return e.id}).includes(t)})},function(e){var t=o(a).concat(o(e.sectionDefinitions)).map(function(e){return e.id}),n=e.sections.find(function(e){return!t.includes(e)});return"'".concat(n,"' is not a valid section ID. Valid section IDs include the built-in sections ").concat(c(a))+(e.sectionDefinitions.length?"; and the defined sections ".concat(c(e.sectionDefinitions),"."):".")}),(0,r.validator)(function(e){return e.sectionDefinitions.every(function(t){return t.fields.every(function(t){return o(u).concat(o(e.fieldDefinitions.map(function(e){return e.id}))).includes(t)})})},function(e){var t=o(u).concat(o(e.fieldDefinitions.map(function(e){return e.id}))),n=e.sectionDefinitions.find(function(e){return e.fields.some(function(e){return!t.includes(e)})}),r=n.fields.find(function(e){return!t.includes(e)});return"The section definition '".concat(n.id,"' contains an invalid field '").concat(r,"'. 'fields' can only contain the built-in fields '").concat(u.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(c(e.fieldDefinitions),"."):".")})]};function c(e){return"'".concat(e.map(function(e){return e.id}).join("', '"),"'")}},97e3:(e,t,n)=>{"use strict";n.d(t,{A:()=>y,u:()=>m});var r=n(83437),i=n(57691),o=n(49971);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){u(o,r,i,a,s,"next",e)}function s(e){u(o,r,i,a,s,"throw",e)}a(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){f(e,t,n[t])})}return e}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}var y=function(){function e(){c(this,e)}var t,n;return t=e,n=[{key:"saveRelationships",value:function(e,t){return s(function(){return h(this,function(n){return[2,Promise.all(e.filter(function(e){return e.relationshipType}).filter(function(e){return!!e.action}).map(function(e){var n=e.relatedPersonUuid,r=e.relationshipType,i=e.uuid,a=e.action,u=p(r.split("/"),2),s=u[0],c=u[1],l=t.data.uuid,f="aIsToB"===c,d={personA:f?n:l,personB:f?l:n,relationshipType:s};switch(a){case"ADD":return(0,o.SP)(d);case"UPDATE":return(0,o.G1)(i,d);case"DELETE":return(0,o.SE)(i)}}))]})})()}},{key:"saveObservations",value:function(e,t,n,r,i){return s(function(){var a;return h(this,function(u){if(e&&Object.keys(e).length>0){if(i.registrationObs.encounterTypeUuid)return a={encounterDatetime:new Date,patient:t.data.uuid,encounterType:i.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:r.currentProvider.uuid,encounterRole:i.registrationObs.encounterProviderRoleUuid}],form:i.registrationObs.registrationFormUuid,obs:Object.entries(e).filter(function(e){return""!==p(e,2)[1]}).map(function(e){var t=p(e,2);return{concept:t[0],value:t[1]}})},[2,(0,o.t2)(a)];console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved.")}return[2]})})()}},{key:"savePatientIdentifiers",value:function(e,t,n,r,i){return s(function(){var a;return h(this,function(u){return a=Object.values(n).filter(function(e){var t=e.identifierValue,n=e.autoGeneration,r=e.selectedSource;return t||n&&r}).map(function(n){return s(function(){var r,a,u,s,c,l,f,d,p,y,m,b;return h(this,function(h){switch(h.label){case 0:return a=n.identifierTypeUuid,u=n.identifierValue,s=n.identifierUuid,c=n.selectedSource,l=n.preferred,f=n.autoGeneration,d=n.initialValue,p=f&&(null==c||null===(r=c.autoGenerationOption)||void 0===r?void 0:r.manualEntryEnabled)&&!!u,f&&!p?[3,1]:(m=u,[3,4]);case 1:return[4,(0,o.zx)(c.uuid)];case 2:return[4,h.sent().data.identifier];case 3:m=h.sent(),h.label=4;case 4:return b={uuid:s,identifier:y=m,identifierType:a,location:i,preferred:l},e?[3,8]:d?[3,6]:[4,(0,o.A4)(t,b)];case 5:return h.sent(),[3,8];case 6:return d===y?[3,8]:[4,(0,o.Yu)(t,s,b.identifier)];case 7:h.sent(),h.label=8;case 8:return[2,b]}})})()}),t&&Object.keys(r).filter(function(e){return!n[e]}).forEach(function(e){return s(function(){return h(this,function(n){switch(n.label){case 0:return[4,(0,o.SQ)(t,r[e].identifierUuid)];case 1:return n.sent(),[2]}})})()}),[2,Promise.all(a)]})})()}},{key:"getDeletedNames",value:function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]}},{key:"getPatientToCreate",value:function(t,n,r,i,o,a){var u,s,c;return s=n.birthdate,u=(null!=(c=Date)&&"undefined"!=typeof Symbol&&c[Symbol.hasInstance]?c[Symbol.hasInstance](s):s instanceof c)?[n.birthdate.getFullYear(),n.birthdate.getMonth()+1,n.birthdate.getDate()].join("-"):n.birthdate,{uuid:n.patientUuid,person:d({uuid:n.patientUuid,names:e.getNames(n,r),gender:n.gender.charAt(0).toUpperCase(),birthdate:u,birthdateEstimated:n.birthdateEstimated,attributes:e.getPatientAttributes(t,n,r),addresses:[n.address]},e.getPatientDeathInfo(n,a)),identifiers:o}}},{key:"getNames",value:function(e,t){var n=[{uuid:t.preferredNameUuid,preferred:!0,givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}];return e.addNameInLocalLanguage&&n.push({uuid:t.additionalNameUuid,preferred:!1,givenName:e.additionalGivenName,middleName:e.additionalMiddleName,familyName:e.additionalFamilyName}),n}},{key:"getPatientAttributes",value:function(e,t,n){var i=[];return t.attributes&&(Object.entries(t.attributes).filter(function(e){return!!p(e,2)[1]}).forEach(function(e){var t=p(e,2),n=t[0],r=t[1];i.push({attributeType:n,value:r})}),!e&&t.patientUuid&&Object.entries(t.attributes).filter(function(e){return!p(e,2)[1]}).forEach(function(e){var i=p(e,1)[0];return s(function(){var e;return h(this,function(o){switch(o.label){case 0:return e=n["attribute.".concat(i)],[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person/").concat(t.patientUuid,"/attribute/").concat(e),{method:"DELETE"}).catch(function(e){console.error(e)})];case 1:return o.sent(),[2]}})})()})),i}},{key:"getPatientDeathInfo",value:function(e,t){var n=e.isDead,i=e.deathDate,a=e.deathTime,u=e.deathTimeFormat,s=e.deathCause,c=e.nonCodedCauseOfDeath;return n?d({dead:!0,deathDate:(0,r.toOmrsIsoString)((0,o.oq)(i,a,u))},s===(null==t?void 0:t.freeTextFieldConceptUuid)?{causeOfDeathNonCoded:c,causeOfDeath:null}:{causeOfDeath:s,causeOfDeathNonCoded:null}):{dead:!1}}},{key:"mapPatientToFhirPatient",value:function(e){var t,n,r,i,o,a;return{id:e.uuid,gender:null===(t=e.person)||void 0===t?void 0:t.gender,birthDate:null===(n=e.person)||void 0===n?void 0:n.birthdate,deceasedBoolean:e.person.dead,deceasedDateTime:e.person.deathDate,name:null===(i=e.person)||void 0===i||null===(r=i.names)||void 0===r?void 0:r.map(function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}}),address:null===(o=e.person)||void 0===o?void 0:o.addresses.map(function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}}),telecom:null===(a=e.person.attributes)||void 0===a?void 0:a.filter(function(e){return"Telephone Number"===e.attributeType})}}}],null&&l(t.prototype,null),n&&l(t,n),e}();f(y,"savePatientFormOffline",function(e,t,n,o,a,u,c,l,f){return s(function(){var s;return h(this,function(d){switch(d.label){case 0:return s={fhirPatient:y.mapPatientToFhirPatient(y.getPatientToCreate(e,t,n,o,[],f)),_patientRegistrationData:{isNewPatient:e,formValues:t,patientUuidMap:n,initialAddressFieldValues:o,capturePhotoProps:a,currentLocation:u,initialIdentifierValues:c,currentUser:l,config:f,savePatientTransactionManager:new m}},[4,(0,r.queueSynchronizationItem)(i.dR,s,{id:t.patientUuid,displayName:"Patient registration",patientUuid:s.fhirPatient.id,dependencies:[]})];case 1:return d.sent(),[2,null]}})})()}),f(y,"savePatientFormOnline",function(e,t,n,i,a,u,c,l,f,d,p){return s(function(){var p,m,b,v;return h(this,function(g){switch(g.label){case 0:return[4,y.savePatientIdentifiers(e,t.patientUuid,t.identifiers,c,u)];case 1:return p=g.sent(),m=y.getPatientToCreate(e,t,n,i,p,f),y.getDeletedNames(t.patientUuid,n).forEach(function(e){return s(function(){return h(this,function(t){switch(t.label){case 0:return[4,(0,o.o9)(e.nameUuid,e.personUuid)];case 1:return t.sent(),[2]}})})()}),[4,(0,o.Z)(m,e&&!d.patientSaved?void 0:t.patientUuid)];case 2:return(b=g.sent()).ok?(d.patientSaved=!0,[4,y.saveRelationships(t.relationships,b)]):[3,7];case 3:return g.sent(),[4,y.saveObservations(t.obs,b,u,l,f)];case 4:return g.sent(),[4,(0,r.getConfig)("@openmrs/esm-styleguide")];case 5:return(v=g.sent().patientPhotoConceptUuid)&&(null==a?void 0:a.imageData)?[4,(0,o.hz)(b.data.uuid,a.imageData,"".concat(r.restBaseUrl,"/obs"),a.dateTime||(new Date).toISOString(),v)]:[3,7];case 6:g.sent(),g.label=7;case 7:return[2,b.data.uuid]}})})()});var m=function e(){c(this,e),f(this,"patientSaved",!1)}}}]);
2
+ (globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[320,3474],{5921:(e,t,n)=>{"use strict";n.d(t,{A:()=>g});var r=n(39791),i=n(57812);var o=n(97942);const a=function(e){return e==e&&!(0,o.A)(e)};var u=n(7817);const s=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}},c=function(e){var t=function(e){for(var t=(0,u.A)(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,a(i)]}return t}(e);return 1==t.length&&t[0][2]?s(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,o){var a=n.length,u=a,s=!o;if(null==e)return!u;for(e=Object(e);a--;){var c=n[a];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<u;){var l=(c=n[a])[0],f=e[l],d=c[1];if(s&&c[2]){if(void 0===f&&!(l in e))return!1}else{var p=new r.A;if(o)var h=o(f,d,l,e,t,p);if(!(void 0===h?(0,i.A)(d,f,3,o,p):h))return!1}}return!0}(n,e,t)}};var l=n(55841);const f=function(e,t){return null!=e&&t in Object(e)};var d=n(23017);var p=n(1677),h=n(9322);const y=function(e,t){return(0,p.A)(e)&&a(t)?s((0,h.A)(e),t):function(n){var r=function(e,t,n){var r=null==e?void 0:(0,l.A)(e,t);return void 0===r?n:r}(n,e);return void 0===r&&r===t?function(e,t){return null!=e&&(0,d.A)(e,t,f)}(n,e):(0,i.A)(t,r,3)}};var m=n(14151),b=n(96956);const v=function(e){return(0,p.A)(e)?(t=(0,h.A)(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return(0,l.A)(t,e)}}(e);var t},g=function(e){return"function"==typeof e?e:null==e?m.A:"object"==typeof e?(0,b.A)(e)?y(e[0],e[1]):c(e):v(e)}},16666:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(60587),i=n(8007);var o=n(26207),a=n(74239);const u=function(e){e=(0,r.A)(e);var t,n,u,s,c=(0,o.A)(e)?(0,a.A)(e):void 0,l=c?c[0]:e.charAt(0),f=c?(t=c,n=1,s=t.length,u=void 0===u?s:u,!n&&u>=s?t:(0,i.A)(t,n,u)).join(""):e.slice(1);return l.toUpperCase()+f},s=(0,n(62617).A)(function(e,t,n){return t=t.toLowerCase(),e+(n?(i=t,u((0,r.A)(i).toLowerCase())):t);var i})},18361:(e,t,n)=>{"use strict";n.d(t,{pX:()=>C,qm:()=>E,zL:()=>x,GC:()=>P,Qi:()=>I});var r=n(5921),i=n(31475),o=n(7817);var a=/\s/;var u=/^\s+/;const s=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&a.test(e.charAt(t)););return t}(e)+1).replace(u,""):e};var c=n(97942),l=n(84089),f=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,p=/^0o[0-7]+$/i,h=parseInt;var y=1/0;const m=function(e){return e?(e=function(e){if("number"==typeof e)return e;if((0,l.A)(e))return NaN;if((0,c.A)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,c.A)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=s(e);var n=d.test(e);return n||p.test(e)?h(e.slice(2),n?2:8):f.test(e)?NaN:+e}(e))===y||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var b=Math.max;const v=(g=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o,a,u=null==n?0:(o=m(n),a=o%1,o==o?a?o-a:o:0);return u<0&&(u=b(i+u,0)),function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}(e,(0,r.A)(t,3),u)},function(e,t,n){var a=Object(e);if(!(0,i.A)(e)){var u=(0,r.A)(t,3);e=(0,o.A)(e),t=function(e){return u(a[e],e,a)}}var s=g(e,t,n);return s>-1?a[u?e[s]:s]:void 0});var g,A=n(37127),_=n(16666),w=n(54440),T=n(57691);function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function U(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function O(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){U(o,r,i,a,u,"next",e)}function u(e){U(o,r,i,a,u,"throw",e)}a(void 0)})}}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function P(){return O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/session"))];case 1:return[2,e.sent().data]}})})()}function C(){return O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/addresstemplate"))];case 1:return[2,e.sent().data]}})})()}function x(){return O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/relationshiptype?v=default"))];case 1:return[2,e.sent().data]}})})()}function E(){return O(function(){var e,t;return j(this,function(n){switch(n.label){case 0:return[4,(0,w.getConfig)(T.AO)];case 1:return(e=n.sent()).fieldDefinitions?(t=e.fieldDefinitions.map(function(e){return t=e,O(function(){var e;return j(this,function(n){switch(n.label){case 0:return e="","person attribute"===t.type&&(e="".concat(w.restBaseUrl,"/personattributetype/").concat(t.uuid)),t.answerConceptSetUuid?[4,B("".concat(w.restBaseUrl,"/concept/").concat(t.answerConceptSetUuid))]:[3,2];case 1:n.sent(),n.label=2;case 2:return[4,B(e)];case 3:return[2,n.sent().data]}})})();var t}),[4,Promise.all(t)]):[2];case 2:return[2,n.sent().reduce(function(e,t){return t&&e.push(t),e},[])]}})})()}function I(){return O(function(){var e,t,n,r,i,o,a,u;return j(this,function(s){switch(s.label){case 0:return e=function(e){n[e].identifierSources=a.filter(function(t){return t.identifierType.uuid===n[e].uuid}).map(function(e){var t=v(i.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e})},[4,O(function(){var e,t,n,r,i,o,a,u,s,c;return j(this,function(l){switch(l.label){case 0:return[4,Promise.all([B("".concat(w.restBaseUrl,"/patientidentifiertype?v=custom:(display,uuid,name,format,formatDescription,required,uniquenessBehavior)")),B("".concat(w.restBaseUrl,"/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType"))])];case 1:return e=D.apply(void 0,[l.sent(),2]),t=e[0],n=e[1],t.ok?(u=null==t||null===(r=t.data)||void 0===r?void 0:r.results,s=null==n||null===(a=n.data)||void 0===a||null===(o=a.results)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.metadataUuid,c=(null==n?void 0:n.ok)?[k(null==u?void 0:u.find(function(e){return e.uuid===s}),!0)]:[],u.forEach(function(e){e.uuid!==s&&c.push(k(e,!1))}),[2,c]):[2,[]]}})})()];case 1:return t=s.sent(),n=t.filter(Boolean),[4,Promise.all([O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/idgen/autogenerationoption?v=full"))];case 1:return[2,e.sent()]}})})(),O(function(){return j(this,function(e){switch(e.label){case 0:return[4,B("".concat(w.restBaseUrl,"/idgen/identifiersource?v=default"))];case 1:return[2,e.sent()]}})})()])];case 2:for(r=D.apply(void 0,[s.sent(),2]),i=r[0],o=r[1],a=o.data.results,u=0;u<(null==n?void 0:n.length);u++)e(u);return[2,n]}})})()}function B(e){return O(function(){var t;return j(this,function(n){switch(n.label){case 0:return t=new AbortController,[4,(0,w.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,A.A)(e)})];case 1:return n.sent(),[4,(0,w.openmrsFetch)(e,{headers:T.v4,signal:null==t?void 0:t.signal})];case 2:return[2,n.sent()]}})})()}function k(e,t){return{name:e.display,fieldName:(0,_.A)(e.name),required:e.required,uuid:e.uuid,format:e.format,formatDescription:e.formatDescription,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},23017:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(50196),i=n(61697),o=n(96956),a=n(85378),u=n(47893),s=n(9322);const c=function(e,t,n){for(var c=-1,l=(t=(0,r.A)(t,e)).length,f=!1;++c<l;){var d=(0,s.A)(t[c]);if(!(f=null!=e&&n(e,d)))break;e=e[d]}return f||++c!=l?f:!!(l=null==e?0:e.length)&&(0,u.A)(l)&&(0,a.A)(d,l)&&((0,o.A)(e)||(0,i.A)(e))}},26207:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const i=function(e){return r.test(e)}},36207:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(30977),i=n.n(r),o=n(95924),a=n.n(o)()(i());a.push([e.id,".-esm-patient-registration__add-patient-link__slotStyles___ejEWZ{background-color:rgba(0,0,0,0)}","",{version:3,sources:["webpack://./src/add-patient-link.scss"],names:[],mappings:"AAAA,iEACE,8BAAA",sourcesContent:[".slotStyles {\n background-color: transparent;\n}\n"],sourceRoot:""}]),a.locals={slotStyles:"-esm-patient-registration__add-patient-link__slotStyles___ejEWZ"};const u=a},49971:(e,t,n)=>{"use strict";n.d(t,{A4:()=>_,G1:()=>b,SE:()=>v,SP:()=>m,SQ:()=>T,Yu:()=>w,Z:()=>d,hz:()=>g,o9:()=>y,oq:()=>S,t2:()=>p,uH:()=>A,zx:()=>h});var r=n(54440),i=n(46372),o=n.n(i);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){u(o,r,i,a,s,"next",e)}function s(e){u(o,r,i,a,s,"throw",e)}a(void 0)})}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function f(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function d(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(t||""),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:n.signal})}function p(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/encounter"),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function h(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/idgen/identifiersource/").concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function y(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person/").concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function m(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship"),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function b(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship/").concat(e),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:t.relationshipType},signal:n.signal})}function v(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship/").concat(e),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:t.signal})}function g(e,t,n,i,o){return s(function(){var a,u;return f(this,function(s){return a=new AbortController,(u=new FormData).append("patient",e),u.append("file",function(e){for(var t=window.atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);var o=new Blob([r],{type:n});return new File([o],"patient-photo.png")}(t)),u.append("json",JSON.stringify({person:e,concept:o,groupMembers:[],obsDatetime:i})),[2,(0,r.openmrsFetch)(n,{method:"POST",signal:a.signal,body:u})]})})()}function A(e,t){return s(function(){var n,i,o,u;return f(this,function(s){switch(s.label){case 0:return[4,Promise.all([(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient?q=").concat(e),{signal:t.signal}),(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person?q=").concat(e),{signal:t.signal})])];case 1:return n=c.apply(void 0,[s.sent(),2]),i=n[0],o=n[1],f=i.data.results,u=function(e){if(Array.isArray(e))return a(e)}(f)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(f)||l(f)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o.data.results.forEach(function(e){u.some(function(t){return t.uuid===e.uuid})||u.push(e)}),[2,u]}var f})})()}function _(e,t){return s(function(){var n;return f(this,function(i){return n=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:t})]})})()}function w(e,t,n){return s(function(){var i;return f(this,function(o){return i=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:{identifier:n}})]})})()}function T(e,t){return s(function(){var n;return f(this,function(i){return n=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/").concat(t,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:n.signal})]})})()}function S(e,t,n){var r=new Date(e),i=c(t.split(":").map(Number),2),a=i[0],u=i[1],s="PM"===n?a%12+12:a%12;return o()(r).hour(s).minute(u).second(0).millisecond(0).toDate()}},57691:(e,t,n)=>{"use strict";n.d(t,{AO:()=>s,DA:()=>u,dR:()=>c,v4:()=>l});var r,i,o,a=n(54440),u="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",s="@openmrs/esm-patient-registration-app",c="patient-registration",l=(r={},o="network-first",(i=a.omrsOfflineCachingStrategyHttpHeaderName)in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r)},62617:(e,t,n)=>{"use strict";n.d(t,{A:()=>B});const r=(i={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},function(e){return null==i?void 0:i[e]});var i,o=n(60587),a=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var s=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var c=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var l="\\ud800-\\udfff",f="\\u2700-\\u27bf",d="a-z\\xdf-\\xf6\\xf8-\\xff",p="A-Z\\xc0-\\xd6\\xd8-\\xde",h="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",y="["+h+"]",m="\\d+",b="["+f+"]",v="["+d+"]",g="[^"+l+h+m+f+d+p+"]",A="(?:\\ud83c[\\udde6-\\uddff]){2}",_="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+p+"]",T="(?:"+v+"|"+g+")",S="(?:"+w+"|"+g+")",U="(?:['’](?:d|ll|m|re|s|t|ve))?",O="(?:['’](?:D|LL|M|RE|S|T|VE))?",D="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",j="[\\ufe0e\\ufe0f]?",P=j+D+"(?:\\u200d(?:"+["[^"+l+"]",A,_].join("|")+")"+j+D+")*",C="(?:"+[b,A,_].join("|")+")"+P,x=RegExp([w+"?"+v+"+"+U+"(?="+[y,w,"$"].join("|")+")",S+"+"+O+"(?="+[y,w+T,"$"].join("|")+")",w+"?"+T+"+"+U,w+"+"+O,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",m,C].join("|"),"g");const E=function(e,t,n){return e=(0,o.A)(e),void 0===(t=n?void 0:t)?function(e){return c.test(e)}(e)?function(e){return e.match(x)||[]}(e):function(e){return e.match(s)||[]}(e):e.match(t)||[]};var I=RegExp("['’]","g");const B=function(e){return function(t){return function(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}(E(function(e){return(e=(0,o.A)(e))&&e.replace(a,r).replace(u,"")}(t).replace(I,"")),e,"")}}},74239:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(26207),i="\\ud800-\\udfff",o="["+i+"]",a="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",u="\\ud83c[\\udffb-\\udfff]",s="[^"+i+"]",c="(?:\\ud83c[\\udde6-\\uddff]){2}",l="[\\ud800-\\udbff][\\udc00-\\udfff]",f="(?:"+a+"|"+u+")?",d="[\\ufe0e\\ufe0f]?",p=d+f+"(?:\\u200d(?:"+[s,c,l].join("|")+")"+d+f+")*",h="(?:"+[s+a+"?",a,c,l,o].join("|")+")",y=RegExp(u+"(?="+u+")|"+h+p,"g");const m=function(e){return(0,r.A)(e)?function(e){return e.match(y)||[]}(e):function(e){return e.split("")}(e)}},84767:(e,t,n)=>{var r={"./am.json":[81197,1197],"./ar.json":[14132,4132],"./ar_SY.json":[37617,7617],"./bn.json":[77159,7159],"./de.json":[34944,4944],"./en.json":[34300,4300],"./en_US.json":[59569,9569],"./es.json":[93099,3099],"./es_MX.json":[88349,8349],"./fr.json":[94055,4055],"./he.json":[84652,4652],"./hi.json":[36840,6840],"./hi_IN.json":[55442,5442],"./id.json":[72690,2690],"./it.json":[9538,9538],"./ka.json":[70795,795],"./km.json":[54335,4335],"./ku.json":[9895,9895],"./ky.json":[88163,8163],"./lg.json":[64618,4618],"./ne.json":[12146,2146],"./pl.json":[41119,1119],"./pt.json":[96679,6679],"./pt_BR.json":[36468,6468],"./qu.json":[35173,5173],"./ro_RO.json":[46022,6022],"./ru_RU.json":[60986,986],"./si.json":[56859,6859],"./sw.json":[89913,9913],"./sw_KE.json":[88618,8618],"./tr.json":[55241,5241],"./tr_TR.json":[99900,9900],"./uk.json":[60723,723],"./uz.json":[43584,3584],"./uz@Latn.json":[27097,7097],"./uz_UZ.json":[70890,890],"./vi.json":[79214,9214],"./zh.json":[35661,5661],"./zh_CN.json":[99879,9879]};function i(e){if(!n.o(r,e))return Promise.resolve().then(()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=r[e],i=t[0];return n.e(t[1]).then(()=>n(i))}i.keys=()=>Object.keys(r),i.id=84767,e.exports=i},87821:(e,t,n)=>{"use strict";n.r(t),n.d(t,{addPatientLink:()=>F,cancelPatientEditModal:()=>$,deleteIdentifierConfirmationModal:()=>z,editPatient:()=>R,editPatientDetailsButton:()=>M,importTranslation:()=>I,patientPhotoExtension:()=>L,root:()=>N,startupApp:()=>k});var r=n(54440),i=n(95008),o=n(57691),a=n(18361),u=n(97e3);function s(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,u,"next",e)}function u(e){s(o,r,i,a,u,"throw",e)}a(void 0)})}}function l(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function f(e){return["".concat(r.fhirBaseUrl,"/Patient/").concat(e),"".concat(r.restBaseUrl,"/relationship?v=").concat(o.DA,"&person=").concat(e),"".concat(r.restBaseUrl,"/person/").concat(e,"/attribute"),"".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map(function(e){return window.origin+(0,r.makeUrl)(e)})}function d(e,t){return c(function(){return l(this,function(n){switch(n.label){case 0:return[4,u.A.savePatientFormOnline(e._patientRegistrationData.isNewPatient,e._patientRegistrationData.formValues,e._patientRegistrationData.patientUuidMap,e._patientRegistrationData.initialAddressFieldValues,e._patientRegistrationData.capturePhotoProps,e._patientRegistrationData.currentLocation,e._patientRegistrationData.initialIdentifierValues,e._patientRegistrationData.currentUser,e._patientRegistrationData.config,e._patientRegistrationData.savePatientTransactionManager,t.abort)];case 1:return n.sent(),[2]}})})()}var p=n(1343),h=n.n(p),y=n(93150),m=n(25626),b=n(85951),v=n(72591),g=n.n(v),A=n(1740),_=n.n(A),w=n(88128),T=n.n(w),S=n(30855),U=n.n(S),O=n(93051),D=n.n(O),j=n(73656),P=n.n(j),C=n(36207),x={};x.styleTagTransform=P(),x.setAttributes=U(),x.insert=T().bind(null,"head"),x.domAPI=_(),x.insertStyleElement=D(),g()(C.A,x);const E=C.A&&C.A.locals?C.A.locals:void 0;var I=n(84767),B={featureName:"Patient Registration",moduleName:o.AO};function k(){(0,r.defineConfigSchema)(o.AO,i.hV),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.dR),title:function(){return Promise.resolve(window.i18next.t("patientRegistrationBreadcrumb",{defaultValue:"Patient Registration",ns:o.AO}))},parent:"".concat(window.spaBase,"/home")},{path:"".concat(window.spaBase,"/patient/:patientUuid/edit"),title:function(){return Promise.resolve(window.i18next.t("editPatientDetailsBreadcrumb",{defaultValue:"Edit patient details",ns:o.AO}))},parent:"".concat(window.spaBase,"/patient/:patientUuid/chart")}]),(0,r.setupOfflineSync)(o.dR,[],d,{onBeginEditSyncItem:function(e){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),c(function(){return l(this,function(e){switch(e.label){case 0:return[4,Promise.all([(0,a.GC)(),(0,a.pX)(),(0,a.zL)(),(0,a.qm)(),(0,a.Qi)()])];case 1:return e.sent(),[2]}})})(),(0,r.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return c(function(){var t,n;return l(this,function(r){switch(r.label){case 0:return t=f(e),[4,caches.open("omrs-spa-cache-v1")];case 1:return[4,r.sent().keys()];case 2:return n=r.sent().map(function(e){return e.url}),[2,t.every(function(e){return n.includes(e)})]}})})()},sync:function(e){return c(function(){var t;return l(this,function(n){switch(n.label){case 0:return t=f(e),[4,Promise.allSettled(t.map(function(e){return c(function(){return l(this,function(t){switch(t.label){case 0:return[4,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:e})];case 1:return t.sent(),[4,fetch(e)];case 2:return t.sent(),[2]}})})()}))];case 1:return n.sent(),[2]}})})()}})}var N=(0,r.getAsyncLifecycle)(function(){return Promise.all([n.e(8727),n.e(6724),n.e(5434),n.e(2086),n.e(627)]).then(n.bind(n,30627))},B),R=(0,r.getAsyncLifecycle)(function(){return Promise.all([n.e(8727),n.e(6724),n.e(5434),n.e(2086),n.e(627)]).then(n.bind(n,30627))},B),F=(0,r.getSyncLifecycle)(function(){var e=(0,y.useTranslation)().t,t=h().useCallback(function(){return(0,r.navigate)({to:"${openmrsSpaBase}/patient-registration"})},[]);return h().createElement(m.V8d,{"aria-label":e("addPatient","Add patient"),"aria-labelledby":e("addPatient","Add patient"),enterDelayMs:500,name:"AddPatientIcon",onClick:t,className:E.slotStyles},h().createElement(b.rs,{size:20}))},B),$=(0,r.getAsyncLifecycle)(function(){return n.e(8434).then(n.bind(n,58434))},B),L=(0,r.getAsyncLifecycle)(function(){return n.e(4463).then(n.bind(n,94463))},B),M=(0,r.getAsyncLifecycle)(function(){return n.e(3093).then(n.bind(n,43093))},B),z=(0,r.getAsyncLifecycle)(function(){return n.e(6276).then(n.bind(n,56276))},B)},90320:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,f=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.suspense_list"):60120,y=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,g=n?Symbol.for("react.responder"):60118,A=n?Symbol.for("react.scope"):60119;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case l:case f:case o:case u:case a:case p:return e;default:switch(e=e&&e.$$typeof){case c:case d:case m:case y:case s:return e;default:return t}}case i:return t}}}function w(e){return _(e)===f}t.AsyncMode=l,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=s,t.Element=r,t.ForwardRef=d,t.Fragment=o,t.Lazy=m,t.Memo=y,t.Portal=i,t.Profiler=u,t.StrictMode=a,t.Suspense=p,t.isAsyncMode=function(e){return w(e)||_(e)===l},t.isConcurrentMode=w,t.isContextConsumer=function(e){return _(e)===c},t.isContextProvider=function(e){return _(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return _(e)===d},t.isFragment=function(e){return _(e)===o},t.isLazy=function(e){return _(e)===m},t.isMemo=function(e){return _(e)===y},t.isPortal=function(e){return _(e)===i},t.isProfiler=function(e){return _(e)===u},t.isStrictMode=function(e){return _(e)===a},t.isSuspense=function(e){return _(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===f||e===u||e===a||e===p||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===y||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===v||e.$$typeof===g||e.$$typeof===A||e.$$typeof===b)},t.typeOf=_},95008:(e,t,n)=>{"use strict";n.d(t,{hV:()=>s,t_:()=>u,yk:()=>a});var r=n(54440);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var a=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone"]},{id:"death",name:"Death Info",fields:["dateAndTimeOfDeath","causeOfDeath"]},{id:"relationships",name:"Relationships",fields:[]}],u=["name","gender","dob","id","address","phone","causeOfDeath","dateAndTimeOfDeath"],s={sections:{_type:r.Type.Array,_default:["demographics","contact","relationships"],_description:"An array of strings which are the keys from 'sectionDefinitions' or any of the following built-in sections: '".concat(a.map(function(e){return e.id}).join("', '"),"'."),_elements:{_type:r.Type.String}},sectionDefinitions:{_type:r.Type.Array,_default:[],_elements:{id:{_type:r.Type.String,_description:"How this section will be referred to in the `sections` configuration. To override a built-in section, use that section's id. The built in section ids are '".concat(a.map(function(e){return e.id}).join("', '"),"'.")},name:{_type:r.Type.String,_description:"The title to display at the top of the section."},fields:{_type:r.Type.Array,_default:[],_description:"The parts to include in the section. Can be any of the following built-in fields: ".concat(u.join(", "),". Can also be an id from an object in the `fieldDefinitions` array, which you can use to define custom fields."),_elements:{_type:r.Type.String}}}},fieldDefinitions:{_type:r.Type.Array,_default:[],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields.",_elements:{id:{_type:r.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:r.Type.String,_description:"How this field's data will be stored—a person attribute or an obs.",_validators:[r.validators.oneOf(["person attribute","obs"])]},uuid:{_type:r.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},showHeading:{_type:r.Type.Boolean,_default:!1,_description:"Whether to show a heading above the person attribute field."},label:{_type:r.Type.String,_default:"",_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:r.Type.String,_default:"",_description:"Placeholder that will appear in the input."},allowFutureDates:{_type:r.Type.Boolean,_default:!0,_description:"Indicates whether the date input field should allow the selection of future dates or not."},allowPastDates:{_type:r.Type.Boolean,_default:!0,_description:"Indicates whether the date input field should allow the selection of past dates or not."},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:"",_description:"Optional RegEx for testing the validity of the input."}},locationTag:{_type:r.Type.String,_default:"",_description:'Only for fields with "person attribute" type `org.openmrs.Location`. This filters the list of location options in the dropdown based on their location tag. By default, all locations are shown.'},answerConceptSetUuid:{_type:r.Type.ConceptUuid,_default:"",_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:r.Type.Array,_default:[],_description:"For coded questions only (obs or person attrbute). A list of custom concept answers. Overrides answers that come from the obs concept or from `answerSetConceptUuid`.",_elements:{uuid:{_type:r.Type.UUID,_description:"Answer concept UUID"},label:{_type:r.Type.String,_default:"",_description:"The custom label for the answer concept."}}}}},fieldConfigurations:{causeOfDeath:{conceptUuid:{_type:r.Type.ConceptUuid,_default:"9272a14b-7260-4353-9e5b-5787b5dead9d",_description:"The concept UUID to get cause of death answers"},required:{_type:r.Type.Boolean,_default:!1}},name:{displayMiddleName:{_type:r.Type.Boolean,_default:!0},allowUnidentifiedPatients:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow registering unidentified patients."},defaultUnknownGivenName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."},displayCapturePhoto:{_type:r.Type.Boolean,_default:!0,_description:"Whether to display capture patient photo slot on name field"},displayReverseFieldOrder:{_type:r.Type.Boolean,_default:!1,_description:"Whether to display the name fields in the order 'Family name' -> 'Middle name' -> 'First name'"}},gender:{_type:r.Type.Array,_default:[{value:"male"},{value:"female"},{value:"other"},{value:"unknown"}],_description:"The options for sex selection during patient registration. This is Administrative Gender as it is called by FHIR (Possible options are limited to those defined in FHIR Administrative Gender, see https://hl7.org/fhir/R4/valueset-administrative-gender.html).",_elements:{value:{_type:r.Type.String,_description:"Value that will be sent to the server. Limited to FHIR-supported values for Administrative Gender",_validators:[r.validators.oneOf(["male","female","other","unknown"])]},label:{_type:r.Type.String,_default:"",_description:'The label displayed for the sex option, if it should be different from the value (the value will be translated; the English "translation" is upper-case).'}}},address:{useAddressHierarchy:{enabled:{_type:r.Type.Boolean,_default:!0,_description:"Whether to use the Address hierarchy in the registration form or not"},useQuickSearch:{_type:r.Type.Boolean,_default:!0,_description:"Whether to use the quick searching through the address saved in the database pre-fill the form."},searchAddressByLevel:{_type:r.Type.Boolean,_default:!1,_description:"Whether to fill the addresses by levels, i.e. County => subCounty, the current field is dependent on it's previous field."}}},dateOfBirth:{allowEstimatedDateOfBirth:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow estimated date of birth for a patient during registration"},useEstimatedDateOfBirth:{enabled:{_type:r.Type.Boolean,_default:!1,_description:"Whether to use a fixed day and month for estimated date of birth"},dayOfMonth:{_type:r.Type.Number,_default:0,_description:"The custom day of the month use on the estimated date of birth (0 = last day of previous month, 1-31 = specific day)",_validators:[r.validators.inRange(0,31)]},month:{_type:r.Type.Number,_default:0,_description:"The custom month to use on the estimated date of birth i.e 0 = Jan & 11 = Dec",_validators:[r.validators.inRange(0,11)]}}},phone:{personAttributeUuid:{_type:r.Type.UUID,_default:"14d4f066-15f5-102d-96e4-000c29c2a5d7",_description:"The UUID of the phone number person attribute type"},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:"",_description:"Optional RegEx for testing the validity of the input."}}}},links:{submitButton:{_type:r.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]}},defaultPatientIdentifierTypes:{_type:r.Type.Array,_default:[],_elements:{_type:r.Type.PatientIdentifierTypeUuid}},registrationObs:{encounterTypeUuid:{_type:r.Type.UUID,_default:"",_description:"Obs created during registration will be associated with an encounter of this type. This must be set in order to use fields of type `obs`."},encounterProviderRoleUuid:{_type:r.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:r.Type.UUID,_default:"",_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},freeTextFieldConceptUuid:{_type:r.Type.ConceptUuid,_default:"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},_validators:[(0,r.validator)(function(e){return!e.fieldDefinitions.some(function(e){return"obs"==e.type})||null!=e.registrationObs.encounterTypeUuid},"If fieldDefinitions contains any fields of type 'obs', `registrationObs.encounterTypeUuid` must be specified."),(0,r.validator)(function(e){return e.sections.every(function(t){return o(a).concat(o(e.sectionDefinitions)).map(function(e){return e.id}).includes(t)})},function(e){var t=o(a).concat(o(e.sectionDefinitions)).map(function(e){return e.id}),n=e.sections.find(function(e){return!t.includes(e)});return"'".concat(n,"' is not a valid section ID. Valid section IDs include the built-in sections ").concat(c(a))+(e.sectionDefinitions.length?"; and the defined sections ".concat(c(e.sectionDefinitions),"."):".")}),(0,r.validator)(function(e){return e.sectionDefinitions.every(function(t){return t.fields.every(function(t){return o(u).concat(o(e.fieldDefinitions.map(function(e){return e.id}))).includes(t)})})},function(e){var t=o(u).concat(o(e.fieldDefinitions.map(function(e){return e.id}))),n=e.sectionDefinitions.find(function(e){return e.fields.some(function(e){return!t.includes(e)})}),r=n.fields.find(function(e){return!t.includes(e)});return"The section definition '".concat(n.id,"' contains an invalid field '").concat(r,"'. 'fields' can only contain the built-in fields '").concat(u.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(c(e.fieldDefinitions),"."):".")})]};function c(e){return"'".concat(e.map(function(e){return e.id}).join("', '"),"'")}},97e3:(e,t,n)=>{"use strict";n.d(t,{A:()=>y,u:()=>m});var r=n(54440),i=n(57691),o=n(49971);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){u(o,r,i,a,s,"next",e)}function s(e){u(o,r,i,a,s,"throw",e)}a(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){f(e,t,n[t])})}return e}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}var y=function(){function e(){c(this,e)}var t,n;return t=e,n=[{key:"saveRelationships",value:function(e,t){return s(function(){return h(this,function(n){return[2,Promise.all(e.filter(function(e){return e.relationshipType}).filter(function(e){return!!e.action}).map(function(e){var n=e.relatedPersonUuid,r=e.relationshipType,i=e.uuid,a=e.action,u=p(r.split("/"),2),s=u[0],c=u[1],l=t.data.uuid,f="aIsToB"===c,d={personA:f?n:l,personB:f?l:n,relationshipType:s};switch(a){case"ADD":return(0,o.SP)(d);case"UPDATE":return(0,o.G1)(i,d);case"DELETE":return(0,o.SE)(i)}}))]})})()}},{key:"saveObservations",value:function(e,t,n,r,i){return s(function(){var a;return h(this,function(u){if(e&&Object.keys(e).length>0){if(i.registrationObs.encounterTypeUuid)return a={encounterDatetime:new Date,patient:t.data.uuid,encounterType:i.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:r.currentProvider.uuid,encounterRole:i.registrationObs.encounterProviderRoleUuid}],form:i.registrationObs.registrationFormUuid,obs:Object.entries(e).filter(function(e){return""!==p(e,2)[1]}).map(function(e){var t=p(e,2);return{concept:t[0],value:t[1]}})},[2,(0,o.t2)(a)];console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved.")}return[2]})})()}},{key:"savePatientIdentifiers",value:function(e,t,n,r,i){return s(function(){var a;return h(this,function(u){return a=Object.values(n).filter(function(e){var t=e.identifierValue,n=e.autoGeneration,r=e.selectedSource;return t||n&&r}).map(function(n){return s(function(){var r,a,u,s,c,l,f,d,p,y,m,b;return h(this,function(h){switch(h.label){case 0:return a=n.identifierTypeUuid,u=n.identifierValue,s=n.identifierUuid,c=n.selectedSource,l=n.preferred,f=n.autoGeneration,d=n.initialValue,p=f&&(null==c||null===(r=c.autoGenerationOption)||void 0===r?void 0:r.manualEntryEnabled)&&!!u,f&&!p?[3,1]:(m=u,[3,4]);case 1:return[4,(0,o.zx)(c.uuid)];case 2:return[4,h.sent().data.identifier];case 3:m=h.sent(),h.label=4;case 4:return b={uuid:s,identifier:y=m,identifierType:a,location:i,preferred:l},e?[3,8]:d?[3,6]:[4,(0,o.A4)(t,b)];case 5:return h.sent(),[3,8];case 6:return d===y?[3,8]:[4,(0,o.Yu)(t,s,b.identifier)];case 7:h.sent(),h.label=8;case 8:return[2,b]}})})()}),t&&Object.keys(r).filter(function(e){return!n[e]}).forEach(function(e){return s(function(){return h(this,function(n){switch(n.label){case 0:return[4,(0,o.SQ)(t,r[e].identifierUuid)];case 1:return n.sent(),[2]}})})()}),[2,Promise.all(a)]})})()}},{key:"getDeletedNames",value:function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]}},{key:"getPatientToCreate",value:function(t,n,r,i,o,a){var u,s,c;return s=n.birthdate,u=(null!=(c=Date)&&"undefined"!=typeof Symbol&&c[Symbol.hasInstance]?c[Symbol.hasInstance](s):s instanceof c)?[n.birthdate.getFullYear(),n.birthdate.getMonth()+1,n.birthdate.getDate()].join("-"):n.birthdate,{uuid:n.patientUuid,person:d({uuid:n.patientUuid,names:e.getNames(n,r),gender:n.gender.charAt(0).toUpperCase(),birthdate:u,birthdateEstimated:n.birthdateEstimated,attributes:e.getPatientAttributes(t,n,r),addresses:[n.address]},e.getPatientDeathInfo(n,a)),identifiers:o}}},{key:"getNames",value:function(e,t){var n=[{uuid:t.preferredNameUuid,preferred:!0,givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}];return e.addNameInLocalLanguage&&n.push({uuid:t.additionalNameUuid,preferred:!1,givenName:e.additionalGivenName,middleName:e.additionalMiddleName,familyName:e.additionalFamilyName}),n}},{key:"getPatientAttributes",value:function(e,t,n){var i=[];return t.attributes&&(Object.entries(t.attributes).filter(function(e){return!!p(e,2)[1]}).forEach(function(e){var t=p(e,2),n=t[0],r=t[1];i.push({attributeType:n,value:r})}),!e&&t.patientUuid&&Object.entries(t.attributes).filter(function(e){return!p(e,2)[1]}).forEach(function(e){var i=p(e,1)[0];return s(function(){var e;return h(this,function(o){switch(o.label){case 0:return e=n["attribute.".concat(i)],[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person/").concat(t.patientUuid,"/attribute/").concat(e),{method:"DELETE"}).catch(function(e){console.error(e)})];case 1:return o.sent(),[2]}})})()})),i}},{key:"getPatientDeathInfo",value:function(e,t){var n=e.isDead,i=e.deathDate,a=e.deathTime,u=e.deathTimeFormat,s=e.deathCause,c=e.nonCodedCauseOfDeath;return n?d({dead:!0,deathDate:(0,r.toOmrsIsoString)((0,o.oq)(i,a,u))},s===(null==t?void 0:t.freeTextFieldConceptUuid)?{causeOfDeathNonCoded:c,causeOfDeath:null}:{causeOfDeath:s,causeOfDeathNonCoded:null}):{dead:!1}}},{key:"mapPatientToFhirPatient",value:function(e){var t,n,r,i,o,a;return{id:e.uuid,gender:null===(t=e.person)||void 0===t?void 0:t.gender,birthDate:null===(n=e.person)||void 0===n?void 0:n.birthdate,deceasedBoolean:e.person.dead,deceasedDateTime:e.person.deathDate,name:null===(i=e.person)||void 0===i||null===(r=i.names)||void 0===r?void 0:r.map(function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}}),address:null===(o=e.person)||void 0===o?void 0:o.addresses.map(function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}}),telecom:null===(a=e.person.attributes)||void 0===a?void 0:a.filter(function(e){return"Telephone Number"===e.attributeType})}}}],null&&l(t.prototype,null),n&&l(t,n),e}();f(y,"savePatientFormOffline",function(e,t,n,o,a,u,c,l,f){return s(function(){var s;return h(this,function(d){switch(d.label){case 0:return s={fhirPatient:y.mapPatientToFhirPatient(y.getPatientToCreate(e,t,n,o,[],f)),_patientRegistrationData:{isNewPatient:e,formValues:t,patientUuidMap:n,initialAddressFieldValues:o,capturePhotoProps:a,currentLocation:u,initialIdentifierValues:c,currentUser:l,config:f,savePatientTransactionManager:new m}},[4,(0,r.queueSynchronizationItem)(i.dR,s,{id:t.patientUuid,displayName:"Patient registration",patientUuid:s.fhirPatient.id,dependencies:[]})];case 1:return d.sent(),[2,null]}})})()}),f(y,"savePatientFormOnline",function(e,t,n,i,a,u,c,l,f,d,p){return s(function(){var p,m,b,v;return h(this,function(g){switch(g.label){case 0:return[4,y.savePatientIdentifiers(e,t.patientUuid,t.identifiers,c,u)];case 1:return p=g.sent(),m=y.getPatientToCreate(e,t,n,i,p,f),y.getDeletedNames(t.patientUuid,n).forEach(function(e){return s(function(){return h(this,function(t){switch(t.label){case 0:return[4,(0,o.o9)(e.nameUuid,e.personUuid)];case 1:return t.sent(),[2]}})})()}),[4,(0,o.Z)(m,e&&!d.patientSaved?void 0:t.patientUuid)];case 2:return(b=g.sent()).ok?(d.patientSaved=!0,[4,y.saveRelationships(t.relationships,b)]):[3,7];case 3:return g.sent(),[4,y.saveObservations(t.obs,b,u,l,f)];case 4:return g.sent(),[4,(0,r.getConfig)("@openmrs/esm-styleguide")];case 5:return(v=g.sent().patientPhotoConceptUuid)&&(null==a?void 0:a.imageData)?[4,(0,o.hz)(b.data.uuid,a.imageData,"".concat(r.restBaseUrl,"/obs"),a.dateTime||(new Date).toISOString(),v)]:[3,7];case 6:g.sent(),g.label=7;case 7:return[2,b.data.uuid]}})})()});var m=function e(){c(this,e),f(this,"patientSaved",!1)}}}]);
package/dist/4463.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[4463],{94463:(e,t,o)=>{o.r(t),o.d(t,{default:()=>r});var n=o(1343),s=o.n(n),a=o(83437);const r=function(e){return console.warn("Using the patient-photo extension (or patient-photo-slot slot) is deprecated. Please use the PatientPhoto component from @openmrs/esm-framework."),s().createElement(a.PatientPhoto,e)}}}]);
1
+ "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[4463],{94463:(e,t,o)=>{o.r(t),o.d(t,{default:()=>r});var n=o(1343),s=o.n(n),a=o(54440);const r=function(e){return console.warn("Using the patient-photo extension (or patient-photo-slot slot) is deprecated. Please use the PatientPhoto component from @openmrs/esm-framework."),s().createElement(a.PatientPhoto,e)}}}]);