@openmrs/esm-patient-registration-app 4.0.2-pre.837 → 4.0.2-pre.858

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.
@@ -30,4 +30,4 @@ Assets:
30
30
  858.js (397 KiB)
31
31
  430.js (244 KiB)
32
32
 
33
- webpack 5.74.0 compiled with 1 warning in 166470 ms
33
+ webpack 5.74.0 compiled with 1 warning in 123208 ms
package/dist/574.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[574],{3574:e=>{e.exports=JSON.parse('{"addRelationshipButtonText":"Add Relationship","address1":"Address line 1","address2":"Address line 2","addressHeader":"Address","allFieldsRequiredText":"All fields are required unless marked optional","autoGeneratedPlaceholderText":"Auto-generated","birthdayNotInTheFuture":"Birthday cannot be in the future","birthdayRequired":"Birthday is required","birthFieldLabelText":"Birth","cancel":"Cancel","causeOfDeathInputLabel":"Cause of Death","cityVillage":"City","configure":"Configure","country":"Country","countyDistrict":"District","createNew":"Create New","dateOfBirthLabelText":"Date of Birth","deathDateInputLabel":"Date of Death","deathdayNotInTheFuture":"Death day cannot be in the future","deleteIdentifierTooltip":"Delete","deleteRelationshipTooltipText":"Delete","discard":"Discard","discardModalBody":"The changes you made to this patient\'s details have not been saved. Discard changes?","discardModalHeader":"Confirm Discard Changes","dobToggleLabelText":"Date of Birth Known?","edit":"Edit","editIdentifierTooltip":"Edit","editPatientDetails":"Edit patient details","emailLabelText":"Email","estimatedAgeInMonthsLabelText":"Estimated age in months","estimatedAgeInYearsLabelText":"Estimated age in years","familyNameLabelText":"Family Name","familyNameRequired":"Family name is required","female":"Female","fieldErrorTitleMessage":"The following fields have errors:","fullNameLabelText":"Full Name","genderLabelText":"Sex","genderRequired":"Gender is required","genderUnspecified":"Gender is not specified","givenNameLabelText":"First Name","givenNameRequired":"Given name is required","identifierValueRequired":"Identifier value is required","idFieldLabelText":"Identifiers","incompleteForm":"Incomplete form","invalidEmail":"A valid email has to be given","invalidInput":"Invalid Input","isDeadInputLabel":"Is Dead","jumpTo":"Jump to","loadingResults":"Loading results","male":"Male","middleNameLabelText":"Middle Name","months":"Months","negativeMonths":"Negative months","negativeYears":"Negative years","no":"No","noResultsFound":"No results found","numberInNameDubious":"Number is name is dubious","optional":"optional","other":"Other","patient":"Patient","patientNameKnown":"Patient\'s Name is Known?","phoneEmailLabelText":"Phone, Email, etc.","phoneNumberInputLabelText":"Phone number","postalCode":"Postcode","registerPatient":"Register Patient","registrationSuccessToastDescription":"The patient can now be found by searching for them using their name or ID number","registrationSuccessToastTitle":"New Patient Created","relationship":"Relationship","relationshipPlaceholder":"Relationship","relationshipRemovedText":"Relationship removed","relationshipToPatient":"Relationship to patient","relativeFullNameLabelText":"Full name","relativeNamePlaceholder":"Firstname Familyname","resetIdentifierTooltip":"Reset","restoreRelationshipActionButton":"Undo","searchAddress":"Search address","sexFieldLabelText":"Sex","stateProvince":"State","stroke":"Stroke","unidentifiedPatient":"Unidentified Patient","unknown":"Unknown","updatePatient":"Update Patient","updationSuccessToastDescription":"The patient\'s information has been successfully updated","updationSuccessToastTitle":"Patient Details Updated","years":"Years","yearsEstimateRequired":"Years estimate required","yes":"Yes"}')}}]);
1
+ "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[574],{3574:e=>{e.exports=JSON.parse('{"addRelationshipButtonText":"Add Relationship","address1":"Address line 1","address2":"Address line 2","addressHeader":"Address","allFieldsRequiredText":"All fields are required unless marked optional","autoGeneratedPlaceholderText":"Auto-generated","birthdayNotInTheFuture":"Birthday cannot be in the future","birthdayRequired":"Birthday is required","birthFieldLabelText":"Birth","cancel":"Cancel","causeOfDeathInputLabel":"Cause of Death","cityVillage":"City","configure":"Configure","contactSection":"Contact Details","country":"Country","countyDistrict":"District","createNew":"Create New","dateOfBirthLabelText":"Date of Birth","deathDateInputLabel":"Date of Death","deathdayNotInTheFuture":"Death day cannot be in the future","deathSection":"Death Info","deleteIdentifierTooltip":"Delete","deleteRelationshipTooltipText":"Delete","demographicsSection":"Basic Info","discard":"Discard","discardModalBody":"The changes you made to this patient\'s details have not been saved. Discard changes?","discardModalHeader":"Confirm Discard Changes","dobToggleLabelText":"Date of Birth Known?","edit":"Edit","editIdentifierTooltip":"Edit","editPatientDetails":"Edit patient details","emailLabelText":"Email","estimatedAgeInMonthsLabelText":"Estimated age in months","estimatedAgeInYearsLabelText":"Estimated age in years","familyNameLabelText":"Family Name","familyNameRequired":"Family name is required","female":"Female","fieldErrorTitleMessage":"The following fields have errors:","fullNameLabelText":"Full Name","genderLabelText":"Sex","genderRequired":"Gender is required","genderUnspecified":"Gender is not specified","givenNameLabelText":"First Name","givenNameRequired":"Given name is required","identifierValueRequired":"Identifier value is required","idFieldLabelText":"Identifiers","incompleteForm":"Incomplete form","invalidEmail":"A valid email has to be given","invalidInput":"Invalid Input","isDeadInputLabel":"Is Dead","jumpTo":"Jump to","loadingResults":"Loading results","male":"Male","middleNameLabelText":"Middle Name","months":"Months","negativeMonths":"Negative months","negativeYears":"Negative years","no":"No","noResultsFound":"No results found","numberInNameDubious":"Number is name is dubious","optional":"optional","other":"Other","patient":"Patient","patientNameKnown":"Patient\'s Name is Known?","phoneEmailLabelText":"Phone, Email, etc.","phoneNumberInputLabelText":"Phone number","postalCode":"Postcode","registerPatient":"Register Patient","registrationSuccessToastDescription":"The patient can now be found by searching for them using their name or ID number","registrationSuccessToastTitle":"New Patient Created","relationship":"Relationship","relationshipPlaceholder":"Relationship","relationshipRemovedText":"Relationship removed","relationshipsSection":"Relationships","relationshipToPatient":"Relationship to patient","relativeFullNameLabelText":"Full name","relativeNamePlaceholder":"Firstname Familyname","resetIdentifierTooltip":"Reset","restoreRelationshipActionButton":"Undo","searchAddress":"Search address","sexFieldLabelText":"Sex","stateProvince":"State","stroke":"Stroke","unidentifiedPatient":"Unidentified Patient","unknown":"Unknown","updatePatient":"Update Patient","updationSuccessToastDescription":"The patient\'s information has been successfully updated","updationSuccessToastTitle":"Patient Details Updated","years":"Years","yearsEstimateRequired":"Years estimate required","yes":"Yes"}')}}]);
package/dist/658.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[658],{5671:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__address-search__label01___UPnro{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__address-search__suggestions___qAiUx{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__address-search__suggestions___qAiUx li{padding:1rem;line-height:1.29;color:#525252;border-bottom:1px solid #8d8d8d}.-esm-patient-registration__address-search__suggestions___qAiUx li:hover{background-color:#e5e5e5;color:#161616;cursor:pointer}.-esm-patient-registration__address-search__suggestions___qAiUx li:not(:last-of-type){border-bottom:1px solid #999}.-esm-patient-registration__address-search__autocomplete___S4jFy{position:relative}.-esm-patient-registration__address-search__autocompleteSearch___AG-ZP{width:100%}.-esm-patient-registration__address-search__suggestions___qAiUx a{color:inherit;text-decoration:none}",""]),i.locals={label01:"-esm-patient-registration__address-search__label01___UPnro",suggestions:"-esm-patient-registration__address-search__suggestions___qAiUx",autocomplete:"-esm-patient-registration__address-search__autocomplete___S4jFy",autocompleteSearch:"-esm-patient-registration__address-search__autocompleteSearch___AG-ZP"};const a=i},1098:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},3433:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},1662:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},4939:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},1093:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},138:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},2936:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},7857:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},4954:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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))}",""]),i.locals={root:"-esm-patient-registration__root__root___msybz",grid:"-esm-patient-registration__root__grid___p9P+g"};const a=i},7658:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Tn});var r=n(268),i=n.n(r),a=n(8744),o=n(2430),l=n(906),s=n(6279),c=n(781),u=n(4924),d=n(7065),_=n(73),m=n(4519),p=n.n(m),f=_.Ry({givenName:_.Z_().required("givenNameRequired"),familyName:_.Z_().required("familyNameRequired"),additionalGivenName:_.Z_().when("addNameInLocalLanguage",{is:!0,then:_.Z_().required("givenNameRequired"),otherwise:_.Z_().notRequired()}),additionalFamilyName:_.Z_().when("addNameInLocalLanguage",{is:!0,then:_.Z_().required("familyNameRequired"),otherwise:_.Z_().notRequired()}),gender:_.Z_().oneOf(["Male","Female","Other","Unknown"],"genderUnspecified").required("genderRequired"),birthdate:_.hT().when("birthdateEstimated",{is:!1,then:_.hT().required("birthdayRequired").max(Date(),"birthdayNotInTheFuture").nullable(),otherwise:_.hT().nullable()}),yearsEstimated:_.Rx().when("birthdateEstimated",{is:!0,then:_.Rx().required("yearsEstimateRequired").min(0,"negativeYears"),otherwise:_.Rx().nullable()}),monthsEstimated:_.Rx().min(0,"negativeMonths"),deathDate:_.hT().max(Date(),"deathdayNotInTheFuture").nullable(),email:_.Z_().optional().email("invalidEmail"),identifiers:_.Vo((function(e){return _.Ry(p()(e,(function(){return _.Ry({required:_.Xg(),identifierValue:_.Z_().when("required",{is:!0,then:_.Z_().required("identifierValueRequired"),otherwise:_.Z_().notRequired()})})})))}))}),g=(0,r.createContext)(void 0),h=n(3076),v=n(7117),b=n(9571),y=n(6062),w=n.n(y),E=n(4036),x=n.n(E),k=n(6793),T=n.n(k),S=n(7892),O=n.n(S),N=n(1173),I=n.n(N),C=n(2464),j=n.n(C),A=n(4939),P={};P.styleTagTransform=j(),P.setAttributes=O(),P.insert=T().bind(null,"head"),P.domAPI=x(),P.insertStyleElement=I(),w()(A.Z,P);const D=A.Z&&A.Z.locals?A.Z.locals:void 0;var F={patientUuid:(0,b.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",isDead:!1,deathDate:"",deathCause:"",relationships:[],address:{address1:"Bom Jesus Street",address2:"",cityVillage:"Recife",stateProvince:"Pernambuco",country:"Brazil",postalCode:"50030-310"},identifiers:{}},B=function(e){var t=e.setValues;return i().createElement("main",null,i().createElement("button",{onClick:function(){return t(F)},className:"omrs-btn omrs-filled-neutral ".concat(D.dummyData),type:"button","aria-label":"Dummy Data Input"},"Input Dummy Data"))},L=n(2777),U=n(1525);function z(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 V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(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){V(e,t,n[t])}))}return e}function R(e,t,n){var r,i,a;return null!==(a=null===(i=null===(r=n.querySelector(t))||void 0===r?void 0:r.querySelector("[name=".concat(e,"]")))||void 0===i?void 0:i.getAttribute("value"))&&void 0!==a?a:null}function H(){(0,l.navigate)({to:"".concat(window.spaBase,"/home")})}function q(e){var t,n={},r=null===(t=e.address)||void 0===t?void 0:t[0];if(r){var i=!0,a=!1,o=void 0;try{for(var l,s=Object.keys(r)[Symbol.iterator]();!(i=(l=s.next()).done);i=!0){var c=l.value;switch(c){case"city":n.cityVillage=r[c];break;case"state":n.stateProvince=r[c];break;case"district":n.countyDistrict=r[c];break;case"extension":r[c].forEach((function(e){e.extension.forEach((function(e){n[e.url.split("#")[1]]=e.valueString}))}));break;default:"country"!==c&&"postalCode"!==c||(n[c]=r[c])}}}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}}return n}function M(e){var t,n=e.name[0],r=e.name[1],i=null===(t=e.address)||void 0===t?void 0:t[0];return Z({preferredNameUuid:null==n?void 0:n.id,additionalNameUuid:null==r?void 0:r.id,preferredAddressUuid:null==i?void 0:i.id},e.identifier.map((function(e){return V({},(0,L.Z)(e.system||e.type.text),{uuid:e.id,value:e.value})})))}var G=n(9857),W=n(8179);function Y(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 Q(e,t,n,r,i,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(r,i)}function K(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Q(a,r,i,o,l,"next",e)}function l(e){Q(a,r,i,o,l,"throw",e)}o(void 0)}))}}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X(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){$(e,t,n[t])}))}return e}function J(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 ee(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Y(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)?Y(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 te=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function ne(e){return re.apply(this,arguments)}function re(){return(re=K((function(e){return te(this,(function(t){switch(t.label){case 0:return[4,(0,l.getSynchronizationItems)(W.Kt)];case 1:return[2,t.sent().find((function(t){return t._patientRegistrationData.formValues.patientUuid===e}))]}}))}))).apply(this,arguments)}var ie=n(225),ae=n(1093),oe={};oe.styleTagTransform=j(),oe.setAttributes=O(),oe.insert=T().bind(null,"head"),oe.domAPI=x(),oe.insertStyleElement=I(),w()(ae.Z,oe);const le=ae.Z&&ae.Z.locals?ae.Z.locals:void 0;function se(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 ce(){return ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ce.apply(this,arguments)}var ue=function(e){var t,n,a=e.checkWarning,l=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,["checkWarning"]),s=(t=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return se(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)?se(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],_=s[1],m=(0,u.useTranslation)().t,p=c.value||"",f=_.error&&m(_.error),g=(0,r.useMemo)((function(){if(!f&&"function"==typeof a){var e=a(p);return e&&m(e)}}),[a,f,p,m]),h=l.required?l.labelText:"".concat(l.labelText," (").concat(m("optional","optional"),")");return i().createElement("div",{style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.oil,ce({},l,c,{labelText:h,invalid:!(!_.touched||!_.error),invalidText:f,warn:!!g,warnText:g,value:p}))))},de=function(){var e=(0,u.useTranslation)().t;return i().createElement("div",null,i().createElement(ue,{id:"phone",name:"attributes.14d4f066-15f5-102d-96e4-000c29c2a5d7",labelText:e("phoneNumberInputLabelText","Phone number"),light:!0}))},_e=n(1098),me={};me.styleTagTransform=j(),me.setAttributes=O(),me.insert=T().bind(null,"head"),me.domAPI=x(),me.insertStyleElement=I(),w()(_e.Z,me);const pe=_e.Z&&_e.Z.locals?_e.Z.locals:void 0;var fe=function(){var e=(0,u.useTranslation)().t;return i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},e("phoneEmailLabelText","Phone, Email")),i().createElement("div",{className:pe.grid},i().createElement(de,null),i().createElement(ue,{id:"email",name:"attributes.ac7d7773-fe9f-11ec-8b9b-0242ac1b0002",labelText:e("emailLabelText","Email")})))};function ge(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}var he=/^([^0-9]*)$/;function ve(e){if(!he.test(e))return"numberInNameDubious"}var be=function(){var e,t,n=(0,l.useConfig)().fieldConfigurations.name.displayCapturePhoto,a=(0,u.useTranslation)().t,s=(0,r.useContext)(g),c=s.setCapturePhotoProps,_=s.currentPhoto,m=s.setFieldValue,p=(0,l.useConfig)().fieldConfigurations,f=null==p?void 0:p.name,h=!(e=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ge(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)?ge(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,v=(0,r.useCallback)((function(e,t){c&&c({imageData:e,dateTime:t})}),[c]);return i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},a("fullNameLabelText","Full Name")),i().createElement("div",{className:pe.grid},n&&i().createElement(l.ExtensionSlot,{className:pe.photoExtension,extensionSlotName:"capture-patient-photo-slot",state:{onCapturePhoto:v,initialState:_}}),i().createElement("div",{className:pe.nameField},i().createElement("div",{className:pe.dobContentSwitcherLabel},i().createElement("span",{className:pe.label01},a("patientNameKnown","Patient's Name is Known?"))),i().createElement(o.GHR,{className:pe.contentSwitcher,onChange:function(e){"known"===e.name?(m("givenName",""),m("familyName",""),m("unidentifiedPatient",!1)):(m("givenName",f.defaultUnknownGivenName),m("familyName",f.defaultUnknownFamilyName),m("unidentifiedPatient",!0))}},i().createElement(o.rsf,{name:"known",text:a("yes","Yes")}),i().createElement(o.rsf,{name:"unknown",text:a("no","No")})),h&&i().createElement(i().Fragment,null,i().createElement(ue,{id:"givenName",name:"givenName",labelText:a("givenNameLabelText","First Name"),checkWarning:ve,required:!0}),f.displayMiddleName&&i().createElement(ue,{id:"middleName",name:"middleName",labelText:a("middleNameLabelText","Middle Name"),light:!0,checkWarning:ve}),i().createElement(ue,{id:"familyName",name:"familyName",labelText:a("familyNameLabelText","Family Name"),checkWarning:ve,required:!0})))))};function ye(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}var we=function(){var e,t,n=(0,l.useConfig)().fieldConfigurations,a=(0,u.useTranslation)().t,s=(e=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ye(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)?ye(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],_=s[1],m=(0,r.useContext)(g).setFieldValue,p=null==n?void 0:n.gender;return i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement("h4",{className:pe.productiveHeading02Light},a("sexFieldLabelText","Sex")),i().createElement("div",{className:pe.sexField},i().createElement("p",{className:"cds--label"},a("genderLabelText","Sex")),i().createElement(o.SYO,{name:"gender",orientation:"vertical",onChange:function(e){m("gender",e)},valueSelected:c.value},p.map((function(e){return i().createElement(o.EUY,{key:e.label,id:e.id,value:e.value,labelText:a("".concat(e.label),"".concat(e.label))})}))),_.touched&&_.error&&i().createElement("div",{className:pe.radioFieldError},a(_.error,"Gender is required"))))},Ee=n(6759),xe=n(2074),ke=n(7857),Te={};Te.styleTagTransform=j(),Te.setAttributes=O(),Te.insert=T().bind(null,"head"),Te.domAPI=x(),Te.insertStyleElement=I(),w()(ke.Z,Te);const Se=ke.Z&&ke.Z.locals?ke.Z.locals:void 0;function Oe(){return Oe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oe.apply(this,arguments)}const Ne=function(e){var t=e.close,n=e.children,r=e.header,a=e.buttonsGroup,s=(0,u.useTranslation)().t,c=(0,l.useLayoutType)();return i().createElement("div",{className:(0,l.isDesktop)(c)?Se.desktopOverlay:Se.tabletOverlay},(0,l.isDesktop)(c)?i().createElement("div",{className:Se.desktopHeader},i().createElement("div",{className:Se.headerContent},r),i().createElement(o.zxk,{className:Se.closeButton,iconDescription:s("closeOverlay","Close overlay"),onClick:t,kind:"ghost",hasIconOnly:!0,renderIcon:function(e){return i().createElement(xe.x8,Oe({size:16},e))}})):i().createElement(o.h4i,{className:Se.tabletOverlayHeader},i().createElement(o.zxk,{kind:"ghost",onClick:t,hasIconOnly:!0,iconDescription:s("closeOverlay","Close overlay"),renderIcon:function(e){return i().createElement(Ee.Xd,Oe({size:16,onClick:t},e))}}),i().createElement("div",{className:Se.headerContent},r)),i().createElement("div",{className:Se.overlayContent},n),i().createElement("div",null,a))};function Ie(e){return Ce(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 Ce(e){return"UNIQUE"===e.uniquenessBehavior||"LOCATION"===e.uniquenessBehavior}var je=n(3433),Ae={};Ae.styleTagTransform=j(),Ae.setAttributes=O(),Ae.insert=T().bind(null,"head"),Ae.domAPI=x(),Ae.insertStyleElement=I(),w()(je.Z,Ae);const Pe=je.Z&&je.Z.locals?je.Z.locals:void 0;function De(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 Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Be(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){Fe(e,t,n[t])}))}return e}function Le(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 Ue(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return De(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)?De(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)(),d=(0,r.useContext)(s.Cg).identifierTypes,_=(0,r.useContext)(g),m=_.isOffline,p=_.values,f=_.initialFormValues,h=Ue((0,r.useState)(p.identifiers),2),v=h[0],b=h[1],y=Ue((0,r.useState)(""),2),w=y[0],E=y[1],x=(0,u.useTranslation)().t,k=(0,l.useConfig)().defaultPatientIdentifierTypes,T=(0,r.useMemo)((function(){var e={};return null==k||k.forEach((function(t){e[t]=!0})),e}),[k]);(0,r.useEffect)((function(){b(p.identifiers)}),[p.identifiers]);var S=(0,r.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:"")}),[]),O=(0,r.useMemo)((function(){return null==d?void 0:d.filter((function(e){var t;return null==e||null===(t=e.name)||void 0===t?void 0:t.toLowerCase().includes(w.toLowerCase())}))}),[v,w]),N=function(e,t){return b((function(n){var r,i;return t?Le(Be({},n),Fe({},e.fieldName,et(e,null!==(i=null!==(r=p.identifiers[e.fieldName])&&void 0!==r?r:f.identifiers[e.fieldName])&&void 0!==i?i:{}))):n[e.fieldName]?Object.fromEntries(Object.entries(n).filter((function(t){return Ue(t,1)[0]!==e.fieldName}))):n}))},I=(0,r.useMemo)((function(){return O.map((function(e){var t,n,r=v[e.fieldName],a=e.isPrimary||e.required||T[e.uuid]||p.identifiers[e.fieldName],l=m&&Ie(e);return i().createElement("div",{key:e.uuid,className:Pe.space05},i().createElement(o.XZJ,{id:e.uuid,value:e.uuid,labelText:e.name,onChange:function(t){return N(e,t)},checked:!!r,disabled:a||m&&l}),r&&(null==e||null===(t=e.identifierSources)||void 0===t?void 0:t.length)>0&&(!r.initialValue||(null==r?void 0:r.selectedSource))&&i().createElement("div",{className:Pe.radioGroup},i().createElement(o.SYO,{legendText:x("source","Source"),name:"".concat(null==e?void 0:e.fieldName,"-identifier-sources"),defaultSelected:null==r||null===(n=r.selectedSource)||void 0===n?void 0:n.uuid,onChange:function(t){return function(e,t){return b((function(n){return Le(Be({},n),Fe({},e.fieldName,Be({},n[e.fieldName],Je(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 i().createElement(o.EUY,{key:t.uuid,labelText:t.name,name:t.uuid,value:t.uuid,className:Pe.radioButton,disabled:m&&Ce(e)&&(null===(n=t.autoGenerationOption)||void 0===n?void 0:n.manualEntryEnabled)})})))))}))}),[O,v,T,p.identifiers,m,N]),C=(0,r.useCallback)((function(){a("identifiers",v),n()}),[v,a]);return i().createElement(Ne,{close:n,header:x("configureIdentifiers","Configure identifiers"),buttonsGroup:i().createElement(o.uVA,{className:(0,l.isDesktop)(c)?Pe.desktop:Pe.tablet},i().createElement(o.zxk,{className:Pe.button,kind:"secondary",onClick:n},x("cancel","Cancel")),i().createElement(o.zxk,{className:Pe.button,kind:"primary",onClick:C},x("configureIdentifiers","Configure identifiers")))},i().createElement("div",null,i().createElement("p",{className:Pe.bodyLong02},x("IDInstructions","Select the identifiers you'd like to add for this patient:")),d.length>7&&i().createElement("div",{className:Pe.space05},i().createElement(o.olm,{labelText:x("searchIdentifierPlaceholder","Search identifier"),placeholder:x("searchIdentifierPlaceholder","Search identifier"),onChange:S,value:w})),i().createElement("fieldset",null,I)))};var Ve=n(7631),Ze=n(3469),Re=n(5508);function He(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 qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(){return Me=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(this,arguments)}function Ge(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){qe(e,t,n[t])}))}return e}function We(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return He(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)?He(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 Ye=function(e){var t=e.patientIdentifier,n=e.fieldName,a=(0,u.useTranslation)().t,c=(0,l.useConfig)().defaultPatientIdentifierTypes,_=(0,r.useContext)(s.Cg).identifierTypes,m=(0,r.useContext)(g),p=m.isOffline,f=m.values,h=m.setFieldValue,v=(0,r.useMemo)((function(){return _.find((function(e){return e.uuid===t.identifierTypeUuid}))}),[t,_]),b=t.autoGeneration,y=t.initialValue,w=t.identifierValue,E=t.identifierName,x=t.required,k=We((0,r.useState)(b||y===w),2),T=k[0],S=k[1],O="identifiers.".concat(n,".identifierValue"),N=We((0,d.U$)(O),2),I=N[0],C=N[1],j=p&&Ie(v),A=(0,r.useMemo)((function(){var e={};return null==c||c.forEach((function(t){e[t]=!0})),e}),[c]),P=(0,r.useCallback)((function(){var e,r;S(!0),h("identifiers.".concat(n),(e=Ge({},t),r=null!=(r={identifierValue:y,selectedSource:null,autoGeneration:!1})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})),e))}),[y,S]);return i().createElement("div",{className:D.IDInput},b||T?i().createElement("div",{className:D.textID},i().createElement("p",{className:D.label},E),i().createElement("p",{className:D.bodyShort02},b?a("autoGeneratedPlaceholderText","Auto-generated"):w),i().createElement("input",Me({type:"hidden"},I,{disabled:!0})),!(!C.touched||!C.error)&&i().createElement("span",{className:D.dangerLabel01},C.error&&a(C.error))):i().createElement(ue,Me({id:O,labelText:E,name:O,disabled:j,required:x,invalid:!(!C.touched||!C.error),invalidText:C.error&&a(C.error)},I)),i().createElement("div",null,!t.required&&t.initialValue&&T&&i().createElement(o.zxk,{kind:"ghost",onClick:function(){var e;S(!1),h("identifiers.".concat(n),Ge({},t,Je(null==v||null===(e=v.identifierSources)||void 0===e?void 0:e[0],y,y)))},iconDescription:a("editIdentifierTooltip","Edit"),disabled:j,hasIconOnly:!0},i().createElement(Ve.I8,{size:16})),y&&y!==w&&i().createElement(o.zxk,{kind:"ghost",onClick:P,iconDescription:a("resetIdentifierTooltip","Reset"),disabled:j,hasIconOnly:!0},i().createElement(Ze.AG,{size:16})),!t.required&&!A[t.identifierTypeUuid]&&i().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},i().createElement(o.zxk,{kind:"danger--ghost",onClick:function(){if(y)var e=(0,l.showModal)("delete-identifier-confirmation-modal",{deleteIdentifier:function(t){t&&h("identifiers",tt(f.identifiers,n)),e()},identifierName:E,initialValue:y});else h("identifiers",tt(f.identifiers,n))},iconDescription:a("deleteIdentifierTooltip","Delete"),disabled:j,hasIconOnly:!0},i().createElement(Re.ZN,{size:16})))))};function Qe(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 Ke(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $e(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){Ke(e,t,n[t])}))}return e}function Xe(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}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.")}()}function Je(e,t,n){var r,i=null==e||null===(r=e.autoGenerationOption)||void 0===r?void 0:r.automaticGenerationEnabled;return{selectedSource:e,autoGeneration:i,identifierValue:i?"auto-generated":"auto-generated"!==t?t:n}}function et(e,t){var n,r,i;return $e({identifierTypeUuid:e.uuid,identifierName:e.name,preferred:e.isPrimary,initialValue:"",required:e.isPrimary||e.required},t,Je(null!==(r=null==t?void 0:t.selectedSource)&&void 0!==r?r:null===(n=e.identifierSources)||void 0===n?void 0:n[0],null==t?void 0:t.identifierValue,null!==(i=null==t?void 0:t.initialValue)&&void 0!==i?i:""))}function tt(e,t){return Object.fromEntries(Object.entries(e).filter((function(e){return Xe(e,1)[0]!==t})))}var nt=function(){var e=(0,r.useContext)(s.Cg).identifierTypes,t=!e,n=(0,r.useContext)(g),a=n.values,c=n.setFieldValue,d=n.initialFormValues,_=(0,u.useTranslation)().t,m=(0,l.useLayoutType)(),p=Xe((0,r.useState)(!1),2),f=p[0],h=p[1],v=(0,l.useConfig)().defaultPatientIdentifierTypes;return(0,r.useEffect)((function(){if(e){var t={};e.filter((function(e){return e.isPrimary||e.required||!!(null==v?void 0:v.find((function(t){return t===e.uuid})))})).filter((function(e){return!a.identifiers[e.fieldName]})).forEach((function(e){var n,r;t[e.fieldName]=et(e,null!==(r=null!==(n=a.identifiers[e.uuid])&&void 0!==n?n:d.identifiers[e.uuid])&&void 0!==r?r:{})})),Object.keys(t).length&&c("identifiers",$e({},a.identifiers,t))}}),[e,c,et,v,a.identifiers]),t?i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement("div",{className:pe.identifierLabelText},i().createElement("h4",{className:pe.productiveHeading02Light},_("idFieldLabelText","Identifiers"))),i().createElement(o.N2B,null)):i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},i().createElement("div",{className:pe.identifierLabelText},i().createElement("h4",{className:pe.productiveHeading02Light},_("idFieldLabelText","Identifiers")),i().createElement(o.zxk,{kind:"ghost",className:pe.setIDNumberButton,onClick:function(){return h(!0)},size:(0,l.isDesktop)(m)?"sm":"md"},_("configure","Configure")," ",i().createElement(Ee.ol,{size:16})))),i().createElement("div",null,Object.entries(a.identifiers).map((function(e){var t=Xe(e,2),n=t[0],r=t[1];return i().createElement(Ye,{key:n,fieldName:n,patientIdentifier:r})})),f&&i().createElement(ze,{setFieldValue:c,closeOverlay:function(){return h(!1)}})))};function rt(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 it(){return it=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},it.apply(this,arguments)}function at(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rt(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)?rt(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 ot=function(e,t,n){var r=n.useEstimatedDateOfBirth,i=r.enabled,a=r.month,o=r.dayOfMonth,l=new Date,s=new Date(l.getFullYear()-e,l.getMonth()-t,1),c=new Date(s.getFullYear(),s.getMonth()+1,0).getDate(),u=new Date(s.getFullYear(),s.getMonth(),Math.min(l.getDate(),c));return i?new Date(u.getFullYear(),a,o):u},lt=function(){var e,t,n=(0,u.useTranslation)().t,a=(0,l.useConfig)().fieldConfigurations.dateOfBirth,s=!at((0,d.U$)("birthdateEstimated"),1)[0].value,c=at((0,d.U$)("birthdate"),2),_=c[0],m=c[1],p=at((0,d.U$)("yearsEstimated"),2),f=p[0],h=p[1],v=at((0,d.U$)("monthsEstimated"),2),b=v[0],y=v[1],w=(0,r.useContext)(g).setFieldValue,E=(t="/",{parse:function(n){var r=n.split(t),i=new Date(null);return e.forEach((function(e,t){switch(e){case"d":i.setDate(parseInt(r[t]));break;case"m":i.setMonth(parseInt(r[t])-1);break;case"Y":i.setFullYear(parseInt(r[t]))}})),i},format:function(n){if(null===n)return"";if(i=n,null!=(a=Date)&&"undefined"!=typeof Symbol&&a[Symbol.hasInstance]?a[Symbol.hasInstance](i):i instanceof a){var r=[];return e.forEach((function(e,t){switch(e){case"d":r[t]=n.getDate();break;case"m":r[t]=n.getMonth()+1;break;case"Y":r[t]=n.getFullYear()}})),r.join(t)}return n;var i,a},placeHolder:(e=["d","m","Y"]).map((function(e){return"Y"===e?"YYYY":e+e})).join(t),dateFormat:e.join(t)}),x=E.format,k=E.placeHolder,T=E.dateFormat,S=new Date;return i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement("h4",{className:pe.productiveHeading02Light},n("birthFieldLabelText","Birth")),i().createElement("div",{className:pe.dobField},i().createElement("div",{className:pe.dobContentSwitcherLabel},i().createElement("span",{className:pe.label01},n("dobToggleLabelText","Date of Birth Known?"))),i().createElement(o.GHR,{onChange:function(e){w("birthdateEstimated","unknown"===e.name),w("birthdate",""),w("yearsEstimated",""),w("monthsEstimated","")}},i().createElement(o.rsf,{name:"known",text:n("yes","Yes")}),i().createElement(o.rsf,{name:"unknown",text:n("no","No")}))),s?i().createElement("div",{className:pe.dobField},i().createElement(o.Mtg,{dateFormat:T,datePickerType:"single",onChange:function(e){var t=at(e,1)[0];w("birthdate",t)},maxDate:x(S)},i().createElement(o.aj6,it({id:"birthdate"},_,{placeholder:k,labelText:n("dateOfBirthLabelText","Date of Birth"),invalid:!(!m.touched||!m.error),invalidText:m.error&&n(m.error),value:x(_.value)})))):i().createElement("div",{className:pe.grid},i().createElement(o.oil,{id:"yearsEstimated",type:"number",name:f.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<140&&t>=0&&(w("yearsEstimated",t),w("birthdate",ot(t,y.value,a)))},labelText:n("estimatedAgeInYearsLabelText","Estimated age in years"),invalid:!(!h.touched||!h.error),invalidText:h.error&&n(h.error),value:f.value,min:0,required:!0}),i().createElement(o.oil,{id:"monthsEstimated",type:"number",name:b.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<=11&&t>=0&&(w("monthsEstimated",t),w("birthdate",ot(h.value,t,a)))},labelText:n("estimatedAgeInMonthsLabelText","Estimated age in months"),invalid:!(!y.touched||!y.error),invalidText:y.error&&n(y.error),value:b.value,min:0})))};function st(){return st=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},st.apply(this,arguments)}var ct=function(e){var t=e.fieldDefinition,n=(0,u.useTranslation)().t;return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.gN,{name:t.id},(function(e){var r=e.field,a=e.form;return a.touched,a.errors,e.meta,i().createElement(ue,st({id:t.id,labelText:n("".concat(t.label),"".concat(t.label))},r))})))},ut=n(2303);function dt(e){var t,n="string"==typeof e&&""!==e,r=(0,ut.Z)(n?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),i=r.data,a=r.error;return a&&(0,l.showToast)({title:a.name,description:a.message,kind:"error"}),{data:null==i||null===(t=i.data)||void 0===t?void 0:t.answers,isLoading:!i&&!a}}function _t(){return _t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_t.apply(this,arguments)}function mt(e){var t=e.fieldDefinition,n=function(e){var t="string"==typeof e&&""!==e,n=(0,ut.Z)(t?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),r=n.data,i=n.error;return i&&(0,l.showToast)({title:i.name,description:i.message,kind:"error"}),{data:null==r?void 0:r.data,isLoading:!r&&!i}}(t.uuid),r=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(r.datatype.display){case"Text":return i().createElement(pt,{concept:r,validationRegex:t.validation.matches,label:t.label});case"Numeric":return i().createElement(ft,{concept:r,label:t.label});case"Coded":return i().createElement(gt,{concept:r,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return i().createElement(o.K0D,{kind:"error",title:"Error"},'Concept has unknown datatype "',r.datatype.display,'"')}}function pt(e){var t=e.concept,n=e.validationRegex,r=e.label,a=(0,u.useTranslation)().t,o="obs.".concat(t.uuid);return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.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,i().createElement(ue,_t({id:o,labelText:null!=r?r:t.display,invalid:s[o]&&l[o]},n))})))}function ft(e){var t=e.concept,n=e.label,r=((0,u.useTranslation)().t,"obs.".concat(t.uuid));return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.gN,{name:r},(function(e){var a=e.field,o=e.form,l=o.touched,s=o.errors;return e.meta,i().createElement(ue,_t({id:r,labelText:null!=n?n:t.display,invalid:s[r]&&l[r],type:"number"},a))})))}function gt(e){var t,n=e.concept,r=e.answerConceptSetUuid,a=e.label,s=(0,l.useConfig)(),c=dt(null!=r?r:n.uuid),u=c.data,_=c.isLoading,m="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 i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},_?null:i().createElement(d.gN,{name:m},(function(e){var t,r=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)?i().createElement(o.PhF,_t({id:m,name:m,labelText:null!=a?a:null==n?void 0:n.display,light:!0,invalid:c[m]&&s[m]},r),i().createElement(o.QlF,{key:"no-answer-select-item-".concat(m),value:"",text:""}),null==p?void 0:p.customConceptAnswers.map((function(e){return i().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.label})}))):i().createElement(o.mh4,null,i().createElement(o.PhF,_t({id:m,name:m,labelText:null!=a?a:null==n?void 0:n.display,invalid:c[m]&&s[m]},r),i().createElement(o.QlF,{key:"no-answer-select-item-".concat(m),value:"",text:""}),u.map((function(e){return i().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})}))))})))}function ht(e){var t=e.personAttributeType,n=e.answerConceptSetUuid,r=e.label,a=dt(n),l=a.data,s=a.isLoading;return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},!s&&(null==l?void 0:l.length)?i().createElement(o.mh4,null,i().createElement(o.PhF,{id:"person-attribute-".concat(t.uuid),name:"attributes.".concat(t.uuid),labelText:null!=r?r:null==t?void 0:t.display},i().createElement(o.QlF,{value:"",text:""}),l.map((function(e){return i().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))):i().createElement(ue,{id:"person-attribute-".concat(t.uuid),labelText:null!=r?r:null==t?void 0:t.display,name:"attributes.".concat(t.uuid)}))}function vt(){return vt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vt.apply(this,arguments)}function bt(e){var t=e.personAttributeType,n=e.validationRegex,r=e.label,a=e.required,o=(0,u.useTranslation)().t,l="attributes.".concat(t.uuid);return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.gN,{name:l,validate:function(e){if(e&&n&&""!==n&&"string"==typeof n&&""!==e)return new RegExp(n).test(e)?void 0:o("invalidInput","Invalid Input")}},(function(e){var n=e.field,o=e.form,s=o.touched,c=o.errors;return e.meta,i().createElement(ue,vt({id:"person-attribute-".concat(t.uuid),labelText:null!=r?r:null==t?void 0:t.display,invalid:c[l]&&s[l]},n,{required:a}))})))}function yt(e){var t=e.fieldDefinition,n=function(e){var t=(0,ut.Z)("/ws/rest/v1/personattributetype/".concat(e),l.openmrsFetch),n=t.data,r=t.error;return r&&(0,l.showToast)({title:r.name,description:r.message,kind:"error"}),{data:null==n?void 0:n.data,isLoading:!n&&!r}}(t.uuid),r=n.data;if(n.isLoading)return null;switch(r.format){case"java.lang.String":return i().createElement(bt,{personAttributeType:r,validationRegex:t.validation.matches,label:t.label,required:t.validation.required});case"org.openmrs.Concept":return i().createElement(ht,{personAttributeType:r,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return i().createElement(o.K0D,{kind:"error",title:"Error"},'Patient attribute type has unknown format "',r.format,'"')}}function wt(e){var t=e.name,n=(0,l.useConfig)().fieldDefinitions.filter((function(e){return e.id==t}))[0];return"person attribute"===n.type?i().createElement(yt,{fieldDefinition:n}):"obs"===n.type?i().createElement(mt,{fieldDefinition:n}):"address"===n.type?i().createElement(ct,{fieldDefinition:n}):i().createElement("div",null,"Error: Unknown field type ",n.type)}function Et(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 xt(){return xt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xt.apply(this,arguments)}function kt(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Et(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)?Et(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 Tt=function(e){var t,n=e.name,a=e.labelText,s=e.placeholder,c=e.setSelectedValue,_=e.selected,m=e.textFieldName,p=(0,u.useTranslation)().t,f=kt((0,d.U$)(n),3),g=f[0],h=(f[1],f[2]),v=kt((0,r.useState)([]),2),b=v[0],y=v[1],w=kt((0,r.useState)(),2),E=w[0],x=w[1],k=h.setValue;return E?i().createElement("span",null,p("".concat(E.message))):i().createElement("div",{style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.CtY,xt({id:n,onInputChange:function(e){var t,n,r,i;""==(t=e)||(n=m.replace(" ",""),r=_,i=t,(0,l.openmrsFetch)("".concat("/module/addresshierarchy/ajax/getPossibleAddressHierarchyEntriesWithParents.form","?addressField=").concat(n,"&limit=20&searchString=").concat(i,"&parentUuid=").concat(r),{method:"GET"})).then((function(e){y(e.data.map((function(e){return{id:e.uuid,text:e.name}})))})).catch((function(e){x(e)})),k(e)},items:b,itemToString:function(e){return null!==(t=null==e?void 0:e.text)&&void 0!==t?t:""}},g,{onChange:function(e){Boolean(e.selectedItem)?(c(e.selectedItem.id),k(e.selectedItem.text)):(c(void 0),k(void 0))},placeholder:s,titleText:a,light:!0}))))},St=n(5671),Ot={};Ot.styleTagTransform=j(),Ot.setAttributes=O(),Ot.insert=T().bind(null,"head"),Ot.domAPI=x(),Ot.insertStyleElement=I(),w()(St.Z,Ot);const Nt=St.Z&&St.Z.locals?St.Z.locals:void 0;function It(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 Ct(e,t){if(e){if("string"==typeof e)return It(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)?It(e,t):void 0}}const jt=function(e){var t,n,a=e.addressLayout,l=(0,u.useTranslation)().t,s=" > ",c=(0,r.useRef)(null),_=(0,r.useRef)(null),m=(t=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||Ct(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.")}()),p=m[0],f=m[1],g=(0,v.f$)(p,s),h=g.addresses,b=g.isLoading,y=g.error,w=(0,r.useMemo)((function(){var e=new Set;return h.forEach((function(t){var n=t.split(s);n.forEach((function(t,r){t.toLowerCase().includes(p.toLowerCase())&&e.add(n.slice(0,r+1).join(s))}))})),function(e){return function(e){if(Array.isArray(e))return It(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ct(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.")}()}(e)}),[h,p]),E=(0,d.u6)().setFieldValue,x=function(e){_.current&&!_.current.contains(e.target)&&f("")};return(0,r.useEffect)((function(){return document.addEventListener("mousedown",x),function(){document.removeEventListener("mousedown",x)}}),[_]),i().createElement("div",{className:Nt.autocomplete,ref:_,style:{marginBottom:"1rem"}},i().createElement(o.olm,{onChange:function(e){f(e.target.value)},labelText:l("searchAddress","Search address"),placeholder:l("searchAddress","Search address"),ref:c,helperText:p?b?l("loadingResults","Loading results"):y?y.message:0===(null==h?void 0:h.length)?l("noResultsFound","No results found"):null:null,value:p}),w.length>0&&i().createElement("ul",{className:Nt.suggestions},w.map((function(e,t){return i().createElement("li",{key:t,onClick:function(t){return function(e){if(e){var t=e.split(s);a.map((function(e,n){var r,i=e.name;E("address.".concat(i),null!==(r=null==t?void 0:t[n])&&void 0!==r?r:"")})),f("")}}(e)}},e)}))))};var At=n(7279);function Pt(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 Dt(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pt(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)?Pt(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 Ft(e){return(new DOMParser).parseFromString(e,"text/xml")}function Bt(e,t){var n=t.getElementsByTagName(e)[0];return Ft(n?n.outerHTML:"")}var Lt=function(){var e=Dt((0,r.useState)(""),2),t=e[0],n=e[1],a=Dt((0,r.useState)([]),2),c=a[0],d=a[1],_=(0,u.useTranslation)().t,m=(0,r.useContext)(s.Cg).addressTemplate,p=null==m?void 0:m.results[0].value,f=function(e){n(e)},g=(0,l.useConfig)(),h=g.fieldConfigurations.address.useAddressHierarchy,v=h.enabled,b=h.useQuickSearch,y=h.searchAddressByLevel;return(0,l.useLayoutType)(),(0,r.useEffect)((function(){var e=Ft(p),t=Bt("elementdefaults",e),n=Bt("nameMappings",e),r=Array.from(n.getElementsByTagName("property")).length>0?n.getElementsByTagName("property"):n.getElementsByTagName("entry"),i=Array.prototype.map.call(r,(function(e){var n,r,i=null!==(n=e.getAttribute("name"))&&void 0!==n?n:e.getElementsByTagName("string")[0].innerHTML,a=(null!==(r=e.getAttribute("value"))&&void 0!==r||e.getElementsByTagName("string")[1].innerHTML,function(e,t){var n=t.getElementsByName(e)[0];return n?n.getAttribute("value"):null}(i,t));return{id:i,name:i,value:a}}));d(i)}),[_,p]),m?i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},_("addressHeader","Address")),i().createElement("div",{style:{paddingBottom:"5%"}},v?i().createElement(i().Fragment,null,b&&i().createElement(jt,{addressLayout:c}),c.map((function(e,n){return y?i().createElement(Tt,{key:"combo_input_".concat(n),textFieldName:e.name,name:"address.".concat(e.name),labelText:(0,At.Z)(g.fieldConfigurations.address.useAddressHierarchy.useAddressHierarchyLabel)?_(e.name):g.fieldConfigurations.address.useAddressHierarchy.useAddressHierarchyLabel[e.name],id:e.name,setSelectedValue:f,selected:t}):i().createElement(ue,{key:"combo_input_".concat(n),name:"address.".concat(e.name),labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})}))):c.map((function(e,n){return i().createElement(ue,{key:"combo_input_".concat(n),name:"address.".concat(e.name),labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})})))):i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},_("addressHeader","Address")),i().createElement(o.N2B,null))};function Ut(e){var t=e.name,n=(0,l.useConfig)();if(!ie.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(ie.X8).join("', '"),"'.")),null;switch(t){case"name":return i().createElement(be,null);case"gender":return i().createElement(we,null);case"dob":return i().createElement(lt,null);case"address":return i().createElement(Lt,null);case"id":return i().createElement(nt,null);case"phone & email":return i().createElement(fe,null);default:return i().createElement(wt,{name:t})}}var zt=function(e){var t=e.sectionDefinition;return i().createElement("section",{"aria-label":"".concat(t.name," Section")},t.fields.map((function(e){return i().createElement(Ut,{key:"".concat(t.name,"-").concat(e),name:e})})))};function Vt(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 Zt(){return Zt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zt.apply(this,arguments)}function Rt(e,t){if(e){if("string"==typeof e)return Vt(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)?Vt(e,t):void 0}}var Ht=function(e){var t,n,r=e.name,a=e.options,l=e.label,s=e.required,c=(t=(0,d.U$)(r),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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||Rt(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],_=(0,u.useTranslation)().t,m=[i().createElement(o.QlF,{disabled:!0,hidden:!0,text:"Select ".concat(l),key:"",value:""})].concat(function(e){return function(e){if(Array.isArray(e))return Vt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Rt(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 i().createElement(o.QlF,{text:e,value:e,key:t})})))),p=s?l:"".concat(l," (").concat(_("optional","optional"),")");return i().createElement("div",{style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.PhF,Zt({id:"identifier"},c,{labelText:p}),m)))},qt=n(2936),Mt={};Mt.styleTagTransform=j(),Mt.setAttributes=O(),Mt.insert=T().bind(null,"head"),Mt.domAPI=x(),Mt.insertStyleElement=I(),w()(qt.Z,Mt);const Gt=qt.Z&&qt.Z.locals?qt.Z.locals:void 0;var Wt=function(){var e=i().useContext(g).values,t=(0,u.useTranslation)().t;return i().createElement("section",{className:Gt.formSection,"aria-label":"Death Info Section"},i().createElement("h5",{className:"omrs-type-title-5 ".concat(Gt.formSectionTitle)},"Death Info"),i().createElement("section",{className:Gt.fieldGroup},i().createElement(ue,{labelText:t("isDeadInputLabel","Is Dead"),name:"isDead",id:"isDead"}),e.isDead&&i().createElement(i().Fragment,null,i().createElement(ue,{labelText:t("deathDateInputLabel","Date of Death"),name:"deathDate",id:"deathDate"}),i().createElement(Ht,{options:[t("unknown","Unknown"),t("stroke","Stroke")],label:t("causeOfDeathInputLabel","Cause of Death"),name:"deathCause"}))))};function Yt(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}var Qt=function(e){var t,n,a=e.fields,o=(t=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}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.")}()),l=o[0],s=o[1],c=(0,r.useContext)(g).setFieldValue;return(0,r.useEffect)((function(){!l.value&&s.touched&&(c("additionalGivenName",""),c("additionalMiddleName",""),c("additionalFamilyName",""))}),[l.value,s.touched]),i().createElement("section",{className:Gt.formSection,"aria-label":"Demographics Section"},a.map((function(e){return i().createElement(Ut,{key:"demographics-".concat(e),name:e})})))},Kt=n(1662),$t={};$t.styleTagTransform=j(),$t.setAttributes=O(),$t.insert=T().bind(null,"head"),$t.domAPI=x(),$t.insertStyleElement=I(),w()(Kt.Z,$t);const Xt=Kt.Z&&Kt.Z.locals?Kt.Z.locals:void 0;function Jt(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 en(){return en=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},en.apply(this,arguments)}var tn=function(e){var t,n,a=e.getDisplayValue,l=e.getFieldValue,s=e.getSearchResults,c=e.onSuggestionSelected,d=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,["getDisplayValue","getFieldValue","getSearchResults","onSuggestionSelected"]),_=(t=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Jt(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)?Jt(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,r.useRef)(null),g=(0,r.useRef)(null),h=((0,u.useTranslation)().t,d.name),v=d.labelText;(0,r.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 i().createElement("div",{className:Xt.autocomplete,ref:g},i().createElement("label",{className:"cds--label"},v),i().createElement(o.mh4,null,i().createElement(o.olm,en({id:"autosuggest",onChange:function(e){var t=e.target.value;t?s(t).then((function(e){p(e)})):p([])},ref:f,className:Xt.autocompleteSearch},d))),m.length>0&&i().createElement("ul",{className:Xt.suggestions},m.map((function(e,t){return i().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))}))))},nn=n(138),rn={};rn.styleTagTransform=j(),rn.setAttributes=O(),rn.insert=T().bind(null,"head"),rn.domAPI=x(),rn.insertStyleElement=I(),w()(nn.Z,rn);const an=nn.Z&&nn.Z.locals?nn.Z.locals:void 0;function on(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 ln(e,t,n,r,i,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(r,i)}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cn=function(){var e,t,n=(0,r.useContext)(s.Cg).relationshipTypes,a=(e=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return on(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)?on(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],_=(0,u.useTranslation)().t;return(0,r.useEffect)((function(){if(n){var e=[];n.results.forEach((function(t){var n={display:t.aIsToB,uuid:t.uuid,direction:"aIsToB"},r={display:t.bIsToA,uuid:t.uuid,direction:"bIsToA"};n.display===r.display?e.push(n):e.push(n,r)})),c(e)}}),[n]),n?i().createElement("section",{"aria-label":"Relationships Section"},i().createElement(d.F2,{name:"relationships"},(function(e){var t=e.push,n=e.remove,r=e.form.values.relationships;return i().createElement("div",null,r&&r.length>0?r.map((function(e,t){return i().createElement("div",{key:t,className:Gt.formSection},i().createElement(un,{relationship:e,index:t,displayRelationshipTypes:l,key:t,remove:n}))})):null,i().createElement("div",{className:an.actions},i().createElement(o.zxk,{kind:"ghost",onClick:function(){return t({relatedPersonUuid:"",action:"ADD"})}},_("addRelationshipButtonText","Add Relationship"))))}))):i().createElement("section",{"aria-label":"Relationships Section"},i().createElement(o.N2B,null))},un=function(e){var t,n,a,l,s=e.relationship,c=e.index,d=e.displayRelationshipTypes,_=e.remove,m=(0,u.useTranslation)().t,p=i().useContext(g).setFieldValue,f=!s.uuid,h=(0,r.useCallback)((function(e){var t=e.target,n=t.name,r=t.options[t.selectedIndex].value;p(n,r),(null==s?void 0:s.action)||p("relationships[".concat(c,"].action"),"UPDATE")}),[]),b=(0,r.useCallback)((function(e,t){p(e,t)}),[]),y=(t=function(e){var t;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return t=new AbortController,[4,(0,v.M8)(e,t)];case 1:return[2,n.sent().data.results]}}))},n=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){ln(a,r,i,o,l,"next",e)}function l(e){ln(a,r,i,o,l,"throw",e)}o(void 0)}))},function(e){return n.apply(this,arguments)}),w=(0,r.useCallback)((function(){"ADD"===s.action?_(c):p("relationships[".concat(c,"].action"),"DELETE")}),[s,c]),E=(0,r.useCallback)((function(){var e,t;p("relationships[".concat(c,"]"),(e=function(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){sn(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 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))}),[c]);return"DELETE"!==s.action?i().createElement("div",{className:an.relationship},i().createElement("div",{className:an.searchBox},i().createElement("div",{className:an.relationshipHeader},i().createElement("h4",{className:an.productiveHeading},null!==(a=null==s?void 0:s.relation)&&void 0!==a?a:m("relationshipPlaceholder","Relationship")),i().createElement(o.zxk,{kind:"ghost",iconDescription:m("deleteRelationshipTooltipText","Delete"),hasIconOnly:!0,onClick:w},i().createElement(Re.ZN,{size:16,className:an.trashCan}))),i().createElement("div",null,f?i().createElement(tn,{name:"relationships[".concat(c,"].relatedPersonUuid"),labelText:m("relativeFullNameLabelText","Full name"),placeholder:m("relativeNamePlaceholder","Firstname Familyname"),defaultValue:s.relatedPersonName,onSuggestionSelected:b,getSearchResults:y,getDisplayValue:function(e){return e.display},getFieldValue:function(e){return e.uuid},required:!0}):i().createElement(i().Fragment,null,i().createElement("span",{className:an.labelText},m("relativeFullNameLabelText","Full name")),i().createElement("p",{className:an.bodyShort02},s.relatedPersonName)))),i().createElement("div",{className:"".concat(an.selectRelationshipType),style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.PhF,{id:"select",labelText:m("relationship","Relationship"),onChange:h,name:"relationships[".concat(c,"].relationshipType"),defaultValue:null!==(l=null==s?void 0:s.relationshipType)&&void 0!==l?l:"placeholder-item"},i().createElement(o.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:m("relationshipToPatient","Relationship to patient")}),d.map((function(e){return i().createElement(o.QlF,{text:e.display,value:"".concat(e.uuid,"/").concat(e.direction),key:e.display})})))))):i().createElement(o.K0D,{kind:"info",title:m("relationshipRemovedText","Relationship removed"),actions:i().createElement(o.xho,{onClick:E},m("restoreRelationshipActionButton","Undo"))})};function dn(e){var t=e.sectionDefinition;switch(t.id){case"demographics":return i().createElement(Qt,{fields:t.fields});case"death":return i().createElement(Wt,null);case"relationships":return i().createElement(cn,null);default:return i().createElement(zt,{sectionDefinition:t})}}var _n=function(e){var t=e.sectionDefinition,n=e.index,r=(0,u.useTranslation)().t;return i().createElement("div",{id:t.id},i().createElement("h3",{className:le.productiveHeading02,style:{color:"#161616"}},n+1,". ",t.name),i().createElement("span",{className:le.label01},r("allFieldsRequiredText","All fields are required unless marked optional")),i().createElement("div",{style:{margin:"1rem 0 1rem"}},i().createElement(o.n9L,null,i().createElement(dn,{sectionDefinition:t}))))};function mn(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 pn(e){var t;return null===(t=e.split(window.getOpenmrsSpaBase()))||void 0===t?void 0:t[1]}const fn=function(e){var t,n,i=e.when,a=e.redirect,o=(0,u.useTranslation)().t,s=(0,r.useRef)(!1),c=(t=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return mn(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)?mn(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.")}()),d=c[0],_=c[1],m=d||a,p=(0,r.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,r.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,r.useEffect)((function(){if(i&&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,i,p,f]),(0,r.useEffect)((function(){"string"==typeof m&&(0,l.navigate)({to:"${openmrsSpaBase}/".concat(pn(m))})}),[m]),null};function gn(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 hn(e,t,n,r,i,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(r,i)}function vn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bn(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){vn(e,t,n[t])}))}return e}function yn(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gn(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)?gn(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 wn=function(e){var t,n,m=e.savePatientForm,p=e.isOffline,y=(0,r.useContext)(s.Cg),w=y.currentSession,E=y.addressTemplate,x=y.identifierTypes,k=(0,a.useLocation)().search,T=(0,l.useConfig)(),S=yn((0,r.useState)(),2),O=S[0],N=S[1],I=yn((0,r.useState)(f),2),C=I[0],j=I[1],A=(0,a.useParams)().patientUuid,P=(0,l.usePatient)(A),D=P.isLoading,F=P.patient,Y=(0,u.useTranslation)().t,Q=yn((0,r.useState)(null),2),$=Q[0],re=Q[1],ae=yn(function(e){var t=(0,l.usePatient)(e),n=t.isLoading,i=t.patient,a=function(e){var t=!!e,n=(0,G.ZP)(t?"/ws/rest/v1/person/".concat(e,"/attribute"):null,l.openmrsFetch),i=n.data,a=n.error,o=(0,r.useMemo)((function(){var e;return{data:null==i||null===(e=i.data)||void 0===e?void 0:e.results,isLoading:!i&&!a}}),[i,a]);return o}(e),o=a.data,s=a.isLoading,c=function(e){var t=!!e,n=(0,G.ZP)(t?"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)"):null,l.openmrsFetch),i=n.data,a=n.error,o=(0,r.useMemo)((function(){var e,t,n={};return null==i||null===(e=i.data)||void 0===e||null===(t=e.results)||void 0===t||t.forEach((function(e){n[(0,L.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:!i&&!a}}),[i,a]);return o}(e),u=c.data,d=c.isLoading,_=function(e){var t=!!e,n=(0,G.ZP)(t?"/ws/rest/v1/relationship?v=".concat(W.UO,"&person=").concat(e):null,l.openmrsFetch),i=n.data,a=n.error,o=(0,r.useMemo)((function(){var t;return{data:null==i||null===(t=i.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:!i&&!a}}),[e,i,a]);return o}(e),m=_.data,p=_.isLoading,f=ee((0,r.useState)({patientUuid:(0,b.Z)(),givenName:"",middleName:"",familyName:"",unidentifiedPatient:!1,additionalGivenName:"",additionalMiddleName:"",additionalFamilyName:"",addNameInLocalLanguage:!1,gender:"",birthdate:null,yearsEstimated:null,monthsEstimated:0,birthdateEstimated:!1,telephoneNumber:"",isDead:!1,deathDate:"",deathCause:"",relationships:[],identifiers:{},address:{}}),2),g=f[0],h=f[1];return(0,r.useEffect)((function(){K((function(){var t;return te(this,(function(r){switch(r.label){case 0:return i?(h(X(J(X({},g,(o={},l=(a=i).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,U.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]:""),Z({},o,a.identifier.map((function(e){return V({},(0,L.Z)(e.system||e.type.text),e.value)}))))),{address:q(i)}),function(e){var t={};return e.telecom&&(t.phone=e.telecom[0].value),t}(i))),[3,3]):[3,1];case 1:return n||!e?[3,3]:[4,ne(e)];case 2:if(!(t=r.sent())._patientRegistrationData.formValues)return console.error("Found a queued offline patient registration for patient ".concat(e,", but without form values. Not using these values.")),[2];h(t._patientRegistrationData.formValues),r.label=3;case 3:return[2]}var a,o,l,s}))}))()}),[n,i,e]),(0,r.useEffect)((function(){!p&&m&&h((function(e){return J(X({},e),{relationships:m})}))}),[p,m,h]),(0,r.useEffect)((function(){!d&&u&&h((function(e){return J(X({},e),{identifiers:u})}))}),[d,u,h]),(0,r.useEffect)((function(){if(!s&&o){var e={};o.forEach((function(t){e[t.attributeType.uuid]=t.value})),h((function(t){return J(X({},t),{attributes:e})}))}}),[o,h,s]),[g,h]}(A),2),oe=ae[0],se=ae[1],ce=yn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),i=n.isLoading,a=n.patient,o=ee((0,r.useState)(t),2),s=o[0],c=o[1];return(0,r.useEffect)((function(){K((function(){var n,r;return te(this,(function(o){switch(o.label){case 0:return a?(c(J(X({},s),{address:q(a)})),[3,3]):[3,1];case 1:return i||!e?[3,3]:[4,ne(e)];case 2:n=o.sent(),c(null!==(r=null==n?void 0:n._patientRegistrationData.initialAddressFieldValues)&&void 0!==r?r:t),o.label=3;case 3:return[2]}}))}))()}),[i,a,e]),[s,c]}(A),1),ue=ce[0],de=yn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),i=n.isLoading,a=n.patient,o=ee((0,r.useState)(t),2),s=o[0],c=o[1];return(0,r.useEffect)((function(){if(a)c(X({},s,M(a)));else if(!i&&e){var n;ne(e).then((function(e){return c(null!==(n=null==e?void 0:e._patientRegistrationData.initialAddressFieldValues)&&void 0!==n?n:t)}))}}),[i,a,e]),[s,c]}(A),1),_e=de[0],me=null==w||null===(t=w.sessionLocation)||void 0===t?void 0:t.uuid,pe=D?void 0:!(!A||!F),fe=(0,r.useMemo)((function(){return"true"===localStorage.getItem("openmrs:devtools")&&!pe}),[pe]),ge=(0,v.Uu)(null==F?void 0:F.id).data,he=(0,r.useRef)(new h.I),ve=null==T||null===(n=T.fieldDefinitions)||void 0===n?void 0:n.filter((function(e){return"address"===e.type}));(0,r.useEffect)((function(){}),[oe]);var be=(0,r.useMemo)((function(){var e;return T.sections.map((function(t){return null!==(e=T.sectionDefinitions.filter((function(e){return e.id==t}))[0])&&void 0!==e?e:ie.bs.filter((function(e){return e.id==t}))[0]})).filter((function(e){return e}))}),[T.sections,T.sectionDefinitions]);(0,r.useEffect)((function(){if(E){var e=null==E?void 0:E.results[0].value;if(!e)return;var t=function(e){var t=(new DOMParser).parseFromString(e,"text/xml"),n=t.querySelector("nameMappings").getElementsByTagName("entry"),r=Array.prototype.map.call(n,(function(e){var n=e.getElementsByTagName("string")[0].innerHTML;return{name:n,label:e.getElementsByTagName("string")[1].innerHTML,regex:R(n,"elementRegex",t)||".*",regexFormat:R(n,"elementRegexFormats",t)||""}})),i=_.Ry(r.reduce((function(e,t){return e[t.name]=_.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:i}}(e),n=t.addressFieldValues,r=t.addressValidationSchema;if(j((function(e){return e.concat(r)})),!1===pe){var i=!0,a=!1,o=void 0;try{for(var l,s=n[Symbol.iterator]();!(i=(l=s.next()).done);i=!0){var c=l.value,u=c.name,d=c.defaultValue;ue[u]||(ue[u]=d)}}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}null==ve||ve.map((function(e){return ue[e.id]=""})),se(bn({},oe,ue))}}}),[pe,E,ue]);var ye,we,Ee=(ye=function(e,t){var n,r,i,a,o,s,c,u,d;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(_){switch(_.label){case 0:n=new AbortController,t.setSubmitting(!0),r=function(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}(bn({},e),{identifiers:(p=e.identifiers,Object.fromEntries(Object.entries(p).filter((function(e){var t,n,r=(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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}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 r[0],void 0!==r[1].identifierValue}))))}),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,m(!pe,r,_e,ue,$,me,oe.identifiers,w,T,he.current,n)];case 2:return _.sent(),(0,l.showToast)({description:pe?Y("updationSuccessToastDescription","The patient's information has been successfully updated"):Y("registrationSuccessToastDescription","The patient can now be found by searching for them using their name or ID number"),title:pe?Y("updationSuccessToastTitle","Patient Details Updated"):Y("registrationSuccessToastTitle","New Patient Created"),kind:"success"}),i=new URLSearchParams(k).get("afterUrl"),a=(0,l.interpolateUrl)(i||T.links.submitButton,{patientUuid:e.patientUuid}),N(a),[3,4];case 3:return o=_.sent(),(null===(s=o.responseBody)||void 0===s||null===(c=s.error)||void 0===c?void 0:c.globalErrors)?o.responseBody.error.globalErrors.forEach((function(e){(0,l.showToast)({description:e.message})})):(null===(u=o.responseBody)||void 0===u||null===(d=u.error)||void 0===d?void 0:d.message)?(0,l.showToast)({description:o.responseBody.error.message}):(0,l.createErrorHandler)()(o),t.setSubmitting(!1),[3,4];case 4:return[2]}var p}))},we=function(){var e=this,t=arguments;return new Promise((function(n,r){var i=ye.apply(e,t);function a(e){hn(i,n,r,a,o,"next",e)}function o(e){hn(i,n,r,a,o,"throw",e)}a(void 0)}))},function(e,t){return we.apply(this,arguments)}),xe=function(e){return i().createElement("div",null,i().createElement("p",null,Y("fieldErrorTitleMessage","The following fields have errors:")),i().createElement("ul",{style:{listStyle:"inside"}},Object.keys(e).map((function(e,t){return i().createElement("li",{key:t},Y("".concat(e,"LabelText"),e))}))))};return i().createElement(d.J9,{enableReinitialize:!0,initialValues:oe,validationSchema:C,onSubmit:Ee},(function(e){return i().createElement(d.l0,{className:le.form},i().createElement(fn,{when:e.dirty,redirect:O}),i().createElement("div",{className:le.formContainer},i().createElement("div",null,i().createElement("div",{className:le.stickyColumn},i().createElement("h4",null,pe?Y("edit","Edit"):Y("createNew","Create New")," ",Y("patient","Patient")),fe&&i().createElement(B,{setValues:e.setValues}),i().createElement("p",{className:le.label01},Y("jumpTo","Jump to")),be.map((function(e){return i().createElement("div",{className:"".concat(le.space05," ").concat(le.touchTarget),key:e.name},i().createElement(o.rUS,{className:le.linkName,onClick:function(){return t=e.id,void document.getElementById(t).scrollIntoView({behavior:"smooth",block:"center",inline:"center"});var t}},i().createElement(c.Kc,{size:16})," ",e.name))})),i().createElement(o.zxk,{className:le.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:xe(e),title:Y("incompleteForm","Incomplete form"),kind:"warning"})}(e)}))},disabled:!w||!x},pe?Y("updatePatient","Update Patient"):Y("registerPatient","Register Patient")),i().createElement(o.zxk,{className:le.cancelButton,kind:"tertiary",onClick:H},Y("cancel","Cancel")))),i().createElement("div",{className:le.infoGrid},i().createElement(g.Provider,{value:{identifierTypes:x,validationSchema:C,setValidationSchema:j,values:e.values,inEditMode:pe,setFieldValue:e.setFieldValue,setCapturePhotoProps:re,currentPhoto:null==ge?void 0:ge.imageSrc,isOffline:p,initialFormValues:e.initialValues}},be.map((function(e,t){return i().createElement(_n,{key:"registration-section-".concat(e.id),sectionDefinition:e,index:t})}))))))}))},En=n(4954),xn={};xn.styleTagTransform=j(),xn.setAttributes=O(),xn.insert=T().bind(null,"head"),xn.domAPI=x(),xn.insertStyleElement=I(),w()(En.Z,xn);const kn=En.Z&&En.Z.locals?En.Z.locals:void 0;function Tn(e){var t=e.savePatientForm,n=e.isOffline,r=(0,l.useSession)(),c=(0,ut.Z)("patientRegistrationAddressTemplate",s.Te).data,u=(0,ut.Z)("patientRegistrationRelationshipTypes",s.mt).data,d=(0,ut.Z)("patientRegistrationPatientIdentifiers",s.St).data;return i().createElement("main",{className:"omrs-main-content ".concat(kn.root)},i().createElement(o.rjZ,{className:kn.grid},i().createElement(o.X2j,null,i().createElement(l.ExtensionSlot,{extensionSlotName:"breadcrumbs-slot"})),i().createElement(s.Cg.Provider,{value:{addressTemplate:c,relationshipTypes:u,identifierTypes:d,currentSession:r}},i().createElement(a.BrowserRouter,{basename:"".concat(window.getOpenmrsSpaBase())},i().createElement(a.Routes,null,i().createElement(a.Route,{path:"patient-registration",element:i().createElement(wn,{savePatientForm:t,isOffline:n})}),i().createElement(a.Route,{path:"patient/:patientUuid/edit",element:i().createElement(wn,{savePatientForm:t,isOffline:n})}))))))}}}]);
1
+ "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[658],{5671:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-registration__address-search__label01___UPnro{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__address-search__suggestions___qAiUx{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__address-search__suggestions___qAiUx li{padding:1rem;line-height:1.29;color:#525252;border-bottom:1px solid #8d8d8d}.-esm-patient-registration__address-search__suggestions___qAiUx li:hover{background-color:#e5e5e5;color:#161616;cursor:pointer}.-esm-patient-registration__address-search__suggestions___qAiUx li:not(:last-of-type){border-bottom:1px solid #999}.-esm-patient-registration__address-search__autocomplete___S4jFy{position:relative}.-esm-patient-registration__address-search__autocompleteSearch___AG-ZP{width:100%}.-esm-patient-registration__address-search__suggestions___qAiUx a{color:inherit;text-decoration:none}",""]),i.locals={label01:"-esm-patient-registration__address-search__label01___UPnro",suggestions:"-esm-patient-registration__address-search__suggestions___qAiUx",autocomplete:"-esm-patient-registration__address-search__autocomplete___S4jFy",autocompleteSearch:"-esm-patient-registration__address-search__autocompleteSearch___AG-ZP"};const a=i},1098:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},3433:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},1662:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},4939:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},1093:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},138:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},2936:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},7857:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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}",""]),i.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=i},4954:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),i=n.n(r)()((function(e){return e[1]}));i.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))}",""]),i.locals={root:"-esm-patient-registration__root__root___msybz",grid:"-esm-patient-registration__root__grid___p9P+g"};const a=i},7658:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Tn});var r=n(268),i=n.n(r),a=n(8744),o=n(2430),l=n(906),s=n(6279),c=n(781),u=n(4924),d=n(7065),_=n(73),m=n(4519),p=n.n(m),f=_.Ry({givenName:_.Z_().required("givenNameRequired"),familyName:_.Z_().required("familyNameRequired"),additionalGivenName:_.Z_().when("addNameInLocalLanguage",{is:!0,then:_.Z_().required("givenNameRequired"),otherwise:_.Z_().notRequired()}),additionalFamilyName:_.Z_().when("addNameInLocalLanguage",{is:!0,then:_.Z_().required("familyNameRequired"),otherwise:_.Z_().notRequired()}),gender:_.Z_().oneOf(["Male","Female","Other","Unknown"],"genderUnspecified").required("genderRequired"),birthdate:_.hT().when("birthdateEstimated",{is:!1,then:_.hT().required("birthdayRequired").max(Date(),"birthdayNotInTheFuture").nullable(),otherwise:_.hT().nullable()}),yearsEstimated:_.Rx().when("birthdateEstimated",{is:!0,then:_.Rx().required("yearsEstimateRequired").min(0,"negativeYears"),otherwise:_.Rx().nullable()}),monthsEstimated:_.Rx().min(0,"negativeMonths"),deathDate:_.hT().max(Date(),"deathdayNotInTheFuture").nullable(),email:_.Z_().optional().email("invalidEmail"),identifiers:_.Vo((function(e){return _.Ry(p()(e,(function(){return _.Ry({required:_.Xg(),identifierValue:_.Z_().when("required",{is:!0,then:_.Z_().required("identifierValueRequired"),otherwise:_.Z_().notRequired()})})})))}))}),g=(0,r.createContext)(void 0),h=n(3076),v=n(7117),b=n(9571),y=n(6062),w=n.n(y),E=n(4036),x=n.n(E),k=n(6793),T=n.n(k),S=n(7892),O=n.n(S),N=n(1173),I=n.n(N),C=n(2464),j=n.n(C),A=n(4939),P={};P.styleTagTransform=j(),P.setAttributes=O(),P.insert=T().bind(null,"head"),P.domAPI=x(),P.insertStyleElement=I(),w()(A.Z,P);const D=A.Z&&A.Z.locals?A.Z.locals:void 0;var F={patientUuid:(0,b.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",isDead:!1,deathDate:"",deathCause:"",relationships:[],address:{address1:"Bom Jesus Street",address2:"",cityVillage:"Recife",stateProvince:"Pernambuco",country:"Brazil",postalCode:"50030-310"},identifiers:{}},B=function(e){var t=e.setValues;return i().createElement("main",null,i().createElement("button",{onClick:function(){return t(F)},className:"omrs-btn omrs-filled-neutral ".concat(D.dummyData),type:"button","aria-label":"Dummy Data Input"},"Input Dummy Data"))},L=n(2777),U=n(1525);function z(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 V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(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){V(e,t,n[t])}))}return e}function R(e,t,n){var r,i,a;return null!==(a=null===(i=null===(r=n.querySelector(t))||void 0===r?void 0:r.querySelector("[name=".concat(e,"]")))||void 0===i?void 0:i.getAttribute("value"))&&void 0!==a?a:null}function H(){(0,l.navigate)({to:"".concat(window.spaBase,"/home")})}function q(e){var t,n={},r=null===(t=e.address)||void 0===t?void 0:t[0];if(r){var i=!0,a=!1,o=void 0;try{for(var l,s=Object.keys(r)[Symbol.iterator]();!(i=(l=s.next()).done);i=!0){var c=l.value;switch(c){case"city":n.cityVillage=r[c];break;case"state":n.stateProvince=r[c];break;case"district":n.countyDistrict=r[c];break;case"extension":r[c].forEach((function(e){e.extension.forEach((function(e){n[e.url.split("#")[1]]=e.valueString}))}));break;default:"country"!==c&&"postalCode"!==c||(n[c]=r[c])}}}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}}return n}function M(e){var t,n=e.name[0],r=e.name[1],i=null===(t=e.address)||void 0===t?void 0:t[0];return Z({preferredNameUuid:null==n?void 0:n.id,additionalNameUuid:null==r?void 0:r.id,preferredAddressUuid:null==i?void 0:i.id},e.identifier.map((function(e){return V({},(0,L.Z)(e.system||e.type.text),{uuid:e.id,value:e.value})})))}var G=n(9857),W=n(8179);function Y(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 Q(e,t,n,r,i,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(r,i)}function K(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Q(a,r,i,o,l,"next",e)}function l(e){Q(a,r,i,o,l,"throw",e)}o(void 0)}))}}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X(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){$(e,t,n[t])}))}return e}function J(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 ee(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Y(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)?Y(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 te=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function ne(e){return re.apply(this,arguments)}function re(){return(re=K((function(e){return te(this,(function(t){switch(t.label){case 0:return[4,(0,l.getSynchronizationItems)(W.Kt)];case 1:return[2,t.sent().find((function(t){return t._patientRegistrationData.formValues.patientUuid===e}))]}}))}))).apply(this,arguments)}var ie=n(225),ae=n(1093),oe={};oe.styleTagTransform=j(),oe.setAttributes=O(),oe.insert=T().bind(null,"head"),oe.domAPI=x(),oe.insertStyleElement=I(),w()(ae.Z,oe);const le=ae.Z&&ae.Z.locals?ae.Z.locals:void 0;function se(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 ce(){return ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ce.apply(this,arguments)}var ue=function(e){var t,n,a=e.checkWarning,l=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,["checkWarning"]),s=(t=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return se(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)?se(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],_=s[1],m=(0,u.useTranslation)().t,p=c.value||"",f=_.error&&m(_.error),g=(0,r.useMemo)((function(){if(!f&&"function"==typeof a){var e=a(p);return e&&m(e)}}),[a,f,p,m]),h=l.required?l.labelText:"".concat(l.labelText," (").concat(m("optional","optional"),")");return i().createElement("div",{style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.oil,ce({},l,c,{labelText:h,invalid:!(!_.touched||!_.error),invalidText:f,warn:!!g,warnText:g,value:p}))))},de=function(){var e=(0,u.useTranslation)().t;return i().createElement("div",null,i().createElement(ue,{id:"phone",name:"attributes.14d4f066-15f5-102d-96e4-000c29c2a5d7",labelText:e("phoneNumberInputLabelText","Phone number"),light:!0}))},_e=n(1098),me={};me.styleTagTransform=j(),me.setAttributes=O(),me.insert=T().bind(null,"head"),me.domAPI=x(),me.insertStyleElement=I(),w()(_e.Z,me);const pe=_e.Z&&_e.Z.locals?_e.Z.locals:void 0;var fe=function(){var e=(0,u.useTranslation)().t;return i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},e("phoneEmailLabelText","Phone, Email")),i().createElement("div",{className:pe.grid},i().createElement(de,null),i().createElement(ue,{id:"email",name:"attributes.ac7d7773-fe9f-11ec-8b9b-0242ac1b0002",labelText:e("emailLabelText","Email")})))};function ge(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}var he=/^([^0-9]*)$/;function ve(e){if(!he.test(e))return"numberInNameDubious"}var be=function(){var e,t,n=(0,l.useConfig)().fieldConfigurations.name.displayCapturePhoto,a=(0,u.useTranslation)().t,s=(0,r.useContext)(g),c=s.setCapturePhotoProps,_=s.currentPhoto,m=s.setFieldValue,p=(0,l.useConfig)().fieldConfigurations,f=null==p?void 0:p.name,h=!(e=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ge(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)?ge(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,v=(0,r.useCallback)((function(e,t){c&&c({imageData:e,dateTime:t})}),[c]);return i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},a("fullNameLabelText","Full Name")),i().createElement("div",{className:pe.grid},n&&i().createElement(l.ExtensionSlot,{className:pe.photoExtension,extensionSlotName:"capture-patient-photo-slot",state:{onCapturePhoto:v,initialState:_}}),i().createElement("div",{className:pe.nameField},i().createElement("div",{className:pe.dobContentSwitcherLabel},i().createElement("span",{className:pe.label01},a("patientNameKnown","Patient's Name is Known?"))),i().createElement(o.GHR,{className:pe.contentSwitcher,onChange:function(e){"known"===e.name?(m("givenName",""),m("familyName",""),m("unidentifiedPatient",!1)):(m("givenName",f.defaultUnknownGivenName),m("familyName",f.defaultUnknownFamilyName),m("unidentifiedPatient",!0))}},i().createElement(o.rsf,{name:"known",text:a("yes","Yes")}),i().createElement(o.rsf,{name:"unknown",text:a("no","No")})),h&&i().createElement(i().Fragment,null,i().createElement(ue,{id:"givenName",name:"givenName",labelText:a("givenNameLabelText","First Name"),checkWarning:ve,required:!0}),f.displayMiddleName&&i().createElement(ue,{id:"middleName",name:"middleName",labelText:a("middleNameLabelText","Middle Name"),light:!0,checkWarning:ve}),i().createElement(ue,{id:"familyName",name:"familyName",labelText:a("familyNameLabelText","Family Name"),checkWarning:ve,required:!0})))))};function ye(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}var we=function(){var e,t,n=(0,l.useConfig)().fieldConfigurations,a=(0,u.useTranslation)().t,s=(e=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ye(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)?ye(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],_=s[1],m=(0,r.useContext)(g).setFieldValue,p=null==n?void 0:n.gender;return i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement("h4",{className:pe.productiveHeading02Light},a("sexFieldLabelText","Sex")),i().createElement("div",{className:pe.sexField},i().createElement("p",{className:"cds--label"},a("genderLabelText","Sex")),i().createElement(o.SYO,{name:"gender",orientation:"vertical",onChange:function(e){m("gender",e)},valueSelected:c.value},p.map((function(e){return i().createElement(o.EUY,{key:e.label,id:e.id,value:e.value,labelText:a("".concat(e.label),"".concat(e.label))})}))),_.touched&&_.error&&i().createElement("div",{className:pe.radioFieldError},a(_.error,"Gender is required"))))},Ee=n(6759),xe=n(2074),ke=n(7857),Te={};Te.styleTagTransform=j(),Te.setAttributes=O(),Te.insert=T().bind(null,"head"),Te.domAPI=x(),Te.insertStyleElement=I(),w()(ke.Z,Te);const Se=ke.Z&&ke.Z.locals?ke.Z.locals:void 0;function Oe(){return Oe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oe.apply(this,arguments)}const Ne=function(e){var t=e.close,n=e.children,r=e.header,a=e.buttonsGroup,s=(0,u.useTranslation)().t,c=(0,l.useLayoutType)();return i().createElement("div",{className:(0,l.isDesktop)(c)?Se.desktopOverlay:Se.tabletOverlay},(0,l.isDesktop)(c)?i().createElement("div",{className:Se.desktopHeader},i().createElement("div",{className:Se.headerContent},r),i().createElement(o.zxk,{className:Se.closeButton,iconDescription:s("closeOverlay","Close overlay"),onClick:t,kind:"ghost",hasIconOnly:!0,renderIcon:function(e){return i().createElement(xe.x8,Oe({size:16},e))}})):i().createElement(o.h4i,{className:Se.tabletOverlayHeader},i().createElement(o.zxk,{kind:"ghost",onClick:t,hasIconOnly:!0,iconDescription:s("closeOverlay","Close overlay"),renderIcon:function(e){return i().createElement(Ee.Xd,Oe({size:16,onClick:t},e))}}),i().createElement("div",{className:Se.headerContent},r)),i().createElement("div",{className:Se.overlayContent},n),i().createElement("div",null,a))};function Ie(e){return Ce(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 Ce(e){return"UNIQUE"===e.uniquenessBehavior||"LOCATION"===e.uniquenessBehavior}var je=n(3433),Ae={};Ae.styleTagTransform=j(),Ae.setAttributes=O(),Ae.insert=T().bind(null,"head"),Ae.domAPI=x(),Ae.insertStyleElement=I(),w()(je.Z,Ae);const Pe=je.Z&&je.Z.locals?je.Z.locals:void 0;function De(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 Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Be(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){Fe(e,t,n[t])}))}return e}function Le(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 Ue(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return De(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)?De(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)(),d=(0,r.useContext)(s.Cg).identifierTypes,_=(0,r.useContext)(g),m=_.isOffline,p=_.values,f=_.initialFormValues,h=Ue((0,r.useState)(p.identifiers),2),v=h[0],b=h[1],y=Ue((0,r.useState)(""),2),w=y[0],E=y[1],x=(0,u.useTranslation)().t,k=(0,l.useConfig)().defaultPatientIdentifierTypes,T=(0,r.useMemo)((function(){var e={};return null==k||k.forEach((function(t){e[t]=!0})),e}),[k]);(0,r.useEffect)((function(){b(p.identifiers)}),[p.identifiers]);var S=(0,r.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:"")}),[]),O=(0,r.useMemo)((function(){return null==d?void 0:d.filter((function(e){var t;return null==e||null===(t=e.name)||void 0===t?void 0:t.toLowerCase().includes(w.toLowerCase())}))}),[v,w]),N=function(e,t){return b((function(n){var r,i;return t?Le(Be({},n),Fe({},e.fieldName,et(e,null!==(i=null!==(r=p.identifiers[e.fieldName])&&void 0!==r?r:f.identifiers[e.fieldName])&&void 0!==i?i:{}))):n[e.fieldName]?Object.fromEntries(Object.entries(n).filter((function(t){return Ue(t,1)[0]!==e.fieldName}))):n}))},I=(0,r.useMemo)((function(){return O.map((function(e){var t,n,r=v[e.fieldName],a=e.isPrimary||e.required||T[e.uuid]||p.identifiers[e.fieldName],l=m&&Ie(e);return i().createElement("div",{key:e.uuid,className:Pe.space05},i().createElement(o.XZJ,{id:e.uuid,value:e.uuid,labelText:e.name,onChange:function(t){return N(e,t)},checked:!!r,disabled:a||m&&l}),r&&(null==e||null===(t=e.identifierSources)||void 0===t?void 0:t.length)>0&&(!r.initialValue||(null==r?void 0:r.selectedSource))&&i().createElement("div",{className:Pe.radioGroup},i().createElement(o.SYO,{legendText:x("source","Source"),name:"".concat(null==e?void 0:e.fieldName,"-identifier-sources"),defaultSelected:null==r||null===(n=r.selectedSource)||void 0===n?void 0:n.uuid,onChange:function(t){return function(e,t){return b((function(n){return Le(Be({},n),Fe({},e.fieldName,Be({},n[e.fieldName],Je(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 i().createElement(o.EUY,{key:t.uuid,labelText:t.name,name:t.uuid,value:t.uuid,className:Pe.radioButton,disabled:m&&Ce(e)&&(null===(n=t.autoGenerationOption)||void 0===n?void 0:n.manualEntryEnabled)})})))))}))}),[O,v,T,p.identifiers,m,N]),C=(0,r.useCallback)((function(){a("identifiers",v),n()}),[v,a]);return i().createElement(Ne,{close:n,header:x("configureIdentifiers","Configure identifiers"),buttonsGroup:i().createElement(o.uVA,{className:(0,l.isDesktop)(c)?Pe.desktop:Pe.tablet},i().createElement(o.zxk,{className:Pe.button,kind:"secondary",onClick:n},x("cancel","Cancel")),i().createElement(o.zxk,{className:Pe.button,kind:"primary",onClick:C},x("configureIdentifiers","Configure identifiers")))},i().createElement("div",null,i().createElement("p",{className:Pe.bodyLong02},x("IDInstructions","Select the identifiers you'd like to add for this patient:")),d.length>7&&i().createElement("div",{className:Pe.space05},i().createElement(o.olm,{labelText:x("searchIdentifierPlaceholder","Search identifier"),placeholder:x("searchIdentifierPlaceholder","Search identifier"),onChange:S,value:w})),i().createElement("fieldset",null,I)))};var Ve=n(7631),Ze=n(3469),Re=n(5508);function He(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 qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(){return Me=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(this,arguments)}function Ge(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){qe(e,t,n[t])}))}return e}function We(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return He(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)?He(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 Ye=function(e){var t=e.patientIdentifier,n=e.fieldName,a=(0,u.useTranslation)().t,c=(0,l.useConfig)().defaultPatientIdentifierTypes,_=(0,r.useContext)(s.Cg).identifierTypes,m=(0,r.useContext)(g),p=m.isOffline,f=m.values,h=m.setFieldValue,v=(0,r.useMemo)((function(){return _.find((function(e){return e.uuid===t.identifierTypeUuid}))}),[t,_]),b=t.autoGeneration,y=t.initialValue,w=t.identifierValue,E=t.identifierName,x=t.required,k=We((0,r.useState)(b||y===w),2),T=k[0],S=k[1],O="identifiers.".concat(n,".identifierValue"),N=We((0,d.U$)(O),2),I=N[0],C=N[1],j=p&&Ie(v),A=(0,r.useMemo)((function(){var e={};return null==c||c.forEach((function(t){e[t]=!0})),e}),[c]),P=(0,r.useCallback)((function(){var e,r;S(!0),h("identifiers.".concat(n),(e=Ge({},t),r=null!=(r={identifierValue:y,selectedSource:null,autoGeneration:!1})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})),e))}),[y,S]);return i().createElement("div",{className:D.IDInput},b||T?i().createElement("div",{className:D.textID},i().createElement("p",{className:D.label},E),i().createElement("p",{className:D.bodyShort02},b?a("autoGeneratedPlaceholderText","Auto-generated"):w),i().createElement("input",Me({type:"hidden"},I,{disabled:!0})),!(!C.touched||!C.error)&&i().createElement("span",{className:D.dangerLabel01},C.error&&a(C.error))):i().createElement(ue,Me({id:O,labelText:E,name:O,disabled:j,required:x,invalid:!(!C.touched||!C.error),invalidText:C.error&&a(C.error)},I)),i().createElement("div",null,!t.required&&t.initialValue&&T&&i().createElement(o.zxk,{kind:"ghost",onClick:function(){var e;S(!1),h("identifiers.".concat(n),Ge({},t,Je(null==v||null===(e=v.identifierSources)||void 0===e?void 0:e[0],y,y)))},iconDescription:a("editIdentifierTooltip","Edit"),disabled:j,hasIconOnly:!0},i().createElement(Ve.I8,{size:16})),y&&y!==w&&i().createElement(o.zxk,{kind:"ghost",onClick:P,iconDescription:a("resetIdentifierTooltip","Reset"),disabled:j,hasIconOnly:!0},i().createElement(Ze.AG,{size:16})),!t.required&&!A[t.identifierTypeUuid]&&i().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},i().createElement(o.zxk,{kind:"danger--ghost",onClick:function(){if(y)var e=(0,l.showModal)("delete-identifier-confirmation-modal",{deleteIdentifier:function(t){t&&h("identifiers",tt(f.identifiers,n)),e()},identifierName:E,initialValue:y});else h("identifiers",tt(f.identifiers,n))},iconDescription:a("deleteIdentifierTooltip","Delete"),disabled:j,hasIconOnly:!0},i().createElement(Re.ZN,{size:16})))))};function Qe(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 Ke(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $e(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){Ke(e,t,n[t])}))}return e}function Xe(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}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.")}()}function Je(e,t,n){var r,i=null==e||null===(r=e.autoGenerationOption)||void 0===r?void 0:r.automaticGenerationEnabled;return{selectedSource:e,autoGeneration:i,identifierValue:i?"auto-generated":"auto-generated"!==t?t:n}}function et(e,t){var n,r,i;return $e({identifierTypeUuid:e.uuid,identifierName:e.name,preferred:e.isPrimary,initialValue:"",required:e.isPrimary||e.required},t,Je(null!==(r=null==t?void 0:t.selectedSource)&&void 0!==r?r:null===(n=e.identifierSources)||void 0===n?void 0:n[0],null==t?void 0:t.identifierValue,null!==(i=null==t?void 0:t.initialValue)&&void 0!==i?i:""))}function tt(e,t){return Object.fromEntries(Object.entries(e).filter((function(e){return Xe(e,1)[0]!==t})))}var nt=function(){var e=(0,r.useContext)(s.Cg).identifierTypes,t=!e,n=(0,r.useContext)(g),a=n.values,c=n.setFieldValue,d=n.initialFormValues,_=(0,u.useTranslation)().t,m=(0,l.useLayoutType)(),p=Xe((0,r.useState)(!1),2),f=p[0],h=p[1],v=(0,l.useConfig)().defaultPatientIdentifierTypes;return(0,r.useEffect)((function(){if(e){var t={};e.filter((function(e){return e.isPrimary||e.required||!!(null==v?void 0:v.find((function(t){return t===e.uuid})))})).filter((function(e){return!a.identifiers[e.fieldName]})).forEach((function(e){var n,r;t[e.fieldName]=et(e,null!==(r=null!==(n=a.identifiers[e.uuid])&&void 0!==n?n:d.identifiers[e.uuid])&&void 0!==r?r:{})})),Object.keys(t).length&&c("identifiers",$e({},a.identifiers,t))}}),[e,c,et,v,a.identifiers]),t?i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement("div",{className:pe.identifierLabelText},i().createElement("h4",{className:pe.productiveHeading02Light},_("idFieldLabelText","Identifiers"))),i().createElement(o.N2B,null)):i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement(l.UserHasAccess,{privilege:"coreapps.systemAdministration"},i().createElement("div",{className:pe.identifierLabelText},i().createElement("h4",{className:pe.productiveHeading02Light},_("idFieldLabelText","Identifiers")),i().createElement(o.zxk,{kind:"ghost",className:pe.setIDNumberButton,onClick:function(){return h(!0)},size:(0,l.isDesktop)(m)?"sm":"md"},_("configure","Configure")," ",i().createElement(Ee.ol,{size:16})))),i().createElement("div",null,Object.entries(a.identifiers).map((function(e){var t=Xe(e,2),n=t[0],r=t[1];return i().createElement(Ye,{key:n,fieldName:n,patientIdentifier:r})})),f&&i().createElement(ze,{setFieldValue:c,closeOverlay:function(){return h(!1)}})))};function rt(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 it(){return it=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},it.apply(this,arguments)}function at(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rt(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)?rt(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 ot=function(e,t,n){var r=n.useEstimatedDateOfBirth,i=r.enabled,a=r.month,o=r.dayOfMonth,l=new Date,s=new Date(l.getFullYear()-e,l.getMonth()-t,1),c=new Date(s.getFullYear(),s.getMonth()+1,0).getDate(),u=new Date(s.getFullYear(),s.getMonth(),Math.min(l.getDate(),c));return i?new Date(u.getFullYear(),a,o):u},lt=function(){var e,t,n=(0,u.useTranslation)().t,a=(0,l.useConfig)().fieldConfigurations.dateOfBirth,s=!at((0,d.U$)("birthdateEstimated"),1)[0].value,c=at((0,d.U$)("birthdate"),2),_=c[0],m=c[1],p=at((0,d.U$)("yearsEstimated"),2),f=p[0],h=p[1],v=at((0,d.U$)("monthsEstimated"),2),b=v[0],y=v[1],w=(0,r.useContext)(g).setFieldValue,E=(t="/",{parse:function(n){var r=n.split(t),i=new Date(null);return e.forEach((function(e,t){switch(e){case"d":i.setDate(parseInt(r[t]));break;case"m":i.setMonth(parseInt(r[t])-1);break;case"Y":i.setFullYear(parseInt(r[t]))}})),i},format:function(n){if(null===n)return"";if(i=n,null!=(a=Date)&&"undefined"!=typeof Symbol&&a[Symbol.hasInstance]?a[Symbol.hasInstance](i):i instanceof a){var r=[];return e.forEach((function(e,t){switch(e){case"d":r[t]=n.getDate();break;case"m":r[t]=n.getMonth()+1;break;case"Y":r[t]=n.getFullYear()}})),r.join(t)}return n;var i,a},placeHolder:(e=["d","m","Y"]).map((function(e){return"Y"===e?"YYYY":e+e})).join(t),dateFormat:e.join(t)}),x=E.format,k=E.placeHolder,T=E.dateFormat,S=new Date;return i().createElement("div",{className:pe.halfWidthInDesktopView},i().createElement("h4",{className:pe.productiveHeading02Light},n("birthFieldLabelText","Birth")),i().createElement("div",{className:pe.dobField},i().createElement("div",{className:pe.dobContentSwitcherLabel},i().createElement("span",{className:pe.label01},n("dobToggleLabelText","Date of Birth Known?"))),i().createElement(o.GHR,{onChange:function(e){w("birthdateEstimated","unknown"===e.name),w("birthdate",""),w("yearsEstimated",""),w("monthsEstimated","")}},i().createElement(o.rsf,{name:"known",text:n("yes","Yes")}),i().createElement(o.rsf,{name:"unknown",text:n("no","No")}))),s?i().createElement("div",{className:pe.dobField},i().createElement(o.Mtg,{dateFormat:T,datePickerType:"single",onChange:function(e){var t=at(e,1)[0];w("birthdate",t)},maxDate:x(S)},i().createElement(o.aj6,it({id:"birthdate"},_,{placeholder:k,labelText:n("dateOfBirthLabelText","Date of Birth"),invalid:!(!m.touched||!m.error),invalidText:m.error&&n(m.error),value:x(_.value)})))):i().createElement("div",{className:pe.grid},i().createElement(o.oil,{id:"yearsEstimated",type:"number",name:f.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<140&&t>=0&&(w("yearsEstimated",t),w("birthdate",ot(t,y.value,a)))},labelText:n("estimatedAgeInYearsLabelText","Estimated age in years"),invalid:!(!h.touched||!h.error),invalidText:h.error&&n(h.error),value:f.value,min:0,required:!0}),i().createElement(o.oil,{id:"monthsEstimated",type:"number",name:b.name,light:!0,onChange:function(e){var t=+e.target.value;!isNaN(t)&&t<=11&&t>=0&&(w("monthsEstimated",t),w("birthdate",ot(h.value,t,a)))},labelText:n("estimatedAgeInMonthsLabelText","Estimated age in months"),invalid:!(!y.touched||!y.error),invalidText:y.error&&n(y.error),value:b.value,min:0})))};function st(){return st=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},st.apply(this,arguments)}var ct=function(e){var t=e.fieldDefinition,n=(0,u.useTranslation)().t;return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.gN,{name:t.id},(function(e){var r=e.field,a=e.form;return a.touched,a.errors,e.meta,i().createElement(ue,st({id:t.id,labelText:n("".concat(t.label),"".concat(t.label))},r))})))},ut=n(2303);function dt(e){var t,n="string"==typeof e&&""!==e,r=(0,ut.Z)(n?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),i=r.data,a=r.error;return a&&(0,l.showToast)({title:a.name,description:a.message,kind:"error"}),{data:null==i||null===(t=i.data)||void 0===t?void 0:t.answers,isLoading:!i&&!a}}function _t(){return _t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_t.apply(this,arguments)}function mt(e){var t=e.fieldDefinition,n=function(e){var t="string"==typeof e&&""!==e,n=(0,ut.Z)(t?"/ws/rest/v1/concept/".concat(e):null,l.openmrsFetch),r=n.data,i=n.error;return i&&(0,l.showToast)({title:i.name,description:i.message,kind:"error"}),{data:null==r?void 0:r.data,isLoading:!r&&!i}}(t.uuid),r=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(r.datatype.display){case"Text":return i().createElement(pt,{concept:r,validationRegex:t.validation.matches,label:t.label});case"Numeric":return i().createElement(ft,{concept:r,label:t.label});case"Coded":return i().createElement(gt,{concept:r,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return i().createElement(o.K0D,{kind:"error",title:"Error"},'Concept has unknown datatype "',r.datatype.display,'"')}}function pt(e){var t=e.concept,n=e.validationRegex,r=e.label,a=(0,u.useTranslation)().t,o="obs.".concat(t.uuid);return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.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,i().createElement(ue,_t({id:o,labelText:null!=r?r:t.display,invalid:s[o]&&l[o]},n))})))}function ft(e){var t=e.concept,n=e.label,r=((0,u.useTranslation)().t,"obs.".concat(t.uuid));return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.gN,{name:r},(function(e){var a=e.field,o=e.form,l=o.touched,s=o.errors;return e.meta,i().createElement(ue,_t({id:r,labelText:null!=n?n:t.display,invalid:s[r]&&l[r],type:"number"},a))})))}function gt(e){var t,n=e.concept,r=e.answerConceptSetUuid,a=e.label,s=(0,l.useConfig)(),c=dt(null!=r?r:n.uuid),u=c.data,_=c.isLoading,m="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 i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},_?null:i().createElement(d.gN,{name:m},(function(e){var t,r=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)?i().createElement(o.PhF,_t({id:m,name:m,labelText:null!=a?a:null==n?void 0:n.display,light:!0,invalid:c[m]&&s[m]},r),i().createElement(o.QlF,{key:"no-answer-select-item-".concat(m),value:"",text:""}),null==p?void 0:p.customConceptAnswers.map((function(e){return i().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.label})}))):i().createElement(o.mh4,null,i().createElement(o.PhF,_t({id:m,name:m,labelText:null!=a?a:null==n?void 0:n.display,invalid:c[m]&&s[m]},r),i().createElement(o.QlF,{key:"no-answer-select-item-".concat(m),value:"",text:""}),u.map((function(e){return i().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})}))))})))}function ht(e){var t=e.personAttributeType,n=e.answerConceptSetUuid,r=e.label,a=dt(n),l=a.data,s=a.isLoading;return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},!s&&(null==l?void 0:l.length)?i().createElement(o.mh4,null,i().createElement(o.PhF,{id:"person-attribute-".concat(t.uuid),name:"attributes.".concat(t.uuid),labelText:null!=r?r:null==t?void 0:t.display},i().createElement(o.QlF,{value:"",text:""}),l.map((function(e){return i().createElement(o.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))):i().createElement(ue,{id:"person-attribute-".concat(t.uuid),labelText:null!=r?r:null==t?void 0:t.display,name:"attributes.".concat(t.uuid)}))}function vt(){return vt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vt.apply(this,arguments)}function bt(e){var t=e.personAttributeType,n=e.validationRegex,r=e.label,a=e.required,o=(0,u.useTranslation)().t,l="attributes.".concat(t.uuid);return i().createElement("div",{className:"".concat(pe.customField," ").concat(pe.halfWidthInDesktopView)},i().createElement(d.gN,{name:l,validate:function(e){if(e&&n&&""!==n&&"string"==typeof n&&""!==e)return new RegExp(n).test(e)?void 0:o("invalidInput","Invalid Input")}},(function(e){var n=e.field,o=e.form,s=o.touched,c=o.errors;return e.meta,i().createElement(ue,vt({id:"person-attribute-".concat(t.uuid),labelText:null!=r?r:null==t?void 0:t.display,invalid:c[l]&&s[l]},n,{required:a}))})))}function yt(e){var t=e.fieldDefinition,n=function(e){var t=(0,ut.Z)("/ws/rest/v1/personattributetype/".concat(e),l.openmrsFetch),n=t.data,r=t.error;return r&&(0,l.showToast)({title:r.name,description:r.message,kind:"error"}),{data:null==n?void 0:n.data,isLoading:!n&&!r}}(t.uuid),r=n.data;if(n.isLoading)return null;switch(r.format){case"java.lang.String":return i().createElement(bt,{personAttributeType:r,validationRegex:t.validation.matches,label:t.label,required:t.validation.required});case"org.openmrs.Concept":return i().createElement(ht,{personAttributeType:r,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label});default:return i().createElement(o.K0D,{kind:"error",title:"Error"},'Patient attribute type has unknown format "',r.format,'"')}}function wt(e){var t=e.name,n=(0,l.useConfig)().fieldDefinitions.filter((function(e){return e.id==t}))[0];return"person attribute"===n.type?i().createElement(yt,{fieldDefinition:n}):"obs"===n.type?i().createElement(mt,{fieldDefinition:n}):"address"===n.type?i().createElement(ct,{fieldDefinition:n}):i().createElement("div",null,"Error: Unknown field type ",n.type)}function Et(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 xt(){return xt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xt.apply(this,arguments)}function kt(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Et(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)?Et(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 Tt=function(e){var t,n=e.name,a=e.labelText,s=e.placeholder,c=e.setSelectedValue,_=e.selected,m=e.textFieldName,p=(0,u.useTranslation)().t,f=kt((0,d.U$)(n),3),g=f[0],h=(f[1],f[2]),v=kt((0,r.useState)([]),2),b=v[0],y=v[1],w=kt((0,r.useState)(),2),E=w[0],x=w[1],k=h.setValue;return E?i().createElement("span",null,p("".concat(E.message))):i().createElement("div",{style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.CtY,xt({id:n,onInputChange:function(e){var t,n,r,i;""==(t=e)||(n=m.replace(" ",""),r=_,i=t,(0,l.openmrsFetch)("".concat("/module/addresshierarchy/ajax/getPossibleAddressHierarchyEntriesWithParents.form","?addressField=").concat(n,"&limit=20&searchString=").concat(i,"&parentUuid=").concat(r),{method:"GET"})).then((function(e){y(e.data.map((function(e){return{id:e.uuid,text:e.name}})))})).catch((function(e){x(e)})),k(e)},items:b,itemToString:function(e){return null!==(t=null==e?void 0:e.text)&&void 0!==t?t:""}},g,{onChange:function(e){Boolean(e.selectedItem)?(c(e.selectedItem.id),k(e.selectedItem.text)):(c(void 0),k(void 0))},placeholder:s,titleText:a,light:!0}))))},St=n(5671),Ot={};Ot.styleTagTransform=j(),Ot.setAttributes=O(),Ot.insert=T().bind(null,"head"),Ot.domAPI=x(),Ot.insertStyleElement=I(),w()(St.Z,Ot);const Nt=St.Z&&St.Z.locals?St.Z.locals:void 0;function It(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 Ct(e,t){if(e){if("string"==typeof e)return It(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)?It(e,t):void 0}}const jt=function(e){var t,n,a=e.addressLayout,l=(0,u.useTranslation)().t,s=" > ",c=(0,r.useRef)(null),_=(0,r.useRef)(null),m=(t=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||Ct(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.")}()),p=m[0],f=m[1],g=(0,v.f$)(p,s),h=g.addresses,b=g.isLoading,y=g.error,w=(0,r.useMemo)((function(){var e=new Set;return h.forEach((function(t){var n=t.split(s);n.forEach((function(t,r){t.toLowerCase().includes(p.toLowerCase())&&e.add(n.slice(0,r+1).join(s))}))})),function(e){return function(e){if(Array.isArray(e))return It(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ct(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.")}()}(e)}),[h,p]),E=(0,d.u6)().setFieldValue,x=function(e){_.current&&!_.current.contains(e.target)&&f("")};return(0,r.useEffect)((function(){return document.addEventListener("mousedown",x),function(){document.removeEventListener("mousedown",x)}}),[_]),i().createElement("div",{className:Nt.autocomplete,ref:_,style:{marginBottom:"1rem"}},i().createElement(o.olm,{onChange:function(e){f(e.target.value)},labelText:l("searchAddress","Search address"),placeholder:l("searchAddress","Search address"),ref:c,helperText:p?b?l("loadingResults","Loading results"):y?y.message:0===(null==h?void 0:h.length)?l("noResultsFound","No results found"):null:null,value:p}),w.length>0&&i().createElement("ul",{className:Nt.suggestions},w.map((function(e,t){return i().createElement("li",{key:t,onClick:function(t){return function(e){if(e){var t=e.split(s);a.map((function(e,n){var r,i=e.name;E("address.".concat(i),null!==(r=null==t?void 0:t[n])&&void 0!==r?r:"")})),f("")}}(e)}},e)}))))};var At=n(7279);function Pt(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 Dt(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pt(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)?Pt(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 Ft(e){return(new DOMParser).parseFromString(e,"text/xml")}function Bt(e,t){var n=t.getElementsByTagName(e)[0];return Ft(n?n.outerHTML:"")}var Lt=function(){var e=Dt((0,r.useState)(""),2),t=e[0],n=e[1],a=Dt((0,r.useState)([]),2),c=a[0],d=a[1],_=(0,u.useTranslation)().t,m=(0,r.useContext)(s.Cg).addressTemplate,p=null==m?void 0:m.results[0].value,f=function(e){n(e)},g=(0,l.useConfig)(),h=g.fieldConfigurations.address.useAddressHierarchy,v=h.enabled,b=h.useQuickSearch,y=h.searchAddressByLevel;return(0,l.useLayoutType)(),(0,r.useEffect)((function(){var e=Ft(p),t=Bt("elementdefaults",e),n=Bt("nameMappings",e),r=Array.from(n.getElementsByTagName("property")).length>0?n.getElementsByTagName("property"):n.getElementsByTagName("entry"),i=Array.prototype.map.call(r,(function(e){var n,r,i=null!==(n=e.getAttribute("name"))&&void 0!==n?n:e.getElementsByTagName("string")[0].innerHTML,a=(null!==(r=e.getAttribute("value"))&&void 0!==r||e.getElementsByTagName("string")[1].innerHTML,function(e,t){var n=t.getElementsByName(e)[0];return n?n.getAttribute("value"):null}(i,t));return{id:i,name:i,value:a}}));d(i)}),[_,p]),m?i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},_("addressHeader","Address")),i().createElement("div",{style:{paddingBottom:"5%"}},v?i().createElement(i().Fragment,null,b&&i().createElement(jt,{addressLayout:c}),c.map((function(e,n){return y?i().createElement(Tt,{key:"combo_input_".concat(n),textFieldName:e.name,name:"address.".concat(e.name),labelText:(0,At.Z)(g.fieldConfigurations.address.useAddressHierarchy.useAddressHierarchyLabel)?_(e.name):g.fieldConfigurations.address.useAddressHierarchy.useAddressHierarchyLabel[e.name],id:e.name,setSelectedValue:f,selected:t}):i().createElement(ue,{key:"combo_input_".concat(n),name:"address.".concat(e.name),labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})}))):c.map((function(e,n){return i().createElement(ue,{key:"combo_input_".concat(n),name:"address.".concat(e.name),labelText:_(e.name),id:e.name,setSelectedValue:f,selected:t})})))):i().createElement("div",null,i().createElement("h4",{className:pe.productiveHeading02Light},_("addressHeader","Address")),i().createElement(o.N2B,null))};function Ut(e){var t=e.name,n=(0,l.useConfig)();if(!ie.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(ie.X8).join("', '"),"'.")),null;switch(t){case"name":return i().createElement(be,null);case"gender":return i().createElement(we,null);case"dob":return i().createElement(lt,null);case"address":return i().createElement(Lt,null);case"id":return i().createElement(nt,null);case"phone & email":return i().createElement(fe,null);default:return i().createElement(wt,{name:t})}}var zt=function(e){var t=e.sectionDefinition;return i().createElement("section",{"aria-label":"".concat(t.name," Section")},t.fields.map((function(e){return i().createElement(Ut,{key:"".concat(t.name,"-").concat(e),name:e})})))};function Vt(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 Zt(){return Zt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zt.apply(this,arguments)}function Rt(e,t){if(e){if("string"==typeof e)return Vt(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)?Vt(e,t):void 0}}var Ht=function(e){var t,n,r=e.name,a=e.options,l=e.label,s=e.required,c=(t=(0,d.U$)(r),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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||Rt(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],_=(0,u.useTranslation)().t,m=[i().createElement(o.QlF,{disabled:!0,hidden:!0,text:"Select ".concat(l),key:"",value:""})].concat(function(e){return function(e){if(Array.isArray(e))return Vt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Rt(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 i().createElement(o.QlF,{text:e,value:e,key:t})})))),p=s?l:"".concat(l," (").concat(_("optional","optional"),")");return i().createElement("div",{style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.PhF,Zt({id:"identifier"},c,{labelText:p}),m)))},qt=n(2936),Mt={};Mt.styleTagTransform=j(),Mt.setAttributes=O(),Mt.insert=T().bind(null,"head"),Mt.domAPI=x(),Mt.insertStyleElement=I(),w()(qt.Z,Mt);const Gt=qt.Z&&qt.Z.locals?qt.Z.locals:void 0;var Wt=function(){var e=i().useContext(g).values,t=(0,u.useTranslation)().t;return i().createElement("section",{className:Gt.formSection,"aria-label":"Death Info Section"},i().createElement("h5",{className:"omrs-type-title-5 ".concat(Gt.formSectionTitle)},"Death Info"),i().createElement("section",{className:Gt.fieldGroup},i().createElement(ue,{labelText:t("isDeadInputLabel","Is Dead"),name:"isDead",id:"isDead"}),e.isDead&&i().createElement(i().Fragment,null,i().createElement(ue,{labelText:t("deathDateInputLabel","Date of Death"),name:"deathDate",id:"deathDate"}),i().createElement(Ht,{options:[t("unknown","Unknown"),t("stroke","Stroke")],label:t("causeOfDeathInputLabel","Cause of Death"),name:"deathCause"}))))};function Yt(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}var Qt=function(e){var t,n,a=e.fields,o=(t=(0,d.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}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.")}()),l=o[0],s=o[1],c=(0,r.useContext)(g).setFieldValue;return(0,r.useEffect)((function(){!l.value&&s.touched&&(c("additionalGivenName",""),c("additionalMiddleName",""),c("additionalFamilyName",""))}),[l.value,s.touched]),i().createElement("section",{className:Gt.formSection,"aria-label":"Demographics Section"},a.map((function(e){return i().createElement(Ut,{key:"demographics-".concat(e),name:e})})))},Kt=n(1662),$t={};$t.styleTagTransform=j(),$t.setAttributes=O(),$t.insert=T().bind(null,"head"),$t.domAPI=x(),$t.insertStyleElement=I(),w()(Kt.Z,$t);const Xt=Kt.Z&&Kt.Z.locals?Kt.Z.locals:void 0;function Jt(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 en(){return en=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},en.apply(this,arguments)}var tn=function(e){var t,n,a=e.getDisplayValue,l=e.getFieldValue,s=e.getSearchResults,c=e.onSuggestionSelected,d=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,["getDisplayValue","getFieldValue","getSearchResults","onSuggestionSelected"]),_=(t=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Jt(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)?Jt(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,r.useRef)(null),g=(0,r.useRef)(null),h=((0,u.useTranslation)().t,d.name),v=d.labelText;(0,r.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 i().createElement("div",{className:Xt.autocomplete,ref:g},i().createElement("label",{className:"cds--label"},v),i().createElement(o.mh4,null,i().createElement(o.olm,en({id:"autosuggest",onChange:function(e){var t=e.target.value;t?s(t).then((function(e){p(e)})):p([])},ref:f,className:Xt.autocompleteSearch},d))),m.length>0&&i().createElement("ul",{className:Xt.suggestions},m.map((function(e,t){return i().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))}))))},nn=n(138),rn={};rn.styleTagTransform=j(),rn.setAttributes=O(),rn.insert=T().bind(null,"head"),rn.domAPI=x(),rn.insertStyleElement=I(),w()(nn.Z,rn);const an=nn.Z&&nn.Z.locals?nn.Z.locals:void 0;function on(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 ln(e,t,n,r,i,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(r,i)}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cn=function(){var e,t,n=(0,r.useContext)(s.Cg).relationshipTypes,a=(e=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return on(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)?on(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],_=(0,u.useTranslation)().t;return(0,r.useEffect)((function(){if(n){var e=[];n.results.forEach((function(t){var n={display:t.aIsToB,uuid:t.uuid,direction:"aIsToB"},r={display:t.bIsToA,uuid:t.uuid,direction:"bIsToA"};n.display===r.display?e.push(n):e.push(n,r)})),c(e)}}),[n]),n?i().createElement("section",{"aria-label":"Relationships Section"},i().createElement(d.F2,{name:"relationships"},(function(e){var t=e.push,n=e.remove,r=e.form.values.relationships;return i().createElement("div",null,r&&r.length>0?r.map((function(e,t){return i().createElement("div",{key:t,className:Gt.formSection},i().createElement(un,{relationship:e,index:t,displayRelationshipTypes:l,key:t,remove:n}))})):null,i().createElement("div",{className:an.actions},i().createElement(o.zxk,{kind:"ghost",onClick:function(){return t({relatedPersonUuid:"",action:"ADD"})}},_("addRelationshipButtonText","Add Relationship"))))}))):i().createElement("section",{"aria-label":"Relationships Section"},i().createElement(o.N2B,null))},un=function(e){var t,n,a,l,s=e.relationship,c=e.index,d=e.displayRelationshipTypes,_=e.remove,m=(0,u.useTranslation)().t,p=i().useContext(g).setFieldValue,f=!s.uuid,h=(0,r.useCallback)((function(e){var t=e.target,n=t.name,r=t.options[t.selectedIndex].value;p(n,r),(null==s?void 0:s.action)||p("relationships[".concat(c,"].action"),"UPDATE")}),[]),b=(0,r.useCallback)((function(e,t){p(e,t)}),[]),y=(t=function(e){var t;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return t=new AbortController,[4,(0,v.M8)(e,t)];case 1:return[2,n.sent().data.results]}}))},n=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){ln(a,r,i,o,l,"next",e)}function l(e){ln(a,r,i,o,l,"throw",e)}o(void 0)}))},function(e){return n.apply(this,arguments)}),w=(0,r.useCallback)((function(){"ADD"===s.action?_(c):p("relationships[".concat(c,"].action"),"DELETE")}),[s,c]),E=(0,r.useCallback)((function(){var e,t;p("relationships[".concat(c,"]"),(e=function(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){sn(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 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))}),[c]);return"DELETE"!==s.action?i().createElement("div",{className:an.relationship},i().createElement("div",{className:an.searchBox},i().createElement("div",{className:an.relationshipHeader},i().createElement("h4",{className:an.productiveHeading},null!==(a=null==s?void 0:s.relation)&&void 0!==a?a:m("relationshipPlaceholder","Relationship")),i().createElement(o.zxk,{kind:"ghost",iconDescription:m("deleteRelationshipTooltipText","Delete"),hasIconOnly:!0,onClick:w},i().createElement(Re.ZN,{size:16,className:an.trashCan}))),i().createElement("div",null,f?i().createElement(tn,{name:"relationships[".concat(c,"].relatedPersonUuid"),labelText:m("relativeFullNameLabelText","Full name"),placeholder:m("relativeNamePlaceholder","Firstname Familyname"),defaultValue:s.relatedPersonName,onSuggestionSelected:b,getSearchResults:y,getDisplayValue:function(e){return e.display},getFieldValue:function(e){return e.uuid},required:!0}):i().createElement(i().Fragment,null,i().createElement("span",{className:an.labelText},m("relativeFullNameLabelText","Full name")),i().createElement("p",{className:an.bodyShort02},s.relatedPersonName)))),i().createElement("div",{className:"".concat(an.selectRelationshipType),style:{marginBottom:"1rem"}},i().createElement(o.mh4,null,i().createElement(o.PhF,{id:"select",labelText:m("relationship","Relationship"),onChange:h,name:"relationships[".concat(c,"].relationshipType"),defaultValue:null!==(l=null==s?void 0:s.relationshipType)&&void 0!==l?l:"placeholder-item"},i().createElement(o.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:m("relationshipToPatient","Relationship to patient")}),d.map((function(e){return i().createElement(o.QlF,{text:e.display,value:"".concat(e.uuid,"/").concat(e.direction),key:e.display})})))))):i().createElement(o.K0D,{kind:"info",title:m("relationshipRemovedText","Relationship removed"),actions:i().createElement(o.xho,{onClick:E},m("restoreRelationshipActionButton","Undo"))})};function dn(e){var t=e.sectionDefinition;switch(t.id){case"demographics":return i().createElement(Qt,{fields:t.fields});case"death":return i().createElement(Wt,null);case"relationships":return i().createElement(cn,null);default:return i().createElement(zt,{sectionDefinition:t})}}var _n=function(e){var t=e.sectionDefinition,n=e.index,r=(0,u.useTranslation)().t;return i().createElement("div",{id:t.id},i().createElement("h3",{className:le.productiveHeading02,style:{color:"#161616"}},n+1,". ",r("".concat(t.id,"Section"),t.name)),i().createElement("span",{className:le.label01},r("allFieldsRequiredText","All fields are required unless marked optional")),i().createElement("div",{style:{margin:"1rem 0 1rem"}},i().createElement(o.n9L,null,i().createElement(dn,{sectionDefinition:t}))))};function mn(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 pn(e){var t;return null===(t=e.split(window.getOpenmrsSpaBase()))||void 0===t?void 0:t[1]}const fn=function(e){var t,n,i=e.when,a=e.redirect,o=(0,u.useTranslation)().t,s=(0,r.useRef)(!1),c=(t=(0,r.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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return mn(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)?mn(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.")}()),d=c[0],_=c[1],m=d||a,p=(0,r.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,r.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,r.useEffect)((function(){if(i&&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,i,p,f]),(0,r.useEffect)((function(){"string"==typeof m&&(0,l.navigate)({to:"${openmrsSpaBase}/".concat(pn(m))})}),[m]),null};function gn(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 hn(e,t,n,r,i,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(r,i)}function vn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bn(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){vn(e,t,n[t])}))}return e}function yn(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,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gn(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)?gn(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 wn=function(e){var t,n,m=e.savePatientForm,p=e.isOffline,y=(0,r.useContext)(s.Cg),w=y.currentSession,E=y.addressTemplate,x=y.identifierTypes,k=(0,a.useLocation)().search,T=(0,l.useConfig)(),S=yn((0,r.useState)(),2),O=S[0],N=S[1],I=yn((0,r.useState)(f),2),C=I[0],j=I[1],A=(0,a.useParams)().patientUuid,P=(0,l.usePatient)(A),D=P.isLoading,F=P.patient,Y=(0,u.useTranslation)().t,Q=yn((0,r.useState)(null),2),$=Q[0],re=Q[1],ae=yn(function(e){var t=(0,l.usePatient)(e),n=t.isLoading,i=t.patient,a=function(e){var t=!!e,n=(0,G.ZP)(t?"/ws/rest/v1/person/".concat(e,"/attribute"):null,l.openmrsFetch),i=n.data,a=n.error,o=(0,r.useMemo)((function(){var e;return{data:null==i||null===(e=i.data)||void 0===e?void 0:e.results,isLoading:!i&&!a}}),[i,a]);return o}(e),o=a.data,s=a.isLoading,c=function(e){var t=!!e,n=(0,G.ZP)(t?"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)"):null,l.openmrsFetch),i=n.data,a=n.error,o=(0,r.useMemo)((function(){var e,t,n={};return null==i||null===(e=i.data)||void 0===e||null===(t=e.results)||void 0===t||t.forEach((function(e){n[(0,L.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:!i&&!a}}),[i,a]);return o}(e),u=c.data,d=c.isLoading,_=function(e){var t=!!e,n=(0,G.ZP)(t?"/ws/rest/v1/relationship?v=".concat(W.UO,"&person=").concat(e):null,l.openmrsFetch),i=n.data,a=n.error,o=(0,r.useMemo)((function(){var t;return{data:null==i||null===(t=i.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:!i&&!a}}),[e,i,a]);return o}(e),m=_.data,p=_.isLoading,f=ee((0,r.useState)({patientUuid:(0,b.Z)(),givenName:"",middleName:"",familyName:"",unidentifiedPatient:!1,additionalGivenName:"",additionalMiddleName:"",additionalFamilyName:"",addNameInLocalLanguage:!1,gender:"",birthdate:null,yearsEstimated:null,monthsEstimated:0,birthdateEstimated:!1,telephoneNumber:"",isDead:!1,deathDate:"",deathCause:"",relationships:[],identifiers:{},address:{}}),2),g=f[0],h=f[1];return(0,r.useEffect)((function(){K((function(){var t;return te(this,(function(r){switch(r.label){case 0:return i?(h(X(J(X({},g,(o={},l=(a=i).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,U.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]:""),Z({},o,a.identifier.map((function(e){return V({},(0,L.Z)(e.system||e.type.text),e.value)}))))),{address:q(i)}),function(e){var t={};return e.telecom&&(t.phone=e.telecom[0].value),t}(i))),[3,3]):[3,1];case 1:return n||!e?[3,3]:[4,ne(e)];case 2:if(!(t=r.sent())._patientRegistrationData.formValues)return console.error("Found a queued offline patient registration for patient ".concat(e,", but without form values. Not using these values.")),[2];h(t._patientRegistrationData.formValues),r.label=3;case 3:return[2]}var a,o,l,s}))}))()}),[n,i,e]),(0,r.useEffect)((function(){!p&&m&&h((function(e){return J(X({},e),{relationships:m})}))}),[p,m,h]),(0,r.useEffect)((function(){!d&&u&&h((function(e){return J(X({},e),{identifiers:u})}))}),[d,u,h]),(0,r.useEffect)((function(){if(!s&&o){var e={};o.forEach((function(t){e[t.attributeType.uuid]=t.value})),h((function(t){return J(X({},t),{attributes:e})}))}}),[o,h,s]),[g,h]}(A),2),oe=ae[0],se=ae[1],ce=yn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),i=n.isLoading,a=n.patient,o=ee((0,r.useState)(t),2),s=o[0],c=o[1];return(0,r.useEffect)((function(){K((function(){var n,r;return te(this,(function(o){switch(o.label){case 0:return a?(c(J(X({},s),{address:q(a)})),[3,3]):[3,1];case 1:return i||!e?[3,3]:[4,ne(e)];case 2:n=o.sent(),c(null!==(r=null==n?void 0:n._patientRegistrationData.initialAddressFieldValues)&&void 0!==r?r:t),o.label=3;case 3:return[2]}}))}))()}),[i,a,e]),[s,c]}(A),1),ue=ce[0],de=yn(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,l.usePatient)(e),i=n.isLoading,a=n.patient,o=ee((0,r.useState)(t),2),s=o[0],c=o[1];return(0,r.useEffect)((function(){if(a)c(X({},s,M(a)));else if(!i&&e){var n;ne(e).then((function(e){return c(null!==(n=null==e?void 0:e._patientRegistrationData.initialAddressFieldValues)&&void 0!==n?n:t)}))}}),[i,a,e]),[s,c]}(A),1),_e=de[0],me=null==w||null===(t=w.sessionLocation)||void 0===t?void 0:t.uuid,pe=D?void 0:!(!A||!F),fe=(0,r.useMemo)((function(){return"true"===localStorage.getItem("openmrs:devtools")&&!pe}),[pe]),ge=(0,v.Uu)(null==F?void 0:F.id).data,he=(0,r.useRef)(new h.I),ve=null==T||null===(n=T.fieldDefinitions)||void 0===n?void 0:n.filter((function(e){return"address"===e.type}));(0,r.useEffect)((function(){}),[oe]);var be=(0,r.useMemo)((function(){var e;return T.sections.map((function(t){return null!==(e=T.sectionDefinitions.filter((function(e){return e.id==t}))[0])&&void 0!==e?e:ie.bs.filter((function(e){return e.id==t}))[0]})).filter((function(e){return e}))}),[T.sections,T.sectionDefinitions]);(0,r.useEffect)((function(){if(E){var e=null==E?void 0:E.results[0].value;if(!e)return;var t=function(e){var t=(new DOMParser).parseFromString(e,"text/xml"),n=t.querySelector("nameMappings").getElementsByTagName("entry"),r=Array.prototype.map.call(n,(function(e){var n=e.getElementsByTagName("string")[0].innerHTML;return{name:n,label:e.getElementsByTagName("string")[1].innerHTML,regex:R(n,"elementRegex",t)||".*",regexFormat:R(n,"elementRegexFormats",t)||""}})),i=_.Ry(r.reduce((function(e,t){return e[t.name]=_.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:i}}(e),n=t.addressFieldValues,r=t.addressValidationSchema;if(j((function(e){return e.concat(r)})),!1===pe){var i=!0,a=!1,o=void 0;try{for(var l,s=n[Symbol.iterator]();!(i=(l=s.next()).done);i=!0){var c=l.value,u=c.name,d=c.defaultValue;ue[u]||(ue[u]=d)}}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}null==ve||ve.map((function(e){return ue[e.id]=""})),se(bn({},oe,ue))}}}),[pe,E,ue]);var ye,we,Ee=(ye=function(e,t){var n,r,i,a,o,s,c,u,d;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(_){switch(_.label){case 0:n=new AbortController,t.setSubmitting(!0),r=function(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}(bn({},e),{identifiers:(p=e.identifiers,Object.fromEntries(Object.entries(p).filter((function(e){var t,n,r=(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 r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}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 r[0],void 0!==r[1].identifierValue}))))}),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,m(!pe,r,_e,ue,$,me,oe.identifiers,w,T,he.current,n)];case 2:return _.sent(),(0,l.showToast)({description:pe?Y("updationSuccessToastDescription","The patient's information has been successfully updated"):Y("registrationSuccessToastDescription","The patient can now be found by searching for them using their name or ID number"),title:pe?Y("updationSuccessToastTitle","Patient Details Updated"):Y("registrationSuccessToastTitle","New Patient Created"),kind:"success"}),i=new URLSearchParams(k).get("afterUrl"),a=(0,l.interpolateUrl)(i||T.links.submitButton,{patientUuid:e.patientUuid}),N(a),[3,4];case 3:return o=_.sent(),(null===(s=o.responseBody)||void 0===s||null===(c=s.error)||void 0===c?void 0:c.globalErrors)?o.responseBody.error.globalErrors.forEach((function(e){(0,l.showToast)({description:e.message})})):(null===(u=o.responseBody)||void 0===u||null===(d=u.error)||void 0===d?void 0:d.message)?(0,l.showToast)({description:o.responseBody.error.message}):(0,l.createErrorHandler)()(o),t.setSubmitting(!1),[3,4];case 4:return[2]}var p}))},we=function(){var e=this,t=arguments;return new Promise((function(n,r){var i=ye.apply(e,t);function a(e){hn(i,n,r,a,o,"next",e)}function o(e){hn(i,n,r,a,o,"throw",e)}a(void 0)}))},function(e,t){return we.apply(this,arguments)}),xe=function(e){return i().createElement("div",null,i().createElement("p",null,Y("fieldErrorTitleMessage","The following fields have errors:")),i().createElement("ul",{style:{listStyle:"inside"}},Object.keys(e).map((function(e,t){return i().createElement("li",{key:t},Y("".concat(e,"LabelText"),e))}))))};return i().createElement(d.J9,{enableReinitialize:!0,initialValues:oe,validationSchema:C,onSubmit:Ee},(function(e){return i().createElement(d.l0,{className:le.form},i().createElement(fn,{when:e.dirty,redirect:O}),i().createElement("div",{className:le.formContainer},i().createElement("div",null,i().createElement("div",{className:le.stickyColumn},i().createElement("h4",null,pe?Y("edit","Edit"):Y("createNew","Create New")," ",Y("patient","Patient")),fe&&i().createElement(B,{setValues:e.setValues}),i().createElement("p",{className:le.label01},Y("jumpTo","Jump to")),be.map((function(e){return i().createElement("div",{className:"".concat(le.space05," ").concat(le.touchTarget),key:e.name},i().createElement(o.rUS,{className:le.linkName,onClick:function(){return t=e.id,void document.getElementById(t).scrollIntoView({behavior:"smooth",block:"center",inline:"center"});var t}},i().createElement(c.Kc,{size:16})," ",e.name))})),i().createElement(o.zxk,{className:le.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:xe(e),title:Y("incompleteForm","Incomplete form"),kind:"warning"})}(e)}))},disabled:!w||!x},pe?Y("updatePatient","Update Patient"):Y("registerPatient","Register Patient")),i().createElement(o.zxk,{className:le.cancelButton,kind:"tertiary",onClick:H},Y("cancel","Cancel")))),i().createElement("div",{className:le.infoGrid},i().createElement(g.Provider,{value:{identifierTypes:x,validationSchema:C,setValidationSchema:j,values:e.values,inEditMode:pe,setFieldValue:e.setFieldValue,setCapturePhotoProps:re,currentPhoto:null==ge?void 0:ge.imageSrc,isOffline:p,initialFormValues:e.initialValues}},be.map((function(e,t){return i().createElement(_n,{key:"registration-section-".concat(e.id),sectionDefinition:e,index:t})}))))))}))},En=n(4954),xn={};xn.styleTagTransform=j(),xn.setAttributes=O(),xn.insert=T().bind(null,"head"),xn.domAPI=x(),xn.insertStyleElement=I(),w()(En.Z,xn);const kn=En.Z&&En.Z.locals?En.Z.locals:void 0;function Tn(e){var t=e.savePatientForm,n=e.isOffline,r=(0,l.useSession)(),c=(0,ut.Z)("patientRegistrationAddressTemplate",s.Te).data,u=(0,ut.Z)("patientRegistrationRelationshipTypes",s.mt).data,d=(0,ut.Z)("patientRegistrationPatientIdentifiers",s.St).data;return i().createElement("main",{className:"omrs-main-content ".concat(kn.root)},i().createElement(o.rjZ,{className:kn.grid},i().createElement(o.X2j,null,i().createElement(l.ExtensionSlot,{extensionSlotName:"breadcrumbs-slot"})),i().createElement(s.Cg.Provider,{value:{addressTemplate:c,relationshipTypes:u,identifierTypes:d,currentSession:r}},i().createElement(a.BrowserRouter,{basename:"".concat(window.getOpenmrsSpaBase())},i().createElement(a.Routes,null,i().createElement(a.Route,{path:"patient-registration",element:i().createElement(wn,{savePatientForm:t,isOffline:n})}),i().createElement(a.Route,{path:"patient/:patientUuid/edit",element:i().createElement(wn,{savePatientForm:t,isOffline:n})}))))))}}}]);
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 i=n(906);function r(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 a(e){return function(e){if(Array.isArray(e))return r(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 r(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)?r(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:i.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:i.Type.String}},sectionDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.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:i.Type.String,_description:"The title to display at the top of the section."},fields:{_type:i.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:i.Type.String}}},_default:[]},fieldDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:i.Type.String,_description:"How this field's data will be stored—a person attribute or an obs."},uuid:{_type:i.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},label:{_type:i.Type.String,_default:null,_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:i.Type.String,_default:"",_description:"Placeholder that will appear in the input."},validation:{required:{_type:i.Type.Boolean,_default:!1},matches:{_type:i.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:i.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:i.Type.Array,_elements:{uuid:{_type:i.Type.UUID,_description:"Answer concept UUID"},label:{_type:i.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:i.Type.Boolean,_default:!0},unidentifiedPatient:{_type:i.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},defaultUnknownGivenName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."},displayCapturePhoto:{_type:i.Type.Boolean,_default:!0,_description:"Whether to display capture patient photo slot on name field"}},gender:{_type:i.Type.Array,_elements:{value:{_type:i.Type.String,_description:"The value for sex option"},label:{_type:i.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:i.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:{enabled:{_type:i.Type.Boolean,_description:"Whether to use the Address hierarchy in the registration form or not",_default:!0},useQuickSearch:{_type:i.Type.Boolean,_description:"Whether to use the quick searching through the address saved in the database pre-fill the form.",_default:!0},searchAddressByLevel:{_type:i.Type.Boolean,_description:"Whether to fill the addresses by levels, i.e. County => subCounty, the current field is dependent on it's previous field.",_default:!0},useAddressHierarchyLabel:{_type:i.Type.Object,_description:"Whether to use custom labels for address hierarchy",_default:{}}}},dateOfBirth:{useEstimatedDateOfBirth:{enabled:{_type:i.Type.Boolean,_description:"Whether to use custom day and month for estimated date of birth",_default:!1},dayOfMonth:{_type:i.Type.Number,_description:"The custom day of the month use on the estimated date of birth",_default:0},month:{_type:i.Type.Number,_description:"The custom month to use on the estimated date of birth i.e 0 = Jan 11 = Dec",_default:0}}}},links:{submitButton:{_type:i.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[i.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:i.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:i.Type.Array,_elements:{_type:i.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:i.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:i.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:i.Type.UUID,_default:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_validators:[(0,i.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,i.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(l(o))+(e.sectionDefinitions.length?"; and the defined sections ".concat(l(e.sectionDefinitions),"."):".")})),(0,i.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)}))})),i=n.fields.find((function(e){return!t.includes(e)}));return"The section definition '".concat(n.id,"' contains an invalid field '").concat(i,"'. 'fields' can only contain the built-in fields '").concat(s.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(l(e.fieldDefinitions),"."):".")}))]};function l(e){return"'".concat(e.map((function(e){return e.id})).join("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>l,QT:()=>c,UO:()=>s,e1:()=>u});var i,r,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",l="patient-registration",c=(i={},a="network-first",(r=o.omrsOfflineCachingStrategyHttpHeaderName)in i?Object.defineProperty(i,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[r]=a,i)},1686:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>v,importTranslation:()=>b,setupOpenMRS:()=>g,version:()=>m});var i=n(906),r=n(3076),a=n(225),o=n(8179),s=n(6279);function u(e,t,n,i,r,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(i,r)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){u(a,i,r,o,s,"next",e)}function s(e){u(a,i,r,o,s,"throw",e)}o(void 0)}))}}var c=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};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,i.makeUrl)(e)}))}function f(){return p.apply(this,arguments)}function p(){return(p=l((function(){return c(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(0,s.X1)(),(0,s.Te)(),(0,s.mt)(),(0,s.St)()])];case 1:return e.sent(),[2]}}))}))).apply(this,arguments)}function h(e,t){return y.apply(this,arguments)}function y(){return(y=l((function(e,t){return c(this,(function(n){switch(n.label){case 0:return[4,r.y.savePatientFormOnline(e._patientRegistrationData.isNewPatient,e._patientRegistrationData.formValues,e._patientRegistrationData.patientUuidMap,e._patientRegistrationData.initialAddressFieldValues,e._patientRegistrationData.capturePhotoProps,e._patientRegistrationData.currentLocation,e._patientRegistrationData.initialIdentifierValues,e._patientRegistrationData.currentUser,e._patientRegistrationData.config,e._patientRegistrationData.savePatientTransactionManager,t.abort)];case 1:return n.sent(),[2]}}))}))).apply(this,arguments)}var m="4.0.2-pre.837",b=n(3979),v={"webservices.rest":"^2.24.0"};function g(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,i.defineConfigSchema)(o.e1,a.bT),(0,i.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")},{path:"".concat(window.spaBase,"/patient/:patientUuid/edit"),title:"Edit patient details",parent:"".concat(window.spaBase,"/patient/:patientUuid/chart")}]),(0,i.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,i.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,i.subscribePrecacheStaticDependencies)(f),(0,i.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return l((function(){var t,n;return c(this,(function(i){switch(i.label){case 0:return t=d(e),[4,caches.open("omrs-spa-cache-v1")];case 1:return[4,i.sent().keys()];case 2:return n=i.sent().map((function(e){return e.url})),[2,t.every((function(e){return n.includes(e)}))]}}))}))()},sync:function(e){return l((function(){var t;return c(this,(function(n){switch(n.label){case 0:return t=d(e),[4,Promise.allSettled(t.map((r=l((function(e){return c(this,(function(t){switch(t.label){case 0:return[4,(0,i.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:e})];case 1:return t.sent(),[4,fetch(e)];case 2:return t.sent(),[2]}}))})),function(e){return r.apply(this,arguments)})))];case 1:return n.sent(),[2]}var r}))}))()}}),{pages:[{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),n.e(375),n.e(154),n.e(924),n.e(658)]).then(n.bind(n,7658))}),e),route:"patient-registration",online:{savePatientForm:r.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:r.y.savePatientFormOffline,isOffline:!0}},{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),n.e(375),n.e(154),n.e(924),n.e(658)]).then(n.bind(n,7658))}),{featureName:"edit-patient-details-form",moduleName:o.e1}),route:/patient\/([a-zA-Z0-9\-]+)\/edit/,online:{savePatientForm:r.y.savePatientFormOnline},offline:{savePatientForm:r.y.savePatientFormOffline}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),n.e(375),n.e(206)]).then(n.bind(n,8206))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),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,i.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-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,i.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,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),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:()=>T,X1:()=>w,mt:()=>O});var i=n(268),r=n.n(i),a=n(3662),o=n(2777),s=n(8407),u=n(906),l=n(8179);function c(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 d(e,t,n,i,r,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(i,r)}function f(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){d(a,i,r,o,s,"next",e)}function s(e){d(a,i,r,o,s,"throw",e)}o(void 0)}))}}function p(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){p(e,t,n[t])}))}return e}function y(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 m(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,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}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 b=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},v=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},g=r().createContext(null);function w(e){return _.apply(this,arguments)}function _(){return(_=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/session",e)];case 1:return[2,t.sent().data]}}))}))).apply(this,arguments)}function T(e){return P.apply(this,arguments)}function P(){return(P=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)",e)];case 1:return[2,t.sent().data]}}))}))).apply(this,arguments)}function O(e){return S.apply(this,arguments)}function S(){return(S=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/relationshiptype?v=default",e)];case 1:return[2,t.sent().data]}}))}))).apply(this,arguments)}function D(e){return U.apply(this,arguments)}function U(){return(U=f((function(e){var t,n,i,r,o,s,u,l,c;return b(this,(function(d){switch(d.label){case 0:return[4,j(e)];case 1:t=d.sent(),n=t.filter(Boolean),i=!0,r=!1,o=void 0,d.label=2;case 2:d.trys.push([2,7,8,9]),s=function(){var t,n,i,r;return b(this,(function(o){switch(o.label){case 0:return t=l.value,[4,Promise.all([k(t.uuid,e),F(e)])];case 1:return n=m.apply(void 0,[o.sent(),2]),i=n[0],r=n[1],t.identifierSources=i.data.results.map((function(e){var t=(0,a.Z)(r.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e})),[2]}}))},u=n[Symbol.iterator](),d.label=3;case 3:return(i=(l=u.next()).done)?[3,6]:[5,v(s())];case 4:d.sent(),d.label=5;case 5:return i=!0,[3,3];case 6:return[3,9];case 7:return c=d.sent(),r=!0,o=c,[3,9];case 8:try{i||null==u.return||u.return()}finally{if(r)throw o}return[7];case 9:return[2,n]}}))}))).apply(this,arguments)}function j(e){return A.apply(this,arguments)}function A(){return(A=f((function(e){var t,n,i,r,a,s,u,l,c;return b(this,(function(d){switch(d.label){case 0:return[4,C("/ws/rest/v1/patientidentifiertype?v=full",e)];case 1:return t=d.sent(),[4,C("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType",e)];case 2:return n=d.sent(),t.ok?(u=null==t||null===(i=t.data)||void 0===i?void 0:i.results,l=null==n||null===(r=n.data)||void 0===r||null===(a=r.results)||void 0===a||null===(s=a[0])||void 0===s?void 0:s.metadataUuid,c=(null==n?void 0:n.ok)?[B(null==u?void 0:u.find((function(e){return e.uuid===l})),!0)]:[],u.forEach((function(e){e.uuid!==l&&c.push(B(e,!1))})),[2,c.map((function(e){return y(h({},e),{fieldName:(0,o.Z)(e.name)})}))]):[2,[]]}}))}))).apply(this,arguments)}function k(e,t){return N.apply(this,arguments)}function N(){return(N=f((function(e,t){return b(this,(function(n){switch(n.label){case 0:return[4,C("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(e),t)];case 1:return[2,n.sent()]}}))}))).apply(this,arguments)}function F(e){return I.apply(this,arguments)}function I(){return(I=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/idgen/autogenerationoption?v=full",e)];case 1:return[2,t.sent()]}}))}))).apply(this,arguments)}function C(e,t){return E.apply(this,arguments)}function E(){return(E=f((function(e,t){return b(this,(function(n){switch(n.label){case 0:return[4,(0,u.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,s.Z)(e)})];case 1:return n.sent(),[4,(0,u.openmrsFetch)(e,{headers:l.QT,signal:null==t?void 0:t.signal})];case 2:return[2,n.sent()]}}))}))).apply(this,arguments)}function B(e,t){return{name:e.display,fieldName:(0,o.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:()=>m,y:()=>y});var i=n(906),r=n(8179),a=n(7117);function o(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 s(e,t,n,i,r,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(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},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){c(e,t,n[t])}))}return e}function f(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,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(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)?o(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 p,h=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},y=function(){function e(){l(this,e)}return e.saveRelationships=function(e,t,n){return u((function(){return h(this,(function(i){return[2,Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var i=e.relatedPersonUuid,r=e.relationshipType,o=e.uuid,s=e.action,u=f(r.split("/"),2),l=u[0],c=u[1],d=t.data.uuid,p="aIsToB"===c,h={personA:p?i:d,personB:p?d:i,relationshipType:l};switch(s){case"ADD":return(0,a.bL)(n,h);case"UPDATE":return(0,a.r6)(n,o,h);case"DELETE":return(0,a.kE)(n,o)}})))]}))}))()},e.saveObservations=function(e,t,n,i,r,o){return u((function(){var s;return h(this,(function(u){if(e&&Object.keys(e).length>0){if(r.registrationObs.encounterTypeUuid)return s={encounterDatetime:new Date,patient:t.data.uuid,encounterType:r.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:i.currentProvider.uuid,encounterRole:r.registrationObs.encounterProviderRoleUuid}],form:r.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},[2,(0,a.M1)(o,s)];console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved.")}return[2]}))}))()},e.savePatientIdentifiers=function(e,t,n,i,r,o){return u((function(){var s;return h(this,(function(l){var c;return s=Object.values(n).map((c=u((function(n){var i,s,u,l,c,d,f,p,y,m;return h(this,(function(h){switch(h.label){case 0:return i=n.identifierTypeUuid,s=n.identifierValue,u=n.identifierUuid,l=n.selectedSource,c=n.preferred,d=n.autoGeneration,f=n.initialValue,s||d&&l?d?[3,1]:(y=s,[3,4]):[3,9];case 1:return[4,(0,a.fX)(n.selectedSource.uuid,o)];case 2:return[4,h.sent().data.identifier];case 3:y=h.sent(),h.label=4;case 4:return m={uuid:u,identifier:p=y,identifierType:i,location:r,preferred:c},e?[3,8]:f?[3,6]:[4,(0,a.eb)(t,m,o)];case 5:return h.sent(),[3,8];case 6:return f===p?[3,8]:[4,(0,a.nI)(t,u,m.identifier,o)];case 7:h.sent(),h.label=8;case 8:return[2,m];case 9:return[2]}}))})),function(e){return c.apply(this,arguments)})),t&&Object.keys(i).filter((function(e){return!n[e]})).forEach(function(){var e=u((function(e){return h(this,(function(n){switch(n.label){case 0:return[4,(0,a.ZB)(t,i[e].identifierUuid,o)];case 1:return n.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[2,Promise.all(s)]}))}))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,i,r){var a,o,s;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,{uuid:t.patientUuid,person:d({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[t.address]},e.getPatientDeathInfo(t)),identifiers:r}},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,i=!1,r=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=f(a.value,2),u=s[0],l=s[1];t.push({attributeType:u,value:l})}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,i=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?i:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,i,r,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===(i=e.person)||void 0===i||null===(r=i.names)||void 0===r?void 0:r.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(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}();y.savePatientFormOffline=(p=u((function(e,t,n,a,o,s,u,l,c){var d;return h(this,(function(f){switch(f.label){case 0:return d={fhirPatient:y.mapPatientToFhirPatient(y.getPatientToCreate(t,n,a,[])),_patientRegistrationData:{isNewPatient:e,formValues:t,patientUuidMap:n,initialAddressFieldValues:a,capturePhotoProps:o,currentLocation:s,initialIdentifierValues:u,currentUser:l,config:c,savePatientTransactionManager:new m}},[4,(0,i.queueSynchronizationItem)(r.Kt,d,{id:t.patientUuid,displayName:"Patient registration",patientUuid:d.fhirPatient.id,dependencies:[]})];case 1:return f.sent(),[2,null]}}))})),function(e,t,n,i,r,a,o,s,u){return p.apply(this,arguments)}),y.savePatientFormOnline=function(){var e=u((function(e,t,n,i,r,o,s,l,c,d,f){var p,m,b;return h(this,(function(v){switch(v.label){case 0:return[4,y.savePatientIdentifiers(e,t.patientUuid,t.identifiers,s,o,f)];case 1:return p=v.sent(),m=y.getPatientToCreate(t,n,i,p),y.getDeletedNames(t.patientUuid,n).forEach(function(){var e=u((function(e){return h(this,(function(t){switch(t.label){case 0:return[4,(0,a.uO)(e.nameUuid,e.personUuid,f)];case 1:return t.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[4,(0,a.co)(f,m,e&&!d.patientSaved?void 0:t.patientUuid)];case 2:return(b=v.sent()).ok?(d.patientSaved=!0,[4,y.saveRelationships(t.relationships,b,f)]):[3,6];case 3:return v.sent(),[4,y.saveObservations(t.obs,b,o,l,c,f)];case 4:return v.sent(),c.concepts.patientPhotoUuid&&(null==r?void 0:r.imageData)?[4,(0,a.oV)(b.data.uuid,r.imageData,"/ws/rest/v1/obs",r.dateTime||(new Date).toISOString(),c.concepts.patientPhotoUuid,f)]:[3,6];case 5:v.sent(),v.label=6;case 6:return[2,b.data.uuid]}}))}));return function(t,n,i,r,a,o,s,u,l,c,d){return e.apply(this,arguments)}}();var m=function e(){l(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>f,M8:()=>_,Uu:()=>w,ZB:()=>U,bL:()=>y,co:()=>d,eb:()=>P,f$:()=>A,fX:()=>p,kE:()=>b,nI:()=>S,oV:()=>v,r6:()=>m,uO:()=>h});var i=n(9857),r=n(2303),a=n(906),o=n(268);function s(e,t,n,i,r,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(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}var l=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};function c(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new Uint8Array(t.length),r=0;r<t.length;r++)i[r]=t.charCodeAt(r);var a=new Blob([i],{type:n});return new File([a],"patient-photo.png")}function d(e,t,n){return(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(n||""),{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function f(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function p(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function h(e,t,n){return(0,a.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function m(e,t,n){return(0,a.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:n.relationshipType},signal:e.signal})}function b(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:e.signal})}function v(e,t,n,i,r,a){return g.apply(this,arguments)}function g(){return(g=u((function(e,t,n,i,r,o){var s;return l(this,(function(u){return(s=new FormData).append("patient",e),s.append("file",c(t)),s.append("json",JSON.stringify({person:e,concept:r,groupMembers:[],obsDatetime:i})),[2,(0,a.openmrsFetch)(n,{method:"POST",signal:o.signal,body:s})]}))}))).apply(this,arguments)}function w(e){var t,n,r,o=(0,a.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(o,"&v=full"),u=(0,i.ZP)(e?s:null,a.openmrsFetch),l=u.data,c=u.error,d=null==l||null===(t=l.data)||void 0===t?void 0:t.results[0];return{data:d?{dateTime:null==d?void 0:d.obsDatetime,imageSrc:null==d||null===(n=d.value)||void 0===n||null===(r=n.links)||void 0===r?void 0:r.uri}:null,isError:c,isLoading:!l&&!c}}function _(e,t){return T.apply(this,arguments)}function T(){return(T=u((function(e,t){return l(this,(function(n){return[2,(0,a.openmrsFetch)("/ws/rest/v1/person?q=".concat(e),{signal:t.signal})]}))}))).apply(this,arguments)}function P(e,t,n){return O.apply(this,arguments)}function O(){return(O=u((function(e,t,n){return l(this,(function(i){return[2,(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:t})]}))}))).apply(this,arguments)}function S(e,t,n,i){return D.apply(this,arguments)}function D(){return(D=u((function(e,t,n,i){return l(this,(function(r){return[2,(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:{identifier:n}})]}))}))).apply(this,arguments)}function U(e,t,n){return j.apply(this,arguments)}function j(){return(j=u((function(e,t,n){return l(this,(function(i){return[2,(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:n.signal})]}))}))).apply(this,arguments)}function A(e,t){var n,i=(0,r.Z)(e?"/module/addresshierarchy/ajax/getPossibleFullAddresses.form?separator=".concat(t,"&searchString=").concat(e):null,a.openmrsFetch),s=i.data,u=i.error,l=(0,o.useMemo)((function(){var e;return{addresses:null!==(n=null==s||null===(e=s.data)||void 0===e?void 0:e.map((function(e){return e.address})))&&void 0!==n?n:[],error:u,isLoading:!s&&!u}}),[s,u]);return l}},3979:(e,t,n)=>{var i={"./en.json":[3574,574],"./km.json":[7807,807]};function r(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],r=t[0];return n.e(t[1]).then((()=>n(r)))}r.keys=()=>Object.keys(i),r.id=3979,e.exports=r}}]);
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 i=n(906);function r(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 a(e){return function(e){if(Array.isArray(e))return r(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 r(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)?r(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:i.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:i.Type.String}},sectionDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.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:i.Type.String,_description:"The title to display at the top of the section."},fields:{_type:i.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:i.Type.String}}},_default:[]},fieldDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:i.Type.String,_description:"How this field's data will be stored—a person attribute or an obs."},uuid:{_type:i.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},label:{_type:i.Type.String,_default:null,_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:i.Type.String,_default:"",_description:"Placeholder that will appear in the input."},validation:{required:{_type:i.Type.Boolean,_default:!1},matches:{_type:i.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:i.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:i.Type.Array,_elements:{uuid:{_type:i.Type.UUID,_description:"Answer concept UUID"},label:{_type:i.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:i.Type.Boolean,_default:!0},unidentifiedPatient:{_type:i.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},defaultUnknownGivenName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."},displayCapturePhoto:{_type:i.Type.Boolean,_default:!0,_description:"Whether to display capture patient photo slot on name field"}},gender:{_type:i.Type.Array,_elements:{value:{_type:i.Type.String,_description:"The value for sex option"},label:{_type:i.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:i.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:{enabled:{_type:i.Type.Boolean,_description:"Whether to use the Address hierarchy in the registration form or not",_default:!0},useQuickSearch:{_type:i.Type.Boolean,_description:"Whether to use the quick searching through the address saved in the database pre-fill the form.",_default:!0},searchAddressByLevel:{_type:i.Type.Boolean,_description:"Whether to fill the addresses by levels, i.e. County => subCounty, the current field is dependent on it's previous field.",_default:!0},useAddressHierarchyLabel:{_type:i.Type.Object,_description:"Whether to use custom labels for address hierarchy",_default:{}}}},dateOfBirth:{useEstimatedDateOfBirth:{enabled:{_type:i.Type.Boolean,_description:"Whether to use custom day and month for estimated date of birth",_default:!1},dayOfMonth:{_type:i.Type.Number,_description:"The custom day of the month use on the estimated date of birth",_default:0},month:{_type:i.Type.Number,_description:"The custom month to use on the estimated date of birth i.e 0 = Jan 11 = Dec",_default:0}}}},links:{submitButton:{_type:i.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[i.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:i.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:i.Type.Array,_elements:{_type:i.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:i.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:i.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:i.Type.UUID,_default:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_validators:[(0,i.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,i.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(l(o))+(e.sectionDefinitions.length?"; and the defined sections ".concat(l(e.sectionDefinitions),"."):".")})),(0,i.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)}))})),i=n.fields.find((function(e){return!t.includes(e)}));return"The section definition '".concat(n.id,"' contains an invalid field '").concat(i,"'. 'fields' can only contain the built-in fields '").concat(s.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(l(e.fieldDefinitions),"."):".")}))]};function l(e){return"'".concat(e.map((function(e){return e.id})).join("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>l,QT:()=>c,UO:()=>s,e1:()=>u});var i,r,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",l="patient-registration",c=(i={},a="network-first",(r=o.omrsOfflineCachingStrategyHttpHeaderName)in i?Object.defineProperty(i,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[r]=a,i)},1686:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>v,importTranslation:()=>b,setupOpenMRS:()=>g,version:()=>m});var i=n(906),r=n(3076),a=n(225),o=n(8179),s=n(6279);function u(e,t,n,i,r,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(i,r)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){u(a,i,r,o,s,"next",e)}function s(e){u(a,i,r,o,s,"throw",e)}o(void 0)}))}}var c=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};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,i.makeUrl)(e)}))}function f(){return p.apply(this,arguments)}function p(){return(p=l((function(){return c(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(0,s.X1)(),(0,s.Te)(),(0,s.mt)(),(0,s.St)()])];case 1:return e.sent(),[2]}}))}))).apply(this,arguments)}function h(e,t){return y.apply(this,arguments)}function y(){return(y=l((function(e,t){return c(this,(function(n){switch(n.label){case 0:return[4,r.y.savePatientFormOnline(e._patientRegistrationData.isNewPatient,e._patientRegistrationData.formValues,e._patientRegistrationData.patientUuidMap,e._patientRegistrationData.initialAddressFieldValues,e._patientRegistrationData.capturePhotoProps,e._patientRegistrationData.currentLocation,e._patientRegistrationData.initialIdentifierValues,e._patientRegistrationData.currentUser,e._patientRegistrationData.config,e._patientRegistrationData.savePatientTransactionManager,t.abort)];case 1:return n.sent(),[2]}}))}))).apply(this,arguments)}var m="4.0.2-pre.858",b=n(3979),v={"webservices.rest":"^2.24.0"};function g(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,i.defineConfigSchema)(o.e1,a.bT),(0,i.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")},{path:"".concat(window.spaBase,"/patient/:patientUuid/edit"),title:"Edit patient details",parent:"".concat(window.spaBase,"/patient/:patientUuid/chart")}]),(0,i.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,i.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,i.subscribePrecacheStaticDependencies)(f),(0,i.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return l((function(){var t,n;return c(this,(function(i){switch(i.label){case 0:return t=d(e),[4,caches.open("omrs-spa-cache-v1")];case 1:return[4,i.sent().keys()];case 2:return n=i.sent().map((function(e){return e.url})),[2,t.every((function(e){return n.includes(e)}))]}}))}))()},sync:function(e){return l((function(){var t;return c(this,(function(n){switch(n.label){case 0:return t=d(e),[4,Promise.allSettled(t.map((r=l((function(e){return c(this,(function(t){switch(t.label){case 0:return[4,(0,i.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:e})];case 1:return t.sent(),[4,fetch(e)];case 2:return t.sent(),[2]}}))})),function(e){return r.apply(this,arguments)})))];case 1:return n.sent(),[2]}var r}))}))()}}),{pages:[{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),n.e(375),n.e(154),n.e(924),n.e(658)]).then(n.bind(n,7658))}),e),route:"patient-registration",online:{savePatientForm:r.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:r.y.savePatientFormOffline,isOffline:!0}},{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),n.e(375),n.e(154),n.e(924),n.e(658)]).then(n.bind(n,7658))}),{featureName:"edit-patient-details-form",moduleName:o.e1}),route:/patient\/([a-zA-Z0-9\-]+)\/edit/,online:{savePatientForm:r.y.savePatientFormOnline},offline:{savePatientForm:r.y.savePatientFormOffline}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),n.e(375),n.e(206)]).then(n.bind(n,8206))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),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,i.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-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,i.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,i.getAsyncLifecycle)((function(){return Promise.all([n.e(430),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:()=>T,X1:()=>w,mt:()=>O});var i=n(268),r=n.n(i),a=n(3662),o=n(2777),s=n(8407),u=n(906),l=n(8179);function c(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 d(e,t,n,i,r,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(i,r)}function f(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){d(a,i,r,o,s,"next",e)}function s(e){d(a,i,r,o,s,"throw",e)}o(void 0)}))}}function p(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){p(e,t,n[t])}))}return e}function y(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 m(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,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}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 b=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},v=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},g=r().createContext(null);function w(e){return _.apply(this,arguments)}function _(){return(_=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/session",e)];case 1:return[2,t.sent().data]}}))}))).apply(this,arguments)}function T(e){return P.apply(this,arguments)}function P(){return(P=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)",e)];case 1:return[2,t.sent().data]}}))}))).apply(this,arguments)}function O(e){return S.apply(this,arguments)}function S(){return(S=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/relationshiptype?v=default",e)];case 1:return[2,t.sent().data]}}))}))).apply(this,arguments)}function D(e){return U.apply(this,arguments)}function U(){return(U=f((function(e){var t,n,i,r,o,s,u,l,c;return b(this,(function(d){switch(d.label){case 0:return[4,j(e)];case 1:t=d.sent(),n=t.filter(Boolean),i=!0,r=!1,o=void 0,d.label=2;case 2:d.trys.push([2,7,8,9]),s=function(){var t,n,i,r;return b(this,(function(o){switch(o.label){case 0:return t=l.value,[4,Promise.all([k(t.uuid,e),F(e)])];case 1:return n=m.apply(void 0,[o.sent(),2]),i=n[0],r=n[1],t.identifierSources=i.data.results.map((function(e){var t=(0,a.Z)(r.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e})),[2]}}))},u=n[Symbol.iterator](),d.label=3;case 3:return(i=(l=u.next()).done)?[3,6]:[5,v(s())];case 4:d.sent(),d.label=5;case 5:return i=!0,[3,3];case 6:return[3,9];case 7:return c=d.sent(),r=!0,o=c,[3,9];case 8:try{i||null==u.return||u.return()}finally{if(r)throw o}return[7];case 9:return[2,n]}}))}))).apply(this,arguments)}function j(e){return A.apply(this,arguments)}function A(){return(A=f((function(e){var t,n,i,r,a,s,u,l,c;return b(this,(function(d){switch(d.label){case 0:return[4,C("/ws/rest/v1/patientidentifiertype?v=full",e)];case 1:return t=d.sent(),[4,C("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType",e)];case 2:return n=d.sent(),t.ok?(u=null==t||null===(i=t.data)||void 0===i?void 0:i.results,l=null==n||null===(r=n.data)||void 0===r||null===(a=r.results)||void 0===a||null===(s=a[0])||void 0===s?void 0:s.metadataUuid,c=(null==n?void 0:n.ok)?[B(null==u?void 0:u.find((function(e){return e.uuid===l})),!0)]:[],u.forEach((function(e){e.uuid!==l&&c.push(B(e,!1))})),[2,c.map((function(e){return y(h({},e),{fieldName:(0,o.Z)(e.name)})}))]):[2,[]]}}))}))).apply(this,arguments)}function k(e,t){return N.apply(this,arguments)}function N(){return(N=f((function(e,t){return b(this,(function(n){switch(n.label){case 0:return[4,C("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(e),t)];case 1:return[2,n.sent()]}}))}))).apply(this,arguments)}function F(e){return I.apply(this,arguments)}function I(){return(I=f((function(e){return b(this,(function(t){switch(t.label){case 0:return[4,C("/ws/rest/v1/idgen/autogenerationoption?v=full",e)];case 1:return[2,t.sent()]}}))}))).apply(this,arguments)}function C(e,t){return E.apply(this,arguments)}function E(){return(E=f((function(e,t){return b(this,(function(n){switch(n.label){case 0:return[4,(0,u.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,s.Z)(e)})];case 1:return n.sent(),[4,(0,u.openmrsFetch)(e,{headers:l.QT,signal:null==t?void 0:t.signal})];case 2:return[2,n.sent()]}}))}))).apply(this,arguments)}function B(e,t){return{name:e.display,fieldName:(0,o.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:()=>m,y:()=>y});var i=n(906),r=n(8179),a=n(7117);function o(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 s(e,t,n,i,r,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(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},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){c(e,t,n[t])}))}return e}function f(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,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(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)?o(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 p,h=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},y=function(){function e(){l(this,e)}return e.saveRelationships=function(e,t,n){return u((function(){return h(this,(function(i){return[2,Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var i=e.relatedPersonUuid,r=e.relationshipType,o=e.uuid,s=e.action,u=f(r.split("/"),2),l=u[0],c=u[1],d=t.data.uuid,p="aIsToB"===c,h={personA:p?i:d,personB:p?d:i,relationshipType:l};switch(s){case"ADD":return(0,a.bL)(n,h);case"UPDATE":return(0,a.r6)(n,o,h);case"DELETE":return(0,a.kE)(n,o)}})))]}))}))()},e.saveObservations=function(e,t,n,i,r,o){return u((function(){var s;return h(this,(function(u){if(e&&Object.keys(e).length>0){if(r.registrationObs.encounterTypeUuid)return s={encounterDatetime:new Date,patient:t.data.uuid,encounterType:r.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:i.currentProvider.uuid,encounterRole:r.registrationObs.encounterProviderRoleUuid}],form:r.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},[2,(0,a.M1)(o,s)];console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved.")}return[2]}))}))()},e.savePatientIdentifiers=function(e,t,n,i,r,o){return u((function(){var s;return h(this,(function(l){var c;return s=Object.values(n).map((c=u((function(n){var i,s,u,l,c,d,f,p,y,m;return h(this,(function(h){switch(h.label){case 0:return i=n.identifierTypeUuid,s=n.identifierValue,u=n.identifierUuid,l=n.selectedSource,c=n.preferred,d=n.autoGeneration,f=n.initialValue,s||d&&l?d?[3,1]:(y=s,[3,4]):[3,9];case 1:return[4,(0,a.fX)(n.selectedSource.uuid,o)];case 2:return[4,h.sent().data.identifier];case 3:y=h.sent(),h.label=4;case 4:return m={uuid:u,identifier:p=y,identifierType:i,location:r,preferred:c},e?[3,8]:f?[3,6]:[4,(0,a.eb)(t,m,o)];case 5:return h.sent(),[3,8];case 6:return f===p?[3,8]:[4,(0,a.nI)(t,u,m.identifier,o)];case 7:h.sent(),h.label=8;case 8:return[2,m];case 9:return[2]}}))})),function(e){return c.apply(this,arguments)})),t&&Object.keys(i).filter((function(e){return!n[e]})).forEach(function(){var e=u((function(e){return h(this,(function(n){switch(n.label){case 0:return[4,(0,a.ZB)(t,i[e].identifierUuid,o)];case 1:return n.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[2,Promise.all(s)]}))}))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,i,r){var a,o,s;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,{uuid:t.patientUuid,person:d({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[t.address]},e.getPatientDeathInfo(t)),identifiers:r}},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,i=!1,r=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=f(a.value,2),u=s[0],l=s[1];t.push({attributeType:u,value:l})}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,i=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?i:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,i,r,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===(i=e.person)||void 0===i||null===(r=i.names)||void 0===r?void 0:r.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(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}();y.savePatientFormOffline=(p=u((function(e,t,n,a,o,s,u,l,c){var d;return h(this,(function(f){switch(f.label){case 0:return d={fhirPatient:y.mapPatientToFhirPatient(y.getPatientToCreate(t,n,a,[])),_patientRegistrationData:{isNewPatient:e,formValues:t,patientUuidMap:n,initialAddressFieldValues:a,capturePhotoProps:o,currentLocation:s,initialIdentifierValues:u,currentUser:l,config:c,savePatientTransactionManager:new m}},[4,(0,i.queueSynchronizationItem)(r.Kt,d,{id:t.patientUuid,displayName:"Patient registration",patientUuid:d.fhirPatient.id,dependencies:[]})];case 1:return f.sent(),[2,null]}}))})),function(e,t,n,i,r,a,o,s,u){return p.apply(this,arguments)}),y.savePatientFormOnline=function(){var e=u((function(e,t,n,i,r,o,s,l,c,d,f){var p,m,b;return h(this,(function(v){switch(v.label){case 0:return[4,y.savePatientIdentifiers(e,t.patientUuid,t.identifiers,s,o,f)];case 1:return p=v.sent(),m=y.getPatientToCreate(t,n,i,p),y.getDeletedNames(t.patientUuid,n).forEach(function(){var e=u((function(e){return h(this,(function(t){switch(t.label){case 0:return[4,(0,a.uO)(e.nameUuid,e.personUuid,f)];case 1:return t.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[4,(0,a.co)(f,m,e&&!d.patientSaved?void 0:t.patientUuid)];case 2:return(b=v.sent()).ok?(d.patientSaved=!0,[4,y.saveRelationships(t.relationships,b,f)]):[3,6];case 3:return v.sent(),[4,y.saveObservations(t.obs,b,o,l,c,f)];case 4:return v.sent(),c.concepts.patientPhotoUuid&&(null==r?void 0:r.imageData)?[4,(0,a.oV)(b.data.uuid,r.imageData,"/ws/rest/v1/obs",r.dateTime||(new Date).toISOString(),c.concepts.patientPhotoUuid,f)]:[3,6];case 5:v.sent(),v.label=6;case 6:return[2,b.data.uuid]}}))}));return function(t,n,i,r,a,o,s,u,l,c,d){return e.apply(this,arguments)}}();var m=function e(){l(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>f,M8:()=>_,Uu:()=>w,ZB:()=>U,bL:()=>y,co:()=>d,eb:()=>P,f$:()=>A,fX:()=>p,kE:()=>b,nI:()=>S,oV:()=>v,r6:()=>m,uO:()=>h});var i=n(9857),r=n(2303),a=n(906),o=n(268);function s(e,t,n,i,r,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(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}var l=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};function c(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new Uint8Array(t.length),r=0;r<t.length;r++)i[r]=t.charCodeAt(r);var a=new Blob([i],{type:n});return new File([a],"patient-photo.png")}function d(e,t,n){return(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(n||""),{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function f(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function p(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function h(e,t,n){return(0,a.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function m(e,t,n){return(0,a.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:n.relationshipType},signal:e.signal})}function b(e,t){return(0,a.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:e.signal})}function v(e,t,n,i,r,a){return g.apply(this,arguments)}function g(){return(g=u((function(e,t,n,i,r,o){var s;return l(this,(function(u){return(s=new FormData).append("patient",e),s.append("file",c(t)),s.append("json",JSON.stringify({person:e,concept:r,groupMembers:[],obsDatetime:i})),[2,(0,a.openmrsFetch)(n,{method:"POST",signal:o.signal,body:s})]}))}))).apply(this,arguments)}function w(e){var t,n,r,o=(0,a.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(o,"&v=full"),u=(0,i.ZP)(e?s:null,a.openmrsFetch),l=u.data,c=u.error,d=null==l||null===(t=l.data)||void 0===t?void 0:t.results[0];return{data:d?{dateTime:null==d?void 0:d.obsDatetime,imageSrc:null==d||null===(n=d.value)||void 0===n||null===(r=n.links)||void 0===r?void 0:r.uri}:null,isError:c,isLoading:!l&&!c}}function _(e,t){return T.apply(this,arguments)}function T(){return(T=u((function(e,t){return l(this,(function(n){return[2,(0,a.openmrsFetch)("/ws/rest/v1/person?q=".concat(e),{signal:t.signal})]}))}))).apply(this,arguments)}function P(e,t,n){return O.apply(this,arguments)}function O(){return(O=u((function(e,t,n){return l(this,(function(i){return[2,(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:t})]}))}))).apply(this,arguments)}function S(e,t,n,i){return D.apply(this,arguments)}function D(){return(D=u((function(e,t,n,i){return l(this,(function(r){return[2,(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:{identifier:n}})]}))}))).apply(this,arguments)}function U(e,t,n){return j.apply(this,arguments)}function j(){return(j=u((function(e,t,n){return l(this,(function(i){return[2,(0,a.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:n.signal})]}))}))).apply(this,arguments)}function A(e,t){var n,i=(0,r.Z)(e?"/module/addresshierarchy/ajax/getPossibleFullAddresses.form?separator=".concat(t,"&searchString=").concat(e):null,a.openmrsFetch),s=i.data,u=i.error,l=(0,o.useMemo)((function(){var e;return{addresses:null!==(n=null==s||null===(e=s.data)||void 0===e?void 0:e.map((function(e){return e.address})))&&void 0!==n?n:[],error:u,isLoading:!s&&!u}}),[s,u]);return l}},3979:(e,t,n)=>{var i={"./en.json":[3574,574],"./km.json":[7807,807]};function r(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],r=t[0];return n.e(t[1]).then((()=>n(r)))}r.keys=()=>Object.keys(i),r.id=3979,e.exports=r}}]);
@@ -98,7 +98,7 @@
98
98
  "main.js"
99
99
  ],
100
100
  "auxiliaryFiles": [],
101
- "hash": "9789917166b53004cb88",
101
+ "hash": "edc72144d01f5ba3f999",
102
102
  "childrenByOrder": {}
103
103
  },
104
104
  {
@@ -270,9 +270,9 @@
270
270
  "initial": false,
271
271
  "entry": false,
272
272
  "recorded": false,
273
- "size": 3311,
273
+ "size": 3448,
274
274
  "sizes": {
275
- "javascript": 3311
275
+ "javascript": 3448
276
276
  },
277
277
  "names": [],
278
278
  "idHints": [],
@@ -284,7 +284,7 @@
284
284
  "574.js"
285
285
  ],
286
286
  "auxiliaryFiles": [],
287
- "hash": "19fe5e336b5568340bcc",
287
+ "hash": "4a6dc686187811425045",
288
288
  "childrenByOrder": {}
289
289
  },
290
290
  {
@@ -314,9 +314,9 @@
314
314
  "initial": false,
315
315
  "entry": false,
316
316
  "recorded": false,
317
- "size": 252643,
317
+ "size": 253022,
318
318
  "sizes": {
319
- "javascript": 252601,
319
+ "javascript": 252980,
320
320
  "consume-shared": 42
321
321
  },
322
322
  "names": [],
@@ -329,7 +329,7 @@
329
329
  "658.js"
330
330
  ],
331
331
  "auxiliaryFiles": [],
332
- "hash": "59f543540d9629f58482",
332
+ "hash": "90991aa7c773a94919b5",
333
333
  "childrenByOrder": {}
334
334
  },
