@openmrs/esm-patient-registration-app 4.0.2-pre.647 → 4.0.2-pre.649

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.
@@ -1,4 +1,4 @@
1
- @openmrs/esm-patient-registration-app:build: cache hit, replaying output a9df77cb8eefc586
1
+ @openmrs/esm-patient-registration-app:build: cache hit, replaying output 90524e56b8ad39e0
2
2
  @openmrs/esm-patient-registration-app:build: assets by chunk 892 KiB (id hint: vendors)
3
3
  @openmrs/esm-patient-registration-app:build:  asset 858.js 407 KiB [emitted] [minimized] [big] (id hint: vendors) 1 related asset
4
4
  @openmrs/esm-patient-registration-app:build:  asset 767.js 244 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
@@ -13,7 +13,7 @@
13
13
  @openmrs/esm-patient-registration-app:build: built modules 3.36 MiB (javascript) 168 bytes (share-init) 168 bytes (consume-shared) [built]
14
14
  @openmrs/esm-patient-registration-app:build:  modules by path ../../node_modules/ 3.04 MiB 409 modules
15
15
  @openmrs/esm-patient-registration-app:build:  modules by path ./ 327 KiB
16
- @openmrs/esm-patient-registration-app:build:  modules by path ./src/ 323 KiB 23 modules
16
+ @openmrs/esm-patient-registration-app:build:  modules by path ./src/ 324 KiB 23 modules
17
17
  @openmrs/esm-patient-registration-app:build:  modules by path ./translations/ 3.19 KiB 2 modules
18
18
  @openmrs/esm-patient-registration-app:build:  provide-module modules 168 bytes
19
19
  @openmrs/esm-patient-registration-app:build:  provide shared module (default) @openmrs/esm-framework@4.0.2 = ../../node_modules/@openmrs/esm-framework/src/internal.ts 42 bytes [built] [code generated]
@@ -29,4 +29,4 @@
29
29
  @openmrs/esm-patient-registration-app:build: Assets:
30
30
  @openmrs/esm-patient-registration-app:build:  858.js (407 KiB)
31
31
  @openmrs/esm-patient-registration-app:build: 
