@kenyaemr/esm-patient-registration-app 7.0.0 → 7.0.2-pre.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +38 -0
- package/dist/130.js +1 -1
- package/dist/130.js.map +1 -1
- package/dist/152.js +1 -1
- package/dist/152.js.map +1 -1
- package/dist/169.js +1 -0
- package/dist/169.js.map +1 -0
- package/dist/207.js +1 -0
- package/dist/{537.js.map → 207.js.map} +1 -1
- package/dist/255.js +1 -1
- package/dist/255.js.map +1 -1
- package/dist/266.js +2 -0
- package/dist/266.js.map +1 -0
- package/dist/303.js +1 -1
- package/dist/303.js.map +1 -1
- package/dist/330.js +1 -1
- package/dist/501.js +1 -0
- package/dist/501.js.map +1 -0
- package/dist/548.js +1 -0
- package/dist/548.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/59.js +1 -1
- package/dist/59.js.map +1 -1
- package/dist/729.js +1 -1
- package/dist/729.js.map +1 -1
- package/dist/735.js +1 -1
- package/dist/753.js +1 -0
- package/dist/753.js.map +1 -0
- package/dist/879.js +1 -1
- package/dist/879.js.map +1 -1
- package/dist/kenyaemr-esm-patient-registration-app.js +1 -1
- package/dist/kenyaemr-esm-patient-registration-app.js.buildmanifest.json +137 -113
- package/dist/kenyaemr-esm-patient-registration-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +5 -4
- package/src/config-schema.ts +1 -0
- package/src/offline.resources.ts +7 -5
- package/src/patient-registration/field/obs/obs-field.component.tsx +64 -2
- package/src/patient-registration/field/obs/obs-field.test.tsx +44 -2
- package/src/patient-registration/form-manager.ts +7 -5
- package/src/patient-registration/patient-registration.component.tsx +5 -4
- package/src/patient-registration/patient-registration.resource.ts +1 -1
- package/src/patient-registration/patient-registration.scss +16 -13
- package/src/patient-registration/patient-registration.test.tsx +5 -5
- package/translations/en.json +1 -3
- package/dist/336.js +0 -2
- package/dist/336.js.map +0 -1
- package/dist/481.js +0 -1
- package/dist/481.js.map +0 -1
- package/dist/537.js +0 -1
- package/dist/676.js +0 -1
- package/dist/676.js.map +0 -1
- package/dist/889.js +0 -1
- package/dist/889.js.map +0 -1
- /package/dist/{336.js.LICENSE.txt → 266.js.LICENSE.txt} +0 -0
package/dist/548.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.webpackChunk_kenyaemr_esm_patient_registration_app=globalThis.webpackChunk_kenyaemr_esm_patient_registration_app||[]).push([[548],{2553:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,".-esm-patient-registration__add-patient-link__slotStyles___hAVLC{background-color:rgba(0,0,0,0)}","",{version:3,sources:["webpack://./src/add-patient-link.scss"],names:[],mappings:"AAAA,iEACE,8BAAA",sourceRoot:""}]),o.locals={slotStyles:"-esm-patient-registration__add-patient-link__slotStyles___hAVLC"};const s=o},5671:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__address-search__label01___oURHe{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___eCtFr{border-top-width:0;list-style:none;margin-top:0;max-height:20rem;overflow-y:auto;padding-left:0;width:100%;position:absolute;left:0;background-color:#fff;margin-bottom:20px;z-index:99;border:1px solid #e0e0e0}.-esm-patient-registration__address-search__suggestions___eCtFr li{padding:1rem;line-height:1.29;color:#525252;border-bottom:1px solid #8d8d8d}.-esm-patient-registration__address-search__suggestions___eCtFr li:hover{background-color:#e5e5e5;color:#161616;cursor:pointer}.-esm-patient-registration__address-search__suggestions___eCtFr li:not(:last-of-type){border-bottom:1px solid #999}.-esm-patient-registration__address-search__autocomplete___ziYIM{position:relative}.-esm-patient-registration__address-search__autocompleteSearch____mzpI{width:100%}.-esm-patient-registration__address-search__suggestions___eCtFr a{color:inherit;text-decoration:none}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/field/address/address-search.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,4DC81BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD11BJ,gEACE,kBAAA,CACA,eAAA,CACA,YAAA,CACA,gBAAA,CACA,eAAA,CACA,cAAA,CACA,UAAA,CACA,iBAAA,CACA,MAAA,CACA,qBAAA,CACA,kBAAA,CACA,UAAA,CACA,wBAAA,CAGF,mEACE,YEMW,CFLX,gBAAA,CACA,aAAA,CACA,+BAAA,CAGF,yEACE,wBAAA,CACA,aAAA,CACA,cAAA,CAGF,sFACE,4BAAA,CAGF,iEACE,iBAAA,CAGF,uEACE,UAAA,CAGF,kEACE,aAAA,CACA,oBAAA",sourceRoot:""}]),o.locals={label01:"-esm-patient-registration__address-search__label01___oURHe",suggestions:"-esm-patient-registration__address-search__suggestions___eCtFr",autocomplete:"-esm-patient-registration__address-search__autocomplete___ziYIM",autocompleteSearch:"-esm-patient-registration__address-search__autocompleteSearch____mzpI"};const s=o},1098:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__field__productiveHeading02___B7YQg{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___Kitgy{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___XhEuH{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___kG494{display:grid;grid-template-columns:1fr 1fr;column-gap:1rem}.-esm-patient-registration__field__halfWidthInDesktopView___bN6Sw{width:calc(50% - 1rem)}.-esm-patient-registration__field__patientPhoto___qrH4P{display:flex;justify-content:center}.-esm-patient-registration__field__nameField___tUkky{grid-row:1;grid-column:1}.-esm-patient-registration__field__nameField___tUkky>.cds--content-switcher{display:grid;grid-template-columns:1fr 1fr;width:max-content;justify-content:flex-start}.-esm-patient-registration__field__contentSwitcher___ReJS6{margin-bottom:1rem}.-esm-patient-registration__field__dobField___r5Uum>.cds--content-switcher{display:grid;grid-template-columns:1fr 1fr;width:max-content;justify-content:flex-start}.-esm-patient-registration__field__photoExtension___eUcYn{margin-bottom:1rem;grid-row:1;grid-column:2;justify-self:center}.-esm-patient-registration__field__sexField___WBNSZ,.-esm-patient-registration__field__dobField___r5Uum{margin-bottom:1rem}.-esm-patient-registration__field__dobContentSwitcherLabel___f3ZOM{margin-bottom:.5rem}.-esm-patient-registration__field__identifierLabelText___CUAVo{display:flex;align-items:center}.-esm-patient-registration__field__setIDNumberButton___MPk53{margin-bottom:1rem}.-esm-patient-registration__field__setIDNumberButton___MPk53>svg{margin-left:.5rem}.-esm-patient-registration__field__customField___FqVZp{margin-bottom:1rem}.-esm-patient-registration__field__attributeField___f6fQL{margin-bottom:1rem}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__grid___kG494{grid-template-columns:1fr;grid-template-rows:auto auto}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__nameField___tUkky{grid-row:2;grid-column:1}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__photoExtension___eUcYn{grid-column:1;grid-row:1;justify-self:start}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__radioButton___yvufj label{height:3rem !important}.omrs-breakpoint-lt-desktop .-esm-patient-registration__field__halfWidthInDesktopView___bN6Sw{width:100%}.-esm-patient-registration__field__radioFieldError___Y8du_{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}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/field/field.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,+DC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,kBAAA,CAGF,oECy1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CDv1BF,kBAAA,CACA,aAAA,CAGF,mDCm1BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD/0BJ,gDACE,YAAA,CACA,6BAAA,CACA,eESW,CFNb,kEACE,sBAAA,CAGF,wDACE,YAAA,CACA,sBAAA,CAGF,qDACE,UAAA,CACA,aAAA,CAGF,4EACE,YAAA,CACA,6BAAA,CACA,iBAAA,CACA,0BAAA,CAGF,2DACE,kBAAA,CAGF,2EACE,YAAA,CACA,6BAAA,CACA,iBAAA,CACA,0BAAA,CAGF,0DACE,kBAAA,CACA,UAAA,CACA,aAAA,CACA,mBAAA,CAGF,wGAEE,kBEnCW,CFsCb,mEACE,mBEjDW,CFoDb,+DACE,YAAA,CACA,kBAAA,CAGF,6DACE,kBEhDW,CFmDb,iEACE,iBE9DW,CFiEb,uDACE,kBExDW,CF2Db,0DACE,kBE5DW,CFgEX,4EACE,yBAAA,CACA,4BAAA,CAEF,iFACE,UAAA,CACA,aAAA,CAEF,sFACE,aAAA,CACA,UAAA,CACA,kBAAA,CAEF,yFACE,sBAAA,CAEF,8FACE,UAAA,CAIJ,2DACE,aAAA,CACA,aAAA,CACA,eAAA,CACA,kBAAA,CACA,gBAAA,CACA,gBAAA,CACA,oBAAA,CACA,gBAAA,CACA,iBAAA",sourceRoot:""}]),o.locals={productiveHeading02:"-esm-patient-registration__field__productiveHeading02___B7YQg",productiveHeading02Light:"-esm-patient-registration__field__productiveHeading02Light___Kitgy",label01:"-esm-patient-registration__field__label01___XhEuH",grid:"-esm-patient-registration__field__grid___kG494",halfWidthInDesktopView:"-esm-patient-registration__field__halfWidthInDesktopView___bN6Sw",patientPhoto:"-esm-patient-registration__field__patientPhoto___qrH4P",nameField:"-esm-patient-registration__field__nameField___tUkky",contentSwitcher:"-esm-patient-registration__field__contentSwitcher___ReJS6",dobField:"-esm-patient-registration__field__dobField___r5Uum",photoExtension:"-esm-patient-registration__field__photoExtension___eUcYn",sexField:"-esm-patient-registration__field__sexField___WBNSZ",dobContentSwitcherLabel:"-esm-patient-registration__field__dobContentSwitcherLabel___f3ZOM",identifierLabelText:"-esm-patient-registration__field__identifierLabelText___CUAVo",setIDNumberButton:"-esm-patient-registration__field__setIDNumberButton___MPk53",customField:"-esm-patient-registration__field__customField___FqVZp",attributeField:"-esm-patient-registration__field__attributeField___f6fQL",radioButton:"-esm-patient-registration__field__radioButton___yvufj",radioFieldError:"-esm-patient-registration__field__radioFieldError___Y8du_"};const s=o},3433:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__identifier-selection__title___id4Ma{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__identifier-selection__submit___EFvNk{width:250px}.-esm-patient-registration__identifier-selection__submit___EFvNk:hover{cursor:pointer}.-esm-patient-registration__identifier-selection__cancelButton___o8f0G{width:11.688rem}.-esm-patient-registration__identifier-selection__submitButton___WRJVa{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__identifier-selection__infoGrid___lYE6f{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__identifier-selection__label01___P7jXk{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___rOsRi{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___Y0nw4{margin:1rem 0}.-esm-patient-registration__identifier-selection__formContainer___isKuG{display:flex;width:100%}.-esm-patient-registration__identifier-selection__stickyColumn___SCnIQ{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__identifier-selection__touchTarget___OhMJU a:active{color:#161616}.-esm-patient-registration__identifier-selection__linkName___eS6IH{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__identifier-selection__linkName___eS6IH:active{text-decoration:none;color:#161616}.-esm-patient-registration__identifier-selection__linkName___eS6IH:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__identifier-selection__main___eLHMZ{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__identifier-selection__infoGrid___lYE6f{max-width:unset}.-esm-patient-registration__identifier-selection__spinner___VF1W2{min-height:1rem;width:max-content}.-esm-patient-registration__identifier-selection__spinner___VF1W2 .cds--inline-loading__text{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}html[dir=rtl] .-esm-patient-registration__identifier-selection__linkName___eS6IH>svg{transform:scale(-1, 1)}html[dir=rtl] .-esm-patient-registration__identifier-selection__infoGrid___lYE6f{padding-left:unset;padding-right:2rem}.-esm-patient-registration__identifier-selection__button___l3yVl{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-registration__identifier-selection__tablet___rSdxC{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-registration__identifier-selection__desktop___WlFF7{padding:0rem}.-esm-patient-registration__identifier-selection__radioGroup___WAlzM{background-color:#f4f4f4;padding:1rem}.-esm-patient-registration__identifier-selection__radioButton___vGul_{margin:0 !important}.-esm-patient-registration__identifier-selection__radioButton___vGul_ label{height:2rem}.omrs-breakpoint-lt-desktop .-esm-patient-registration__identifier-selection__radioButton___vGul_ label{height:3rem !important}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/patient-registration.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./src/patient-registration/field/id/identifier-selection.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,gEACE,kCAAA,CAGF,iEACE,WAAA,CAGF,uEACE,cAAA,CAGF,uEACE,eAAA,CAGF,uEACE,kBCUW,CDTX,eAAA,CACA,aAAA,CAGF,mEACE,UAAA,CACA,iBCaW,CDZX,kBAAA,CACA,eCCW,CAAA,eAAA,CDGb,kEEg0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF9zBF,eCLW,CDMX,kBCNW,CDOX,aDnCM,CCsCR,8EEyzBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFvzBF,aDxCM,CCyCN,cAAA,CAGF,kEACE,aAAA,CAGF,wEACE,YAAA,CACA,UAAA,CAGF,uEACE,eAAA,CACA,eC3BW,CD6BX,QAAA,CAGF,+EACE,aDtDe,CCyDjB,mEACE,aD3Dc,CC4Dd,gBAAA,CACA,cCvCW,CDwCX,eAAA,CAEA,0EACE,oBAAA,CACA,aDjEa,CCoEf,yEACE,oBAAA,CACA,aDtEa,CCuEb,cAAA,CAIJ,+DACE,qBAAA,CAIA,+FACE,eAAA,CAIJ,kEACE,eAAA,CACA,iBAAA,CAEA,6FE+vBE,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CFvvBA,qFACE,sBAAA,CAIJ,iFACE,kBAAA,CACA,kBCzES,CEtCb,iEACE,WAAA,CACA,YAAA,CACA,wBAAA,CACA,oBAAA,CACA,aAAA,CAGF,iEACE,mBAAA,CACA,qBJZM,CIeR,kEACE,YAAA,CAGF,qEACE,wBJrBM,CIsBN,YFSW,CENb,sEACE,mBAAA,CACA,4EACE,WFaS,CERX,wGACE,sBAAA",sourceRoot:""}]),o.locals={title:"-esm-patient-registration__identifier-selection__title___id4Ma",submit:"-esm-patient-registration__identifier-selection__submit___EFvNk",cancelButton:"-esm-patient-registration__identifier-selection__cancelButton___o8f0G",submitButton:"-esm-patient-registration__identifier-selection__submitButton___WRJVa",infoGrid:"-esm-patient-registration__identifier-selection__infoGrid___lYE6f",label01:"-esm-patient-registration__identifier-selection__label01___P7jXk",productiveHeading02:"-esm-patient-registration__identifier-selection__productiveHeading02___rOsRi",space05:"-esm-patient-registration__identifier-selection__space05___Y0nw4",formContainer:"-esm-patient-registration__identifier-selection__formContainer___isKuG",stickyColumn:"-esm-patient-registration__identifier-selection__stickyColumn___SCnIQ",touchTarget:"-esm-patient-registration__identifier-selection__touchTarget___OhMJU",linkName:"-esm-patient-registration__identifier-selection__linkName___eS6IH",main:"-esm-patient-registration__identifier-selection__main___eLHMZ",spinner:"-esm-patient-registration__identifier-selection__spinner___VF1W2",button:"-esm-patient-registration__identifier-selection__button___l3yVl",tablet:"-esm-patient-registration__identifier-selection__tablet___rSdxC",desktop:"-esm-patient-registration__identifier-selection__desktop___WlFF7",radioGroup:"-esm-patient-registration__identifier-selection__radioGroup___WAlzM",radioButton:"-esm-patient-registration__identifier-selection__radioButton___vGul_"};const s=o},1662:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__autosuggest__label01___ZMRhI{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___jNk6d{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___jNk6d li{padding:1rem;line-height:1.29;color:#525252;border-bottom:1px solid #8d8d8d}.-esm-patient-registration__autosuggest__suggestions___jNk6d li:hover{background-color:#e5e5e5;color:#161616;cursor:pointer}.-esm-patient-registration__autosuggest__suggestions___jNk6d li:not(:last-of-type){border-bottom:1px solid #999}.-esm-patient-registration__autosuggest__autocomplete___CqHbh{position:relative}.-esm-patient-registration__autosuggest__autocompleteSearch___tDrC1{width:100%}.-esm-patient-registration__autosuggest__suggestions___jNk6d a{color:inherit;text-decoration:none}.-esm-patient-registration__autosuggest__invalid___ucMxb input{outline:2px solid var(--cds-support-error, #da1e28);outline-offset:-2px}.-esm-patient-registration__autosuggest__invalidMsg___fYXV4{color:var(--cds-text-error, #da1e28)}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/input/custom-input/autosuggest/autosuggest.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,yDC81BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD11BJ,6DACE,iBAAA,CACA,kBAAA,CACA,eAAA,CACA,YAAA,CACA,gBAAA,CACA,eAAA,CACA,cAAA,CACA,UAAA,CACA,iBAAA,CACA,MAAA,CACA,qBAAA,CACA,kBAAA,CACA,UAAA,CAGF,gEACE,YEMW,CFLX,gBAAA,CACA,aAAA,CACA,+BAAA,CAGF,sEACE,wBAAA,CACA,aAAA,CACA,cAAA,CAGF,mFACE,4BAAA,CAGF,8DACE,iBAAA,CAGF,oEACE,UAAA,CAGF,+DACE,aAAA,CACA,oBAAA,CAGF,+DACE,mDAAA,CACA,mBAAA,CAGF,4DACE,oCAAA",sourceRoot:""}]),o.locals={label01:"-esm-patient-registration__autosuggest__label01___ZMRhI",suggestions:"-esm-patient-registration__autosuggest__suggestions___jNk6d",autocomplete:"-esm-patient-registration__autosuggest__autocomplete___CqHbh",autocompleteSearch:"-esm-patient-registration__autosuggest__autocompleteSearch___tDrC1",invalid:"-esm-patient-registration__autosuggest__invalid___ucMxb",invalidMsg:"-esm-patient-registration__autosuggest__invalidMsg___fYXV4"};const s=o},4939:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__input__title___ymmMp{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__input__submit___drScu{width:250px}.-esm-patient-registration__input__submit___drScu:hover{cursor:pointer}.-esm-patient-registration__input__cancelButton___MGlnb{width:11.688rem}.-esm-patient-registration__input__submitButton___KxHlt{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__input__infoGrid___KptwF{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__input__label01___udxOY{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___BviaC{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___MSQTm{margin:1rem 0}.-esm-patient-registration__input__formContainer___Djtuh{display:flex;width:100%}.-esm-patient-registration__input__stickyColumn___Cqo0q{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__input__touchTarget___aKvZw a:active{color:#161616}.-esm-patient-registration__input__linkName___ePbIQ{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__input__linkName___ePbIQ:active{text-decoration:none;color:#161616}.-esm-patient-registration__input__linkName___ePbIQ:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__input__main___xrszP{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__input__infoGrid___KptwF{max-width:unset}.-esm-patient-registration__input__spinner___jE55H{min-height:1rem;width:max-content}.-esm-patient-registration__input__spinner___jE55H .cds--inline-loading__text{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}html[dir=rtl] .-esm-patient-registration__input__linkName___ePbIQ>svg{transform:scale(-1, 1)}html[dir=rtl] .-esm-patient-registration__input__infoGrid___KptwF{padding-left:unset;padding-right:2rem}.-esm-patient-registration__input__fieldRow___vLP6O{display:flex;flex-direction:row;justify-content:flex-start;flex-wrap:wrap}.-esm-patient-registration__input__subFieldRow___sPk3F{margin-bottom:5px}.-esm-patient-registration__input__label___orNk0{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___Ubh9Y,.-esm-patient-registration__input__comboInput___qUhJm{margin-bottom:1rem}.-esm-patient-registration__input__requiredField___k3345{color:#da1e28}.-esm-patient-registration__input__input___Dwmo5{margin-right:5px}.-esm-patient-registration__input__checkboxField___OEvPy{display:flex;flex-direction:row;justify-content:flex-start;width:400px;margin-left:10px}.-esm-patient-registration__input__textInput___hQZXv{width:250px !important;height:40px !important}.-esm-patient-registration__input__numberInput___SAa3l{width:200px !important;height:40px !important}.-esm-patient-registration__input__checkboxInput___oso9t{height:1.5rem !important;width:1.5rem !important;margin-top:8px}.-esm-patient-registration__input__selectInput___lV71G{width:150px !important;height:40px !important}.-esm-patient-registration__input__dateInput___KyGaB{width:200px !important;height:40px !important;font-size:large !important}.-esm-patient-registration__input__telInput___DwqWm{width:250px !important;height:40px !important}.-esm-patient-registration__input__errorInput___Xyttp{border:2px solid #da1e28 !important;padding-left:.875rem !important}.-esm-patient-registration__input__errorMessage___LkLY3{color:#da1e28;align-self:center}.-esm-patient-registration__input__dummyData___lR2jV{cursor:pointer;margin-left:5px}.-esm-patient-registration__input__IDInput___NYnrx{display:grid;grid-template-columns:1fr auto;align-items:end}.-esm-patient-registration__input__trashCan___T3t2n{color:#da1e28}.omrs-breakpoint-lt-desktop .-esm-patient-registration__input__IDInput___NYnrx{max-width:unset;width:100%}.-esm-patient-registration__input__dangerLabel01___C3QkA{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}.-esm-patient-registration__input__comboInputEntries___Xg2qG{position:relative}.-esm-patient-registration__input__comboInputItemOption___Uv8Ip{margin:0;padding-left:1rem}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/patient-registration.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./src/patient-registration/input/input.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,iDACE,kCAAA,CAGF,kDACE,WAAA,CAGF,wDACE,cAAA,CAGF,wDACE,eAAA,CAGF,wDACE,kBCUW,CDTX,eAAA,CACA,aAAA,CAGF,oDACE,UAAA,CACA,iBCaW,CDZX,kBAAA,CACA,eCCW,CAAA,eAAA,CDGb,mDEg0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF9zBF,eCLW,CDMX,kBCNW,CDOX,aDnCM,CCsCR,+DEyzBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFvzBF,aDxCM,CCyCN,cAAA,CAGF,mDACE,aAAA,CAGF,yDACE,YAAA,CACA,UAAA,CAGF,wDACE,eAAA,CACA,eC3BW,CD6BX,QAAA,CAGF,gEACE,aDtDe,CCyDjB,oDACE,aD3Dc,CC4Dd,gBAAA,CACA,cCvCW,CDwCX,eAAA,CAEA,2DACE,oBAAA,CACA,aDjEa,CCoEf,0DACE,oBAAA,CACA,aDtEa,CCuEb,cAAA,CAIJ,gDACE,qBAAA,CAIA,gFACE,eAAA,CAIJ,mDACE,eAAA,CACA,iBAAA,CAEA,8EE+vBE,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CFvvBA,sEACE,sBAAA,CAIJ,kEACE,kBAAA,CACA,kBCzES,CErCb,oDACE,YAAA,CACA,kBAAA,CACA,0BAAA,CACA,cAAA,CAGF,uDACE,iBAAA,CAGF,iDDm1BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CCj1BF,aJZQ,CIeV,wGAEE,kBFSW,CENb,yDACE,aJNO,CIST,iDACE,gBAAA,CAGF,yDACE,YAAA,CACA,kBAAA,CACA,0BAAA,CACA,WAAA,CACA,gBAAA,CAGF,qDACE,sBAAA,CACA,sBAAA,CAGF,uDACE,sBAAA,CACA,sBAAA,CAGF,yDACE,wBAAA,CACA,uBAAA,CACA,cAAA,CAGF,uDACE,sBAAA,CACA,sBAAA,CAGF,qDACE,sBAAA,CACA,sBAAA,CACA,0BAAA,CAGF,oDACE,sBAAA,CACA,sBAAA,CAGF,sDACE,mCAAA,CACA,+BAAA,CAGF,wDACE,aJ3DO,CI4DP,iBAAA,CAGF,qDACE,cAAA,CACA,eAAA,CAGF,mDACE,YAAA,CACA,8BAAA,CACA,eAAA,CAGF,oDACE,aJ3EO,CI+EP,+EACE,eAAA,CACA,UAAA,CAIJ,yDDyvBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CCvvBF,aJvFO,CI0FT,6DACE,iBAAA,CAGF,gEACE,QAAA,CACA,iBAAA",sourceRoot:""}]),o.locals={title:"-esm-patient-registration__input__title___ymmMp",submit:"-esm-patient-registration__input__submit___drScu",cancelButton:"-esm-patient-registration__input__cancelButton___MGlnb",submitButton:"-esm-patient-registration__input__submitButton___KxHlt",infoGrid:"-esm-patient-registration__input__infoGrid___KptwF",label01:"-esm-patient-registration__input__label01___udxOY",productiveHeading02:"-esm-patient-registration__input__productiveHeading02___BviaC",space05:"-esm-patient-registration__input__space05___MSQTm",formContainer:"-esm-patient-registration__input__formContainer___Djtuh",stickyColumn:"-esm-patient-registration__input__stickyColumn___Cqo0q",touchTarget:"-esm-patient-registration__input__touchTarget___aKvZw",linkName:"-esm-patient-registration__input__linkName___ePbIQ",main:"-esm-patient-registration__input__main___xrszP",spinner:"-esm-patient-registration__input__spinner___jE55H",fieldRow:"-esm-patient-registration__input__fieldRow___vLP6O",subFieldRow:"-esm-patient-registration__input__subFieldRow___sPk3F",label:"-esm-patient-registration__input__label___orNk0",textID:"-esm-patient-registration__input__textID___Ubh9Y",comboInput:"-esm-patient-registration__input__comboInput___qUhJm",requiredField:"-esm-patient-registration__input__requiredField___k3345",input:"-esm-patient-registration__input__input___Dwmo5",checkboxField:"-esm-patient-registration__input__checkboxField___OEvPy",textInput:"-esm-patient-registration__input__textInput___hQZXv",numberInput:"-esm-patient-registration__input__numberInput___SAa3l",checkboxInput:"-esm-patient-registration__input__checkboxInput___oso9t",selectInput:"-esm-patient-registration__input__selectInput___lV71G",dateInput:"-esm-patient-registration__input__dateInput___KyGaB",telInput:"-esm-patient-registration__input__telInput___DwqWm",errorInput:"-esm-patient-registration__input__errorInput___Xyttp",errorMessage:"-esm-patient-registration__input__errorMessage___LkLY3",dummyData:"-esm-patient-registration__input__dummyData___lR2jV",IDInput:"-esm-patient-registration__input__IDInput___NYnrx",trashCan:"-esm-patient-registration__input__trashCan___T3t2n",dangerLabel01:"-esm-patient-registration__input__dangerLabel01___C3QkA",comboInputEntries:"-esm-patient-registration__input__comboInputEntries___Xg2qG",comboInputItemOption:"-esm-patient-registration__input__comboInputItemOption___Uv8Ip"};const s=o},1093:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__patient-registration__title___deVt0{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__patient-registration__submit___WAvMe{width:250px}.-esm-patient-registration__patient-registration__submit___WAvMe:hover{cursor:pointer}.-esm-patient-registration__patient-registration__cancelButton___d1bxd{width:11.688rem}.-esm-patient-registration__patient-registration__submitButton___FPRJM{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__patient-registration__infoGrid___GbkQI{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__patient-registration__label01___wbzrK{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___VG2Xd{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___kujPI{margin:1rem 0}.-esm-patient-registration__patient-registration__formContainer___R8NXh{display:flex;width:100%}.-esm-patient-registration__patient-registration__stickyColumn___YyTJX{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__patient-registration__touchTarget___J2DcK a:active{color:#161616}.-esm-patient-registration__patient-registration__linkName___R5ijn{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__patient-registration__linkName___R5ijn:active{text-decoration:none;color:#161616}.-esm-patient-registration__patient-registration__linkName___R5ijn:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__patient-registration__main___pAibL{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__patient-registration__infoGrid___GbkQI{max-width:unset}.-esm-patient-registration__patient-registration__spinner___wUnQX{min-height:1rem;width:max-content}.-esm-patient-registration__patient-registration__spinner___wUnQX .cds--inline-loading__text{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}html[dir=rtl] .-esm-patient-registration__patient-registration__linkName___R5ijn>svg{transform:scale(-1, 1)}html[dir=rtl] .-esm-patient-registration__patient-registration__infoGrid___GbkQI{padding-left:unset;padding-right:2rem}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/patient-registration.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,gEACE,kCAAA,CAGF,iEACE,WAAA,CAGF,uEACE,cAAA,CAGF,uEACE,eAAA,CAGF,uEACE,kBCUW,CDTX,eAAA,CACA,aAAA,CAGF,mEACE,UAAA,CACA,iBCaW,CDZX,kBAAA,CACA,eCCW,CAAA,eAAA,CDGb,kEEg0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF9zBF,eCLW,CDMX,kBCNW,CDOX,aDnCM,CCsCR,8EEyzBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFvzBF,aDxCM,CCyCN,cAAA,CAGF,kEACE,aAAA,CAGF,wEACE,YAAA,CACA,UAAA,CAGF,uEACE,eAAA,CACA,eC3BW,CD6BX,QAAA,CAGF,+EACE,aDtDe,CCyDjB,mEACE,aD3Dc,CC4Dd,gBAAA,CACA,cCvCW,CDwCX,eAAA,CAEA,0EACE,oBAAA,CACA,aDjEa,CCoEf,yEACE,oBAAA,CACA,aDtEa,CCuEb,cAAA,CAIJ,+DACE,qBAAA,CAIA,+FACE,eAAA,CAIJ,kEACE,eAAA,CACA,iBAAA,CAEA,6FE+vBE,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CFvvBA,qFACE,sBAAA,CAIJ,iFACE,kBAAA,CACA,kBCzES",sourceRoot:""}]),o.locals={title:"-esm-patient-registration__patient-registration__title___deVt0",submit:"-esm-patient-registration__patient-registration__submit___WAvMe",cancelButton:"-esm-patient-registration__patient-registration__cancelButton___d1bxd",submitButton:"-esm-patient-registration__patient-registration__submitButton___FPRJM",infoGrid:"-esm-patient-registration__patient-registration__infoGrid___GbkQI",label01:"-esm-patient-registration__patient-registration__label01___wbzrK",productiveHeading02:"-esm-patient-registration__patient-registration__productiveHeading02___VG2Xd",space05:"-esm-patient-registration__patient-registration__space05___kujPI",formContainer:"-esm-patient-registration__patient-registration__formContainer___R8NXh",stickyColumn:"-esm-patient-registration__patient-registration__stickyColumn___YyTJX",touchTarget:"-esm-patient-registration__patient-registration__touchTarget___J2DcK",linkName:"-esm-patient-registration__patient-registration__linkName___R5ijn",main:"-esm-patient-registration__patient-registration__main___pAibL",spinner:"-esm-patient-registration__patient-registration__spinner___wUnQX"};const s=o},138:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__relationships__title___VwsTO{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__relationships__submit___XKnWx{width:250px}.-esm-patient-registration__relationships__submit___XKnWx:hover{cursor:pointer}.-esm-patient-registration__relationships__cancelButton___BQuUm{width:11.688rem}.-esm-patient-registration__relationships__submitButton___Tg9V7{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__relationships__infoGrid___SAUPw{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__relationships__label01___pH0BA{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___BjxK9{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___cMUhT{margin:1rem 0}.-esm-patient-registration__relationships__formContainer___fk4C8{display:flex;width:100%}.-esm-patient-registration__relationships__stickyColumn___hS_Eh{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__relationships__touchTarget___PbOAv a:active{color:#161616}.-esm-patient-registration__relationships__linkName___QK15g{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__relationships__linkName___QK15g:active{text-decoration:none;color:#161616}.-esm-patient-registration__relationships__linkName___QK15g:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__relationships__main___kTcJj{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__relationships__infoGrid___SAUPw{max-width:unset}.-esm-patient-registration__relationships__spinner____dwdz{min-height:1rem;width:max-content}.-esm-patient-registration__relationships__spinner____dwdz .cds--inline-loading__text{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}html[dir=rtl] .-esm-patient-registration__relationships__linkName___QK15g>svg{transform:scale(-1, 1)}html[dir=rtl] .-esm-patient-registration__relationships__infoGrid___SAUPw{padding-left:unset;padding-right:2rem}.-esm-patient-registration__relationships__labelText___uj7UC{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___lfKTT{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___sm1h1{margin-bottom:1rem}.-esm-patient-registration__relationships__relationshipHeader____GJQK{display:flex;align-items:center}.-esm-patient-registration__relationships__productiveHeading___kksGB{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___RUDnn{color:#da1e28 !important}.omrs-breakpoint-lt-desktop .-esm-patient-registration__relationships__relationshipHeader____GJQK{justify-content:space-between}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/patient-registration.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./src/patient-registration/section/patient-relationships/relationships.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,yDACE,kCAAA,CAGF,0DACE,WAAA,CAGF,gEACE,cAAA,CAGF,gEACE,eAAA,CAGF,gEACE,kBCUW,CDTX,eAAA,CACA,aAAA,CAGF,4DACE,UAAA,CACA,iBCaW,CDZX,kBAAA,CACA,eCCW,CAAA,eAAA,CDGb,2DEg0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF9zBF,eCLW,CDMX,kBCNW,CDOX,aDnCM,CCsCR,uEEyzBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFvzBF,aDxCM,CCyCN,cAAA,CAGF,2DACE,aAAA,CAGF,iEACE,YAAA,CACA,UAAA,CAGF,gEACE,eAAA,CACA,eC3BW,CD6BX,QAAA,CAGF,wEACE,aDtDe,CCyDjB,4DACE,aD3Dc,CC4Dd,gBAAA,CACA,cCvCW,CDwCX,eAAA,CAEA,mEACE,oBAAA,CACA,aDjEa,CCoEf,kEACE,oBAAA,CACA,aDtEa,CCuEb,cAAA,CAIJ,wDACE,qBAAA,CAIA,wFACE,eAAA,CAIJ,2DACE,eAAA,CACA,iBAAA,CAEA,sFE+vBE,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CFvvBA,8EACE,sBAAA,CAIJ,0EACE,kBAAA,CACA,kBCzES,CErCb,6DD81BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CC11BJ,+DD01BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CCt1BJ,6DACE,kBFkBW,CEfb,sEACE,YAAA,CACA,kBAAA,CAGF,qED60BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CC30BF,aJlBQ,CIqBV,4DACE,wBAAA,CAIA,kGACE,6BAAA",sourceRoot:""}]),o.locals={title:"-esm-patient-registration__relationships__title___VwsTO",submit:"-esm-patient-registration__relationships__submit___XKnWx",cancelButton:"-esm-patient-registration__relationships__cancelButton___BQuUm",submitButton:"-esm-patient-registration__relationships__submitButton___Tg9V7",infoGrid:"-esm-patient-registration__relationships__infoGrid___SAUPw",label01:"-esm-patient-registration__relationships__label01___pH0BA",productiveHeading02:"-esm-patient-registration__relationships__productiveHeading02___BjxK9",space05:"-esm-patient-registration__relationships__space05___cMUhT",formContainer:"-esm-patient-registration__relationships__formContainer___fk4C8",stickyColumn:"-esm-patient-registration__relationships__stickyColumn___hS_Eh",touchTarget:"-esm-patient-registration__relationships__touchTarget___PbOAv",linkName:"-esm-patient-registration__relationships__linkName___QK15g",main:"-esm-patient-registration__relationships__main___kTcJj",spinner:"-esm-patient-registration__relationships__spinner____dwdz",labelText:"-esm-patient-registration__relationships__labelText___uj7UC",bodyShort02:"-esm-patient-registration__relationships__bodyShort02___lfKTT",searchBox:"-esm-patient-registration__relationships__searchBox___sm1h1",relationshipHeader:"-esm-patient-registration__relationships__relationshipHeader____GJQK",productiveHeading:"-esm-patient-registration__relationships__productiveHeading___kksGB",trashCan:"-esm-patient-registration__relationships__trashCan___RUDnn"};const s=o},2936:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__section__title___t5kfW{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__section__submit___deOxc{width:250px}.-esm-patient-registration__section__submit___deOxc:hover{cursor:pointer}.-esm-patient-registration__section__cancelButton___WL_ze{width:11.688rem}.-esm-patient-registration__section__submitButton___LIciE{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__section__infoGrid___pWQZT{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__section__label01___zyKRq{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____1hxG{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___lREpo{margin:1rem 0}.-esm-patient-registration__section__formContainer___SRjjl{display:flex;width:100%}.-esm-patient-registration__section__stickyColumn___a3FUs{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__section__touchTarget___Eb0y6 a:active{color:#161616}.-esm-patient-registration__section__linkName___u7Bhd{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__section__linkName___u7Bhd:active{text-decoration:none;color:#161616}.-esm-patient-registration__section__linkName___u7Bhd:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__section__main___yCaDW{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__section__infoGrid___pWQZT{max-width:unset}.-esm-patient-registration__section__spinner___rIo46{min-height:1rem;width:max-content}.-esm-patient-registration__section__spinner___rIo46 .cds--inline-loading__text{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}html[dir=rtl] .-esm-patient-registration__section__linkName___u7Bhd>svg{transform:scale(-1, 1)}html[dir=rtl] .-esm-patient-registration__section__infoGrid___pWQZT{padding-left:unset;padding-right:2rem}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/patient-registration.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,mDACE,kCAAA,CAGF,oDACE,WAAA,CAGF,0DACE,cAAA,CAGF,0DACE,eAAA,CAGF,0DACE,kBCUW,CDTX,eAAA,CACA,aAAA,CAGF,sDACE,UAAA,CACA,iBCaW,CDZX,kBAAA,CACA,eCCW,CAAA,eAAA,CDGb,qDEg0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF9zBF,eCLW,CDMX,kBCNW,CDOX,aDnCM,CCsCR,iEEyzBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFvzBF,aDxCM,CCyCN,cAAA,CAGF,qDACE,aAAA,CAGF,2DACE,YAAA,CACA,UAAA,CAGF,0DACE,eAAA,CACA,eC3BW,CD6BX,QAAA,CAGF,kEACE,aDtDe,CCyDjB,sDACE,aD3Dc,CC4Dd,gBAAA,CACA,cCvCW,CDwCX,eAAA,CAEA,6DACE,oBAAA,CACA,aDjEa,CCoEf,4DACE,oBAAA,CACA,aDtEa,CCuEb,cAAA,CAIJ,kDACE,qBAAA,CAIA,kFACE,eAAA,CAIJ,qDACE,eAAA,CACA,iBAAA,CAEA,gFE+vBE,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CFvvBA,wEACE,sBAAA,CAIJ,oEACE,kBAAA,CACA,kBCzES",sourceRoot:""}]),o.locals={title:"-esm-patient-registration__section__title___t5kfW",submit:"-esm-patient-registration__section__submit___deOxc",cancelButton:"-esm-patient-registration__section__cancelButton___WL_ze",submitButton:"-esm-patient-registration__section__submitButton___LIciE",infoGrid:"-esm-patient-registration__section__infoGrid___pWQZT",label01:"-esm-patient-registration__section__label01___zyKRq",productiveHeading02:"-esm-patient-registration__section__productiveHeading02____1hxG",space05:"-esm-patient-registration__section__space05___lREpo",formContainer:"-esm-patient-registration__section__formContainer___SRjjl",stickyColumn:"-esm-patient-registration__section__stickyColumn___a3FUs",touchTarget:"-esm-patient-registration__section__touchTarget___Eb0y6",linkName:"-esm-patient-registration__section__linkName___u7Bhd",main:"-esm-patient-registration__section__main___yCaDW",spinner:"-esm-patient-registration__section__spinner___rIo46"};const s=o},7857:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__overlay__title____YPY_{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__overlay__submit___zc6Wb{width:250px}.-esm-patient-registration__overlay__submit___zc6Wb:hover{cursor:pointer}.-esm-patient-registration__overlay__cancelButton___h860H{width:11.688rem}.-esm-patient-registration__overlay__submitButton___xvgAH{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__overlay__infoGrid___LpFZH{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__overlay__label01___YrbZe{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___sQ1wt{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___qxgdq{margin:1rem 0}.-esm-patient-registration__overlay__formContainer___mqmN0{display:flex;width:100%}.-esm-patient-registration__overlay__stickyColumn___BR29p{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__overlay__touchTarget___tGlGl a:active{color:#161616}.-esm-patient-registration__overlay__linkName___NTGfr{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__overlay__linkName___NTGfr:active{text-decoration:none;color:#161616}.-esm-patient-registration__overlay__linkName___NTGfr:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__overlay__main___MOTWA{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__overlay__infoGrid___LpFZH{max-width:unset}.-esm-patient-registration__overlay__spinner___knUsd{min-height:1rem;width:max-content}.-esm-patient-registration__overlay__spinner___knUsd .cds--inline-loading__text{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}html[dir=rtl] .-esm-patient-registration__overlay__linkName___NTGfr>svg{transform:scale(-1, 1)}html[dir=rtl] .-esm-patient-registration__overlay__infoGrid___LpFZH{padding-left:unset;padding-right:2rem}.-esm-patient-registration__overlay__desktopOverlay___d3zF6{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___JSgzT{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___HKDSr button{background-color:#005d5d !important}.-esm-patient-registration__overlay__tabletOverlayHeader___HKDSr .-esm-patient-registration__overlay__headerContent___E79in{color:#fff}.-esm-patient-registration__overlay__desktopHeader___D56AB{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8}.-esm-patient-registration__overlay__headerContent___E79in{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___jwVf9{background-color:#fff}.-esm-patient-registration__overlay__overlayContent___FVBjG{padding:1rem;overflow-y:auto}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/patient-registration.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./src/patient-registration/ui-components/overlay/overlay.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,mDACE,kCAAA,CAGF,oDACE,WAAA,CAGF,0DACE,cAAA,CAGF,0DACE,eAAA,CAGF,0DACE,kBCUW,CDTX,eAAA,CACA,aAAA,CAGF,sDACE,UAAA,CACA,iBCaW,CDZX,kBAAA,CACA,eCCW,CAAA,eAAA,CDGb,qDEg0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF9zBF,eCLW,CDMX,kBCNW,CDOX,aDnCM,CCsCR,iEEyzBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFvzBF,aDxCM,CCyCN,cAAA,CAGF,qDACE,aAAA,CAGF,2DACE,YAAA,CACA,UAAA,CAGF,0DACE,eAAA,CACA,eC3BW,CD6BX,QAAA,CAGF,kEACE,aDtDe,CCyDjB,sDACE,aD3Dc,CC4Dd,gBAAA,CACA,cCvCW,CDwCX,eAAA,CAEA,6DACE,oBAAA,CACA,aDjEa,CCoEf,4DACE,oBAAA,CACA,aDtEa,CCuEb,cAAA,CAIJ,kDACE,qBAAA,CAIA,kFACE,eAAA,CAIJ,qDACE,eAAA,CACA,iBAAA,CAEA,gFE+vBE,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CFvvBA,wEACE,sBAAA,CAIJ,oEACE,kBAAA,CACA,kBCzES,CErCb,4DACE,cAAA,CACA,QF6CW,CE5CX,OAAA,CACA,yBAAA,CACA,eAAA,CACA,qBJTM,CIUN,6BAAA,CACA,eAAA,CACA,YAAA,CACA,gCAAA,CACA,WAAA,CAGF,2DACE,cAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,qBJxBM,CIyBN,eAAA,CACA,gBFwBW,CEvBX,YAAA,CACA,2BAAA,CAIA,wEACE,mCAAA,CAEF,4HACE,UJpCI,CIwCR,2DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBJ3CM,CI4CN,+BAAA,CAGF,2DDizBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CC/yBF,cAAA,CACA,aJhDM,CImDR,yDACE,qBJvDM,CI0DR,4DACE,YF7BW,CE8BX,eAAA",sourceRoot:""}]),o.locals={title:"-esm-patient-registration__overlay__title____YPY_",submit:"-esm-patient-registration__overlay__submit___zc6Wb",cancelButton:"-esm-patient-registration__overlay__cancelButton___h860H",submitButton:"-esm-patient-registration__overlay__submitButton___xvgAH",infoGrid:"-esm-patient-registration__overlay__infoGrid___LpFZH",label01:"-esm-patient-registration__overlay__label01___YrbZe",productiveHeading02:"-esm-patient-registration__overlay__productiveHeading02___sQ1wt",space05:"-esm-patient-registration__overlay__space05___qxgdq",formContainer:"-esm-patient-registration__overlay__formContainer___mqmN0",stickyColumn:"-esm-patient-registration__overlay__stickyColumn___BR29p",touchTarget:"-esm-patient-registration__overlay__touchTarget___tGlGl",linkName:"-esm-patient-registration__overlay__linkName___NTGfr",main:"-esm-patient-registration__overlay__main___MOTWA",spinner:"-esm-patient-registration__overlay__spinner___knUsd",desktopOverlay:"-esm-patient-registration__overlay__desktopOverlay___d3zF6",tabletOverlay:"-esm-patient-registration__overlay__tabletOverlay___JSgzT",tabletOverlayHeader:"-esm-patient-registration__overlay__tabletOverlayHeader___HKDSr",headerContent:"-esm-patient-registration__overlay__headerContent___E79in",desktopHeader:"-esm-patient-registration__overlay__desktopHeader___D56AB",closeButton:"-esm-patient-registration__overlay__closeButton___jwVf9",overlayContent:"-esm-patient-registration__overlay__overlayContent___FVBjG"};const s=o},4113:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-patient-registration__patient-verification__title___FpuaQ{color:var(--omrs-color-brand-teal)}.-esm-patient-registration__patient-verification__submit___SLswF{width:250px}.-esm-patient-registration__patient-verification__submit___SLswF:hover{cursor:pointer}.-esm-patient-registration__patient-verification__cancelButton___RXj9P{width:11.688rem}.-esm-patient-registration__patient-verification__submitButton___Oy620{margin-bottom:1rem;width:11.688rem;display:block}.-esm-patient-registration__patient-verification__infoGrid___nnX3H{width:100%;padding-left:2rem;margin-bottom:40vh;margin-top:1rem;max-width:50rem}.-esm-patient-registration__patient-verification__label01___egrNc{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-verification__productiveHeading02___Vktw7{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-verification__space05___JNnZ3{margin:1rem 0}.-esm-patient-registration__patient-verification__formContainer___rhAxH{display:flex;width:100%}.-esm-patient-registration__patient-verification__stickyColumn___uau9B{position:sticky;margin-top:1rem;top:4rem}.-esm-patient-registration__patient-verification__touchTarget___VKIUW a:active{color:#161616}.-esm-patient-registration__patient-verification__linkName___TOGpb{color:#525252;line-height:1.38;font-size:1rem;font-weight:600}.-esm-patient-registration__patient-verification__linkName___TOGpb:active{text-decoration:none;color:#161616}.-esm-patient-registration__patient-verification__linkName___TOGpb:hover{text-decoration:none;color:#161616;cursor:pointer}.-esm-patient-registration__patient-verification__main___ajuiO{background-color:#fff}.omrs-breakpoint-lt-desktop .-esm-patient-registration__patient-verification__infoGrid___nnX3H{max-width:unset}.-esm-patient-registration__patient-verification__spinner___c93Ta{min-height:1rem;width:max-content}.-esm-patient-registration__patient-verification__spinner___c93Ta .cds--inline-loading__text{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}html[dir=rtl] .-esm-patient-registration__patient-verification__linkName___TOGpb>svg{transform:scale(-1, 1)}html[dir=rtl] .-esm-patient-registration__patient-verification__infoGrid___nnX3H{padding-left:unset;padding-right:2rem}.omrs-breakpoint-gt-tablet .-esm-patient-registration__patient-verification__verificationWrapper___s93qh{display:grid;grid-template-columns:1fr 1fr 1fr 1fr;column-gap:.325rem;align-items:flex-end}.omrs-breakpoint-lt-desktop .-esm-patient-registration__patient-verification__verificationWrapper___s93qh{row-gap:.5rem;display:flex;flex-direction:column}.-esm-patient-registration__patient-verification__errorWrapper___ufQm1{margin:0 0 1rem 0}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/patient-registration/patient-registration.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./src/patient-verification/patient-verification.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,yEAAA,CACA,2GAAA,CCvDF,gEACE,kCAAA,CAGF,iEACE,WAAA,CAGF,uEACE,cAAA,CAGF,uEACE,eAAA,CAGF,uEACE,kBCUW,CDTX,eAAA,CACA,aAAA,CAGF,mEACE,UAAA,CACA,iBCaW,CDZX,kBAAA,CACA,eCCW,CAAA,eAAA,CDGb,kEEg0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF9zBF,eCLW,CDMX,kBCNW,CDOX,aDnCM,CCsCR,8EEyzBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFvzBF,aDxCM,CCyCN,cAAA,CAGF,kEACE,aAAA,CAGF,wEACE,YAAA,CACA,UAAA,CAGF,uEACE,eAAA,CACA,eC3BW,CD6BX,QAAA,CAGF,+EACE,aDtDe,CCyDjB,mEACE,aD3Dc,CC4Dd,gBAAA,CACA,cCvCW,CDwCX,eAAA,CAEA,0EACE,oBAAA,CACA,aDjEa,CCoEf,yEACE,oBAAA,CACA,aDtEa,CCuEb,cAAA,CAIJ,+DACE,qBAAA,CAIA,+FACE,eAAA,CAIJ,kEACE,eAAA,CACA,iBAAA,CAEA,6FE+vBE,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CFvvBA,qFACE,sBAAA,CAIJ,iFACE,kBAAA,CACA,kBCzES,CEpCX,yGACE,YAAA,CACA,qCAAA,CACA,kBAAA,CACA,oBAAA,CAMF,0GACE,aAAA,CACA,YAAA,CACA,qBAAA,CAIJ,uEACE,iBAAA",sourceRoot:""}]),o.locals={title:"-esm-patient-registration__patient-verification__title___FpuaQ",submit:"-esm-patient-registration__patient-verification__submit___SLswF",cancelButton:"-esm-patient-registration__patient-verification__cancelButton___RXj9P",submitButton:"-esm-patient-registration__patient-verification__submitButton___Oy620",infoGrid:"-esm-patient-registration__patient-verification__infoGrid___nnX3H",label01:"-esm-patient-registration__patient-verification__label01___egrNc",productiveHeading02:"-esm-patient-registration__patient-verification__productiveHeading02___Vktw7",space05:"-esm-patient-registration__patient-verification__space05___JNnZ3",formContainer:"-esm-patient-registration__patient-verification__formContainer___rhAxH",stickyColumn:"-esm-patient-registration__patient-verification__stickyColumn___uau9B",touchTarget:"-esm-patient-registration__patient-verification__touchTarget___VKIUW",linkName:"-esm-patient-registration__patient-verification__linkName___TOGpb",main:"-esm-patient-registration__patient-verification__main___ajuiO",spinner:"-esm-patient-registration__patient-verification__spinner___c93Ta",verificationWrapper:"-esm-patient-registration__patient-verification__verificationWrapper___s93qh",errorWrapper:"-esm-patient-registration__patient-verification__errorWrapper___ufQm1"};const s=o},4954:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(272),i=n.n(r),a=n(2609),o=n.n(a)()(i());o.push([e.id,".-esm-patient-registration__root__root___ZqEMk{background-color:#fff}.-esm-patient-registration__root__grid___Bq7KW{grid-template-columns:repeat(1, minmax(0, 1fr))}","",{version:3,sources:["webpack://./src/root.scss"],names:[],mappings:"AAAA,+CACE,qBAAA,CAGF,+CACE,+CAAA",sourceRoot:""}]),o.locals={root:"-esm-patient-registration__root__root___ZqEMk",grid:"-esm-patient-registration__root__grid___Bq7KW"};const s=o},8548:(e,t,n)=>{"use strict";n.r(t),n.d(t,{addPatientLink:()=>ta,cancelPatientEditModal:()=>na,confirmClientRegistryModal:()=>oa,deleteIdentifierConfirmationModal:()=>aa,editPatient:()=>ea,editPatientDetailsButton:()=>ia,emptyClientRegistryModal:()=>sa,importTranslation:()=>Xi,patientPhotoExtension:()=>ra,root:()=>$i,startupApp:()=>Qi});var r=n(2870);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var o=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone"]},{id:"death",name:"Death Info",fields:[]},{id:"relationships",name:"Relationships",fields:[]}],s=["name","gender","dob","id","address","phone"],l={sections:{_type:r.Type.Array,_default:["demographics","contact","relationships"],_description:"An array of strings which are the keys from 'sectionDefinitions' or any of the following built-in sections: '".concat(o.map((function(e){return e.id})).join("', '"),"'."),_elements:{_type:r.Type.String}},sectionDefinitions:{_type:r.Type.Array,_elements:{id:{_type:r.Type.String,_description:"How this section will be referred to in the `sections` configuration. To override a built-in section, use that section's id. The built in section ids are '".concat(o.map((function(e){return e.id})).join("', '"),"'.")},name:{_type:r.Type.String,_description:"The title to display at the top of the section."},fields:{_type:r.Type.Array,_default:[],_description:"The parts to include in the section. Can be any of the following built-in fields: ".concat(s.join(", "),". Can also be an id from an object in the `fieldDefinitions` array, which you can use to define custom fields."),_elements:{_type:r.Type.String}}},_default:[]},fieldDefinitions:{_type:r.Type.Array,_elements:{id:{_type:r.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:r.Type.String,_description:"How this field's data will be stored—a person attribute or an obs.",_validators:[r.validators.oneOf(["person attribute","obs"])]},uuid:{_type:r.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},showHeading:{_type:r.Type.Boolean,_description:"Whether to show a heading above the person attribute field.",_default:!1},label:{_type:r.Type.String,_default:null,_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:r.Type.String,_default:"",_description:"Placeholder that will appear in the input."},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:r.Type.ConceptUuid,_default:null,_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:r.Type.Array,_elements:{uuid:{_type:r.Type.UUID,_description:"Answer concept UUID"},label:{_type:r.Type.String,_default:null,_description:"The custom label for the answer concept."}},_default:[],_description:"For coded questions only (obs or person attrbute). A list of custom concept answers. Overrides answers that come from the obs concept or from `answerSetConceptUuid`."}},_default:[],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields."},fieldConfigurations:{name:{displayMiddleName:{_type:r.Type.Boolean,_default:!0},allowUnidentifiedPatients:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow registering unidentified patients."},defaultUnknownGivenName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."},displayCapturePhoto:{_type:r.Type.Boolean,_default:!0,_description:"Whether to display capture patient photo slot on name field"},displayReverseFieldOrder:{_type:r.Type.Boolean,_default:!1,_description:"Whether to display the name fields in the order 'Family name' -> 'Middle name' -> 'First name'"}},gender:{_type:r.Type.Array,_elements:{value:{_type:r.Type.String,_description:"Value that will be sent to the server. Limited to FHIR-supported values for Administrative Gender",_validators:[r.validators.oneOf(["male","female","other","unknown"])]},label:{_type:r.Type.String,_default:null,_description:'The label displayed for the sex option, if it should be different from the value (the value will be translated; the English "translation" is upper-case).'}},_default:[{value:"male"},{value:"female"},{value:"other"},{value:"unknown"}],_description:"The options for sex selection during patient registration. This is Administrative Gender as it is called by FHIR (Possible options are limited to those defined in FHIR Administrative Gender, see https://hl7.org/fhir/R4/valueset-administrative-gender.html)."},address:{useAddressHierarchy:{enabled:{_type:r.Type.Boolean,_description:"Whether to use the Address hierarchy in the registration form or not",_default:!0},useQuickSearch:{_type:r.Type.Boolean,_description:"Whether to use the quick searching through the address saved in the database pre-fill the form.",_default:!0},searchAddressByLevel:{_type:r.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:!1},useAddressHierarchyLabel:{_type:r.Type.Object,_description:"Whether to use custom labels for address hierarchy",_default:{}}}},dateOfBirth:{allowEstimatedDateOfBirth:{_type:r.Type.Boolean,_description:"Whether to allow estimated date of birth for a patient during registration",_default:!0},useEstimatedDateOfBirth:{enabled:{_type:r.Type.Boolean,_description:"Whether to use a fixed day and month for estimated date of birth",_default:!1},dayOfMonth:{_type:r.Type.Number,_description:"The custom day of the month use on the estimated date of birth",_default:0},month:{_type:r.Type.Number,_description:"The custom month to use on the estimated date of birth i.e 0 = Jan & 11 = Dec",_default:0}}},phone:{personAttributeUuid:{_type:r.Type.UUID,_default:"14d4f066-15f5-102d-96e4-000c29c2a5d7",_description:"The UUID of the phone number person attribute type"},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}}}},links:{submitButton:{_type:r.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]}},defaultPatientIdentifierTypes:{_type:r.Type.Array,_elements:{_type:r.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:r.Type.UUID,_default:null,_description:"Obs created during registration will be associated with an encounter of this type. This must be set in order to use fields of type `obs`."},encounterProviderRoleUuid:{_type:r.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:r.Type.UUID,_default:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_validators:[(0,r.validator)((function(e){return!e.fieldDefinitions.some((function(e){return"obs"==e.type}))||null!=e.registrationObs.encounterTypeUuid}),"If fieldDefinitions contains any fields of type 'obs', `registrationObs.encounterTypeUuid` must be specified."),(0,r.validator)((function(e){return e.sections.every((function(t){return a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})).includes(t)}))}),(function(e){var t=a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})),n=e.sections.find((function(e){return!t.includes(e)}));return"'".concat(n,"' is not a valid section ID. Valid section IDs include the built-in sections ").concat(c(o))+(e.sectionDefinitions.length?"; and the defined sections ".concat(c(e.sectionDefinitions),"."):".")})),(0,r.validator)((function(e){return e.sectionDefinitions.every((function(t){return t.fields.every((function(t){return a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))).includes(t)}))}))}),(function(e){var t=a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))),n=e.sectionDefinitions.find((function(e){return e.fields.some((function(e){return!t.includes(e)}))})),r=n.fields.find((function(e){return!t.includes(e)}));return"The section definition '".concat(n.id,"' contains an invalid field '").concat(r,"'. 'fields' can only contain the built-in fields '").concat(s.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(c(e.fieldDefinitions),"."):".")}))]};function c(e){return"'".concat(e.map((function(e){return e.id})).join("', '"),"'")}var u,d,A,p="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",m="@kenyaemr/esm-patient-registration-app",f="patient-registration",_=(u={},A="network-first",(d=r.omrsOfflineCachingStrategyHttpHeaderName)in u?Object.defineProperty(u,d,{value:A,enumerable:!0,configurable:!0,writable:!0}):u[d]=A,u),g=n(268),h=n.n(g),b=n(286),v=n(2777),y=n(8407);function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){w(a,r,i,o,s,"next",e)}function s(e){w(a,r,i,o,s,"throw",e)}o(void 0)}))}}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(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: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,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,s])}}}var O=h().createContext(null);function S(){return B.apply(this,arguments)}function B(){return(B=E((function(){return k(this,(function(e){switch(e.label){case 0:return[4,V("".concat(r.restBaseUrl,"/session"))];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function T(){return j.apply(this,arguments)}function j(){return(j=E((function(){return k(this,(function(e){switch(e.label){case 0:return[4,V("".concat(r.restBaseUrl,"/addresstemplate"))];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function P(){return F.apply(this,arguments)}function F(){return(F=E((function(){return k(this,(function(e){switch(e.label){case 0:return[4,V("".concat(r.restBaseUrl,"/relationshiptype?v=default"))];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function x(){return I.apply(this,arguments)}function I(){return I=E((function(){var e,t;return k(this,(function(n){switch(n.label){case 0:return[4,(0,r.getConfig)(m)];case 1:return(e=n.sent()).fieldDefinitions?(t=e.fieldDefinitions.map((function(e){return function(e){return N.apply(this,arguments)}(e)})),[4,Promise.all(t)]):[2];case 2:return[2,n.sent().reduce((function(e,t){return t&&e.push(t),e}),[])]}}))})),I.apply(this,arguments)}function N(){return(N=E((function(e){var t;return k(this,(function(n){switch(n.label){case 0:return t="","person attribute"===e.type&&(t="".concat(r.restBaseUrl,"/personattributetype/").concat(e.uuid)),e.answerConceptSetUuid?[4,V("".concat(r.restBaseUrl,"/concept/").concat(e.answerConceptSetUuid))]:[3,2];case 1:n.sent(),n.label=2;case 2:return[4,V(t)];case 3:return[2,n.sent().data]}}))}))).apply(this,arguments)}function U(){return G.apply(this,arguments)}function G(){return(G=E((function(){var e,t,n,r,i,a,o,s;return k(this,(function(l){switch(l.label){case 0:return[4,L()];case 1:return t=l.sent(),n=t.filter(Boolean),[4,Promise.all([z(),R()])];case 2:for(r=D.apply(void 0,[l.sent(),2]),i=r[0],a=r[1],o=a.data.results,s=0;s<(null===(e=n)||void 0===e?void 0:e.length);s++)n[s].identifierSources=o.map((function(e){var t=(0,b.Z)(i.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e}));return[2,n]}}))}))).apply(this,arguments)}function L(){return M.apply(this,arguments)}function M(){return(M=E((function(){var e,t,n,i,a,o,s,l,c,u,d,A;return k(this,(function(p){switch(p.label){case 0:return[4,Promise.all([V("".concat(r.restBaseUrl,"/patientidentifiertype?v=custom:(display,uuid,name,format,required,uniquenessBehavior)")),V("".concat(r.restBaseUrl,"/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType"))])];case 1:return e=D.apply(void 0,[p.sent(),2]),t=e[0],n=e[1],t.ok?(u=null===(a=t)||void 0===a||null===(i=a.data)||void 0===i?void 0:i.results,d=null===(c=n)||void 0===c||null===(l=c.data)||void 0===l||null===(s=l.results)||void 0===s||null===(o=s[0])||void 0===o?void 0:o.metadataUuid,A=[],u.forEach((function(e){var t;e.uuid!==d&&A.push((!1,{name:(t=e).display,fieldName:(0,v.Z)(t.name),required:t.required,uuid:t.uuid,format:t.format,isPrimary:false,uniquenessBehavior:t.uniquenessBehavior}))})),[2,A]):[2,[]]}}))}))).apply(this,arguments)}function R(){return q.apply(this,arguments)}function q(){return(q=E((function(){return k(this,(function(e){switch(e.label){case 0:return[4,V("".concat(r.restBaseUrl,"/idgen/identifiersource?v=default"))];case 1:return[2,e.sent()]}}))}))).apply(this,arguments)}function z(e){return W.apply(this,arguments)}function W(){return(W=E((function(e){return k(this,(function(e){switch(e.label){case 0:return[4,V("".concat(r.restBaseUrl,"/idgen/autogenerationoption?v=full"))];case 1:return[2,e.sent()]}}))}))).apply(this,arguments)}function V(e){return Z.apply(this,arguments)}function Z(){return(Z=E((function(e){var t,n;return k(this,(function(i){switch(i.label){case 0:return n=new AbortController,[4,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,y.Z)(e)})];case 1:return i.sent(),[4,(0,r.openmrsFetch)(e,{headers:_,signal:null===(t=n)||void 0===t?void 0:t.signal})];case 2:return[2,i.sent()]}}))}))).apply(this,arguments)}function H(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 Y(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).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){Y(a,r,i,o,s,"next",e)}function s(e){Y(a,r,i,o,s,"throw",e)}o(void 0)}))}}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||J(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(e,t){if(e){if("string"==typeof e)return H(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)?H(e,t):void 0}}function Q(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: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,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,s])}}}function $(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(t||""),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:n.signal})}function ee(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person/").concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function te(e,t,n,r,i){return ne.apply(this,arguments)}function ne(){return(ne=K((function(e,t,n,i,a){var o,s;return Q(this,(function(l){return o=new AbortController,(s=new FormData).append("patient",e),s.append("file",function(e){for(var t=window.atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);var a=new Blob([r],{type:n});return new File([a],"patient-photo.png")}(t)),s.append("json",JSON.stringify({person:e,concept:a,groupMembers:[],obsDatetime:i})),[2,(0,r.openmrsFetch)(n,{method:"POST",signal:o.signal,body:s})]}))}))).apply(this,arguments)}function re(e,t){return ie.apply(this,arguments)}function ie(){return(ie=K((function(e,t){var n,i,a,o;return Q(this,(function(s){switch(s.label){case 0:return[4,Promise.all([(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient?q=").concat(e),{signal:t.signal}),(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person?q=").concat(e),{signal:t.signal})])];case 1:return n=X.apply(void 0,[s.sent(),2]),i=n[0],a=n[1],l=i.data.results,o=function(e){if(Array.isArray(e))return H(e)}(l)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||J(l)||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.data.results.forEach((function(e){o.some((function(t){return t.uuid===e.uuid}))||o.push(e)})),[2,o]}var l}))}))).apply(this,arguments)}function ae(e,t){return oe.apply(this,arguments)}function oe(){return(oe=K((function(e,t){var n;return Q(this,(function(i){return n=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:t})]}))}))).apply(this,arguments)}function se(e,t,n){return le.apply(this,arguments)}function le(){return(le=K((function(e,t,n){var i;return Q(this,(function(a){return i=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:{identifier:n}})]}))}))).apply(this,arguments)}function ce(e,t){return ue.apply(this,arguments)}function ue(){return(ue=K((function(e,t){var n;return Q(this,(function(i){return n=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier/").concat(t,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:n.signal})]}))}))).apply(this,arguments)}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 Ae(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function pe(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Ae(a,r,i,o,s,"next",e)}function s(e){Ae(a,r,i,o,s,"throw",e)}o(void 0)}))}}function me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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){_e(e,t,n[t])}))}return e}function he(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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.")}()}function be(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: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,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,s])}}}var ve,ye=function(){function e(){me(this,e)}var t,n;return t=e,n=[{key:"saveRelationships",value:function(e,t){return pe((function(){return be(this,(function(n){return[2,Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var n,i,a=e.relatedPersonUuid,o=e.relationshipType,s=e.uuid,l=e.action,c=he(o.split("/"),2),u=c[0],d=c[1],A=t.data.uuid,p="aIsToB"===d,m={personA:p?a:A,personB:p?A:a,relationshipType:u};switch(l){case"ADD":return n=m,i=new AbortController,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship"),{headers:{"Content-Type":"application/json"},method:"POST",body:n,signal:i.signal});case"UPDATE":return function(e,t){var n=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship/").concat(e),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:t.relationshipType},signal:n.signal})}(s,m);case"DELETE":return function(e){var t=new AbortController;return(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/relationship/").concat(e),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:t.signal})}(s)}})))]}))}))()}},{key:"saveObservations",value:function(e,t,n,i,a){return pe((function(){return be(this,(function(o){if(e&&Object.keys(e).length>0){if(a.registrationObs.encounterTypeUuid)return[2,(s={patient:t.data.uuid,encounterType:a.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:i.currentProvider.uuid,encounterRole:a.registrationObs.encounterProviderRoleUuid}],form:a.registrationObs.registrationFormUuid,obs:Object.entries(e).filter((function(e){return""!==he(e,2)[1]})).map((function(e){var t=he(e,2);return{concept:t[0],value:t[1]}}))},l=new AbortController,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/encounter"),{headers:{"Content-Type":"application/json"},method:"POST",body:s,signal:l.signal}))];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.")}var s,l;return[2]}))}))()}},{key:"savePatientIdentifiers",value:function(e,t,n,i,a){return pe((function(){var o;return be(this,(function(s){var l;return o=Object.values(n).filter((function(e){var t=e.identifierValue,n=e.autoGeneration,r=e.selectedSource;return t||n&&r})).map((l=pe((function(n){var i,o,s,l,c,u,d,A,p,m;return be(this,(function(f){switch(f.label){case 0:return i=n.identifierTypeUuid,o=n.identifierValue,s=n.identifierUuid,l=n.selectedSource,c=n.preferred,u=n.autoGeneration,d=n.initialValue,u?[3,1]:(p=o,[3,4]);case 1:return[4,(_=l.uuid,g=new AbortController,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/idgen/identifiersource/").concat(_,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:g.signal}))];case 2:return[4,f.sent().data.identifier];case 3:p=f.sent(),f.label=4;case 4:return m={uuid:s,identifier:A=p,identifierType:i,location:a,preferred:c},e?[3,8]:d?[3,6]:[4,ae(t,m)];case 5:return f.sent(),[3,8];case 6:return d===A?[3,8]:[4,se(t,s,m.identifier)];case 7:f.sent(),f.label=8;case 8:return[2,m]}var _,g}))})),function(e){return l.apply(this,arguments)})),t&&Object.keys(i).filter((function(e){return!n[e]})).forEach(function(){var e=pe((function(e){return be(this,(function(n){switch(n.label){case 0:return[4,ce(t,i[e].identifierUuid)];case 1:return n.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[2,Promise.all(o)]}))}))()}},{key:"getDeletedNames",value:function(e,t){var n;return(null===(n=t)||void 0===n?void 0:n.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]}},{key:"getPatientToCreate",value:function(t,n,r,i,a){var o,s,l;return s=n.birthdate,o=(null!=(l=Date)&&"undefined"!=typeof Symbol&&l[Symbol.hasInstance]?l[Symbol.hasInstance](s):s instanceof l)?[n.birthdate.getFullYear(),n.birthdate.getMonth()+1,n.birthdate.getDate()].join("-"):n.birthdate,{uuid:n.patientUuid,person:ge({uuid:n.patientUuid,names:e.getNames(n,r),gender:n.gender.charAt(0).toUpperCase(),birthdate:o,birthdateEstimated:n.birthdateEstimated,attributes:e.getPatientAttributes(t,n,r),addresses:[n.address]},e.getPatientDeathInfo(n)),identifiers:a}}},{key:"getNames",value:function(e,t){var n=[{uuid:t.preferredNameUuid,preferred:!0,givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}];return e.addNameInLocalLanguage&&n.push({uuid:t.additionalNameUuid,preferred:!1,givenName:e.additionalGivenName,middleName:e.additionalMiddleName,familyName:e.additionalFamilyName}),n}},{key:"getPatientAttributes",value:function(e,t,n){var i,a=[];return t.attributes&&(Object.entries(t.attributes).filter((function(e){return!!he(e,2)[1]})).forEach((function(e){var t=he(e,2),n=t[0],r=t[1];a.push({attributeType:n,value:r})})),!e&&t.patientUuid&&Object.entries(t.attributes).filter((function(e){return!he(e,2)[1]})).forEach((i=pe((function(e){var i,a,o;return be(this,(function(s){switch(s.label){case 0:return i=he(e,1),a=i[0],o=n["attribute.".concat(a)],[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/person/").concat(t.patientUuid,"/attribute/").concat(o),{method:"DELETE"}).catch((function(e){console.error(e)}))];case 1:return s.sent(),[2]}}))})),function(e){return i.apply(this,arguments)}))),a}},{key:"getPatientDeathInfo",value:function(e){var t=e.isDead,n=e.deathDate,r=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?r:void 0}}},{key:"mapPatientToFhirPatient",value:function(e){var t,n,r,i,a,o;return{id:e.uuid,gender:null===(t=e.person)||void 0===t?void 0:t.gender,birthDate:null===(n=e.person)||void 0===n?void 0:n.birthdate,deceasedBoolean:e.person.dead,deceasedDateTime:e.person.deathDate,name:null===(i=e.person)||void 0===i||null===(r=i.names)||void 0===r?void 0:r.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(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}))}}}],null&&fe(t.prototype,null),n&&fe(t,n),e}();_e(ye,"savePatientFormOffline",(ve=pe((function(e,t,n,i,a,o,s,l,c){var u;return be(this,(function(d){switch(d.label){case 0:return u={fhirPatient:ye.mapPatientToFhirPatient(ye.getPatientToCreate(e,t,n,i,[])),_patientRegistrationData:{isNewPatient:e,formValues:t,patientUuidMap:n,initialAddressFieldValues:i,capturePhotoProps:a,currentLocation:o,initialIdentifierValues:s,currentUser:l,config:c,savePatientTransactionManager:new Ce}},[4,(0,r.queueSynchronizationItem)(f,u,{id:t.patientUuid,displayName:"Patient registration",patientUuid:u.fhirPatient.id,dependencies:[]})];case 1:return d.sent(),[2,null]}}))})),function(e,t,n,r,i,a,o,s,l){return ve.apply(this,arguments)})),_e(ye,"savePatientFormOnline",function(){var e=pe((function(e,t,n,i,a,o,s,l,c,u,d){var A,p,m,f,_;return be(this,(function(d){switch(d.label){case 0:return[4,ye.savePatientIdentifiers(e,t.patientUuid,t.identifiers,s,o)];case 1:return A=d.sent(),p=ye.getPatientToCreate(e,t,n,i,A),ye.getDeletedNames(t.patientUuid,n).forEach(function(){var e=pe((function(e){return be(this,(function(t){switch(t.label){case 0:return[4,ee(e.nameUuid,e.personUuid)];case 1:return t.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[4,$(p,e&&!u.patientSaved?void 0:t.patientUuid)];case 2:return(m=d.sent()).ok?(u.patientSaved=!0,[4,ye.saveRelationships(t.relationships,m)]):[3,7];case 3:return d.sent(),[4,ye.saveObservations(t.obs,m,o,l,c)];case 4:return d.sent(),[4,(0,r.getConfig)("@openmrs/esm-styleguide")];case 5:return(_=d.sent().patientPhotoConceptUuid)&&(null===(f=a)||void 0===f?void 0:f.imageData)?[4,te(m.data.uuid,a.imageData,"".concat(r.restBaseUrl,"/obs"),a.dateTime||(new Date).toISOString(),_)]:[3,7];case 6:d.sent(),d.label=7;case 7:return[2,m.data.uuid]}}))}));return function(t,n,r,i,a,o,s,l,c,u,d){return e.apply(this,arguments)}}());var Ce=function e(){me(this,e),_e(this,"patientSaved",!1)};function we(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Ee(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){we(a,r,i,o,s,"next",e)}function s(e){we(a,r,i,o,s,"throw",e)}o(void 0)}))}}function De(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: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,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,s])}}}function ke(e){return["".concat(r.fhirBaseUrl,"/Patient/").concat(e),"".concat(r.restBaseUrl,"/relationship?v=").concat(p,"&person=").concat(e),"".concat(r.restBaseUrl,"/person/").concat(e,"/attribute"),"".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map((function(e){return window.origin+(0,r.makeUrl)(e)}))}function Oe(){return(Oe=Ee((function(){return De(this,(function(e){switch(e.label){case 0:return[4,Promise.all([S(),T(),P(),x(),U()])];case 1:return e.sent(),[2]}}))}))).apply(this,arguments)}function Se(e,t){return Be.apply(this,arguments)}function Be(){return Be=Ee((function(e,t){return De(this,(function(n){switch(n.label){case 0:return[4,ye.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]}}))})),Be.apply(this,arguments)}var Te=n(2524),je=n.n(Te),Pe=n(9198),Fe=n.n(Pe),xe=n(8744),Ie=n(5950),Ne=n(8614),Ue=n(6039),Ge=n(4924),Le=n(898),Me=n(2113),Re=n(4519),qe=n.n(Re),ze=(0,g.createContext)(void 0),We=n(6804),Ve=n(6062),Ze=n.n(Ve),He=n(4036),Ye=n.n(He),Ke=n(6793),Xe=n.n(Ke),Je=n(7892),Qe=n.n(Je),$e=n(1173),et=n.n($e),tt=n(2464),nt=n.n(tt),rt=n(4939),it={};it.styleTagTransform=nt(),it.setAttributes=Qe(),it.insert=Xe().bind(null,"head"),it.domAPI=Ye(),it.insertStyleElement=et(),Ze()(rt.Z,it);const at=rt.Z&&rt.Z.locals?rt.Z.locals:void 0;var ot={patientUuid:(0,We.Z)(),givenName:"John",middleName:"",familyName:"Smith",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:{}},st=function(e){var t=e.setValues;return h().createElement("main",null,h().createElement("button",{className:je()("omrs-btn omrs-filled-neutral",at.dummyData),onClick:function(){return t(ot)},type:"button","aria-label":"Dummy Data Input"},"Input Dummy Data"))};function lt(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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ut(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){ct(e,t,n[t])}))}return e}function dt(){window.history.back()}function At(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 s,l=Object.keys(r)[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var c=s.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==l.return||l.return()}finally{if(a)throw o}}}return n}var pt=n(2228),mt=n(3255);const ft=JSON.parse('[{"name":"Mombasa","code":1,"capital":"Mombasa City"},{"name":"Kwale","code":2,"capital":"Kwale"},{"name":"Kilifi","code":3,"capital":"Kilifi"},{"name":"Tana River","code":4,"capital":"Hola"},{"name":"Lamu","code":5,"capital":"Lamu"},{"name":"Taita taveta","code":6,"capital":"Voi"},{"name":"Garissa","code":7,"capital":"Garissa"},{"name":"Wajir","code":8,"capital":"Wajir"},{"name":"Mandera","code":9,"capital":"Mandera"},{"name":"Marsabit","code":10,"capital":"Marsabit"},{"name":"Isiolo","code":11,"capital":"Isiolo"},{"name":"Meru","code":12,"capital":"Meru"},{"name":"Tharaka nithi","code":13,"capital":"Chuka"},{"name":"Embu","code":14,"capital":"Embu"},{"name":"Kitui","code":15,"capital":"Kitui"},{"name":"Machakos","code":16,"capital":"Machakos"},{"name":"Makueni","code":17,"capital":"Wote"},{"name":"Nyandarua","code":18,"capital":"Ol Kalou"},{"name":"Nyeri","code":19,"capital":"Nyeri"},{"name":"Kirinyaga","code":20,"capital":"Kerugoya/Kutus"},{"name":"Murang\'a","code":21,"capital":"Murang\'a"},{"name":"Kiambu","code":22,"capital":"Kiambu"},{"name":"Turkana","code":23,"capital":"Lodwar"},{"name":"West pokot","code":24,"capital":"Kapenguria"},{"name":"Samburu","code":25,"capital":"Maralal"},{"name":"Trans nzoia","code":26,"capital":"Kitale"},{"name":"Uasin gishu","code":27,"capital":"Eldoret"},{"name":"Elgeyo marakwet","code":28,"capital":"Iten"},{"name":"Nandi","code":29,"capital":"Kapsabet"},{"name":"Baringo","code":30,"capital":"Kabarnet"},{"name":"Laikipia","code":31,"capital":"Rumuruti"},{"name":"Nakuru","code":32,"capital":"Nakuru"},{"name":"Narok","code":33,"capital":"Narok"},{"name":"Kajiado","code":34},{"name":"Kericho","code":35,"capital":"Kericho"},{"name":"Bomet","code":36,"capital":"Bomet"},{"name":"Kakamega","code":37,"capital":"Kakamega"},{"name":"Vihiga","code":38,"capital":"Vihiga"},{"name":"Bungoma","code":39,"capital":"Bungoma"},{"name":"Busia","code":40,"capital":"Busia"},{"name":"Siaya","code":41,"capital":"Siaya"},{"name":"Kisumu","code":42,"capital":"Kisumu"},{"name":"Homa bay","code":43,"capital":"Homa Bay"},{"name":"Migori","code":44,"capital":"Migori"},{"name":"Kisii","code":45,"capital":"Kisii"},{"name":"Nyamira","code":46,"capital":"Nyamira"},{"name":"Nairobi","code":47,"capital":"Nairobi City"}]');var _t=n(1140);function gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ht(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){gt(e,t,n[t])}))}return e}function bt(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 vt(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function yt(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){vt(a,r,i,o,s,"next",e)}function s(e){vt(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wt(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){Ct(e,t,n[t])}))}return e}function Et(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 Dt(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: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,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,s])}}}function kt(e,t,n){var r="https://afyakenyaapi.health.go.ke/partners/registry/search/".concat(arguments.length>3&&void 0!==arguments[3]?arguments[3]:"KE","/").concat(e,"/").concat(t);return fetch(r,{headers:{Authorization:"Bearer ".concat(n)}}).then((function(e){return e.json()}))}function Ot(e){var t=function(e){var t,n,r,i,a,o,s,l,c,u,d,A,p,m,f,_,g,h,b=e.concepts.find((function(t){return t.uuid===e.obs["1712AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"]})),v=e.concepts.find((function(t){return t.uuid===e.obs["1542AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"]})),y=e.concepts.find((function(t){return t.uuid===e.obs["1054AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"]}));return{firstName:null===(t=e)||void 0===t?void 0:t.givenName,middleName:null===(n=e)||void 0===n?void 0:n.middleName,lastName:null===(r=e)||void 0===r?void 0:r.familyName,gender:"Male"===(null===(i=e)||void 0===i?void 0:i.gender)?"male":"female",dateOfBirth:new Date(e.birthdate).toISOString(),isAlive:!e.isDead,residence:{county:"0".concat(null===(a=ft.find((function(t){return t.name.includes(e.address.countyDistrict)})))||void 0===a?void 0:a.code),subCounty:null===(o=e.address.stateProvince)||void 0===o?void 0:o.toLocaleLowerCase(),ward:null===(s=e.address.address4)||void 0===s?void 0:s.toLocaleLowerCase(),village:e.address.cityVillage,landmark:e.address.address2,address:e.address.postalCode},nextOfKins:[],contact:{primaryPhone:e.attributes["b2c38640-2603-4629-aebd-3b54f33f1e3a"],secondaryPhone:e.attributes["94614350-84c8-41e0-ac29-86bc107069be"],emailAddress:e.attributes["b8d0b331-1d2d-4a9a-b741-1816f498bdb6"]},country:"KE",countyOfBirth:"0".concat(null===(l=ft.find((function(t){return t.name.includes(e.address.countyDistrict)})))||void 0===l?void 0:l.code),educationLevel:null!==(_=null===(u=b)||void 0===u||null===(c=u.display)||void 0===c?void 0:c.toLowerCase())&&void 0!==_?_:"",religion:"",occupation:null!==(g=null===(A=v)||void 0===A||null===(d=A.display)||void 0===d?void 0:d.toLowerCase())&&void 0!==g?g:"",maritalStatus:null!==(h=null===(m=y)||void 0===m||null===(p=m.display)||void 0===p?void 0:p.toLowerCase())&&void 0!==h?h:"",originFacilityKmflCode:"",nascopCCCNumber:"",identifications:[{identificationType:"national-id",identificationNumber:null===(f=e.identifiers.nationalId)||void 0===f?void 0:f.identifierValue}]}}(e);return fetch("https://afyakenyaapi.health.go.ke/partners/registry",{headers:{Authorization:"Bearer ".concat(e.token),"Content-Type":"application/json"},method:"POST",body:JSON.stringify(t)})}function St(){return(St=yt((function(e,t,n){var i,a,o;return Dt(this,(function(s){switch(s.label){case 0:switch(n?"edit":"new"){case"edit":return[3,1];case"new":return[3,5]}return[3,6];case 1:return s.trys.push([1,3,,4]),[4,kt("national-id",e.identifiers.nationalId.identifierValue,e.token)];case 2:return a=s.sent(),!1===(null===(i=a)||void 0===i?void 0:i.clientExists)&&Pt(e,t),[3,4];case 3:return o=s.sent(),(0,r.showSnackbar)({title:"Client registry error",subtitle:"".concat(o),timeoutInMs:1e4,kind:"error",isLowContrast:!0}),[3,4];case 4:return[2];case 5:Pt(e,t),s.label=6;case 6:return[2]}}))}))).apply(this,arguments)}var Bt=new URLSearchParams;Bt.append("client_id","palladium.partner.client"),Bt.append("client_secret","28f95b2a"),Bt.append("grant_type","client_credentials"),Bt.append("scope","DHP.Gateway DHP.Partners");var Tt=function(){var e=yt((function(e){var t,n;return Dt(this,(function(r){switch(r.label){case 0:return[4,fetch(e,{method:"POST",body:Bt,redirect:"follow"})];case 1:return(t=r.sent()).ok?[3,3]:(n=new Error("An error occurred while fetching the data."),[4,t.json()]);case 2:throw n.info=r.sent(),n.status=t.status,n;case 3:return[2,t.json()]}}))}));return function(t){return e.apply(this,arguments)}}();function jt(){var e=Fe()("https://afyakenyaidentityapi.health.go.ke/connect/token",Tt,{refreshInterval:864e3});return{data:e.data,isLoading:e.isLoading,error:e.error}}function Pt(e,t){return Ft.apply(this,arguments)}function Ft(){return(Ft=yt((function(e,t){var n,i,a,o,s,l,c,u;return Dt(this,(function(d){switch(d.label){case 0:return d.trys.push([0,6,,7]),[4,Ot(e)];case 1:return(n=d.sent()).ok?[4,n.json()]:[3,3];case 2:return i=d.sent(),a=Ct({},"nationalUniquePatientIdentifier",{identifierTypeUuid:"f85081e2-b4be-4e48-b3a4-7994b69bb101",identifierName:"National Unique patient identifier",identifierValue:i.clientNumber,initialValue:i.clientNumber,identifierUuid:void 0,selectedSource:{uuid:"",name:""},preferred:!1,required:!1}),t(Et(wt({},e),{identifiers:wt({},e.identifiers,a)})),(0,r.showToast)({title:"Posted patient to client registry successfully",description:"The patient has been saved to client registry",kind:"success"}),[3,5];case 3:return[4,n.json()];case 4:o=d.sent(),l=Object.values(null!==(s=o.errors)&&void 0!==s?s:{}).map((function(e){return e.join()})).toString(),t(Et(wt({},e),{attributes:Et(wt({},e.attributes),(c={},Ct(c,"869f623a-f78e-4ace-9202-0bed481822f5","Failed validation"),Ct(c,"752a0331-5293-4aa5-bf46-4d51aaf2cdc5","Failed"),c))})),(0,r.showNotification)({title:o.title,description:l,kind:"warning",millis:15e4}),d.label=5;case 5:return[3,7];case 6:return u=d.sent(),(0,r.showNotification)({kind:"error",title:"NUPI Post failed",description:JSON.stringify(u)}),[3,7];case 7:return[2]}}))}))).apply(this,arguments)}var xt=n(3565),It=n.n(xt);function Nt(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 Ut(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Gt(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Ut(a,r,i,o,s,"next",e)}function s(e){Ut(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(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){Lt(e,t,n[t])}))}return e}function Rt(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 qt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||Wt(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 zt(e){return function(e){if(Array.isArray(e))return Nt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Wt(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.")}()}function Wt(e,t){if(e){if("string"==typeof e)return Nt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nt(e,t):void 0}}function Vt(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: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,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,s])}}}function Zt(e){return Ht.apply(this,arguments)}function Ht(){return(Ht=Gt((function(e){return Vt(this,(function(t){switch(t.label){case 0:return[4,(0,r.getSynchronizationItems)(f)];case 1:return[2,t.sent().find((function(t){return t._patientRegistrationData.formValues.patientUuid===e}))]}}))}))).apply(this,arguments)}function Yt(e){var t=!!e,n=(0,mt.ZP)(t?"".concat(r.restBaseUrl,"/person/").concat(e,"/attribute?v=custom:(uuid,display,attributeType:(uuid,display,format),value)"):null,r.openmrsFetch),i=n.data,a=n.error,o=n.isLoading;return(0,g.useMemo)((function(){var e,t;return{data:null===(t=i)||void 0===t||null===(e=t.data)||void 0===e?void 0:e.results,isLoading:o}}),[i,a])}var Kt=n(1093),Xt={};Xt.styleTagTransform=nt(),Xt.setAttributes=Qe(),Xt.insert=Xe().bind(null,"head"),Xt.domAPI=Ye(),Xt.insertStyleElement=et(),Ze()(Kt.Z,Xt);const Jt=Kt.Z&&Kt.Z.locals?Kt.Z.locals:void 0;function Qt(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 $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var en=function(e){var t,n,r,i,a=e.checkWarning,o=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,Le.U$)(o.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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Qt(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)?Qt(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=s[0],c=s[1],u=(0,Ge.useTranslation)().t,d=l.value||"",A=c.error&&u(c.error),p=(0,g.useMemo)((function(){if(!A&&"function"==typeof a){var e=a(d);return e&&u(e)}}),[a,A,d,u]),m=o.required?o.labelText:"".concat(o.labelText," (").concat(u("optional","optional"),")");return h().createElement("div",{style:{marginBottom:"1rem"}},h().createElement(Ie.mh4,null,h().createElement(Ie.oil,(r=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){$t(e,t,n[t])}))}return e}({},o,l),i=null!=(i={labelText:m,invalid:!(!c.touched||!c.error),invalidText:A,warn:!!p,warnText:p,value:d})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})),r))))},tn=n(1098),nn={};nn.styleTagTransform=nt(),nn.setAttributes=Qe(),nn.insert=Xe().bind(null,"head"),nn.domAPI=Ye(),nn.insertStyleElement=et(),Ze()(tn.Z,nn);const rn=tn.Z&&tn.Z.locals?tn.Z.locals:void 0;function an(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 on=/^([^0-9]*)$/;function sn(e){if(!on.test(e))return"numberInNameDubious"}var ln=function(){var e,t,n=(0,Ge.useTranslation)().t,i=(0,g.useContext)(ze),a=i.setCapturePhotoProps,o=i.currentPhoto,s=i.setFieldValue,l=(0,r.useConfig)().fieldConfigurations.name,c=l.displayCapturePhoto,u=l.allowUnidentifiedPatients,d=l.defaultUnknownGivenName,A=l.defaultUnknownFamilyName,p=l.displayMiddleName,m=l.displayReverseFieldOrder,f=(e=(0,Le.U$)("attributes.".concat("8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47")),t=3,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return an(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)?an(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.")}()),_=f[0].value,b=f[2].setValue,v="true"===_,y=(0,g.useCallback)((function(e,t){a&&a({imageData:e,dateTime:t})}),[a]),C=h().createElement(en,{id:"givenName",name:"givenName",labelText:n("givenNameLabelText","First Name"),checkWarning:sn,required:!0}),w=p&&h().createElement(en,{id:"middleName",name:"middleName",labelText:n("middleNameLabelText","Middle Name"),checkWarning:sn}),E=h().createElement(en,{id:"familyName",name:"familyName",labelText:n("familyNameLabelText","Family Name"),checkWarning:sn,required:!0});return h().createElement("div",null,h().createElement("h4",{className:rn.productiveHeading02Light},n("fullNameLabelText","Full Name")),h().createElement("div",{className:rn.grid},c&&h().createElement(r.ExtensionSlot,{className:rn.photoExtension,name:"capture-patient-photo-slot",state:{onCapturePhoto:y,initialState:o}}),h().createElement("div",{className:rn.nameField},(u||v)&&h().createElement(h().Fragment,null,h().createElement("div",{className:rn.dobContentSwitcherLabel},h().createElement("span",{className:rn.label01},n("patientNameKnown","Patient's Name is Known?"))),h().createElement(Ie.GHR,{className:rn.contentSwitcher,selectedIndex:v?1:0,onChange:function(e){"known"===e.name?(s("givenName",""),s("familyName",""),b("false")):(s("givenName",d),s("familyName",A),b("true"))}},h().createElement(Ie.rsf,{name:"known",text:n("yes","Yes")}),h().createElement(Ie.rsf,{name:"unknown",text:n("no","No")}))),!v&&(m?h().createElement(h().Fragment,null,E,w,C):h().createElement(h().Fragment,null,C,w,E)))))};function cn(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 un=function(){var e,t,n,i,a,o,s=(0,r.useConfig)().fieldConfigurations,l=(0,Ge.useTranslation)().t,c=(a=(0,Le.U$)("gender"),o=2,function(e){if(Array.isArray(e))return e}(a)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(a,o)||function(e,t){if(e){if("string"==typeof e)return cn(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)?cn(e,t):void 0}}(a,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],A=(0,g.useContext)(ze).setFieldValue,p=null===(e=s)||void 0===e?void 0:e.gender;return h().createElement("div",{className:rn.halfWidthInDesktopView},h().createElement("h4",{className:rn.productiveHeading02Light},l("sexFieldLabelText","Sex")),h().createElement("div",{className:rn.sexField},h().createElement("p",{className:"cds--label"},l("genderLabelText","Sex")),h().createElement(Ie.SYO,{name:"gender",orientation:"vertical",onChange:function(e){A("gender",e)},valueSelected:u.value},p.map((function(e){return h().createElement(Ie.EUY,{key:null!==(t=e.label)&&void 0!==t?t:e.value,id:"gender-option-".concat(e.value),value:e.value,labelText:l(null!==(n=e.label)&&void 0!==n?n:e.value,null!==(i=e.label)&&void 0!==i?i:e.value)})}))),d.touched&&d.error&&h().createElement("div",{className:rn.radioFieldError},l(d.error,"Gender is required"))))},dn=n(6759),An=n(3238),pn=n(7857),mn={};mn.styleTagTransform=nt(),mn.setAttributes=Qe(),mn.insert=Xe().bind(null,"head"),mn.domAPI=Ye(),mn.insertStyleElement=et(),Ze()(pn.Z,mn);const fn=pn.Z&&pn.Z.locals?pn.Z.locals:void 0;function _n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gn(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){_n(e,t,n[t])}))}return e}const hn=function(e){var t=e.close,n=e.children,i=e.header,a=e.buttonsGroup,o=(0,Ge.useTranslation)().t,s=(0,r.useLayoutType)();return h().createElement("div",{className:(0,r.isDesktop)(s)?fn.desktopOverlay:fn.tabletOverlay},(0,r.isDesktop)(s)?h().createElement("div",{className:fn.desktopHeader},h().createElement("div",{className:fn.headerContent},i),h().createElement(Ie.zxk,{className:fn.closeButton,iconDescription:o("closeOverlay","Close overlay"),onClick:t,kind:"ghost",hasIconOnly:!0,renderIcon:function(e){return h().createElement(An.x8,gn({size:16},e))}})):h().createElement(Ie.h4i,{className:fn.tabletOverlayHeader,"aria-label":"Overlay header"},h().createElement(Ie.zxk,{kind:"ghost",onClick:t,hasIconOnly:!0,iconDescription:o("closeOverlay","Close overlay"),renderIcon:function(e){return h().createElement(dn.Xd,gn({size:16,onClick:t},e))}}),h().createElement("div",{className:fn.headerContent},i)),h().createElement("div",{className:fn.overlayContent},n),h().createElement("div",null,a))};function bn(e){return vn(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 vn(e){return"UNIQUE"===e.uniquenessBehavior||"LOCATION"===e.uniquenessBehavior}var yn=n(3433),Cn={};Cn.styleTagTransform=nt(),Cn.setAttributes=Qe(),Cn.insert=Xe().bind(null,"head"),Cn.domAPI=Ye(),Cn.insertStyleElement=et(),Ze()(yn.Z,Cn);const wn=yn.Z&&yn.Z.locals?yn.Z.locals:void 0;function En(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 Dn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kn(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){Dn(e,t,n[t])}))}return e}function On(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 Sn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return En(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?En(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Bn=function(e){var t,n=e.closeOverlay,i=e.setFieldValue,a=(0,r.useLayoutType)(),o=(0,g.useContext)(O).identifierTypes,s=(0,g.useContext)(ze),l=s.isOffline,c=s.values,u=s.initialFormValues,d=Sn((0,g.useState)(c.identifiers),2),A=d[0],p=d[1],m=Sn((0,g.useState)(""),2),f=m[0],_=m[1],b=(0,Ge.useTranslation)().t,v=(0,r.useConfig)().defaultPatientIdentifierTypes,y=(0,g.useMemo)((function(){var e,t={};return null===(e=v)||void 0===e||e.forEach((function(e){t[e]=!0})),t}),[v]);(0,g.useEffect)((function(){p(c.identifiers)}),[c.identifiers]);var C=(0,g.useCallback)((function(e){var n,r;return _(null!==(t=null===(r=e)||void 0===r||null===(n=r.target)||void 0===n?void 0:n.value)&&void 0!==t?t:"")}),[]),w=(0,g.useMemo)((function(){var e;return null===(e=o)||void 0===e?void 0:e.filter((function(e){var t,n;return null===(n=e)||void 0===n||null===(t=n.name)||void 0===t?void 0:t.toLowerCase().includes(f.toLowerCase())}))}),[f,o]),E=(0,g.useCallback)((function(e,t){return p((function(n){var r,i;return t?On(kn({},n),Dn({},e.fieldName,Wn(e,null!==(i=null!==(r=c.identifiers[e.fieldName])&&void 0!==r?r:u.identifiers[e.fieldName])&&void 0!==i?i:{}))):n[e.fieldName]?Object.fromEntries(Object.entries(n).filter((function(t){return Sn(t,1)[0]!==e.fieldName}))):n}))}),[u.identifiers,c.identifiers]),D=(0,g.useMemo)((function(){return w.map((function(e){var t,n,r,i,a,o,s,u=A[e.fieldName],d=e.isPrimary||e.required||y[e.uuid]||c.identifiers[e.fieldName],m=l&&bn(e);return h().createElement("div",{key:e.uuid,className:wn.space05},h().createElement(Ie.XZJ,{id:e.uuid,value:e.uuid,labelText:e.name,onChange:function(t,n){var r=n.checked;return E(e,r)},checked:!!u,disabled:d||l&&m}),u&&(null===(n=e)||void 0===n||null===(t=n.identifierSources)||void 0===t?void 0:t.length)>0&&(!u.initialValue||(null===(r=u)||void 0===r?void 0:r.selectedSource))&&h().createElement("div",{className:wn.radioGroup},h().createElement(Ie.SYO,{legendText:b("source","Source"),name:"".concat(null===(i=e)||void 0===i?void 0:i.fieldName,"-identifier-sources"),defaultSelected:null===(o=u)||void 0===o||null===(a=o.selectedSource)||void 0===a?void 0:a.uuid,onChange:function(t){return function(e,t){return p((function(n){return On(kn({},n),Dn({},e.fieldName,kn({},n[e.fieldName],zn(e.identifierSources.find((function(e){return e.uuid===t})),n[e.fieldName].identifierValue,n[e.fieldName].initialValue))))}))}(e,t)},orientation:"vertical"},null===(s=e)||void 0===s?void 0:s.identifierSources.map((function(t){var n;return h().createElement(Ie.EUY,{key:t.uuid,labelText:t.name,name:t.uuid,value:t.uuid,className:wn.radioButton,disabled:l&&vn(e)&&(null===(n=t.autoGenerationOption)||void 0===n?void 0:n.manualEntryEnabled)})})))))}))}),[w,A,y,c.identifiers,l,E,b]),k=(0,g.useCallback)((function(){i("identifiers",A),n()}),[A,i,n]);return h().createElement(hn,{close:n,header:b("configureIdentifiers","Configure identifiers"),buttonsGroup:h().createElement(Ie.uVA,{className:(0,r.isDesktop)(a)?wn.desktop:wn.tablet},h().createElement(Ie.zxk,{className:wn.button,kind:"secondary",onClick:n},b("cancel","Cancel")),h().createElement(Ie.zxk,{className:wn.button,kind:"primary",onClick:k},b("configureIdentifiers","Configure identifiers")))},h().createElement("div",null,h().createElement("p",{className:wn.bodyLong02},b("IDInstructions","Select the identifiers you'd like to add for this patient:")),o.length>7&&h().createElement("div",{className:wn.space05},h().createElement(Ie.olm,{labelText:b("searchIdentifierPlaceholder","Search identifier"),placeholder:b("searchIdentifierPlaceholder","Search identifier"),onChange:C,value:f})),h().createElement("fieldset",null,D)))};var Tn=n(7631),jn=n(37),Pn=n(9525);function Fn(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 xn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function In(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){xn(e,t,n[t])}))}return e}function Nn(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 Un(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fn(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)?Fn(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 Gn=function(e){var t=e.patientIdentifier,n=e.fieldName,i=(0,Ge.useTranslation)().t,a=(0,r.useConfig)().defaultPatientIdentifierTypes,o=(0,g.useContext)(O).identifierTypes,s=(0,g.useContext)(ze),l=s.isOffline,c=s.values,u=s.setFieldValue,d=(0,g.useMemo)((function(){return o.find((function(e){return e.uuid===t.identifierTypeUuid}))}),[t,o]),A=t.autoGeneration,p=t.initialValue,m=t.identifierValue,f=t.identifierName,_=t.required,b=Un((0,g.useState)(A||p===m),2),v=b[0],y=b[1],C="identifiers.".concat(n,".identifierValue"),w=Un((0,Le.U$)(C),2),E=w[0],D=w[1],k=l&&bn(d),S=(0,g.useMemo)((function(){var e,t={};return null===(e=a)||void 0===e||e.forEach((function(e){t[e]=!0})),t}),[a]),B=(0,g.useCallback)((function(){y(!0),u("identifiers.".concat(n),Nn(In({},t),{identifierValue:p,selectedSource:null,autoGeneration:!1}))}),[p,y]);return h().createElement("div",{className:at.IDInput},A||v?h().createElement("div",{className:at.textID},h().createElement("p",{className:at.label},f),h().createElement("p",{className:at.bodyShort02},A?i("autoGeneratedPlaceholderText","Auto-generated"):m),h().createElement("input",Nn(In({type:"hidden"},E),{disabled:!0})),!(!D.touched||!D.error)&&h().createElement("span",{className:at.dangerLabel01},D.error&&i(D.error))):h().createElement(en,In({id:C,labelText:f,name:C,disabled:k,required:_,invalid:!(!D.touched||!D.error),invalidText:D.error&&i(D.error)},E)),h().createElement("div",{style:{marginBottom:"1rem"}},!t.required&&t.initialValue&&v&&h().createElement(r.UserHasAccess,{privilege:"Edit Patient Identifiers"},h().createElement(Ie.zxk,{size:"md",kind:"ghost",onClick:function(){var e,r;y(!1),u("identifiers.".concat(n),In({},t,zn(null===(r=d)||void 0===r||null===(e=r.identifierSources)||void 0===e?void 0:e[0],p,p)))},iconDescription:i("editIdentifierTooltip","Edit"),disabled:k,hasIconOnly:!0},h().createElement(Tn.I8,{size:16}))),p&&p!==m&&h().createElement(r.UserHasAccess,{privilege:"Edit Patient Identifiers"},h().createElement(Ie.zxk,{size:"md",kind:"ghost",onClick:B,iconDescription:i("resetIdentifierTooltip","Reset"),disabled:k,hasIconOnly:!0},h().createElement(jn.AG,{size:16}))),!t.required&&!S[t.identifierTypeUuid]&&h().createElement(r.UserHasAccess,{privilege:"Delete Patient Identifiers"},h().createElement(Ie.zxk,{size:"md",kind:"ghost",onClick:function(){if(p)var e=(0,r.showModal)("delete-identifier-confirmation-modal",{deleteIdentifier:function(t){t&&u("identifiers",Vn(c.identifiers,n)),e()},identifierName:f,initialValue:p});else u("identifiers",Vn(c.identifiers,n))},iconDescription:i("deleteIdentifierTooltip","Delete"),disabled:k,hasIconOnly:!0},h().createElement(Pn.ZN,{size:16})))))};function Ln(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 Mn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rn(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){Mn(e,t,n[t])}))}return e}function qn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ln(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)?Ln(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 zn(e,t,n){var r,i,a=null===(i=e)||void 0===i||null===(r=i.autoGenerationOption)||void 0===r?void 0:r.automaticGenerationEnabled;return{selectedSource:e,autoGeneration:a,identifierValue:a?"auto-generated":"auto-generated"!==t?t:n}}function Wn(e,t){var n,r,i,a,o,s;return Rn({identifierTypeUuid:e.uuid,identifierName:e.name,preferred:e.isPrimary,initialValue:"",required:e.isPrimary||e.required},t,zn(null!==(o=null===(n=t)||void 0===n?void 0:n.selectedSource)&&void 0!==o?o:null===(r=e.identifierSources)||void 0===r?void 0:r[0],null===(i=t)||void 0===i?void 0:i.identifierValue,null!==(s=null===(a=t)||void 0===a?void 0:a.initialValue)&&void 0!==s?s:""))}function Vn(e,t){return Object.fromEntries(Object.entries(e).filter((function(e){return qn(e,1)[0]!==t})))}var Zn=function(){var e=(0,g.useContext)(O).identifierTypes,t=!e,n=(0,g.useContext)(ze),i=n.values,a=n.setFieldValue,o=n.initialFormValues,s=n.isOffline,l=(0,Ge.useTranslation)().t,c=(0,r.useLayoutType)(),u=qn((0,g.useState)(!1),2),d=u[0],A=u[1],p=(0,r.useConfig)().defaultPatientIdentifierTypes;(0,g.useEffect)((function(){if(e){var t={};e.filter((function(e){var t;return e.isPrimary||e.required||!!(null===(t=p)||void 0===t?void 0:t.find((function(t){return t===e.uuid})))})).filter((function(e){return!i.identifiers[e.fieldName]})).forEach((function(e){var n,r;t[e.fieldName]=Wn(e,null!==(r=null!==(n=i.identifiers[e.uuid])&&void 0!==n?n:o.identifiers[e.uuid])&&void 0!==r?r:{})})),Object.keys(t).length&&a("identifiers",Rn({},i.identifiers,t))}}),[e,a,p,i.identifiers,Wn]);var m=(0,g.useCallback)((function(){return A(!1)}),[A]);return t&&!s?h().createElement("div",{"data-testid":"loading-skeleton",className:rn.halfWidthInDesktopView},h().createElement("div",{className:rn.identifierLabelText},h().createElement("h4",{className:rn.productiveHeading02Light},l("idFieldLabelText","Identifiers"))),h().createElement(Ie.N2B,null)):h().createElement("div",{className:rn.halfWidthInDesktopView},h().createElement(r.UserHasAccess,{privilege:["Get Identifier Types","Add Patient Identifiers"]},h().createElement("div",{className:rn.identifierLabelText},h().createElement("h4",{className:rn.productiveHeading02Light},l("idFieldLabelText","Identifiers")),h().createElement(Ie.zxk,{kind:"ghost",className:rn.setIDNumberButton,onClick:function(){return A(!0)},size:(0,r.isDesktop)(c)?"sm":"md"},l("configure","Configure")," ",h().createElement(dn.ol,{size:16})))),h().createElement("div",null,Object.entries(i.identifiers).map((function(e){var t=qn(e,2),n=t[0],r=t[1];return h().createElement(Gn,{key:n,fieldName:n,patientIdentifier:r})})),d&&h().createElement(Bn,{setFieldValue:a,closeOverlay:m})))},Hn=function(e,t){return{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.map((function(e){return"Y"===e?"YYYY":e+e})).join(t),dateFormat:e.join(t)}};function Yn(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 Kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xn(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){Kn(e,t,n[t])}))}return e}function Jn(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 Qn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yn(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)?Yn(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 $n=function(e,t,n){var r=n.useEstimatedDateOfBirth,i=r.enabled,a=r.month,o=r.dayOfMonth,s=new Date,l=new Date(s.getFullYear()-e,s.getMonth()-t,1),c=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),u=new Date(l.getFullYear(),l.getMonth(),Math.min(s.getDate(),c));return i?new Date(u.getFullYear(),a,o):u},er=function(){var e,t=(0,Ge.useTranslation)().t,n=(0,r.useConfig)().fieldConfigurations.dateOfBirth,i=null===(e=n)||void 0===e?void 0:e.allowEstimatedDateOfBirth,a=Qn((0,Le.U$)("birthdateEstimated"),1)[0].value,o=Qn((0,Le.U$)("birthdate"),2),s=o[0],l=o[1],c=Qn((0,Le.U$)("yearsEstimated"),2),u=c[0],d=c[1],A=Qn((0,Le.U$)("monthsEstimated"),2),p=A[0],m=A[1],f=(0,g.useContext)(ze).setFieldValue,_=Hn(["d","m","Y"],"/"),b=(_.format,_.placeHolder),v=_.dateFormat,y=new Date,C=(0,g.useCallback)((function(e){f("birthdateEstimated","unknown"===e.name),f("birthdate",""),f("yearsEstimated",0),f("monthsEstimated","")}),[f]),w=(0,g.useCallback)((function(e){f("birthdate",e)}),[f]),E=(0,g.useCallback)((function(e){var t=+e.target.value;!isNaN(t)&&t<140&&t>=0&&(f("yearsEstimated",t),f("birthdate",$n(t,m.value,n)))}),[f,n,m.value]),D=(0,g.useCallback)((function(e){var t=+e.target.value;isNaN(t)||(f("monthsEstimated",t),f("birthdate",$n(d.value,t,n)))}),[f,n,d.value]),k=(0,g.useCallback)((function(){var e=+m.value%12,t=+d.value+Math.floor(m.value/12);f("yearsEstimated",t),f("monthsEstimated",e>0?e:""),f("birthdate",$n(t,e,n))}),[f,m,d,n]);return h().createElement("div",{className:rn.halfWidthInDesktopView},h().createElement("h4",{className:rn.productiveHeading02Light},t("birthFieldLabelText","Birth")),(i||a)&&h().createElement("div",{className:rn.dobField},h().createElement("div",{className:rn.dobContentSwitcherLabel},h().createElement("span",{className:rn.label01},t("dobToggleLabelText","Date of Birth Known?"))),h().createElement(Ie.GHR,{onChange:C,selectedIndex:a?1:0},h().createElement(Ie.rsf,{name:"known",text:t("yes","Yes")}),h().createElement(Ie.rsf,{name:"unknown",text:t("no","No")}))),h().createElement(Ie.mh4,null,a?h().createElement("div",{className:rn.grid},h().createElement("div",{className:rn.dobField},h().createElement(Ie.mh4,null,h().createElement(Ie.oil,Jn(Xn({id:"yearsEstimated",type:"number",name:u.name,onChange:E,labelText:t("estimatedAgeInYearsLabelText","Estimated age in years"),invalid:!(!d.touched||!d.error),invalidText:d.error&&t(d.error),value:u.value,min:0,required:!0},u),{onBlur:k})))),h().createElement("div",{className:rn.dobField},h().createElement(Ie.mh4,null,h().createElement(Ie.oil,Jn(Xn({id:"monthsEstimated",type:"number",name:p.name,onChange:D,labelText:t("estimatedAgeInMonthsLabelText","Estimated age in months"),invalid:!(!m.touched||!m.error),invalidText:m.error&&t(m.error),value:p.value,min:0},p),{required:!d.value,onBlur:k}))))):h().createElement("div",{className:rn.dobField},h().createElement(r.OpenmrsDatePicker,Jn(Xn({id:"birthdate"},s),{dateFormat:v,onChange:w,maxDate:y,labelText:t("dateOfBirthLabelText","Date of Birth"),invalid:!(!l.touched||!l.error),invalidText:l.error&&t(l.error),value:s.value,carbonOptions:{placeholder:b}})))))};function tr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var nr=function(e){var t=e.fieldDefinition,n=(0,Ge.useTranslation)().t;return h().createElement("div",{className:je()(rn.customField,rn.halfWidthInDesktopView)},h().createElement(Le.gN,{name:t.id},(function(e){var r,i,a,o=e.field,s=e.form;return s.touched,s.errors,e.meta,h().createElement(en,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){tr(e,t,n[t])}))}return e}({id:t.id,labelText:n("".concat(t.label),"".concat(t.label)),required:null!==(a=null===(i=t)||void 0===i||null===(r=i.validation)||void 0===r?void 0:r.required)&&void 0!==a&&a},o))})))};function rr(e){var t,n,i="string"==typeof e&&""!==e,a=Fe()(i?"".concat(r.restBaseUrl,"/concept/").concat(e):null,r.openmrsFetch),o=a.data,s=a.error,l=a.isLoading;return s&&(0,r.showSnackbar)({title:s.name,subtitle:s.message,kind:"error"}),{data:null===(n=o)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.answers,isLoading:l}}function ir(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ar(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){ir(e,t,n[t])}))}return e}function or(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 sr(e){var t=e.fieldDefinition,n=(0,Ge.useTranslation)().t,i=function(e){var t,n="string"==typeof e&&""!==e,i=Fe()(n?"".concat(r.restBaseUrl,"/concept/").concat(e):null,r.openmrsFetch),a=i.data,o=i.error,s=i.isLoading;return o&&(0,r.showSnackbar)({title:o.name,subtitle:o.message,kind:"error"}),{data:null===(t=a)||void 0===t?void 0:t.data,isLoading:s}}(t.uuid),a=i.data,o=i.isLoading;if(!(0,r.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(o)return null;switch(a.datatype.display){case"Text":return h().createElement(lr,{concept:a,validationRegex:t.validation.matches,label:t.label,required:t.validation.required});case"Numeric":return h().createElement(cr,{concept:a,label:t.label,required:t.validation.required});case"Date":return h().createElement(ur,{concept:a,label:t.label,required:t.validation.required,dateFormat:t.dateFormat,placeholder:t.placeholder});case"Coded":return h().createElement(dr,{concept:a,answerConceptSetUuid:t.answerConceptSetUuid,label:t.label,required:t.validation.required,customConceptAnswers:t.customConceptAnswers});default:return h().createElement(Ie.K0D,{kind:"error",title:"Error"},n("obsFieldUnknownDatatype","Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",{fieldDefinitionId:t.id,datatypeName:a.datatype.display}))}}function lr(e){var t=e.concept,n=e.validationRegex,r=e.label,i=e.required,a=(0,Ge.useTranslation)().t,o="obs.".concat(t.uuid);return h().createElement("div",{className:je()(rn.customField,rn.halfWidthInDesktopView)},h().createElement(Le.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,s=a.touched,l=a.errors;return e.meta,h().createElement(en,ar({id:o,labelText:null!=r?r:t.display,required:i,invalid:l[o]&&s[o]},n))})))}function cr(e){var t=e.concept,n=e.label,r=e.required,i="obs.".concat(t.uuid);return h().createElement("div",{className:je()(rn.customField,rn.halfWidthInDesktopView)},h().createElement(Le.gN,{name:i},(function(e){var a=e.field,o=e.form,s=o.touched,l=o.errors;return e.meta,h().createElement(en,ar({id:i,labelText:null!=n?n:t.display,required:r,invalid:l[i]&&s[i],type:"number"},a))})))}function ur(e){var t=e.concept,n=e.label,i=e.required,a=e.placeholder,o=(0,Ge.useTranslation)().t,s="obs.".concat(t.uuid),l=(0,g.useContext)(ze).setFieldValue,c=Hn(["d","m","Y"],"/"),u=(c.format,c.placeHolder),d=c.dateFormat,A=(0,g.useCallback)((function(e){l(s,e)}),[l]);return h().createElement(Ie.mh4,null,h().createElement("div",{className:rn.dobField},h().createElement(Le.gN,{name:s},(function(e){var l=e.field,c=e.form,p=c.touched,m=c.errors,f=e.meta,_=l.value?(0,r.parseDate)(l.value):l.value;return h().createElement(r.OpenmrsDatePicker,or(ar({id:s},l),{required:i,dateFormat:d,onChange:A,labelText:null!=n?n:t.display,invalid:m[s]&&p[s],invalidText:f.error&&o(f.error),value:_,carbonOptions:{placeholder:null!=a?a:u}}))}))))}function dr(e){var t=e.concept,n=e.answerConceptSetUuid,r=e.label,i=e.required,a=e.customConceptAnswers,o=(0,Ge.useTranslation)().t,s="obs.".concat(t.uuid),l=rr(a.length?"":null!=n?n:t.uuid),c=l.data,u=l.isLoading,d=(0,g.useMemo)((function(){return a.length?a:u?[]:c.map((function(e){return or(ar({},e),{label:e.display})}))}),[a,c,u]);return h().createElement("div",{className:je()(rn.customField,rn.halfWidthInDesktopView)},u?null:h().createElement(Le.gN,{name:s},(function(e){var n,a=e.field,l=e.form,c=l.touched,u=l.errors;return e.meta,h().createElement(Ie.mh4,null,h().createElement(Ie.PhF,ar({id:s,name:s,labelText:null!=r?r:null===(n=t)||void 0===n?void 0:n.display,required:i,invalid:u[s]&&c[s]},a),h().createElement(Ie.QlF,{key:"no-answer-select-item-".concat(s),value:"",text:o("selectAnOption","Select an option")}),d.map((function(e){return h().createElement(Ie.QlF,{key:e.uuid,value:e.uuid,text:e.label})}))))})))}function Ar(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 pr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mr(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){pr(e,t,n[t])}))}return e}function fr(e){var t,n,i=e.id,a=e.personAttributeType,o=e.answerConceptSetUuid,s=e.label,l=e.customConceptAnswers,c=e.required,u=rr(l.length?"":o),d=u.data,A=u.isLoading,p=(0,Ge.useTranslation)().t,m="attributes.".concat(a.uuid),f=(t=(0,g.useState)(!1),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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ar(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)?Ar(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.")}()),_=f[0],b=f[1];(0,g.useEffect)((function(){o||l.length||((0,r.reportError)(p("codedPersonAttributeNoAnswerSet","The person attribute field '{{codedPersonAttributeFieldId}}' is of type 'coded' but has been defined without an answer concept set UUID. The 'answerConceptSetUuid' key is required.",{codedPersonAttributeFieldId:i})),b(!0))}),[o,l]),(0,g.useEffect)((function(){var e;A||l.length||(d||((0,r.reportError)(p("codedPersonAttributeAnswerSetInvalid","The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an invalid answer concept set UUID '{{answerConceptSetUuid}}'.",{codedPersonAttributeFieldId:i,answerConceptSetUuid:o})),b(!0)),0==(null===(e=d)||void 0===e?void 0:e.length)&&((0,r.reportError)(p("codedPersonAttributeAnswerSetEmpty","The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an answer concept set UUID '{{answerConceptSetUuid}}' that does not have any concept answers.",{codedPersonAttributeFieldId:i,answerConceptSetUuid:o})),b(!0)))}),[A,d,l]);var v=(0,g.useMemo)((function(){return l.length?l:A||!d?[]:d.map((function(e){return t=mr({},e),n=null!=(n={label:e.display})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t;var t,n})).sort((function(e,t){return e.label.localeCompare(t.label)}))}),[l,d,A]);return _?null:h().createElement("div",{className:je()(rn.customField,rn.halfWidthInDesktopView)},A?null:h().createElement(Ie.mh4,null,h().createElement(Le.gN,{name:m},(function(e){var t,n=e.field,r=e.form,o=r.touched,l=r.errors;return e.meta,h().createElement(h().Fragment,null,h().createElement(Ie.PhF,mr({id:i,name:"person-attribute-".concat(a.uuid),labelText:null!=s?s:null===(t=a)||void 0===t?void 0:t.display,invalid:l[m]&&o[m],required:c},n),h().createElement(Ie.QlF,{value:"",text:p("selectAnOption","Select an option")}),v.map((function(e){return h().createElement(Ie.QlF,{key:e.uuid,value:e.uuid,text:e.label})}))))}))))}function _r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gr(e){var t=e.id,n=e.personAttributeType,r=e.validationRegex,i=e.label,a=e.required,o=(0,Ge.useTranslation)().t,s="attributes.".concat(n.uuid);return h().createElement("div",{className:je()(rn.customField,rn.halfWidthInDesktopView)},h().createElement(Le.gN,{name:s,validate:function(e){if(e&&r&&""!==r&&"string"==typeof r&&""!==e)return new RegExp(r).test(e)?void 0:o("invalidInput","Invalid Input")}},(function(e){var r,o,l,c=e.field,u=e.form,d=u.touched,A=u.errors;return e.meta,h().createElement(en,(o=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){_r(e,t,n[t])}))}return e}({id:t,name:"person-attribute-".concat(n.uuid),labelText:null!=i?i:null===(r=n)||void 0===r?void 0:r.display,invalid:A[s]&&d[s]},c),l=null!=(l={required:a})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(l)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(l)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(l,e))})),o))})))}function hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const br=function(e){var t=e.personAttributeType,n=e.required,r=e.id,i=e.label,a=e.customConceptAnswers,o=(0,Ge.useTranslation)().t,s="attributes.".concat(t.uuid);return h().createElement("div",{className:je()(rn.customField,rn.halfWidthInDesktopView)},h().createElement(Ie.mh4,null,h().createElement(Le.gN,{name:s},(function(e){var l,c=e.field,u=e.form,d=u.touched,A=u.errors;return e.meta,h().createElement(h().Fragment,null,h().createElement(Ie.PhF,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){hr(e,t,n[t])}))}return e}({id:r,name:"person-attribute-".concat(t.uuid),labelText:null!=i?i:null===(l=t)||void 0===l?void 0:l.display,invalid:A[s]&&d[s],required:n},c),h().createElement(Ie.QlF,{value:"",text:o("selectAnOption","Select an option")}),a.map((function(e){return h().createElement(Ie.QlF,{key:e.uuid,value:e.uuid,text:e.uuid})}))))}))))};function vr(e){var t,n,i,a,o,s,l,c,u=e.fieldDefinition,d=function(e){var t,n=Fe()("".concat(r.restBaseUrl,"/personattributetype/").concat(e),r.openmrsFetch),i=n.data,a=n.error,o=n.isLoading;return{data:null===(t=i)||void 0===t?void 0:t.data,isLoading:o,error:a}}(u.uuid),A=d.data,p=d.isLoading,m=d.error,f=(0,Ge.useTranslation)().t,_=(0,g.useMemo)((function(){if(!A)return null;switch(A.format){case"java.lang.String":var e,t,n,r,i,a,o,s,l;return h().createElement(h().Fragment,null,"select"===u.renderType?h().createElement(br,{personAttributeType:A,answerConceptSetUuid:u.answerConceptSetUuid,label:u.label,id:null===(e=u)||void 0===e?void 0:e.id,customConceptAnswers:null!==(a=u.customConceptAnswers)&&void 0!==a?a:[],required:null!==(o=null===(t=u.validation)||void 0===t?void 0:t.required)&&void 0!==o&&o}):h().createElement(gr,{personAttributeType:A,validationRegex:null!==(s=null===(n=u.validation)||void 0===n?void 0:n.matches)&&void 0!==s?s:"",label:u.label,required:null!==(l=null===(r=u.validation)||void 0===r?void 0:r.required)&&void 0!==l&&l,id:null===(i=u)||void 0===i?void 0:i.id}));case"org.openmrs.Concept":var c,d,p,m;return h().createElement(fr,{personAttributeType:A,answerConceptSetUuid:u.answerConceptSetUuid,label:u.label,id:null===(c=u)||void 0===c?void 0:c.id,customConceptAnswers:null!==(p=u.customConceptAnswers)&&void 0!==p?p:[],required:null!==(m=null===(d=u.validation)||void 0===d?void 0:d.required)&&void 0!==m&&m});default:return h().createElement(Ie.K0D,{kind:"error",title:"Error"},f("unknownPatientAttributeType","Patient attribute type has unknown format {{personAttributeTypeFormat}}",{personAttributeTypeFormat:A.format}))}}),[A,u,f]);return p?h().createElement("div",null,u.showHeading&&h().createElement("h4",{className:rn.productiveHeading02Light},null===(i=u)||void 0===i?void 0:i.label),h().createElement(Ie.znL,null)):m?h().createElement("div",null,u.showHeading&&h().createElement("h4",{className:rn.productiveHeading02Light},null===(a=u)||void 0===a?void 0:a.label),h().createElement(Ie.K0D,{kind:"error",title:f("error","Error")},f("unableToFetch","Unable to fetch person attribute type - {{personattributetype}}",{personattributetype:null!==(l=null===(o=u)||void 0===o?void 0:o.label)&&void 0!==l?l:null===(s=u)||void 0===s?void 0:s.id}))):h().createElement("div",null,u.showHeading&&h().createElement("h4",{className:rn.productiveHeading02Light},null!==(c=null===(t=u)||void 0===t?void 0:t.label)&&void 0!==c?c:null===(n=A)||void 0===n?void 0:n.display),_)}function yr(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 Cr(e){var t,n,i,a=e.name,o=(0,r.useConfig)().fieldDefinitions.filter((function(e){return e.id==a}))[0],s=(n=(0,Le.U$)("attributes.".concat(null===(t=o.showWhenExpression)||void 0===t?void 0:t.field)),i=1,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(n,i)||function(e,t){if(e){if("string"==typeof e)return yr(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)?yr(e,t):void 0}}(n,i)||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;return o.showWhenExpression&&s!==o.showWhenExpression.value?null:"person attribute"===o.type?h().createElement(vr,{fieldDefinition:o}):"obs"===o.type?h().createElement(sr,{fieldDefinition:o}):"address"===o.type?h().createElement(nr,{fieldDefinition:o}):h().createElement("div",null,"Error: Unknown field type ",o.type)}function wr(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 Er(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dr(){var e=Fe()("/module/addresshierarchy/ajax/getOrderedAddressHierarchyLevels.form",r.openmrsFetch),t=e.data,n=e.isLoading,i=e.error,a=(0,g.useMemo)((function(){var e,r;return{orderedFields:null===(r=t)||void 0===r||null===(e=r.data)||void 0===e?void 0:e.map((function(e){return e.addressField})),isLoadingFieldOrder:n,errorFetchingFieldOrder:i}}),[t,n,i]);return a}function kr(e){var t,n,r=Dr(),i=r.orderedFields,a=r.isLoadingFieldOrder,o=(0,g.useContext)(ze).setFieldValue,s=(t=(0,Le.U$)("address"),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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return wr(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)?wr(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.")}())[1].value,l=(0,g.useMemo)((function(){return a?-1:i.findIndex((function(t){return t===e}))}),[i,e,a]),c=(0,g.useMemo)((function(){var e,t,n=!0,r=null!==(t=null===(e=i)||void 0===e?void 0:e.slice(0,l))&&void 0!==t?t:[],a=[],o=!0,c=!1,u=void 0;try{for(var d,A=r[Symbol.iterator]();!(o=(d=A.next()).done);o=!0){var p=d.value;if(!s[p]){n=!1;break}a.push(s[p])}}catch(e){c=!0,u=e}finally{try{o||null==A.return||A.return()}finally{if(c)throw u}}return{fetchEntriesForField:n,searchString:a.join("|")}}),[i,l,s]),u=(0,g.useCallback)((function(){a||i.slice(l+1).map((function(e){o("address.".concat(e),"")}))}),[l,a,i,o]),d=(0,g.useMemo)((function(){return 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){Er(e,t,n[t])}))}return e}({},c),t=null!=(t={updateChildElements:u})?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;var e,t}),[c,u]);return d}const Or=function(){return h().createElement("svg",{focusable:"false",preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",width:"16",height:"16",viewBox:"0 0 32 32","aria-hidden":"true",className:"cds--list-box__menu-item__selected-icon"},h().createElement("path",{d:"M13 24L4 15 5.414 13.586 13 21.171 26.586 7.586 28 9 13 24z"}))};function Sr(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 Br(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sr(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)?Sr(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 jr=function(e){var t,n,r=e.entries,i=e.fieldProps,a=e.handleInputChange,o=e.handleSelection,s=Tr((0,g.useState)(-1),2),l=s[0],c=s[1],u=i.value,d=void 0===u?"":u,A=Tr((0,g.useState)(!1),2),p=A[0],m=A[1],f=(0,g.useRef)(null),_=(0,g.useCallback)((function(){m(!0),c(-1)}),[m,c]),b=(0,g.useMemo)((function(){return r?d?r.filter((function(e){return e.toLowerCase().includes(d.toLowerCase())})):r:[]}),[r,d]),v=(0,g.useCallback)((function(e){var t;null===(t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||void 0===t||t.preventDefault(),o(e),m(!1)}),[o,m]),y=(0,g.useCallback)((function(e){var t,n=null!==(t=b.length)&&void 0!==t?t:0;"Tab"===e.key&&(m(!1),c(-1)),"ArrowUp"===e.key?c((function(e){return Math.max(-1,e-1)})):"ArrowDown"===e.key?c((function(e){return Math.min(n-1,e+1)})):"Enter"===e.key&&l>-1&&v(b[l],e)}),[l,v,b,c,m]);return(0,g.useEffect)((function(){var e=function(e){f.current.contains(e.target)||(m(!1),c(-1))};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}})),h().createElement("div",{className:at.comboInput,ref:f},h().createElement(Ie.mh4,null,h().createElement(Ie.oil,(t=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){Br(e,t,n[t])}))}return e}({},i),n=null!=(n={onChange:function(e){c(-1),a(e.target.value)},onFocus:_,autoComplete:"off",onKeyDown:y})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))),h().createElement("div",{className:at.comboInputEntries},p&&h().createElement("div",{className:"cds--combo-box cds--list-box cds--list-box--expanded"},h().createElement("div",{id:"downshift-1-menu",className:"cds--list-box__menu",role:"listbox"},b.map((function(e,t){return h().createElement("div",{className:je()("cds--list-box__menu-item",{"cds--list-box__menu-item--highlighted":t===l}),key:t,id:"downshift-1-item-0",role:"option",tabIndex:-1,"aria-selected":"true",onClick:function(){return v(e)}},h().createElement("div",{className:je()("cds--list-box__menu-item__option",at.comboInputItemOption,{"cds--list-box__menu-item--active":e===d})},e,e===d&&h().createElement(Or,null)))}))))))};function Pr(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 Fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xr(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){Fr(e,t,n[t])}))}return e}const Ir=function(e){var t=e.orderedAddressFields;return(0,Ge.useTranslation)().t,h().createElement(h().Fragment,null,t.map((function(e){return h().createElement(Nr,{key:e.id,attribute:e})})))};var Nr=function(e){var t,n,i,a,o,s,l=e.attribute,c=(0,Ge.useTranslation)().t,u=(i=(0,Le.U$)("address.".concat(l.name)),a=3,function(e){if(Array.isArray(e))return e}(i)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(i,a)||function(e,t){if(e){if("string"==typeof e)return Pr(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)?Pr(e,t):void 0}}(i,a)||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=u[0],A=u[1],p=u[2].setValue,m=kr(l.name),f=m.fetchEntriesForField,_=m.searchString,b=m.updateChildElements,v=function(e,t){var n=encodeURIComponent(t),i=Fe()(e?"module/addresshierarchy/ajax/getChildAddressHierarchyEntries.form?searchString=".concat(n):null,r.openmrsFetch),a=i.data,o=i.isLoading,s=i.error;return(0,g.useEffect)((function(){s&&console.error(s)}),[s]),(0,g.useMemo)((function(){var e,t;return{entries:null===(t=a)||void 0===t||null===(e=t.data)||void 0===e?void 0:e.map((function(e){return e.name})),isLoadingAddressEntries:o,errorFetchingAddressEntries:s}}),[a,o,s])}(f,_).entries,y=c(l.label)+((null===(t=l)||void 0===t?void 0:t.required)?"":" (".concat(c("optional","optional"),")")),C=(0,g.useCallback)((function(e){p(e)}),[p]),w=(0,g.useCallback)((function(e){A.value!==e&&(p(e),b())}),[b,A.value,p]);return h().createElement(jr,{entries:v,handleSelection:w,name:"address.".concat(l.name),fieldProps:(o=xr({},d),s={id:l.name,labelText:y,required:null===(n=l)||void 0===n?void 0:n.required},s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(s)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(s)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(s,e))})),o),handleInputChange:C})},Ur=n(5671),Gr={};Gr.styleTagTransform=nt(),Gr.setAttributes=Qe(),Gr.insert=Xe().bind(null,"head"),Gr.domAPI=Ye(),Gr.insertStyleElement=et(),Ze()(Ur.Z,Gr);const Lr=Ur.Z&&Ur.Z.locals?Ur.Z.locals:void 0;function Mr(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 Rr(e,t){if(e){if("string"==typeof e)return Mr(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)?Mr(e,t):void 0}}const qr=function(e){var t,n,i=e.addressLayout,a=(0,Ge.useTranslation)().t,o=" > ",s=(0,g.useRef)(null),l=(0,g.useRef)(null),c=(t=(0,g.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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||Rr(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],A=function(e,t){var n,i,a=Fe()(e?"/module/addresshierarchy/ajax/getPossibleFullAddresses.form?separator=".concat(t,"&searchString=").concat(e):null,r.openmrsFetch),o=a.data,s=a.error,l=a.isLoading,c=(0,g.useMemo)((function(){var e,t;return{addresses:null!==(i=null===(t=o)||void 0===t||null===(e=t.data)||void 0===e?void 0:e.map((function(e){return e.address})))&&void 0!==i?i:[],error:s,isLoading:l}}),[null===(n=o)||void 0===n?void 0:n.data,s,l]);return c}(u,o),p=A.addresses,m=(A.isLoading,A.error,(0,g.useMemo)((function(){var e=new Set;return p.forEach((function(t){var n=t.split(o);n.forEach((function(t,r){t.toLowerCase().includes(u.toLowerCase())&&e.add(n.slice(0,r+1).join(o))}))})),function(e){return function(e){if(Array.isArray(e))return Mr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Rr(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)}),[p,u])),f=(0,Le.u6)().setFieldValue,_=function(e){l.current&&!l.current.contains(e.target)&&d("")};return(0,g.useEffect)((function(){return document.addEventListener("mousedown",_),function(){document.removeEventListener("mousedown",_)}}),[l]),h().createElement("div",{className:Lr.autocomplete,ref:l,style:{marginBottom:"1rem"}},h().createElement(Ie.olm,{onChange:function(e){d(e.target.value)},labelText:a("searchAddress","Search address"),placeholder:a("searchAddress","Search address"),ref:s,value:u}),m.length>0&&h().createElement("ul",{className:Lr.suggestions},m.map((function(e,t){return h().createElement("li",{key:t,onClick:function(t){return function(e){if(e){var t=e.split(o);i.map((function(e,n){var r,i,a=e.name;f("address.".concat(a),null!==(i=null===(r=t)||void 0===r?void 0:r[n])&&void 0!==i?i:"")})),d("")}}(e)}},e)}))))};function zr(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 Wr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||Vr(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 Vr(e,t){if(e){if("string"==typeof e)return zr(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)?zr(e,t):void 0}}var Zr=function(){var e=Wr((0,g.useState)(""),2),t=e[0],n=(e[1],(0,g.useContext)(O).addressTemplate),i=(0,g.useMemo)((function(){var e,t,r,i,a,o;if(!(null===(e=n)||void 0===e?void 0:e.lines))return[];var s=null===(i=null===(r=n)||void 0===r||null===(t=r.lines)||void 0===t?void 0:t.flat())||void 0===i?void 0:i.filter((function(e){return"IS_ADDR_TOKEN"===e.isToken})),l=Object.fromEntries((null===(o=n)||void 0===o||null===(a=o.requiredElements)||void 0===a?void 0:a.map((function(e){return[e,e]})))||[]);return s.map((function(e){var t=e.displayText,n=e.codeName;return{id:n,name:n,label:t,required:Boolean(l[n])}}))}),[n]),a=(0,Ge.useTranslation)().t,o=(0,r.useConfig)(),s=(0,r.useConnectivity)(),l=o.fieldConfigurations.address.useAddressHierarchy,c=l.enabled,u=l.useQuickSearch,d=l.searchAddressByLevel,A=(0,g.useContext)(ze).setFieldValue,p=Dr(),m=p.orderedFields,f=p.isLoadingFieldOrder,_=p.errorFetchingFieldOrder;(0,g.useEffect)((function(){var e;(null===(e=n)||void 0===e?void 0:e.elementDefaults)&&Object.entries(n.elementDefaults).forEach((function(e){var t=Wr(e,2),n=t[0],r=t[1];A("address.".concat(n),r)}))}),[n,A]);var b=(0,g.useMemo)((function(){if(f||_)return[];var e,t=Object.fromEntries(m.map((function(e,t){return[e,t]})));return(e=i,function(e){if(Array.isArray(e))return zr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Vr(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.")}()).sort((function(e,n){return t[e.name]-t[n.name]}))}),[f,_,m,i]);return n?c&&s?f?h().createElement(Hr,null,h().createElement(Ie.N2B,null)):_?h().createElement(Hr,null,h().createElement(Ie.K0D,{style:{margin:"0",minWidth:"100%"},kind:"error",lowContrast:!0,title:a("errorFetchingOrderedFields","Error occured fetching ordered fields for address hierarchy")})):h().createElement(Hr,null,u&&h().createElement(qr,{addressLayout:b}),d?h().createElement(Ir,{orderedAddressFields:b}):b.map((function(e,n){return h().createElement(en,{key:"combo_input_".concat(n),name:"address.".concat(e.name),labelText:a(e.label),id:e.name,value:t,required:e.required})}))):h().createElement(Hr,null,i.map((function(e,n){return h().createElement(en,{key:"combo_input_".concat(n),name:"address.".concat(e.name),labelText:a(e.label),id:e.name,value:t,required:e.required})}))):h().createElement(Hr,null,h().createElement(Ie.N2B,null))},Hr=function(e){var t=e.children,n=(0,Ge.useTranslation)().t;return h().createElement("div",null,h().createElement("h4",{className:rn.productiveHeading02Light},n("addressHeader","Address")),h().createElement("div",{style:{paddingBottom:"5%"}},t))};function Yr(){var e=(0,r.useConfig)(),t={id:"phone",type:"person attribute",uuid:e.fieldConfigurations.phone.personAttributeUuid,validation:e.fieldConfigurations.phone.validation,showHeading:!1};return h().createElement(vr,{fieldDefinition:t})}function Kr(e){var t=e.name,n=(0,r.useConfig)();if(!s.includes(t)&&!n.fieldDefinitions.some((function(e){return e.id==t})))return(0,r.reportError)("Invalid field name '".concat(t,"'. Valid options are '").concat(n.fieldDefinitions.map((function(e){return e.id})).concat(s).join("', '"),"'.")),null;switch(t){case"name":return h().createElement(ln,null);case"gender":return h().createElement(un,null);case"dob":return h().createElement(er,null);case"address":return h().createElement(Zr,null);case"id":return h().createElement(Zn,null);case"phone":return h().createElement(Yr,null);default:return h().createElement(Cr,{name:t})}}var Xr=function(e){var t=e.sectionDefinition;return h().createElement("section",{"aria-label":"".concat(t.name," Section")},t.fields.map((function(e){return h().createElement(Kr,{key:"".concat(t.name,"-").concat(e),name:e})})))};function Jr(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 Qr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $r(e,t){if(e){if("string"==typeof e)return Jr(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)?Jr(e,t):void 0}}var ei=function(e){var t,n,r,i,a=e.name,o=e.options,s=e.label,l=e.required,c=(t=(0,Le.U$)(a),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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||$r(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],u=(0,Ge.useTranslation)().t,d=[h().createElement(Ie.QlF,{disabled:!0,hidden:!0,text:"Select ".concat(s),key:"",value:""})].concat(function(e){return function(e){if(Array.isArray(e))return Jr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||$r(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.")}()}(o.map((function(e,t){return h().createElement(Ie.QlF,{text:e,value:e,key:t})})))),A=l?s:"".concat(s," (").concat(u("optional","optional"),")");return h().createElement("div",{style:{marginBottom:"1rem"}},h().createElement(Ie.mh4,null,h().createElement(Ie.PhF,(r=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){Qr(e,t,n[t])}))}return e}({id:"identifier"},c),i=null!=(i={labelText:A})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})),r),d)))},ti=n(2936),ni={};ni.styleTagTransform=nt(),ni.setAttributes=Qe(),ni.insert=Xe().bind(null,"head"),ni.domAPI=Ye(),ni.insertStyleElement=et(),Ze()(ti.Z,ni);const ri=ti.Z&&ti.Z.locals?ti.Z.locals:void 0;var ii=function(){var e=h().useContext(ze).values,t=(0,Ge.useTranslation)().t;return h().createElement("section",{className:ri.formSection,"aria-label":"Death Info Section"},h().createElement("h5",{className:je()("omrs-type-title-5",ri.formSectionTitle)},"Death Info"),h().createElement("section",{className:ri.fieldGroup},h().createElement(en,{labelText:t("isDeadInputLabel","Is Dead"),name:"isDead",id:"isDead"}),e.isDead&&h().createElement(h().Fragment,null,h().createElement(en,{labelText:t("deathDateInputLabel","Date of Death"),name:"deathDate",id:"deathDate"}),h().createElement(ei,{options:[t("unknown","Unknown"),t("stroke","Stroke")],label:t("causeOfDeathInputLabel","Cause of Death"),name:"deathCause"}))))};function ai(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 oi=function(e){var t,n,r=e.fields,i=(t=(0,Le.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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ai(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)?ai(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.")}()),a=i[0],o=i[1],s=(0,g.useContext)(ze).setFieldValue;return(0,g.useEffect)((function(){!a.value&&o.touched&&(s("additionalGivenName",""),s("additionalMiddleName",""),s("additionalFamilyName",""))}),[a.value,o.touched]),h().createElement("section",{className:ri.formSection,"aria-label":"Demographics Section"},r.map((function(e){return h().createElement(Kr,{key:"demographics-".concat(e),name:e})})))},si=n(1662),li={};li.styleTagTransform=nt(),li.setAttributes=Qe(),li.insert=Xe().bind(null,"head"),li.domAPI=Ye(),li.insertStyleElement=et(),Ze()(si.Z,li);const ci=si.Z&&si.Z.locals?si.Z.locals:void 0;function ui(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 di(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ai=function(e){var t,n,r=e.getDisplayValue,i=e.getFieldValue,a=e.getSearchResults,o=e.onSuggestionSelected,s=e.invalid,l=e.invalidText,c=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","invalid","invalidText"]),u=(t=(0,g.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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ui(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)?ui(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=u[0],A=u[1],p=(0,g.useRef)(null),m=(0,g.useRef)(null),f=c.id,_=c.labelText;(0,g.useEffect)((function(){return document.addEventListener("mousedown",b),function(){document.removeEventListener("mousedown",b)}}),[m]);var b=function(e){m.current&&!m.current.contains(e.target)&&A([])};return h().createElement("div",{className:ci.autocomplete,ref:m},h().createElement("label",{className:"cds--label"},_),h().createElement(Ie.mh4,{className:je()(di({},ci.invalid,s))},h().createElement(Ie.olm,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){di(e,t,n[t])}))}return e}({id:"autosuggest",onChange:function(e){var t=e.target.value;o(f,void 0),t?a(t).then((function(e){A(e)})):A([])},onClear:function(e){o(f,void 0)},ref:p,className:ci.autocompleteSearch},c))),d.length>0&&h().createElement("ul",{className:ci.suggestions},d.map((function(e,t){return h().createElement("li",{key:t,onClick:function(e){return function(e){var t=r(d[e]),n=i(d[e]);p.current.value=t,o(f,n),A([])}(t)}},r(e))}))),s?h().createElement("label",{className:je()(ci.invalidMsg)},l):h().createElement(h().Fragment,null))},pi=n(138),mi={};mi.styleTagTransform=nt(),mi.setAttributes=Qe(),mi.insert=Xe().bind(null,"head"),mi.domAPI=Ye(),mi.insertStyleElement=et(),Ze()(pi.Z,mi);const fi=pi.Z&&pi.Z.locals?pi.Z.locals:void 0;function _i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gi(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function hi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_i(e,t):void 0}}(e,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 vi=function(e){var t,n,r,i=e.relationship,a=e.index,o=e.displayRelationshipTypes,s=e.remove,l=(0,Ge.useTranslation)().t,c=h().useContext(ze).setFieldValue,u=bi((0,g.useState)(!1),2),d=u[0],A=u[1],p=!i.uuid,m=(0,g.useCallback)((function(e){var t,n=e.target,r=n.name,o=n.options[n.selectedIndex].value;c(r,o),(null===(t=i)||void 0===t?void 0:t.action)||c("relationships[".concat(a,"].action"),"UPDATE")}),[a,null===(t=i)||void 0===t?void 0:t.action,c]),f=(0,g.useCallback)((function(e,t){A(!t),c(e,t)}),[c]),_=function(){var e,t=(e=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: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,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,s])}}}(this,(function(n){switch(n.label){case 0:return t=new AbortController,[4,re(e,t)];case 1:return[2,n.sent()]}}))},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){gi(a,r,i,o,s,"next",e)}function s(e){gi(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e){return t.apply(this,arguments)}}(),b=(0,g.useCallback)((function(){"ADD"===i.action?s(a):c("relationships[".concat(a,"].action"),"DELETE")}),[i,a,s,c]),v=(0,g.useCallback)((function(){var e,t;c("relationships[".concat(a,"]"),(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){hi(e,t,n[t])}))}return e}({},i),t=null!=(t={action:void 0,relationshipType:i.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))}),[a,c,i]);return"DELETE"!==i.action?h().createElement("div",{className:fi.relationship},h().createElement("div",{className:fi.searchBox},h().createElement("div",{className:fi.relationshipHeader},h().createElement("h4",{className:fi.productiveHeading},l("relationshipPlaceholder","Relationship")),h().createElement(Ie.zxk,{kind:"ghost",iconDescription:l("deleteRelationshipTooltipText","Delete"),hasIconOnly:!0,onClick:b},h().createElement(Pn.ZN,{size:16,className:fi.trashCan}))),h().createElement("div",null,p?h().createElement(Ai,{id:"relationships[".concat(a,"].relatedPersonUuid"),labelText:l("relativeFullNameLabelText","Full name"),placeholder:l("relativeNamePlaceholder","Firstname Familyname"),defaultValue:i.relatedPersonName,onSuggestionSelected:f,invalid:d,invalidText:l("relationshipPersonMustExist","Related person must be an existing person"),getSearchResults:_,getDisplayValue:function(e){return e.display},getFieldValue:function(e){return e.uuid}}):h().createElement(h().Fragment,null,h().createElement("span",{className:fi.labelText},l("relativeFullNameLabelText","Full name")),h().createElement("p",{className:fi.bodyShort02},i.relatedPersonName)))),h().createElement("div",{className:fi.selectRelationshipType,style:{marginBottom:"1rem"}},h().createElement(Ie.mh4,null,h().createElement(Ie.PhF,{id:"select",labelText:l("relationship","Relationship"),onChange:m,name:"relationships[".concat(a,"].relationshipType"),defaultValue:null!==(r=null===(n=i)||void 0===n?void 0:n.relationshipType)&&void 0!==r?r:"placeholder-item"},h().createElement(Ie.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:l("relationshipToPatient","Relationship to patient")}),o.map((function(e,t){return h().createElement(Ie.QlF,{text:e.display,value:"".concat(e.uuid,"/").concat(e.direction),key:"relationship-".concat(e.uuid,"-").concat(t)})})))))):h().createElement(Ie.K0D,{kind:"info",title:l("relationshipRemovedText","Relationship removed"),actions:h().createElement(Ie.xho,{onClick:v},l("restoreRelationshipActionButton","Undo"))})},yi=function(){var e=(0,g.useContext)(O).relationshipTypes,t=bi((0,g.useState)([]),2),n=t[0],r=t[1],i=(0,Ge.useTranslation)().t;return(0,g.useEffect)((function(){if(e){var t=[];e.results.forEach((function(e){var n={display:e.displayAIsToB?e.displayAIsToB:e.displayBIsToA,uuid:e.uuid,direction:"aIsToB"},r={display:e.displayBIsToA?e.displayBIsToA:e.displayAIsToB,uuid:e.uuid,direction:"bIsToA"};n.display===r.display?t.push(n):"Patient"===r.display?t.push(n,{display:"Patient (".concat(n.display,")"),uuid:e.uuid,direction:"bIsToA"}):t.push(n,r)})),r(t)}}),[e]),e?h().createElement("section",{"aria-label":"Relationships section"},h().createElement(Le.F2,{name:"relationships"},(function(e){var t=e.push,r=e.remove,a=e.form.values.relationships;return h().createElement("div",null,a&&a.length>0?a.map((function(e,t){return h().createElement("div",{key:t,className:ri.formSection},h().createElement(vi,{relationship:e,index:t,displayRelationshipTypes:n,key:t,remove:r}))})):null,h().createElement("div",{className:fi.actions},h().createElement(Ie.zxk,{kind:"ghost",onClick:function(){return t({relatedPersonUuid:"",action:"ADD"})}},i("addRelationshipButtonText","Add Relationship"))))}))):h().createElement("section",{"aria-label":"Loading relationships section"},h().createElement(Ie.N2B,{role:"progressbar"}))};function Ci(e){var t=e.sectionDefinition;switch(t.id){case"demographics":return h().createElement(oi,{fields:t.fields});case"death":return h().createElement(ii,null);case"relationships":return h().createElement(yi,null);default:return h().createElement(Xr,{sectionDefinition:t})}}var wi=function(e){var t=e.sectionDefinition,n=e.index,r=(0,Ge.useTranslation)().t;return h().createElement("div",{id:t.id,style:{scrollMarginTop:"4rem"}},h().createElement("h3",{className:Jt.productiveHeading02,style:{color:"#161616"}},n+1,". ",r("".concat(t.id,"Section"),t.name)),h().createElement("span",{className:Jt.label01},r("allFieldsRequiredText","All fields are required unless marked optional")),h().createElement("div",{style:{margin:"1rem 0 1rem"}},h().createElement(Ie.n9L,null,h().createElement(Ci,{sectionDefinition:t}))))};function Ei(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}const Di=function(e){var t,n,i=e.when,a=e.redirect,o=(0,Ge.useTranslation)().t,s=(0,g.useRef)(!1),l=(t=(0,g.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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ei(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)?Ei(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=l[0],u=l[1],d=c||a,A=(0,g.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]),p=(0,g.useCallback)((function(e){if(!e.detail.navigationIsCanceled&&!s.current){s.current=!0,e.detail.cancelNavigation();var t=(0,r.showModal)("cancel-patient-edit-modal",{onConfirm:function(){u(e.detail.newUrl),t()}},(function(){s.current=!1}))}}),[]);return(0,g.useEffect)((function(){if(i&&void 0===d)return window.addEventListener("single-spa:before-routing-event",p),window.addEventListener("beforeunload",A),function(){window.removeEventListener("beforeunload",A),window.removeEventListener("single-spa:before-routing-event",p)}}),[d,i,A,p]),(0,g.useEffect)((function(){var e,t;"string"==typeof d&&(0,r.navigate)({to:"${openmrsSpaBase}/".concat((e=d,null===(t=e.split(window.getOpenmrsSpaBase()))||void 0===t?void 0:t[1]))})}),[d]),null};var ki=n(4113),Oi={};Oi.styleTagTransform=nt(),Oi.setAttributes=Qe(),Oi.insert=Xe().bind(null,"head"),Oi.domAPI=Ye(),Oi.insertStyleElement=et(),Ze()(ki.Z,Oi);const Si=ki.Z&&ki.Z.locals?ki.Z.locals:void 0;var Bi=[{name:"Kenya",initials:"KE"},{name:"Uganda",initials:"UG"},{name:"Tanzania",initials:"TZ"}],Ti=[{name:"National ID",value:"national-id"},{name:"Passport",value:"passport"},{name:"Birth certificate number",value:"birth-certificate"}];function ji(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 Pi(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Fi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xi(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){Fi(e,t,n[t])}))}return e}function Ii(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 Ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ji(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)?ji(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 Ui=function(e){var t,n,i=e.props,a=(0,Ge.useTranslation)().t,o=jt(),s=(o.data,o.isLoading),l=o.error,c=Ni((0,g.useState)({searchTerm:"",identifierType:"",countryCode:"KE"}),2),u=c[0],d=c[1],A=Ni((0,g.useState)(!1),2),p=A[0],m=A[1],f=function(){var e,t=(e=function(){var e;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: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,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,s])}}}(this,(function(t){switch(t.label){case 0:m(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,kt(u.identifierType,u.searchTerm,i.values.token,u.countryCode)];case 2:return e=t.sent(),m(!1),function(e,t,n){var i,a;if(!1===(null===(i=e)||void 0===i?void 0:i.clientExists))var o=gt({},"nationalId",{initialValue:n,identifierUuid:void 0,selectedSource:{uuid:"",name:""},preferred:!1,required:!1,identifierTypeUuid:"49af6cdc-7968-4abb-bf46-de10d7f4859f",identifierName:"National ID",identifierValue:n}),s=(0,r.showModal)("empty-client-registry-modal",{onConfirm:function(){t.setValues(bt(ht({},t.values),{identifiers:ht({},t.values.identifiers,o)})),s()},close:function(){return s()}});if(null===(a=e)||void 0===a?void 0:a.clientExists)var l,c,u,d=e.client,A=d.middleName,p=d.lastName,m=d.firstName,f=d.contact,_=(d.country,d.countyOfBirth,d.residence),g=d.identifications,h=(d.gender,d.dateOfBirth),b=d.isAlive,v=d.clientNumber,y=(d.educationLevel,d.occupation,d.maritalStatus,gt(u={},"nationalId",{initialValue:void 0!==g&&(null===(l=g[0])||void 0===l?void 0:l.identificationNumber),identifierUuid:void 0,selectedSource:{uuid:"",name:""},preferred:!1,required:!1,identifierTypeUuid:"49af6cdc-7968-4abb-bf46-de10d7f4859f",identifierName:"National ID",identifierValue:void 0!==g&&(null===(c=g[0])||void 0===c?void 0:c.identificationNumber)}),gt(u,"nationalUniquePatientIdentifier",{identifierTypeUuid:"f85081e2-b4be-4e48-b3a4-7994b69bb101",identifierName:"National Unique patient identifier",identifierValue:v,initialValue:v,identifierUuid:void 0,selectedSource:{uuid:"",name:""},preferred:!1,required:!1}),u),C=(0,r.showModal)("confirm-client-registry-modal",{onConfirm:function(){var n,r,i,a,o,s,l,c,u,d,g,v,w,E,D,k,O,S;t.setValues(bt(ht({},t.values),{familyName:p,middleName:A,givenName:m,gender:e.client.gender,birthdate:new Date(h),isDead:!b,attributes:{"b2c38640-2603-4629-aebd-3b54f33f1e3a":null===(n=f)||void 0===n?void 0:n.primaryPhone,"94614350-84c8-41e0-ac29-86bc107069be":null===(r=f)||void 0===r?void 0:r.secondaryPhone,"b8d0b331-1d2d-4a9a-b741-1816f498bdb6":null!==(w=null===(i=f)||void 0===i?void 0:i.emailAddress)&&void 0!==w?w:""},address:{address1:null===(a=_)||void 0===a?void 0:a.address,address2:"",address4:(0,_t.Z)(null!==(E=null===(o=_)||void 0===o?void 0:o.ward)&&void 0!==E?E:""),cityVillage:null===(s=_)||void 0===s?void 0:s.village,stateProvince:(0,_t.Z)(null!==(D=null===(l=_)||void 0===l?void 0:l.subCounty)&&void 0!==D?D:""),countyDistrict:null===(c=ft.find((function(e){return e.code===parseInt(_?.county)})))||void 0===c?void 0:c.name,country:"Kenya",postalCode:null===(u=_)||void 0===u?void 0:u.address},identifiers:ht({},t.values.identifiers,y),obs:{"1054AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA":null!==(k=null===(d=t.values.concepts.find((function(t){return t.display?.toLowerCase()?.includes(e.client.maritalStatus?.toLowerCase())})))||void 0===d?void 0:d.uuid)&&void 0!==k?k:"","1712AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA":null!==(O=null===(g=t.values.concepts.find((function(t){return t.display?.toLowerCase()?.includes(e.client.educationLevel?.toLowerCase())})))||void 0===g?void 0:g.uuid)&&void 0!==O?O:"","1542AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA":void 0===e.client.occupation||null===e.client.occupation?"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA":null!==(S=null===(v=t.values.concepts.find((function(t){return t.display?.toLowerCase()===e.client.occupation?.toLowerCase()})))||void 0===v?void 0:v.uuid)&&void 0!==S?S:"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}})),C()},close:function(){return C()},patient:e.client})}(e,i,u.searchTerm),[3,4];case 3:return t.sent(),(0,r.showSnackbar)({title:"Client registry error",subtitle:"Please reload the registration page and re-try again, if the issue persist contact system administrator",timeoutInMs:1e4,kind:"error",isLowContrast:!0}),m(!1),[3,4];case 4:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Pi(a,r,i,o,s,"next",e)}function s(e){Pi(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(){return t.apply(this,arguments)}}();return h().createElement("div",{id:"patientVerification"},h().createElement("h3",{className:Si.productiveHeading02,style:{color:"#161616"}},a("clientVerificationWithClientRegistry","Client verification with client registry")),h().createElement("div",{style:{margin:"1rem 0 1rem"}},h().createElement(Ie.mh4,null,s&&h().createElement(Ie.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."})),l&&h().createElement(Ie.K0D,{className:Si.errorWrapper,"aria-label":"closes notification",kind:"error",lowContrast:!0,statusIconDescription:"notification",subtitle:a("clientRegistryErrorSubtitle","Please proceed with registration contact system admin and try again later"),title:a("clientRegistryError","Error occurred while reaching the client registry")}),h().createElement(Ie.n9L,{className:Si.verificationWrapper},h().createElement(Ie.mh4,null,h().createElement(Ie.CtY,{ariaLabel:a("selectCountry","Select country"),id:"selectCountry",items:Bi,itemToString:function(e){var n;return null!==(t=null===(n=e)||void 0===n?void 0:n.name)&&void 0!==t?t:""},label:"Select country",titleText:a("selectCountry","Select country"),initialSelectedItem:Bi[0],onChange:function(e){var t,n=e.selectedItem;return d(Ii(xi({},u),{countryCode:null===(t=n)||void 0===t?void 0:t.initials}))}})),h().createElement(Ie.mh4,null,h().createElement(Ie.CtY,{ariaLabel:a("selectIdentifierType","Select identifier type"),id:"selectIdentifierType",items:Ti,itemToString:function(e){var t;return null!==(n=null===(t=e)||void 0===t?void 0:t.name)&&void 0!==n?n:""},label:"Select identifier type",titleText:a("selectIdentifierType","Select identifier type"),onChange:function(e){var t,n=e.selectedItem;return d(Ii(xi({},u),{identifierType:null===(t=n)||void 0===t?void 0:t.value}))}})),h().createElement(Ie.mh4,null,h().createElement(Ie.olm,{id:"clientRegistrySearch",autoFocus:!0,placeHolderText:a("searchClientRegistry","Search client registry"),disabled:!u.identifierType,onChange:function(e){return d(Ii(xi({},u),{searchTerm:e.target.value}))}})),p?h().createElement(Ie.lSo,{status:"active",iconDescription:"Loading",description:"Searching client registry"}):h().createElement(Ie.zxk,{disabled:!u.identifierType&&!s,size:"md",onClick:f},a("validate","Validate")))))};function Gi(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 Li(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Mi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ri(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gi(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)?Gi(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 qi=function(e){var t,n,i,a,s,l,c=e.savePatientForm,u=e.isOffline,d=(0,g.useContext)(O),A=d.currentSession,m=(d.addressTemplate,d.identifierTypes),f=(0,xe.useLocation)().search,_=(0,r.useConfig)(),b=Ri((0,g.useState)(),2),y=b[0],C=b[1],w=(0,xe.useParams)().patientUuid,E=(0,r.usePatient)(w),D=E.isLoading,k=E.patient,S=(0,Ge.useTranslation)().t,B=Ri((0,g.useState)(null),2),T=B[0],j=B[1],P=Ri(function(e){var t=function(){var e,t,n,i,a,o,s,l=(0,r.useConfig)(),c=(a=(i=(0,mt.ZP)("/ws/rest/v1/concept/".concat("1712AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"),r.openmrsFetch)).data,o=i.error,s=i.isLoading,o&&(0,r.showToast)({title:o.name,description:o.message,kind:"error"}),{data:null!==(n=null===(t=a)||void 0===t||null===(e=t.data)||void 0===e?void 0:e.answers)&&void 0!==n?n:[],isLoading:s}),u=c.data,d=c.isLoading;return{martialStatus:l.fieldDefinitions.find((function(e){return"maritalStatus"===e.id})).customConceptAnswers.map((function(e){return{uuid:e.uuid,display:e.label}})),education:u,occupation:[{uuid:"1538AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",display:"Farmer"},{uuid:"1540AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",display:"Employee"},{uuid:"1539AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",display:"Trader"},{uuid:"159465AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",display:"Student"},{uuid:"159466AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",display:"Driver"},{uuid:"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",display:"None"},{uuid:"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",display:"Other"}],educationLoad:d}}(),n=t.martialStatus,i=t.education,a=t.occupation,o=t.educationLoad,s=(0,r.usePatient)(e),l=s.isLoading,c=s.patient,u=Yt(e),d=u.data,A=u.isLoading,m=function(e){var t=!!e,n=(0,mt.ZP)(t?"".concat(r.restBaseUrl,"/patient/").concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)"):null,r.openmrsFetch),i=n.data,a=n.error,o=n.isLoading,s=(0,g.useMemo)((function(){var e,t,n,r={};return null===(n=i)||void 0===n||null===(t=n.data)||void 0===t||null===(e=t.results)||void 0===e||e.forEach((function(e){r[(0,v.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:r,isLoading:o}}),[i,a]);return s}(e),f=m.data,_=m.isLoading,h=function(e){var t=!!e,n=(0,mt.ZP)(t?"".concat(r.restBaseUrl,"/relationship?v=").concat(p,"&person=").concat(e):null,r.openmrsFetch),i=n.data,a=n.error,o=n.isLoading;return(0,g.useMemo)((function(){var t,n;return{data:null===(n=i)||void 0===n||null===(t=n.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:o}}),[e,i,a])}(e),b=h.data,y=h.isLoading,C=function(e){var t,n,i,a=(0,r.useConfig)().registrationObs.encounterTypeUuid,o="/ws/rest/v1/encounter?patient=".concat(e,"&encounterType=").concat(a,"&v=custom:(obs:(uuid,display,concept:(uuid,display),value:(uuid,display)))"),s=(0,mt.ZP)(e?o:null,r.openmrsFetch),l=s.data,c=s.isLoading,u=s.error,d={};return null===(n=(0,pt.Z)(l?.data?.results))||void 0===n||null===(t=n.obs)||void 0===t||t.forEach((function(e){Object.assign(d,Lt({},e.concept.uuid,e.value.uuid))})),{data:d,isLoading:c,error:u,obs:null===(i=l)||void 0===i?void 0:i.data}}(e),w=C.data,E=C.isLoading,D=C.obs,k=jt(),O=k.data,S=k.isLoading,B=qt((0,g.useState)({patientUuid:(0,We.Z)(),givenName:"",middleName:"",familyName:"",additionalGivenName:"",additionalMiddleName:"",additionalFamilyName:"",addNameInLocalLanguage:!1,gender:"",birthdate:null,yearsEstimated:0,monthsEstimated:0,birthdateEstimated:!1,telephoneNumber:"",isDead:!1,deathDate:"",deathCause:"",relationships:[],identifiers:{},address:{}}),2),T=B[0],j=B[1];return(0,g.useEffect)((function(){Gt((function(){var t,n,i,a,o,s;return Vt(this,(function(u){switch(u.label){case 0:return c?(t=!/^\d{4}-\d{2}-\d{2}$/.test(c.birthDate),(n=qt(c.birthDate.split("-").map((function(e){return parseInt(e)})),2))[0],n[1],i=c.birthDate.split("-").length>1,a=t?Math.floor(It()().diff(c.birthDate,"month")/12):0,o=t&&i?It()().diff(c.birthDate,"month")%12:0,j(Rt(Mt(Rt(Mt({},T,(h={},b=(d=c).name[0],y=d.name[1],h.patientUuid=d.id,h.givenName=null===(A=b)||void 0===A?void 0:A.given[0],h.middleName=null===(p=b)||void 0===p?void 0:p.given[1],h.familyName=null===(m=b)||void 0===m?void 0:m.family,h.addNameInLocalLanguage=!!y||void 0,h.additionalGivenName=null===(f=y)||void 0===f?void 0:f.given[0],h.additionalMiddleName=null===(_=y)||void 0===_?void 0:_.given[1],h.additionalFamilyName=null===(g=y)||void 0===g?void 0:g.family,h.gender=d.gender,h.birthdate=d.birthDate?(0,r.parseDate)(d.birthDate):void 0,h.telephoneNumber=d.telecom?d.telecom[0].value:"",(d.deceasedBoolean||d.deceasedDateTime)&&(h.isDead=!0,h.deathDate=d.deceasedDateTime?d.deceasedDateTime.split("T")[0]:""),ut({},h,d.identifier.map((function(e){return ct({},(0,v.Z)(e.system||e.type.text),e.value)}))))),{address:At(c)}),function(e){var t={};return e.telecom&&(t.phone=e.telecom[0].value),t}(c)),{birthdateEstimated:!/^\d{4}-\d{2}-\d{2}$/.test(c.birthDate),yearsEstimated:a,monthsEstimated:o})),[3,3]):[3,1];case 1:return l||!e?[3,3]:[4,Zt(e)];case 2:if(!(s=u.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];j(s._patientRegistrationData.formValues),u.label=3;case 3:return[2]}var d,A,p,m,f,_,g,h,b,y}))}))()}),[l,c,e]),(0,g.useEffect)((function(){!S&&O&&j((function(e){return Rt(Mt({},e),{token:String(O.access_token)})}))}),[S,O]),(0,g.useEffect)((function(){!y&&b&&j((function(e){return Rt(Mt({},e),{relationships:b})}))}),[y,b,j]),(0,g.useEffect)((function(){!_&&f&&j((function(e){return Rt(Mt({},e),{identifiers:f})}))}),[_,f,j]),(0,g.useEffect)((function(){if(!A&&d){var e={};d.forEach((function(t){var n;e[t.attributeType.uuid]="org.openmrs.Concept"===t.attributeType.format&&"object"==typeof t.value?null===(n=t.value)||void 0===n?void 0:n.uuid:t.value})),j((function(t){return Rt(Mt({},t),{attributes:e})}))}}),[d,j,A]),(0,g.useEffect)((function(){E||j((function(e){return Rt(Mt({},e),{obs:w,observation:D})}))}),[E]),(0,g.useEffect)((function(){o||j((function(e){return Rt(Mt({},e),{concepts:zt(a).concat(zt(n),zt(i))})}))}),[o]),[T,j]}(w),2),F=P[0],x=P[1],I=Ri(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,r.usePatient)(e),i=n.isLoading,a=n.patient,o=qt((0,g.useState)(t),2),s=o[0],l=o[1];return(0,g.useEffect)((function(){Gt((function(){var n,r,o;return Vt(this,(function(c){switch(c.label){case 0:return a?(l(Rt(Mt({},s),{address:At(a)})),[3,3]):[3,1];case 1:return i||!e?[3,3]:[4,Zt(e)];case 2:r=c.sent(),l(null!==(o=null===(n=r)||void 0===n?void 0:n._patientRegistrationData.initialAddressFieldValues)&&void 0!==o?o:t),c.label=3;case 3:return[2]}}))}))()}),[i,a,e]),[s,l]}(w),1),N=I[0],U=Ri(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,r.usePatient)(e),i=n.isLoading,a=n.patient,o=Yt(e).data,s=qt((0,g.useState)(t),2),l=s[0],c=s[1];return(0,g.useEffect)((function(){if(a)c(Mt({},l,(A=(r=a).name[0],p=r.name[1],m=null===(o=r.address)||void 0===o?void 0:o[0],ut({preferredNameUuid:null===(s=A)||void 0===s?void 0:s.id,additionalNameUuid:null===(u=p)||void 0===u?void 0:u.id,preferredAddressUuid:null===(d=m)||void 0===d?void 0:d.id},r.identifier.map((function(e){return ct({},(0,v.Z)(e.system||e.type.text),{uuid:e.id,value:e.value})}))))));else if(!i&&e){var n;Zt(e).then((function(e){var r;return c(null!==(n=null===(r=e)||void 0===r?void 0:r._patientRegistrationData.initialAddressFieldValues)&&void 0!==n?n:t)}))}var r,o,s,u,d,A,p,m}),[i,a,e]),(0,g.useEffect)((function(){o&&c((function(e){return Mt({},e,function(e){var t={};return e.forEach((function(e){var n,r,i;t["attribute.".concat(null===(r=e)||void 0===r||null===(n=r.attributeType)||void 0===n?void 0:n.uuid)]=null===(i=e)||void 0===i?void 0:i.uuid})),t}(o))}))}),[o]),[l,c]}(w),1)[0],G=null===(n=A)||void 0===n||null===(t=n.sessionLocation)||void 0===t?void 0:t.uuid,L=D?void 0:!(!w||!k),M=(0,g.useMemo)((function(){return"true"===localStorage.getItem("openmrs:devtools")&&!L}),[L]),R=(0,r.usePatientPhoto)(null===(i=k)||void 0===i?void 0:i.id).data,q=(0,g.useRef)(new Ce),z=(null===(s=_)||void 0===s||null===(a=s.fieldDefinitions)||void 0===a||a.filter((function(e){return"address"===e.type})),function(e){return Me.Ry({givenName:Me.Z_().required("givenNameRequired"),familyName:Me.Z_().required("familyNameRequired"),additionalGivenName:Me.Z_().when("addNameInLocalLanguage",{is:!0,then:Me.Z_().required("givenNameRequired"),otherwise:Me.Z_().notRequired()}),additionalFamilyName:Me.Z_().when("addNameInLocalLanguage",{is:!0,then:Me.Z_().required("familyNameRequired"),otherwise:Me.Z_().notRequired()}),gender:Me.Z_().oneOf(e.fieldConfigurations.gender.map((function(e){return e.value})),"genderUnspecified").required("genderRequired"),birthdate:Me.hT().when("birthdateEstimated",{is:!1,then:Me.hT().required("birthdayRequired").max(Date(),"birthdayNotInTheFuture").nullable(),otherwise:Me.hT().nullable()}),yearsEstimated:Me.Rx().when("birthdateEstimated",{is:!0,then:Me.Rx().required("yearsEstimateRequired").min(0,"negativeYears"),otherwise:Me.Rx().nullable()}),monthsEstimated:Me.Rx().min(0,"negativeMonths"),deathDate:Me.hT().max(Date(),"deathdayNotInTheFuture").nullable(),email:Me.Z_().optional().email("invalidEmail"),identifiers:Me.Vo((function(e){return Me.Ry(qe()(e,(function(){return Me.Ry({required:Me.Xg(),identifierValue:Me.Z_().when("required",{is:!0,then:Me.Z_().required("identifierValueRequired"),otherwise:Me.Z_().notRequired()})})})))})),relationships:Me.IX().of(Me.Ry().shape({relatedPersonUuid:Me.Z_().required(),relationshipType:Me.Z_().required()}))})}(_)),W=Ri((0,g.useState)(!!L&&(null===(l=F.identifiers.nationalUniquePatientIdentifier)||void 0===l?void 0:l.identifierValue)),2),V=W[0],Z=W[1];(0,g.useEffect)((function(){}),[F]);var H=(0,g.useMemo)((function(){var e;return _.sections.map((function(t){return null!==(e=_.sectionDefinitions.filter((function(e){return e.id==t}))[0])&&void 0!==e?e:o.filter((function(e){return e.id==t}))[0]})).filter((function(e){return e}))}),[_.sections,_.sectionDefinitions]),Y=function(){var e,t=(e=function(e,t){var n,i,a,o,s,l,u,d,p,m,g,h,b,v;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: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,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,s])}}}(this,(function(y){switch(y.label){case 0:n=new AbortController,t.setSubmitting(!0),i=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}(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){Mi(e,t,n[t])}))}return e}({},e),{identifiers:(w=e.identifiers,Object.fromEntries(Object.entries(w).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,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return lt(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)?lt(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}))))}),y.label=1;case 1:return y.trys.push([1,3,,4]),[4,c(!L,i,U,N,T,G,F.identifiers,A,_,q.current,n)];case 2:return y.sent(),(0,r.showSnackbar)({subtitle:L?S("updatePatientSuccessSnackbarSubtitle","The patient's information has been successfully updated"):S("registerPatientSuccessSnackbarSubtitle","The patient can now be found by searching for them using their name or ID number"),title:L?S("updatePatientSuccessSnackbarTitle","Patient Details Updated"):S("registerPatientSuccessSnackbarTitle","New Patient Created"),kind:"success",isLowContrast:!0}),a=new URLSearchParams(f).get("afterUrl"),o=(0,r.interpolateUrl)(a||_.links.submitButton,{patientUuid:e.patientUuid}),C(o),[3,4];case 3:return s=y.sent(),h=Object.entries((null===(u=s.responseBody)||void 0===u||null===(l=u.error)||void 0===l?void 0:l.fieldErrors)||{}),q.current.patientSaved&&(h.forEach((function(e){var t=Ri(e,2),n=(t[0],t[1].map((function(e){return e.message})).join(", "));(0,r.showSnackbar)({subtitle:n,title:"Patient registration successful, with errors for registration encounter",kind:"warning",timeoutInMs:8e3})})),b=new URLSearchParams(f).get("afterUrl"),v=(0,r.interpolateUrl)(b||_.links.submitButton,{patientUuid:e.patientUuid}),C(v)),(null===(p=s.responseBody)||void 0===p||null===(d=p.error)||void 0===d?void 0:d.globalErrors)?s.responseBody.error.globalErrors.forEach((function(e){(0,r.showSnackbar)({title:L?S("updatePatientErrorSnackbarTitle","Patient Details Update Failed"):S("registrationErrorSnackbarTitle","Patient Registration Failed"),subtitle:e.message,kind:"error"})})):(null===(g=s.responseBody)||void 0===g||null===(m=g.error)||void 0===m?void 0:m.message)?(0,r.showSnackbar)({title:L?S("updatePatientErrorSnackbarTitle","Patient Details Update Failed"):S("registrationErrorSnackbarTitle","Patient Registration Failed"),subtitle:s.responseBody.error.message,kind:"error"}):((0,r.createErrorHandler)()(s),console.error(s)),t.setSubmitting(!1),[3,4];case 4:return[2]}var w}))},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Li(a,r,i,o,s,"next",e)}function s(e){Li(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e,n){return t.apply(this,arguments)}}(),K=function(e){e&&"object"==typeof e&&Object.keys(e).length&&Object.keys(e).forEach((function(e){(0,r.showSnackbar)({subtitle:S("".concat(e,"LabelText"),e),title:S("incompleteForm","The following field has errors:"),kind:"warning",isLowContrast:!0,timeoutInMs:5e3})}))};return h().createElement(Le.J9,{enableReinitialize:!0,initialValues:F,validationSchema:z,onSubmit:Y},(function(e){var t;return h().createElement(Le.l0,{className:Jt.form},h().createElement(Di,{when:e.dirty,redirect:y}),h().createElement("div",{className:Jt.formContainer},h().createElement("div",null,h().createElement("div",{className:Jt.stickyColumn},h().createElement("h4",null,L?S("editPatientDetails","Edit patient details"):S("createNewPatient","Create new patient")),M&&h().createElement(st,{setValues:e.setValues}),h().createElement("p",{className:Jt.label01},S("jumpTo","Jump to")),H.map((function(e){return h().createElement("div",{className:je()(Jt.space05,Jt.touchTarget),key:e.name},h().createElement(Ie.rUS,{className:Jt.linkName,onClick:function(){return t=e.id,void document.getElementById(t).scrollIntoView({behavior:"smooth",block:"center",inline:"center"});var t}},h().createElement(Ne.Kc,{size:16})," ",S("".concat(e.id,"Section"),e.name)))})),h().createElement(Ie.zxk,{renderIcon:Ue.r,disabled:!A||!m,onClick:function(){Z(!0),e.isValid?function(e,t,n){St.apply(this,arguments)}(e.values,e.setValues,L):e.validateForm().then((function(e){return K(e)}))},className:Jt.submitButton},S("postToRegistry","Post to registry")),h().createElement(Ie.zxk,{className:Jt.submitButton,type:"submit",onClick:function(){return e.validateForm().then((function(e){return K(e)}))},disabled:!A||!m||e.isSubmitting||!V},e.isSubmitting?h().createElement(Ie.lSo,{className:Jt.spinner,description:"".concat(S("submitting","Submitting")," ..."),iconDescription:"submitting"}):L?S("updatePatient","Update patient"):S("registerPatient","Register patient")),h().createElement(Ie.zxk,{className:Jt.cancelButton,kind:"tertiary",onClick:dt},S("cancel","Cancel")))),h().createElement("div",{className:Jt.infoGrid},h().createElement(ze.Provider,{value:{identifierTypes:m,validationSchema:z,values:e.values,inEditMode:L,setFieldValue:e.setFieldValue,setCapturePhotoProps:j,currentPhoto:null===(t=R)||void 0===t?void 0:t.imageSrc,isOffline:u,initialFormValues:e.initialValues,setInitialFormValues:x}},h().createElement(Ui,{props:e,setInitialFormValues:x}),H.map((function(e,t){return h().createElement(wi,{key:"registration-section-".concat(e.id),sectionDefinition:e,index:t})}))))))}))},zi=n(4954),Wi={};Wi.styleTagTransform=nt(),Wi.setAttributes=Qe(),Wi.insert=Xe().bind(null,"head"),Wi.domAPI=Ye(),Wi.insertStyleElement=et(),Ze()(zi.Z,Wi);const Vi=zi.Z&&zi.Z.locals?zi.Z.locals:void 0;function Zi(){var e=(0,r.useConnectivity)(),t=(0,r.useSession)(),n=Fe()("patientRegistrationAddressTemplate",T).data,i=Fe()("patientRegistrationRelationshipTypes",P).data,a=Fe()("patientRegistrationPatientIdentifiers",U).data,o=(0,g.useMemo)((function(){return e?ye.savePatientFormOnline:ye.savePatientFormOffline}),[e]);return h().createElement("main",{className:je()("omrs-main-content",Vi.root)},h().createElement(Ie.rjZ,{className:Vi.grid},h().createElement(Ie.X2j,null,h().createElement(r.ExtensionSlot,{name:"breadcrumbs-slot"})),h().createElement(O.Provider,{value:{addressTemplate:n,relationshipTypes:i,identifierTypes:a,currentSession:t}},h().createElement(xe.BrowserRouter,{basename:window.getOpenmrsSpaBase()},h().createElement(xe.Routes,null,h().createElement(xe.Route,{path:"patient-registration",element:h().createElement(qi,{savePatientForm:o,isOffline:!e})}),h().createElement(xe.Route,{path:"patient/:patientUuid/edit",element:h().createElement(qi,{savePatientForm:o,isOffline:!e})}))))))}var Hi=n(2553),Yi={};Yi.styleTagTransform=nt(),Yi.setAttributes=Qe(),Yi.insert=Xe().bind(null,"head"),Yi.domAPI=Ye(),Yi.insertStyleElement=et(),Ze()(Hi.Z,Yi);const Ki=Hi.Z&&Hi.Z.locals?Hi.Z.locals:void 0;var Xi=n(3979),Ji={featureName:"Patient Registration",moduleName:m};function Qi(){(0,r.defineConfigSchema)(m,l),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(f),title:function(){return Promise.resolve(window.i18next.t("patientRegistrationBreadcrumb",{defaultValue:"Patient Registration",ns:m}))},parent:"".concat(window.spaBase,"/home")},{path:"".concat(window.spaBase,"/patient/:patientUuid/edit"),title:function(){return Promise.resolve(window.i18next.t("editPatientDetailsBreadcrumb",{defaultValue:"Edit patient details",ns:m}))},parent:"".concat(window.spaBase,"/patient/:patientUuid/chart")}]),(0,r.setupOfflineSync)(f,[],Se,{onBeginEditSyncItem:function(e){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),function(){Oe.apply(this,arguments)}(),(0,r.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return Ee((function(){var t,n;return De(this,(function(r){switch(r.label){case 0:return t=ke(e),[4,caches.open("omrs-spa-cache-v1")];case 1:return[4,r.sent().keys()];case 2:return n=r.sent().map((function(e){return e.url})),[2,t.every((function(e){return n.includes(e)}))]}}))}))()},sync:function(e){return Ee((function(){var t;return De(this,(function(n){switch(n.label){case 0:return t=ke(e),[4,Promise.allSettled(t.map(function(){var e=Ee((function(e){return De(this,(function(t){switch(t.label){case 0:return[4,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:e})];case 1:return t.sent(),[4,fetch(e)];case 2:return t.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()))];case 1:return n.sent(),[2]}}))}))()}})}var $i=(0,r.getSyncLifecycle)(Zi,Ji),ea=(0,r.getSyncLifecycle)(Zi,{featureName:"edit-patient-details-form",moduleName:m}),ta=(0,r.getSyncLifecycle)((function(){var e=h().useCallback((function(){return(0,r.navigate)({to:"${openmrsSpaBase}/patient-registration"})}),[]);return h().createElement(Ie.JMr,{"aria-label":"Add Patient","aria-labelledby":"Add Patient",enterDelayMs:500,name:"AddPatientIcon",onClick:e,className:Ki.slotStyles},h().createElement(Pn.JT,{size:20}))}),Ji),na=(0,r.getAsyncLifecycle)((function(){return n.e(735).then(n.bind(n,5735))}),Ji),ra=(0,r.getSyncLifecycle)((function(e){return console.warn("Using the patient-photo extension (or patient-photo-slot slot) is deprecated. Please use the PatientPhoto component from @openmrs/esm-framework."),h().createElement(r.PatientPhoto,e)}),Ji),ia=(0,r.getSyncLifecycle)((function(e){var t=e.patientUuid,n=e.onTransition,i=(0,Ge.useTranslation)().t,a=h().useCallback((function(){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(t,"/edit")}),n&&n()}),[n,t]);return h().createElement("li",{className:"cds--overflow-menu-options__option"},h().createElement("button",{className:"cds--overflow-menu-options__btn",role:"menuitem",title:i("editPatientDetails","Edit patient details"),"data-floating-menu-primary-focus":!0,onClick:a},h().createElement("span",{className:"cds--overflow-menu-options__option-content"},i("editPatientDetails","Edit patient details"))))}),{featureName:"edit-patient-details",moduleName:m}),aa=(0,r.getAsyncLifecycle)((function(){return n.e(207).then(n.bind(n,9207))}),Ji),oa=(0,r.getAsyncLifecycle)((function(){return n.e(59).then(n.bind(n,7059))}),Ji),sa=(0,r.getAsyncLifecycle)((function(){return n.e(330).then(n.bind(n,1330))}),Ji)},3979:(e,t,n)=>{var r={"./am.json":[8788,788],"./ar.json":[4460,460],"./en.json":[3574,574],"./es.json":[8319,319],"./fr.json":[2757,757],"./he.json":[5833,833],"./km.json":[7807,807],"./zh.json":[8271,271],"./zh_CN.json":[1644,644]};function i(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return n.e(t[1]).then((()=>n(i)))}i.keys=()=>Object.keys(r),i.id=3979,e.exports=i}}]);
|