335
335
  {
@@ -351,7 +351,7 @@
351
351
  "686.js"
352
352
  ],
353
353
  "auxiliaryFiles": [],
354
- "hash": "8974f160c3d32b717b34",
354
+ "hash": "e23a93c4562d500bc90d",
355
355
  "childrenByOrder": {}
356
356
  },
357
357
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-patient-registration-app",
3
- "version": "4.0.2-pre.837",
3
+ "version": "4.0.2-pre.858",
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": "adefadf7ad038d3110a50fb0463f109b1a8c5fe6"
55
+ "gitHead": "bb603fce63d7b72cfc27e310e304bfc028f41f58"
56
56
  }
@@ -2,29 +2,29 @@ import { Type, validator, validators } from '@openmrs/esm-framework';
2
2
 
3
3
  export interface SectionDefinition {
4
4
  id: string;
5
- name: string;
5
+ name?: string;
6
6
  fields: Array<string>;
7
7
  }
8
8
 
9
9
  export interface FieldDefinition {
10
10
  id: string;
11
11
  type: string;
12
- label: string | null;
12
+ label?: string;
13
13
  uuid: string;
14
14
  placeholder: string;
15
15
  validation: {
16
16
  required: boolean;
17
- matches: string | null;
17
+ matches?: string;
18
18
  };
19
- answerConceptSetUuid: string | null;
19
+ answerConceptSetUuid?: string;
20
20
  customConceptAnswers: Array<CustomConceptAnswer>;
21
21
  }