32
- @openmrs/esm-patient-registration-app:build: webpack 5.74.0 compiled with 1 warning in 126843 ms
32
+ @openmrs/esm-patient-registration-app:build: webpack 5.74.0 compiled with 1 warning in 112763 ms
package/dist/686.js CHANGED
@@ -1 +1 @@
1
- (self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[686],{225:(e,t,n)=>{"use strict";n.d(t,{X8:()=>s,bT:()=>u,bs:()=>o});var r=n(906);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 a(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 o=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone & email"]},{id:"death",name:"Death Info",fields:[]},{id:"relationships",name:"Relationships",fields:[]}],s=["name","gender","dob","address","id","phone & email"],u={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(o.map((function(e){return e.id})).join("', '"),"'."),_elements:{_type:r.Type.String}},sectionDefinitions:{_type:r.Type.Array,_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(o.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(s.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}}},_default:[]},fieldDefinitions:{_type:r.Type.Array,_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."},uuid:{_type:r.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},label:{_type:r.Type.String,_default:null,_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."},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:r.Type.ConceptUuid,_default:null,_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:r.Type.Array,_elements:{uuid:{_type:r.Type.UUID,_description:"Answer concept UUID"},label:{_type:r.Type.String,_default:null,_description:"The custom label for the answer concept."}},_default:[],_description:"For coded questions only. Provide ability to add custom concept answers."}},_default:[],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields."},fieldConfigurations:{name:{displayMiddleName:{_type:r.Type.Boolean,_default:!0},unidentifiedPatient:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},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."}},gender:{_type:r.Type.Array,_elements:{value:{_type:r.Type.String,_description:"The value for sex option"},label:{_type:r.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:r.Type.String,_default:null,_description:"The id for sex option."}},_default:[{id:"male",value:"Male",label:"Male"},{id:"female",value:"Female",label:"Female"},{id:"other",value:"Other",label:"Other"},{id:"unknown",value:"Unknown",label:"Unknown"}],_description:"Provide ability to configure sex options."},address:{useAddressHeirarchy:{_type:r.Type.Boolean,_description:"Whether to use the Address heirarchy in the registration form or not",_default:!1}}},links:{submitButton:{_type:r.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:r.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:r.Type.Array,_elements:{_type:r.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:r.Type.UUID,_default:null,_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:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_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 a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})).includes(t)}))}),(function(e){var t=a(o).concat(a(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(o))+(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 a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))).includes(t)}))}))}),(function(e){var t=a(s).concat(a(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(s.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("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>c,QT:()=>l,UO:()=>s,e1:()=>u});var r,i,a,o=n(906),s="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",u="@openmrs/esm-patient-registration-app",c="patient-registration",l=(r={},a="network-first",(i=o.omrsOfflineCachingStrategyHttpHeaderName)in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r)},1686:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>g,importTranslation:()=>b,setupOpenMRS:()=>w,version:()=>v});var r=n(906),i=n(3076),a=n(225),o=n(8179),s=n(5047),u=n.n(s),c=n(6279);function l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e){return["/ws/fhir2/R4/Patient/".concat(e),"/ws/rest/v1/relationship?v=".concat(o.UO,"&person=").concat(e),"/ws/rest/v1/person/".concat(e,"/attribute"),"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map((function(e){return window.origin+(0,r.makeUrl)(e)}))}function f(){return y.apply(this,arguments)}function y(){return(y=p(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([(0,c.X1)(),(0,c.Te)(),(0,c.mt)(),(0,c.St)()]);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t){return m.apply(this,arguments)}function m(){return(m=p(u().mark((function e(t,n){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.y.savePatientFormOnline(t._patientRegistrationData.isNewPatient,t._patientRegistrationData.formValues,t._patientRegistrationData.patientUuidMap,t._patientRegistrationData.initialAddressFieldValues,t._patientRegistrationData.capturePhotoProps,t._patientRegistrationData.currentLocation,t._patientRegistrationData.initialIdentifierValues,t._patientRegistrationData.currentUser,t._patientRegistrationData.config,t._patientRegistrationData.savePatientTransactionManager,n.abort);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var v="4.0.2-pre.647",b=n(3979),g={"webservices.rest":"^2.24.0"};function w(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,r.defineConfigSchema)(o.e1,a.bT),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")}]),(0,r.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,r.subscribePrecacheStaticDependencies)(f),(0,r.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return p(u().mark((function t(){var n,r,i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,caches.open("omrs-spa-cache-v1");case 3:return r=t.sent,t.next=6,r.keys();case 6:return i=t.sent.map((function(e){return e.url})),t.abrupt("return",n.every((function(e){return i.includes(e)})));case 8:case"end":return t.stop()}}),t)})))()},sync:function(e){return p(u().mark((function t(){var n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,Promise.allSettled(n.map(function(){var e=p(u().mark((function e(t){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:t});case 2:return e.next=4,fetch(t);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t)})))()}}),{pages:[{load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(553),n.e(924),n.e(859)]).then(n.bind(n,1859))}),e),route:"patient-registration",online:{savePatientForm:i.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:i.y.savePatientFormOffline,isOffline:!0}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(206)]).then(n.bind(n,8206))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(735)]).then(n.bind(n,5735))}),e),online:!0,offline:!0},{id:"patient-photo-widget",slot:"patient-photo-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(854),n.e(975)]).then(n.bind(n,9975))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"delete-identifier-confirmation-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(242)]).then(n.bind(n,5242))}),e),online:!0,offline:!0}]}}},6279:(e,t,n)=>{"use strict";n.d(t,{Cg:()=>g,St:()=>D,Te:()=>_,X1:()=>w,mt:()=>O});var r=n(5047),i=n.n(r),a=n(268),o=n.n(a),s=n(3662),u=n(2777),c=n(8407),l=n(906),p=n(8179);function d(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 f(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,"next",e)}function s(e){f(a,r,i,o,s,"throw",e)}o(void 0)}))}}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(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){h(e,t,n[t])}))}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function b(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(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.")}()}var g=o().createContext(null);function w(e){return T.apply(this,arguments)}function T(){return(T=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/session",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e){return P.apply(this,arguments)}function P(){return(P=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){return x.apply(this,arguments)}function x(){return(x=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/relationshiptype?v=default",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e){return U.apply(this,arguments)}function U(){return(U=y(i().mark((function e(t){var n,r,a,o,u,c,l,p,d,f,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k(t);case 2:n=e.sent,r=n.filter(Boolean),a=!0,o=!1,u=void 0,e.prev=5,c=r[Symbol.iterator]();case 7:if(a=(l=c.next()).done){e.next=20;break}return p=l.value,e.t0=b,e.next=12,Promise.all([j(p.uuid,t),N(t)]);case 12:e.t1=e.sent,d=(0,e.t0)(e.t1,2),f=d[0],y=d[1],p.identifierSources=f.data.results.map((function(e){var t=(0,s.Z)(y.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e}));case 17:a=!0,e.next=7;break;case 20:e.next=26;break;case 22:e.prev=22,e.t2=e.catch(5),o=!0,u=e.t2;case 26:e.prev=26,e.prev=27,a||null==c.return||c.return();case 29:if(e.prev=29,!o){e.next=32;break}throw u;case 32:return e.finish(29);case 33:return e.finish(26);case 34:return e.abrupt("return",r);case 35:case"end":return e.stop()}}),e,null,[[5,22,26,34],[27,,29,33]])})))).apply(this,arguments)}function k(e){return S.apply(this,arguments)}function S(){return(S=y(i().mark((function e(t){var n,r,a,o,s,c,l,p,d;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/patientidentifiertype?v=full",t);case 2:return n=e.sent,e.next=5,F("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType",t);case 5:if(r=e.sent,!n.ok){e.next=13;break}return l=null==n||null===(a=n.data)||void 0===a?void 0:a.results,p=null==r||null===(o=r.data)||void 0===o||null===(s=o.results)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.metadataUuid,d=(null==r?void 0:r.ok)?[E(null==l?void 0:l.find((function(e){return e.uuid===p})),!0)]:[],l.forEach((function(e){e.uuid!==p&&d.push(E(e,!1))})),e.abrupt("return",d.map((function(e){return v(m({},e),{fieldName:(0,u.Z)(e.name)})})));case 13:return e.abrupt("return",[]);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(e,t){return A.apply(this,arguments)}function A(){return(A=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(t),n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(e){return I.apply(this,arguments)}function I(){return(I=y(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/autogenerationoption?v=full",t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e,t){return C.apply(this,arguments)}function C(){return(C=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,c.Z)(t)});case 2:return e.next=4,(0,l.openmrsFetch)(t,{headers:p.QT,signal:null==n?void 0:n.signal});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t){return{name:e.display,fieldName:(0,u.Z)(e.display),required:e.required,uuid:e.uuid,format:e.format,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},3076:(e,t,n)=>{"use strict";n.d(t,{I:()=>b,y:()=>v});var r=n(5047),i=n.n(r),a=n(906),o=n(8179),s=n(7117),u=n(5741);function c(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 l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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 y(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 h(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(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)?c(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.")}()}var m,v=function(){function e(){d(this,e)}return e.saveRelationships=function(e,t,n){return p(i().mark((function r(){return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var r=e.relatedPersonUuid,i=e.relationshipType,a=e.uuid,o=e.action,u=h(i.split("/"),2),c=u[0],l=u[1],p=t.data.uuid,d="aIsToB"===l,f={personA:d?r:p,personB:d?p:r,relationshipType:c};switch(o){case"ADD":return(0,s.bL)(n,f);case"UPDATE":return(0,s.r6)(n,a,f);case"DELETE":return(0,s.kE)(n,a)}}))));case 1:case"end":return r.stop()}}),r)})))()},e.saveObservations=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(e&&Object.keys(e).length>0)){i.next=7;break}if(a.registrationObs.encounterTypeUuid){i.next=5;break}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."),i.next=7;break;case 5:return c={encounterDatetime:new Date,patient:t.data.uuid,encounterType:a.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:r.currentProvider.uuid,encounterRole:a.registrationObs.encounterProviderRoleUuid}],form:a.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},i.abrupt("return",(0,s.M1)(o,c));case 7:case"end":return i.stop()}}),u)})))()},e.savePatientIdentifiers=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return c=Object.values(n).map(function(){var n=p(i().mark((function n(r){var u,c,l,p,d,f,y,h,m;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(u=r.identifierTypeUuid,c=r.identifierValue,l=r.identifierUuid,p=r.selectedSource,d=r.preferred,f=r.autoGeneration,y=r.initialValue,!(c||f&&p)){n.next=23;break}if(f){n.next=6;break}n.t0=c,n.next=11;break;case 6:return n.next=8,(0,s.fX)(r.selectedSource.uuid,o);case 8:return n.next=10,n.sent.data.identifier;case 10:n.t0=n.sent;case 11:if(h=n.t0,m={uuid:l,identifier:h,identifierType:u,location:a,preferred:d},e){n.next=22;break}if(y){n.next=19;break}return n.next=17,(0,s.eb)(t,m,o);case 17:n.next=22;break;case 19:if(y===h){n.next=22;break}return n.next=22,(0,s.nI)(t,l,m.identifier,o);case 22:return n.abrupt("return",m);case 23:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()),t&&Object.keys(r).filter((function(e){return!n[e]})).forEach(function(){var e=p(i().mark((function e(n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.ZB)(t,r[n].identifierUuid,o);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),u.abrupt("return",Promise.all(c));case 3:case"end":return u.stop()}}),u)})))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,r,i){var a,o,s,c=e.getPatientAddressField(t,r);return o=t.birthdate,a=(null!=(s=Date)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](o):o instanceof s)?[t.birthdate.getFullYear(),t.birthdate.getMonth()+1,t.birthdate.getDate()].join("-"):t.birthdate,(0,u.Z)(r,c)&&(c={}),{uuid:t.patientUuid,person:y({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[c]},e.getPatientDeathInfo(t)),identifiers:i}},e.getNames=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},e.getPatientAttributes=function(e){var t=[];if(e.attributes){var n=!0,r=!1,i=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=h(a.value,2),u=s[0],c=s[1];t.push({attributeType:u,value:c})}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientAddressField=function(e,t){return Object.keys(t).reduce((function(t,n){return r=y({},t),i=null!=(i=f({},n,e[n]))?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})),r;var r,i}),{})},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,r=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?r:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,r,i,a,o;return{id:e.uuid,gender:{M:"male",F:"female",O:"other",U:"unknown"}[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===(r=e.person)||void 0===r||null===(i=r.names)||void 0===i?void 0:i.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(a=e.person)||void 0===a?void 0:a.addresses.map((function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}})),telecom:null===(o=e.person.attributes)||void 0===o?void 0:o.filter((function(e){return"Telephone Number"===e.attributeType}))}},e}();v.savePatientFormOffline=(m=p(i().mark((function e(t,n,r,s,u,c,l,p,d){var f;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f={fhirPatient:v.mapPatientToFhirPatient(v.getPatientToCreate(n,r,s,[])),_patientRegistrationData:{isNewPatient:t,formValues:n,patientUuidMap:r,initialAddressFieldValues:s,capturePhotoProps:u,currentLocation:c,initialIdentifierValues:l,currentUser:p,config:d,savePatientTransactionManager:new b}},e.next=3,(0,a.queueSynchronizationItem)(o.Kt,f,{id:n.patientUuid,displayName:"Patient registration",patientUuid:f.fhirPatient.id,dependencies:[]});case 3:return e.abrupt("return",null);case 4:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,a,o,s,u){return m.apply(this,arguments)}),v.savePatientFormOnline=function(){var e=p(i().mark((function e(t,n,r,a,o,u,c,l,d,f,y){var h,m,b;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.savePatientIdentifiers(t,n.patientUuid,n.identifiers,c,u,y);case 2:return h=e.sent,m=v.getPatientToCreate(n,r,a,h),v.getDeletedNames(n.patientUuid,r).forEach(function(){var e=p(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.uO)(t.nameUuid,t.personUuid,y);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=7,(0,s.co)(y,m,t&&!f.patientSaved?void 0:n.patientUuid);case 7:if(!(b=e.sent).ok){e.next=17;break}return f.patientSaved=!0,e.next=12,v.saveRelationships(n.relationships,b,y);case 12:return e.next=14,v.saveObservations(n.obs,b,u,l,d,y);case 14:if(!d.concepts.patientPhotoUuid||!(null==o?void 0:o.imageData)){e.next=17;break}return e.next=17,(0,s.oV)(b.data.uuid,o.imageData,"/ws/rest/v1/obs",o.dateTime||(new Date).toISOString(),d.concepts.patientPhotoUuid,y);case 17:return e.abrupt("return",b.data.uuid);case 18:case"end":return e.stop()}}),e)})));return function(t,n,r,i,a,o,s,u,c,l,p){return e.apply(this,arguments)}}();var b=function e(){d(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>p,M8:()=>w,Uu:()=>g,ZB:()=>D,bL:()=>y,co:()=>l,eb:()=>_,fX:()=>d,kE:()=>m,nI:()=>O,oV:()=>v,r6:()=>h,uO:()=>f});var r=n(5047),i=n.n(r),a=n(9857),o=n(906);function s(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,u,"next",e)}function u(e){s(a,r,i,o,u,"throw",e)}o(void 0)}))}}function c(e){for(var t=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 a=new Blob([r],{type:n});return new File([a],"patient-photo.png")}function l(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(n||""),{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function p(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function d(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function f(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function h(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:n.relationshipType},signal:e.signal})}function m(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:e.signal})}function v(e,t,n,r,i,a){return b.apply(this,arguments)}function b(){return(b=u(i().mark((function e(t,n,r,a,s,u){var l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(l=new FormData).append("patient",t),l.append("file",c(n)),l.append("json",JSON.stringify({person:t,concept:s,groupMembers:[],obsDatetime:a})),e.abrupt("return",(0,o.openmrsFetch)(r,{method:"POST",signal:u.signal,body:l}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){var t,n,r,i=(0,o.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(i,"&v=full"),u=(0,a.ZP)(e?s:null,o.openmrsFetch),c=u.data,l=u.error,p=null==c||null===(t=c.data)||void 0===t?void 0:t.results[0];return{data:p?{dateTime:null==p?void 0:p.obsDatetime,imageSrc:null==p||null===(n=p.value)||void 0===n||null===(r=n.links)||void 0===r?void 0:r.uri}:null,isError:l,isLoading:!c&&!l}}function w(e,t){return T.apply(this,arguments)}function T(){return(T=u(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/person?q=".concat(t),{signal:n.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e,t,n){return P.apply(this,arguments)}function P(){return(P=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:r.signal,body:n}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t,n,r){return x.apply(this,arguments)}function x(){return(x=u(i().mark((function e(t,n,r,a){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n),{method:"POST",headers:{"Content-Type":"application/json"},signal:a.signal,body:{identifier:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t,n){return U.apply(this,arguments)}function U(){return(U=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},3979:(e,t,n)=>{var r={"./en.json":[3574,574]};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=3979,e.exports=i}}]);
1
+ (self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[686],{225:(e,t,n)=>{"use strict";n.d(t,{X8:()=>s,bT:()=>u,bs:()=>o});var r=n(906);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 a(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 o=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone & email"]},{id:"death",name:"Death Info",fields:[]},{id:"relationships",name:"Relationships",fields:[]}],s=["name","gender","dob","address","id","phone & email"],u={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(o.map((function(e){return e.id})).join("', '"),"'."),_elements:{_type:r.Type.String}},sectionDefinitions:{_type:r.Type.Array,_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(o.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(s.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}}},_default:[]},fieldDefinitions:{_type:r.Type.Array,_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."},uuid:{_type:r.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},label:{_type:r.Type.String,_default:null,_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."},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:r.Type.ConceptUuid,_default:null,_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:r.Type.Array,_elements:{uuid:{_type:r.Type.UUID,_description:"Answer concept UUID"},label:{_type:r.Type.String,_default:null,_description:"The custom label for the answer concept."}},_default:[],_description:"For coded questions only. Provide ability to add custom concept answers."}},_default:[],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields."},fieldConfigurations:{name:{displayMiddleName:{_type:r.Type.Boolean,_default:!0},unidentifiedPatient:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},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."}},gender:{_type:r.Type.Array,_elements:{value:{_type:r.Type.String,_description:"The value for sex option"},label:{_type:r.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:r.Type.String,_default:null,_description:"The id for sex option."}},_default:[{id:"male",value:"Male",label:"Male"},{id:"female",value:"Female",label:"Female"},{id:"other",value:"Other",label:"Other"},{id:"unknown",value:"Unknown",label:"Unknown"}],_description:"Provide ability to configure sex options."},address:{useAddressHierarchy:{_type:r.Type.Boolean,_description:"Whether to use the Address heirarchy in the registration form or not",_default:!1}}},links:{submitButton:{_type:r.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:r.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:r.Type.Array,_elements:{_type:r.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:r.Type.UUID,_default:null,_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:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_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 a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})).includes(t)}))}),(function(e){var t=a(o).concat(a(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(o))+(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 a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))).includes(t)}))}))}),(function(e){var t=a(s).concat(a(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(s.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("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>c,QT:()=>l,UO:()=>s,e1:()=>u});var r,i,a,o=n(906),s="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",u="@openmrs/esm-patient-registration-app",c="patient-registration",l=(r={},a="network-first",(i=o.omrsOfflineCachingStrategyHttpHeaderName)in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r)},1686:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>g,importTranslation:()=>b,setupOpenMRS:()=>w,version:()=>v});var r=n(906),i=n(3076),a=n(225),o=n(8179),s=n(5047),u=n.n(s),c=n(6279);function l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e){return["/ws/fhir2/R4/Patient/".concat(e),"/ws/rest/v1/relationship?v=".concat(o.UO,"&person=").concat(e),"/ws/rest/v1/person/".concat(e,"/attribute"),"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map((function(e){return window.origin+(0,r.makeUrl)(e)}))}function f(){return y.apply(this,arguments)}function y(){return(y=p(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([(0,c.X1)(),(0,c.Te)(),(0,c.mt)(),(0,c.St)()]);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t){return m.apply(this,arguments)}function m(){return(m=p(u().mark((function e(t,n){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.y.savePatientFormOnline(t._patientRegistrationData.isNewPatient,t._patientRegistrationData.formValues,t._patientRegistrationData.patientUuidMap,t._patientRegistrationData.initialAddressFieldValues,t._patientRegistrationData.capturePhotoProps,t._patientRegistrationData.currentLocation,t._patientRegistrationData.initialIdentifierValues,t._patientRegistrationData.currentUser,t._patientRegistrationData.config,t._patientRegistrationData.savePatientTransactionManager,n.abort);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var v="4.0.2-pre.649",b=n(3979),g={"webservices.rest":"^2.24.0"};function w(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,r.defineConfigSchema)(o.e1,a.bT),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")}]),(0,r.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,r.subscribePrecacheStaticDependencies)(f),(0,r.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return p(u().mark((function t(){var n,r,i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,caches.open("omrs-spa-cache-v1");case 3:return r=t.sent,t.next=6,r.keys();case 6:return i=t.sent.map((function(e){return e.url})),t.abrupt("return",n.every((function(e){return i.includes(e)})));case 8:case"end":return t.stop()}}),t)})))()},sync:function(e){return p(u().mark((function t(){var n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,Promise.allSettled(n.map(function(){var e=p(u().mark((function e(t){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:t});case 2:return e.next=4,fetch(t);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t)})))()}}),{pages:[{load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(553),n.e(924),n.e(859)]).then(n.bind(n,1859))}),e),route:"patient-registration",online:{savePatientForm:i.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:i.y.savePatientFormOffline,isOffline:!0}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(206)]).then(n.bind(n,8206))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(735)]).then(n.bind(n,5735))}),e),online:!0,offline:!0},{id:"patient-photo-widget",slot:"patient-photo-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(854),n.e(975)]).then(n.bind(n,9975))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"delete-identifier-confirmation-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(242)]).then(n.bind(n,5242))}),e),online:!0,offline:!0}]}}},6279:(e,t,n)=>{"use strict";n.d(t,{Cg:()=>g,St:()=>D,Te:()=>_,X1:()=>w,mt:()=>O});var r=n(5047),i=n.n(r),a=n(268),o=n.n(a),s=n(3662),u=n(2777),c=n(8407),l=n(906),p=n(8179);function d(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 f(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,"next",e)}function s(e){f(a,r,i,o,s,"throw",e)}o(void 0)}))}}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(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){h(e,t,n[t])}))}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function b(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(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.")}()}var g=o().createContext(null);function w(e){return T.apply(this,arguments)}function T(){return(T=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/session",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e){return P.apply(this,arguments)}function P(){return(P=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){return x.apply(this,arguments)}function x(){return(x=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/relationshiptype?v=default",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e){return U.apply(this,arguments)}function U(){return(U=y(i().mark((function e(t){var n,r,a,o,u,c,l,p,d,f,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k(t);case 2:n=e.sent,r=n.filter(Boolean),a=!0,o=!1,u=void 0,e.prev=5,c=r[Symbol.iterator]();case 7:if(a=(l=c.next()).done){e.next=20;break}return p=l.value,e.t0=b,e.next=12,Promise.all([j(p.uuid,t),N(t)]);case 12:e.t1=e.sent,d=(0,e.t0)(e.t1,2),f=d[0],y=d[1],p.identifierSources=f.data.results.map((function(e){var t=(0,s.Z)(y.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e}));case 17:a=!0,e.next=7;break;case 20:e.next=26;break;case 22:e.prev=22,e.t2=e.catch(5),o=!0,u=e.t2;case 26:e.prev=26,e.prev=27,a||null==c.return||c.return();case 29:if(e.prev=29,!o){e.next=32;break}throw u;case 32:return e.finish(29);case 33:return e.finish(26);case 34:return e.abrupt("return",r);case 35:case"end":return e.stop()}}),e,null,[[5,22,26,34],[27,,29,33]])})))).apply(this,arguments)}function k(e){return S.apply(this,arguments)}function S(){return(S=y(i().mark((function e(t){var n,r,a,o,s,c,l,p,d;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/patientidentifiertype?v=full",t);case 2:return n=e.sent,e.next=5,F("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType",t);case 5:if(r=e.sent,!n.ok){e.next=13;break}return l=null==n||null===(a=n.data)||void 0===a?void 0:a.results,p=null==r||null===(o=r.data)||void 0===o||null===(s=o.results)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.metadataUuid,d=(null==r?void 0:r.ok)?[E(null==l?void 0:l.find((function(e){return e.uuid===p})),!0)]:[],l.forEach((function(e){e.uuid!==p&&d.push(E(e,!1))})),e.abrupt("return",d.map((function(e){return v(m({},e),{fieldName:(0,u.Z)(e.name)})})));case 13:return e.abrupt("return",[]);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(e,t){return A.apply(this,arguments)}function A(){return(A=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(t),n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(e){return I.apply(this,arguments)}function I(){return(I=y(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/autogenerationoption?v=full",t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e,t){return C.apply(this,arguments)}function C(){return(C=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,c.Z)(t)});case 2:return e.next=4,(0,l.openmrsFetch)(t,{headers:p.QT,signal:null==n?void 0:n.signal});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t){return{name:e.display,fieldName:(0,u.Z)(e.display),required:e.required,uuid:e.uuid,format:e.format,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},3076:(e,t,n)=>{"use strict";n.d(t,{I:()=>b,y:()=>v});var r=n(5047),i=n.n(r),a=n(906),o=n(8179),s=n(7117),u=n(5741);function c(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 l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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 y(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 h(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(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)?c(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.")}()}var m,v=function(){function e(){d(this,e)}return e.saveRelationships=function(e,t,n){return p(i().mark((function r(){return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var r=e.relatedPersonUuid,i=e.relationshipType,a=e.uuid,o=e.action,u=h(i.split("/"),2),c=u[0],l=u[1],p=t.data.uuid,d="aIsToB"===l,f={personA:d?r:p,personB:d?p:r,relationshipType:c};switch(o){case"ADD":return(0,s.bL)(n,f);case"UPDATE":return(0,s.r6)(n,a,f);case"DELETE":return(0,s.kE)(n,a)}}))));case 1:case"end":return r.stop()}}),r)})))()},e.saveObservations=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(e&&Object.keys(e).length>0)){i.next=7;break}if(a.registrationObs.encounterTypeUuid){i.next=5;break}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."),i.next=7;break;case 5:return c={encounterDatetime:new Date,patient:t.data.uuid,encounterType:a.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:r.currentProvider.uuid,encounterRole:a.registrationObs.encounterProviderRoleUuid}],form:a.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},i.abrupt("return",(0,s.M1)(o,c));case 7:case"end":return i.stop()}}),u)})))()},e.savePatientIdentifiers=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return c=Object.values(n).map(function(){var n=p(i().mark((function n(r){var u,c,l,p,d,f,y,h,m;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(u=r.identifierTypeUuid,c=r.identifierValue,l=r.identifierUuid,p=r.selectedSource,d=r.preferred,f=r.autoGeneration,y=r.initialValue,!(c||f&&p)){n.next=23;break}if(f){n.next=6;break}n.t0=c,n.next=11;break;case 6:return n.next=8,(0,s.fX)(r.selectedSource.uuid,o);case 8:return n.next=10,n.sent.data.identifier;case 10:n.t0=n.sent;case 11:if(h=n.t0,m={uuid:l,identifier:h,identifierType:u,location:a,preferred:d},e){n.next=22;break}if(y){n.next=19;break}return n.next=17,(0,s.eb)(t,m,o);case 17:n.next=22;break;case 19:if(y===h){n.next=22;break}return n.next=22,(0,s.nI)(t,l,m.identifier,o);case 22:return n.abrupt("return",m);case 23:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()),t&&Object.keys(r).filter((function(e){return!n[e]})).forEach(function(){var e=p(i().mark((function e(n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.ZB)(t,r[n].identifierUuid,o);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),u.abrupt("return",Promise.all(c));case 3:case"end":return u.stop()}}),u)})))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,r,i){var a,o,s,c=e.getPatientAddressField(t,r);return o=t.birthdate,a=(null!=(s=Date)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](o):o instanceof s)?[t.birthdate.getFullYear(),t.birthdate.getMonth()+1,t.birthdate.getDate()].join("-"):t.birthdate,(0,u.Z)(r,c)&&(c={}),{uuid:t.patientUuid,person:y({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[c]},e.getPatientDeathInfo(t)),identifiers:i}},e.getNames=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},e.getPatientAttributes=function(e){var t=[];if(e.attributes){var n=!0,r=!1,i=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=h(a.value,2),u=s[0],c=s[1];t.push({attributeType:u,value:c})}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientAddressField=function(e,t){return Object.keys(t).reduce((function(t,n){return r=y({},t),i=null!=(i=f({},n,e[n]))?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})),r;var r,i}),{})},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,r=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?r:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,r,i,a,o;return{id:e.uuid,gender:{M:"male",F:"female",O:"other",U:"unknown"}[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===(r=e.person)||void 0===r||null===(i=r.names)||void 0===i?void 0:i.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(a=e.person)||void 0===a?void 0:a.addresses.map((function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}})),telecom:null===(o=e.person.attributes)||void 0===o?void 0:o.filter((function(e){return"Telephone Number"===e.attributeType}))}},e}();v.savePatientFormOffline=(m=p(i().mark((function e(t,n,r,s,u,c,l,p,d){var f;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f={fhirPatient:v.mapPatientToFhirPatient(v.getPatientToCreate(n,r,s,[])),_patientRegistrationData:{isNewPatient:t,formValues:n,patientUuidMap:r,initialAddressFieldValues:s,capturePhotoProps:u,currentLocation:c,initialIdentifierValues:l,currentUser:p,config:d,savePatientTransactionManager:new b}},e.next=3,(0,a.queueSynchronizationItem)(o.Kt,f,{id:n.patientUuid,displayName:"Patient registration",patientUuid:f.fhirPatient.id,dependencies:[]});case 3:return e.abrupt("return",null);case 4:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,a,o,s,u){return m.apply(this,arguments)}),v.savePatientFormOnline=function(){var e=p(i().mark((function e(t,n,r,a,o,u,c,l,d,f,y){var h,m,b;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.savePatientIdentifiers(t,n.patientUuid,n.identifiers,c,u,y);case 2:return h=e.sent,m=v.getPatientToCreate(n,r,a,h),v.getDeletedNames(n.patientUuid,r).forEach(function(){var e=p(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.uO)(t.nameUuid,t.personUuid,y);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=7,(0,s.co)(y,m,t&&!f.patientSaved?void 0:n.patientUuid);case 7:if(!(b=e.sent).ok){e.next=17;break}return f.patientSaved=!0,e.next=12,v.saveRelationships(n.relationships,b,y);case 12:return e.next=14,v.saveObservations(n.obs,b,u,l,d,y);case 14:if(!d.concepts.patientPhotoUuid||!(null==o?void 0:o.imageData)){e.next=17;break}return e.next=17,(0,s.oV)(b.data.uuid,o.imageData,"/ws/rest/v1/obs",o.dateTime||(new Date).toISOString(),d.concepts.patientPhotoUuid,y);case 17:return e.abrupt("return",b.data.uuid);case 18:case"end":return e.stop()}}),e)})));return function(t,n,r,i,a,o,s,u,c,l,p){return e.apply(this,arguments)}}();var b=function e(){d(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>p,M8:()=>w,Uu:()=>g,ZB:()=>D,bL:()=>y,co:()=>l,eb:()=>_,fX:()=>d,kE:()=>m,nI:()=>O,oV:()=>v,r6:()=>h,uO:()=>f});var r=n(5047),i=n.n(r),a=n(9857),o=n(906);function s(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,u,"next",e)}function u(e){s(a,r,i,o,u,"throw",e)}o(void 0)}))}}function c(e){for(var t=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 a=new Blob([r],{type:n});return new File([a],"patient-photo.png")}function l(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(n||""),{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function p(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function d(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function f(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function h(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:n.relationshipType},signal:e.signal})}function m(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:e.signal})}function v(e,t,n,r,i,a){return b.apply(this,arguments)}function b(){return(b=u(i().mark((function e(t,n,r,a,s,u){var l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(l=new FormData).append("patient",t),l.append("file",c(n)),l.append("json",JSON.stringify({person:t,concept:s,groupMembers:[],obsDatetime:a})),e.abrupt("return",(0,o.openmrsFetch)(r,{method:"POST",signal:u.signal,body:l}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){var t,n,r,i=(0,o.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(i,"&v=full"),u=(0,a.ZP)(e?s:null,o.openmrsFetch),c=u.data,l=u.error,p=null==c||null===(t=c.data)||void 0===t?void 0:t.results[0];return{data:p?{dateTime:null==p?void 0:p.obsDatetime,imageSrc:null==p||null===(n=p.value)||void 0===n||null===(r=n.links)||void 0===r?void 0:r.uri}:null,isError:l,isLoading:!c&&!l}}function w(e,t){return T.apply(this,arguments)}function T(){return(T=u(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/person?q=".concat(t),{signal:n.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e,t,n){return P.apply(this,arguments)}function P(){return(P=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:r.signal,body:n}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t,n,r){return x.apply(this,arguments)}function x(){return(x=u(i().mark((function e(t,n,r,a){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n),{method:"POST",headers:{"Content-Type":"application/json"},signal:a.signal,body:{identifier:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t,n){return U.apply(this,arguments)}function U(){return(U=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},3979:(e,t,n)=>{var r={"./en.json":[3574,574]};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=3979,e.exports=i}}]);
package/dist/859.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[859],{1098:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__field__productiveHeading02___0\\+2Gm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-registration__field__productiveHeading02Light___bbKeq{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-bottom:1rem;color:#525252}.-esm-patient-registration__field__label01___6YyKZ{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-registration__field__grid___g21pQ{display:grid;grid-template-columns:1fr 1fr;column-gap:1rem}.-esm-patient-registration__field__halfWidthInDesktopView___J9cO8{width:calc(50% - 1rem)}.-esm-patient-registration__field__patientPhoto___9mWMr{display:flex;justify-content:center}.-esm-patient-registration__field__nameField___uPmod{grid-row:1;grid-column:1}.-esm-patient-registration__field__nameField___uPmod>.cds--content-switcher{display:grid;grid-template-columns:1fr 1fr;width:max-content;justify-content:flex-start}.-esm-patient-registration__field__contentSwitcher___G7dTq{margin-bottom:1rem}.-esm-patient-registration__field__dobField___P6SHd>.cds--content-switcher{display:grid;grid-template-columns:1fr 1fr;width:max-content;justify-content:flex-start}.-esm-patient-registration__field__photoExtension___IqCnX{margin-bottom:1rem;grid-row:1;grid-column:2;justify-self:center}.-esm-patient-registration__field__sexField___F8TIv,.-esm-patient-registration__field__dobField___P6SHd{margin-bottom:1rem}.-esm-patient-registration__field__dobContentSwitcherLabel___vW\\+UB{margin-bottom:.5rem}.-esm-patient-registration__field__identifierLabelText___bdyJF{display:flex;align-items:center}.-esm-patient-registration__field__setIDNumberButton___XziAX{margin-bottom:1rem}.-esm-patient-registration__field__setIDNumberButton___XziAX>svg{margin-left:.5rem}.-esm-patient-registration__field__customField___40yP4{margin-bottom:1rem}.-esm-patient-registration__field__attributeField___qdljB{margin-bottom:1rem}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__grid___g21pQ{grid-template-columns:1fr;grid-template-rows:auto auto}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__nameField___uPmod{grid-row:2;grid-column:1}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__photoExtension___IqCnX{grid-column:1;grid-row:1;justify-self:start}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__radioButton___d7GuU label{height:3rem !important}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__halfWidthInDesktopView___J9cO8{width:100%}.-esm-patient-registration__field__radioFieldError___LyxW0{color:#da1e28;display:block;font-weight:400;max-height:12.5rem;overflow:visible;font-size:.75rem;letter-spacing:.32px;line-height:1.34;margin:.25rem 0 0}",""]),r.locals={productiveHeading02:"-esm-patient-registration__field__productiveHeading02___0+2Gm",productiveHeading02Light:"-esm-patient-registration__field__productiveHeading02Light___bbKeq",label01:"-esm-patient-registration__field__label01___6YyKZ",grid:"-esm-patient-registration__field__grid___g21pQ",halfWidthInDesktopView:"-esm-patient-registration__field__halfWidthInDesktopView___J9cO8",patientPhoto:"-esm-patient-registration__field__patientPhoto___9mWMr",nameField:"-esm-patient-registration__field__nameField___uPmod",contentSwitcher:"-esm-patient-registration__field__contentSwitcher___G7dTq",dobField:"-esm-patient-registration__field__dobField___P6SHd",photoExtension:"-esm-patient-registration__field__photoExtension___IqCnX",sexField:"-esm-patient-registration__field__sexField___F8TIv",dobContentSwitcherLabel:"-esm-patient-registration__field__dobContentSwitcherLabel___vW+UB",identifierLabelText:"-esm-patient-registration__field__identifierLabelText___bdyJF",setIDNumberButton:"-esm-patient-registration__field__setIDNumberButton___XziAX",customField:"-esm-patient-registration__field__customField___40yP4",attributeField:"-esm-patient-registration__field__attributeField___qdljB",radioButton:"-esm-patient-registration__field__radioButton___d7GuU",radioFieldError:"-esm-patient-registration__field__radioFieldError___LyxW0"};const a=r},3433:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__identifier-selection__title___fPIy3{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__identifier-selection__submit___WgYnV{width:250px}.-esm-patient-registration__identifier-selection__submit___WgYnV:hover{cursor:pointer}.-esm-patient-registration__identifier-selection__cancelButton___ar-za{width:11.688rem}.-esm-patient-registration__identifier-selection__submitButton___mJgTx{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__identifier-selection__infoGrid___5ovdR{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__identifier-selection__label01___sm7Rq{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__identifier-selection__productiveHeading02___aocJ0{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__identifier-selection__space05___pbxiU{margin:1rem 0 1rem 0}.-esm-patient-registration__identifier-selection__formContainer___XacnD{display:flex;width:100%}.-esm-patient-registration__identifier-selection__stickyColumn___H9Wbn{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__identifier-selection__touchTarget___heOv2 a:active{color:#161616}.-esm-patient-registration__identifier-selection__linkName___oKi4d{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__identifier-selection__linkName___oKi4d:active{text-decoration:none;color:#161616}.-esm-patient-registration__identifier-selection__linkName___oKi4d:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__identifier-selection__main___s9KQc{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__identifier-selection__infoGrid___5ovdR{max-width:unset}.-esm-patient-registration__identifier-selection__button___08VWQ{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-registration__identifier-selection__tablet___mHt6H{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-registration__identifier-selection__desktop___VkI9z{padding:0rem}.-esm-patient-registration__identifier-selection__radioGroup___n\\+7PW{background-color:#f4f4f4;padding:1rem}.-esm-patient-registration__identifier-selection__radioButton___yaoFj{margin:0 !important}.-esm-patient-registration__identifier-selection__radioButton___yaoFj label{height:2rem}.omrs-breakpoint-lt-desktop .-esm-patient-registration__identifier-selection__radioButton___yaoFj label{height:3rem !important}",""]),r.locals={title:"-esm-patient-registration__identifier-selection__title___fPIy3",submit:"-esm-patient-registration__identifier-selection__submit___WgYnV",cancelButton:"-esm-patient-registration__identifier-selection__cancelButton___ar-za",submitButton:"-esm-patient-registration__identifier-selection__submitButton___mJgTx",infoGrid:"-esm-patient-registration__identifier-selection__infoGrid___5ovdR",label01:"-esm-patient-registration__identifier-selection__label01___sm7Rq",productiveHeading02:"-esm-patient-registration__identifier-selection__productiveHeading02___aocJ0",space05:"-esm-patient-registration__identifier-selection__space05___pbxiU",formContainer:"-esm-patient-registration__identifier-selection__formContainer___XacnD",stickyColumn:"-esm-patient-registration__identifier-selection__stickyColumn___H9Wbn",touchTarget:"-esm-patient-registration__identifier-selection__touchTarget___heOv2",linkName:"-esm-patient-registration__identifier-selection__linkName___oKi4d",main:"-esm-patient-registration__identifier-selection__main___s9KQc",button:"-esm-patient-registration__identifier-selection__button___08VWQ",tablet:"-esm-patient-registration__identifier-selection__tablet___mHt6H",desktop:"-esm-patient-registration__identifier-selection__desktop___VkI9z",radioGroup:"-esm-patient-registration__identifier-selection__radioGroup___n+7PW",radioButton:"-esm-patient-registration__identifier-selection__radioButton___yaoFj"};const a=r},1662:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__autosuggest__label01___f95oj{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-registration__autosuggest__suggestions___v5o3w{position:relative;border-top-width:0;list-style:none;margin-top:0;max-height:143px;overflow-y:auto;padding-left:0;width:100%;position:absolute;left:0;background-color:#fff;margin-bottom:20px;z-index:99}.-esm-patient-registration__autosuggest__suggestions___v5o3w li{padding:1rem;line-height:1.29;color:#525252;border-bottom:1px solid #8d8d8d}.-esm-patient-registration__autosuggest__suggestions___v5o3w li:hover{background-color:#e5e5e5;color:#161616;cursor:pointer}.-esm-patient-registration__autosuggest__suggestions___v5o3w li:not(:last-of-type){border-bottom:1px solid #999}.-esm-patient-registration__autosuggest__autocomplete___it56z{position:relative}.-esm-patient-registration__autosuggest__autocompleteSearch___sc5fh{width:100%}.-esm-patient-registration__autosuggest__suggestions___v5o3w a{color:inherit;text-decoration:none}",""]),r.locals={label01:"-esm-patient-registration__autosuggest__label01___f95oj",suggestions:"-esm-patient-registration__autosuggest__suggestions___v5o3w",autocomplete:"-esm-patient-registration__autosuggest__autocomplete___it56z",autocompleteSearch:"-esm-patient-registration__autosuggest__autocompleteSearch___sc5fh"};const a=r},4939:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__input__title___4PKlg{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__input__submit___mloB4{width:250px}.-esm-patient-registration__input__submit___mloB4:hover{cursor:pointer}.-esm-patient-registration__input__cancelButton___blAcs{width:11.688rem}.-esm-patient-registration__input__submitButton___SofD2{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__input__infoGrid___xohlq{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__input__label01___fwQQq{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__input__productiveHeading02___7pE9K{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__input__space05___9oNC\\+{margin:1rem 0 1rem 0}.-esm-patient-registration__input__formContainer___YE8UP{display:flex;width:100%}.-esm-patient-registration__input__stickyColumn___KQudo{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__input__touchTarget___lFvgc a:active{color:#161616}.-esm-patient-registration__input__linkName___C8vKy{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__input__linkName___C8vKy:active{text-decoration:none;color:#161616}.-esm-patient-registration__input__linkName___C8vKy:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__input__main___rng6t{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__input__infoGrid___xohlq{max-width:unset}.-esm-patient-registration__input__fieldRow___5TD7U{display:flex;flex-direction:row;justify-content:flex-start;flex-wrap:wrap}.-esm-patient-registration__input__subFieldRow___zGAH4{margin-bottom:5px}.-esm-patient-registration__input__label___65tRW{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252}.-esm-patient-registration__input__textID___F\\+F-t{margin-bottom:1rem}.-esm-patient-registration__input__requiredField___x0TVf{color:#da1e28}.-esm-patient-registration__input__input___JYX4d{margin-right:5px}.-esm-patient-registration__input__checkboxField___gmx7u{display:flex;flex-direction:row;justify-content:flex-start;width:400px;margin-left:10px}.-esm-patient-registration__input__textInput___QJYjz{width:250px !important;height:40px !important}.-esm-patient-registration__input__numberInput___IGlx4{width:200px !important;height:40px !important}.-esm-patient-registration__input__checkboxInput___IVRIk{height:1.5rem !important;width:1.5rem !important;margin-top:8px}.-esm-patient-registration__input__selectInput___yrzZ-{width:150px !important;height:40px !important}.-esm-patient-registration__input__dateInput___2shrY{width:200px !important;height:40px !important;font-size:large !important}.-esm-patient-registration__input__telInput___HxQe3{width:250px !important;height:40px !important}.-esm-patient-registration__input__errorInput___aW2qL{border:2px solid #da1e28 !important;padding-left:.875rem !important}.-esm-patient-registration__input__errorMessage___cbdW2{color:#da1e28;align-self:center}.-esm-patient-registration__input__dummyData___GFQGF{cursor:pointer;margin-left:5px}.-esm-patient-registration__input__IDInput___6B3\\+s{display:grid;grid-template-columns:1fr auto;align-items:center;max-width:27rem}.-esm-patient-registration__input__trashCan___usc53{color:#da1e28}.omrs-breakpoint-lt-desktop .-esm-patient-registration__input__IDInput___6B3\\+s{max-width:unset;width:100%}.-esm-patient-registration__input__dangerLabel01___sb6Np{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#da1e28}",""]),r.locals={title:"-esm-patient-registration__input__title___4PKlg",submit:"-esm-patient-registration__input__submit___mloB4",cancelButton:"-esm-patient-registration__input__cancelButton___blAcs",submitButton:"-esm-patient-registration__input__submitButton___SofD2",infoGrid:"-esm-patient-registration__input__infoGrid___xohlq",label01:"-esm-patient-registration__input__label01___fwQQq",productiveHeading02:"-esm-patient-registration__input__productiveHeading02___7pE9K",space05:"-esm-patient-registration__input__space05___9oNC+",formContainer:"-esm-patient-registration__input__formContainer___YE8UP",stickyColumn:"-esm-patient-registration__input__stickyColumn___KQudo",touchTarget:"-esm-patient-registration__input__touchTarget___lFvgc",linkName:"-esm-patient-registration__input__linkName___C8vKy",main:"-esm-patient-registration__input__main___rng6t",fieldRow:"-esm-patient-registration__input__fieldRow___5TD7U",subFieldRow:"-esm-patient-registration__input__subFieldRow___zGAH4",label:"-esm-patient-registration__input__label___65tRW",textID:"-esm-patient-registration__input__textID___F+F-t",requiredField:"-esm-patient-registration__input__requiredField___x0TVf",input:"-esm-patient-registration__input__input___JYX4d",checkboxField:"-esm-patient-registration__input__checkboxField___gmx7u",textInput:"-esm-patient-registration__input__textInput___QJYjz",numberInput:"-esm-patient-registration__input__numberInput___IGlx4",checkboxInput:"-esm-patient-registration__input__checkboxInput___IVRIk",selectInput:"-esm-patient-registration__input__selectInput___yrzZ-",dateInput:"-esm-patient-registration__input__dateInput___2shrY",telInput:"-esm-patient-registration__input__telInput___HxQe3",errorInput:"-esm-patient-registration__input__errorInput___aW2qL",errorMessage:"-esm-patient-registration__input__errorMessage___cbdW2",dummyData:"-esm-patient-registration__input__dummyData___GFQGF",IDInput:"-esm-patient-registration__input__IDInput___6B3+s",trashCan:"-esm-patient-registration__input__trashCan___usc53",dangerLabel01:"-esm-patient-registration__input__dangerLabel01___sb6Np"};const a=r},1093:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__patient-registration__title___d6s20{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__patient-registration__submit___S6frc{width:250px}.-esm-patient-registration__patient-registration__submit___S6frc:hover{cursor:pointer}.-esm-patient-registration__patient-registration__cancelButton___2-E\\+5{width:11.688rem}.-esm-patient-registration__patient-registration__submitButton___Ps1do{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__patient-registration__infoGrid___2S1kw{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__patient-registration__label01___CxOgi{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__patient-registration__productiveHeading02___mBDux{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__patient-registration__space05___\\+IJfn{margin:1rem 0 1rem 0}.-esm-patient-registration__patient-registration__formContainer___ydkLz{display:flex;width:100%}.-esm-patient-registration__patient-registration__stickyColumn___2G55G{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__patient-registration__touchTarget___KxfOv a:active{color:#161616}.-esm-patient-registration__patient-registration__linkName___Ukv7z{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__patient-registration__linkName___Ukv7z:active{text-decoration:none;color:#161616}.-esm-patient-registration__patient-registration__linkName___Ukv7z:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__patient-registration__main___eiIwY{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__patient-registration__infoGrid___2S1kw{max-width:unset}",""]),r.locals={title:"-esm-patient-registration__patient-registration__title___d6s20",submit:"-esm-patient-registration__patient-registration__submit___S6frc",cancelButton:"-esm-patient-registration__patient-registration__cancelButton___2-E+5",submitButton:"-esm-patient-registration__patient-registration__submitButton___Ps1do",infoGrid:"-esm-patient-registration__patient-registration__infoGrid___2S1kw",label01:"-esm-patient-registration__patient-registration__label01___CxOgi",productiveHeading02:"-esm-patient-registration__patient-registration__productiveHeading02___mBDux",space05:"-esm-patient-registration__patient-registration__space05___+IJfn",formContainer:"-esm-patient-registration__patient-registration__formContainer___ydkLz",stickyColumn:"-esm-patient-registration__patient-registration__stickyColumn___2G55G",touchTarget:"-esm-patient-registration__patient-registration__touchTarget___KxfOv",linkName:"-esm-patient-registration__patient-registration__linkName___Ukv7z",main:"-esm-patient-registration__patient-registration__main___eiIwY"};const a=r},138:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__relationships__title___zOYZm{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__relationships__submit___kNlmu{width:250px}.-esm-patient-registration__relationships__submit___kNlmu:hover{cursor:pointer}.-esm-patient-registration__relationships__cancelButton___cFt6p{width:11.688rem}.-esm-patient-registration__relationships__submitButton___CW8X\\+{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__relationships__infoGrid___9dg84{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__relationships__label01___TYH\\+i{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__relationships__productiveHeading02___PuSkg{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__relationships__space05___gWnMG{margin:1rem 0 1rem 0}.-esm-patient-registration__relationships__formContainer___U91DX{display:flex;width:100%}.-esm-patient-registration__relationships__stickyColumn___2cbAk{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__relationships__touchTarget___chVrk a:active{color:#161616}.-esm-patient-registration__relationships__linkName___M6KoQ{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__relationships__linkName___M6KoQ:active{text-decoration:none;color:#161616}.-esm-patient-registration__relationships__linkName___M6KoQ:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__relationships__main___G8ux-{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__relationships__infoGrid___9dg84{max-width:unset}.-esm-patient-registration__relationships__labelText___hTuhj{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-registration__relationships__bodyShort02___hfBao{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0)}.-esm-patient-registration__relationships__searchBox___xY0Yt{margin-bottom:1rem}.-esm-patient-registration__relationships__relationshipHeader___2w\\+Ew{display:flex;align-items:center}.-esm-patient-registration__relationships__productiveHeading___IiVgd{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-patient-registration__relationships__trashCan___nBYrg{color:#da1e28 !important}.omrs-breakpoint-lt-desktop .-esm-patient-registration__relationships__relationshipHeader___2w\\+Ew{justify-content:space-between}",""]),r.locals={title:"-esm-patient-registration__relationships__title___zOYZm",submit:"-esm-patient-registration__relationships__submit___kNlmu",cancelButton:"-esm-patient-registration__relationships__cancelButton___cFt6p",submitButton:"-esm-patient-registration__relationships__submitButton___CW8X+",infoGrid:"-esm-patient-registration__relationships__infoGrid___9dg84",label01:"-esm-patient-registration__relationships__label01___TYH+i",productiveHeading02:"-esm-patient-registration__relationships__productiveHeading02___PuSkg",space05:"-esm-patient-registration__relationships__space05___gWnMG",formContainer:"-esm-patient-registration__relationships__formContainer___U91DX",stickyColumn:"-esm-patient-registration__relationships__stickyColumn___2cbAk",touchTarget:"-esm-patient-registration__relationships__touchTarget___chVrk",linkName:"-esm-patient-registration__relationships__linkName___M6KoQ",main:"-esm-patient-registration__relationships__main___G8ux-",labelText:"-esm-patient-registration__relationships__labelText___hTuhj",bodyShort02:"-esm-patient-registration__relationships__bodyShort02___hfBao",searchBox:"-esm-patient-registration__relationships__searchBox___xY0Yt",relationshipHeader:"-esm-patient-registration__relationships__relationshipHeader___2w+Ew",productiveHeading:"-esm-patient-registration__relationships__productiveHeading___IiVgd",trashCan:"-esm-patient-registration__relationships__trashCan___nBYrg"};const a=r},2936:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__section__title___WE522{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__section__submit___ZCyMT{width:250px}.-esm-patient-registration__section__submit___ZCyMT:hover{cursor:pointer}.-esm-patient-registration__section__cancelButton___BtWcr{width:11.688rem}.-esm-patient-registration__section__submitButton___SX3tz{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__section__infoGrid___m6EFv{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__section__label01___SB4dO{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__section__productiveHeading02___0Qr6X{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__section__space05___\\+I97l{margin:1rem 0 1rem 0}.-esm-patient-registration__section__formContainer___bUz8M{display:flex;width:100%}.-esm-patient-registration__section__stickyColumn___e3QEm{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__section__touchTarget___ubpCE a:active{color:#161616}.-esm-patient-registration__section__linkName___NOqjy{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__section__linkName___NOqjy:active{text-decoration:none;color:#161616}.-esm-patient-registration__section__linkName___NOqjy:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__section__main___3eHUo{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__section__infoGrid___m6EFv{max-width:unset}",""]),r.locals={title:"-esm-patient-registration__section__title___WE522",submit:"-esm-patient-registration__section__submit___ZCyMT",cancelButton:"-esm-patient-registration__section__cancelButton___BtWcr",submitButton:"-esm-patient-registration__section__submitButton___SX3tz",infoGrid:"-esm-patient-registration__section__infoGrid___m6EFv",label01:"-esm-patient-registration__section__label01___SB4dO",productiveHeading02:"-esm-patient-registration__section__productiveHeading02___0Qr6X",space05:"-esm-patient-registration__section__space05___+I97l",formContainer:"-esm-patient-registration__section__formContainer___bUz8M",stickyColumn:"-esm-patient-registration__section__stickyColumn___e3QEm",touchTarget:"-esm-patient-registration__section__touchTarget___ubpCE",linkName:"-esm-patient-registration__section__linkName___NOqjy",main:"-esm-patient-registration__section__main___3eHUo"};const a=r},7857:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__overlay__title___ovEFv{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__overlay__submit___MEU04{width:250px}.-esm-patient-registration__overlay__submit___MEU04:hover{cursor:pointer}.-esm-patient-registration__overlay__cancelButton___Kuq8k{width:11.688rem}.-esm-patient-registration__overlay__submitButton___koip2{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__overlay__infoGrid___IR-lJ{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__overlay__label01___UFjWe{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__overlay__productiveHeading02___0-7g8{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__overlay__space05___3-aCf{margin:1rem 0 1rem 0}.-esm-patient-registration__overlay__formContainer___0etfN{display:flex;width:100%}.-esm-patient-registration__overlay__stickyColumn___ZAq3J{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__overlay__touchTarget___eSQ3o a:active{color:#161616}.-esm-patient-registration__overlay__linkName___Kol4j{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__overlay__linkName___Kol4j:active{text-decoration:none;color:#161616}.-esm-patient-registration__overlay__linkName___Kol4j:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__overlay__main___pCgsu{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__overlay__infoGrid___IR-lJ{max-width:unset}.-esm-patient-registration__overlay__desktopOverlay___pTy0O{position:fixed;top:3rem;right:0;height:calc(100vh - 3rem);min-width:27rem;background-color:#fff;border-left:1px solid #a8a8a8;overflow:hidden;display:grid;grid-template-rows:auto 1fr auto;z-index:999}.-esm-patient-registration__overlay__tabletOverlay___\\+CQze{position:fixed;top:0;bottom:0;left:0;right:0;z-index:9999;background-color:#fff;overflow:hidden;padding-top:3rem;display:grid;grid-template-rows:1fr auto}.-esm-patient-registration__overlay__tabletOverlayHeader___omtl4 button{background-color:#005d5d !important}.-esm-patient-registration__overlay__tabletOverlayHeader___omtl4 .-esm-patient-registration__overlay__headerContent___S7vPL{color:#fff}.-esm-patient-registration__overlay__desktopHeader___X3NCa{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8}.-esm-patient-registration__overlay__headerContent___S7vPL{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);padding:0 1rem;color:#161616}.-esm-patient-registration__overlay__closeButton___8Pcw1{background-color:#fff}.-esm-patient-registration__overlay__overlayContent___9V2UN{padding:1rem;overflow-y:auto}",""]),r.locals={title:"-esm-patient-registration__overlay__title___ovEFv",submit:"-esm-patient-registration__overlay__submit___MEU04",cancelButton:"-esm-patient-registration__overlay__cancelButton___Kuq8k",submitButton:"-esm-patient-registration__overlay__submitButton___koip2",infoGrid:"-esm-patient-registration__overlay__infoGrid___IR-lJ",label01:"-esm-patient-registration__overlay__label01___UFjWe",productiveHeading02:"-esm-patient-registration__overlay__productiveHeading02___0-7g8",space05:"-esm-patient-registration__overlay__space05___3-aCf",formContainer:"-esm-patient-registration__overlay__formContainer___0etfN",stickyColumn:"-esm-patient-registration__overlay__stickyColumn___ZAq3J",touchTarget:"-esm-patient-registration__overlay__touchTarget___eSQ3o",linkName:"-esm-patient-registration__overlay__linkName___Kol4j",main:"-esm-patient-registration__overlay__main___pCgsu",desktopOverlay:"-esm-patient-registration__overlay__desktopOverlay___pTy0O",tabletOverlay:"-esm-patient-registration__overlay__tabletOverlay___+CQze",tabletOverlayHeader:"-esm-patient-registration__overlay__tabletOverlayHeader___omtl4",headerContent:"-esm-patient-registration__overlay__headerContent___S7vPL",desktopHeader:"-esm-patient-registration__overlay__desktopHeader___X3NCa",closeButton:"-esm-patient-registration__overlay__closeButton___8Pcw1",overlayContent:"-esm-patient-registration__overlay__overlayContent___9V2UN"};const a=r},4954:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".-esm-patient-registration__root__root___msybz{background-color:#fff}.-esm-patient-registration__root__grid___p9P\\+g{grid-template-columns:repeat(1, minmax(0, 1fr))}",""]),r.locals={root:"-esm-patient-registration__root__root___msybz",grid:"-esm-patient-registration__root__grid___p9P+g"};const a=r},1859:(e,t,n)=>{n.r(t),n.d(t,{default:()=>wn});var i=n(268),r=n.n(i),a=n(7228),o=n(2767),l=n(906),s=n(6279),c=n(5047),u=n.n(c),_=n(781),d=n(4924),m=n(7065),p=n(6794),f=n(4519),g=n.n(f),h=p.Ry({givenName:p.Z_().required("givenNameRequired"),familyName:p.Z_().required("familyNameRequired"),additionalGivenName:p.Z_().when("addNameInLocalLanguage",{is:!0,then:p.Z_().required("givenNameRequired"),otherwise:p.Z_().notRequired()}),additionalFamilyName:p.Z_().when("addNameInLocalLanguage",{is:!0,then:p.Z_().required("familyNameRequired"),otherwise:p.Z_().notRequired()}),gender:p.Z_().oneOf(["Male","Female","Other","Unknown"],"genderUnspecified").required("genderRequired"),birthdate:p.hT().when("birthdateEstimated",{is:!1,then:p.hT().required("birthdayRequired").max(Date(),"birthdayNotInTheFuture").nullable(),otherwise:p.hT().nullable()}),yearsEstimated:p.Rx().when("birthdateEstimated",{is:!0,then:p.Rx().required("yearsEstimateRequired").min(0,"negativeYears"),otherwise:p.Rx().nullable()}),monthsEstimated:p.Rx().min(0,"negativeMonths"),deathDate:p.hT().max(Date(),"deathdayNotInTheFuture").nullable(),email:p.Z_().optional().email("invalidEmail"),identifiers:p.Vo((function(e){return p.Ry(g()(e,(function(){return p.Ry({required:p.Xg(),identifierValue:p.Z_().when("required",{is:!0,then:p.Z_().required("identifierValueRequired"),otherwise:p.Z_().notRequired()})})})))}))}),v=(0,i.createContext)(void 0),b=n(3076),y=n(7117),w=n(9571),E=n(6062),x=n.n(E),k=n(4036),T=n.n(k),O=n(6793),S=n.n(O),N=n(7892),I=n.n(N),C=n(1173),j=n.n(C),P=n(2464),A=n.n(P),D=n(4939),F={};F.styleTagTransform=A(),F.setAttributes=I(),F.insert=S().bind(null,"head"),F.domAPI=T(),F.insertStyleElement=j(),x()(D.Z,F);const B=D.Z&&D.Z.locals?D.Z.locals:void 0;var z={patientUuid:(0,w.Z)(),givenName:"John",middleName:"",familyName:"Smith",unidentifiedPatient:!1,additionalGivenName:"Joey",additionalMiddleName:"",additionalFamilyName:"Smitty",addNameInLocalLanguage:!0,gender:"Male",birthdate:new Date(2020,1,1),yearsEstimated:1,monthsEstimated:2,birthdateEstimated:!0,telephoneNumber:"0800001066",address1:"Bom Jesus Street",address2:"",cityVillage:"Recife",stateProvince:"Pernambuco",country:"Brazil",postalCode:"50030-310",isDead:!1,deathDate:"",deathCause:"",relationships:[],identifiers:{}},L=function(e){var t=e.setValues;return r().createElement("main",null,r().createElement("button",{onClick:function(){return t(z)},className:"omrs-btn omrs-filled-neutral ".concat(B.dummyData),type:"button","aria-label":"Dummy Data Input"},"Input Dummy Data"))},U=n(2777),V=n(1525);function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){R(e,t,n[t])}))}return e}function M(e,t,n){var i,r,a;return null!==(a=null===(r=null===(i=n.querySelector(t))||void 0===i?void 0:i.querySelector("[name=".concat(e,"]")))||void 0===r?void 0:r.getAttribute("value"))&&void 0!==a?a:null}function q(){(0,l.navigate)({to:"".concat(window.spaBase,"/home")})}function G(e){var t,n={},i=null===(t=e.address)||void 0===t?void 0:t[0];if(i){var r=!0,a=!1,o=void 0;try{for(var l,s=Object.keys(i)[Symbol.iterator]();!(r=(l=s.next()).done);r=!0){var c=l.value;switch(c){case"city":n.cityVillage=i[c];break;case"state":n.stateProvince=i[c];break;case"district":n.countyDistrict=i[c];break;case"extension":i[c].forEach((function(e){e.extension.forEach((function(e){n[e.url.split("#")[1]]=e.valueString}))}));break;default:"country"!==c&&"postalCode"!==c||(n[c]=i[c])}}}catch(e){a=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}}return n}function W(e){var t,n=e.name[0],i=e.name[1],r=null===(t=e.address)||void 0===t?void 0:t[0];return H({preferredNameUuid:null==n?void 0:n.id,additionalNameUuid:null==i?void 0:i.id,preferredAddressUuid:null==r?void 0:r.id},e.identifier.map((function(e){return R({},(0,U.Z)(e.system||e.type.text),{uuid:e.id,value:e.value})})))}function Y(e){var t={};return e.telecom&&(t.phone=e.telecom[0].value),t}var Q=n(9857),K=n(8179);function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function X(e,t,n,i,r,a,o){try{var l=e[a](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,r)}function J(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){X(a,i,r,o,l,"next",e)}function l(e){X(a,i,r,o,l,"throw",e)}o(void 0)}))}}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){ee(e,t,n[t])}))}return e}function ne(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function ie(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $(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)?$(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 re(e){return ae.apply(this,arguments)}function ae(){return(ae=J(u().mark((function e(t){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.getSynchronizationItems)(K.Kt);case 2:return n=e.sent,e.abrupt("return",n.find((function(e){return e._patientRegistrationData.formValues.patientUuid===t})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var oe=n(225),le=n(1093),se={};se.styleTagTransform=A(),se.setAttributes=I(),se.insert=S().bind(null,"head"),se.domAPI=T(),se.insertStyleElement=j(),x()(le.Z,se);const ce=le.Z&&le.Z.locals?le.Z.locals:void 0;function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _e(){return _e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},_e.apply(this,arguments)}var de=function(e){var t,n,a=e.checkWarning,l=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["checkWarning"]),s=(t=(0,m.U$)(l.name),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ue(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)?ue(e,t):void 0}}(t,n)||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.")}()),c=s[0],u=s[1],_=(0,d.useTranslation)().t,p=c.value||"",f=u.error&&_(u.error),g=(0,i.useMemo)((function(){if(!f&&"function"==typeof a){var e=a(p);return e&&_(e)}}),[a,f,p,_]),h=l.required?l.labelText:"".concat(l.labelText," (").concat(_("optional","optional"),")");return r().createElement("div",{style:{marginBottom:"1rem"}},r().createElement(o.mh4,null,r().createElement(o.oil,_e({},l,c,{labelText:h,invalid:!(!u.touched||!u.error),invalidText:f,warn:!!g,warnText:g,value:p}))))},me=function(){var e=(0,d.useTranslation)().t;return r().createElement("div",null,r().createElement(de,{id:"phone",name:"attributes.14d4f066-15f5-102d-96e4-000c29c2a5d7",labelText:e("phoneNumberInputLabelText","Phone number"),light:!0}))},pe=n(1098),fe={};fe.styleTagTransform=A(),fe.setAttributes=I(),fe.insert=S().bind(null,"head"),fe.domAPI=T(),fe.insertStyleElement=j(),x()(pe.Z,fe);const ge=pe.Z&&pe.Z.locals?pe.Z.locals:void 0;var he=function(){var e=(0,d.useTranslation)().t;return r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},e("phoneEmailLabelText","Phone, Email")),r().createElement("div",{className:ge.grid},r().createElement(me,null),r().createElement(de,{id:"email",name:"attributes.ac7d7773-fe9f-11ec-8b9b-0242ac1b0002",labelText:e("emailLabelText","Email")})))};function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var be=/^([^0-9]*)$/;function ye(e){if(!be.test(e))return"numberInNameDubious"}var we=function(){var e,t,n=(0,d.useTranslation)().t,a=(0,i.useContext)(v),s=a.setCapturePhotoProps,c=a.currentPhoto,u=a.setFieldValue,_=(0,l.useConfig)().fieldConfigurations,p=null==_?void 0:_.name,f=!(e=(0,m.U$)("unidentifiedPatient"),t=1,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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ve(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)?ve(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.")}())[0].value,g=(0,i.useCallback)((function(e,t){s&&s({imageData:e,dateTime:t})}),[s]);return r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},n("fullNameLabelText","Full Name")),r().createElement("div",{className:ge.grid},r().createElement(l.ExtensionSlot,{className:ge.photoExtension,extensionSlotName:"capture-patient-photo-slot",state:{onCapturePhoto:g,initialState:c}}),r().createElement("div",{className:ge.nameField},r().createElement("div",{className:ge.dobContentSwitcherLabel},r().createElement("span",{className:ge.label01},n("patientNameKnown","Patient's Name is Known?"))),r().createElement(o.GHR,{className:ge.contentSwitcher,onChange:function(e){"known"===e.name?(u("givenName",""),u("familyName",""),u("unidentifiedPatient",!1)):(u("givenName",p.defaultUnknownGivenName),u("familyName",p.defaultUnknownFamilyName),u("unidentifiedPatient",!0))}},r().createElement(o.rsf,{name:"known",text:n("yes","Yes")}),r().createElement(o.rsf,{name:"unknown",text:n("no","No")})),f&&r().createElement(r().Fragment,null,r().createElement(de,{id:"givenName",name:"givenName",labelText:n("givenNameLabelText","First Name"),checkWarning:ye,required:!0}),p.displayMiddleName&&r().createElement(de,{id:"middleName",name:"middleName",labelText:n("middleNameLabelText","Middle Name"),light:!0,checkWarning:ye}),r().createElement(de,{id:"familyName",name:"familyName",labelText:n("familyNameLabelText","Family Name"),checkWarning:ye,required:!0})))))};function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var xe=function(){var e,t,n=(0,l.useConfig)().fieldConfigurations,a=(0,d.useTranslation)().t,s=(e=(0,m.U$)("gender"),t=2,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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ee(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)?Ee(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.")}()),c=s[0],u=s[1],_=(0,i.useContext)(v).setFieldValue,p=null==n?void 0:n.gender;return r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement("h4",{className:ge.productiveHeading02Light},a("sexFieldLabelText","Sex")),r().createElement("div",{className:ge.sexField},r().createElement("p",{className:"cds--label"},a("genderLabelText","Sex")),r().createElement(o.SYO,{name:"gender",orientation:"vertical",onChange:function(e){_("gender",e)},valueSelected:c.value},p.map((function(e){return r().createElement(o.EUY,{key:e.label,id:e.id,value:e.value,labelText:a("".concat(e.label),"".concat(e.label))})}))),u.touched&&u.error&&r().createElement("div",{className:ge.radioFieldError},a(u.error,"Gender is required"))))},ke=n(6759),Te=n(2074),Oe=n(7857),Se={};Se.styleTagTransform=A(),Se.setAttributes=I(),Se.insert=S().bind(null,"head"),Se.domAPI=T(),Se.insertStyleElement=j(),x()(Oe.Z,Se);const Ne=Oe.Z&&Oe.Z.locals?Oe.Z.locals:void 0;function Ie(){return Ie=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Ie.apply(this,arguments)}const Ce=function(e){var t=e.close,n=e.children,i=e.header,a=e.buttonsGroup,s=(0,d.useTranslation)().t,c=(0,l.useLayoutType)();return r().createElement("div",{className:(0,l.isDesktop)(c)?Ne.desktopOverlay:Ne.tabletOverlay},(0,l.isDesktop)(c)?r().createElement("div",{className:Ne.desktopHeader},r().createElement("div",{className:Ne.headerContent},i),r().createElement(o.zxk,{className:Ne.closeButton,iconDescription:s("closeOverlay","Close overlay"),onClick:t,kind:"ghost",hasIconOnly:!0,renderIcon:function(e){return r().createElement(Te.x8,Ie({size:16},e))}})):r().createElement(o.h4i,{className:Ne.tabletOverlayHeader},r().createElement(o.zxk,{kind:"ghost",onClick:t,hasIconOnly:!0,iconDescription:s("closeOverlay","Close overlay"),renderIcon:function(e){return r().createElement(ke.Xd,Ie({size:16,onClick:t},e))}}),r().createElement("div",{className:Ne.headerContent},i)),r().createElement("div",{className:Ne.overlayContent},n),r().createElement("div",null,a))};function je(e){return Pe(e)&&!e.identifierSources.some((function(e){var t,n;return!(null===(t=e.autoGenerationOption)||void 0===t?void 0:t.manualEntryEnabled)&&(null===(n=e.autoGenerationOption)||void 0===n?void 0:n.automaticGenerationEnabled)}))}function Pe(e){return"UNIQUE"===e.uniquenessBehavior||"LOCATION"===e.uniquenessBehavior}var Ae=n(3433),De={};De.styleTagTransform=A(),De.setAttributes=I(),De.insert=S().bind(null,"head"),De.domAPI=T(),De.insertStyleElement=j(),x()(Ae.Z,De);const Fe=Ae.Z&&Ae.Z.locals?Ae.Z.locals:void 0;function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){ze(e,t,n[t])}))}return e}function Ue(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Ve(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Be(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)?Be(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.")}()}const Ze=function(e){var t,n=e.closeOverlay,a=e.setFieldValue,c=(0,l.useLayoutType)(),u=(0,i.useContext)(s.Cg).identifierTypes,_=(0,i.useContext)(v),m=_.isOffline,p=_.values,f=_.initialFormValues,g=Ve((0,i.useState)(p.identifiers),2),h=g[0],b=g[1],y=Ve((0,i.useState)(""),2),w=y[0],E=y[1],x=(0,d.useTranslation)().t,k=(0,l.useConfig)().defaultPatientIdentifierTypes,T=(0,i.useMemo)((function(){var e={};return null==k||k.forEach((function(t){e[t]=!0})),e}),[k]);(0,i.useEffect)((function(){b(p.identifiers)}),[p.identifiers]);var O=(0,i.useCallback)((function(e){var n;return E(null!==(t=null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&void 0!==t?t:"")}),[]),S=(0,i.useMemo)((function(){return null==u?void 0:u.filter((function(e){var t;return null==e||null===(t=e.name)||void 0===t?void 0:t.toLowerCase().includes(w.toLowerCase())}))}),[h,w]),N=function(e,t){return b((function(n){var i,r;return t?Ue(Le({},n),ze({},e.fieldName,nt(e,null!==(r=null!==(i=p.identifiers[e.fieldName])&&void 0!==i?i:f.identifiers[e.fieldName])&&void 0!==r?r:{}))):n[e.fieldName]?Object.fromEntries(Object.entries(n).filter((function(t){return Ve(t,1)[0]!==e.fieldName}))):n}))},I=(0,i.useMemo)((function(){return S.map((function(e){var t,n,i=h[e.fieldName],a=e.isPrimary||e.required||T[e.uuid]||p.identifiers[e.fieldName],l=m&&je(e);return r().createElement("div",{key:e.uuid,className:Fe.space05},r().createElement(o.XZJ,{id:e.uuid,value:e.uuid,labelText:e.name,onChange:function(t){return N(e,t)},checked:!!i,disabled:a||m&&l}),i&&(null==e||null===(t=e.identifierSources)||void 0===t?void 0:t.length)>0&&(!i.initialValue||(null==i?void 0:i.selectedSource))&&r().createElement("div",{className:Fe.radioGroup},r().createElement(o.SYO,{legendText:x("source","Source"),name:"".concat(null==e?void 0:e.fieldName,"-identifier-sources"),defaultSelected:null==i||null===(n=i.selectedSource)||void 0===n?void 0:n.uuid,onChange:function(t){return function(e,t){return b((function(n){return Ue(Le({},n),ze({},e.fieldName,Le({},n[e.fieldName],tt(e.identifierSources.find((function(e){return e.uuid===t})),n[e.fieldName].identifierValue,n[e.fieldName].initialValue))))}))}(e,t)},orientation:"vertical"},null==e?void 0:e.identifierSources.map((function(t){var n;return r().createElement(o.EUY,{key:t.uuid,labelText:t.name,name:t.uuid,value:t.uuid,className:Fe.radioButton,disabled:m&&Pe(e)&&(null===(n=t.autoGenerationOption)||void 0===n?void 0:n.manualEntryEnabled)})})))))}))}),[S,h,T,p.identifiers,m,N]),C=(0,i.useCallback)((function(){a("identifiers",h),n()}),[h,a]);return r().createElement(Ce,{close:n,header:x("configureIdentifiers","Configure identifiers"),buttonsGroup:r().createElement(o.uVA,{className:(0,l.isDesktop)(c)?Fe.desktop:Fe.tablet},r().createElement(o.zxk,{className:Fe.button,kind:"secondary",onClick:n},x("cancel","Cancel")),r().createElement(o.zxk,{className:Fe.button,kind:"primary",onClick:C},x("configureIdentifiers","Configure identifiers")))},r().createElement("div",null,r().createElement("p",{className:Fe.bodyLong02},x("IDInstructions","Select the identifiers you'd like to add for this patient:")),u.length>7&&r().createElement("div",{className:Fe.space05},r().createElement(o.olm,{labelText:x("searchIdentifierPlaceholder","Search identifier"),placeholder:x("searchIdentifierPlaceholder","Search identifier"),onChange:O,value:w})),r().createElement("fieldset",null,I)))};var Re=n(7631),He=n(3469),Me=n(6039);function qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function We(){return We=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},We.apply(this,arguments)}function Ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){Ge(e,t,n[t])}))}return e}function Qe(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qe(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)?qe(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.")}()}var Ke=function(e){var t=e.patientIdentifier,n=e.fieldName,a=(0,d.useTranslation)().t,c=(0,l.useConfig)().defaultPatientIdentifierTypes,u=(0,i.useContext)(s.Cg).identifierTypes,_=(0,i.useContext)(v),p=_.isOffline,f=_.values,g=_.setFieldValue,h=(0,i.useMemo)((function(){return u.find((function(e){return e.uuid===t.identifierTypeUuid}))}),[t,u]),b=t.autoGeneration,y=t.initialValue,w=t.identifierValue,E=t.identifierName,x=t.required,k=Qe((0,i.useState)(b||y===w),2),T=k[0],O=k[1],S="identifiers.".concat(n,".identifierValue"),N=Qe((0,m.U$)(S),2),I=N[0],C=N[1],j=p&&je(h),P=(0,i.useMemo)((function(){var e={};return null==c||c.forEach((function(t){e[t]=!0})),e}),[c]),A=(0,i.useCallback)((function(){var e,i;O(!0),g("identifiers.".concat(n),(e=Ye({},t),i=null!=(i={identifierValue:y,selectedSource:null,autoGeneration:!1})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})),e))}),[y,O]);return r().createElement("div",{className:B.IDInput},b||T?r().createElement("div",{className:B.textID},r().createElement("p",{className:B.label},E),r().createElement("p",{className:B.bodyShort02},b?a("autoGeneratedPlaceholderText","Auto-generated"):w),r().createElement("input",We({type:"hidden"},I,{disabled:!0})),!(!C.touched||!C.error)&&r().createElement("span",{className:B.dangerLabel01},C.error&&a(C.error))):r().createElement(de,We({id:S,labelText:E,name:S,disabled:j,required:x,invalid:!(!C.touched||!C.error),invalidText:C.error&&a(C.error)},I)),r().createElement("div",null,!t.required&&t.initialValue&&T&&r().createElement(o.zxk,{kind:"ghost",onClick:function(){var e;O(!1),g("identifiers.".concat(n),Ye({},t,tt(null==h||null===(e=h.identifierSources)||void 0===e?void 0:e[0],y,y)))},iconDescription:a("editIdentifierTooltip","Edit"),disabled:j,hasIconOnly:!0},r().createElement(Re.I8,{size:16})),y&&y!==w&&r().createElement(o.zxk,{kind:"ghost",onClick:A,iconDescription:a("resetIdentifierTooltip","Reset"),disabled:j,hasIconOnly:!0},r().createElement(He.AG,{size:16})),!t.required&&!P[t.identifierTypeUuid]&&r().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},r().createElement(o.zxk,{kind:"danger--ghost",onClick:function(){if(y)var e=(0,l.showModal)("delete-identifier-confirmation-modal",{deleteIdentifier:function(t){t&&g("identifiers",it(f.identifiers,n)),e()},identifierName:E,initialValue:y});else g("identifiers",it(f.identifiers,n))},iconDescription:a("deleteIdentifierTooltip","Delete"),disabled:j,hasIconOnly:!0},r().createElement(Me.ZN,{size:16})))))};function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){Xe(e,t,n[t])}))}return e}function et(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $e(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)?$e(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 tt(e,t,n){var i,r=null==e||null===(i=e.autoGenerationOption)||void 0===i?void 0:i.automaticGenerationEnabled;return{selectedSource:e,autoGeneration:r,identifierValue:r?"auto-generated":"auto-generated"!==t?t:n}}function nt(e,t){var n,i,r;return Je({identifierTypeUuid:e.uuid,identifierName:e.name,preferred:e.isPrimary,initialValue:"",required:e.isPrimary||e.required},t,tt(null!==(i=null==t?void 0:t.selectedSource)&&void 0!==i?i:null===(n=e.identifierSources)||void 0===n?void 0:n[0],null==t?void 0:t.identifierValue,null!==(r=null==t?void 0:t.initialValue)&&void 0!==r?r:""))}function it(e,t){return Object.fromEntries(Object.entries(e).filter((function(e){return et(e,1)[0]!==t})))}var rt=function(){var e=(0,i.useContext)(s.Cg).identifierTypes,t=!e,n=(0,i.useContext)(v),a=n.values,c=n.setFieldValue,u=n.initialFormValues,_=(0,d.useTranslation)().t,m=(0,l.useLayoutType)(),p=et((0,i.useState)(!1),2),f=p[0],g=p[1],h=(0,l.useConfig)().defaultPatientIdentifierTypes;return(0,i.useEffect)((function(){if(e){var t={};e.filter((function(e){return e.isPrimary||e.required||!!(null==h?void 0:h.find((function(t){return t===e.uuid})))})).filter((function(e){return!a.identifiers[e.fieldName]})).forEach((function(e){var n,i;t[e.fieldName]=nt(e,null!==(i=null!==(n=a.identifiers[e.uuid])&&void 0!==n?n:u.identifiers[e.uuid])&&void 0!==i?i:{})})),Object.keys(t).length&&c("identifiers",Je({},a.identifiers,t))}}),[e,c,nt,h,a.identifiers]),t?r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement("div",{className:ge.identifierLabelText},r().createElement("h4",{className:ge.productiveHeading02Light},_("idFieldLabelText","Identifiers"))),r().createElement(o.N2B,null)):r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},r().createElement("div",{className:ge.identifierLabelText},r().createElement("h4",{className:ge.productiveHeading02Light},_("idFieldLabelText","Identifiers")),r().createElement(o.zxk,{kind:"ghost",className:ge.setIDNumberButton,onClick:function(){return g(!0)},size:(0,l.isDesktop)(m)?"sm":"md"},_("configure","Configure")," ",r().createElement(ke.ol,{size:16})))),r().createElement("div",null,Object.entries(a.identifiers).map((function(e){var t=et(e,2),n=t[0],i=t[1];return r().createElement(Ke,{key:n,fieldName:n,patientIdentifier:i})})),f&&r().createElement(Ze,{setFieldValue:c,closeOverlay:function(){return g(!1)}})))};function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ot(){return ot=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ot.apply(this,arguments)}function lt(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return at(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)?at(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.")}()}var st=function(e,t){var n=new Date,i=new Date(n.getFullYear()-e,n.getMonth()-t,1),r=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();return new Date(i.getFullYear(),i.getMonth(),Math.min(n.getDate(),r))},ct=function(){var e,t,n=(0,d.useTranslation)().t,a=!lt((0,m.U$)("birthdateEstimated"),1)[0].value,l=lt((0,m.U$)("birthdate"),2),s=l[0],c=l[1],u=lt((0,m.U$)("yearsEstimated"),2),_=u[0],p=u[1],f=lt((0,m.U$)("monthsEstimated"),2),g=f[0],h=f[1],b=(0,i.useContext)(v).setFieldValue,y=(t="/",{parse:function(n){var i=n.split(t),r=new Date(null);return e.forEach((function(e,t){switch(e){case"d":r.setDate(parseInt(i[t]));break;case"m":r.setMonth(parseInt(i[t])-1);break;case"Y":r.setFullYear(parseInt(i[t]))}})),r},format:function(n){if(null===n)return"";if(r=n,null!=(a=Date)&&"undefined"!=typeof Symbol&&a[Symbol.hasInstance]?a[Symbol.hasInstance](r):r instanceof a){var i=[];return e.forEach((function(e,t){switch(e){case"d":i[t]=n.getDate();break;case"m":i[t]=n.getMonth()+1;break;case"Y":i[t]=n.getFullYear()}})),i.join(t)}return n;var r,a},placeHolder:(e=["d","m","Y"]).map((function(e){return"Y"===e?"YYYY":e+e})).join(t),dateFormat:e.join(t)}),w=y.format,E=y.placeHolder,x=y.dateFormat,k=new Date;return r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement("h4",{className:ge.productiveHeading02Light},n("birthFieldLabelText","Birth")),r().createElement("div",{className:ge.dobField},r().createElement("div",{className:ge.dobContentSwitcherLabel},r().createElement("span",{className:ge.label01},n("dobToggleLabelText","Date of Birth Known?"))),r().createElement(o.GHR,{onChange:function(e){b("birthdateEstimated","unknown"===e.name),b("birthdate",""),b("yearsEstimated",""),b("monthsEstimated","")}},r().createElement(o.rsf,{name:"known",text:n("yes","Yes")}),r().createElement(o.rsf,{name:"unknown",text:n("no","No")}))),a?r().createElement("div",{className:ge.dobField},r().createElement(o.Mtg,{dateFormat:x,datePickerType:"single",onChange:function(e){var t=lt(e,1)[0];b("birthdate",t)},maxDate:w(k)},r().createElement(o.aj6,ot({id:"birthdate"},s,{placeholder:E,labelText:n("dateOfBirthLabelText","Date of Birth"),invalid:!(!c.touched||!c.error),invalidText:c.error&&n(c.error),value:w(s.value)})))):r().createElement("div",{className:ge.grid},r().createElement(o.oil,{id:"yearsEstimated",type:"number",name:_.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<140&&t>=0&&(b("yearsEstimated",t),b("birthdate",st(t,h.value)))},labelText:n("estimatedYearsLabelText","Estimated Years"),invalid:!(!p.touched||!p.error),invalidText:p.error&&n(p.error),value:_.value,min:0,required:!0}),r().createElement(o.oil,{id:"monthsEstimated",type:"number",name:g.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<=11&&t>=0&&(b("monthsEstimated",t),b("birthdate",st(p.value,t)))},labelText:n("estimatedMonthsLabelText","Estimated Months"),invalid:!(!h.touched||!h.error),invalidText:h.error&&n(h.error),value:g.value,min:0})))};function ut(){return ut=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ut.apply(this,arguments)}var _t=function(e){var t=e.fieldDefinition,n=(0,d.useTranslation)().t;return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:t.id},(function(e){var i=e.field,a=e.form;return a.touched,a.errors,e.meta,r().createElement(de,ut({id:t.id,labelText:n("".concat(t.label),"".concat(t.label))},i))})))},dt=n(2303);function mt(e){var t,n="string"==typeof e&&""!==e,i=(0,dt.Z)(n?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),r=i.data,a=i.error;return a&&(0,l.showToast)({title:a.name,description:a.message,kind:"error"}),{data:null==r||null===(t=r.data)||void 0===t?void 0:t.answers,isLoading:!r&&!a}}function pt(){return pt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},pt.apply(this,arguments)}function ft(e){var t=e.fieldDefinition,n=function(e){var t="string"==typeof e&&""!==e,n=(0,dt.Z)(t?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),i=n.data,r=n.error;return r&&(0,l.showToast)({title:r.name,description:r.message,kind:"error"}),{data:null==i?void 0:i.data,isLoading:!i&&!r}}(t.uuid),i=n.data,a=n.isLoading;if(!(0,l.useConfig)().registrationObs.encounterTypeUuid)return console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs fields will not be displayed."),null;if(a)return null;switch(i.datatype.display){case"Text":return r().createElement(gt,{concept:i,validationRegex:t.validation.matches,label:t.label});case"Numeric":return r().createElement(ht,{concept:i,label:t.label});case"Coded":return r().createElement(vt,{concept:i,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return r().createElement(o.K0D,{kind:"error",title:"Error"},'Concept has unknown datatype "',i.datatype.display,'"')}}function gt(e){var t=e.concept,n=e.validationRegex,i=e.label,a=(0,d.useTranslation)().t,o="obs.".concat(t.uuid);return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:o,validate:function(e){if(e&&n&&""!==n&&"string"==typeof n&&""!==e)return new RegExp(n).test(e)?void 0:a("invalidInput","Invalid Input")}},(function(e){var n=e.field,a=e.form,l=a.touched,s=a.errors;return e.meta,r().createElement(de,pt({id:o,labelText:null!=i?i:t.display,invalid:s[o]&&l[o]},n))})))}function ht(e){var t=e.concept,n=e.label,i=((0,d.useTranslation)().t,"obs.".concat(t.uuid));return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:i},(function(e){var a=e.field,o=e.form,l=o.touched,s=o.errors;return e.meta,r().createElement(de,pt({id:i,labelText:null!=n?n:t.display,invalid:s[i]&&l[i],type:"number"},a))})))}function vt(e){var t,n=e.concept,i=e.answerConceptSetUuid,a=e.label,s=(0,l.useConfig)(),c=mt(null!=i?i:n.uuid),u=c.data,_=c.isLoading,d="obs.".concat(n.uuid),p=null==s||null===(t=s.fieldDefinitions)||void 0===t?void 0:t.filter((function(e){return"obs"===e.type&&e.uuid===n.uuid}))[0];return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},_?null:r().createElement(m.gN,{name:d},(function(e){var t,i=e.field,l=e.form,s=l.touched,c=l.errors;return e.meta,(null==p||null===(t=p.customConceptAnswers)||void 0===t?void 0:t.length)?r().createElement(o.PhF,pt({id:d,name:d,labelText:null!=a?a:null==n?void 0:n.display,light:!0,invalid:c[d]&&s[d]},i),r().createElement(o.QlF,{key:"no-answer-select-item-".concat(d),value:"",text:""}),null==p?void 0:p.customConceptAnswers.map((function(e){return r().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.label})}))):r().createElement(o.mh4,null,r().createElement(o.PhF,pt({id:d,name:d,labelText:null!=a?a:null==n?void 0:n.display,invalid:c[d]&&s[d]},i),r().createElement(o.QlF,{key:"no-answer-select-item-".concat(d),value:"",text:""}),u.map((function(e){return r().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})}))))})))}function bt(e){var t=e.personAttributeType,n=e.answerConceptSetUuid,i=e.label,a=mt(n),l=a.data,s=a.isLoading;return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},!s&&(null==l?void 0:l.length)?r().createElement(o.mh4,null,r().createElement(o.PhF,{id:"person-attribute-".concat(t.uuid),name:"attributes.".concat(t.uuid),labelText:null!=i?i:null==t?void 0:t.display},r().createElement(o.QlF,{value:"",text:""}),l.map((function(e){return r().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))):r().createElement(de,{id:"person-attribute-".concat(t.uuid),labelText:null!=i?i:null==t?void 0:t.display,name:"attributes.".concat(t.uuid)}))}function yt(){return yt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},yt.apply(this,arguments)}function wt(e){var t=e.personAttributeType,n=e.validationRegex,i=e.label,a=(0,d.useTranslation)().t,o="attributes.".concat(t.uuid);return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:o,validate:function(e){if(e&&n&&""!==n&&"string"==typeof n&&""!==e)return new RegExp(n).test(e)?void 0:a("invalidInput","Invalid Input")}},(function(e){var n=e.field,a=e.form,l=a.touched,s=a.errors;return e.meta,r().createElement(de,yt({id:"person-attribute-".concat(t.uuid),labelText:null!=i?i:null==t?void 0:t.display,invalid:s[o]&&l[o]},n))})))}function Et(e){var t=e.fieldDefinition,n=function(e){var t=(0,dt.Z)("/ws/rest/v1/personattributetype/".concat(e),l.openmrsFetch),n=t.data,i=t.error;return i&&(0,l.showToast)({title:i.name,description:i.message,kind:"error"}),{data:null==n?void 0:n.data,isLoading:!n&&!i}}(t.uuid),i=n.data;if(n.isLoading)return null;switch(i.format){case"java.lang.String":return r().createElement(wt,{personAttributeType:i,validationRegex:t.validation.matches,label:t.label});case"org.openmrs.Concept":return r().createElement(bt,{personAttributeType:i,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return r().createElement(o.K0D,{kind:"error",title:"Error"},'Patient attribute type has unknown format "',i.format,'"')}}function xt(e){var t=e.name,n=(0,l.useConfig)().fieldDefinitions.filter((function(e){return e.id==t}))[0];return"person attribute"===n.type?r().createElement(Et,{fieldDefinition:n}):"obs"===n.type?r().createElement(ft,{fieldDefinition:n}):"address"===n.type?r().createElement(_t,{fieldDefinition:n}):r().createElement("div",null,"Error: Unknown field type ",n.type)}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Tt(){return Tt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Tt.apply(this,arguments)}function Ot(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kt(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)?kt(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.")}()}var St=function(e){var t,n=e.name,a=e.labelText,s=e.placeholder,c=e.setSelectedValue,u=e.selected,_=(0,d.useTranslation)().t,p=Ot((0,m.U$)(n),3),f=p[0],g=(p[1],p[2]),h=Ot((0,i.useState)([]),2),v=h[0],b=h[1],y=Ot((0,i.useState)(),2),w=y[0],E=y[1],x=g.setValue;return w?r().createElement("span",null,_("".concat(w.message))):r().createElement(o.CtY,Tt({id:n,onInputChange:function(e){var t,i,r,a,o;i=n,""==(t=e)||(r=i.replace(" ",""),a=u,o=t,(0,l.openmrsFetch)("".concat("/module/addresshierarchy/ajax/getPossibleAddressHierarchyEntriesWithParents.form","?addressField=").concat(r,"&limit=20&searchString=").concat(o,"&parentUuid=").concat(a),{method:"GET"})).then((function(e){b(e.data.map((function(e){return{id:e.uuid,text:e.name}})))})).catch((function(e){E(e)})),x(e)},items:v,itemToString:function(e){return null!==(t=null==e?void 0:e.text)&&void 0!==t?t:""}},f,{onChange:function(e){Boolean(e.selectedItem)?(c(e.selectedItem.id),x(e.selectedItem.text)):(c(void 0),x(void 0))},placeholder:s,titleText:a,light:!0}))};function Nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function It(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nt(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)?Nt(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 Ct(e){return(new DOMParser).parseFromString(e,"text/xml")}function jt(e,t){var n=t.getElementsByTagName(e)[0];return Ct(n?n.outerHTML:"")}var Pt=function(){var e=It((0,i.useState)(""),2),t=e[0],n=e[1],a=It((0,i.useState)([]),2),c=a[0],u=a[1],_=(0,d.useTranslation)().t,m=(0,i.useContext)(s.Cg).addressTemplate,p=null==m?void 0:m.results[0].value,f=function(e){n(e)},g=(0,l.useConfig)().fieldConfigurations.useAddressHeirarchy;return(0,i.useEffect)((function(){var e=Ct(p),t=jt("elementdefaults",e),n=jt("nameMappings",e),i=Array.from(n.getElementsByTagName("property")).length>0?n.getElementsByTagName("property"):n.getElementsByTagName("entry"),r=Array.prototype.map.call(i,(function(e){var n,i,r=null!==(n=e.getAttribute("name"))&&void 0!==n?n:e.getElementsByTagName("string")[0].innerHTML,a=null!==(i=e.getAttribute("value"))&&void 0!==i?i:e.getElementsByTagName("string")[1].innerHTML,o=_(r,a),l=function(e,t){var n=t.getElementsByName(e)[0];return n?n.getAttribute("value"):null}(r,t);return{id:r,name:r,labelText:o,value:l}}));u(r)}),[_,p]),m?r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},_("addressHeader","Address")),r().createElement("div",{style:{width:"50%",paddingBottom:"5%"}},g?c.map((function(e,n){return r().createElement(St,{key:"combo_input_".concat(n),name:e.name,labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})})):c.map((function(e,n){return r().createElement(de,{key:"combo_input_".concat(n),name:e.name,labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})})))):r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},_("addressHeader","Address")),r().createElement(o.N2B,null))};function At(e){var t=e.name,n=(0,l.useConfig)();if(!oe.X8.includes(t)&&!n.fieldDefinitions.some((function(e){return e.id==t})))return(0,l.reportError)("Invalid field name '".concat(t,"'. Valid options are '").concat(n.fieldDefinitions.map((function(e){return e.id})).concat(oe.X8).join("', '"),"'.")),null;switch(t){case"name":return r().createElement(we,null);case"gender":return r().createElement(xe,null);case"dob":return r().createElement(ct,null);case"address":return r().createElement(Pt,null);case"id":return r().createElement(rt,null);case"phone & email":return r().createElement(he,null);default:return r().createElement(xt,{name:t})}}var Dt=function(e){var t=e.sectionDefinition;return r().createElement("section",{"aria-label":"".concat(t.name," Section")},t.fields.map((function(e){return r().createElement(At,{key:"".concat(t.name,"-").concat(e),name:e})})))};function Ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Bt(){return Bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Bt.apply(this,arguments)}function zt(e,t){if(e){if("string"==typeof e)return Ft(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)?Ft(e,t):void 0}}var Lt=function(e){var t,n,i=e.name,a=e.options,l=e.label,s=e.required,c=(t=(0,m.U$)(i),n=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||zt(t,n)||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.")}())[0],u=(0,d.useTranslation)().t,_=[r().createElement(o.QlF,{disabled:!0,hidden:!0,text:"Select ".concat(l),key:"",value:""})].concat(function(e){return function(e){if(Array.isArray(e))return Ft(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zt(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.")}()}(a.map((function(e,t){return r().createElement(o.QlF,{text:e,value:e,key:t})})))),p=s?l:"".concat(l," (").concat(u("optional","optional"),")");return r().createElement("div",{style:{marginBottom:"1rem"}},r().createElement(o.mh4,null,r().createElement(o.PhF,Bt({id:"identifier"},c,{labelText:p}),_)))},Ut=n(2936),Vt={};Vt.styleTagTransform=A(),Vt.setAttributes=I(),Vt.insert=S().bind(null,"head"),Vt.domAPI=T(),Vt.insertStyleElement=j(),x()(Ut.Z,Vt);const Zt=Ut.Z&&Ut.Z.locals?Ut.Z.locals:void 0;var Rt=function(){var e=r().useContext(v).values,t=(0,d.useTranslation)().t;return r().createElement("section",{className:Zt.formSection,"aria-label":"Death Info Section"},r().createElement("h5",{className:"omrs-type-title-5 ".concat(Zt.formSectionTitle)},"Death Info"),r().createElement("section",{className:Zt.fieldGroup},r().createElement(de,{labelText:t("isDeadInputLabel","Is Dead"),name:"isDead",id:"isDead"}),e.isDead&&r().createElement(r().Fragment,null,r().createElement(de,{labelText:t("deathDateInputLabel","Date of Death"),name:"deathDate",id:"deathDate"}),r().createElement(Lt,{options:[t("unknown","Unknown"),t("stroke","Stroke")],label:t("causeOfDeathInputLabel","Cause of Death"),name:"deathCause"}))))};function Ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Mt=function(e){var t,n,a=e.fields,o=(t=(0,m.U$)("addNameInLocalLanguage"),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ht(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)?Ht(e,t):void 0}}(t,n)||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.")}()),l=o[0],s=o[1],c=(0,i.useContext)(v).setFieldValue;return(0,i.useEffect)((function(){!l.value&&s.touched&&(c("additionalGivenName",""),c("additionalMiddleName",""),c("additionalFamilyName",""))}),[l.value,s.touched]),r().createElement("section",{className:Zt.formSection,"aria-label":"Demographics Section"},a.map((function(e){return r().createElement(At,{key:"demographics-".concat(e),name:e})})))},qt=n(1662),Gt={};Gt.styleTagTransform=A(),Gt.setAttributes=I(),Gt.insert=S().bind(null,"head"),Gt.domAPI=T(),Gt.insertStyleElement=j(),x()(qt.Z,Gt);const Wt=qt.Z&&qt.Z.locals?qt.Z.locals:void 0;function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Qt(){return Qt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Qt.apply(this,arguments)}var Kt=function(e){var t,n,a=e.getDisplayValue,l=e.getFieldValue,s=e.getSearchResults,c=e.onSuggestionSelected,u=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["getDisplayValue","getFieldValue","getSearchResults","onSuggestionSelected"]),_=(t=(0,i.useState)([]),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Yt(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)?Yt(e,t):void 0}}(t,n)||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.")}()),m=_[0],p=_[1],f=(0,i.useRef)(null),g=(0,i.useRef)(null),h=((0,d.useTranslation)().t,u.name),v=u.labelText;(0,i.useEffect)((function(){return document.addEventListener("mousedown",b),function(){document.removeEventListener("mousedown",b)}}),[g]);var b=function(e){g.current&&!g.current.contains(e.target)&&p([])};return r().createElement("div",{className:Wt.autocomplete,ref:g},r().createElement("label",{className:"cds--label"},v),r().createElement(o.mh4,null,r().createElement(o.olm,Qt({id:"autosuggest",onChange:function(e){var t=e.target.value;t?s(t).then((function(e){p(e)})):p([])},ref:f,className:Wt.autocompleteSearch},u))),m.length>0&&r().createElement("ul",{className:Wt.suggestions},m.map((function(e,t){return r().createElement("li",{key:t,onClick:function(e){return function(e){var t=a(m[e]),n=l(m[e]);f.current.value=t,c(h,n),p([])}(t)}},a(e))}))))},$t=n(138),Xt={};Xt.styleTagTransform=A(),Xt.setAttributes=I(),Xt.insert=S().bind(null,"head"),Xt.domAPI=T(),Xt.insertStyleElement=j(),x()($t.Z,Xt);const Jt=$t.Z&&$t.Z.locals?$t.Z.locals:void 0;function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function tn(e,t,n,i,r,a,o){try{var l=e[a](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,r)}function nn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rn=function(){var e,t,n=(0,i.useContext)(s.Cg).relationshipTypes,a=(e=(0,i.useState)([]),t=2,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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return en(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)?en(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.")}()),l=a[0],c=a[1],u=(0,d.useTranslation)().t;return(0,i.useEffect)((function(){if(n){var e=[];n.results.forEach((function(t){var n={display:t.aIsToB,uuid:t.uuid,direction:"aIsToB"},i={display:t.bIsToA,uuid:t.uuid,direction:"bIsToA"};n.display===i.display?e.push(n):e.push(n,i)})),c(e)}}),[n]),n?r().createElement("section",{"aria-label":"Relationships Section"},r().createElement(m.F2,{name:"relationships"},(function(e){var t=e.push,n=e.remove,i=e.form.values.relationships;return r().createElement("div",null,i&&i.length>0?i.map((function(e,t){return r().createElement("div",{key:t,className:Zt.formSection},r().createElement(an,{relationship:e,index:t,displayRelationshipTypes:l,key:t,remove:n}))})):null,r().createElement("div",{className:Jt.actions},r().createElement(o.zxk,{kind:"ghost",onClick:function(){return t({relatedPersonUuid:"",action:"ADD"})}},u("addRelationshipButtonText","Add Relationship"))))}))):r().createElement("section",{"aria-label":"Relationships Section"},r().createElement(o.N2B,null))},an=function(e){var t,n,a,l,s=e.relationship,c=e.index,_=e.displayRelationshipTypes,m=e.remove,p=(0,d.useTranslation)().t,f=r().useContext(v).setFieldValue,g=!s.uuid,h=(0,i.useCallback)((function(e){var t=e.target,n=t.name,i=t.options[t.selectedIndex].value;f(n,i),(null==s?void 0:s.action)||f("relationships[".concat(c,"].action"),"UPDATE")}),[]),b=(0,i.useCallback)((function(e,t){f(e,t)}),[]),w=(t=u().mark((function e(t){var n,i;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new AbortController,e.next=3,(0,y.M8)(t,n);case 3:return i=e.sent,e.abrupt("return",i.data.results);case 5:case"end":return e.stop()}}),e)})),n=function(){var e=this,n=arguments;return new Promise((function(i,r){var a=t.apply(e,n);function o(e){tn(a,i,r,o,l,"next",e)}function l(e){tn(a,i,r,o,l,"throw",e)}o(void 0)}))},function(e){return n.apply(this,arguments)}),E=(0,i.useCallback)((function(){"ADD"===s.action?m(c):f("relationships[".concat(c,"].action"),"DELETE")}),[s,c]),x=(0,i.useCallback)((function(){var e,t;f("relationships[".concat(c,"]"),(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){nn(e,t,n[t])}))}return e}({},s),t=null!=(t={action:void 0,relationshipType:s.initialrelationshipTypeValue})?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e))}),[c]);return"DELETE"!==s.action?r().createElement("div",{className:Jt.relationship},r().createElement("div",{className:Jt.searchBox},r().createElement("div",{className:Jt.relationshipHeader},r().createElement("h4",{className:Jt.productiveHeading},null!==(a=null==s?void 0:s.relation)&&void 0!==a?a:p("relationshipPlaceholder","Relationship")),r().createElement(o.zxk,{kind:"ghost",iconDescription:p("deleteRelationshipTooltipText","Delete"),hasIconOnly:!0,onClick:E},r().createElement(Me.ZN,{size:16,className:Jt.trashCan}))),r().createElement("div",null,g?r().createElement(Kt,{name:"relationships[".concat(c,"].relatedPersonUuid"),labelText:p("relativeFullNameLabelText","Full name"),placeholder:p("relativeNamePlaceholder","Firstname Familyname"),defaultValue:s.relatedPersonName,onSuggestionSelected:b,getSearchResults:w,getDisplayValue:function(e){return e.display},getFieldValue:function(e){return e.uuid},required:!0}):r().createElement(r().Fragment,null,r().createElement("span",{className:Jt.labelText},p("relativeFullNameLabelText","Full name")),r().createElement("p",{className:Jt.bodyShort02},s.relatedPersonName)))),r().createElement("div",{className:"".concat(Jt.selectRelationshipType),style:{marginBottom:"1rem"}},r().createElement(o.mh4,null,r().createElement(o.PhF,{id:"select",labelText:p("relationship","Relationship"),onChange:h,name:"relationships[".concat(c,"].relationshipType"),defaultValue:null!==(l=null==s?void 0:s.relationshipType)&&void 0!==l?l:"placeholder-item"},r().createElement(o.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:p("relationshipToPatient","Relationship to patient")}),_.map((function(e){return r().createElement(o.QlF,{text:e.display,value:"".concat(e.uuid,"/").concat(e.direction),key:e.display})})))))):r().createElement(o.K0D,{kind:"info",title:p("relationshipRemovedText","Relationship removed"),actions:r().createElement(o.xho,{onClick:x},p("restoreRelationshipActionButton","Undo"))})};function on(e){var t=e.sectionDefinition;switch(t.id){case"demographics":return r().createElement(Mt,{fields:t.fields});case"death":return r().createElement(Rt,null);case"relationships":return r().createElement(rn,null);default:return r().createElement(Dt,{sectionDefinition:t})}}var ln=function(e){var t=e.sectionDefinition,n=e.index,i=(0,d.useTranslation)().t;return r().createElement("div",{id:t.id},r().createElement("h3",{className:ce.productiveHeading02,style:{color:"#161616"}},n+1,". ",t.name),r().createElement("span",{className:ce.label01},i("allFieldsRequiredText","All fields are required unless marked optional")),r().createElement("div",{style:{margin:"1rem 0 1rem"}},r().createElement(o.n9L,null,r().createElement(on,{sectionDefinition:t}))))};function sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function cn(e){var t;return null===(t=e.split(window.getOpenmrsSpaBase()))||void 0===t?void 0:t[1]}const un=function(e){var t,n,r=e.when,a=e.redirect,o=(0,d.useTranslation)().t,s=(0,i.useRef)(!1),c=(t=(0,i.useState)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return sn(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)?sn(e,t):void 0}}(t,n)||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.")}()),u=c[0],_=c[1],m=u||a,p=(0,i.useCallback)((function(e){var t=o("discardModalBody","The changes you made to this patient's details have not been saved. Discard changes?");return e.preventDefault(),e.returnValue=t,t}),[o]),f=(0,i.useCallback)((function(e){if(!e.detail.navigationIsCanceled&&!s.current){s.current=!0,e.detail.cancelNavigation();var t=(0,l.showModal)("cancel-patient-edit-modal",{onConfirm:function(){_(e.detail.newUrl),t()}},(function(){s.current=!1}))}}),[]);return(0,i.useEffect)((function(){if(r&&void 0===m)return window.addEventListener("single-spa:before-routing-event",f),window.addEventListener("beforeunload",p),function(){window.removeEventListener("beforeunload",p),window.removeEventListener("single-spa:before-routing-event",f)}}),[m,r,p,f]),(0,i.useEffect)((function(){"string"==typeof m&&(0,l.navigate)({to:"${openmrsSpaBase}/".concat(cn(m))})}),[m]),null};function _n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function dn(e,t,n,i,r,a,o){try{var l=e[a](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,r)}function mn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){mn(e,t,n[t])}))}return e}function fn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function gn(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _n(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)?_n(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.")}()}var hn=function(e){var t,n,c=e.savePatientForm,f=e.isOffline,g=(0,i.useContext)(s.Cg),E=g.currentSession,x=g.addressTemplate,k=g.identifierTypes,T=(0,a.useLocation)().search,O=(0,l.useConfig)(),S=gn((0,i.useState)(),2),N=S[0],I=S[1],C=gn((0,i.useState)(h),2),j=C[0],P=C[1],A=(0,a.useParams)().patientUuid,D=(0,l.usePatient)(A),F=D.isLoading,B=D.patient,z=(0,d.useTranslation)().t,$=gn((0,i.useState)(null),2),X=$[0],ee=$[1],ae=gn(function(e){var t=(0,l.usePatient)(e),n=t.isLoading,r=t.patient,a=function(e){var t=!!e,n=(0,Q.ZP)(t?"/ws/rest/v1/person/".concat(e,"/attribute"):null,l.openmrsFetch),r=n.data,a=n.error,o=(0,i.useMemo)((function(){var e;return{data:null==r||null===(e=r.data)||void 0===e?void 0:e.results,isLoading:!r&&!a}}),[r,a]);return o}(e),o=a.data,s=a.isLoading,c=function(e){var t=!!e,n=(0,Q.ZP)(t?"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)"):null,l.openmrsFetch),r=n.data,a=n.error,o=(0,i.useMemo)((function(){var e,t,n={};return null==r||null===(e=r.data)||void 0===e||null===(t=e.results)||void 0===t||t.forEach((function(e){n[(0,U.Z)(e.identifierType.name)]={identifierUuid:e.uuid,preferred:e.preferred,initialValue:e.identifier,identifierValue:e.identifier,identifierTypeUuid:e.identifierType.uuid,identifierName:e.identifierType.name,required:e.identifierType.required,selectedSource:null,autoGeneration:!1}})),{data:n,isLoading:!r&&!a}}),[r,a]);return o}(e),_=c.data,d=c.isLoading,m=function(e){var t=!!e,n=(0,Q.ZP)(t?"/ws/rest/v1/relationship?v=".concat(K.UO,"&person=").concat(e):null,l.openmrsFetch),r=n.data,a=n.error,o=(0,i.useMemo)((function(){var t;return{data:null==r||null===(t=r.data)||void 0===t?void 0:t.results.map((function(t){return t.personA.uuid===e?{relatedPersonName:t.personB.display,relatedPersonUuid:t.personB.uuid,relation:t.relationshipType.bIsToA,relationshipType:"".concat(t.relationshipType.uuid,"/bIsToA"),initialrelationshipTypeValue:"".concat(t.relationshipType.uuid,"/bIsToA"),uuid:t.uuid}:{relatedPersonName:t.personA.display,relatedPersonUuid:t.personA.uuid,relation:t.relationshipType.aIsToB,relationshipType:"".concat(t.relationshipType.uuid,"/aIsToB"),initialrelationshipTypeValue:"".concat(t.relationshipType.uuid,"/aIsToB"),uuid:t.uuid}})),error:a,isLoading:!r&&!a}}),[e,r,a]);return o}(e),p=m.data,f=m.isLoading,g=ie((0,i.useState)({patientUuid:(0,w.Z)(),givenName:"",middleName:"",familyName:"",unidentifiedPatient:!1,additionalGivenName:"",additionalMiddleName:"",additionalFamilyName:"",addNameInLocalLanguage:!1,gender:"",birthdate:null,yearsEstimated:null,monthsEstimated:0,birthdateEstimated:!1,telephoneNumber:"",address1:"",address2:"",cityVillage:"",stateProvince:"",country:"",postalCode:"",isDead:!1,deathDate:"",deathCause:"",relationships:[],identifiers:{}}),2),h=g[0],v=g[1];return(0,i.useEffect)((function(){J(u().mark((function t(){var i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r){t.next=4;break}v(te({},h,(o=void 0,o={},l=(a=r).name[0],s=a.name[1],o.patientUuid=a.id,o.givenName=null==l?void 0:l.given[0],o.middleName=null==l?void 0:l.given[1],o.familyName=null==l?void 0:l.family,o.unidentifiedPatient="UNKNOWN"===l.given[0]&&"unknown"===l.family||void 0,o.addNameInLocalLanguage=!!s||void 0,o.additionalGivenName=null==s?void 0:s.given[0],o.additionalMiddleName=null==s?void 0:s.given[1],o.additionalFamilyName=null==s?void 0:s.family,o.gender=(0,V.Z)(a.gender),o.birthdate=a.birthDate?new Date(a.birthDate):void 0,o.telephoneNumber=a.telecom?a.telecom[0].value:"",(a.deceasedBoolean||a.deceasedDateTime)&&(o.isDead=!0,o.deathDate=a.deceasedDateTime?a.deceasedDateTime.split("T")[0]:""),H({},o,a.identifier.map((function(e){return R({},(0,U.Z)(e.system||e.type.text),e.value)})))),G(r),Y(r))),t.next=12;break;case 4:if(n||!e){t.next=12;break}return t.next=7,re(e);case 7:if((i=t.sent)._patientRegistrationData.formValues){t.next=11;break}return console.error("Found a queued offline patient registration for patient ".concat(e,", but without form values. Not using these values.")),t.abrupt("return");case 11:v(i._patientRegistrationData.formValues);case 12:case"end":return t.stop()}var a,o,l,s}),t)})))()}),[n,r,e]),(0,i.useEffect)((function(){!f&&p&&v((function(e){return ne(te({},e),{relationships:p})}))}),[f,p,v]),(0,i.useEffect)((function(){!d&&_&&v((function(e){return ne(te({},e),{identifiers:_})}))}),[d,_,v]),(0,i.useEffect)((function(){if(!s&&o){var e={};o.forEach((function(t){e[t.attributeType.uuid]=t.value})),v((function(t){return ne(te({},t),{attributes:e})}))}}),[o,v,s]),[h,v]}(A),2),le=ae[0],se=ae[1],ue=gn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),r=n.isLoading,a=n.patient,o=ie((0,i.useState)(t),2),s=o[0],c=o[1];return(0,i.useEffect)((function(){J(u().mark((function n(){var i,o;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!a){n.next=4;break}c(te({},s,G(a))),n.next=10;break;case 4:if(r||!e){n.next=10;break}return n.next=7,re(e);case 7:i=n.sent,c(null!==(o=null==i?void 0:i._patientRegistrationData.initialAddressFieldValues)&&void 0!==o?o:t);case 10:case"end":return n.stop()}}),n)})))()}),[r,a,e]),[s,c]}(A),1),_e=ue[0],de=gn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),r=n.isLoading,a=n.patient,o=ie((0,i.useState)(t),2),s=o[0],c=o[1];return(0,i.useEffect)((function(){if(a)c(te({},s,W(a)));else if(!r&&e){var n;re(e).then((function(e){return c(null!==(n=null==e?void 0:e._patientRegistrationData.initialAddressFieldValues)&&void 0!==n?n:t)}))}}),[r,a,e]),[s,c]}(A),1),me=de[0],pe=null==E||null===(t=E.sessionLocation)||void 0===t?void 0:t.uuid,fe=F?void 0:!(!A||!B),ge=(0,i.useMemo)((function(){return"true"===localStorage.getItem("openmrs:devtools")&&!fe}),[fe]),he=(0,y.Uu)(null==B?void 0:B.id).data,ve=(0,i.useRef)(new b.I),be=null==O||null===(n=O.fieldDefinitions)||void 0===n?void 0:n.filter((function(e){return"address"===e.type}));(0,i.useEffect)((function(){}),[le]);var ye=(0,i.useMemo)((function(){var e;return O.sections.map((function(t){return null!==(e=O.sectionDefinitions.filter((function(e){return e.id==t}))[0])&&void 0!==e?e:oe.bs.filter((function(e){return e.id==t}))[0]})).filter((function(e){return e}))}),[O.sections,O.sectionDefinitions]);(0,i.useEffect)((function(){if(x){var e=null==x?void 0:x.results[0].value;if(!e)return;var t=function(e){var t=(new DOMParser).parseFromString(e,"text/xml"),n=t.querySelector("nameMappings").getElementsByTagName("entry"),i=Array.prototype.map.call(n,(function(e){var n=e.getElementsByTagName("string")[0].innerHTML;return{name:n,label:e.getElementsByTagName("string")[1].innerHTML,regex:M(n,"elementRegex",t)||".*",regexFormat:M(n,"elementRegexFormats",t)||""}})),r=p.Ry(i.reduce((function(e,t){return e[t.name]=p.Z_().matches(t.regex,t.regexFormat),e}),{}));return{addressFieldValues:Array.prototype.map.call(n,(function(e){return{name:e.getElementsByTagName("string")[0].innerHTML,defaultValue:""}})),addressValidationSchema:r}}(e),n=t.addressFieldValues,i=t.addressValidationSchema;if(P((function(e){return e.concat(i)})),!1===fe){var r=!0,a=!1,o=void 0;try{for(var l,s=n[Symbol.iterator]();!(r=(l=s.next()).done);r=!0){var c=l.value,u=c.name,_=c.defaultValue;_e[u]||(_e[u]=_)}}catch(e){a=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}null==be||be.map((function(e){return _e[e.id]=""})),se(pn({},le,_e))}}}),[fe,x,_e]);var we,Ee,xe=(we=u().mark((function e(t,n){var i,r,a,o,s,_,d,m;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=new AbortController,n.setSubmitting(!0),r=fn(pn({},t),{identifiers:(u=t.identifiers,Object.fromEntries(Object.entries(u).filter((function(e){var t,n,i=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Z(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)?Z(e,t):void 0}}(t,n)||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.")}());return i[0],void 0!==i[1].identifierValue}))))}),e.prev=3,e.next=6,c(!fe,r,me,_e,X,pe,le.identifiers,E,O,ve.current,i);case 6:(0,l.showToast)({description:fe?z("updationSuccessToastDescription","The patient's information has been successfully updated"):z("registrationSuccessToastDescription","The patient can now be found by searching for them using their name or ID number"),title:fe?z("updationSuccessToastTitle","Patient Details Updated"):z("registrationSuccessToastTitle","New Patient Created"),kind:"success"}),a=new URLSearchParams(T).get("afterUrl"),o=(0,l.interpolateUrl)(a||O.links.submitButton,{patientUuid:t.patientUuid}),I(o),e.next=17;break;case 12:e.prev=12,e.t0=e.catch(3),(null===(s=e.t0.responseBody)||void 0===s||null===(_=s.error)||void 0===_?void 0:_.globalErrors)?e.t0.responseBody.error.globalErrors.forEach((function(e){(0,l.showToast)({description:e.message})})):(null===(d=e.t0.responseBody)||void 0===d||null===(m=d.error)||void 0===m?void 0:m.message)?(0,l.showToast)({description:e.t0.responseBody.error.message}):(0,l.createErrorHandler)()(e.t0),n.setSubmitting(!1);case 17:case"end":return e.stop()}var u}),e,null,[[3,12]])})),Ee=function(){var e=this,t=arguments;return new Promise((function(n,i){var r=we.apply(e,t);function a(e){dn(r,n,i,a,o,"next",e)}function o(e){dn(r,n,i,a,o,"throw",e)}a(void 0)}))},function(e,t){return Ee.apply(this,arguments)}),ke=function(e){return r().createElement("div",null,r().createElement("p",null,z("fieldErrorTitleMessage","The following fields have errors:")),r().createElement("ul",{style:{listStyle:"inside"}},Object.keys(e).map((function(e,t){return r().createElement("li",{key:t},z("".concat(e,"LabelText"),e))}))))};return r().createElement(m.J9,{enableReinitialize:!0,initialValues:le,validationSchema:j,onSubmit:xe},(function(e){return r().createElement(m.l0,{className:ce.form},r().createElement(un,{when:e.dirty,redirect:N}),r().createElement("div",{className:ce.formContainer},r().createElement("div",null,r().createElement("div",{className:ce.stickyColumn},r().createElement("h4",null,fe?z("edit","Edit"):z("createNew","Create New")," ",z("patient","Patient")),ge&&r().createElement(L,{setValues:e.setValues}),r().createElement("p",{className:ce.label01},z("jumpTo","Jump to")),ye.map((function(e){return r().createElement("div",{className:"".concat(ce.space05," ").concat(ce.touchTarget),key:e.name},r().createElement(o.rUS,{className:ce.linkName,onClick:function(){return t=e.id,void document.getElementById(t).scrollIntoView({behavior:"smooth",block:"center",inline:"center"});var t}},r().createElement(_.Kc,{size:16})," ",e.name))})),r().createElement(o.zxk,{className:ce.submitButton,type:"submit",onClick:function(){return e.validateForm().then((function(e){return function(e){e&&"object"==typeof e&&Object.keys(e).length&&(0,l.showToast)({description:ke(e),title:z("incompleteForm","Incomplete form"),kind:"warning"})}(e)}))},disabled:!E||!k},fe?z("updatePatient","Update Patient"):z("registerPatient","Register Patient")),r().createElement(o.zxk,{className:ce.cancelButton,kind:"tertiary",onClick:q},z("cancel","Cancel")))),r().createElement("div",{className:ce.infoGrid},r().createElement(v.Provider,{value:{identifierTypes:k,validationSchema:j,setValidationSchema:P,values:e.values,inEditMode:fe,setFieldValue:e.setFieldValue,setCapturePhotoProps:ee,currentPhoto:null==he?void 0:he.imageSrc,isOffline:f,initialFormValues:e.initialValues}},ye.map((function(e,t){return r().createElement(ln,{key:"registration-section-".concat(e.id),sectionDefinition:e,index:t})}))))))}))},vn=n(4954),bn={};bn.styleTagTransform=A(),bn.setAttributes=I(),bn.insert=S().bind(null,"head"),bn.domAPI=T(),bn.insertStyleElement=j(),x()(vn.Z,bn);const yn=vn.Z&&vn.Z.locals?vn.Z.locals:void 0;function wn(e){var t=e.savePatientForm,n=e.isOffline,i=(0,l.useSession)(),c=(0,Q.ZP)("patientRegistrationAddressTemplate",s.Te).data,u=(0,Q.ZP)("patientRegistrationRelationshipTypes",s.mt).data,_=(0,Q.ZP)("patientRegistrationPatientIdentifiers",s.St).data;return r().createElement("main",{className:"omrs-main-content ".concat(yn.root)},r().createElement(o.rjZ,{className:yn.grid},r().createElement(o.X2j,null,r().createElement(l.ExtensionSlot,{extensionSlotName:"breadcrumbs-slot"})),r().createElement(s.Cg.Provider,{value:{addressTemplate:c,relationshipTypes:u,identifierTypes:_,currentSession:i}},r().createElement(a.BrowserRouter,{basename:"".concat(window.getOpenmrsSpaBase(),"patient-registration")},r().createElement(a.Routes,null,r().createElement(a.Route,{path:"",element:r().createElement(hn,{savePatientForm:t,isOffline:n})}),r().createElement(a.Route,{path:"/patient/:patientUuid/edit",element:r().createElement(hn,{savePatientForm:t,isOffline:n})}))))))}}}]);
1
+ "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[859],{1098:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__field__productiveHeading02___0\\+2Gm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-registration__field__productiveHeading02Light___bbKeq{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-bottom:1rem;color:#525252}.-esm-patient-registration__field__label01___6YyKZ{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-registration__field__grid___g21pQ{display:grid;grid-template-columns:1fr 1fr;column-gap:1rem}.-esm-patient-registration__field__halfWidthInDesktopView___J9cO8{width:calc(50% - 1rem)}.-esm-patient-registration__field__patientPhoto___9mWMr{display:flex;justify-content:center}.-esm-patient-registration__field__nameField___uPmod{grid-row:1;grid-column:1}.-esm-patient-registration__field__nameField___uPmod>.cds--content-switcher{display:grid;grid-template-columns:1fr 1fr;width:max-content;justify-content:flex-start}.-esm-patient-registration__field__contentSwitcher___G7dTq{margin-bottom:1rem}.-esm-patient-registration__field__dobField___P6SHd>.cds--content-switcher{display:grid;grid-template-columns:1fr 1fr;width:max-content;justify-content:flex-start}.-esm-patient-registration__field__photoExtension___IqCnX{margin-bottom:1rem;grid-row:1;grid-column:2;justify-self:center}.-esm-patient-registration__field__sexField___F8TIv,.-esm-patient-registration__field__dobField___P6SHd{margin-bottom:1rem}.-esm-patient-registration__field__dobContentSwitcherLabel___vW\\+UB{margin-bottom:.5rem}.-esm-patient-registration__field__identifierLabelText___bdyJF{display:flex;align-items:center}.-esm-patient-registration__field__setIDNumberButton___XziAX{margin-bottom:1rem}.-esm-patient-registration__field__setIDNumberButton___XziAX>svg{margin-left:.5rem}.-esm-patient-registration__field__customField___40yP4{margin-bottom:1rem}.-esm-patient-registration__field__attributeField___qdljB{margin-bottom:1rem}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__grid___g21pQ{grid-template-columns:1fr;grid-template-rows:auto auto}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__nameField___uPmod{grid-row:2;grid-column:1}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__photoExtension___IqCnX{grid-column:1;grid-row:1;justify-self:start}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__radioButton___d7GuU label{height:3rem !important}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__halfWidthInDesktopView___J9cO8{width:100%}.-esm-patient-registration__field__radioFieldError___LyxW0{color:#da1e28;display:block;font-weight:400;max-height:12.5rem;overflow:visible;font-size:.75rem;letter-spacing:.32px;line-height:1.34;margin:.25rem 0 0}",""]),r.locals={productiveHeading02:"-esm-patient-registration__field__productiveHeading02___0+2Gm",productiveHeading02Light:"-esm-patient-registration__field__productiveHeading02Light___bbKeq",label01:"-esm-patient-registration__field__label01___6YyKZ",grid:"-esm-patient-registration__field__grid___g21pQ",halfWidthInDesktopView:"-esm-patient-registration__field__halfWidthInDesktopView___J9cO8",patientPhoto:"-esm-patient-registration__field__patientPhoto___9mWMr",nameField:"-esm-patient-registration__field__nameField___uPmod",contentSwitcher:"-esm-patient-registration__field__contentSwitcher___G7dTq",dobField:"-esm-patient-registration__field__dobField___P6SHd",photoExtension:"-esm-patient-registration__field__photoExtension___IqCnX",sexField:"-esm-patient-registration__field__sexField___F8TIv",dobContentSwitcherLabel:"-esm-patient-registration__field__dobContentSwitcherLabel___vW+UB",identifierLabelText:"-esm-patient-registration__field__identifierLabelText___bdyJF",setIDNumberButton:"-esm-patient-registration__field__setIDNumberButton___XziAX",customField:"-esm-patient-registration__field__customField___40yP4",attributeField:"-esm-patient-registration__field__attributeField___qdljB",radioButton:"-esm-patient-registration__field__radioButton___d7GuU",radioFieldError:"-esm-patient-registration__field__radioFieldError___LyxW0"};const a=r},3433:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__identifier-selection__title___fPIy3{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__identifier-selection__submit___WgYnV{width:250px}.-esm-patient-registration__identifier-selection__submit___WgYnV:hover{cursor:pointer}.-esm-patient-registration__identifier-selection__cancelButton___ar-za{width:11.688rem}.-esm-patient-registration__identifier-selection__submitButton___mJgTx{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__identifier-selection__infoGrid___5ovdR{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__identifier-selection__label01___sm7Rq{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__identifier-selection__productiveHeading02___aocJ0{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__identifier-selection__space05___pbxiU{margin:1rem 0 1rem 0}.-esm-patient-registration__identifier-selection__formContainer___XacnD{display:flex;width:100%}.-esm-patient-registration__identifier-selection__stickyColumn___H9Wbn{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__identifier-selection__touchTarget___heOv2 a:active{color:#161616}.-esm-patient-registration__identifier-selection__linkName___oKi4d{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__identifier-selection__linkName___oKi4d:active{text-decoration:none;color:#161616}.-esm-patient-registration__identifier-selection__linkName___oKi4d:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__identifier-selection__main___s9KQc{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__identifier-selection__infoGrid___5ovdR{max-width:unset}.-esm-patient-registration__identifier-selection__button___08VWQ{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-registration__identifier-selection__tablet___mHt6H{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-registration__identifier-selection__desktop___VkI9z{padding:0rem}.-esm-patient-registration__identifier-selection__radioGroup___n\\+7PW{background-color:#f4f4f4;padding:1rem}.-esm-patient-registration__identifier-selection__radioButton___yaoFj{margin:0 !important}.-esm-patient-registration__identifier-selection__radioButton___yaoFj label{height:2rem}.omrs-breakpoint-lt-desktop .-esm-patient-registration__identifier-selection__radioButton___yaoFj label{height:3rem !important}",""]),r.locals={title:"-esm-patient-registration__identifier-selection__title___fPIy3",submit:"-esm-patient-registration__identifier-selection__submit___WgYnV",cancelButton:"-esm-patient-registration__identifier-selection__cancelButton___ar-za",submitButton:"-esm-patient-registration__identifier-selection__submitButton___mJgTx",infoGrid:"-esm-patient-registration__identifier-selection__infoGrid___5ovdR",label01:"-esm-patient-registration__identifier-selection__label01___sm7Rq",productiveHeading02:"-esm-patient-registration__identifier-selection__productiveHeading02___aocJ0",space05:"-esm-patient-registration__identifier-selection__space05___pbxiU",formContainer:"-esm-patient-registration__identifier-selection__formContainer___XacnD",stickyColumn:"-esm-patient-registration__identifier-selection__stickyColumn___H9Wbn",touchTarget:"-esm-patient-registration__identifier-selection__touchTarget___heOv2",linkName:"-esm-patient-registration__identifier-selection__linkName___oKi4d",main:"-esm-patient-registration__identifier-selection__main___s9KQc",button:"-esm-patient-registration__identifier-selection__button___08VWQ",tablet:"-esm-patient-registration__identifier-selection__tablet___mHt6H",desktop:"-esm-patient-registration__identifier-selection__desktop___VkI9z",radioGroup:"-esm-patient-registration__identifier-selection__radioGroup___n+7PW",radioButton:"-esm-patient-registration__identifier-selection__radioButton___yaoFj"};const a=r},1662:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__autosuggest__label01___f95oj{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-registration__autosuggest__suggestions___v5o3w{position:relative;border-top-width:0;list-style:none;margin-top:0;max-height:143px;overflow-y:auto;padding-left:0;width:100%;position:absolute;left:0;background-color:#fff;margin-bottom:20px;z-index:99}.-esm-patient-registration__autosuggest__suggestions___v5o3w li{padding:1rem;line-height:1.29;color:#525252;border-bottom:1px solid #8d8d8d}.-esm-patient-registration__autosuggest__suggestions___v5o3w li:hover{background-color:#e5e5e5;color:#161616;cursor:pointer}.-esm-patient-registration__autosuggest__suggestions___v5o3w li:not(:last-of-type){border-bottom:1px solid #999}.-esm-patient-registration__autosuggest__autocomplete___it56z{position:relative}.-esm-patient-registration__autosuggest__autocompleteSearch___sc5fh{width:100%}.-esm-patient-registration__autosuggest__suggestions___v5o3w a{color:inherit;text-decoration:none}",""]),r.locals={label01:"-esm-patient-registration__autosuggest__label01___f95oj",suggestions:"-esm-patient-registration__autosuggest__suggestions___v5o3w",autocomplete:"-esm-patient-registration__autosuggest__autocomplete___it56z",autocompleteSearch:"-esm-patient-registration__autosuggest__autocompleteSearch___sc5fh"};const a=r},4939:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__input__title___4PKlg{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__input__submit___mloB4{width:250px}.-esm-patient-registration__input__submit___mloB4:hover{cursor:pointer}.-esm-patient-registration__input__cancelButton___blAcs{width:11.688rem}.-esm-patient-registration__input__submitButton___SofD2{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__input__infoGrid___xohlq{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__input__label01___fwQQq{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__input__productiveHeading02___7pE9K{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__input__space05___9oNC\\+{margin:1rem 0 1rem 0}.-esm-patient-registration__input__formContainer___YE8UP{display:flex;width:100%}.-esm-patient-registration__input__stickyColumn___KQudo{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__input__touchTarget___lFvgc a:active{color:#161616}.-esm-patient-registration__input__linkName___C8vKy{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__input__linkName___C8vKy:active{text-decoration:none;color:#161616}.-esm-patient-registration__input__linkName___C8vKy:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__input__main___rng6t{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__input__infoGrid___xohlq{max-width:unset}.-esm-patient-registration__input__fieldRow___5TD7U{display:flex;flex-direction:row;justify-content:flex-start;flex-wrap:wrap}.-esm-patient-registration__input__subFieldRow___zGAH4{margin-bottom:5px}.-esm-patient-registration__input__label___65tRW{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252}.-esm-patient-registration__input__textID___F\\+F-t{margin-bottom:1rem}.-esm-patient-registration__input__requiredField___x0TVf{color:#da1e28}.-esm-patient-registration__input__input___JYX4d{margin-right:5px}.-esm-patient-registration__input__checkboxField___gmx7u{display:flex;flex-direction:row;justify-content:flex-start;width:400px;margin-left:10px}.-esm-patient-registration__input__textInput___QJYjz{width:250px !important;height:40px !important}.-esm-patient-registration__input__numberInput___IGlx4{width:200px !important;height:40px !important}.-esm-patient-registration__input__checkboxInput___IVRIk{height:1.5rem !important;width:1.5rem !important;margin-top:8px}.-esm-patient-registration__input__selectInput___yrzZ-{width:150px !important;height:40px !important}.-esm-patient-registration__input__dateInput___2shrY{width:200px !important;height:40px !important;font-size:large !important}.-esm-patient-registration__input__telInput___HxQe3{width:250px !important;height:40px !important}.-esm-patient-registration__input__errorInput___aW2qL{border:2px solid #da1e28 !important;padding-left:.875rem !important}.-esm-patient-registration__input__errorMessage___cbdW2{color:#da1e28;align-self:center}.-esm-patient-registration__input__dummyData___GFQGF{cursor:pointer;margin-left:5px}.-esm-patient-registration__input__IDInput___6B3\\+s{display:grid;grid-template-columns:1fr auto;align-items:center;max-width:27rem}.-esm-patient-registration__input__trashCan___usc53{color:#da1e28}.omrs-breakpoint-lt-desktop .-esm-patient-registration__input__IDInput___6B3\\+s{max-width:unset;width:100%}.-esm-patient-registration__input__dangerLabel01___sb6Np{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#da1e28}",""]),r.locals={title:"-esm-patient-registration__input__title___4PKlg",submit:"-esm-patient-registration__input__submit___mloB4",cancelButton:"-esm-patient-registration__input__cancelButton___blAcs",submitButton:"-esm-patient-registration__input__submitButton___SofD2",infoGrid:"-esm-patient-registration__input__infoGrid___xohlq",label01:"-esm-patient-registration__input__label01___fwQQq",productiveHeading02:"-esm-patient-registration__input__productiveHeading02___7pE9K",space05:"-esm-patient-registration__input__space05___9oNC+",formContainer:"-esm-patient-registration__input__formContainer___YE8UP",stickyColumn:"-esm-patient-registration__input__stickyColumn___KQudo",touchTarget:"-esm-patient-registration__input__touchTarget___lFvgc",linkName:"-esm-patient-registration__input__linkName___C8vKy",main:"-esm-patient-registration__input__main___rng6t",fieldRow:"-esm-patient-registration__input__fieldRow___5TD7U",subFieldRow:"-esm-patient-registration__input__subFieldRow___zGAH4",label:"-esm-patient-registration__input__label___65tRW",textID:"-esm-patient-registration__input__textID___F+F-t",requiredField:"-esm-patient-registration__input__requiredField___x0TVf",input:"-esm-patient-registration__input__input___JYX4d",checkboxField:"-esm-patient-registration__input__checkboxField___gmx7u",textInput:"-esm-patient-registration__input__textInput___QJYjz",numberInput:"-esm-patient-registration__input__numberInput___IGlx4",checkboxInput:"-esm-patient-registration__input__checkboxInput___IVRIk",selectInput:"-esm-patient-registration__input__selectInput___yrzZ-",dateInput:"-esm-patient-registration__input__dateInput___2shrY",telInput:"-esm-patient-registration__input__telInput___HxQe3",errorInput:"-esm-patient-registration__input__errorInput___aW2qL",errorMessage:"-esm-patient-registration__input__errorMessage___cbdW2",dummyData:"-esm-patient-registration__input__dummyData___GFQGF",IDInput:"-esm-patient-registration__input__IDInput___6B3+s",trashCan:"-esm-patient-registration__input__trashCan___usc53",dangerLabel01:"-esm-patient-registration__input__dangerLabel01___sb6Np"};const a=r},1093:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__patient-registration__title___d6s20{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__patient-registration__submit___S6frc{width:250px}.-esm-patient-registration__patient-registration__submit___S6frc:hover{cursor:pointer}.-esm-patient-registration__patient-registration__cancelButton___2-E\\+5{width:11.688rem}.-esm-patient-registration__patient-registration__submitButton___Ps1do{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__patient-registration__infoGrid___2S1kw{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__patient-registration__label01___CxOgi{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__patient-registration__productiveHeading02___mBDux{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__patient-registration__space05___\\+IJfn{margin:1rem 0 1rem 0}.-esm-patient-registration__patient-registration__formContainer___ydkLz{display:flex;width:100%}.-esm-patient-registration__patient-registration__stickyColumn___2G55G{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__patient-registration__touchTarget___KxfOv a:active{color:#161616}.-esm-patient-registration__patient-registration__linkName___Ukv7z{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__patient-registration__linkName___Ukv7z:active{text-decoration:none;color:#161616}.-esm-patient-registration__patient-registration__linkName___Ukv7z:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__patient-registration__main___eiIwY{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__patient-registration__infoGrid___2S1kw{max-width:unset}",""]),r.locals={title:"-esm-patient-registration__patient-registration__title___d6s20",submit:"-esm-patient-registration__patient-registration__submit___S6frc",cancelButton:"-esm-patient-registration__patient-registration__cancelButton___2-E+5",submitButton:"-esm-patient-registration__patient-registration__submitButton___Ps1do",infoGrid:"-esm-patient-registration__patient-registration__infoGrid___2S1kw",label01:"-esm-patient-registration__patient-registration__label01___CxOgi",productiveHeading02:"-esm-patient-registration__patient-registration__productiveHeading02___mBDux",space05:"-esm-patient-registration__patient-registration__space05___+IJfn",formContainer:"-esm-patient-registration__patient-registration__formContainer___ydkLz",stickyColumn:"-esm-patient-registration__patient-registration__stickyColumn___2G55G",touchTarget:"-esm-patient-registration__patient-registration__touchTarget___KxfOv",linkName:"-esm-patient-registration__patient-registration__linkName___Ukv7z",main:"-esm-patient-registration__patient-registration__main___eiIwY"};const a=r},138:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__relationships__title___zOYZm{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__relationships__submit___kNlmu{width:250px}.-esm-patient-registration__relationships__submit___kNlmu:hover{cursor:pointer}.-esm-patient-registration__relationships__cancelButton___cFt6p{width:11.688rem}.-esm-patient-registration__relationships__submitButton___CW8X\\+{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__relationships__infoGrid___9dg84{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__relationships__label01___TYH\\+i{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__relationships__productiveHeading02___PuSkg{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__relationships__space05___gWnMG{margin:1rem 0 1rem 0}.-esm-patient-registration__relationships__formContainer___U91DX{display:flex;width:100%}.-esm-patient-registration__relationships__stickyColumn___2cbAk{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__relationships__touchTarget___chVrk a:active{color:#161616}.-esm-patient-registration__relationships__linkName___M6KoQ{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__relationships__linkName___M6KoQ:active{text-decoration:none;color:#161616}.-esm-patient-registration__relationships__linkName___M6KoQ:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__relationships__main___G8ux-{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__relationships__infoGrid___9dg84{max-width:unset}.-esm-patient-registration__relationships__labelText___hTuhj{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-registration__relationships__bodyShort02___hfBao{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0)}.-esm-patient-registration__relationships__searchBox___xY0Yt{margin-bottom:1rem}.-esm-patient-registration__relationships__relationshipHeader___2w\\+Ew{display:flex;align-items:center}.-esm-patient-registration__relationships__productiveHeading___IiVgd{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-patient-registration__relationships__trashCan___nBYrg{color:#da1e28 !important}.omrs-breakpoint-lt-desktop .-esm-patient-registration__relationships__relationshipHeader___2w\\+Ew{justify-content:space-between}",""]),r.locals={title:"-esm-patient-registration__relationships__title___zOYZm",submit:"-esm-patient-registration__relationships__submit___kNlmu",cancelButton:"-esm-patient-registration__relationships__cancelButton___cFt6p",submitButton:"-esm-patient-registration__relationships__submitButton___CW8X+",infoGrid:"-esm-patient-registration__relationships__infoGrid___9dg84",label01:"-esm-patient-registration__relationships__label01___TYH+i",productiveHeading02:"-esm-patient-registration__relationships__productiveHeading02___PuSkg",space05:"-esm-patient-registration__relationships__space05___gWnMG",formContainer:"-esm-patient-registration__relationships__formContainer___U91DX",stickyColumn:"-esm-patient-registration__relationships__stickyColumn___2cbAk",touchTarget:"-esm-patient-registration__relationships__touchTarget___chVrk",linkName:"-esm-patient-registration__relationships__linkName___M6KoQ",main:"-esm-patient-registration__relationships__main___G8ux-",labelText:"-esm-patient-registration__relationships__labelText___hTuhj",bodyShort02:"-esm-patient-registration__relationships__bodyShort02___hfBao",searchBox:"-esm-patient-registration__relationships__searchBox___xY0Yt",relationshipHeader:"-esm-patient-registration__relationships__relationshipHeader___2w+Ew",productiveHeading:"-esm-patient-registration__relationships__productiveHeading___IiVgd",trashCan:"-esm-patient-registration__relationships__trashCan___nBYrg"};const a=r},2936:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__section__title___WE522{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__section__submit___ZCyMT{width:250px}.-esm-patient-registration__section__submit___ZCyMT:hover{cursor:pointer}.-esm-patient-registration__section__cancelButton___BtWcr{width:11.688rem}.-esm-patient-registration__section__submitButton___SX3tz{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__section__infoGrid___m6EFv{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__section__label01___SB4dO{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__section__productiveHeading02___0Qr6X{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__section__space05___\\+I97l{margin:1rem 0 1rem 0}.-esm-patient-registration__section__formContainer___bUz8M{display:flex;width:100%}.-esm-patient-registration__section__stickyColumn___e3QEm{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__section__touchTarget___ubpCE a:active{color:#161616}.-esm-patient-registration__section__linkName___NOqjy{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__section__linkName___NOqjy:active{text-decoration:none;color:#161616}.-esm-patient-registration__section__linkName___NOqjy:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__section__main___3eHUo{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__section__infoGrid___m6EFv{max-width:unset}",""]),r.locals={title:"-esm-patient-registration__section__title___WE522",submit:"-esm-patient-registration__section__submit___ZCyMT",cancelButton:"-esm-patient-registration__section__cancelButton___BtWcr",submitButton:"-esm-patient-registration__section__submitButton___SX3tz",infoGrid:"-esm-patient-registration__section__infoGrid___m6EFv",label01:"-esm-patient-registration__section__label01___SB4dO",productiveHeading02:"-esm-patient-registration__section__productiveHeading02___0Qr6X",space05:"-esm-patient-registration__section__space05___+I97l",formContainer:"-esm-patient-registration__section__formContainer___bUz8M",stickyColumn:"-esm-patient-registration__section__stickyColumn___e3QEm",touchTarget:"-esm-patient-registration__section__touchTarget___ubpCE",linkName:"-esm-patient-registration__section__linkName___NOqjy",main:"-esm-patient-registration__section__main___3eHUo"};const a=r},7857:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__overlay__title___ovEFv{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__overlay__submit___MEU04{width:250px}.-esm-patient-registration__overlay__submit___MEU04:hover{cursor:pointer}.-esm-patient-registration__overlay__cancelButton___Kuq8k{width:11.688rem}.-esm-patient-registration__overlay__submitButton___koip2{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__overlay__infoGrid___IR-lJ{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__overlay__label01___UFjWe{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-top:1rem;margin-bottom:1rem;color:#8d8d8d}.-esm-patient-registration__overlay__productiveHeading02___0-7g8{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#8d8d8d;cursor:pointer}.-esm-patient-registration__overlay__space05___3-aCf{margin:1rem 0 1rem 0}.-esm-patient-registration__overlay__formContainer___0etfN{display:flex;width:100%}.-esm-patient-registration__overlay__stickyColumn___ZAq3J{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__overlay__touchTarget___eSQ3o a:active{color:#161616}.-esm-patient-registration__overlay__linkName___Kol4j{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__overlay__linkName___Kol4j:active{text-decoration:none;color:#161616}.-esm-patient-registration__overlay__linkName___Kol4j:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__overlay__main___pCgsu{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__overlay__infoGrid___IR-lJ{max-width:unset}.-esm-patient-registration__overlay__desktopOverlay___pTy0O{position:fixed;top:3rem;right:0;height:calc(100vh - 3rem);min-width:27rem;background-color:#fff;border-left:1px solid #a8a8a8;overflow:hidden;display:grid;grid-template-rows:auto 1fr auto;z-index:999}.-esm-patient-registration__overlay__tabletOverlay___\\+CQze{position:fixed;top:0;bottom:0;left:0;right:0;z-index:9999;background-color:#fff;overflow:hidden;padding-top:3rem;display:grid;grid-template-rows:1fr auto}.-esm-patient-registration__overlay__tabletOverlayHeader___omtl4 button{background-color:#005d5d !important}.-esm-patient-registration__overlay__tabletOverlayHeader___omtl4 .-esm-patient-registration__overlay__headerContent___S7vPL{color:#fff}.-esm-patient-registration__overlay__desktopHeader___X3NCa{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8}.-esm-patient-registration__overlay__headerContent___S7vPL{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);padding:0 1rem;color:#161616}.-esm-patient-registration__overlay__closeButton___8Pcw1{background-color:#fff}.-esm-patient-registration__overlay__overlayContent___9V2UN{padding:1rem;overflow-y:auto}",""]),r.locals={title:"-esm-patient-registration__overlay__title___ovEFv",submit:"-esm-patient-registration__overlay__submit___MEU04",cancelButton:"-esm-patient-registration__overlay__cancelButton___Kuq8k",submitButton:"-esm-patient-registration__overlay__submitButton___koip2",infoGrid:"-esm-patient-registration__overlay__infoGrid___IR-lJ",label01:"-esm-patient-registration__overlay__label01___UFjWe",productiveHeading02:"-esm-patient-registration__overlay__productiveHeading02___0-7g8",space05:"-esm-patient-registration__overlay__space05___3-aCf",formContainer:"-esm-patient-registration__overlay__formContainer___0etfN",stickyColumn:"-esm-patient-registration__overlay__stickyColumn___ZAq3J",touchTarget:"-esm-patient-registration__overlay__touchTarget___eSQ3o",linkName:"-esm-patient-registration__overlay__linkName___Kol4j",main:"-esm-patient-registration__overlay__main___pCgsu",desktopOverlay:"-esm-patient-registration__overlay__desktopOverlay___pTy0O",tabletOverlay:"-esm-patient-registration__overlay__tabletOverlay___+CQze",tabletOverlayHeader:"-esm-patient-registration__overlay__tabletOverlayHeader___omtl4",headerContent:"-esm-patient-registration__overlay__headerContent___S7vPL",desktopHeader:"-esm-patient-registration__overlay__desktopHeader___X3NCa",closeButton:"-esm-patient-registration__overlay__closeButton___8Pcw1",overlayContent:"-esm-patient-registration__overlay__overlayContent___9V2UN"};const a=r},4954:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2609),r=n.n(i)()((function(e){return e[1]}));r.push([e.id,".-esm-patient-registration__root__root___msybz{background-color:#fff}.-esm-patient-registration__root__grid___p9P\\+g{grid-template-columns:repeat(1, minmax(0, 1fr))}",""]),r.locals={root:"-esm-patient-registration__root__root___msybz",grid:"-esm-patient-registration__root__grid___p9P+g"};const a=r},1859:(e,t,n)=>{n.r(t),n.d(t,{default:()=>wn});var i=n(268),r=n.n(i),a=n(7228),o=n(2767),l=n(906),s=n(6279),c=n(5047),u=n.n(c),_=n(781),d=n(4924),m=n(7065),p=n(6794),f=n(4519),g=n.n(f),h=p.Ry({givenName:p.Z_().required("givenNameRequired"),familyName:p.Z_().required("familyNameRequired"),additionalGivenName:p.Z_().when("addNameInLocalLanguage",{is:!0,then:p.Z_().required("givenNameRequired"),otherwise:p.Z_().notRequired()}),additionalFamilyName:p.Z_().when("addNameInLocalLanguage",{is:!0,then:p.Z_().required("familyNameRequired"),otherwise:p.Z_().notRequired()}),gender:p.Z_().oneOf(["Male","Female","Other","Unknown"],"genderUnspecified").required("genderRequired"),birthdate:p.hT().when("birthdateEstimated",{is:!1,then:p.hT().required("birthdayRequired").max(Date(),"birthdayNotInTheFuture").nullable(),otherwise:p.hT().nullable()}),yearsEstimated:p.Rx().when("birthdateEstimated",{is:!0,then:p.Rx().required("yearsEstimateRequired").min(0,"negativeYears"),otherwise:p.Rx().nullable()}),monthsEstimated:p.Rx().min(0,"negativeMonths"),deathDate:p.hT().max(Date(),"deathdayNotInTheFuture").nullable(),email:p.Z_().optional().email("invalidEmail"),identifiers:p.Vo((function(e){return p.Ry(g()(e,(function(){return p.Ry({required:p.Xg(),identifierValue:p.Z_().when("required",{is:!0,then:p.Z_().required("identifierValueRequired"),otherwise:p.Z_().notRequired()})})})))}))}),v=(0,i.createContext)(void 0),b=n(3076),y=n(7117),w=n(9571),E=n(6062),x=n.n(E),k=n(4036),T=n.n(k),O=n(6793),S=n.n(O),N=n(7892),I=n.n(N),C=n(1173),j=n.n(C),P=n(2464),A=n.n(P),D=n(4939),F={};F.styleTagTransform=A(),F.setAttributes=I(),F.insert=S().bind(null,"head"),F.domAPI=T(),F.insertStyleElement=j(),x()(D.Z,F);const B=D.Z&&D.Z.locals?D.Z.locals:void 0;var z={patientUuid:(0,w.Z)(),givenName:"John",middleName:"",familyName:"Smith",unidentifiedPatient:!1,additionalGivenName:"Joey",additionalMiddleName:"",additionalFamilyName:"Smitty",addNameInLocalLanguage:!0,gender:"Male",birthdate:new Date(2020,1,1),yearsEstimated:1,monthsEstimated:2,birthdateEstimated:!0,telephoneNumber:"0800001066",address1:"Bom Jesus Street",address2:"",cityVillage:"Recife",stateProvince:"Pernambuco",country:"Brazil",postalCode:"50030-310",isDead:!1,deathDate:"",deathCause:"",relationships:[],identifiers:{}},L=function(e){var t=e.setValues;return r().createElement("main",null,r().createElement("button",{onClick:function(){return t(z)},className:"omrs-btn omrs-filled-neutral ".concat(B.dummyData),type:"button","aria-label":"Dummy Data Input"},"Input Dummy Data"))},U=n(2777),V=n(1525);function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){R(e,t,n[t])}))}return e}function M(e,t,n){var i,r,a;return null!==(a=null===(r=null===(i=n.querySelector(t))||void 0===i?void 0:i.querySelector("[name=".concat(e,"]")))||void 0===r?void 0:r.getAttribute("value"))&&void 0!==a?a:null}function q(){(0,l.navigate)({to:"".concat(window.spaBase,"/home")})}function G(e){var t,n={},i=null===(t=e.address)||void 0===t?void 0:t[0];if(i){var r=!0,a=!1,o=void 0;try{for(var l,s=Object.keys(i)[Symbol.iterator]();!(r=(l=s.next()).done);r=!0){var c=l.value;switch(c){case"city":n.cityVillage=i[c];break;case"state":n.stateProvince=i[c];break;case"district":n.countyDistrict=i[c];break;case"extension":i[c].forEach((function(e){e.extension.forEach((function(e){n[e.url.split("#")[1]]=e.valueString}))}));break;default:"country"!==c&&"postalCode"!==c||(n[c]=i[c])}}}catch(e){a=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}}return n}function W(e){var t,n=e.name[0],i=e.name[1],r=null===(t=e.address)||void 0===t?void 0:t[0];return H({preferredNameUuid:null==n?void 0:n.id,additionalNameUuid:null==i?void 0:i.id,preferredAddressUuid:null==r?void 0:r.id},e.identifier.map((function(e){return R({},(0,U.Z)(e.system||e.type.text),{uuid:e.id,value:e.value})})))}function Y(e){var t={};return e.telecom&&(t.phone=e.telecom[0].value),t}var Q=n(9857),K=n(8179);function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function X(e,t,n,i,r,a,o){try{var l=e[a](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,r)}function J(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){X(a,i,r,o,l,"next",e)}function l(e){X(a,i,r,o,l,"throw",e)}o(void 0)}))}}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){ee(e,t,n[t])}))}return e}function ne(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function ie(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $(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)?$(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 re(e){return ae.apply(this,arguments)}function ae(){return(ae=J(u().mark((function e(t){var n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.getSynchronizationItems)(K.Kt);case 2:return n=e.sent,e.abrupt("return",n.find((function(e){return e._patientRegistrationData.formValues.patientUuid===t})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var oe=n(225),le=n(1093),se={};se.styleTagTransform=A(),se.setAttributes=I(),se.insert=S().bind(null,"head"),se.domAPI=T(),se.insertStyleElement=j(),x()(le.Z,se);const ce=le.Z&&le.Z.locals?le.Z.locals:void 0;function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _e(){return _e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},_e.apply(this,arguments)}var de=function(e){var t,n,a=e.checkWarning,l=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["checkWarning"]),s=(t=(0,m.U$)(l.name),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ue(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)?ue(e,t):void 0}}(t,n)||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.")}()),c=s[0],u=s[1],_=(0,d.useTranslation)().t,p=c.value||"",f=u.error&&_(u.error),g=(0,i.useMemo)((function(){if(!f&&"function"==typeof a){var e=a(p);return e&&_(e)}}),[a,f,p,_]),h=l.required?l.labelText:"".concat(l.labelText," (").concat(_("optional","optional"),")");return r().createElement("div",{style:{marginBottom:"1rem"}},r().createElement(o.mh4,null,r().createElement(o.oil,_e({},l,c,{labelText:h,invalid:!(!u.touched||!u.error),invalidText:f,warn:!!g,warnText:g,value:p}))))},me=function(){var e=(0,d.useTranslation)().t;return r().createElement("div",null,r().createElement(de,{id:"phone",name:"attributes.14d4f066-15f5-102d-96e4-000c29c2a5d7",labelText:e("phoneNumberInputLabelText","Phone number"),light:!0}))},pe=n(1098),fe={};fe.styleTagTransform=A(),fe.setAttributes=I(),fe.insert=S().bind(null,"head"),fe.domAPI=T(),fe.insertStyleElement=j(),x()(pe.Z,fe);const ge=pe.Z&&pe.Z.locals?pe.Z.locals:void 0;var he=function(){var e=(0,d.useTranslation)().t;return r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},e("phoneEmailLabelText","Phone, Email")),r().createElement("div",{className:ge.grid},r().createElement(me,null),r().createElement(de,{id:"email",name:"attributes.ac7d7773-fe9f-11ec-8b9b-0242ac1b0002",labelText:e("emailLabelText","Email")})))};function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var be=/^([^0-9]*)$/;function ye(e){if(!be.test(e))return"numberInNameDubious"}var we=function(){var e,t,n=(0,d.useTranslation)().t,a=(0,i.useContext)(v),s=a.setCapturePhotoProps,c=a.currentPhoto,u=a.setFieldValue,_=(0,l.useConfig)().fieldConfigurations,p=null==_?void 0:_.name,f=!(e=(0,m.U$)("unidentifiedPatient"),t=1,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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ve(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)?ve(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.")}())[0].value,g=(0,i.useCallback)((function(e,t){s&&s({imageData:e,dateTime:t})}),[s]);return r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},n("fullNameLabelText","Full Name")),r().createElement("div",{className:ge.grid},r().createElement(l.ExtensionSlot,{className:ge.photoExtension,extensionSlotName:"capture-patient-photo-slot",state:{onCapturePhoto:g,initialState:c}}),r().createElement("div",{className:ge.nameField},r().createElement("div",{className:ge.dobContentSwitcherLabel},r().createElement("span",{className:ge.label01},n("patientNameKnown","Patient's Name is Known?"))),r().createElement(o.GHR,{className:ge.contentSwitcher,onChange:function(e){"known"===e.name?(u("givenName",""),u("familyName",""),u("unidentifiedPatient",!1)):(u("givenName",p.defaultUnknownGivenName),u("familyName",p.defaultUnknownFamilyName),u("unidentifiedPatient",!0))}},r().createElement(o.rsf,{name:"known",text:n("yes","Yes")}),r().createElement(o.rsf,{name:"unknown",text:n("no","No")})),f&&r().createElement(r().Fragment,null,r().createElement(de,{id:"givenName",name:"givenName",labelText:n("givenNameLabelText","First Name"),checkWarning:ye,required:!0}),p.displayMiddleName&&r().createElement(de,{id:"middleName",name:"middleName",labelText:n("middleNameLabelText","Middle Name"),light:!0,checkWarning:ye}),r().createElement(de,{id:"familyName",name:"familyName",labelText:n("familyNameLabelText","Family Name"),checkWarning:ye,required:!0})))))};function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var xe=function(){var e,t,n=(0,l.useConfig)().fieldConfigurations,a=(0,d.useTranslation)().t,s=(e=(0,m.U$)("gender"),t=2,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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ee(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)?Ee(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.")}()),c=s[0],u=s[1],_=(0,i.useContext)(v).setFieldValue,p=null==n?void 0:n.gender;return r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement("h4",{className:ge.productiveHeading02Light},a("sexFieldLabelText","Sex")),r().createElement("div",{className:ge.sexField},r().createElement("p",{className:"cds--label"},a("genderLabelText","Sex")),r().createElement(o.SYO,{name:"gender",orientation:"vertical",onChange:function(e){_("gender",e)},valueSelected:c.value},p.map((function(e){return r().createElement(o.EUY,{key:e.label,id:e.id,value:e.value,labelText:a("".concat(e.label),"".concat(e.label))})}))),u.touched&&u.error&&r().createElement("div",{className:ge.radioFieldError},a(u.error,"Gender is required"))))},ke=n(6759),Te=n(2074),Oe=n(7857),Se={};Se.styleTagTransform=A(),Se.setAttributes=I(),Se.insert=S().bind(null,"head"),Se.domAPI=T(),Se.insertStyleElement=j(),x()(Oe.Z,Se);const Ne=Oe.Z&&Oe.Z.locals?Oe.Z.locals:void 0;function Ie(){return Ie=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Ie.apply(this,arguments)}const Ce=function(e){var t=e.close,n=e.children,i=e.header,a=e.buttonsGroup,s=(0,d.useTranslation)().t,c=(0,l.useLayoutType)();return r().createElement("div",{className:(0,l.isDesktop)(c)?Ne.desktopOverlay:Ne.tabletOverlay},(0,l.isDesktop)(c)?r().createElement("div",{className:Ne.desktopHeader},r().createElement("div",{className:Ne.headerContent},i),r().createElement(o.zxk,{className:Ne.closeButton,iconDescription:s("closeOverlay","Close overlay"),onClick:t,kind:"ghost",hasIconOnly:!0,renderIcon:function(e){return r().createElement(Te.x8,Ie({size:16},e))}})):r().createElement(o.h4i,{className:Ne.tabletOverlayHeader},r().createElement(o.zxk,{kind:"ghost",onClick:t,hasIconOnly:!0,iconDescription:s("closeOverlay","Close overlay"),renderIcon:function(e){return r().createElement(ke.Xd,Ie({size:16,onClick:t},e))}}),r().createElement("div",{className:Ne.headerContent},i)),r().createElement("div",{className:Ne.overlayContent},n),r().createElement("div",null,a))};function je(e){return Pe(e)&&!e.identifierSources.some((function(e){var t,n;return!(null===(t=e.autoGenerationOption)||void 0===t?void 0:t.manualEntryEnabled)&&(null===(n=e.autoGenerationOption)||void 0===n?void 0:n.automaticGenerationEnabled)}))}function Pe(e){return"UNIQUE"===e.uniquenessBehavior||"LOCATION"===e.uniquenessBehavior}var Ae=n(3433),De={};De.styleTagTransform=A(),De.setAttributes=I(),De.insert=S().bind(null,"head"),De.domAPI=T(),De.insertStyleElement=j(),x()(Ae.Z,De);const Fe=Ae.Z&&Ae.Z.locals?Ae.Z.locals:void 0;function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){ze(e,t,n[t])}))}return e}function Ue(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Ve(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Be(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)?Be(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.")}()}const Ze=function(e){var t,n=e.closeOverlay,a=e.setFieldValue,c=(0,l.useLayoutType)(),u=(0,i.useContext)(s.Cg).identifierTypes,_=(0,i.useContext)(v),m=_.isOffline,p=_.values,f=_.initialFormValues,g=Ve((0,i.useState)(p.identifiers),2),h=g[0],b=g[1],y=Ve((0,i.useState)(""),2),w=y[0],E=y[1],x=(0,d.useTranslation)().t,k=(0,l.useConfig)().defaultPatientIdentifierTypes,T=(0,i.useMemo)((function(){var e={};return null==k||k.forEach((function(t){e[t]=!0})),e}),[k]);(0,i.useEffect)((function(){b(p.identifiers)}),[p.identifiers]);var O=(0,i.useCallback)((function(e){var n;return E(null!==(t=null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&void 0!==t?t:"")}),[]),S=(0,i.useMemo)((function(){return null==u?void 0:u.filter((function(e){var t;return null==e||null===(t=e.name)||void 0===t?void 0:t.toLowerCase().includes(w.toLowerCase())}))}),[h,w]),N=function(e,t){return b((function(n){var i,r;return t?Ue(Le({},n),ze({},e.fieldName,nt(e,null!==(r=null!==(i=p.identifiers[e.fieldName])&&void 0!==i?i:f.identifiers[e.fieldName])&&void 0!==r?r:{}))):n[e.fieldName]?Object.fromEntries(Object.entries(n).filter((function(t){return Ve(t,1)[0]!==e.fieldName}))):n}))},I=(0,i.useMemo)((function(){return S.map((function(e){var t,n,i=h[e.fieldName],a=e.isPrimary||e.required||T[e.uuid]||p.identifiers[e.fieldName],l=m&&je(e);return r().createElement("div",{key:e.uuid,className:Fe.space05},r().createElement(o.XZJ,{id:e.uuid,value:e.uuid,labelText:e.name,onChange:function(t){return N(e,t)},checked:!!i,disabled:a||m&&l}),i&&(null==e||null===(t=e.identifierSources)||void 0===t?void 0:t.length)>0&&(!i.initialValue||(null==i?void 0:i.selectedSource))&&r().createElement("div",{className:Fe.radioGroup},r().createElement(o.SYO,{legendText:x("source","Source"),name:"".concat(null==e?void 0:e.fieldName,"-identifier-sources"),defaultSelected:null==i||null===(n=i.selectedSource)||void 0===n?void 0:n.uuid,onChange:function(t){return function(e,t){return b((function(n){return Ue(Le({},n),ze({},e.fieldName,Le({},n[e.fieldName],tt(e.identifierSources.find((function(e){return e.uuid===t})),n[e.fieldName].identifierValue,n[e.fieldName].initialValue))))}))}(e,t)},orientation:"vertical"},null==e?void 0:e.identifierSources.map((function(t){var n;return r().createElement(o.EUY,{key:t.uuid,labelText:t.name,name:t.uuid,value:t.uuid,className:Fe.radioButton,disabled:m&&Pe(e)&&(null===(n=t.autoGenerationOption)||void 0===n?void 0:n.manualEntryEnabled)})})))))}))}),[S,h,T,p.identifiers,m,N]),C=(0,i.useCallback)((function(){a("identifiers",h),n()}),[h,a]);return r().createElement(Ce,{close:n,header:x("configureIdentifiers","Configure identifiers"),buttonsGroup:r().createElement(o.uVA,{className:(0,l.isDesktop)(c)?Fe.desktop:Fe.tablet},r().createElement(o.zxk,{className:Fe.button,kind:"secondary",onClick:n},x("cancel","Cancel")),r().createElement(o.zxk,{className:Fe.button,kind:"primary",onClick:C},x("configureIdentifiers","Configure identifiers")))},r().createElement("div",null,r().createElement("p",{className:Fe.bodyLong02},x("IDInstructions","Select the identifiers you'd like to add for this patient:")),u.length>7&&r().createElement("div",{className:Fe.space05},r().createElement(o.olm,{labelText:x("searchIdentifierPlaceholder","Search identifier"),placeholder:x("searchIdentifierPlaceholder","Search identifier"),onChange:O,value:w})),r().createElement("fieldset",null,I)))};var Re=n(7631),He=n(3469),Me=n(6039);function qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function We(){return We=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},We.apply(this,arguments)}function Ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){Ge(e,t,n[t])}))}return e}function Qe(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qe(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)?qe(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.")}()}var Ke=function(e){var t=e.patientIdentifier,n=e.fieldName,a=(0,d.useTranslation)().t,c=(0,l.useConfig)().defaultPatientIdentifierTypes,u=(0,i.useContext)(s.Cg).identifierTypes,_=(0,i.useContext)(v),p=_.isOffline,f=_.values,g=_.setFieldValue,h=(0,i.useMemo)((function(){return u.find((function(e){return e.uuid===t.identifierTypeUuid}))}),[t,u]),b=t.autoGeneration,y=t.initialValue,w=t.identifierValue,E=t.identifierName,x=t.required,k=Qe((0,i.useState)(b||y===w),2),T=k[0],O=k[1],S="identifiers.".concat(n,".identifierValue"),N=Qe((0,m.U$)(S),2),I=N[0],C=N[1],j=p&&je(h),P=(0,i.useMemo)((function(){var e={};return null==c||c.forEach((function(t){e[t]=!0})),e}),[c]),A=(0,i.useCallback)((function(){var e,i;O(!0),g("identifiers.".concat(n),(e=Ye({},t),i=null!=(i={identifierValue:y,selectedSource:null,autoGeneration:!1})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})),e))}),[y,O]);return r().createElement("div",{className:B.IDInput},b||T?r().createElement("div",{className:B.textID},r().createElement("p",{className:B.label},E),r().createElement("p",{className:B.bodyShort02},b?a("autoGeneratedPlaceholderText","Auto-generated"):w),r().createElement("input",We({type:"hidden"},I,{disabled:!0})),!(!C.touched||!C.error)&&r().createElement("span",{className:B.dangerLabel01},C.error&&a(C.error))):r().createElement(de,We({id:S,labelText:E,name:S,disabled:j,required:x,invalid:!(!C.touched||!C.error),invalidText:C.error&&a(C.error)},I)),r().createElement("div",null,!t.required&&t.initialValue&&T&&r().createElement(o.zxk,{kind:"ghost",onClick:function(){var e;O(!1),g("identifiers.".concat(n),Ye({},t,tt(null==h||null===(e=h.identifierSources)||void 0===e?void 0:e[0],y,y)))},iconDescription:a("editIdentifierTooltip","Edit"),disabled:j,hasIconOnly:!0},r().createElement(Re.I8,{size:16})),y&&y!==w&&r().createElement(o.zxk,{kind:"ghost",onClick:A,iconDescription:a("resetIdentifierTooltip","Reset"),disabled:j,hasIconOnly:!0},r().createElement(He.AG,{size:16})),!t.required&&!P[t.identifierTypeUuid]&&r().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},r().createElement(o.zxk,{kind:"danger--ghost",onClick:function(){if(y)var e=(0,l.showModal)("delete-identifier-confirmation-modal",{deleteIdentifier:function(t){t&&g("identifiers",it(f.identifiers,n)),e()},identifierName:E,initialValue:y});else g("identifiers",it(f.identifiers,n))},iconDescription:a("deleteIdentifierTooltip","Delete"),disabled:j,hasIconOnly:!0},r().createElement(Me.ZN,{size:16})))))};function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){Xe(e,t,n[t])}))}return e}function et(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $e(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)?$e(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 tt(e,t,n){var i,r=null==e||null===(i=e.autoGenerationOption)||void 0===i?void 0:i.automaticGenerationEnabled;return{selectedSource:e,autoGeneration:r,identifierValue:r?"auto-generated":"auto-generated"!==t?t:n}}function nt(e,t){var n,i,r;return Je({identifierTypeUuid:e.uuid,identifierName:e.name,preferred:e.isPrimary,initialValue:"",required:e.isPrimary||e.required},t,tt(null!==(i=null==t?void 0:t.selectedSource)&&void 0!==i?i:null===(n=e.identifierSources)||void 0===n?void 0:n[0],null==t?void 0:t.identifierValue,null!==(r=null==t?void 0:t.initialValue)&&void 0!==r?r:""))}function it(e,t){return Object.fromEntries(Object.entries(e).filter((function(e){return et(e,1)[0]!==t})))}var rt=function(){var e=(0,i.useContext)(s.Cg).identifierTypes,t=!e,n=(0,i.useContext)(v),a=n.values,c=n.setFieldValue,u=n.initialFormValues,_=(0,d.useTranslation)().t,m=(0,l.useLayoutType)(),p=et((0,i.useState)(!1),2),f=p[0],g=p[1],h=(0,l.useConfig)().defaultPatientIdentifierTypes;return(0,i.useEffect)((function(){if(e){var t={};e.filter((function(e){return e.isPrimary||e.required||!!(null==h?void 0:h.find((function(t){return t===e.uuid})))})).filter((function(e){return!a.identifiers[e.fieldName]})).forEach((function(e){var n,i;t[e.fieldName]=nt(e,null!==(i=null!==(n=a.identifiers[e.uuid])&&void 0!==n?n:u.identifiers[e.uuid])&&void 0!==i?i:{})})),Object.keys(t).length&&c("identifiers",Je({},a.identifiers,t))}}),[e,c,nt,h,a.identifiers]),t?r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement("div",{className:ge.identifierLabelText},r().createElement("h4",{className:ge.productiveHeading02Light},_("idFieldLabelText","Identifiers"))),r().createElement(o.N2B,null)):r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},r().createElement("div",{className:ge.identifierLabelText},r().createElement("h4",{className:ge.productiveHeading02Light},_("idFieldLabelText","Identifiers")),r().createElement(o.zxk,{kind:"ghost",className:ge.setIDNumberButton,onClick:function(){return g(!0)},size:(0,l.isDesktop)(m)?"sm":"md"},_("configure","Configure")," ",r().createElement(ke.ol,{size:16})))),r().createElement("div",null,Object.entries(a.identifiers).map((function(e){var t=et(e,2),n=t[0],i=t[1];return r().createElement(Ke,{key:n,fieldName:n,patientIdentifier:i})})),f&&r().createElement(Ze,{setFieldValue:c,closeOverlay:function(){return g(!1)}})))};function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ot(){return ot=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ot.apply(this,arguments)}function lt(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return at(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)?at(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.")}()}var st=function(e,t){var n=new Date,i=new Date(n.getFullYear()-e,n.getMonth()-t,1),r=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();return new Date(i.getFullYear(),i.getMonth(),Math.min(n.getDate(),r))},ct=function(){var e,t,n=(0,d.useTranslation)().t,a=!lt((0,m.U$)("birthdateEstimated"),1)[0].value,l=lt((0,m.U$)("birthdate"),2),s=l[0],c=l[1],u=lt((0,m.U$)("yearsEstimated"),2),_=u[0],p=u[1],f=lt((0,m.U$)("monthsEstimated"),2),g=f[0],h=f[1],b=(0,i.useContext)(v).setFieldValue,y=(t="/",{parse:function(n){var i=n.split(t),r=new Date(null);return e.forEach((function(e,t){switch(e){case"d":r.setDate(parseInt(i[t]));break;case"m":r.setMonth(parseInt(i[t])-1);break;case"Y":r.setFullYear(parseInt(i[t]))}})),r},format:function(n){if(null===n)return"";if(r=n,null!=(a=Date)&&"undefined"!=typeof Symbol&&a[Symbol.hasInstance]?a[Symbol.hasInstance](r):r instanceof a){var i=[];return e.forEach((function(e,t){switch(e){case"d":i[t]=n.getDate();break;case"m":i[t]=n.getMonth()+1;break;case"Y":i[t]=n.getFullYear()}})),i.join(t)}return n;var r,a},placeHolder:(e=["d","m","Y"]).map((function(e){return"Y"===e?"YYYY":e+e})).join(t),dateFormat:e.join(t)}),w=y.format,E=y.placeHolder,x=y.dateFormat,k=new Date;return r().createElement("div",{className:ge.halfWidthInDesktopView},r().createElement("h4",{className:ge.productiveHeading02Light},n("birthFieldLabelText","Birth")),r().createElement("div",{className:ge.dobField},r().createElement("div",{className:ge.dobContentSwitcherLabel},r().createElement("span",{className:ge.label01},n("dobToggleLabelText","Date of Birth Known?"))),r().createElement(o.GHR,{onChange:function(e){b("birthdateEstimated","unknown"===e.name),b("birthdate",""),b("yearsEstimated",""),b("monthsEstimated","")}},r().createElement(o.rsf,{name:"known",text:n("yes","Yes")}),r().createElement(o.rsf,{name:"unknown",text:n("no","No")}))),a?r().createElement("div",{className:ge.dobField},r().createElement(o.Mtg,{dateFormat:x,datePickerType:"single",onChange:function(e){var t=lt(e,1)[0];b("birthdate",t)},maxDate:w(k)},r().createElement(o.aj6,ot({id:"birthdate"},s,{placeholder:E,labelText:n("dateOfBirthLabelText","Date of Birth"),invalid:!(!c.touched||!c.error),invalidText:c.error&&n(c.error),value:w(s.value)})))):r().createElement("div",{className:ge.grid},r().createElement(o.oil,{id:"yearsEstimated",type:"number",name:_.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<140&&t>=0&&(b("yearsEstimated",t),b("birthdate",st(t,h.value)))},labelText:n("estimatedYearsLabelText","Estimated Years"),invalid:!(!p.touched||!p.error),invalidText:p.error&&n(p.error),value:_.value,min:0,required:!0}),r().createElement(o.oil,{id:"monthsEstimated",type:"number",name:g.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<=11&&t>=0&&(b("monthsEstimated",t),b("birthdate",st(p.value,t)))},labelText:n("estimatedMonthsLabelText","Estimated Months"),invalid:!(!h.touched||!h.error),invalidText:h.error&&n(h.error),value:g.value,min:0})))};function ut(){return ut=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ut.apply(this,arguments)}var _t=function(e){var t=e.fieldDefinition,n=(0,d.useTranslation)().t;return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:t.id},(function(e){var i=e.field,a=e.form;return a.touched,a.errors,e.meta,r().createElement(de,ut({id:t.id,labelText:n("".concat(t.label),"".concat(t.label))},i))})))},dt=n(2303);function mt(e){var t,n="string"==typeof e&&""!==e,i=(0,dt.Z)(n?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),r=i.data,a=i.error;return a&&(0,l.showToast)({title:a.name,description:a.message,kind:"error"}),{data:null==r||null===(t=r.data)||void 0===t?void 0:t.answers,isLoading:!r&&!a}}function pt(){return pt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},pt.apply(this,arguments)}function ft(e){var t=e.fieldDefinition,n=function(e){var t="string"==typeof e&&""!==e,n=(0,dt.Z)(t?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),i=n.data,r=n.error;return r&&(0,l.showToast)({title:r.name,description:r.message,kind:"error"}),{data:null==i?void 0:i.data,isLoading:!i&&!r}}(t.uuid),i=n.data,a=n.isLoading;if(!(0,l.useConfig)().registrationObs.encounterTypeUuid)return console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs fields will not be displayed."),null;if(a)return null;switch(i.datatype.display){case"Text":return r().createElement(gt,{concept:i,validationRegex:t.validation.matches,label:t.label});case"Numeric":return r().createElement(ht,{concept:i,label:t.label});case"Coded":return r().createElement(vt,{concept:i,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return r().createElement(o.K0D,{kind:"error",title:"Error"},'Concept has unknown datatype "',i.datatype.display,'"')}}function gt(e){var t=e.concept,n=e.validationRegex,i=e.label,a=(0,d.useTranslation)().t,o="obs.".concat(t.uuid);return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:o,validate:function(e){if(e&&n&&""!==n&&"string"==typeof n&&""!==e)return new RegExp(n).test(e)?void 0:a("invalidInput","Invalid Input")}},(function(e){var n=e.field,a=e.form,l=a.touched,s=a.errors;return e.meta,r().createElement(de,pt({id:o,labelText:null!=i?i:t.display,invalid:s[o]&&l[o]},n))})))}function ht(e){var t=e.concept,n=e.label,i=((0,d.useTranslation)().t,"obs.".concat(t.uuid));return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:i},(function(e){var a=e.field,o=e.form,l=o.touched,s=o.errors;return e.meta,r().createElement(de,pt({id:i,labelText:null!=n?n:t.display,invalid:s[i]&&l[i],type:"number"},a))})))}function vt(e){var t,n=e.concept,i=e.answerConceptSetUuid,a=e.label,s=(0,l.useConfig)(),c=mt(null!=i?i:n.uuid),u=c.data,_=c.isLoading,d="obs.".concat(n.uuid),p=null==s||null===(t=s.fieldDefinitions)||void 0===t?void 0:t.filter((function(e){return"obs"===e.type&&e.uuid===n.uuid}))[0];return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},_?null:r().createElement(m.gN,{name:d},(function(e){var t,i=e.field,l=e.form,s=l.touched,c=l.errors;return e.meta,(null==p||null===(t=p.customConceptAnswers)||void 0===t?void 0:t.length)?r().createElement(o.PhF,pt({id:d,name:d,labelText:null!=a?a:null==n?void 0:n.display,light:!0,invalid:c[d]&&s[d]},i),r().createElement(o.QlF,{key:"no-answer-select-item-".concat(d),value:"",text:""}),null==p?void 0:p.customConceptAnswers.map((function(e){return r().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.label})}))):r().createElement(o.mh4,null,r().createElement(o.PhF,pt({id:d,name:d,labelText:null!=a?a:null==n?void 0:n.display,invalid:c[d]&&s[d]},i),r().createElement(o.QlF,{key:"no-answer-select-item-".concat(d),value:"",text:""}),u.map((function(e){return r().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})}))))})))}function bt(e){var t=e.personAttributeType,n=e.answerConceptSetUuid,i=e.label,a=mt(n),l=a.data,s=a.isLoading;return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},!s&&(null==l?void 0:l.length)?r().createElement(o.mh4,null,r().createElement(o.PhF,{id:"person-attribute-".concat(t.uuid),name:"attributes.".concat(t.uuid),labelText:null!=i?i:null==t?void 0:t.display},r().createElement(o.QlF,{value:"",text:""}),l.map((function(e){return r().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))):r().createElement(de,{id:"person-attribute-".concat(t.uuid),labelText:null!=i?i:null==t?void 0:t.display,name:"attributes.".concat(t.uuid)}))}function yt(){return yt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},yt.apply(this,arguments)}function wt(e){var t=e.personAttributeType,n=e.validationRegex,i=e.label,a=(0,d.useTranslation)().t,o="attributes.".concat(t.uuid);return r().createElement("div",{className:"".concat(ge.customField," ").concat(ge.halfWidthInDesktopView)},r().createElement(m.gN,{name:o,validate:function(e){if(e&&n&&""!==n&&"string"==typeof n&&""!==e)return new RegExp(n).test(e)?void 0:a("invalidInput","Invalid Input")}},(function(e){var n=e.field,a=e.form,l=a.touched,s=a.errors;return e.meta,r().createElement(de,yt({id:"person-attribute-".concat(t.uuid),labelText:null!=i?i:null==t?void 0:t.display,invalid:s[o]&&l[o]},n))})))}function Et(e){var t=e.fieldDefinition,n=function(e){var t=(0,dt.Z)("/ws/rest/v1/personattributetype/".concat(e),l.openmrsFetch),n=t.data,i=t.error;return i&&(0,l.showToast)({title:i.name,description:i.message,kind:"error"}),{data:null==n?void 0:n.data,isLoading:!n&&!i}}(t.uuid),i=n.data;if(n.isLoading)return null;switch(i.format){case"java.lang.String":return r().createElement(wt,{personAttributeType:i,validationRegex:t.validation.matches,label:t.label});case"org.openmrs.Concept":return r().createElement(bt,{personAttributeType:i,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return r().createElement(o.K0D,{kind:"error",title:"Error"},'Patient attribute type has unknown format "',i.format,'"')}}function xt(e){var t=e.name,n=(0,l.useConfig)().fieldDefinitions.filter((function(e){return e.id==t}))[0];return"person attribute"===n.type?r().createElement(Et,{fieldDefinition:n}):"obs"===n.type?r().createElement(ft,{fieldDefinition:n}):"address"===n.type?r().createElement(_t,{fieldDefinition:n}):r().createElement("div",null,"Error: Unknown field type ",n.type)}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Tt(){return Tt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Tt.apply(this,arguments)}function Ot(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kt(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)?kt(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.")}()}var St=function(e){var t,n=e.name,a=e.labelText,s=e.placeholder,c=e.setSelectedValue,u=e.selected,_=(0,d.useTranslation)().t,p=Ot((0,m.U$)(n),3),f=p[0],g=(p[1],p[2]),h=Ot((0,i.useState)([]),2),v=h[0],b=h[1],y=Ot((0,i.useState)(),2),w=y[0],E=y[1],x=g.setValue;return w?r().createElement("span",null,_("".concat(w.message))):r().createElement("div",{style:{marginBottom:"1rem"}},r().createElement(o.mh4,null,r().createElement(o.CtY,Tt({id:n,onInputChange:function(e){var t,i,r,a,o;i=n,""==(t=e)||(r=i.replace(" ",""),a=u,o=t,(0,l.openmrsFetch)("".concat("/module/addresshierarchy/ajax/getPossibleAddressHierarchyEntriesWithParents.form","?addressField=").concat(r,"&limit=20&searchString=").concat(o,"&parentUuid=").concat(a),{method:"GET"})).then((function(e){b(e.data.map((function(e){return{id:e.uuid,text:e.name}})))})).catch((function(e){E(e)})),x(e)},items:v,itemToString:function(e){return null!==(t=null==e?void 0:e.text)&&void 0!==t?t:""}},f,{onChange:function(e){Boolean(e.selectedItem)?(c(e.selectedItem.id),x(e.selectedItem.text)):(c(void 0),x(void 0))},placeholder:s,titleText:a}))))};function Nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function It(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nt(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)?Nt(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 Ct(e){return(new DOMParser).parseFromString(e,"text/xml")}function jt(e,t){var n=t.getElementsByTagName(e)[0];return Ct(n?n.outerHTML:"")}var Pt=function(){var e=It((0,i.useState)(""),2),t=e[0],n=e[1],a=It((0,i.useState)([]),2),c=a[0],u=a[1],_=(0,d.useTranslation)().t,m=(0,i.useContext)(s.Cg).addressTemplate,p=null==m?void 0:m.results[0].value,f=function(e){n(e)},g=(0,l.useConfig)().fieldConfigurations.address.useAddressHierarchy;return(0,i.useEffect)((function(){var e=Ct(p),t=jt("elementdefaults",e),n=jt("nameMappings",e),i=Array.from(n.getElementsByTagName("property")).length>0?n.getElementsByTagName("property"):n.getElementsByTagName("entry"),r=Array.prototype.map.call(i,(function(e){var n,i,r=null!==(n=e.getAttribute("name"))&&void 0!==n?n:e.getElementsByTagName("string")[0].innerHTML,a=null!==(i=e.getAttribute("value"))&&void 0!==i?i:e.getElementsByTagName("string")[1].innerHTML,o=_(r,a),l=function(e,t){var n=t.getElementsByName(e)[0];return n?n.getAttribute("value"):null}(r,t);return{id:r,name:r,labelText:o,value:l}}));u(r)}),[_,p]),m?r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},_("addressHeader","Address")),r().createElement("div",{style:{width:"50%",paddingBottom:"5%"}},g?c.map((function(e,n){return r().createElement(St,{key:"combo_input_".concat(n),name:e.name,labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})})):c.map((function(e,n){return r().createElement(de,{key:"combo_input_".concat(n),name:e.name,labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})})))):r().createElement("div",null,r().createElement("h4",{className:ge.productiveHeading02Light},_("addressHeader","Address")),r().createElement(o.N2B,null))};function At(e){var t=e.name,n=(0,l.useConfig)();if(!oe.X8.includes(t)&&!n.fieldDefinitions.some((function(e){return e.id==t})))return(0,l.reportError)("Invalid field name '".concat(t,"'. Valid options are '").concat(n.fieldDefinitions.map((function(e){return e.id})).concat(oe.X8).join("', '"),"'.")),null;switch(t){case"name":return r().createElement(we,null);case"gender":return r().createElement(xe,null);case"dob":return r().createElement(ct,null);case"address":return r().createElement(Pt,null);case"id":return r().createElement(rt,null);case"phone & email":return r().createElement(he,null);default:return r().createElement(xt,{name:t})}}var Dt=function(e){var t=e.sectionDefinition;return r().createElement("section",{"aria-label":"".concat(t.name," Section")},t.fields.map((function(e){return r().createElement(At,{key:"".concat(t.name,"-").concat(e),name:e})})))};function Ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Bt(){return Bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Bt.apply(this,arguments)}function zt(e,t){if(e){if("string"==typeof e)return Ft(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)?Ft(e,t):void 0}}var Lt=function(e){var t,n,i=e.name,a=e.options,l=e.label,s=e.required,c=(t=(0,m.U$)(i),n=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||zt(t,n)||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.")}())[0],u=(0,d.useTranslation)().t,_=[r().createElement(o.QlF,{disabled:!0,hidden:!0,text:"Select ".concat(l),key:"",value:""})].concat(function(e){return function(e){if(Array.isArray(e))return Ft(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zt(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.")}()}(a.map((function(e,t){return r().createElement(o.QlF,{text:e,value:e,key:t})})))),p=s?l:"".concat(l," (").concat(u("optional","optional"),")");return r().createElement("div",{style:{marginBottom:"1rem"}},r().createElement(o.mh4,null,r().createElement(o.PhF,Bt({id:"identifier"},c,{labelText:p}),_)))},Ut=n(2936),Vt={};Vt.styleTagTransform=A(),Vt.setAttributes=I(),Vt.insert=S().bind(null,"head"),Vt.domAPI=T(),Vt.insertStyleElement=j(),x()(Ut.Z,Vt);const Zt=Ut.Z&&Ut.Z.locals?Ut.Z.locals:void 0;var Rt=function(){var e=r().useContext(v).values,t=(0,d.useTranslation)().t;return r().createElement("section",{className:Zt.formSection,"aria-label":"Death Info Section"},r().createElement("h5",{className:"omrs-type-title-5 ".concat(Zt.formSectionTitle)},"Death Info"),r().createElement("section",{className:Zt.fieldGroup},r().createElement(de,{labelText:t("isDeadInputLabel","Is Dead"),name:"isDead",id:"isDead"}),e.isDead&&r().createElement(r().Fragment,null,r().createElement(de,{labelText:t("deathDateInputLabel","Date of Death"),name:"deathDate",id:"deathDate"}),r().createElement(Lt,{options:[t("unknown","Unknown"),t("stroke","Stroke")],label:t("causeOfDeathInputLabel","Cause of Death"),name:"deathCause"}))))};function Ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Mt=function(e){var t,n,a=e.fields,o=(t=(0,m.U$)("addNameInLocalLanguage"),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ht(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)?Ht(e,t):void 0}}(t,n)||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.")}()),l=o[0],s=o[1],c=(0,i.useContext)(v).setFieldValue;return(0,i.useEffect)((function(){!l.value&&s.touched&&(c("additionalGivenName",""),c("additionalMiddleName",""),c("additionalFamilyName",""))}),[l.value,s.touched]),r().createElement("section",{className:Zt.formSection,"aria-label":"Demographics Section"},a.map((function(e){return r().createElement(At,{key:"demographics-".concat(e),name:e})})))},qt=n(1662),Gt={};Gt.styleTagTransform=A(),Gt.setAttributes=I(),Gt.insert=S().bind(null,"head"),Gt.domAPI=T(),Gt.insertStyleElement=j(),x()(qt.Z,Gt);const Wt=qt.Z&&qt.Z.locals?qt.Z.locals:void 0;function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Qt(){return Qt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Qt.apply(this,arguments)}var Kt=function(e){var t,n,a=e.getDisplayValue,l=e.getFieldValue,s=e.getSearchResults,c=e.onSuggestionSelected,u=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["getDisplayValue","getFieldValue","getSearchResults","onSuggestionSelected"]),_=(t=(0,i.useState)([]),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Yt(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)?Yt(e,t):void 0}}(t,n)||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.")}()),m=_[0],p=_[1],f=(0,i.useRef)(null),g=(0,i.useRef)(null),h=((0,d.useTranslation)().t,u.name),v=u.labelText;(0,i.useEffect)((function(){return document.addEventListener("mousedown",b),function(){document.removeEventListener("mousedown",b)}}),[g]);var b=function(e){g.current&&!g.current.contains(e.target)&&p([])};return r().createElement("div",{className:Wt.autocomplete,ref:g},r().createElement("label",{className:"cds--label"},v),r().createElement(o.mh4,null,r().createElement(o.olm,Qt({id:"autosuggest",onChange:function(e){var t=e.target.value;t?s(t).then((function(e){p(e)})):p([])},ref:f,className:Wt.autocompleteSearch},u))),m.length>0&&r().createElement("ul",{className:Wt.suggestions},m.map((function(e,t){return r().createElement("li",{key:t,onClick:function(e){return function(e){var t=a(m[e]),n=l(m[e]);f.current.value=t,c(h,n),p([])}(t)}},a(e))}))))},$t=n(138),Xt={};Xt.styleTagTransform=A(),Xt.setAttributes=I(),Xt.insert=S().bind(null,"head"),Xt.domAPI=T(),Xt.insertStyleElement=j(),x()($t.Z,Xt);const Jt=$t.Z&&$t.Z.locals?$t.Z.locals:void 0;function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function tn(e,t,n,i,r,a,o){try{var l=e[a](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,r)}function nn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rn=function(){var e,t,n=(0,i.useContext)(s.Cg).relationshipTypes,a=(e=(0,i.useState)([]),t=2,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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return en(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)?en(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.")}()),l=a[0],c=a[1],u=(0,d.useTranslation)().t;return(0,i.useEffect)((function(){if(n){var e=[];n.results.forEach((function(t){var n={display:t.aIsToB,uuid:t.uuid,direction:"aIsToB"},i={display:t.bIsToA,uuid:t.uuid,direction:"bIsToA"};n.display===i.display?e.push(n):e.push(n,i)})),c(e)}}),[n]),n?r().createElement("section",{"aria-label":"Relationships Section"},r().createElement(m.F2,{name:"relationships"},(function(e){var t=e.push,n=e.remove,i=e.form.values.relationships;return r().createElement("div",null,i&&i.length>0?i.map((function(e,t){return r().createElement("div",{key:t,className:Zt.formSection},r().createElement(an,{relationship:e,index:t,displayRelationshipTypes:l,key:t,remove:n}))})):null,r().createElement("div",{className:Jt.actions},r().createElement(o.zxk,{kind:"ghost",onClick:function(){return t({relatedPersonUuid:"",action:"ADD"})}},u("addRelationshipButtonText","Add Relationship"))))}))):r().createElement("section",{"aria-label":"Relationships Section"},r().createElement(o.N2B,null))},an=function(e){var t,n,a,l,s=e.relationship,c=e.index,_=e.displayRelationshipTypes,m=e.remove,p=(0,d.useTranslation)().t,f=r().useContext(v).setFieldValue,g=!s.uuid,h=(0,i.useCallback)((function(e){var t=e.target,n=t.name,i=t.options[t.selectedIndex].value;f(n,i),(null==s?void 0:s.action)||f("relationships[".concat(c,"].action"),"UPDATE")}),[]),b=(0,i.useCallback)((function(e,t){f(e,t)}),[]),w=(t=u().mark((function e(t){var n,i;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new AbortController,e.next=3,(0,y.M8)(t,n);case 3:return i=e.sent,e.abrupt("return",i.data.results);case 5:case"end":return e.stop()}}),e)})),n=function(){var e=this,n=arguments;return new Promise((function(i,r){var a=t.apply(e,n);function o(e){tn(a,i,r,o,l,"next",e)}function l(e){tn(a,i,r,o,l,"throw",e)}o(void 0)}))},function(e){return n.apply(this,arguments)}),E=(0,i.useCallback)((function(){"ADD"===s.action?m(c):f("relationships[".concat(c,"].action"),"DELETE")}),[s,c]),x=(0,i.useCallback)((function(){var e,t;f("relationships[".concat(c,"]"),(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){nn(e,t,n[t])}))}return e}({},s),t=null!=(t={action:void 0,relationshipType:s.initialrelationshipTypeValue})?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e))}),[c]);return"DELETE"!==s.action?r().createElement("div",{className:Jt.relationship},r().createElement("div",{className:Jt.searchBox},r().createElement("div",{className:Jt.relationshipHeader},r().createElement("h4",{className:Jt.productiveHeading},null!==(a=null==s?void 0:s.relation)&&void 0!==a?a:p("relationshipPlaceholder","Relationship")),r().createElement(o.zxk,{kind:"ghost",iconDescription:p("deleteRelationshipTooltipText","Delete"),hasIconOnly:!0,onClick:E},r().createElement(Me.ZN,{size:16,className:Jt.trashCan}))),r().createElement("div",null,g?r().createElement(Kt,{name:"relationships[".concat(c,"].relatedPersonUuid"),labelText:p("relativeFullNameLabelText","Full name"),placeholder:p("relativeNamePlaceholder","Firstname Familyname"),defaultValue:s.relatedPersonName,onSuggestionSelected:b,getSearchResults:w,getDisplayValue:function(e){return e.display},getFieldValue:function(e){return e.uuid},required:!0}):r().createElement(r().Fragment,null,r().createElement("span",{className:Jt.labelText},p("relativeFullNameLabelText","Full name")),r().createElement("p",{className:Jt.bodyShort02},s.relatedPersonName)))),r().createElement("div",{className:"".concat(Jt.selectRelationshipType),style:{marginBottom:"1rem"}},r().createElement(o.mh4,null,r().createElement(o.PhF,{id:"select",labelText:p("relationship","Relationship"),onChange:h,name:"relationships[".concat(c,"].relationshipType"),defaultValue:null!==(l=null==s?void 0:s.relationshipType)&&void 0!==l?l:"placeholder-item"},r().createElement(o.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:p("relationshipToPatient","Relationship to patient")}),_.map((function(e){return r().createElement(o.QlF,{text:e.display,value:"".concat(e.uuid,"/").concat(e.direction),key:e.display})})))))):r().createElement(o.K0D,{kind:"info",title:p("relationshipRemovedText","Relationship removed"),actions:r().createElement(o.xho,{onClick:x},p("restoreRelationshipActionButton","Undo"))})};function on(e){var t=e.sectionDefinition;switch(t.id){case"demographics":return r().createElement(Mt,{fields:t.fields});case"death":return r().createElement(Rt,null);case"relationships":return r().createElement(rn,null);default:return r().createElement(Dt,{sectionDefinition:t})}}var ln=function(e){var t=e.sectionDefinition,n=e.index,i=(0,d.useTranslation)().t;return r().createElement("div",{id:t.id},r().createElement("h3",{className:ce.productiveHeading02,style:{color:"#161616"}},n+1,". ",t.name),r().createElement("span",{className:ce.label01},i("allFieldsRequiredText","All fields are required unless marked optional")),r().createElement("div",{style:{margin:"1rem 0 1rem"}},r().createElement(o.n9L,null,r().createElement(on,{sectionDefinition:t}))))};function sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function cn(e){var t;return null===(t=e.split(window.getOpenmrsSpaBase()))||void 0===t?void 0:t[1]}const un=function(e){var t,n,r=e.when,a=e.redirect,o=(0,d.useTranslation)().t,s=(0,i.useRef)(!1),c=(t=(0,i.useState)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return sn(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)?sn(e,t):void 0}}(t,n)||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.")}()),u=c[0],_=c[1],m=u||a,p=(0,i.useCallback)((function(e){var t=o("discardModalBody","The changes you made to this patient's details have not been saved. Discard changes?");return e.preventDefault(),e.returnValue=t,t}),[o]),f=(0,i.useCallback)((function(e){if(!e.detail.navigationIsCanceled&&!s.current){s.current=!0,e.detail.cancelNavigation();var t=(0,l.showModal)("cancel-patient-edit-modal",{onConfirm:function(){_(e.detail.newUrl),t()}},(function(){s.current=!1}))}}),[]);return(0,i.useEffect)((function(){if(r&&void 0===m)return window.addEventListener("single-spa:before-routing-event",f),window.addEventListener("beforeunload",p),function(){window.removeEventListener("beforeunload",p),window.removeEventListener("single-spa:before-routing-event",f)}}),[m,r,p,f]),(0,i.useEffect)((function(){"string"==typeof m&&(0,l.navigate)({to:"${openmrsSpaBase}/".concat(cn(m))})}),[m]),null};function _n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function dn(e,t,n,i,r,a,o){try{var l=e[a](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,r)}function mn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){mn(e,t,n[t])}))}return e}function fn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function gn(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 i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _n(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)?_n(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.")}()}var hn=function(e){var t,n,c=e.savePatientForm,f=e.isOffline,g=(0,i.useContext)(s.Cg),E=g.currentSession,x=g.addressTemplate,k=g.identifierTypes,T=(0,a.useLocation)().search,O=(0,l.useConfig)(),S=gn((0,i.useState)(),2),N=S[0],I=S[1],C=gn((0,i.useState)(h),2),j=C[0],P=C[1],A=(0,a.useParams)().patientUuid,D=(0,l.usePatient)(A),F=D.isLoading,B=D.patient,z=(0,d.useTranslation)().t,$=gn((0,i.useState)(null),2),X=$[0],ee=$[1],ae=gn(function(e){var t=(0,l.usePatient)(e),n=t.isLoading,r=t.patient,a=function(e){var t=!!e,n=(0,Q.ZP)(t?"/ws/rest/v1/person/".concat(e,"/attribute"):null,l.openmrsFetch),r=n.data,a=n.error,o=(0,i.useMemo)((function(){var e;return{data:null==r||null===(e=r.data)||void 0===e?void 0:e.results,isLoading:!r&&!a}}),[r,a]);return o}(e),o=a.data,s=a.isLoading,c=function(e){var t=!!e,n=(0,Q.ZP)(t?"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)"):null,l.openmrsFetch),r=n.data,a=n.error,o=(0,i.useMemo)((function(){var e,t,n={};return null==r||null===(e=r.data)||void 0===e||null===(t=e.results)||void 0===t||t.forEach((function(e){n[(0,U.Z)(e.identifierType.name)]={identifierUuid:e.uuid,preferred:e.preferred,initialValue:e.identifier,identifierValue:e.identifier,identifierTypeUuid:e.identifierType.uuid,identifierName:e.identifierType.name,required:e.identifierType.required,selectedSource:null,autoGeneration:!1}})),{data:n,isLoading:!r&&!a}}),[r,a]);return o}(e),_=c.data,d=c.isLoading,m=function(e){var t=!!e,n=(0,Q.ZP)(t?"/ws/rest/v1/relationship?v=".concat(K.UO,"&person=").concat(e):null,l.openmrsFetch),r=n.data,a=n.error,o=(0,i.useMemo)((function(){var t;return{data:null==r||null===(t=r.data)||void 0===t?void 0:t.results.map((function(t){return t.personA.uuid===e?{relatedPersonName:t.personB.display,relatedPersonUuid:t.personB.uuid,relation:t.relationshipType.bIsToA,relationshipType:"".concat(t.relationshipType.uuid,"/bIsToA"),initialrelationshipTypeValue:"".concat(t.relationshipType.uuid,"/bIsToA"),uuid:t.uuid}:{relatedPersonName:t.personA.display,relatedPersonUuid:t.personA.uuid,relation:t.relationshipType.aIsToB,relationshipType:"".concat(t.relationshipType.uuid,"/aIsToB"),initialrelationshipTypeValue:"".concat(t.relationshipType.uuid,"/aIsToB"),uuid:t.uuid}})),error:a,isLoading:!r&&!a}}),[e,r,a]);return o}(e),p=m.data,f=m.isLoading,g=ie((0,i.useState)({patientUuid:(0,w.Z)(),givenName:"",middleName:"",familyName:"",unidentifiedPatient:!1,additionalGivenName:"",additionalMiddleName:"",additionalFamilyName:"",addNameInLocalLanguage:!1,gender:"",birthdate:null,yearsEstimated:null,monthsEstimated:0,birthdateEstimated:!1,telephoneNumber:"",address1:"",address2:"",cityVillage:"",stateProvince:"",country:"",postalCode:"",isDead:!1,deathDate:"",deathCause:"",relationships:[],identifiers:{}}),2),h=g[0],v=g[1];return(0,i.useEffect)((function(){J(u().mark((function t(){var i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r){t.next=4;break}v(te({},h,(o=void 0,o={},l=(a=r).name[0],s=a.name[1],o.patientUuid=a.id,o.givenName=null==l?void 0:l.given[0],o.middleName=null==l?void 0:l.given[1],o.familyName=null==l?void 0:l.family,o.unidentifiedPatient="UNKNOWN"===l.given[0]&&"unknown"===l.family||void 0,o.addNameInLocalLanguage=!!s||void 0,o.additionalGivenName=null==s?void 0:s.given[0],o.additionalMiddleName=null==s?void 0:s.given[1],o.additionalFamilyName=null==s?void 0:s.family,o.gender=(0,V.Z)(a.gender),o.birthdate=a.birthDate?new Date(a.birthDate):void 0,o.telephoneNumber=a.telecom?a.telecom[0].value:"",(a.deceasedBoolean||a.deceasedDateTime)&&(o.isDead=!0,o.deathDate=a.deceasedDateTime?a.deceasedDateTime.split("T")[0]:""),H({},o,a.identifier.map((function(e){return R({},(0,U.Z)(e.system||e.type.text),e.value)})))),G(r),Y(r))),t.next=12;break;case 4:if(n||!e){t.next=12;break}return t.next=7,re(e);case 7:if((i=t.sent)._patientRegistrationData.formValues){t.next=11;break}return console.error("Found a queued offline patient registration for patient ".concat(e,", but without form values. Not using these values.")),t.abrupt("return");case 11:v(i._patientRegistrationData.formValues);case 12:case"end":return t.stop()}var a,o,l,s}),t)})))()}),[n,r,e]),(0,i.useEffect)((function(){!f&&p&&v((function(e){return ne(te({},e),{relationships:p})}))}),[f,p,v]),(0,i.useEffect)((function(){!d&&_&&v((function(e){return ne(te({},e),{identifiers:_})}))}),[d,_,v]),(0,i.useEffect)((function(){if(!s&&o){var e={};o.forEach((function(t){e[t.attributeType.uuid]=t.value})),v((function(t){return ne(te({},t),{attributes:e})}))}}),[o,v,s]),[h,v]}(A),2),le=ae[0],se=ae[1],ue=gn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),r=n.isLoading,a=n.patient,o=ie((0,i.useState)(t),2),s=o[0],c=o[1];return(0,i.useEffect)((function(){J(u().mark((function n(){var i,o;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!a){n.next=4;break}c(te({},s,G(a))),n.next=10;break;case 4:if(r||!e){n.next=10;break}return n.next=7,re(e);case 7:i=n.sent,c(null!==(o=null==i?void 0:i._patientRegistrationData.initialAddressFieldValues)&&void 0!==o?o:t);case 10:case"end":return n.stop()}}),n)})))()}),[r,a,e]),[s,c]}(A),1),_e=ue[0],de=gn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),r=n.isLoading,a=n.patient,o=ie((0,i.useState)(t),2),s=o[0],c=o[1];return(0,i.useEffect)((function(){if(a)c(te({},s,W(a)));else if(!r&&e){var n;re(e).then((function(e){return c(null!==(n=null==e?void 0:e._patientRegistrationData.initialAddressFieldValues)&&void 0!==n?n:t)}))}}),[r,a,e]),[s,c]}(A),1),me=de[0],pe=null==E||null===(t=E.sessionLocation)||void 0===t?void 0:t.uuid,fe=F?void 0:!(!A||!B),ge=(0,i.useMemo)((function(){return"true"===localStorage.getItem("openmrs:devtools")&&!fe}),[fe]),he=(0,y.Uu)(null==B?void 0:B.id).data,ve=(0,i.useRef)(new b.I),be=null==O||null===(n=O.fieldDefinitions)||void 0===n?void 0:n.filter((function(e){return"address"===e.type}));(0,i.useEffect)((function(){}),[le]);var ye=(0,i.useMemo)((function(){var e;return O.sections.map((function(t){return null!==(e=O.sectionDefinitions.filter((function(e){return e.id==t}))[0])&&void 0!==e?e:oe.bs.filter((function(e){return e.id==t}))[0]})).filter((function(e){return e}))}),[O.sections,O.sectionDefinitions]);(0,i.useEffect)((function(){if(x){var e=null==x?void 0:x.results[0].value;if(!e)return;var t=function(e){var t=(new DOMParser).parseFromString(e,"text/xml"),n=t.querySelector("nameMappings").getElementsByTagName("entry"),i=Array.prototype.map.call(n,(function(e){var n=e.getElementsByTagName("string")[0].innerHTML;return{name:n,label:e.getElementsByTagName("string")[1].innerHTML,regex:M(n,"elementRegex",t)||".*",regexFormat:M(n,"elementRegexFormats",t)||""}})),r=p.Ry(i.reduce((function(e,t){return e[t.name]=p.Z_().matches(t.regex,t.regexFormat),e}),{}));return{addressFieldValues:Array.prototype.map.call(n,(function(e){return{name:e.getElementsByTagName("string")[0].innerHTML,defaultValue:""}})),addressValidationSchema:r}}(e),n=t.addressFieldValues,i=t.addressValidationSchema;if(P((function(e){return e.concat(i)})),!1===fe){var r=!0,a=!1,o=void 0;try{for(var l,s=n[Symbol.iterator]();!(r=(l=s.next()).done);r=!0){var c=l.value,u=c.name,_=c.defaultValue;_e[u]||(_e[u]=_)}}catch(e){a=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}null==be||be.map((function(e){return _e[e.id]=""})),se(pn({},le,_e))}}}),[fe,x,_e]);var we,Ee,xe=(we=u().mark((function e(t,n){var i,r,a,o,s,_,d,m;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=new AbortController,n.setSubmitting(!0),r=fn(pn({},t),{identifiers:(u=t.identifiers,Object.fromEntries(Object.entries(u).filter((function(e){var t,n,i=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Z(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)?Z(e,t):void 0}}(t,n)||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.")}());return i[0],void 0!==i[1].identifierValue}))))}),e.prev=3,e.next=6,c(!fe,r,me,_e,X,pe,le.identifiers,E,O,ve.current,i);case 6:(0,l.showToast)({description:fe?z("updationSuccessToastDescription","The patient's information has been successfully updated"):z("registrationSuccessToastDescription","The patient can now be found by searching for them using their name or ID number"),title:fe?z("updationSuccessToastTitle","Patient Details Updated"):z("registrationSuccessToastTitle","New Patient Created"),kind:"success"}),a=new URLSearchParams(T).get("afterUrl"),o=(0,l.interpolateUrl)(a||O.links.submitButton,{patientUuid:t.patientUuid}),I(o),e.next=17;break;case 12:e.prev=12,e.t0=e.catch(3),(null===(s=e.t0.responseBody)||void 0===s||null===(_=s.error)||void 0===_?void 0:_.globalErrors)?e.t0.responseBody.error.globalErrors.forEach((function(e){(0,l.showToast)({description:e.message})})):(null===(d=e.t0.responseBody)||void 0===d||null===(m=d.error)||void 0===m?void 0:m.message)?(0,l.showToast)({description:e.t0.responseBody.error.message}):(0,l.createErrorHandler)()(e.t0),n.setSubmitting(!1);case 17:case"end":return e.stop()}var u}),e,null,[[3,12]])})),Ee=function(){var e=this,t=arguments;return new Promise((function(n,i){var r=we.apply(e,t);function a(e){dn(r,n,i,a,o,"next",e)}function o(e){dn(r,n,i,a,o,"throw",e)}a(void 0)}))},function(e,t){return Ee.apply(this,arguments)}),ke=function(e){return r().createElement("div",null,r().createElement("p",null,z("fieldErrorTitleMessage","The following fields have errors:")),r().createElement("ul",{style:{listStyle:"inside"}},Object.keys(e).map((function(e,t){return r().createElement("li",{key:t},z("".concat(e,"LabelText"),e))}))))};return r().createElement(m.J9,{enableReinitialize:!0,initialValues:le,validationSchema:j,onSubmit:xe},(function(e){return r().createElement(m.l0,{className:ce.form},r().createElement(un,{when:e.dirty,redirect:N}),r().createElement("div",{className:ce.formContainer},r().createElement("div",null,r().createElement("div",{className:ce.stickyColumn},r().createElement("h4",null,fe?z("edit","Edit"):z("createNew","Create New")," ",z("patient","Patient")),ge&&r().createElement(L,{setValues:e.setValues}),r().createElement("p",{className:ce.label01},z("jumpTo","Jump to")),ye.map((function(e){return r().createElement("div",{className:"".concat(ce.space05," ").concat(ce.touchTarget),key:e.name},r().createElement(o.rUS,{className:ce.linkName,onClick:function(){return t=e.id,void document.getElementById(t).scrollIntoView({behavior:"smooth",block:"center",inline:"center"});var t}},r().createElement(_.Kc,{size:16})," ",e.name))})),r().createElement(o.zxk,{className:ce.submitButton,type:"submit",onClick:function(){return e.validateForm().then((function(e){return function(e){e&&"object"==typeof e&&Object.keys(e).length&&(0,l.showToast)({description:ke(e),title:z("incompleteForm","Incomplete form"),kind:"warning"})}(e)}))},disabled:!E||!k},fe?z("updatePatient","Update Patient"):z("registerPatient","Register Patient")),r().createElement(o.zxk,{className:ce.cancelButton,kind:"tertiary",onClick:q},z("cancel","Cancel")))),r().createElement("div",{className:ce.infoGrid},r().createElement(v.Provider,{value:{identifierTypes:k,validationSchema:j,setValidationSchema:P,values:e.values,inEditMode:fe,setFieldValue:e.setFieldValue,setCapturePhotoProps:ee,currentPhoto:null==he?void 0:he.imageSrc,isOffline:f,initialFormValues:e.initialValues}},ye.map((function(e,t){return r().createElement(ln,{key:"registration-section-".concat(e.id),sectionDefinition:e,index:t})}))))))}))},vn=n(4954),bn={};bn.styleTagTransform=A(),bn.setAttributes=I(),bn.insert=S().bind(null,"head"),bn.domAPI=T(),bn.insertStyleElement=j(),x()(vn.Z,bn);const yn=vn.Z&&vn.Z.locals?vn.Z.locals:void 0;function wn(e){var t=e.savePatientForm,n=e.isOffline,i=(0,l.useSession)(),c=(0,Q.ZP)("patientRegistrationAddressTemplate",s.Te).data,u=(0,Q.ZP)("patientRegistrationRelationshipTypes",s.mt).data,_=(0,Q.ZP)("patientRegistrationPatientIdentifiers",s.St).data;return r().createElement("main",{className:"omrs-main-content ".concat(yn.root)},r().createElement(o.rjZ,{className:yn.grid},r().createElement(o.X2j,null,r().createElement(l.ExtensionSlot,{extensionSlotName:"breadcrumbs-slot"})),r().createElement(s.Cg.Provider,{value:{addressTemplate:c,relationshipTypes:u,identifierTypes:_,currentSession:i}},r().createElement(a.BrowserRouter,{basename:"".concat(window.getOpenmrsSpaBase(),"patient-registration")},r().createElement(a.Routes,null,r().createElement(a.Route,{path:"",element:r().createElement(hn,{savePatientForm:t,isOffline:n})}),r().createElement(a.Route,{path:"/patient/:patientUuid/edit",element:r().createElement(hn,{savePatientForm:t,isOffline:n})}))))))}}}]);
@@ -48,7 +48,7 @@
48
48
  "main.js"
49
49
  ],
50
50
  "auxiliaryFiles": [],
51
- "hash": "41a60d0f21f8d572aaad",
51
+ "hash": "e62c0a14df022fc71f51",
52
52
  "childrenByOrder": {}
53
53
  },
54
54
  {
@@ -278,7 +278,7 @@
278
278
  "686.js"
279
279
  ],
280
280
  "auxiliaryFiles": [],
281
- "hash": "b177f28427905d66e589",
281
+ "hash": "452604062e217f6c1215",
282
282
  "childrenByOrder": {}
283
283
  },
284
284
  {
@@ -405,9 +405,9 @@
405
405
  "initial": false,
406
406
  "entry": false,
407
407
  "recorded": false,
408
- "size": 232420,
408
+ "size": 232618,
409
409
  "sizes": {
410
- "javascript": 232378,
410
+ "javascript": 232576,
411
411
  "consume-shared": 42
412
412
  },
413
413
  "names": [],
@@ -420,7 +420,7 @@
420
420
  "859.js"
421
421
  ],
422
422
  "auxiliaryFiles": [],
423
- "hash": "9ad6bccd9b0defdf1897",
423
+ "hash": "e6c5ccb3abe55ddca50b",
424
424
  "childrenByOrder": {}
425
425
  },
426
426
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-patient-registration-app",
3
- "version": "4.0.2-pre.647",
3
+ "version": "4.0.2-pre.649",
4
4
  "description": "Patient registration microfrontend for the OpenMRS SPA",
5
5
  "browser": "dist/openmrs-esm-patient-registration-app.js",
6
6
  "main": "src/index.ts",
@@ -52,5 +52,5 @@
52
52
  "devDependencies": {
53
53
  "webpack": "^5.74.0"
54
54
  },
55
- "gitHead": "d82404b08a476d58b1904bca1fef351721b4bdce"
55
+ "gitHead": "f57ce1d3fafbefea1a73c216a4acf13e5b8a9c0d"
56
56
  }
@@ -41,6 +41,9 @@ export interface RegistrationConfig {
41
41
  defaultUnknownFamilyName: string;
42
42
  };
43
43
  gender: Array<Gender>;
44
+ address: {
45
+ useAddressHierarchy: boolean;
46
+ };
44
47
  };
45
48
  links: {
46
49
  submitButton: string;
@@ -228,7 +231,7 @@ export const esmPatientRegistrationSchema = {
228
231
  _description: 'Provide ability to configure sex options.',
229
232
  },
230
233
  address: {
231
- useAddressHeirarchy: {
234
+ useAddressHierarchy: {
232
235
  _type: Type.Boolean,
233
236
  _description: 'Whether to use the Address heirarchy in the registration form or not',
234
237
  _default: false,
@@ -31,7 +31,9 @@ export const AddressHierarchy: React.FC = () => {
31
31
  };
32
32
  const config = useConfig();
33
33
  const {
34
- fieldConfigurations: { useAddressHeirarchy },
34
+ fieldConfigurations: {
35
+ address: { useAddressHierarchy },
36
+ },
35
37
  } = config;
36
38
 
37
39
  useEffect(() => {
@@ -85,7 +87,7 @@ export const AddressHierarchy: React.FC = () => {
85
87
  width: '50%',
86
88
  paddingBottom: '5%',
87
89
  }}>
88
- {useAddressHeirarchy
90
+ {useAddressHierarchy
89
91
  ? addressLayout.map((attributes, index) => (
90
92
  <ComboInput
91
93
  key={`combo_input_${index}`}
@@ -8,7 +8,9 @@ jest.mock('@openmrs/esm-framework', () => ({
8
8
  ...jest.requireActual('@openmrs/esm-framework'),
9
9
  useConfig: () => ({
10
10
  fieldConfigurations: {
11
- useAddressHierarchy: false,
11
+ address: {
12
+ useAddressHierarchy: false,
13
+ },
12
14
  },
13
15
  }),
14
16
  }));
@@ -1,4 +1,4 @@
1
- import { ComboBox, ComboBoxProps } from '@carbon/react';
1
+ import { ComboBox, ComboBoxProps, Layer } from '@carbon/react';
2
2
  import { useField } from 'formik';
3
3
  import React, { useState } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
@@ -36,27 +36,30 @@ export const ComboInput: React.FC<ComboInputProps> = ({ name, labelText, placeho
36
36
  }
37
37
 
38
38
  return (
39
- <ComboBox
40
- id={name}
41
- onInputChange={(event) => {
42
- comboBoxEvent(event, name);
43
- setValue(event);
44
- }}
45
- items={listItems}
46
- itemToString={(item) => item?.text ?? ''}
47
- {...field}
48
- onChange={(e) => {
49
- if (Boolean(e.selectedItem)) {
50
- setSelectedValue(e.selectedItem.id);
51
- setValue(e.selectedItem.text);
52
- } else {
53
- setSelectedValue(undefined);
54
- setValue(undefined);
55
- }
56
- }}
57
- placeholder={placeholder}
58
- titleText={labelText}
59
- light
60
- />
39
+ <div style={{ marginBottom: '1rem' }}>
40
+ <Layer>
41
+ <ComboBox
42
+ id={name}
43
+ onInputChange={(event) => {
44
+ comboBoxEvent(event, name);
45
+ setValue(event);
46
+ }}
47
+ items={listItems}
48
+ itemToString={(item) => item?.text ?? ''}
49
+ {...field}
50
+ onChange={(e) => {
51
+ if (Boolean(e.selectedItem)) {
52
+ setSelectedValue(e.selectedItem.id);
53
+ setValue(e.selectedItem.text);
54
+ } else {
55
+ setSelectedValue(undefined);
56
+ setValue(undefined);
57
+ }
58
+ }}
59
+ placeholder={placeholder}
60
+ titleText={labelText}
61
+ />
62
+ </Layer>
63
+ </div>
61
64
  );
62
65
  };
@@ -98,6 +98,9 @@ let mockOpenmrsConfig: RegistrationConfig = {
98
98
  id: 'male',
99
99
  },
100
100
  ],
101
+ address: {
102
+ useAddressHierarchy: false,
103
+ },
101
104
  },
102
105
  concepts: {
103
106
  patientPhotoUuid: '736e8771-e501-4615-bfa7-570c03f4bef5',