22
22
  export interface CustomConceptAnswer {
23
- label: string | null;
24
23
  uuid: string;
24
+ label?: string;
25
25
  }
26
26
  export interface Gender {
27
- label: string | null;
27
+ label?: string;
28
28
  value: string;
29
29
  id: string;
30
30
  }
@@ -13,10 +13,19 @@ export interface SectionWrapperProps {
13
13
  export const SectionWrapper = ({ sectionDefinition, index }: SectionWrapperProps) => {
14
14
  const { t } = useTranslation();
15
15
 
16
+ /*
17
+ * This comment exists to provide translation keys for the default section names.
18
+ *
19
+ * DO NOT REMOVE THESE UNLESS A DEFAULT SECTION IS REMOVED
20
+ * t('demographicsSection', 'Basic Info')
21
+ * t('contactSection', 'Contact Details')
22
+ * t('deathSection', 'Death Info')
23
+ * t('relationshipsSection', 'Relationships')
24
+ */
16
25
  return (
17
26
  <div id={sectionDefinition.id}>
18
27
  <h3 className={styles.productiveHeading02} style={{ color: '#161616' }}>
19
- {index + 1}. {sectionDefinition.name}
28
+ {index + 1}. {t(`${sectionDefinition.id}Section`, sectionDefinition.name)}
20
29
  </h3>
21
30
  <span className={styles.label01}>
22
31
  {t('allFieldsRequiredText', 'All fields are required unless marked optional')}
@@ -12,14 +12,17 @@
12
12
  "causeOfDeathInputLabel": "Cause of Death",
13
13
  "cityVillage": "City",
14
14
  "configure": "Configure",
15
+ "contactSection": "Contact Details",
15
16
  "country": "Country",
16
17
  "countyDistrict": "District",
17
18
  "createNew": "Create New",
18
19
  "dateOfBirthLabelText": "Date of Birth",
19
20
  "deathDateInputLabel": "Date of Death",
20
21
  "deathdayNotInTheFuture": "Death day cannot be in the future",
22
+ "deathSection": "Death Info",
21
23
  "deleteIdentifierTooltip": "Delete",
22
24
  "deleteRelationshipTooltipText": "Delete",
25
+ "demographicsSection": "Basic Info",
23
26
  "discard": "Discard",
24
27
  "discardModalBody": "The changes you made to this patient's details have not been saved. Discard changes?",
25
28
  "discardModalHeader": "Confirm Discard Changes",
@@ -69,6 +72,7 @@
69
72
  "relationship": "Relationship",
70
73
  "relationshipPlaceholder": "Relationship",
71
74
  "relationshipRemovedText": "Relationship removed",
75
+ "relationshipsSection": "Relationships",
72
76
  "relationshipToPatient": "Relationship to patient",
73
77
  "relativeFullNameLabelText": "Full name",
74
78
  "relativeNamePlaceholder": "Firstname Familyname",