@openmrs/esm-patient-registration-app 11.1.1-pre.9708 → 11.1.1-pre.9712

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.
@@ -3,4 +3,4 @@
3
3
  │ 8155.js (878.405 KiB)
4
4
  
5
5
 
6
- Rspack compiled with 1 warning in 33.81 s
6
+ Rspack compiled with 1 warning in 21.92 s
package/dist/1442.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([["1442"],{29876(e,a,t){t.r(a),t.d(a,{default:()=>n,immutable:()=>l});var r=t(84675),i=t(42372);let l=e=>(a,t,r)=>(r.revalidateOnFocus=!1,r.revalidateIfStale=!1,r.revalidateOnReconnect=!1,r.refreshInterval=0,e(a,t,r)),n=(0,i.withMiddleware)(r.u,l)}}]);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1442.js","sources":["webpack://@openmrs/esm-patient-registration-app/../../node_modules/swr/dist/immutable/index.mjs"],"names":[],"mappings":"kPAGA,IAAM,EAAY,AAAC,GAAa,CAAC,EAAK,EAAS,KAEvC,EAAO,iBAAiB,CAAG,GAC3B,EAAO,iBAAiB,CAAG,GAC3B,EAAO,qBAAqB,CAAG,GAC/B,EAAO,eAAe,CAAG,EAClB,EAAW,EAAK,EAAS,IAElC,EAAkB,qBAAe,GAAM,CAAE,E"}
package/dist/2152.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([["2152"],{52470(e,t,a){a.r(t),a.d(t,{default:()=>d,infinite:()=>_,unstable_serialize:()=>c});var r=a(97125),l=a(84675),i=a(64079),n=a(42372),u=a(58139);let s=e=>(0,i.s)(e?e(0,null):null)[0],c=e=>"$inf$"+s(e),o=Promise.resolve(),_=e=>(t,a,l)=>{let n,c=(0,r.useRef)(!1),{cache:_,initialSize:d=1,revalidateAll:f=!1,persistSize:p=!1,revalidateFirstPage:g=!0,revalidateOnMount:b=!1,parallel:m=!1}=l,[,,,h]=i.a.get(i.o);try{(n=s(t))&&(n="$inf$"+n)}catch(e){}let[k,w,y]=(0,i.c)(_,n),v=(0,r.useCallback)(()=>(0,i.i)(k()._l)?d:k()._l,[_,n,d]);(0,u.useSyncExternalStore)((0,r.useCallback)(e=>n?y(n,()=>{e()}):()=>{},[_,n]),v,v);let C=(0,r.useCallback)(()=>{let e=k()._l;return(0,i.i)(e)?d:e},[n,d]),$=(0,r.useRef)(C());(0,i.u)(()=>{if(!c.current){c.current=!0;return}n&&w({_l:p?$.current:C()})},[n,_]);let U=b&&!c.current,z=e(n,async e=>{let r=k()._i,n=k()._r,u=i.a.get(_),s=u[8],c=()=>u[8]!==s;w({_r:i.U});let o=[],d=C(),[p]=(0,i.c)(_,e),b=p().data,y=[],v=null;for(let e=0;e<d;++e){let[u,s]=(0,i.s)(t(e,m?null:v));if(!u)break;let[d,p]=(0,i.c)(_,u),k=d().data,w=f||r||(0,i.i)(k)||g&&!e&&!(0,i.i)(b)||U||b&&!(0,i.i)(b[e])&&!l.compare(b[e],k);if(a&&("function"==typeof n?n(k,s):w)){let t=async()=>{if(u in h){let e=h[u];delete h[u],k=await e}else k=await a(s);c()||p({data:k,_k:s}),o[e]=k};m?y.push(t):await t()}else o[e]=k;m||(v=k)}return m&&await Promise.all(y.map(e=>e())),c()||w({_i:i.U}),o},l),L=(0,r.useCallback)(function(e,t){let a="boolean"==typeof t?{revalidate:t}:t||{},r=!1!==a.revalidate;return n?(r&&((0,i.i)(e)?w({_i:!0,_r:a.revalidate}):w({_i:!1,_r:a.revalidate})),arguments.length?z.mutate(e,{...a,revalidate:r}):z.mutate()):o},[n,_]),P=(0,r.useCallback)(e=>{let a;if(!n)return o;let[,r]=(0,i.c)(_,n);if((0,i.e)(e)?a=e(C()):"number"==typeof e&&(a=e),"number"!=typeof a)return o;r({_l:a}),$.current=a;let l=[],[u]=(0,i.c)(_,n),s=null;for(let e=0;e<a;++e){let[a]=(0,i.s)(t(e,s)),[r]=(0,i.c)(_,a),n=a?r().data:i.U;if((0,i.i)(n))return L(u().data);l.push(n),s=n}return L(l)},[n,_,L,C]);return{size:C(),setSize:P,mutate:L,get data(){return z.data},get error(){return z.error},get isValidating(){return z.isValidating},get isLoading(){return z.isLoading}}},d=(0,n.withMiddleware)(l.u,_)}}]);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"2152.js","sources":["webpack://@openmrs/esm-patient-registration-app/../../node_modules/swr/dist/infinite/index.mjs"],"names":["Promise","p","e","i","u","arguments"],"mappings":"2SAOA,IAAM,EAAkB,AAAC,GACd,QAAU,EAAS,EAAO,EAAG,MAAQ,KAAK,CAAC,EAAE,CAElD,EAAqB,AAAC,GACjB,QAAkB,EAAgB,GAKvC,EAAgBA,QAAQ,OAAO,GAC/B,EAAW,AAAC,GAAa,CAAC,EAAQ,EAAI,KACpC,IAKI,EALE,EAAc,aAAO,IACrB,CAAE,MAAO,CAAO,CAAE,cAAc,CAAC,CAAE,gBAAgB,EAAK,CAAEC,YAAAA,EAAc,EAAK,CAAE,sBAAsB,EAAI,CAAE,oBAAoB,EAAK,CAAE,WAAW,EAAK,CAAE,CAAG,EAC3J,IAAO,EAAQ,CAAG,OAAkB,CAAC,GAAK,EAIhD,GAAI,CAEI,AADJ,GAAc,EAAgB,EAAM,GACnB,GAAc,QAAkB,CAAU,CAC/D,CAAE,MAAOC,EAAK,CAEd,CACA,GAAM,CAAC,EAAK,EAAK,EAAe,CAAG,QAAkB,EAAS,GACxD,EAAc,kBAAY,IACf,GAAAC,EAAA,GAAY,IAAM,EAAE,EAAI,EAAc,IAAM,EAAE,CAG5D,CACC,EACA,EACA,EACH,EACD,GAAAC,EAAA,sBAAqB,kBAAY,AAAC,GAC9B,AAAI,EAAoB,EAAe,EAAa,KAChD,GACJ,GACO,KAAK,EAEhB,CACI,EACA,EACH,EAAG,EA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OAAO,CAAG,EAE1B,IAAM,EAAO,EAAE,CACT,CAAC,EAAiB,CAAG,QAAkB,EAAS,GAClD,EAAmB,KACvB,IAAI,IAAI,EAAI,EAAG,EAAI,EAAM,EAAE,EAAE,CACzB,GAAM,CAAC,EAAQ,CAAG,QAAU,EAAO,EAAG,IAChC,CAAC,EAAS,CAAG,QAAkB,EAAS,GAExC,EAAW,EAAU,IAAW,IAAI,CAAG,GAAS,CAEtD,GAAI,GAAAA,EAAA,GAAY,GACZ,OAAO,EAAO,IAAmB,IAAI,EAEzC,EAAK,IAAI,CAAC,GACV,EAAmB,CACvB,CACA,OAAO,EAAO,EAClB,EAEA,CACI,EACA,EACA,EACA,EACH,EAGD,MAAO,CACH,KAAM,IACN,UACA,SACA,IAAI,MAAQ,CACR,OAAO,EAAI,IAAI,AACnB,EACA,IAAI,OAAS,CACT,OAAO,EAAI,KAAK,AACpB,EACA,IAAI,cAAgB,CAChB,OAAO,EAAI,YAAY,AAC3B,EACA,IAAI,WAAa,CACb,OAAO,EAAI,SAAS,AACxB,CACJ,CACJ,EACE,EAAiB,qBAAe,GAAM,CAAE,E"}
package/dist/3989.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([["3989"],{42372(e,t,n){n.r(t),n.d(t,{INFINITE_PREFIX:()=>B,IS_REACT_LEGACY:()=>k,IS_SERVER:()=>I,OBJECT:()=>l,SWRConfig:()=>H,SWRGlobalState:()=>E,UNDEFINED:()=>a,cache:()=>q,compare:()=>$,createCacheHelper:()=>b,defaultConfig:()=>j,defaultConfigOptions:()=>S,getTimestamp:()=>W,hasRequestAnimationFrame:()=>y,initCache:()=>U,internalMutate:()=>x,isDocumentDefined:()=>v,isFunction:()=>u,isPromiseLike:()=>f,isUndefined:()=>s,isWindowDefined:()=>w,mergeConfigs:()=>z,mergeObjects:()=>c,mutate:()=>J,noop:()=>o,normalize:()=>K,preload:()=>Z,preset:()=>O,rAF:()=>A,revalidateEvents:()=>M,serialize:()=>N,slowConnection:()=>F,stableHash:()=>_,subscribeCallback:()=>en,useIsomorphicLayoutEffect:()=>D,useSWRConfig:()=>Q,withArgs:()=>et,withMiddleware:()=>er});var r=n(97125),i=n.n(r);let o=()=>{},a=o(),l=Object,s=e=>e===a,u=e=>"function"==typeof e,c=(e,t)=>({...e,...t}),f=e=>u(e.then),d=new WeakMap,p=0,_=e=>{let t,n,r=typeof e,i=e&&e.constructor,o=i==Date;if(l(e)!==e||o||i==RegExp)t=o?e.toJSON():"symbol"==r?e.toString():"string"==r?JSON.stringify(e):""+e;else{if(t=d.get(e))return t;if(t=++p+"~",d.set(e,t),i==Array){for(n=0,t="@";n<e.length;n++)t+=_(e[n])+",";d.set(e,t)}if(i==l){t="#";let r=l.keys(e).sort();for(;!s(n=r.pop());)s(e[n])||(t+=n+":"+_(e[n])+",");d.set(e,t)}}return t},E=new WeakMap,h={},g={},m="undefined",w=typeof window!=m,v=typeof document!=m,y=()=>w&&typeof window.requestAnimationFrame!=m,b=(e,t)=>{let n=E.get(e);return[()=>!s(t)&&e.get(t)||h,r=>{if(!s(t)){let i=e.get(t);t in g||(g[t]=i),n[5](t,c(i,r),i||h)}},n[6],()=>!s(t)&&t in g?g[t]:!s(t)&&e.get(t)||h]},R=!0,[C,T]=w&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[o,o],O={isOnline:()=>R,isVisible:()=>{let e=v&&document.visibilityState;return s(e)||"hidden"!==e}},S={initFocus:e=>(v&&document.addEventListener("visibilitychange",e),C("focus",e),()=>{v&&document.removeEventListener("visibilitychange",e),T("focus",e)}),initReconnect:e=>{let t=()=>{R=!0,e()},n=()=>{R=!1};return C("online",t),C("offline",n),()=>{T("online",t),T("offline",n)}}},k=!i().useId,I=!w||"Deno"in window,A=e=>y()?window.requestAnimationFrame(e):setTimeout(e,1),D=I?r.useEffect:r.useLayoutEffect,L="u">typeof navigator&&navigator.connection,F=!I&&L&&(["slow-2g","2g"].includes(L.effectiveType)||L.saveData),N=e=>{if(u(e))try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?_(e):"",t]},V=0,W=()=>++V;var M={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:2,RECONNECT_EVENT:1};async function x(...e){let[t,n,r,i]=e,o=c({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{}),l=o.populateCache,d=o.rollbackOnError,p=o.optimisticData,_=o.throwOnError;if(u(n)){let e=[];for(let r of t.keys())!/^\$(inf|sub)\$/.test(r)&&n(t.get(r)._k)&&e.push(r);return Promise.all(e.map(h))}return h(n);async function h(n){let i,[c]=N(n);if(!c)return;let[h,g]=b(t,c),[m,w,v,y]=E.get(t),R=()=>{let e=m[c];return(u(o.revalidate)?o.revalidate(h().data,n):!1!==o.revalidate)&&(delete v[c],delete y[c],e&&e[0])?e[0](2).then(()=>h().data):h().data};if(e.length<3)return R();let C=r,T=W();w[c]=[T,0];let O=!s(p),S=h(),k=S.data,I=S._c,A=s(I)?k:I;if(O&&g({data:p=u(p)?p(A,k):p,_c:A}),u(C))try{C=C(A)}catch(e){i=e}if(C&&f(C)){let e;if(C=await C.catch(e=>{i=e}),T!==w[c][0]){if(i)throw i;return C}i&&O&&(e=i,"function"==typeof d?d(e):!1!==d)&&(l=!0,g({data:A,_c:a}))}if(l&&!i&&(u(l)?g({data:l(C,A),error:a,_c:a}):g({data:C,error:a,_c:a})),w[c][1]=W(),Promise.resolve(R()).then(()=>{g({_c:a})}),i){if(_)throw i;return}return C}}let P=(e,t)=>{for(let n in e)e[n][0]&&e[n][0](t)},U=(e,t)=>{if(!E.has(e)){let n=c(S,t),r={},i=x.bind(a,e),l=o,s={},u=(e,t)=>{let n=s[e]||[];return s[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},f=(t,n,r)=>{e.set(t,n);let i=s[t];if(i)for(let e of i)e(n,r)},d=()=>{if(!E.has(e)&&(E.set(e,[r,{},{},{},i,f,u]),!I)){let t=n.initFocus(setTimeout.bind(a,P.bind(a,r,0))),i=n.initReconnect(setTimeout.bind(a,P.bind(a,r,1)));l=()=>{t&&t(),i&&i(),E.delete(e)}}};return d(),[e,i,d,l]}return[e,E.get(e)[4]]},$=(e,t)=>_(e)==_(t),[q,J]=U(new Map),j=c({onLoadingSlow:o,onSuccess:o,onError:o,onErrorRetry:(e,t,n,r,i)=>{let o=n.errorRetryCount,a=i.retryCount,l=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;(s(o)||!(a>o))&&setTimeout(r,l,i)},onDiscarded:o,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:F?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:F?5e3:3e3,compare:$,isPaused:()=>!1,cache:q,mutate:J,fallback:{}},O),z=(e,t)=>{let n=c(e,t);if(t){let{use:r,fallback:i}=e,{use:o,fallback:a}=t;r&&o&&(n.use=r.concat(o)),i&&a&&(n.fallback=c(i,a))}return n},G=(0,r.createContext)({}),H=e=>{let{value:t}=e,n=(0,r.useContext)(G),i=u(t),o=(0,r.useMemo)(()=>i?t(n):t,[i,n,t]),l=(0,r.useMemo)(()=>i?o:z(n,o),[i,n,o]),s=o&&o.provider,f=(0,r.useRef)(a);s&&!f.current&&(f.current=U(s(l.cache||q),o));let d=f.current;return d&&(l.cache=d[0],l.mutate=d[1]),D(()=>{if(d)return d[2]&&d[2](),d[3]},[]),(0,r.createElement)(G.Provider,c(e,{value:l}))},B="$inf$",X=w&&window.__SWR_DEVTOOLS_USE__,Y=X?window.__SWR_DEVTOOLS_USE__:[],K=e=>u(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],Q=()=>c(j,(0,r.useContext)(G)),Z=(e,t)=>{let[n,r]=N(e),[,,,i]=E.get(q);if(i[n])return i[n];let o=t(r);return i[n]=o,o},ee=Y.concat(e=>(t,n,r)=>{let i=n&&((...e)=>{let[r]=N(t),[,,,i]=E.get(q);if(r.startsWith(B))return n(...e);let o=i[r];return s(o)?n(...e):(delete i[r],o)});return e(t,i,r)}),et=e=>function(...t){let n=Q(),[r,i,o]=K(t),a=z(n,o),l=e,{use:s}=a,u=(s||[]).concat(ee);for(let e=u.length;e--;)l=u[e](l);return l(r,i||a.fetcher||null,a)},en=(e,t,n)=>{let r=t[e]||(t[e]=[]);return r.push(n),()=>{let e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}},er=(e,t)=>(...n)=>{let[r,i,o]=K(n),a=(o.use||[]).concat(t);return e(r,i,{...o,use:a})};X&&(window.__SWR_DEVTOOLS_REACT__=i())}}]);
1
+ "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([["3989"],{42372(e,t,r){r.r(t),r.d(t,{INFINITE_PREFIX:()=>"$inf$",IS_REACT_LEGACY:()=>n.j,IS_SERVER:()=>n.I,OBJECT:()=>n.O,SWRConfig:()=>n.S,SWRGlobalState:()=>n.a,UNDEFINED:()=>n.U,cache:()=>n.o,compare:()=>n.v,createCacheHelper:()=>n.c,defaultConfig:()=>n.d,defaultConfigOptions:()=>n.w,getTimestamp:()=>n.g,hasRequestAnimationFrame:()=>n.x,initCache:()=>n.y,internalMutate:()=>n.f,isDocumentDefined:()=>n.z,isFunction:()=>n.e,isLegacyDeno:()=>n.A,isPromiseLike:()=>n.b,isUndefined:()=>n.i,isWindowDefined:()=>n.p,mergeConfigs:()=>n.t,mergeObjects:()=>n.m,mutate:()=>n.k,noop:()=>n.n,normalize:()=>u,preload:()=>s,preset:()=>n.B,rAF:()=>n.r,revalidateEvents:()=>n.C,serialize:()=>n.s,slowConnection:()=>n.D,stableHash:()=>n.G,subscribeCallback:()=>p,unload:()=>n.l,useIsomorphicLayoutEffect:()=>n.u,useSWRConfig:()=>c,withArgs:()=>d,withMiddleware:()=>g});var n=r(64079),i=r(97125),o=r.n(i);let a=n.p&&window.__SWR_DEVTOOLS_USE__,l=a?window.__SWR_DEVTOOLS_USE__:[],u=e=>(0,n.e)(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],c=()=>{let e=(0,i.useContext)(n.q);return(0,i.useMemo)(()=>(0,n.m)(n.d,e),[e])},s=(e,t)=>{if(n.I)return;let[r,i]=(0,n.s)(e),[,,,o]=n.a.get(n.o);if(o[r])return o[r];let a=t(i);return o[r]=a,a},f=l.concat(e=>(t,r,i)=>{let o=r&&((...e)=>{let[i]=(0,n.s)(t),[,,,o]=n.a.get(n.o);if(i.startsWith("$inf$"))return r(...e);let a=o[i];return(0,n.i)(a)?r(...e):(delete o[i],a)});return e(t,o,i)}),d=e=>function(...t){let r=c(),[i,o,a]=u(t),l=(0,n.t)(r,a),s=e,{use:d}=l,p=(d||[]).concat(f);for(let e=p.length;e--;)s=p[e](s);return s(i,o||l.fetcher||null,l)},p=(e,t,r)=>{let n=t[e]||(t[e]=[]);return n.push(r),()=>{let e=n.indexOf(r);e>=0&&(n[e]=n[n.length-1],n.pop())}},g=(e,t)=>(...r)=>{let[n,i,o]=u(r),a=(o.use||[]).concat(t);return e(n,i,{...o,use:a})};a&&(window.__SWR_DEVTOOLS_REACT__=o())},64079(e,t,r){r.d(t,{x:()=>T,I:()=>N,j:()=>j,u:()=>M,F:()=>a,g:()=>G,r:()=>F,C:()=>f,d:()=>Z,o:()=>Y,z:()=>R,a:()=>d,l:()=>Q,w:()=>L,S:()=>er,i:()=>E,t:()=>ee,E:()=>c,f:()=>B,q:()=>et,c:()=>C,B:()=>I,M:()=>u,n:()=>p,y:()=>H,U:()=>g,k:()=>K,v:()=>X,G:()=>$,R:()=>l,h:()=>s,s:()=>q,D:()=>W,O:()=>h,e:()=>_,p:()=>O,A:()=>S,b:()=>w,m:()=>m});var n=r(97125),i=r.n(n),o=Object.prototype.hasOwnProperty;let a=0,l=1,u=2,c=3,s=4;var f={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:2,RECONNECT_EVENT:1,UNLOAD_EVENT:4};let d=new WeakMap,p=()=>{},g=p(),h=Object,E=e=>e===g,_=e=>"function"==typeof e,m=(e,t)=>({...e,...t}),w=e=>_(e.then),y={},b={},v="undefined",O=typeof window!=v,R=typeof document!=v,S=O&&"Deno"in window,T=()=>O&&typeof window.requestAnimationFrame!=v,C=(e,t)=>{let r=d.get(e);return[()=>!E(t)&&e.get(t)||y,n=>{if(!E(t)){let i=e.get(t);t in b||(b[t]=i),r[5](t,m(i,n),i||y)}},r[6],()=>!E(t)&&t in b?b[t]:!E(t)&&e.get(t)||y]},D=!0,[k,A]=O&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[p,p],I={isOnline:()=>D,isVisible:()=>{let e=R&&document.visibilityState;return E(e)||"hidden"!==e}},L={initFocus:e=>(R&&document.addEventListener("visibilitychange",e),k("focus",e),()=>{R&&document.removeEventListener("visibilitychange",e),A("focus",e)}),initReconnect:e=>{let t=()=>{D=!0,e()},r=()=>{D=!1};return k("online",t),k("offline",r),()=>{A("online",t),A("offline",r)}}},j=!i().useId,N=!O||S,F=e=>T()?window.requestAnimationFrame(e):setTimeout(e,1),M=N?n.useEffect:n.useLayoutEffect,V="u">typeof navigator&&navigator.connection,W=!N&&V&&(["slow-2g","2g"].includes(V.effectiveType)||V.saveData),x=new WeakMap,U=(e,t)=>e===`[object ${t}]`,P=0,$=e=>{let t,r,n=typeof e,i=h.prototype.toString.call(e),o=U(i,"Date"),a=U(i,"RegExp"),l=U(i,"Object");if(h(e)!==e||o||a)t=o?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=x.get(e))return t;if(t=++P+"~",x.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=$(e[r])+",";x.set(e,t)}if(l){t="#";let n=h.keys(e).sort();for(;!E(r=n.pop());)E(e[r])||(t+=r+":"+$(e[r])+",");x.set(e,t)}}return t},q=e=>{if(_(e))try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?$(e):"",t]},z=0,G=()=>++z;async function B(...e){let[t,r,n,i]=e,o=m({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{}),a=o.populateCache,l=o.rollbackOnError,c=o.optimisticData,s=o.throwOnError;if(_(r)){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(f))}return f(r);async function f(r){let i,[f]=q(r);if(!f)return;let[p,h]=C(t,f),[m,y,b,v]=d.get(t),O=()=>{let e=m[f];return(_(o.revalidate)?o.revalidate(p().data,r):!1!==o.revalidate)&&(delete b[f],delete v[f],e&&e[0])?e[0](u).then(()=>p().data):p().data};if(e.length<3)return O();let R=n,S=!1,T=G();y[f]=[T,0];let D=!E(c),k=p(),A=k.data,I=k._c,L=E(I)?A:I;if(D&&h({data:c=_(c)?c(L,A):c,_c:L}),_(R))try{R=R(L)}catch(e){i=e,S=!0}if(R&&w(R)){let e;if(R=await R.catch(e=>{i=e,S=!0}),T!==y[f][0]){if(S)throw i;return R}S&&D&&(e=i,"function"==typeof l?l(e):!1!==l)&&(a=!0,h({data:L,_c:g}))}if(a&&!S&&(_(a)?h({data:a(R,L),error:g,_c:g}):h({data:R,error:g,_c:g})),y[f][1]=G(),Promise.resolve(O()).then(()=>{h({_c:g})}),S){if(s)throw i;return}return R}}let J=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},H=(e,t)=>{if(!d.has(e)){let r=m(L,t),n=Object.create(null),i=B.bind(g,e),o=p,u=Object.create(null),c=(e,t)=>{let r=u[e]||[];return u[e]=r,r.push(t),()=>{let e=r.indexOf(t);e>=0&&(r[e]=r[r.length-1],r.pop())}},f=(t,r,n)=>{e.set(t,r);let i=u[t];if(i)for(let e of i)e(r,n)},h=t=>{let r=d.get(e),[,i,o,a]=r,l=G();for(let e in r[8]++,o)delete o[e];for(let e in a)delete a[e];for(let e in i)i[e]=[l,l];let c={};for(let t of[...e.keys()]){let r=e.get(t);e.delete(t);let n=u[t];if(n)for(let e of n)e(c,r)}let f=!t||!1!==t.revalidate;for(let e in n){let t=n[e];for(let e=0;e<t.length;e++)t[e](s,{revalidate:f&&!e})}},E=()=>{if(!d.has(e)&&(d.set(e,[n,Object.create(null),Object.create(null),Object.create(null),i,f,c,h,0]),!N)){let t=r.initFocus(setTimeout.bind(g,J.bind(g,n,a))),i=r.initReconnect(setTimeout.bind(g,J.bind(g,n,l)));o=()=>{t&&t(),i&&i(),d.delete(e)}}};return E(),[e,i,E,o,h]}let r=d.get(e);return[e,r[4],g,g,r[7]]},X=function e(t,r){var n,i;if(t===r)return!0;if(t&&r&&(n=t.constructor)===r.constructor){if(n===Date)return t.getTime()===r.getTime();if(n===RegExp)return t.toString()===r.toString();if(n===Array){if((i=t.length)===r.length)for(;i--&&e(t[i],r[i]););return -1===i}if(!n||"object"==typeof t){for(n in i=0,t)if(o.call(t,n)&&++i&&!o.call(r,n)||!(n in r)||!e(t[n],r[n]))return!1;return Object.keys(r).length===i}}return t!=t&&r!=r},[Y,K,,,Q]=H(new Map),Z=m({onLoadingSlow:p,onSuccess:p,onError:p,onErrorRetry:(e,t,r,n,i)=>{let o=r.errorRetryCount,a=i.retryCount,l=~~((Math.random()+.5)*(1<<(a<8?a:8)))*r.errorRetryInterval;(E(o)||!(a>o))&&setTimeout(n,l,i)},onDiscarded:p,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:W?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:W?5e3:3e3,compare:X,isPaused:()=>!1,cache:Y,mutate:K,unload:Q,fallback:{}},I),ee=(e,t)=>{let r=m(e,t);if(t){let{use:n,fallback:i,cacheData:o}=e,{use:a,fallback:l,cacheData:u}=t;n&&a&&(r.use=n.concat(a)),i&&l&&(r.fallback=m(i,l)),o&&u&&(r.cacheData=m(o,u))}return r},et=(0,n.createContext)({}),er=e=>{let{value:t}=e,r=(0,n.useContext)(et),i=_(t),o=(0,n.useMemo)(()=>i?t(r):t,[i,r,t]),a=(0,n.useMemo)(()=>i?o:ee(r,o),[i,r,o]),l=o&&o.provider,u=(0,n.useRef)(g);l&&!u.current&&(u.current=H(l(a.cache||Y),o));let c=u.current;return c&&(a.cache=c[0],a.mutate=c[1],a.unload=c[4]),M(()=>{if(c)return c[2]&&c[2](),c[3]},[]),(0,n.createElement)(et.Provider,m(e,{value:a}))}}}]);
package/dist/3989.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"3989.js","sources":["webpack://@openmrs/esm-patient-registration-app/../../node_modules/swr/dist/_internal/index.mjs"],"names":["Object","WeakMap","Date","RegExp","JSON","Array","window","document","I","setTimeout","navigator","o","Promise","e","t","s","Map","r","Math","i"],"mappings":"+5BAGA,IAAM,EAAO,KAAK,EAKZ,EAA8B,IAC9B,EAASA,OACT,EAAc,AAAC,GAAI,IAAM,EACzB,EAAa,AAAC,GAAI,AAAY,YAAZ,OAAO,EACzB,EAAe,CAAC,EAAG,IAAK,EACtB,GAAG,CAAC,CACJ,GAAG,CAAC,AACR,GACE,EAAgB,AAAC,GAAI,EAAW,EAAE,IAAI,EAMtC,EAAQ,IAAIC,QAEd,EAAU,EASR,EAAa,AAAC,IAChB,IAGI,EACA,EAJE,EAAO,OAAO,EACd,EAAc,GAAO,EAAI,WAAW,CACpC,EAAS,GAAeC,KAG9B,GAAI,EAAO,KAAS,GAAQ,GAAU,GAAeC,OA8BjD,EAAS,EAAS,EAAI,MAAM,GAAK,AAAQ,UAAR,EAAmB,EAAI,QAAQ,GAAK,AAAQ,UAAR,EAAmBC,KAAK,SAAS,CAAC,GAAO,GAAK,MA9B1D,CAIzD,GADA,E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ration-app/../../node_modules/swr/dist/_internal/index.mjs","webpack://@openmrs/esm-patient-registration-app/../../node_modules/dequal/lite/index.mjs","webpack://@openmrs/esm-patient-registration-app/../../node_modules/swr/dist/config-context-ext53wcz.mjs"],"names":["window","Object","WeakMap","m","document","setTimeout","navigator","t","JSON","Array","o","Promise","e","Date","RegExp","Map","Math","i","c"],"mappings":"+gCAMA,IAAM,EAAiB,GAAe,EAAIA,OAAO,oBAAoB,CAC/D,EAAM,EAAiBA,OAAO,oBAAoB,CAAG,EAAE,CAQvD,EAAY,AAAC,GACR,QAAW,CAAI,CAAC,EAAE,EAAI,CACzB,CAAI,CAAC,EAAE,CACP,CAAI,CAAC,EAAE,CACP,CAAI,CAAC,EAAE,EAAI,CAAC,EACf,CAAG,CACA,CAAI,CAAC,EAAE,CACP,KACA,AAAC,CAAY,OAAZ,CAAI,CAAC,EAAE,CAAY,CAAI,CAAC,EAAE,CAAG,CAAI,CAAC,EAAE,AAAD,GAAM,CAAC,EAC9C,CAGC,EAAe,KACjB,IAAM,EAAe,iBAAW,GAAgB,EAIhD,MAHqB,cAAQ,IAAI,QAAa,GAAa,CAAE,GAAe,CACxE,EACH,CAEL,EAEM,EAAU,CAAC,EAAM,KAEnB,GAAI,GAAS,CACT,OAEJ,GAAM,CAAC,EAAK,EAAM,CAAG,QAAU,GACzB,IAAO,EAAQ,CAAG,OAAkB,CAAC,GAAK,EAEhD,GAAI,CAAO,CAAC,EAAI,CACZ,OAAO,CAAO,CAAC,EAAI,CAEvB,IAAM,EAAM,EAAQ,GAEpB,OADA,CAAO,CAAC,EAAI,CAAG,EACR,CACX,EAmBM,EAAsB,EAAI,MAAM,CAlBnB,AAAC,GAAa,CAAC,EAAM,EAAU,KAE1C,IAAM,EAAU,GAAa,EAAC,GAAG,KAC7B,GAAM,CAAC,EAAI,CAAG,QAAU,GAClB,IAAO,EAAQ,CAAG,OAAkB,CAAC,GAAK,EAChD,GAAI,EAAI,UAAU,CAAC,SAGf,OAAO,KAAY,GA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ACZ,EAAe,iBAAW,IAC1Bc,EAAqB,EAAW,GAChC,EAAS,cAAQ,IAAIA,EAAqB,EAAM,GAAgB,EAAO,CACzEA,EACA,EACA,EACH,EAEK,EAAiB,cAAQ,IAAIA,EAAqB,EAAS,GAAa,EAAc,GAAS,CACjGA,EACA,EACA,EACH,EAEK,EAAW,GAAU,EAAO,QAAQ,CAEpC,EAAkB,aAAO,EAC3B,IAAY,CAAC,EAAgB,OAAO,EACpC,GAAgB,OAAO,CAAG,EAAU,EAAS,EAAe,KAAK,EAAI,GAAQ,EAAM,EAEvF,IAAMC,EAAe,EAAgB,OAAO,CAe5C,OAbIA,IACA,EAAe,KAAK,CAAGA,CAAY,CAAC,EAAE,CACtC,EAAe,MAAM,CAAGA,CAAY,CAAC,EAAE,CACvC,EAAe,MAAM,CAAGA,CAAY,CAAC,EAAE,EAG3C,EAA0B,KACtB,GAAIA,EAGA,OADAA,CAAY,CAAC,EAAE,EAAIA,CAAY,CAAC,EAAE,GAC3BA,CAAY,CAAC,EAAE,AAE9B,EAAG,EAAE,EACE,oBAAc,GAAiB,QAAQ,CAAEf,EAAa,EAAO,CAChE,MAAO,CACX,GACJ,C"}
package/dist/4560.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([["4560"],{93296(e,r,t){var n=t(97125),i="function"==typeof Object.is?Object.is:function(e,r){return e===r&&(0!==e||1/e==1/r)||e!=e&&r!=r},a=n.useState,u=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(e){var r=e.getSnapshot;e=e.value;try{var t=r();return!i(e,t)}catch(e){return!0}}var o="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,r){return r()}:function(e,r){var t=r(),n=a({inst:{value:t,getSnapshot:r}}),i=n[0].inst,o=n[1];return s(function(){i.value=t,i.getSnapshot=r,c(i)&&o({inst:i})},[e,t,r]),u(function(){return c(i)&&o({inst:i}),e(function(){c(i)&&o({inst:i})})},[e]),l(t),t};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:o},58139(e,r,t){e.exports=t(93296)},84675(e,r,t){t.d(r,{S:()=>v,u:()=>h});var n=t(97125),i=t.n(n),a=t(58139),u=t(42372),s=t(64079);let l=i().use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(r=>{e.status="fulfilled",e.value=r},r=>{e.status="rejected",e.reason=r}),e}}),c={dedupe:!0},o=(e,r,t)=>{var n;return!!r&&(null==(n=e.get(r))?void 0:n.has(t))===!0},d=(e,r,t)=>{if(!r)return;let n=e.get(r);n||(n=new Set,e.set(r,n)),n.add(t)},f=Promise.resolve(s.U);f.status="fulfilled",f.value=s.U;let g=()=>s.n,v=s.O.defineProperty(s.S,"defaultValue",{value:s.d}),h=(0,u.withArgs)((e,r,t)=>{let{cache:i,compare:v,suspense:h,fallbackData:p,revalidateOnMount:b,revalidateIfStale:w,refreshInterval:S,refreshWhenHidden:k,refreshWhenOffline:m,keepPreviousData:y,strictServerPrefetchWarning:R}=t,[_,V,E,U]=s.a.get(i),[C,D]=(0,s.s)(e),L=(0,n.useRef)(!1),O=(0,n.useRef)(!1),T=(0,n.useRef)(C),P=(0,n.useRef)(r),I=(0,n.useRef)(t),j=()=>I.current.isVisible()&&I.current.isOnline(),[x,F,M,W]=(0,s.c)(i,C),q=(0,n.useRef)({}).current,z=(0,s.i)(p)?(0,s.i)(t.fallback)?s.U:t.fallback[C]:p,A=t.cacheData,Y=C?null==A?void 0:A[C]:s.U,$=C?U[C]:s.U,B=(0,s.i)($)&&!(0,s.i)(Y),G=B?Y:$,H=(e,r)=>{for(let t in q)if("data"===t){if(!v(e[t],r[t])&&(!(0,s.i)(e[t])||!v(ea,r[t])))return!1}else if(r[t]!==e[t])return!1;return!0},J=!L.current,K=(0,n.useMemo)(()=>{let e=x(),t=W(),n=e=>{let t=(0,s.m)(e);return(delete t._k,(()=>{if(!C||!r||I.current.isPaused())return!1;if(J&&!(0,s.i)(b))return b;let e=(0,s.i)(z)?t.data:z;return!(h&&B&&(0,s.i)(e))&&((0,s.i)(e)||w)})())?{isValidating:!0,isLoading:!0,...t}:t},i=n(e),a=e===t?i:n(t),u=i;return[()=>{let e=n(x());return H(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>a]},[i,C]),N=(0,a.useSyncExternalStore)((0,n.useCallback)(e=>M(C,(r,t)=>{H(t,r)||e()}),[i,C]),K[0],K[1]),Q=_[C]&&_[C].length>0,X=N.data,Z=(0,s.i)(X)?z&&(0,s.b)(z)?l(z):z:X,ee=N.error,er=(0,n.useRef)(Z),et=(0,n.useRef)(s.U),en=et.current;en||(et.current=en=new WeakMap);let ei=(0,n.useRef)(null),ea=y?(0,s.i)(X)?(0,s.i)(er.current)?Z:er.current:X:Z,eu=C&&(0,s.i)(Z),es=(0,n.useRef)(null);s.I||(0,a.useSyncExternalStore)(g,()=>(es.current=!1,es),()=>(es.current=!0,es));let el=es.current;R&&el&&!h&&eu&&console.warn(`Missing pre-initiated data for serialized key "${C}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);let ec=!(!C||!r||I.current.isPaused())&&(!Q||!!(0,s.i)(ee))&&(J&&!(0,s.i)(b)?b:(!h||!B||!eu)&&(h?!(0,s.i)(Z)&&w:(0,s.i)(Z)||w)),eo=J&&ec,ed=(0,s.i)(N.isValidating)?eo:N.isValidating,ef=(0,s.i)(N.isLoading)?eo:N.isLoading,eg=(0,n.useCallback)(async e=>{let r,n,i=P.current;if(!C||!i||O.current||I.current.isPaused())return!1;let a=!0,u=e||{},l=!E[C]||!u.dedupe,c=B&&!o(en,A,C)&&!(0,s.i)(G)&&(0,s.i)(x().data),f=()=>s.j?!O.current&&C===T.current&&L.current:C===T.current,g={isValidating:!1,isLoading:!1},h=()=>{F(g)},p=()=>{let e=E[C];e&&e[1]===n&&delete E[C]},b={isValidating:!0};(0,s.i)(x().data)&&(b.isLoading=!0);try{if(l&&(F(b),t.loadingTimeout&&(0,s.i)(x().data)&&setTimeout(()=>{a&&f()&&I.current.onLoadingSlow(C,t)},t.loadingTimeout),c&&d(en,A,C),E[C]=[c?G:i(D),(0,s.g)()],c&&U[C]&&delete U[C]),[r,n]=E[C],r=await r,l&&setTimeout(p,t.dedupingInterval),!E[C]||E[C][1]!==n)return l&&f()&&I.current.onDiscarded(C),!1;g.error=s.U;let e=V[C];if(!(0,s.i)(e)&&(n<=e[0]||n<=e[1]||0===e[1]))return h(),l&&f()&&I.current.onDiscarded(C),!1;let u=x().data;g.data=v(u,r)?u:r,l&&f()&&I.current.onSuccess(r,C,t)}catch(t){p();let e=I.current,{shouldRetryOnError:r}=e;!e.isPaused()&&(g.error=t,l&&f()&&(e.onError(t,C,e),(!0===r||(0,s.e)(r)&&r(t))&&(!I.current.revalidateOnFocus||!I.current.revalidateOnReconnect||j())&&e.onErrorRetry(t,C,e,e=>{let r=_[C];r&&r[0]&&r[0](s.E,e)},{retryCount:(u.retryCount||0)+1,dedupe:!0})))}return a=!1,h(),!0},[C,i]),ev=(0,n.useCallback)((...e)=>(0,s.f)(i,T.current,...e),[]);if((0,s.u)(()=>{let e=ei.current;e&&(ei.current=null,d(en,e.cacheData,e.key),(0,s.i)(x().data)&&F({data:e.data,error:s.U,_k:e._k}),U[e.key]&&delete U[e.key])}),(0,s.u)(()=>{P.current=r,I.current=t,(0,s.i)(X)||(er.current=X)}),(0,s.u)(()=>{if(r||!B||(0,s.i)(G)||o(en,A,C)||!(0,s.i)(x().data))return;d(en,A,C);let e=V[C];(({value:e,getCacheData:r,canCommit:t,setCache:n})=>{let i=e=>{t()&&(0,s.i)(r())&&n(e)};Promise.resolve(e).then(e=>{i({data:e,error:s.U})},e=>{i({error:e})})})({value:G,getCacheData:()=>x().data,canCommit:()=>!O.current&&C===T.current&&V[C]===e,setCache:e=>F({...e,_k:D})})}),(0,s.u)(()=>{if(!C)return;let e=eg.bind(s.U,c),r=0;I.current.revalidateOnFocus&&(r=Date.now()+I.current.focusThrottleInterval);let t=(0,u.subscribeCallback)(C,_,(t,n={})=>{if(t==s.F){let t=Date.now();I.current.revalidateOnFocus&&t>r&&j()&&(r=t+I.current.focusThrottleInterval,e())}else if(t==s.R)I.current.revalidateOnReconnect&&j()&&e();else if(t==s.M)return eg();else if(t==s.E)return eg(n);else if(t==s.h&&(er.current=s.U,n.revalidate))return eg()});return O.current=!1,T.current=C,L.current=!0,F({_k:D}),ec&&!E[C]&&((0,s.i)(Z)||s.I?e():(0,s.r)(e)),()=>{O.current=!0,t()}},[C]),(0,s.u)(()=>{let e;function r(){let r=(0,s.e)(S)?S(x().data):S;r&&-1!==e&&(e=setTimeout(t,r))}function t(){!x().error&&(k||I.current.isVisible())&&(m||I.current.isOnline())?eg(c).then(r):r()}return r(),()=>{e&&(clearTimeout(e),e=-1)}},[S,k,m,C]),(0,n.useDebugValue)(ea),h){if(!s.j&&s.I&&eu&&(0,s.i)(G))throw Error("Fallback data is required when using Suspense in SSR.");eu&&(P.current=r,I.current=t,O.current=!1);let e=!(0,s.i)(G)&&eu,n=s.U;if(e&&B?(Z=n=G&&(0,s.b)(G)?l(G):G,ea=n,s.I||(ei.current={data:n,_k:D,key:C,cacheData:A})):l(e?ev(G):f),!(0,s.i)(ee)&&eu)throw ee;let i=eu&&(0,s.i)(n)?eg(c):f;!(0,s.i)(ea)&&eu&&(i.status="fulfilled",i.value=!0),l(i)}return{mutate:ev,get data(){return q.data=!0,ea},get error(){return q.error=!0,ee},get isValidating(){return q.isValidating=!0,ed},get isLoading(){return q.isLoading=!0,ef}}})}}]);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4560.js","sources":["webpack://@openmrs/esm-patient-registration-app/../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","webpack://@openmrs/esm-patient-registration-app/../../node_modules/use-sync-external-store/shim/index.js","webpack://@openmrs/esm-patient-registration-app/../../node_modules/swr/dist/use-swr-emll9s78.mjs"],"names":["Object","u","c","e","window","i","Set","Promise","s","WeakMap","console","setTimeout","r","Date","t","clearTimeout","Error"],"mappings":"0KAWA,IAAI,EAAQ,EAAQ,OAIhB,EAAW,YAAe,OAAOA,OAAO,EAAE,CAAGA,OAAO,EAAE,CAH1D,SAAY,CAAC,CAAE,CAAC,EACd,OAAO,AAAC,IAAM,GAAM,KAAM,GAAK,EAAI,GAAM,EAAI,IAAQ,GAAM,GAAK,GAAM,CACxE,EAEE,EAAW,EAAM,QAAQ,CACzBC,EAAY,EAAM,SAAS,CAC3B,EAAkB,EAAM,eAAe,CACvC,EAAgB,EAAM,aAAa,CA0BrC,SAASC,EAAuB,CAAI,EAClC,IAAI,EAAoB,EAAK,WAAW,CACxC,EAAO,EAAK,KAAK,CACjB,GAAI,CACF,IAAI,EAAY,IAChB,MAAO,CAAC,EAAS,EAAM,EACzB,CAAE,MAAOC,EAAO,CACd,MAAO,CAAC,CACV,CACF,CAIA,IAAI,EACF,IAAgB,OAAOC,QACvB,SAAuBA,OAAO,QAAQ,EACtC,SAAuBA,OAAO,QAAQ,CAAC,aAAa,CANtD,SAAgC,CAAS,CAAE,CAAW,EACpD,OAAO,GACT,EArCA,SAAgC,CAAS,CAAE,CAAW,EACpD,IAAI,EAAQ,IACV,EAAY,EAAS,CAAE,KAAM,CAAE,MAAO,EAAO,YAAa,CAAY,CAAE,GACxEC,EAAO,CAAS,CAAC,EAAE,CAAC,IAAI,CACxB,EAAc,CAAS,CAAC,EAAE,CAmB5B,OAlBA,EACE,WACEA,EAAK,KAAK,CAAG,EACbA,EAAK,WAAW,CAAG,EACnBH,EAAuBG,IAAS,EAAY,CAAE,KAAMA,CAAK,EAC3D,EACA,CAAC,EAAW,EAAO,EAAY,EAEjCJ,EACE,WAEE,OADAC,EAAuBG,IAAS,EAAY,CAAE,KAAMA,CAAK,GAClD,EAAU,WACfH,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GAAiB,EAEnF,GAAe,EACX,AAAC,GAAS,EACV,IAAgB,OAAO,CAAG,CACtB,KAAM,EACN,GAAI,EACJ,MACA,UAAW,CACf,IAIJ,EADkB,EAAuB,GAAY,GAAiB,GAGtE,CAAC,QAAY,KAAU,GACvB,MAAM,GAEV,IAAM,EAAe,IAAmB,QAAY,GAAe,GAAW,GAAe,CACzF,EAAC,QAAY,KAAiB,KAE9B,EAAa,MAAM,CAAG,YAEtB,EAAa,KAAK,CAAG,IAEzB,EAAI,EACR,CAoBA,MAnBoB,CAChB,OAAQ,GACR,IAAI,MAAQ,CAER,OADA,EAAkB,IAAI,CAAG,GAClB,EACX,EACA,IAAI,OAAS,CAET,OADA,EAAkB,KAAK,CAAG,GACnB,EACX,EACA,IAAI,cAAgB,CAEhB,OADA,EAAkB,YAAY,CAAG,GAC1B,EACX,EACA,IAAI,WAAa,CAEb,OADA,EAAkB,SAAS,CAAG,GACvB,EACX,CACJ,CAEJ,E"}
package/dist/5395.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([["5395"],{90414(e,t,a){a.r(t),a.d(t,{default:()=>e9});var i=a(97125),n=a.n(i),r=a(53373),l=a.n(r),s=a(74498),o=a.n(s),d=a(22745),u=a(23553),m=a(82895),c=a(58146);let p=(0,i.createContext)(null),_=p.Provider,f=()=>{let e=(0,i.useContext)(p);if(!e)throw Error("useResourcesContext must be used within a ResourcesContextProvider");return e};var h=a(54328),g=a(74632),b=a(75921),E=a(33852),v=a(77488),y=a(23073);function T(){window.history.back()}function N(e){let t={},a=e.address?.[0];if(a)for(let e of Object.keys(a))switch(e){case"city":t.cityVillage=a[e];break;case"state":t.stateProvince=a[e];break;case"district":t.countyDistrict=a[e];break;case"extension":a[e].forEach(e=>{e.extension.forEach(e=>{t[e.url.split("#")[1]]=e.valueString})});break;default:("country"===e||"postalCode"===e)&&(t[e]=a[e])}return t}let C=(e,t)=>new Date(t.encounterDatetime).getTime()-new Date(e.encounterDatetime).getTime();var D=a(77248),w=a.n(D),k=a(69534),I=a(46155),x=a.n(I),S=a(81507),F=a(43126);let A={fieldRow:"-esm-patient-registration__input__fieldRow___T70rP",subFieldRow:"-esm-patient-registration__input__subFieldRow___dOohF",label:"-esm-patient-registration__input__label___5Wuq+",textID:"-esm-patient-registration__input__textID___9Cju5",comboInput:"-esm-patient-registration__input__comboInput___pj9A+",requiredField:"-esm-patient-registration__input__requiredField___NBD7N",input:"-esm-patient-registration__input__input___SEGKS",checkboxField:"-esm-patient-registration__input__checkboxField___6+MfA",textInput:"-esm-patient-registration__input__textInput___4fTq0",numberInput:"-esm-patient-registration__input__numberInput___M2Wig",checkboxInput:"-esm-patient-registration__input__checkboxInput___3upGA",selectInput:"-esm-patient-registration__input__selectInput___xBon9",dateInput:"-esm-patient-registration__input__dateInput___Yp0sj",telInput:"-esm-patient-registration__input__telInput___yL6g-",errorInput:"-esm-patient-registration__input__errorInput___R+JXW",errorMessage:"-esm-patient-registration__input__errorMessage___6zL-O",dummyData:"-esm-patient-registration__input__dummyData___bBMm5",IDInput:"-esm-patient-registration__input__IDInput___cs08f",trashCan:"-esm-patient-registration__input__trashCan___pMV3T",dangerLabel01:"-esm-patient-registration__input__dangerLabel01___hFTR0",comboInputEntries:"-esm-patient-registration__input__comboInputEntries___xzA5f",comboInputItemOption:"-esm-patient-registration__input__comboInputItemOption___m+L0M",actionButtonContainer:"-esm-patient-registration__input__actionButtonContainer___-7dfm"},q={patientUuid:(0,F.A)(),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:"",deathTime:"",deathTimeFormat:"AM",deathCause:"",nonCodedCauseOfDeath:"",relationships:[],address:{address1:"Bom Jesus Street",address2:"",cityVillage:"Recife",stateProvince:"Pernambuco",country:"Brazil",postalCode:"50030-310"},identifiers:{}},O=({setValues:e})=>{let{t}=(0,b.useTranslation)();return n().createElement(u.$nd,{kind:"tertiary",onClick:()=>e(q),className:A.dummyData,"aria-label":t("inputDummyData","Input Dummy Data")},t("inputDummyData","Input Dummy Data"))},$=(0,i.createContext)(void 0),L=$.Provider,P=()=>{let e=(0,i.useContext)($);if(!e)throw Error("usePatientRegistrationContext must be used within a PatientRegistrationContextProvider");return e};async function M(e){let t=await (0,m.openmrsFetch)(e),a=t?.data;if(Array.isArray(a))return t;if(!("object"!=typeof a||null===a||Array.isArray(a))&&("message"in a||"localizedMessage"in a)&&("stackTrace"in a||"cause"in a))throw Error(`The address hierarchy module responded to ${e} with a server error: ${a.message??a.localizedMessage}`);throw Error(`Expected an array of address hierarchy entries from ${e}, but the response body was not an array`)}function R(){let{data:e,isLoading:t,error:a}=o()("/module/addresshierarchy/ajax/getOrderedAddressHierarchyLevels.form",M);return(0,i.useMemo)(()=>({orderedFields:e?.data?.map(e=>e.addressField)??[],isLoadingFieldOrder:t,errorFetchingFieldOrder:a}),[e,t,a])}let B=({checkWarning:e,...t})=>{let[a,r]=(0,E.Mt)(t.name),{t:l}=(0,b.useTranslation)(),s=a.value||"",o=r.error||"",d=(0,i.useMemo)(()=>{if(!o&&"function"==typeof e){let t=e(s);return t&&l(t)}},[e,o,s,l]),m=t.required?t.labelText:`${t.labelText} (${l("optional","optional")})`;return n().createElement("div",{style:{marginBottom:"1rem"}},n().createElement(u.Wdr,null,n().createElement(u.ksK,{...t,...a,labelText:m,invalid:!!(r.touched&&r.error),invalidText:o,warn:!!d,warnText:d,value:s})))},U=function(){return n().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"},n().createElement("path",{d:"M13 24L4 15 5.414 13.586 13 21.171 26.586 7.586 28 9 13 24z"}))},j=({entries:e,error:t,isLoading:a,name:r,fieldProps:s,handleInputChange:o,handleSelection:d})=>{let{t:m}=(0,b.useTranslation)(),[c,p]=(0,i.useState)(-1),{value:_=""}=s,[f,h]=(0,i.useState)(!1),g=(0,i.useRef)(null),E=(0,i.useCallback)(()=>{h(!0),p(-1)},[h,p]),v=(0,i.useMemo)(()=>e?_?e.filter(e=>e.toLowerCase().includes(_.toLowerCase())):e:[],[e,_]),y=(0,i.useCallback)((e,t=null)=>{t?.preventDefault(),d(e),h(!1)},[d,h]),T=(0,i.useCallback)(e=>{let t=v.length??0;"Tab"===e.key&&(h(!1),p(-1)),"ArrowUp"===e.key?p(e=>Math.max(-1,e-1)):"ArrowDown"===e.key?p(e=>Math.min(t-1,e+1)):"Enter"===e.key&&(e.preventDefault(),c>-1&&y(v[c]))},[c,y,v,p,h]);return(0,i.useEffect)(()=>{let e=e=>{g.current.contains(e.target)||(h(!1),p(-1))};return window.addEventListener("click",e),()=>{window.removeEventListener("click",e)}},[]),n().createElement("div",{className:A.comboInput,ref:g},n().createElement(u.Wdr,null,n().createElement(u.ksK,{...s,id:s.id||r,onChange:e=>{p(-1),o(e.target.value)},onFocus:E,autoComplete:"off",onKeyDown:T})),n().createElement("div",{className:A.comboInputEntries},f&&n().createElement("div",{className:"cds--combo-box cds--list-box cds--list-box--expanded"},n().createElement("div",{id:"downshift-1-menu",className:"cds--list-box__menu",role:"listbox"},a?n().createElement("div",{className:"cds--list-box__menu-item"},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption)},m("searching","Searching..."))):t?n().createElement("div",{className:"cds--list-box__menu-item"},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption)},m("errorFetchingResults","Error fetching results"))):v.length>0?v.map((e,t)=>n().createElement("div",{className:l()("cds--list-box__menu-item",{"cds--list-box__menu-item--highlighted":t===c}),key:t,id:"downshift-1-item-0",role:"option",tabIndex:-1,"aria-selected":"true",onClick:()=>y(e)},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption,{"cds--list-box__menu-item--active":e===_})},e,e===_&&n().createElement(U,null)))):_?n().createElement("div",{className:"cds--list-box__menu-item"},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption)},m("noMatchingResults","No matching results"))):null))))},V=({attribute:e})=>{let{t}=(0,b.useTranslation)(),[a,r,{setValue:l}]=(0,E.Mt)(`address.${e.name}`),{fetchEntriesForField:s,searchString:d,updateChildElements:u}=function(e){let{orderedFields:t,isLoadingFieldOrder:a}=R(),{setFieldValue:n}=P(),[,{value:r}]=(0,E.Mt)("address"),l=(0,i.useMemo)(()=>a?-1:t?.findIndex(t=>t===e)??-1,[t,e,a]),s=(0,i.useMemo)(()=>{let e=!0,a=t?.slice(0,l)??[],i=[];for(let t of a){if(!r[t]){e=!1;break}i.push(r[t])}return{fetchEntriesForField:e,searchString:i.join("|")}},[t,l,r]),o=(0,i.useCallback)(()=>{a||t?.slice(l+1).map(e=>{n(`address.${e}`,"")})},[l,a,t,n]);return(0,i.useMemo)(()=>({...s,updateChildElements:o}),[s,o])}(e.name),{entries:m,isLoadingAddressEntries:c,errorFetchingAddressEntries:p}=function(e,t){let a=encodeURIComponent(t),{data:n,isLoading:r,error:l}=o()(e?`module/addresshierarchy/ajax/getChildAddressHierarchyEntries.form?searchString=${a}`:null,M);return(0,i.useEffect)(()=>{l&&console.error(l)},[l]),(0,i.useMemo)(()=>({entries:n?.data?.map(e=>e.name)??[],isLoadingAddressEntries:r,errorFetchingAddressEntries:l}),[n,r,l])}(s,d),_=t(e.label)+(e?.required?"":` (${t("optional","optional")})`),f=(0,i.useCallback)(e=>{l(e)},[l]),h=(0,i.useCallback)(e=>{r.value!==e&&(l(e),u())},[u,r.value,l]);return n().createElement(j,{entries:m,error:p,isLoading:c,handleSelection:h,name:`address.${e.name}`,fieldProps:{...a,id:e.name,labelText:_,required:e?.required},handleInputChange:f})},Y=({orderedAddressFields:e})=>n().createElement(n().Fragment,null,e.map(e=>n().createElement(V,{key:e.id,attribute:e}))),G="-esm-patient-registration__address-search__noResults___MaR0+",H=({addressLayout:e})=>{let{t}=(0,b.useTranslation)(),a=(0,i.useRef)(null),r=(0,i.useRef)(null),[l,s]=(0,i.useState)(""),{addresses:d,isLoading:m,error:c}=function(e){let{data:t,error:a,isLoading:n}=o()(e?`/module/addresshierarchy/ajax/getPossibleFullAddresses.form?separator= > &searchString=${e}`:null,M);return(0,i.useMemo)(()=>({addresses:t?.data?.map(e=>e.address)??[],error:a,isLoading:n}),[t?.data,a,n])}(l),p=(0,i.useMemo)(()=>{let e=new Set;return d.forEach(t=>{let a=t.split(" > ");a.forEach((t,i)=>{t.toLowerCase().includes(l.toLowerCase())&&e.add(a.slice(0,i+1).join(" > "))})}),[...e]},[d,l]),{setFieldValue:_}=(0,E.j7)(),f=e=>{r.current&&!r.current.contains(e.target)&&s("")};return(0,i.useEffect)(()=>(document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}),[r]),n().createElement("div",{className:"-esm-patient-registration__address-search__autocomplete___Bu8jL",ref:r,style:{marginBottom:"1rem"}},n().createElement(u.vji,{onChange:e=>{s(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},labelText:t("searchAddress","Search address"),placeholder:t("searchAddress","Search address"),ref:a,value:l}),l&&n().createElement("ul",{className:"-esm-patient-registration__address-search__suggestions___j2wBA"},m?n().createElement("li",{className:"-esm-patient-registration__address-search__loading___Ic4y+"},t("searching","Searching...")):c?n().createElement("li",{className:G},t("errorFetchingAddresses","Error fetching address results")):p.length>0?p.map(t=>n().createElement("li",{key:t,onClick:()=>(t=>{if(t){let a=t.split(" > ");e.map(({name:e},t)=>{_(`address.${e}`,a?.[t]??"")}),s("")}})(t)},t)):n().createElement("li",{className:G},t("noAddressResults","No matching addresses found"))))},z="-esm-patient-registration__field__productiveHeading02Light___oq7j1",W="-esm-patient-registration__field__label01___H7Ys0",K="-esm-patient-registration__field__grid___PPXoN",J="-esm-patient-registration__field__halfWidthInDesktopView___7mF3o",X="-esm-patient-registration__field__dobField___YdyBD",Q="-esm-patient-registration__field__dobContentSwitcherLabel___UhgIs",Z="-esm-patient-registration__field__identifierLabelText___EJqal",ee="-esm-patient-registration__field__customField___MVa8X",et=()=>{let e=(0,m.useConfig)(),{t}=(0,b.useTranslation)(),{setFieldValue:a}=P(),{orderedFields:r,isLoadingFieldOrder:l,errorFetchingFieldOrder:s}=R(),o=(0,m.useConnectivity)(),{fieldConfigurations:{address:{useAddressHierarchy:{enabled:d,useQuickSearch:c,searchAddressByLevel:p}}}}=e,{addressTemplate:_}=f(),h=(0,i.useMemo)(()=>{if(!_?.lines)return[];let e=_?.lines?.flat(),t=e?.filter(({isToken:e})=>"IS_ADDR_TOKEN"===e),a=Object.fromEntries(_?.requiredElements?.map(e=>[e,e])||[]);return t.map(({displayText:e,codeName:t})=>({id:t,name:t,label:e,required:!!a[t]}))},[_]),[g,E]=(0,i.useState)("");(0,i.useEffect)(()=>{_?.elementDefaults&&Object.entries(_.elementDefaults).forEach(([e,t])=>{a(`address.${e}`,t)})},[_,a]);let v=(0,i.useMemo)(()=>{if(l||s)return[];let e=Object.fromEntries((r??[]).map((e,t)=>[e,t]));return[...h].sort((t,a)=>e[t.name]-e[a.name])},[l,s,r,h]);return _&&!Object.keys(_)?.length?n().createElement(ea,null,n().createElement("div",{role:"progressbar","aria-label":t("loading","Loading")},n().createElement(u.rrI,null))):d&&o?l?n().createElement(ea,null,n().createElement("div",{role:"progressbar","aria-label":t("loading","Loading")},n().createElement(u.rrI,null))):s?n().createElement(ea,null,n().createElement(u.jeF,{style:{margin:"0",minWidth:"100%"},kind:"error",lowContrast:!0,title:t("errorFetchingOrderedFields","Error occurred fetching ordered fields for address hierarchy")})):n().createElement(ea,null,c&&n().createElement(H,{addressLayout:v}),p?n().createElement(Y,{orderedAddressFields:v}):v.map((e,a)=>n().createElement(B,{key:`combo_input_${a}`,name:`address.${e.name}`,labelText:t(e.label),id:e.name,value:g,required:e.required}))):n().createElement(ea,null,h.map((e,a)=>n().createElement(B,{key:`combo_input_${a}`,name:`address.${e.name}`,labelText:t(e.label),id:e.name,value:g,required:e.required})))},ea=({children:e})=>{let{t}=(0,b.useTranslation)(),a=(0,i.useMemo)(()=>({fieldConfigurations:{},setFieldValue:async()=>{},values:{}}),[]);return n().createElement(_,{value:{addressTemplate:{},currentSession:{},identifierTypes:[],relationshipTypes:{results:[]}}},n().createElement(L,{value:a},n().createElement("div",null,n().createElement("h4",{className:z},t("addressHeader","Address")),n().createElement("div",{style:{paddingBottom:"5%"}},e))))};function ei(e){let{data:t,error:a,isLoading:n}=o()("string"==typeof e&&""!==e?`${m.restBaseUrl}/concept/${e}?v=custom:(uuid,display,answers:(uuid,display))`:null,m.openmrsFetch);return a&&(0,m.showSnackbar)({title:a.name,subtitle:a.message,kind:"error"}),(0,i.useMemo)(()=>({data:t?.data?.answers,isLoading:n,error:a}),[n,a,t])}let en=()=>{let{t:e}=(0,b.useTranslation)(),{fieldConfigurations:t,freeTextFieldConceptUuid:a}=(0,m.useConfig)(),[r,s]=(0,E.Mt)("deathCause"),o=t?.causeOfDeath?.conceptUuid,d=t?.causeOfDeath?.required,{data:c,isLoading:p,error:_}=ei(o),f=(0,i.useMemo)(()=>!p&&c?c.map(e=>({...e,label:e.display})):[],[c,p]);return p?n().createElement("div",{className:l()(ee,J)},n().createElement("h4",{className:z},e("causeOfDeathInputLabel","Cause of death")),n().createElement(u.aB4,null)):n().createElement("div",{className:l()(ee,J)},n().createElement("h4",{className:z},e("causeOfDeathInputLabel","Cause of death")),_||!o?n().createElement(u.jeF,{hideCloseButton:!0,kind:"error",title:e("errorFetchingCodedCausesOfDeath","Error fetching coded causes of death"),subtitle:e("refreshOrContactAdmin","Try refreshing the page or contact your system administrator")}):n().createElement(n().Fragment,null,n().createElement(E.D0,{name:"deathCause"},({field:t,form:{touched:a,errors:i},meta:r})=>n().createElement(u.Wdr,null,n().createElement(u.l6P,{...t,id:"deathCause",invalid:i.deathCause&&a.deathCause,invalidText:i.deathCause?.message,labelText:e("causeOfDeathInputLabel","Cause of death"),name:"deathCause",required:d},n().createElement(u.ebT,{id:"empty-default-option",value:null,text:e("selectAnOption","Select an option")}),f.map(e=>n().createElement(u.ebT,{id:e.uuid,key:e.uuid,text:e.label,value:e.uuid}))))),r.value===a&&n().createElement("div",{className:"-esm-patient-registration__field__nonCodedCauseOfDeath___W7AAV"},n().createElement(E.D0,{name:"nonCodedCauseOfDeath"},({field:t,form:{touched:a,errors:i},meta:r})=>n().createElement(u.Wdr,null,n().createElement(u.ksK,{...t,id:"nonCodedCauseOfDeath",invalid:i?.nonCodedCauseOfDeath&&a.nonCodedCauseOfDeath,invalidText:i?.nonCodedCauseOfDeath?.message,labelText:e("nonCodedCauseOfDeath","Non-coded cause of death"),placeholder:e("enterNonCodedCauseOfDeath","Enter non-coded cause of death")}))))))},er=({fieldDefinition:e})=>{let{t}=(0,b.useTranslation)();return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:e.id},({field:a,form:{touched:i,errors:r},meta:l})=>n().createElement(B,{id:e.id,labelText:t(`${e.label}`,`${e.label}`),required:e?.validation?.required??!1,...a})))};function el({fieldDefinition:e}){let{t}=(0,b.useTranslation)(),{data:a,isLoading:r}=function(e){let{data:t,error:a,isLoading:n}=o()("string"==typeof e&&""!==e?`${m.restBaseUrl}/concept/${e}`:null,m.openmrsFetch);return a&&(0,m.showSnackbar)({title:a.name,subtitle:a.message,kind:"error"}),(0,i.useMemo)(()=>({data:t?.data,isLoading:n}),[t,n])}(e.uuid);if(!(0,m.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(r)return null;switch(a.datatype.display){case"Text":return n().createElement(es,{concept:a,validationRegex:e.validation.matches,label:e.label,required:e.validation.required});case"Numeric":return n().createElement(eo,{concept:a,label:e.label,required:e.validation.required});case"Date":return n().createElement(ed,{concept:a,label:e.label,required:e.validation.required,allowPastDates:e.allowPastDates,allowFutureDates:e.allowFutureDates});case"Coded":return n().createElement(eu,{concept:a,answerConceptSetUuid:e.answerConceptSetUuid,label:e.label,required:e.validation.required,customConceptAnswers:e.customConceptAnswers});default:return n().createElement(u.jeF,{kind:"error",title:"Error"},t("obsFieldUnknownDatatype","Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",{fieldDefinitionId:e.id,datatypeName:a.datatype.display}))}}function es({concept:e,validationRegex:t,label:a,required:i}){let{t:r}=(0,b.useTranslation)(),s=`obs.${e.uuid}`;return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:s,validate:e=>{if(e&&t&&""!==t&&"string"==typeof t&&""!==e){if(!new RegExp(t).test(e))return r("invalidInput","Invalid Input")}}},({field:t,form:{touched:r,errors:l},meta:o})=>n().createElement(B,{id:s,labelText:a??e.display,required:i,invalid:l[s]&&r[s],...t})))}function eo({concept:e,label:t,required:a}){let i=`obs.${e.uuid}`;return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:i},({field:r,form:{touched:l,errors:s},meta:o})=>n().createElement(B,{id:i,labelText:t??e.display,required:a,invalid:s[i]&&l[i],type:"number",...r})))}function ed({concept:e,label:t,required:a,allowPastDates:i,allowFutureDates:r}){let{t:l}=(0,b.useTranslation)(),s=`obs.${e.uuid}`,{setFieldValue:o}=P(),d=r??!0,c=i??!0,p=e=>{o(s,e)};return n().createElement(u.Wdr,null,n().createElement("div",{className:X},n().createElement(E.D0,{name:s},({field:i,form:{touched:r,errors:o},meta:u})=>n().createElement(n().Fragment,null,n().createElement(m.OpenmrsDatePicker,{id:s,...i,isRequired:a,onChange:p,labelText:t??e.display,isInvalid:o[s]&&r[s],invalidText:l(u.error),value:i.value,minDate:c?void 0:new Date,maxDate:d?void 0:new Date})))))}function eu({concept:e,answerConceptSetUuid:t,label:a,required:r,customConceptAnswers:s}){let{t:o}=(0,b.useTranslation)(),d=`obs.${e.uuid}`,{data:m,isLoading:c}=ei(s.length?"":t??e.uuid),p=(0,i.useMemo)(()=>s.length?s:c?[]:m.map(e=>({...e,label:e.display})),[s,m,c]);return n().createElement("div",{className:l()(ee,J)},c?null:n().createElement(E.D0,{name:d},({field:t,form:{touched:i,errors:l},meta:s})=>n().createElement(u.Wdr,null,n().createElement(u.l6P,{id:d,name:d,labelText:a??e?.display,required:r,invalid:l[d]&&i[d],...t},n().createElement(u.ebT,{key:`no-answer-select-item-${d}`,value:"",text:o("selectAnOption","Select an option")}),p.map(e=>n().createElement(u.ebT,{key:e.uuid,value:e.uuid,text:e.label}))))))}function em({id:e,personAttributeType:t,answerConceptSetUuid:a,label:r,customConceptAnswers:s,required:o}){let{data:d,isLoading:c}=ei(s.length?"":a),{t:p}=(0,b.useTranslation)(),_=`attributes.${t.uuid}`,[f,h]=(0,i.useState)(!1);(0,i.useEffect)(()=>{a||s.length||((0,m.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:e})),h(!0))},[a,s,e,p]),(0,i.useEffect)(()=>{c||s.length||(d||((0,m.reportError)(p("codedPersonAttributeAnswerSetInvalid","The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an invalid answer concept set UUID '{{answerConceptSetUuid}}'.",{codedPersonAttributeFieldId:e,answerConceptSetUuid:a})),h(!0)),d?.length===0&&((0,m.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:e,answerConceptSetUuid:a})),h(!0)))},[c,d,s,p,e,a]);let g=(0,i.useMemo)(()=>s.length?s:c||!d?[]:d.map(e=>({...e,label:e.display})).sort((e,t)=>e.label.localeCompare(t.label)),[s,d,c]);return f?null:n().createElement("div",{className:l()(ee,J)},c?null:n().createElement(u.Wdr,null,n().createElement(E.D0,{name:_},({field:a,form:{touched:i,errors:l},meta:s})=>n().createElement(n().Fragment,null,n().createElement(u.l6P,{id:e,name:`person-attribute-${t.uuid}`,labelText:r??t?.display,invalid:l[_]&&i[_],required:o,...a},n().createElement(u.ebT,{value:"",text:p("selectAnOption","Select an option")}),g.map(e=>n().createElement(u.ebT,{key:e.uuid,value:e.uuid,text:e.label})))))))}function ec({id:e,personAttributeType:t,validationRegex:a,label:i,required:r}){let{t:s}=(0,b.useTranslation)(),o=`attributes.${t.uuid}`;return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:o,validate:e=>{if(e&&a&&""!==a&&"string"==typeof a&&""!==e){if(!new RegExp(a).test(e))return s("invalidInput","Invalid Input")}}},({field:a,form:{touched:l,errors:s},meta:d})=>n().createElement(B,{id:e,name:`person-attribute-${t.uuid}`,labelText:i??t?.display,invalid:s[o]&&l[o],...a,required:r})))}var ep=a(87364),e_=a.n(ep);function ef({personAttributeType:e,id:t,label:a,locationTag:r,required:s}){let{t:o}=(0,b.useTranslation)(),d=`attributes.${e.uuid}`,[c,p,{setValue:_}]=(0,E.Mt)(`attributes.${e.uuid}`),[f,h]=(0,i.useState)(""),{locations:g,isLoading:v,loadingNewData:y}=function(e,t=""){let a=(0,m.useDebounce)(t),n=(0,i.useMemo)(()=>{let t=`${m.fhirBaseUrl}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),a||i.append("_count","10"),e&&i.append("_tag",e),"string"==typeof a&&""!==a&&i.append("name:contains",a),t+i.toString()},[e,a]),{data:r,isLoading:l,isValidating:s}=e_()(n,m.openmrsFetch);return(0,i.useMemo)(()=>({locations:r?.data?.entry||[],isLoading:l,loadingNewData:s}),[r,l,s])}(r||null,f),T=(0,i.useRef)([]),N=(0,i.useMemo)(()=>{if(!(v&&y)){let e=g.map(({resource:{id:e,name:t}})=>({value:e,label:t}));return T.current=e,e}return T.current},[g,v,y]),C=(0,i.useMemo)(()=>"string"==typeof p.value?N.find(({value:e})=>e===p.value)||null:"object"==typeof p.value&&p.value&&N.find(({value:e})=>e===p.value.uuid)||null,[N,p.value]),D=(0,i.useCallback)(e=>{e&&(N.find(({label:t})=>t===e)||(h(e),_(null)))},[N,_]),w=(0,i.useCallback)(({selectedItem:e})=>{e&&_(e.value)},[_]);return n().createElement("div",{className:l()(ee,J,"-esm-patient-registration__field__locationAttributeFieldContainer___Uw7Q9")},n().createElement(u.Wdr,null,n().createElement(E.D0,{name:d},({field:i,form:{touched:r,errors:l}})=>n().createElement(u.a32,{id:t,name:`person-attribute-${e.uuid}`,titleText:a,items:N,placeholder:o("searchLocationPersonAttribute","Search location"),onInputChange:D,required:s,onChange:w,selectedItem:C,invalid:l[d]&&r[d],typeahead:!0}))),y&&n().createElement("div",{className:"-esm-patient-registration__field__loadingContainer___6pGRw"},n().createElement(u.OuH,null)))}function eh({fieldDefinition:e}){let{data:t,isLoading:a,error:r}=function(e){let{data:t,error:a,isLoading:i}=o()(`${m.restBaseUrl}/personattributetype/${e}`,m.openmrsFetch);return{data:t?.data,isLoading:i,error:a}}(e.uuid),{t:l}=(0,b.useTranslation)(),s=(0,i.useMemo)(()=>{if(!t)return null;switch(t.format){case"java.lang.String":return n().createElement(ec,{personAttributeType:t,validationRegex:e.validation?.matches??"",label:e.label,required:e.validation?.required??!1,id:e?.id});case"org.openmrs.Concept":return n().createElement(em,{personAttributeType:t,answerConceptSetUuid:e.answerConceptSetUuid,label:e.label,id:e?.id,customConceptAnswers:e.customConceptAnswers??[],required:e.validation?.required??!1});case"org.openmrs.Location":return n().createElement(ef,{personAttributeType:t,locationTag:e.locationTag,label:e.label,id:e?.id,required:e.validation?.required??!1});default:return n().createElement(u.jeF,{kind:"error",title:"Error"},l("unknownPatientAttributeType","Patient attribute type has unknown format {{personAttributeTypeFormat}}",{personAttributeTypeFormat:t.format}))}},[t,e,l]);return a?n().createElement("div",null,e.showHeading&&n().createElement("h4",{className:z},e?.label),n().createElement(u.P3Z,null)):r?n().createElement("div",null,e.showHeading&&n().createElement("h4",{className:z},e?.label),n().createElement(u.jeF,{kind:"error",title:l("error","Error")},l("unableToFetch","Unable to fetch person attribute type - {{personattributetype}}",{personattributetype:e?.label??e?.id}))):n().createElement("div",null,e.showHeading&&n().createElement("h4",{className:z},e?.label??t?.display),s)}function eg({name:e}){let t=(0,m.useConfig)().fieldDefinitions.filter(t=>t.id===e)[0];return"person attribute"===t.type?n().createElement(eh,{fieldDefinition:t}):"obs"===t.type?n().createElement(el,{fieldDefinition:t}):"address"===t.type?n().createElement(er,{fieldDefinition:t}):n().createElement("div",null,"Error: Unknown field type ",t.type)}let eb=()=>{let{t:e}=(0,b.useTranslation)();return n().createElement("div",{className:l()("-esm-patient-registration__field__dodField___SuHIe",J)},n().createElement("h4",{className:z},e("deathDateInputLabel","Date of death")),n().createElement("span",null,n().createElement(eE,null),n().createElement(ev,null)))};function eE(){let{values:e,setFieldValue:t}=P(),[a,r]=(0,E.Mt)("deathDate"),{t:l}=(0,b.useTranslation)(),s=w()().hour(23).minute(59).second(59).toDate(),o=(0,i.useCallback)(e=>{t("deathDate",e?w()(e).hour(0).minute(0).second(0).millisecond(0).toDate():void 0)},[t]);return n().createElement(u.Wdr,null,n().createElement(m.OpenmrsDatePicker,{...a,id:"deathDate",invalidText:l(r.error),invalid:!!(r.touched&&r.error),isRequired:e.isDead,labelText:l("deathDateInputLabel","Date of death"),maxDate:s,onChange:o}))}function ev(){let{t:e}=(0,b.useTranslation)(),[t,a]=(0,E.Mt)("deathTime"),[i,r]=(0,E.Mt)("deathTimeFormat");return n().createElement(u.Wdr,null,n().createElement(u.AG,{...t,id:"time-picker",labelText:e("timeOfDeathInputLabel","Time of death (hh:mm)"),className:"-esm-patient-registration__field__timeOfDeathField___2JFHZ",pattern:"^(1[0-2]|0?[1-9]):([0-5]?[0-9])$",invalid:!!(a.touched&&a.error),invalidText:e(a.error)},n().createElement(u.E_7,{...i,id:"time-format-picker","aria-label":e("timeFormat","Time Format")},n().createElement(u.ebT,{value:"AM",text:"AM"}),n().createElement(u.ebT,{value:"PM",text:"PM"}))))}let ey=(e,t,a)=>{let{enabled:i,month:n,dayOfMonth:r}=a.useEstimatedDateOfBirth,l=new Date,s=new Date(l.getFullYear()-e,l.getMonth()-t,1),o=new Date(s.getFullYear(),s.getMonth()+1,0).getDate(),d=new Date(s.getFullYear(),s.getMonth(),Math.min(l.getDate(),o));return i?new Date(d.getFullYear(),n,r):d},eT=()=>{let{t:e}=(0,b.useTranslation)(),{fieldConfigurations:{dateOfBirth:t}}=(0,m.useConfig)(),a=t?.allowEstimatedDateOfBirth,[{value:r}]=(0,E.Mt)("birthdateEstimated"),[l,s]=(0,E.Mt)("birthdate"),[o,d]=(0,E.Mt)("yearsEstimated"),[c,p]=(0,E.Mt)("monthsEstimated"),{setFieldValue:_,setFieldTouched:f}=P(),h=new Date,g=(0,i.useCallback)(e=>{_("birthdateEstimated","unknown"===e.name),_("birthdate",""),_("yearsEstimated",0),_("monthsEstimated",""),f("birthdateEstimated",!0,!1)},[f,_]),v=(0,i.useCallback)(e=>{_("birthdate",e),f("birthdate",!0,!1)},[_,f]),y=(0,i.useCallback)(e=>{let a=+e.target.value;!isNaN(a)&&a<140&&a>=0&&(_("yearsEstimated",a),_("birthdate",ey(a,p.value,t)))},[_,t,p.value]),T=(0,i.useCallback)(e=>{let a=+e.target.value;isNaN(a)||(_("monthsEstimated",a),_("birthdate",ey(d.value,a,t)))},[_,t,d.value]),N=(0,i.useCallback)(()=>{let e=p.value%12,a=+d.value+Math.floor(p.value/12);_("yearsEstimated",a),_("monthsEstimated",e>0?e:""),_("birthdate",ey(a,e,t)),f("yearsEstimated",!0,!1),f("monthsEstimated",!0,!1),f("birthdate",!0,!1)},[_,f,p,d,t]);return n().createElement("div",{className:J},n().createElement("h4",{className:z},e("birthFieldLabelText","Birth")),(a||r)&&n().createElement("div",{className:X},n().createElement("div",{className:Q},n().createElement("span",{className:W},e("dobToggleLabelText","Date of birth known?"))),n().createElement(u.Tps,{size:"md",onChange:g,selectedIndex:+!!r},n().createElement(u.dOG,{name:"known"},e("yes","Yes")),n().createElement(u.dOG,{name:"unknown"},e("no","No")))),n().createElement(u.Wdr,null,r?n().createElement("div",{className:K},n().createElement("div",{className:X},n().createElement(u.ksK,{id:"yearsEstimated",type:"number",name:o.name,onChange:y,labelText:e("estimatedAgeInYearsLabelText","Estimated age in years"),invalid:!!(d.touched&&d.error),invalidText:d.error&&e(d.error),value:o.value,min:0,required:!0,...o,onBlur:e=>{o.onBlur(e),f("yearsEstimated",!0,!1),N()}})),n().createElement("div",{className:X},n().createElement(u.ksK,{id:"monthsEstimated",type:"number",name:c.name,onChange:T,labelText:e("estimatedAgeInMonthsLabelText","Estimated age in months"),invalid:!!(p.touched&&p.error),invalidText:p.error&&e(p.error),value:c.value,min:0,...c,required:!d.value,onBlur:e=>{c.onBlur(e),f("monthsEstimated",!0,!1),N()}}))):n().createElement("div",{className:X},n().createElement(m.OpenmrsDatePicker,{id:"birthdate","data-testid":"birthdate",...l,onChange:v,onBlur:()=>f("birthdate",!0,!1),maxDate:h,labelText:e("dateOfBirthLabelText","Date of birth"),isInvalid:!!(s.touched&&s.error),invalidText:e(s.error),value:l.value}))))},eN=()=>{let{t:e}=(0,b.useTranslation)(),{fieldConfigurations:t}=(0,m.useConfig)(),{setFieldValue:a,setFieldTouched:i}=P(),[r,l]=(0,E.Mt)("gender"),s=t?.gender;return n().createElement("div",{className:J},n().createElement("h4",{className:z},e("sexFieldLabelText","Sex")),n().createElement("div",{className:"-esm-patient-registration__field__sexField___HqJLS"},n().createElement(u.zWQ,{name:"gender",legendText:e("genderLabelText","Sex"),orientation:"vertical",onChange:e=>{a("gender",e),i("gender",!0,!1)},valueSelected:r.value},s.map(t=>n().createElement(u.aaP,{id:`gender-option-${t.value}`,key:t.label??t.value,labelText:e(t.label??t.value,t.label??t.value),value:t.value}))),l.touched&&l.error&&n().createElement("div",{className:"-esm-patient-registration__field__radioFieldError___9Xdn-"},e(l.error,"Gender is required"))))};var eC=a(85848),eD=a(68622),ew=a(95795),ek=a(85951);function eI(e){return ex(e)&&!e.identifierSources.some(e=>!e.autoGenerationOption?.manualEntryEnabled&&e.autoGenerationOption?.automaticGenerationEnabled)}function ex(e){return"UNIQUE"===e.uniquenessBehavior||"LOCATION"===e.uniquenessBehavior}let eS=({patientIdentifier:e,fieldName:t})=>{let{t:a}=(0,b.useTranslation)(),{defaultPatientIdentifierTypes:r}=(0,m.useConfig)(),{identifierTypes:l}=f(),{isOffline:s,values:o,setFieldValue:d}=P(),c=(0,i.useMemo)(()=>l.find(t=>t.uuid===e.identifierTypeUuid),[e,l]),{autoGeneration:p,initialValue:_,identifierValue:h,identifierName:g,required:v,selectedSource:y}=e,T=y?.autoGenerationOption?.manualEntryEnabled,[N,C]=(0,i.useState)(p||_===h),D=`identifiers.${t}.identifierValue`,[w,k]=(0,E.Mt)(D),I=s&&eI(c),x=(0,i.useMemo)(()=>{let e={};return r?.forEach(t=>{e[t]=!0}),e},[r]),S=(0,i.useCallback)(()=>{C(!0),d(`identifiers.${t}`,{...e,identifierValue:_,selectedSource:y,autoGeneration:p})},[_,C]),F=!v&&N&&(!!_||T),q=!!_&&_!==h||!N&&T;return n().createElement("div",{className:A.IDInput},N?n().createElement("div",{className:A.textID},n().createElement("p",{"data-testid":"identifier-label",className:A.label},v?g:`${a("optionalIdentifierLabel",{identifierName:g})}`),n().createElement("p",{"data-testid":"identifier-placeholder",className:A.bodyShort02},p?a("autoGeneratedPlaceholderText","Auto-generated"):h),n().createElement("input",{"data-testid":"identifier-input",type:"hidden",...w,disabled:!0}),!!(k.touched&&k.error)&&n().createElement("span",{className:A.dangerLabel01},k.error&&a(k.error))):n().createElement(E.D0,{name:D,validate:e=>{if(e&&""!==e&&c?.format)try{if(new RegExp(c.format).test(e))return;return c.formatDescription??`Expected format: ${c.format}`}catch(e){console.error("Invalid regex pattern:",c.format);return}}},({field:e,form:{touched:t,errors:i}})=>n().createElement(B,{id:D,labelText:g,name:D,disabled:I,required:v,invalid:i[D]&&t[D],invalidText:i[D]&&a(i[D]),...e})),n().createElement("div",{className:A.actionButtonContainer},F&&n().createElement(m.UserHasAccess,{privilege:"Edit Patient Identifiers"},n().createElement(u.$nd,{"data-testid":"edit-button",size:"md",kind:"ghost",onClick:()=>{C(!1),d(`identifiers.${t}`,{...e,...eL(c?.identifierSources?.[0],_,_),...p&&T&&{identifierValue:_??""}})},iconDescription:a("editIdentifierTooltip","Edit"),disabled:I,hasIconOnly:!0},n().createElement(eD.ff,{size:16}))),q&&n().createElement(m.UserHasAccess,{privilege:"Edit Patient Identifiers"},n().createElement(u.$nd,{size:"md",kind:"ghost",onClick:S,iconDescription:a("resetIdentifierTooltip","Reset"),disabled:I,hasIconOnly:!0},n().createElement(ew.Yn,{size:16}))),!e.required&&!x[e.identifierTypeUuid]&&n().createElement(m.UserHasAccess,{privilege:"Delete Patient Identifiers"},n().createElement(u.$nd,{size:"md",kind:"ghost",onClick:()=>{if(_){let e=(0,m.showModal)("delete-identifier-confirmation-modal",{closeModal:()=>e(),deleteIdentifier:a=>{a&&d("identifiers",eM(o.identifiers,t)),e()},identifierName:g,identifierValue:_})}else d("identifiers",eM(o.identifiers,t))},iconDescription:a("deleteIdentifierTooltip","Delete"),disabled:I,hasIconOnly:!0},n().createElement(ek.zH,{size:16})))))};var eF=a(60529);let eA="-esm-patient-registration__overlay__headerContent___CzZgW",eq=({close:e,children:t,header:a,buttonsGroup:i})=>{let{t:r}=(0,b.useTranslation)(),l=(0,m.useLayoutType)();return n().createElement("div",{className:(0,m.isDesktop)(l)?"-esm-patient-registration__overlay__desktopOverlay___Aty9R":"-esm-patient-registration__overlay__tabletOverlay___1eFEE"},(0,m.isDesktop)(l)?n().createElement("div",{className:"-esm-patient-registration__overlay__desktopHeader___7rEvz"},n().createElement("div",{className:eA},a),n().createElement(u.$nd,{className:"-esm-patient-registration__overlay__closeButton___zV7uq",iconDescription:r("closeOverlay","Close overlay"),onClick:e,kind:"ghost",hasIconOnly:!0,renderIcon:e=>n().createElement(eF.bm,{size:16,...e})})):n().createElement(u.Y9Y,{className:"-esm-patient-registration__overlay__tabletOverlayHeader___YrcPp","aria-label":"Overlay header"},n().createElement(u.$nd,{kind:"ghost",onClick:e,hasIconOnly:!0,iconDescription:r("closeOverlay","Close overlay"),renderIcon:t=>n().createElement(eC.nk,{size:16,onClick:e,...t})}),n().createElement("div",{className:eA},a)),n().createElement("div",{className:"-esm-patient-registration__overlay__overlayContent___ij63O"},t),n().createElement("div",null,i))},eO={button:"-esm-patient-registration__identifier-selection__button___S0ENh",tablet:"-esm-patient-registration__identifier-selection__tablet___dJebV",desktop:"-esm-patient-registration__identifier-selection__desktop___aYNV9",radioGroup:"-esm-patient-registration__identifier-selection__radioGroup___MqpRj",radioButton:"-esm-patient-registration__identifier-selection__radioButton___H-1qU",space05:"-esm-patient-registration__identifier-selection__space05___Yilpb"},e$=({closeOverlay:e,setFieldValue:t})=>{let a=(0,m.useLayoutType)(),{identifierTypes:r}=f(),{isOffline:l,values:s,initialFormValues:o}=P(),[d,c]=(0,i.useState)(s.identifiers),[p,_]=(0,i.useState)(""),{t:h}=(0,b.useTranslation)(),{defaultPatientIdentifierTypes:g}=(0,m.useConfig)(),E=(0,i.useMemo)(()=>{let e={};return g?.forEach(t=>{e[t]=!0}),e},[g]);(0,i.useEffect)(()=>{c(s.identifiers)},[s.identifiers]);let v=(0,i.useCallback)(e=>_(e?.target?.value??""),[]),y=(0,i.useMemo)(()=>r?.filter(e=>e?.name?.toLowerCase().includes(p.toLowerCase())),[p,r]),T=(0,i.useCallback)((e,t)=>c(a=>t?{...a,[e.fieldName]:eP(e,s.identifiers[e.fieldName]??o.identifiers[e.fieldName]??{})}:a[e.fieldName]?Object.fromEntries(Object.entries(a).filter(([t])=>t!==e.fieldName)):a),[o.identifiers,s.identifiers]),N=(0,i.useMemo)(()=>y.map(e=>{let t=d[e.fieldName],a=e.isPrimary||e.required||E[e.uuid]||s.identifiers[e.fieldName],i=l&&eI(e);return n().createElement("div",{key:e.uuid,className:eO.space05},n().createElement(u.Sc0,{id:e.uuid,value:e.uuid,labelText:e.name,onChange:(t,{checked:a})=>T(e,a),checked:!!t,disabled:a||l&&i}),t&&e?.identifierSources?.length>0&&(!t.initialValue||t?.selectedSource)&&n().createElement("div",{className:eO.radioGroup},n().createElement(u.zWQ,{legendText:h("source","Source"),name:`${e?.fieldName}-identifier-sources`,defaultSelected:t?.selectedSource?.uuid,onChange:t=>c(a=>({...a,[e.fieldName]:{...a[e.fieldName],...eL(e.identifierSources.find(e=>e.uuid===t),a[e.fieldName].identifierValue,a[e.fieldName].initialValue)}})),orientation:"vertical"},e?.identifierSources.map(t=>n().createElement(u.aaP,{key:t.uuid,labelText:t.name,name:t.uuid,value:t.uuid,className:eO.radioButton,disabled:l&&ex(e)&&t.autoGenerationOption?.manualEntryEnabled})))))}),[y,d,E,s.identifiers,l,T,h]),C=(0,i.useCallback)(()=>{t("identifiers",d),e()},[d,t,e]);return n().createElement(eq,{close:e,header:h("configureIdentifiers","Configure identifiers"),buttonsGroup:n().createElement(u.Te$,{className:(0,m.isDesktop)(a)?eO.desktop:eO.tablet},n().createElement(u.$nd,{className:eO.button,kind:"secondary",onClick:e},h("cancel","Cancel")),n().createElement(u.$nd,{className:eO.button,kind:"primary",onClick:C},h("configureIdentifiers","Configure identifiers")))},n().createElement("div",null,n().createElement("p",{className:eO.bodyLong02},h("IDInstructions","Select the identifiers you'd like to add for this patient:")),r.length>7&&n().createElement("div",{className:eO.space05},n().createElement(u.vji,{labelText:h("searchIdentifierPlaceholder","Search identifier"),placeholder:h("searchIdentifierPlaceholder","Search identifier"),onChange:v,value:p})),n().createElement("fieldset",null,N)))};function eL(e,t,a){let i=e?.autoGenerationOption?.automaticGenerationEnabled,n=e?.autoGenerationOption?.manualEntryEnabled;return{selectedSource:e,autoGeneration:i,identifierValue:i&&!n?"auto-generated":"auto-generated"!==t?t:a}}function eP(e,t){return{identifierTypeUuid:e.uuid,identifierName:e.name,preferred:e.isPrimary,initialValue:"",required:e.isPrimary||e.required,...t,...eL(t?.selectedSource??e.identifierSources?.[0],t?.identifierValue,t?.initialValue??"")}}function eM(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}let eR=()=>{let{identifierTypes:e}=f(),t=!e?.length,{values:a,setFieldValue:r,initialFormValues:l,isOffline:s}=P(),{t:o}=(0,b.useTranslation)(),d=(0,m.useLayoutType)(),[c,p]=(0,i.useState)(!1),{defaultPatientIdentifierTypes:_}=(0,m.useConfig)();(0,i.useEffect)(()=>{if(e){let t={};e.filter(e=>e.isPrimary||e.required||!!_?.find(t=>t===e.uuid)).filter(e=>!a.identifiers[e.fieldName]).forEach(e=>{t[e.fieldName]=eP(e,a.identifiers[e.uuid]??l.identifiers[e.uuid]??{})}),Object.keys(t).length&&r("identifiers",{...a.identifiers,...t})}},[e,r,_,a.identifiers,eP]);let h=(0,i.useCallback)(()=>p(!1),[p]);return t&&!s?n().createElement("div",{className:J},n().createElement("div",{className:Z},n().createElement("h4",{className:z},o("idFieldLabelText","Identifiers"))),n().createElement("div",{role:"progressbar","aria-label":o("loading","Loading")},n().createElement(u.rrI,null))):n().createElement("div",{className:J},n().createElement(m.UserHasAccess,{privilege:["Get Identifier Types","Add Patient Identifiers"]},n().createElement("div",{className:Z},n().createElement("h4",{className:z},o("idFieldLabelText","Identifiers")),n().createElement(u.$nd,{kind:"ghost",className:"-esm-patient-registration__field__configureIdentifiersButton___PYKaV",onClick:()=>p(!0),size:(0,m.isDesktop)(d)?"sm":"md"},o("configure","Configure")," ",n().createElement(eC.Qp,{className:"-esm-patient-registration__field__arrowRightIcon___slDqt",size:16})))),n().createElement("div",null,Object.entries(a.identifiers).map(([e,t])=>n().createElement(eS,{key:e,fieldName:e,patientIdentifier:t})),c&&n().createElement(e$,{setFieldValue:r,closeOverlay:h})))},eB="8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",eU=/^([^0-9]*)$/;function ej(e){if(!eU.test(e))return"numberInNameDubious"}let eV=()=>{let{t:e}=(0,b.useTranslation)(),{setCapturePhotoProps:t,currentPhoto:a,setFieldValue:r,setFieldTouched:l}=P(),{fieldConfigurations:{name:{displayCapturePhoto:s,allowUnidentifiedPatients:o,defaultUnknownGivenName:d,defaultUnknownFamilyName:c,displayMiddleName:p,displayReverseFieldOrder:_}}}=(0,m.useConfig)(),[{value:f},,{setValue:h}]=(0,E.Mt)(`attributes.${eB}`),g="true"===f,v=(0,i.useCallback)((e,a)=>{t&&(t({imageData:e,dateTime:a}),l("photo",!0,!1))},[t,l]),y=n().createElement(B,{id:"givenName",name:"givenName",labelText:e("givenNameLabelText","First Name"),checkWarning:ej,required:!0}),T=p&&n().createElement(B,{id:"middleName",name:"middleName",labelText:e("middleNameLabelText","Middle Name"),checkWarning:ej}),N=n().createElement(B,{id:"familyName",name:"familyName",labelText:e("familyNameLabelText","Family Name"),checkWarning:ej,required:!0});return n().createElement("div",null,n().createElement("h4",{className:z},e("fullNameLabelText","Full Name")),n().createElement("div",{className:K},s&&n().createElement(m.ExtensionSlot,{className:"-esm-patient-registration__field__photoExtension___2oTk6",name:"capture-patient-photo-slot",state:{onCapturePhoto:v,initialState:a}}),n().createElement("div",{className:"-esm-patient-registration__field__nameField___yn8u2"},(o||g)&&n().createElement(n().Fragment,null,n().createElement("div",{className:Q},n().createElement("span",{className:W},e("patientNameKnown","Patient's Name is Known?"))),n().createElement(u.Tps,{className:"-esm-patient-registration__field__contentSwitcher___G0UXd",size:"md",selectedIndex:+!!g,onChange:e=>{"known"===e.name?(r("givenName",""),r("familyName",""),h("false")):(r("givenName",d),r("familyName",c),h("true")),l("givenName",!0),l("familyName",!0),l(`attributes.${eB}`,!0,!1)}},n().createElement(u.dOG,{name:"known"},e("yes","Yes")),n().createElement(u.dOG,{name:"unknown"},e("no","No")))),!g&&(_?n().createElement(n().Fragment,null,N,T,y):n().createElement(n().Fragment,null,y,T,N)))))};function eY(){let e=(0,m.useConfig)(),t={id:"phone",type:"person attribute",uuid:e.fieldConfigurations.phone.personAttributeUuid,validation:e.fieldConfigurations.phone.validation,showHeading:!1};return n().createElement(eh,{fieldDefinition:t})}function eG({name:e}){let t=(0,m.useConfig)();if(!v.t_.includes(e)&&!t.fieldDefinitions.some(t=>t.id===e))return(0,m.reportError)(`Invalid field name '${e}'. Valid options are '${t.fieldDefinitions.map(e=>e.id).concat(v.t_).join("', '")}'.`),null;switch(e){case"name":return n().createElement(eV,null);case"gender":return n().createElement(eN,null);case"dob":return n().createElement(eT,null);case"dateAndTimeOfDeath":return n().createElement(eb,null);case"causeOfDeath":return n().createElement(en,null);case"address":return n().createElement(et,null);case"id":return n().createElement(eR,null);case"phone":return n().createElement(eY,null);default:return n().createElement(eg,{name:e})}}let eH=({sectionDefinition:e})=>n().createElement("section",{"aria-label":`${e.name} Section`},e.fields.map(t=>n().createElement(eG,{key:`${e.name}-${t}`,name:t}))),ez={label01:"-esm-patient-registration__section__label01___ECvmT",productiveHeading02:"-esm-patient-registration__section__productiveHeading02___7AMo6",isDeadFieldContainer:"-esm-patient-registration__section__isDeadFieldContainer___ZGgBz"},eW=({fields:e})=>{let{t}=(0,b.useTranslation)(),{values:a,setFieldValue:i}=P(),[r,l]=(0,E.Mt)("deathDate");return n().createElement("section",{className:ez.formSection,"aria-label":"Death Info Section"},n().createElement("section",{className:ez.fieldGroup},n().createElement(u.Wdr,null,n().createElement("div",{className:ez.isDeadFieldContainer},n().createElement(u.Sc0,{checked:a.isDead,id:"isDead",labelText:t("isDeadInputLabel","Is dead"),onChange:(e,{checked:t,id:a})=>i(a,t)}))),a.isDead?e.map(e=>n().createElement(eG,{key:`death-info-${e}`,name:e})):null))},eK=({fields:e})=>{let[t,a]=(0,E.Mt)("addNameInLocalLanguage"),{setFieldValue:r}=P();return(0,i.useEffect)(()=>{!t.value&&a.touched&&(r("additionalGivenName",""),r("additionalMiddleName",""),r("additionalFamilyName",""))},[t.value,a.touched,r]),n().createElement("section",{className:ez.formSection,"aria-label":"Demographics Section"},e.map(e=>n().createElement(eG,{key:`demographics-${e}`,name:e})))},eJ=({getDisplayValue:e,getFieldValue:t,getSearchResults:a,onSuggestionSelected:r,invalid:s,invalidText:o,...d})=>{let[m,c]=(0,i.useState)([]),p=(0,i.useRef)(null),_=(0,i.useRef)(null),{id:f,labelText:h}=d;(0,i.useEffect)(()=>(document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}),[_]);let g=e=>{_.current&&!_.current.contains(e.target)&&c([])};return n().createElement("div",{className:"-esm-patient-registration__autosuggest__autocomplete___95MR4",ref:_},n().createElement("label",{className:"cds--label"},h),n().createElement(u.Wdr,{className:l()({"-esm-patient-registration__autosuggest__invalid___WU59X":s})},n().createElement(u.vji,{id:"autosuggest",onChange:e=>{let t=e.target.value;r(f,void 0),t?a(t).then(e=>{c(e)}):c([])},onClear:()=>{r(f,void 0)},ref:p,className:"-esm-patient-registration__autosuggest__autocompleteSearch___P2UOw",labelText:h,...d})),m.length>0&&n().createElement("ul",{className:"-esm-patient-registration__autosuggest__suggestions___SpgLN"},m.map((a,i)=>n().createElement("li",{key:i,onClick:a=>{let n,l;return n=e(m[i]),l=t(m[i]),void(p.current.value=n,r(f,l),c([]))}},e(a)))),s?n().createElement("label",{className:l()("-esm-patient-registration__autosuggest__invalidMsg___iR7AK")},o):n().createElement(n().Fragment,null))},eX={labelText:"-esm-patient-registration__relationships__labelText___yNoLO",bodyShort02:"-esm-patient-registration__relationships__bodyShort02___hnV3v",searchBox:"-esm-patient-registration__relationships__searchBox___lB3ot",relationshipHeader:"-esm-patient-registration__relationships__relationshipHeader___pFsXl",productiveHeading:"-esm-patient-registration__relationships__productiveHeading___-0fjP",trashCan:"-esm-patient-registration__relationships__trashCan___DVwNy"},eQ=({relationship:e,index:t,displayRelationshipTypes:a,remove:r})=>{let{t:l}=(0,b.useTranslation)(),{setFieldValue:s}=P(),[o,d]=(0,i.useState)(!1),m=!e.uuid,c=(0,i.useId)(),p=(0,i.useCallback)(a=>{let{target:i}=a;s(i.name,i.options[i.selectedIndex].value),e?.action||s(`relationships[${t}].action`,"UPDATE")},[t,e?.action,s]),_=(0,i.useCallback)((e,t)=>{d(!t),s(e,t)},[s]),f=async e=>{let t=new AbortController;return await (0,S.uH)(e,t)},h=(0,i.useCallback)(()=>{"ADD"===e.action?r(t):s(`relationships[${t}].action`,"DELETE")},[e,t,r,s]),g=(0,i.useCallback)(()=>{s(`relationships[${t}]`,{...e,action:void 0,relationshipType:e.initialrelationshipTypeValue})},[t,s,e]);return"DELETE"!==e.action?n().createElement("div",{className:eX.relationship},n().createElement("div",{className:eX.searchBox},n().createElement("div",{className:eX.relationshipHeader},n().createElement("h4",{className:eX.productiveHeading},l("relationshipPlaceholder","Relationship")),n().createElement(u.$nd,{kind:"ghost",iconDescription:l("deleteRelationshipTooltipText","Delete"),hasIconOnly:!0,onClick:h},n().createElement(ek.zH,{size:16,className:eX.trashCan}))),n().createElement("div",null,m?n().createElement(eJ,{id:`relationships[${t}].relatedPersonUuid`,labelText:l("relativeFullNameLabelText","Full name"),placeholder:l("relativeNamePlaceholder","Firstname Familyname"),defaultValue:e.relatedPersonName,onSuggestionSelected:_,invalid:o,invalidText:l("relationshipPersonMustExist","Related person must be an existing person"),getSearchResults:f,getDisplayValue:e=>e.display,getFieldValue:e=>e.uuid}):n().createElement(n().Fragment,null,n().createElement("span",{className:eX.labelText},l("relativeFullNameLabelText","Full name")),n().createElement("p",{className:eX.bodyShort02},e.relatedPersonName)))),n().createElement("div",{className:eX.selectRelationshipType,style:{marginBottom:"1rem"}},n().createElement(u.Wdr,null,n().createElement(u.l6P,{id:c,labelText:l("relationship","Relationship"),onChange:p,name:`relationships[${t}].relationshipType`,value:e.relationshipType||"placeholder-item"},n().createElement(u.ebT,{disabled:!0,hidden:!0,value:"placeholder-item",text:l("relationshipToPatient","Relationship to patient")}),a.map((e,t)=>n().createElement(u.ebT,{text:e.display,value:`${e.uuid}/${e.direction}`,key:`relationship-${e.uuid}-${t}`})))))):n().createElement(u.kZS,{kind:"info",title:l("relationshipRemovedText","Relationship removed"),actionButtonLabel:l("restoreRelationshipActionButton","Undo"),onActionButtonClick:g})},eZ=()=>{let{relationshipTypes:e}=f(),[t,a]=(0,i.useState)([]),{t:r}=(0,b.useTranslation)();return((0,i.useEffect)(()=>{if(e){let t=[];e.results.forEach(e=>{let a={display:e.displayAIsToB?e.displayAIsToB:e.displayBIsToA,uuid:e.uuid,direction:"aIsToB"},i={display:e.displayBIsToA?e.displayBIsToA:e.displayAIsToB,uuid:e.uuid,direction:"bIsToA"};a.display===i.display?t.push(a):"Patient"===i.display?t.push(a,{display:`Patient (${a.display})`,uuid:e.uuid,direction:"bIsToA"}):t.push(a,i)}),a(t)}},[e]),e)?n().createElement("section",{"aria-label":"Relationships section"},n().createElement(E.ED,{name:"relationships"},({push:e,remove:a,form:{values:{relationships:i}}})=>n().createElement("div",null,i&&i.length>0?i.map((e,i)=>n().createElement("div",{key:e.uuid??e.clientId,className:ez.formSection},n().createElement(eQ,{relationship:e,index:i,displayRelationshipTypes:t,remove:a}))):null,n().createElement("div",{className:eX.actions},n().createElement(u.$nd,{kind:"ghost",onClick:()=>e({clientId:(0,F.A)(),relatedPersonUuid:"",action:"ADD"})},r("addRelationshipButtonText","Add Relationship")))))):n().createElement("section",{"aria-label":"Loading relationships section"},n().createElement("div",{role:"progressbar","aria-label":r("loading","Loading")},n().createElement(u.rrI,null)))};function e0({sectionDefinition:e}){switch(e.id){case"demographics":return n().createElement(eK,{fields:e.fields});case"death":return n().createElement(eW,{fields:e.fields});case"relationships":return n().createElement(eZ,null);default:return n().createElement(eH,{sectionDefinition:e})}}let e1=({sectionDefinition:e,index:t})=>{let{t:a}=(0,b.useTranslation)();return n().createElement("div",{id:e.id,style:{scrollMarginTop:"1rem"}},n().createElement("h3",{className:ez.productiveHeading02,style:{color:"#161616"}},t+1,". ",a(`${e.id}Section`,e.name)),n().createElement("span",{className:ez.label01},a("allFieldsRequiredText","All fields are required unless marked optional")),n().createElement("div",{style:{margin:"1rem 0 1rem"}},n().createElement(u.FAs,null,n().createElement(e0,{sectionDefinition:e}))))};var e2=a(57003);async function e4(e){return(await (0,m.getSynchronizationItems)(e2.dR)).find(t=>t._patientRegistrationData.formValues.patientUuid===e)}function e5(e){let{data:t,error:a,isLoading:n}=e_()(e?`${m.restBaseUrl}/person/${e}/attribute?v=custom:(uuid,display,attributeType:(uuid,display,format),value)`:null,m.openmrsFetch);return(0,i.useMemo)(()=>({data:t?.data?.results,isLoading:n}),[t?.data?.results,n])}let e6=({when:e,redirect:t})=>{let{t:a}=(0,b.useTranslation)(),n=(0,i.useRef)(!1),[r,l]=(0,i.useState)(),s=r||t,o=(0,i.useCallback)(e=>{let t=a("discardModalBody","The changes you made to this patient's details have not been saved. Discard changes?");return e.preventDefault(),e.returnValue=t,t},[a]),d=(0,i.useCallback)(e=>{if(!e.detail.navigationIsCanceled&&!n.current){n.current=!0,e.detail.cancelNavigation();let t=(0,m.showModal)("cancel-patient-edit-modal",{onConfirm:()=>{l(e.detail.newUrl),t()}},()=>{n.current=!1})}},[]);return(0,i.useEffect)(()=>{if(e&&void 0===s)return window.addEventListener("single-spa:before-routing-event",d),window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o),window.removeEventListener("single-spa:before-routing-event",d)}},[s,e,o,d]),(0,i.useEffect)(()=>{"string"==typeof s&&(0,m.navigate)({to:`\${openmrsSpaBase}/${s.split(window.getOpenmrsSpaBase())?.[1]}`})},[s]),null},e3={submit:"-esm-patient-registration__patient-registration__submit___5UPB7",cancelButton:"-esm-patient-registration__patient-registration__cancelButton___eEF4p",submitButton:"-esm-patient-registration__patient-registration__submitButton___4RhNt",infoGrid:"-esm-patient-registration__patient-registration__infoGrid___GxoOx",label01:"-esm-patient-registration__patient-registration__label01___dP1a4",space05:"-esm-patient-registration__patient-registration__space05___g8aca",divider:"-esm-patient-registration__patient-registration__divider___ftgRA",formContainer:"-esm-patient-registration__patient-registration__formContainer___LUBOk",stickyColumn:"-esm-patient-registration__patient-registration__stickyColumn___pGyZY",touchTarget:"-esm-patient-registration__patient-registration__touchTarget___OvQJY",linkName:"-esm-patient-registration__patient-registration__linkName___KqHmO",spinner:"-esm-patient-registration__patient-registration__spinner___wUSXi"},e7=({savePatientForm:e,isOffline:t})=>{let{t:a}=(0,b.useTranslation)(),{currentSession:r,identifierTypes:s}=f(),{patientUuid:o}=(0,d.useParams)(),{search:c}=(0,d.useLocation)(),{isLoading:p,patient:_}=(0,m.usePatient)(o),D=(0,m.useConfig)(),[I,A]=function(e,t,a){let{freeTextFieldConceptUuid:n}=(0,m.useConfig)(),{data:r,isLoading:l}=function(e){let{data:t,error:a,isLoading:n}=e_()(e?`${m.restBaseUrl}/person/${e}?v=custom:(uuid,display,causeOfDeath,dead,deathDate,causeOfDeathNonCoded)`:null,m.openmrsFetch);return(0,i.useMemo)(()=>({data:t?.data,isLoading:n}),[t?.data,n])}(a),{data:s,isLoading:o}=e5(a),{data:d,isLoading:u}=function(e){let{data:t,error:a,isLoading:n}=e_()(e?`${m.restBaseUrl}/patient/${e}/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)`:null,m.openmrsFetch);return(0,i.useMemo)(()=>{let e={};return t?.data?.results?.forEach(t=>{e[(0,y.A)(t.identifierType.name)]={identifierUuid:t.uuid,preferred:t.preferred,initialValue:t.identifier,identifierValue:t.identifier,identifierTypeUuid:t.identifierType.uuid,identifierName:t.identifierType.name,required:t.identifierType.required,selectedSource:null,autoGeneration:!1}}),{data:e,isLoading:n}},[t?.data?.results,n])}(a),{data:c,isLoading:p}=function(e){let t=!!e,{data:a,error:n,isLoading:r}=e_()(t?`${m.restBaseUrl}/relationship?v=${e2.DA}&person=${e}`:null,m.openmrsFetch);return(0,i.useMemo)(()=>({data:a?.data?.results.map(t=>t.personA.uuid===e?{relatedPersonName:t.personB.display,relatedPersonUuid:t.personB.uuid,relation:t.relationshipType.bIsToA,relationshipType:`${t.relationshipType.uuid}/bIsToA`,initialrelationshipTypeValue:`${t.relationshipType.uuid}/bIsToA`,uuid:t.uuid}:{relatedPersonName:t.personA.display,relatedPersonUuid:t.personA.uuid,relation:t.relationshipType.aIsToB,relationshipType:`${t.relationshipType.uuid}/aIsToB`,initialrelationshipTypeValue:`${t.relationshipType.uuid}/aIsToB`,uuid:t.uuid}),error:n,isLoading:r}),[a?.data?.results,n,r,e])}(a),{data:_}=function(e,t){let{registrationObs:a}=(0,m.useConfig)(),{data:i,error:n,isLoading:r}=e_()(t&&a.encounterTypeUuid?`${m.restBaseUrl}/encounter?patient=${e}&v=custom:(encounterDatetime,obs:(concept:ref,value:ref))&encounterType=${a.encounterTypeUuid}`:null,m.openmrsFetch),l=i?.data.results.sort(C)?.at(0)?.obs;return{data:l?.map(({concept:e,value:t})=>({[e.uuid]:"object"==typeof t?t?.uuid:t})).reduce((e,t)=>Object.assign(e,t),{}),isLoading:r,error:n}}(a,t),[f,h]=(0,i.useState)({additionalFamilyName:"",additionalGivenName:"",additionalMiddleName:"",addNameInLocalLanguage:!1,address:{},birthdate:null,birthdateEstimated:!1,deathCause:"",deathDate:void 0,deathTime:void 0,deathTimeFormat:"AM",familyName:"",gender:"",givenName:"",identifiers:{},isDead:!1,middleName:"",monthsEstimated:0,nonCodedCauseOfDeath:"",patientUuid:(0,F.A)(),relationships:[],telephoneNumber:"",yearsEstimated:0});return(0,i.useEffect)(()=>{(async()=>{if(t){let e=!/^\d{4}-\d{2}-\d{2}$/.test(t.birthDate),[a=0,i=0]=t.birthDate.split("-").map(e=>parseInt(e)),n=t.birthDate.split("-").length>1,r=e?Math.floor(w()().diff(t.birthDate,"month")/12):0,l=e&&n?w()().diff(t.birthDate,"month")%12:0;h(e=>{let a,i,n,s;return{...e,...(a={},i=t.name[0],n=t.name[1],a.patientUuid=t.id,a.givenName=i?.given[0],a.middleName=i?.given[1],a.familyName=i?.family,a.addNameInLocalLanguage=!!n||void 0,a.additionalGivenName=n?.given[0],a.additionalMiddleName=n?.given[1],a.additionalFamilyName=n?.family,a.gender=t.gender,a.birthdate=t.birthDate?(0,m.parseDate)(t.birthDate):void 0,a.telephoneNumber=t.telecom?t.telecom[0].value:"",{...a,...t.identifier.map(e=>({[(0,y.A)(e.system||e.type.text)]:e.value}))}),address:N(t),...(s={},t.telecom&&(s.phone=t.telecom[0].value),s),birthdateEstimated:!/^\d{4}-\d{2}-\d{2}$/.test(t.birthDate),yearsEstimated:r,monthsEstimated:l}})}else if(!e&&a){let e=await e4(a);if(!e._patientRegistrationData.formValues)return console.error(`Found a queued offline patient registration for patient ${a}, but without form values. Not using these values.`);h(e._patientRegistrationData.formValues)}})()},[e,t,a]),(0,i.useEffect)(()=>{if(!l&&r?.dead){let e=r.deathDate||null,t=e?new Date(e):void 0,a=t?w()(t).format("hh:mm"):void 0,i=t&&w()(t).hour()>=12?"PM":"AM";h(e=>({...e,isDead:r.dead||!1,deathDate:t,deathTime:a,deathTimeFormat:i,deathCause:r.causeOfDeathNonCoded?n:r.causeOfDeath?.uuid,nonCodedCauseOfDeath:r.causeOfDeathNonCoded}))}},[l,r,n]),(0,i.useEffect)(()=>{!p&&c&&h(e=>({...e,relationships:c})),!u&&d&&h(e=>({...e,identifiers:d}))},[p,c,u,d]),(0,i.useEffect)(()=>{if(!o&&s){let e=s.reduce((e,t)=>({...e,[t.attributeType.uuid]:"org.openmrs.Concept"===t.attributeType.format&&"object"==typeof t.value?t.value?.uuid:t.value}),{});h(t=>({...t,attributes:e}))}},[s,o]),(0,i.useEffect)(()=>{t&&_&&h(e=>({...e,obs:_}))},[_,t]),[f,h]}(p,_,o),[q]=function(e={},t,a,n){let r=(0,i.useRef)(e),[l,s]=(0,i.useState)(r.current);return(0,i.useEffect)(()=>{(async()=>{if(a)s(e=>({...e,address:N(a)}));else if(!t&&n){let e=await e4(n);s(e?._patientRegistrationData.initialAddressFieldValues??r.current)}})()},[t,a,n]),[l,s]}({},p,_,o),[$]=function(e={},t,a,n){let r=(0,i.useRef)(e),[l,s]=(0,i.useState)(r.current),{data:o}=e5(n);return(0,i.useEffect)(()=>{let e=new AbortController;return async function(){if(a)s(e=>{let t,i,n;return{...e,...(t=a.name[0],i=a.name[1],n=a.address?.[0],{preferredNameUuid:t?.id,additionalNameUuid:i?.id,preferredAddressUuid:n?.id,...a.identifier.map(e=>({[(0,y.A)(e.system||e.type.text)]:{uuid:e.id,value:e.value}}))})}});else if(!t&&n)try{let t=await e4(n);e.signal.aborted||s(t?._patientRegistrationData.patientUuidMap??r.current)}catch(t){e.signal.aborted||console.error("Failed to get patient registration:",t)}}(),()=>e.abort()},[t,a,n]),(0,i.useEffect)(()=>{o&&s(e=>{let t;return{...e,...(t={},o.forEach(e=>{t[`attribute.${e?.attributeType?.uuid}`]=e?.uuid}),t)}})},[o]),[l,s]}({},p,_,o),[P,M]=(0,i.useState)(),[R,B]=(0,i.useState)(null),U=r?.sessionLocation?.uuid,j=p?void 0:!!(o&&_),V=(0,i.useMemo)(()=>"true"===localStorage.getItem("openmrs:devtools")&&!j,[j]),{data:Y}=(0,m.usePatientPhoto)(_?.id),G=(0,i.useRef)(new h.u),H=k.Ik({givenName:k.Yj().required(a("givenNameRequired","Given name is required")),familyName:k.Yj().required(a("familyNameRequired","Family name is required")),additionalGivenName:k.Yj().when("addNameInLocalLanguage",{is:!0,then:k.Yj().required(a("givenNameRequired","Given name is required")),otherwise:k.Yj().notRequired()}),additionalFamilyName:k.Yj().when("addNameInLocalLanguage",{is:!0,then:k.Yj().required(a("familyNameRequired","Family name is required")),otherwise:k.Yj().notRequired()}),gender:k.Yj().oneOf(D.fieldConfigurations.gender.map(e=>e.value),a("genderUnspecified","Gender unspecified")).required(a("genderRequired","Gender is required")),birthdate:k.p6().when("birthdateEstimated",{is:!1,then:k.p6().required(a("birthdayRequired","Birthday is required")).max(Date(),a("birthdayNotInTheFuture","Birthday cannot be in future")).min(w()().subtract(140,"years").toDate(),a("birthdayNotOver140YearsAgo","Birthday cannot be more than 140 years ago")).nullable(),otherwise:k.p6().nullable()}),yearsEstimated:k.ai().when("birthdateEstimated",{is:!0,then:k.ai().required(a("yearsEstimateRequired","Estimated years required")).min(0,a("negativeYears","Estimated years cannot be negative")).max(140,a("nonsensicalYears","Estimated years cannot be more than 140")),otherwise:k.ai().nullable()}),monthsEstimated:k.ai().min(0,a("negativeMonths","Estimated months cannot be negative")),isDead:k.zM(),deathDate:k.p6().when("isDead",{is:!0,then:k.p6().required(a("deathDateRequired","Death date is required")),otherwise:k.p6().nullable()}).max(new Date,a("deathDateInFuture","Death date cannot be in future")).test("deathDate-not-before-birthdate",a("deathdayBeforeBirthday","Death date and time cannot be before the birthday"),function(e){let{birthdate:t}=this.parent;return!t||!e||!w()(e).isBefore(t,"day")}).test("deathDate-before-today",a("deathDateInFuture","Death date cannot be in future"),function(e){let{deathTime:t,deathTimeFormat:a}=this.parent;return!(e&&t&&a&&/^(1[0-2]|0?[1-9]):([0-5]?[0-9])$/.test(t))||w()((0,S.oq)(e,t,a)).isBefore(w()())}),deathTime:k.Yj().when("isDead",{is:!0,then:k.Yj().required(a("deathTimeRequired","Death time is required")),otherwise:k.Yj().nullable()}).matches(/^(1[0-2]|0?[1-9]):([0-5]?[0-9])$/,a("deathTimeInvalid","Time doesn't match the format 'hh:mm'")),deathTimeFormat:k.Yj().when("isDead",{is:!0,then:k.Yj().required(a("deathTimeFormatRequired","Time format is required")),otherwise:k.Yj().nullable()}).oneOf(["AM","PM"],a("deathTimeFormatInvalid","Time format is invalid")),deathCause:k.Yj().when("isDead",{is:!0,then:k.Yj().required(a("deathCauseRequired","Cause of death is required")),otherwise:k.Yj().nullable()}),nonCodedCauseOfDeath:k.Yj().when(["isDead","deathCause"],{is:(e,t)=>e&&t===D.freeTextFieldConceptUuid,then:k.Yj().required(a("nonCodedCauseOfDeathRequiredWhenSelected","Non-coded cause of death is required")),otherwise:k.Yj().nullable()}),email:k.Yj().optional().email(a("invalidEmail","Invalid email")),identifiers:k.RZ(e=>k.Ik(x()(e,()=>k.Ik({required:k.lc(),identifierValue:k.Yj().when("required",{is:!0,then:k.Yj().required(a("identifierValueRequired","Identifier value is required")),otherwise:k.Yj().notRequired()})})))),relationships:k.YO().of(k.Ik().shape({relatedPersonUuid:k.Yj().required(),relationshipType:k.Yj().required()}))});(0,i.useEffect)(()=>{},[I]);let z=(0,i.useMemo)(()=>D.sections.map(e=>D.sectionDefinitions.filter(t=>t.id===e)[0]??v.yk.filter(t=>t.id===e)[0]).filter(e=>e),[D.sections,D.sectionDefinitions]),W=async(t,i)=>{let n=new AbortController;i.setSubmitting(!0);let l={...t,identifiers:Object.fromEntries(Object.entries(t.identifiers).filter(([e,t])=>t.autoGeneration&&t.selectedSource.autoGenerationOption.manualEntryEnabled||void 0!==t.identifierValue))};try{await e(!j,l,$,q,R,U,I.identifiers,r,D,G.current,n),(0,m.showSnackbar)({subtitle:j?a("updatePatientSuccessSnackbarSubtitle","The patient's information has been successfully updated"):a("registerPatientSuccessSnackbarSubtitle","The patient can now be found by searching for them using their name or ID number"),title:j?a("updatePatientSuccessSnackbarTitle","Patient Details Updated"):a("registerPatientSuccessSnackbarTitle","New Patient Created"),kind:"success",isLowContrast:!0});let i=new URLSearchParams(c).get("afterUrl"),s=(0,m.interpolateUrl)(i||D.links.submitButton,{patientUuid:t.patientUuid});M(s)}catch(e){e.responseBody?.error?.globalErrors?e.responseBody.error.globalErrors.forEach(e=>{(0,m.showSnackbar)({title:j?a("updatePatientErrorSnackbarTitle","Patient Details Update Failed"):a("registrationErrorSnackbarTitle","Patient Registration Failed"),subtitle:e.message,kind:"error"})}):e.responseBody?.error?.message?(0,m.showSnackbar)({title:j?a("updatePatientErrorSnackbarTitle","Patient Details Update Failed"):a("registrationErrorSnackbarTitle","Patient Registration Failed"),subtitle:e.responseBody.error.message,kind:"error"}):(0,m.createErrorHandler)()(e),i.setSubmitting(!1)}},K=(0,i.useCallback)(e=>({identifierTypes:s,validationSchema:H,values:e.values,inEditMode:j,setFieldValue:e.setFieldValue,setFieldTouched:e.setFieldTouched,setCapturePhotoProps:B,currentPhoto:Y?.imageSrc,isOffline:t,initialFormValues:e.initialValues,setInitialFormValues:A}),[s,H,j,B,Y?.imageSrc,t,A]);return n().createElement(E.l1,{enableReinitialize:!0,initialValues:I,onSubmit:W,validationSchema:H},e=>n().createElement(E.lV,{className:e3.form},n().createElement(e6,{when:Object.keys(e.touched).length>0,redirect:P}),n().createElement("div",{className:e3.formContainer},n().createElement("div",{className:e3.stickyColumn},n().createElement("h4",null,j?a("editPatientDetails","Edit patient details"):a("createNewPatient","Create new patient")),V&&n().createElement(O,{setValues:e.setValues}),n().createElement("p",{className:e3.label01},a("jumpTo","Jump to")),z.map(e=>n().createElement("div",{className:l()(e3.space05,e3.touchTarget),key:e.name},n().createElement(u.N_E,{className:e3.linkName,onClick:()=>{var t;return t=e.id,void document.getElementById(t)?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"})}},n().createElement(g.WX,{size:16})," ",a(`${e.id}Section`,e.name)))),n().createElement("hr",{className:e3.divider}),n().createElement(u.$nd,{className:e3.submitButton,type:"submit",onClick:()=>e.validateForm().then(e=>{e&&"object"==typeof e&&Object.keys(e).length&&(0,m.showSnackbar)({isLowContrast:!0,kind:"warning",title:a("fieldsWithErrors","The following fields have errors:"),subtitle:n().createElement(n().Fragment,null,n().createElement("ul",{style:{listStyle:"inside"}},Object.keys(e).map((e,t)=>n().createElement("li",{key:t},a(`${e}LabelText`,e)))))})}),disabled:!r||!s||e.isSubmitting},e.isSubmitting?n().createElement(u.OuH,{className:e3.spinner,description:`${a("submitting","Submitting")} ...`,iconDescription:"submitting"}):j?a("updatePatient","Update patient"):a("registerPatient","Register patient")),n().createElement(u.$nd,{className:e3.cancelButton,kind:"secondary",onClick:T},a("cancel","Cancel"))),n().createElement("div",{className:e3.infoGrid},n().createElement(L,{value:K(e)},z.map((e,t)=>n().createElement(e1,{key:`registration-section-${e.id}`,sectionDefinition:e,index:t})))))))};function e9(){let e=(0,m.useConnectivity)(),t=(0,m.useSession)(),{data:a}=o()("patientRegistrationAddressTemplate",c.pX),{data:r}=o()("patientRegistrationRelationshipTypes",c.zL),{data:s}=o()("patientRegistrationPatientIdentifiers",c.Qi),p=(0,i.useMemo)(()=>e?h.A.savePatientFormOnline:h.A.savePatientFormOffline,[e]);return n().createElement("main",{className:l()("omrs-main-content","-esm-patient-registration__root__root___vsTSI")},n().createElement(u.xA9,{className:"-esm-patient-registration__root__grid___fHLiE"},n().createElement(_,{value:{addressTemplate:a,relationshipTypes:r,identifierTypes:s,currentSession:t}},n().createElement(d.BrowserRouter,{basename:window.getOpenmrsSpaBase()},n().createElement(d.Routes,null,n().createElement(d.Route,{path:"patient-registration",element:n().createElement(e7,{savePatientForm:p,isOffline:!e})}),n().createElement(d.Route,{path:"patient/:patientUuid/edit",element:n().createElement(e7,{savePatientForm:p,isOffline:!e})}))))))}}}]);
1
+ "use strict";(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([["5395"],{90414(e,t,a){a.r(t),a.d(t,{default:()=>e9});var i=a(97125),n=a.n(i),r=a(53373),l=a.n(r),s=a(74498),o=a.n(s),d=a(22745),u=a(23553),m=a(82895),c=a(58146);let p=(0,i.createContext)(null),_=p.Provider,f=()=>{let e=(0,i.useContext)(p);if(!e)throw Error("useResourcesContext must be used within a ResourcesContextProvider");return e};var h=a(54328),g=a(74632),b=a(75921),E=a(33852),v=a(77488),y=a(23073);function T(){window.history.back()}function N(e){let t={},a=e.address?.[0];if(a)for(let e of Object.keys(a))switch(e){case"city":t.cityVillage=a[e];break;case"state":t.stateProvince=a[e];break;case"district":t.countyDistrict=a[e];break;case"extension":a[e].forEach(e=>{e.extension.forEach(e=>{t[e.url.split("#")[1]]=e.valueString})});break;default:("country"===e||"postalCode"===e)&&(t[e]=a[e])}return t}let C=(e,t)=>new Date(t.encounterDatetime).getTime()-new Date(e.encounterDatetime).getTime();var D=a(77248),w=a.n(D),k=a(69534),I=a(46155),x=a.n(I),S=a(81507),F=a(43126);let A={fieldRow:"-esm-patient-registration__input__fieldRow___T70rP",subFieldRow:"-esm-patient-registration__input__subFieldRow___dOohF",label:"-esm-patient-registration__input__label___5Wuq+",textID:"-esm-patient-registration__input__textID___9Cju5",comboInput:"-esm-patient-registration__input__comboInput___pj9A+",requiredField:"-esm-patient-registration__input__requiredField___NBD7N",input:"-esm-patient-registration__input__input___SEGKS",checkboxField:"-esm-patient-registration__input__checkboxField___6+MfA",textInput:"-esm-patient-registration__input__textInput___4fTq0",numberInput:"-esm-patient-registration__input__numberInput___M2Wig",checkboxInput:"-esm-patient-registration__input__checkboxInput___3upGA",selectInput:"-esm-patient-registration__input__selectInput___xBon9",dateInput:"-esm-patient-registration__input__dateInput___Yp0sj",telInput:"-esm-patient-registration__input__telInput___yL6g-",errorInput:"-esm-patient-registration__input__errorInput___R+JXW",errorMessage:"-esm-patient-registration__input__errorMessage___6zL-O",dummyData:"-esm-patient-registration__input__dummyData___bBMm5",IDInput:"-esm-patient-registration__input__IDInput___cs08f",trashCan:"-esm-patient-registration__input__trashCan___pMV3T",dangerLabel01:"-esm-patient-registration__input__dangerLabel01___hFTR0",comboInputEntries:"-esm-patient-registration__input__comboInputEntries___xzA5f",comboInputItemOption:"-esm-patient-registration__input__comboInputItemOption___m+L0M",actionButtonContainer:"-esm-patient-registration__input__actionButtonContainer___-7dfm"},q={patientUuid:(0,F.A)(),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:"",deathTime:"",deathTimeFormat:"AM",deathCause:"",nonCodedCauseOfDeath:"",relationships:[],address:{address1:"Bom Jesus Street",address2:"",cityVillage:"Recife",stateProvince:"Pernambuco",country:"Brazil",postalCode:"50030-310"},identifiers:{}},O=({setValues:e})=>{let{t}=(0,b.useTranslation)();return n().createElement(u.$nd,{kind:"tertiary",onClick:()=>e(q),className:A.dummyData,"aria-label":t("inputDummyData","Input Dummy Data")},t("inputDummyData","Input Dummy Data"))},$=(0,i.createContext)(void 0),L=$.Provider,P=()=>{let e=(0,i.useContext)($);if(!e)throw Error("usePatientRegistrationContext must be used within a PatientRegistrationContextProvider");return e};async function M(e){let t=await (0,m.openmrsFetch)(e),a=t?.data;if(Array.isArray(a))return t;if(!("object"!=typeof a||null===a||Array.isArray(a))&&("message"in a||"localizedMessage"in a)&&("stackTrace"in a||"cause"in a))throw Error(`The address hierarchy module responded to ${e} with a server error: ${a.message??a.localizedMessage}`);throw Error(`Expected an array of address hierarchy entries from ${e}, but the response body was not an array`)}function R(){let{data:e,isLoading:t,error:a}=o()("/module/addresshierarchy/ajax/getOrderedAddressHierarchyLevels.form",M);return(0,i.useMemo)(()=>({orderedFields:e?.data?.map(e=>e.addressField)??[],isLoadingFieldOrder:t,errorFetchingFieldOrder:a}),[e,t,a])}let B=({checkWarning:e,...t})=>{let[a,r]=(0,E.Mt)(t.name),{t:l}=(0,b.useTranslation)(),s=a.value||"",o=r.error||"",d=(0,i.useMemo)(()=>{if(!o&&"function"==typeof e){let t=e(s);return t&&l(t)}},[e,o,s,l]),m=t.required?t.labelText:`${t.labelText} (${l("optional","optional")})`;return n().createElement("div",{style:{marginBottom:"1rem"}},n().createElement(u.Wdr,null,n().createElement(u.ksK,{...t,...a,labelText:m,invalid:!!(r.touched&&r.error),invalidText:o,warn:!!d,warnText:d,value:s})))},U=function(){return n().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"},n().createElement("path",{d:"M13 24L4 15 5.414 13.586 13 21.171 26.586 7.586 28 9 13 24z"}))},j=({entries:e,error:t,isLoading:a,name:r,fieldProps:s,handleInputChange:o,handleSelection:d})=>{let{t:m}=(0,b.useTranslation)(),[c,p]=(0,i.useState)(-1),{value:_=""}=s,[f,h]=(0,i.useState)(!1),g=(0,i.useRef)(null),E=(0,i.useCallback)(()=>{h(!0),p(-1)},[h,p]),v=(0,i.useMemo)(()=>e?_?e.filter(e=>e.toLowerCase().includes(_.toLowerCase())):e:[],[e,_]),y=(0,i.useCallback)((e,t=null)=>{t?.preventDefault(),d(e),h(!1)},[d,h]),T=(0,i.useCallback)(e=>{let t=v.length??0;"Tab"===e.key&&(h(!1),p(-1)),"ArrowUp"===e.key?p(e=>Math.max(-1,e-1)):"ArrowDown"===e.key?p(e=>Math.min(t-1,e+1)):"Enter"===e.key&&(e.preventDefault(),c>-1&&y(v[c]))},[c,y,v,p,h]);return(0,i.useEffect)(()=>{let e=e=>{g.current.contains(e.target)||(h(!1),p(-1))};return window.addEventListener("click",e),()=>{window.removeEventListener("click",e)}},[]),n().createElement("div",{className:A.comboInput,ref:g},n().createElement(u.Wdr,null,n().createElement(u.ksK,{...s,id:s.id||r,onChange:e=>{p(-1),o(e.target.value)},onFocus:E,autoComplete:"off",onKeyDown:T})),n().createElement("div",{className:A.comboInputEntries},f&&n().createElement("div",{className:"cds--combo-box cds--list-box cds--list-box--expanded"},n().createElement("div",{id:"downshift-1-menu",className:"cds--list-box__menu",role:"listbox"},a?n().createElement("div",{className:"cds--list-box__menu-item"},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption)},m("searching","Searching..."))):t?n().createElement("div",{className:"cds--list-box__menu-item"},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption)},m("errorFetchingResults","Error fetching results"))):v.length>0?v.map((e,t)=>n().createElement("div",{className:l()("cds--list-box__menu-item",{"cds--list-box__menu-item--highlighted":t===c}),key:t,id:"downshift-1-item-0",role:"option",tabIndex:-1,"aria-selected":"true",onClick:()=>y(e)},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption,{"cds--list-box__menu-item--active":e===_})},e,e===_&&n().createElement(U,null)))):_?n().createElement("div",{className:"cds--list-box__menu-item"},n().createElement("div",{className:l()("cds--list-box__menu-item__option",A.comboInputItemOption)},m("noMatchingResults","No matching results"))):null))))},V=({attribute:e})=>{let{t}=(0,b.useTranslation)(),[a,r,{setValue:l}]=(0,E.Mt)(`address.${e.name}`),{fetchEntriesForField:s,searchString:d,updateChildElements:u}=function(e){let{orderedFields:t,isLoadingFieldOrder:a}=R(),{setFieldValue:n}=P(),[,{value:r}]=(0,E.Mt)("address"),l=(0,i.useMemo)(()=>a?-1:t?.findIndex(t=>t===e)??-1,[t,e,a]),s=(0,i.useMemo)(()=>{let e=!0,a=t?.slice(0,l)??[],i=[];for(let t of a){if(!r[t]){e=!1;break}i.push(r[t])}return{fetchEntriesForField:e,searchString:i.join("|")}},[t,l,r]),o=(0,i.useCallback)(()=>{a||t?.slice(l+1).map(e=>{n(`address.${e}`,"")})},[l,a,t,n]);return(0,i.useMemo)(()=>({...s,updateChildElements:o}),[s,o])}(e.name),{entries:m,isLoadingAddressEntries:c,errorFetchingAddressEntries:p}=function(e,t){let a=encodeURIComponent(t),{data:n,isLoading:r,error:l}=o()(e?`module/addresshierarchy/ajax/getChildAddressHierarchyEntries.form?searchString=${a}`:null,M);return(0,i.useEffect)(()=>{l&&console.error(l)},[l]),(0,i.useMemo)(()=>({entries:n?.data?.map(e=>e.name)??[],isLoadingAddressEntries:r,errorFetchingAddressEntries:l}),[n,r,l])}(s,d),_=t(e.label)+(e?.required?"":` (${t("optional","optional")})`),f=(0,i.useCallback)(e=>{l(e)},[l]),h=(0,i.useCallback)(e=>{r.value!==e&&(l(e),u())},[u,r.value,l]);return n().createElement(j,{entries:m,error:p,isLoading:c,handleSelection:h,name:`address.${e.name}`,fieldProps:{...a,id:e.name,labelText:_,required:e?.required},handleInputChange:f})},Y=({orderedAddressFields:e})=>n().createElement(n().Fragment,null,e.map(e=>n().createElement(V,{key:e.id,attribute:e}))),G="-esm-patient-registration__address-search__noResults___MaR0+",H=({addressLayout:e})=>{let{t}=(0,b.useTranslation)(),a=(0,i.useRef)(null),r=(0,i.useRef)(null),[l,s]=(0,i.useState)(""),{addresses:d,isLoading:m,error:c}=function(e){let{data:t,error:a,isLoading:n}=o()(e?`/module/addresshierarchy/ajax/getPossibleFullAddresses.form?separator= > &searchString=${e}`:null,M);return(0,i.useMemo)(()=>({addresses:t?.data?.map(e=>e.address)??[],error:a,isLoading:n}),[t?.data,a,n])}(l),p=(0,i.useMemo)(()=>{let e=new Set;return d.forEach(t=>{let a=t.split(" > ");a.forEach((t,i)=>{t.toLowerCase().includes(l.toLowerCase())&&e.add(a.slice(0,i+1).join(" > "))})}),[...e]},[d,l]),{setFieldValue:_}=(0,E.j7)(),f=e=>{r.current&&!r.current.contains(e.target)&&s("")};return(0,i.useEffect)(()=>(document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}),[r]),n().createElement("div",{className:"-esm-patient-registration__address-search__autocomplete___Bu8jL",ref:r,style:{marginBottom:"1rem"}},n().createElement(u.vji,{onChange:e=>{s(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},labelText:t("searchAddress","Search address"),placeholder:t("searchAddress","Search address"),ref:a,value:l}),l&&n().createElement("ul",{className:"-esm-patient-registration__address-search__suggestions___j2wBA"},m?n().createElement("li",{className:"-esm-patient-registration__address-search__loading___Ic4y+"},t("searching","Searching...")):c?n().createElement("li",{className:G},t("errorFetchingAddresses","Error fetching address results")):p.length>0?p.map(t=>n().createElement("li",{key:t,onClick:()=>(t=>{if(t){let a=t.split(" > ");e.map(({name:e},t)=>{_(`address.${e}`,a?.[t]??"")}),s("")}})(t)},t)):n().createElement("li",{className:G},t("noAddressResults","No matching addresses found"))))},z="-esm-patient-registration__field__productiveHeading02Light___oq7j1",W="-esm-patient-registration__field__label01___H7Ys0",K="-esm-patient-registration__field__grid___PPXoN",J="-esm-patient-registration__field__halfWidthInDesktopView___7mF3o",X="-esm-patient-registration__field__dobField___YdyBD",Q="-esm-patient-registration__field__dobContentSwitcherLabel___UhgIs",Z="-esm-patient-registration__field__identifierLabelText___EJqal",ee="-esm-patient-registration__field__customField___MVa8X",et=()=>{let e=(0,m.useConfig)(),{t}=(0,b.useTranslation)(),{setFieldValue:a}=P(),{orderedFields:r,isLoadingFieldOrder:l,errorFetchingFieldOrder:s}=R(),o=(0,m.useConnectivity)(),{fieldConfigurations:{address:{useAddressHierarchy:{enabled:d,useQuickSearch:c,searchAddressByLevel:p}}}}=e,{addressTemplate:_}=f(),h=(0,i.useMemo)(()=>{if(!_?.lines)return[];let e=_?.lines?.flat(),t=e?.filter(({isToken:e})=>"IS_ADDR_TOKEN"===e),a=Object.fromEntries(_?.requiredElements?.map(e=>[e,e])||[]);return t.map(({displayText:e,codeName:t})=>({id:t,name:t,label:e,required:!!a[t]}))},[_]),[g,E]=(0,i.useState)("");(0,i.useEffect)(()=>{_?.elementDefaults&&Object.entries(_.elementDefaults).forEach(([e,t])=>{a(`address.${e}`,t)})},[_,a]);let v=(0,i.useMemo)(()=>{if(l||s)return[];let e=Object.fromEntries((r??[]).map((e,t)=>[e,t]));return[...h].sort((t,a)=>e[t.name]-e[a.name])},[l,s,r,h]);return _&&!Object.keys(_)?.length?n().createElement(ea,null,n().createElement("div",{role:"progressbar","aria-label":t("loading","Loading")},n().createElement(u.rrI,null))):d&&o?l?n().createElement(ea,null,n().createElement("div",{role:"progressbar","aria-label":t("loading","Loading")},n().createElement(u.rrI,null))):s?n().createElement(ea,null,n().createElement(u.jeF,{style:{margin:"0",minWidth:"100%"},kind:"error",lowContrast:!0,title:t("errorFetchingOrderedFields","Error occurred fetching ordered fields for address hierarchy")})):n().createElement(ea,null,c&&n().createElement(H,{addressLayout:v}),p?n().createElement(Y,{orderedAddressFields:v}):v.map((e,a)=>n().createElement(B,{key:`combo_input_${a}`,name:`address.${e.name}`,labelText:t(e.label),id:e.name,value:g,required:e.required}))):n().createElement(ea,null,h.map((e,a)=>n().createElement(B,{key:`combo_input_${a}`,name:`address.${e.name}`,labelText:t(e.label),id:e.name,value:g,required:e.required})))},ea=({children:e})=>{let{t}=(0,b.useTranslation)(),a=(0,i.useMemo)(()=>({fieldConfigurations:{},setFieldValue:async()=>{},values:{}}),[]);return n().createElement(_,{value:{addressTemplate:{},currentSession:{},identifierTypes:[],relationshipTypes:{results:[]}}},n().createElement(L,{value:a},n().createElement("div",null,n().createElement("h4",{className:z},t("addressHeader","Address")),n().createElement("div",{style:{paddingBottom:"5%"}},e))))};function ei(e){let{data:t,error:a,isLoading:n}=o()("string"==typeof e&&""!==e?`${m.restBaseUrl}/concept/${e}?v=custom:(uuid,display,answers:(uuid,display))`:null,m.openmrsFetch);return a&&(0,m.showSnackbar)({title:a.name,subtitle:a.message,kind:"error"}),(0,i.useMemo)(()=>({data:t?.data?.answers,isLoading:n,error:a}),[n,a,t])}let en=()=>{let{t:e}=(0,b.useTranslation)(),{fieldConfigurations:t,freeTextFieldConceptUuid:a}=(0,m.useConfig)(),[r,s]=(0,E.Mt)("deathCause"),o=t?.causeOfDeath?.conceptUuid,d=t?.causeOfDeath?.required,{data:c,isLoading:p,error:_}=ei(o),f=(0,i.useMemo)(()=>!p&&c?c.map(e=>({...e,label:e.display})):[],[c,p]);return p?n().createElement("div",{className:l()(ee,J)},n().createElement("h4",{className:z},e("causeOfDeathInputLabel","Cause of death")),n().createElement(u.aB4,null)):n().createElement("div",{className:l()(ee,J)},n().createElement("h4",{className:z},e("causeOfDeathInputLabel","Cause of death")),_||!o?n().createElement(u.jeF,{hideCloseButton:!0,kind:"error",title:e("errorFetchingCodedCausesOfDeath","Error fetching coded causes of death"),subtitle:e("refreshOrContactAdmin","Try refreshing the page or contact your system administrator")}):n().createElement(n().Fragment,null,n().createElement(E.D0,{name:"deathCause"},({field:t,form:{touched:a,errors:i},meta:r})=>n().createElement(u.Wdr,null,n().createElement(u.l6P,{...t,id:"deathCause",invalid:i.deathCause&&a.deathCause,invalidText:i.deathCause?.message,labelText:e("causeOfDeathInputLabel","Cause of death"),name:"deathCause",required:d},n().createElement(u.ebT,{id:"empty-default-option",value:null,text:e("selectAnOption","Select an option")}),f.map(e=>n().createElement(u.ebT,{id:e.uuid,key:e.uuid,text:e.label,value:e.uuid}))))),r.value===a&&n().createElement("div",{className:"-esm-patient-registration__field__nonCodedCauseOfDeath___W7AAV"},n().createElement(E.D0,{name:"nonCodedCauseOfDeath"},({field:t,form:{touched:a,errors:i},meta:r})=>n().createElement(u.Wdr,null,n().createElement(u.ksK,{...t,id:"nonCodedCauseOfDeath",invalid:i?.nonCodedCauseOfDeath&&a.nonCodedCauseOfDeath,invalidText:i?.nonCodedCauseOfDeath?.message,labelText:e("nonCodedCauseOfDeath","Non-coded cause of death"),placeholder:e("enterNonCodedCauseOfDeath","Enter non-coded cause of death")}))))))},er=({fieldDefinition:e})=>{let{t}=(0,b.useTranslation)();return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:e.id},({field:a,form:{touched:i,errors:r},meta:l})=>n().createElement(B,{id:e.id,labelText:t(`${e.label}`,`${e.label}`),required:e?.validation?.required??!1,...a})))};function el({fieldDefinition:e}){let{t}=(0,b.useTranslation)(),{data:a,isLoading:r}=function(e){let{data:t,error:a,isLoading:n}=o()("string"==typeof e&&""!==e?`${m.restBaseUrl}/concept/${e}`:null,m.openmrsFetch);return a&&(0,m.showSnackbar)({title:a.name,subtitle:a.message,kind:"error"}),(0,i.useMemo)(()=>({data:t?.data,isLoading:n}),[t,n])}(e.uuid);if(!(0,m.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(r)return null;switch(a.datatype.display){case"Text":return n().createElement(es,{concept:a,validationRegex:e.validation.matches,label:e.label,required:e.validation.required});case"Numeric":return n().createElement(eo,{concept:a,label:e.label,required:e.validation.required});case"Date":return n().createElement(ed,{concept:a,label:e.label,required:e.validation.required,allowPastDates:e.allowPastDates,allowFutureDates:e.allowFutureDates});case"Coded":return n().createElement(eu,{concept:a,answerConceptSetUuid:e.answerConceptSetUuid,label:e.label,required:e.validation.required,customConceptAnswers:e.customConceptAnswers});default:return n().createElement(u.jeF,{kind:"error",title:"Error"},t("obsFieldUnknownDatatype","Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",{fieldDefinitionId:e.id,datatypeName:a.datatype.display}))}}function es({concept:e,validationRegex:t,label:a,required:i}){let{t:r}=(0,b.useTranslation)(),s=`obs.${e.uuid}`;return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:s,validate:e=>{if(e&&t&&""!==t&&"string"==typeof t&&""!==e){if(!new RegExp(t).test(e))return r("invalidInput","Invalid Input")}}},({field:t,form:{touched:r,errors:l},meta:o})=>n().createElement(B,{id:s,labelText:a??e.display,required:i,invalid:l[s]&&r[s],...t})))}function eo({concept:e,label:t,required:a}){let i=`obs.${e.uuid}`;return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:i},({field:r,form:{touched:l,errors:s},meta:o})=>n().createElement(B,{id:i,labelText:t??e.display,required:a,invalid:s[i]&&l[i],type:"number",...r})))}function ed({concept:e,label:t,required:a,allowPastDates:i,allowFutureDates:r}){let{t:l}=(0,b.useTranslation)(),s=`obs.${e.uuid}`,{setFieldValue:o}=P(),d=r??!0,c=i??!0,p=e=>{o(s,e)};return n().createElement(u.Wdr,null,n().createElement("div",{className:X},n().createElement(E.D0,{name:s},({field:i,form:{touched:r,errors:o},meta:u})=>n().createElement(n().Fragment,null,n().createElement(m.OpenmrsDatePicker,{id:s,...i,isRequired:a,onChange:p,labelText:t??e.display,isInvalid:o[s]&&r[s],invalidText:l(u.error),value:i.value,minDate:c?void 0:new Date,maxDate:d?void 0:new Date})))))}function eu({concept:e,answerConceptSetUuid:t,label:a,required:r,customConceptAnswers:s}){let{t:o}=(0,b.useTranslation)(),d=`obs.${e.uuid}`,{data:m,isLoading:c}=ei(s.length?"":t??e.uuid),p=(0,i.useMemo)(()=>s.length?s:c?[]:m.map(e=>({...e,label:e.display})),[s,m,c]);return n().createElement("div",{className:l()(ee,J)},c?null:n().createElement(E.D0,{name:d},({field:t,form:{touched:i,errors:l},meta:s})=>n().createElement(u.Wdr,null,n().createElement(u.l6P,{id:d,name:d,labelText:a??e?.display,required:r,invalid:l[d]&&i[d],...t},n().createElement(u.ebT,{key:`no-answer-select-item-${d}`,value:"",text:o("selectAnOption","Select an option")}),p.map(e=>n().createElement(u.ebT,{key:e.uuid,value:e.uuid,text:e.label}))))))}function em({id:e,personAttributeType:t,answerConceptSetUuid:a,label:r,customConceptAnswers:s,required:o}){let{data:d,isLoading:c}=ei(s.length?"":a),{t:p}=(0,b.useTranslation)(),_=`attributes.${t.uuid}`,[f,h]=(0,i.useState)(!1);(0,i.useEffect)(()=>{a||s.length||((0,m.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:e})),h(!0))},[a,s,e,p]),(0,i.useEffect)(()=>{c||s.length||(d||((0,m.reportError)(p("codedPersonAttributeAnswerSetInvalid","The coded person attribute field '{{codedPersonAttributeFieldId}}' has been defined with an invalid answer concept set UUID '{{answerConceptSetUuid}}'.",{codedPersonAttributeFieldId:e,answerConceptSetUuid:a})),h(!0)),d?.length===0&&((0,m.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:e,answerConceptSetUuid:a})),h(!0)))},[c,d,s,p,e,a]);let g=(0,i.useMemo)(()=>s.length?s:c||!d?[]:d.map(e=>({...e,label:e.display})).sort((e,t)=>e.label.localeCompare(t.label)),[s,d,c]);return f?null:n().createElement("div",{className:l()(ee,J)},c?null:n().createElement(u.Wdr,null,n().createElement(E.D0,{name:_},({field:a,form:{touched:i,errors:l},meta:s})=>n().createElement(n().Fragment,null,n().createElement(u.l6P,{id:e,name:`person-attribute-${t.uuid}`,labelText:r??t?.display,invalid:l[_]&&i[_],required:o,...a},n().createElement(u.ebT,{value:"",text:p("selectAnOption","Select an option")}),g.map(e=>n().createElement(u.ebT,{key:e.uuid,value:e.uuid,text:e.label})))))))}function ec({id:e,personAttributeType:t,validationRegex:a,label:i,required:r}){let{t:s}=(0,b.useTranslation)(),o=`attributes.${t.uuid}`;return n().createElement("div",{className:l()(ee,J)},n().createElement(E.D0,{name:o,validate:e=>{if(e&&a&&""!==a&&"string"==typeof a&&""!==e){if(!new RegExp(a).test(e))return s("invalidInput","Invalid Input")}}},({field:a,form:{touched:l,errors:s},meta:d})=>n().createElement(B,{id:e,name:`person-attribute-${t.uuid}`,labelText:i??t?.display,invalid:s[o]&&l[o],...a,required:r})))}var ep=a(28909),e_=a.n(ep);function ef({personAttributeType:e,id:t,label:a,locationTag:r,required:s}){let{t:o}=(0,b.useTranslation)(),d=`attributes.${e.uuid}`,[c,p,{setValue:_}]=(0,E.Mt)(`attributes.${e.uuid}`),[f,h]=(0,i.useState)(""),{locations:g,isLoading:v,loadingNewData:y}=function(e,t=""){let a=(0,m.useDebounce)(t),n=(0,i.useMemo)(()=>{let t=`${m.fhirBaseUrl}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),a||i.append("_count","10"),e&&i.append("_tag",e),"string"==typeof a&&""!==a&&i.append("name:contains",a),t+i.toString()},[e,a]),{data:r,isLoading:l,isValidating:s}=e_()(n,m.openmrsFetch);return(0,i.useMemo)(()=>({locations:r?.data?.entry||[],isLoading:l,loadingNewData:s}),[r,l,s])}(r||null,f),T=(0,i.useRef)([]),N=(0,i.useMemo)(()=>{if(!(v&&y)){let e=g.map(({resource:{id:e,name:t}})=>({value:e,label:t}));return T.current=e,e}return T.current},[g,v,y]),C=(0,i.useMemo)(()=>"string"==typeof p.value?N.find(({value:e})=>e===p.value)||null:"object"==typeof p.value&&p.value&&N.find(({value:e})=>e===p.value.uuid)||null,[N,p.value]),D=(0,i.useCallback)(e=>{e&&(N.find(({label:t})=>t===e)||(h(e),_(null)))},[N,_]),w=(0,i.useCallback)(({selectedItem:e})=>{e&&_(e.value)},[_]);return n().createElement("div",{className:l()(ee,J,"-esm-patient-registration__field__locationAttributeFieldContainer___Uw7Q9")},n().createElement(u.Wdr,null,n().createElement(E.D0,{name:d},({field:i,form:{touched:r,errors:l}})=>n().createElement(u.a32,{id:t,name:`person-attribute-${e.uuid}`,titleText:a,items:N,placeholder:o("searchLocationPersonAttribute","Search location"),onInputChange:D,required:s,onChange:w,selectedItem:C,invalid:l[d]&&r[d],typeahead:!0}))),y&&n().createElement("div",{className:"-esm-patient-registration__field__loadingContainer___6pGRw"},n().createElement(u.OuH,null)))}function eh({fieldDefinition:e}){let{data:t,isLoading:a,error:r}=function(e){let{data:t,error:a,isLoading:i}=o()(`${m.restBaseUrl}/personattributetype/${e}`,m.openmrsFetch);return{data:t?.data,isLoading:i,error:a}}(e.uuid),{t:l}=(0,b.useTranslation)(),s=(0,i.useMemo)(()=>{if(!t)return null;switch(t.format){case"java.lang.String":return n().createElement(ec,{personAttributeType:t,validationRegex:e.validation?.matches??"",label:e.label,required:e.validation?.required??!1,id:e?.id});case"org.openmrs.Concept":return n().createElement(em,{personAttributeType:t,answerConceptSetUuid:e.answerConceptSetUuid,label:e.label,id:e?.id,customConceptAnswers:e.customConceptAnswers??[],required:e.validation?.required??!1});case"org.openmrs.Location":return n().createElement(ef,{personAttributeType:t,locationTag:e.locationTag,label:e.label,id:e?.id,required:e.validation?.required??!1});default:return n().createElement(u.jeF,{kind:"error",title:"Error"},l("unknownPatientAttributeType","Patient attribute type has unknown format {{personAttributeTypeFormat}}",{personAttributeTypeFormat:t.format}))}},[t,e,l]);return a?n().createElement("div",null,e.showHeading&&n().createElement("h4",{className:z},e?.label),n().createElement(u.P3Z,null)):r?n().createElement("div",null,e.showHeading&&n().createElement("h4",{className:z},e?.label),n().createElement(u.jeF,{kind:"error",title:l("error","Error")},l("unableToFetch","Unable to fetch person attribute type - {{personattributetype}}",{personattributetype:e?.label??e?.id}))):n().createElement("div",null,e.showHeading&&n().createElement("h4",{className:z},e?.label??t?.display),s)}function eg({name:e}){let t=(0,m.useConfig)().fieldDefinitions.filter(t=>t.id===e)[0];return"person attribute"===t.type?n().createElement(eh,{fieldDefinition:t}):"obs"===t.type?n().createElement(el,{fieldDefinition:t}):"address"===t.type?n().createElement(er,{fieldDefinition:t}):n().createElement("div",null,"Error: Unknown field type ",t.type)}let eb=()=>{let{t:e}=(0,b.useTranslation)();return n().createElement("div",{className:l()("-esm-patient-registration__field__dodField___SuHIe",J)},n().createElement("h4",{className:z},e("deathDateInputLabel","Date of death")),n().createElement("span",null,n().createElement(eE,null),n().createElement(ev,null)))};function eE(){let{values:e,setFieldValue:t}=P(),[a,r]=(0,E.Mt)("deathDate"),{t:l}=(0,b.useTranslation)(),s=w()().hour(23).minute(59).second(59).toDate(),o=(0,i.useCallback)(e=>{t("deathDate",e?w()(e).hour(0).minute(0).second(0).millisecond(0).toDate():void 0)},[t]);return n().createElement(u.Wdr,null,n().createElement(m.OpenmrsDatePicker,{...a,id:"deathDate",invalidText:l(r.error),invalid:!!(r.touched&&r.error),isRequired:e.isDead,labelText:l("deathDateInputLabel","Date of death"),maxDate:s,onChange:o}))}function ev(){let{t:e}=(0,b.useTranslation)(),[t,a]=(0,E.Mt)("deathTime"),[i,r]=(0,E.Mt)("deathTimeFormat");return n().createElement(u.Wdr,null,n().createElement(u.AG,{...t,id:"time-picker",labelText:e("timeOfDeathInputLabel","Time of death (hh:mm)"),className:"-esm-patient-registration__field__timeOfDeathField___2JFHZ",pattern:"^(1[0-2]|0?[1-9]):([0-5]?[0-9])$",invalid:!!(a.touched&&a.error),invalidText:e(a.error)},n().createElement(u.E_7,{...i,id:"time-format-picker","aria-label":e("timeFormat","Time Format")},n().createElement(u.ebT,{value:"AM",text:"AM"}),n().createElement(u.ebT,{value:"PM",text:"PM"}))))}let ey=(e,t,a)=>{let{enabled:i,month:n,dayOfMonth:r}=a.useEstimatedDateOfBirth,l=new Date,s=new Date(l.getFullYear()-e,l.getMonth()-t,1),o=new Date(s.getFullYear(),s.getMonth()+1,0).getDate(),d=new Date(s.getFullYear(),s.getMonth(),Math.min(l.getDate(),o));return i?new Date(d.getFullYear(),n,r):d},eT=()=>{let{t:e}=(0,b.useTranslation)(),{fieldConfigurations:{dateOfBirth:t}}=(0,m.useConfig)(),a=t?.allowEstimatedDateOfBirth,[{value:r}]=(0,E.Mt)("birthdateEstimated"),[l,s]=(0,E.Mt)("birthdate"),[o,d]=(0,E.Mt)("yearsEstimated"),[c,p]=(0,E.Mt)("monthsEstimated"),{setFieldValue:_,setFieldTouched:f}=P(),h=new Date,g=(0,i.useCallback)(e=>{_("birthdateEstimated","unknown"===e.name),_("birthdate",""),_("yearsEstimated",0),_("monthsEstimated",""),f("birthdateEstimated",!0,!1)},[f,_]),v=(0,i.useCallback)(e=>{_("birthdate",e),f("birthdate",!0,!1)},[_,f]),y=(0,i.useCallback)(e=>{let a=+e.target.value;!isNaN(a)&&a<140&&a>=0&&(_("yearsEstimated",a),_("birthdate",ey(a,p.value,t)))},[_,t,p.value]),T=(0,i.useCallback)(e=>{let a=+e.target.value;isNaN(a)||(_("monthsEstimated",a),_("birthdate",ey(d.value,a,t)))},[_,t,d.value]),N=(0,i.useCallback)(()=>{let e=p.value%12,a=+d.value+Math.floor(p.value/12);_("yearsEstimated",a),_("monthsEstimated",e>0?e:""),_("birthdate",ey(a,e,t)),f("yearsEstimated",!0,!1),f("monthsEstimated",!0,!1),f("birthdate",!0,!1)},[_,f,p,d,t]);return n().createElement("div",{className:J},n().createElement("h4",{className:z},e("birthFieldLabelText","Birth")),(a||r)&&n().createElement("div",{className:X},n().createElement("div",{className:Q},n().createElement("span",{className:W},e("dobToggleLabelText","Date of birth known?"))),n().createElement(u.Tps,{size:"md",onChange:g,selectedIndex:+!!r},n().createElement(u.dOG,{name:"known"},e("yes","Yes")),n().createElement(u.dOG,{name:"unknown"},e("no","No")))),n().createElement(u.Wdr,null,r?n().createElement("div",{className:K},n().createElement("div",{className:X},n().createElement(u.ksK,{id:"yearsEstimated",type:"number",name:o.name,onChange:y,labelText:e("estimatedAgeInYearsLabelText","Estimated age in years"),invalid:!!(d.touched&&d.error),invalidText:d.error&&e(d.error),value:o.value,min:0,required:!0,...o,onBlur:e=>{o.onBlur(e),f("yearsEstimated",!0,!1),N()}})),n().createElement("div",{className:X},n().createElement(u.ksK,{id:"monthsEstimated",type:"number",name:c.name,onChange:T,labelText:e("estimatedAgeInMonthsLabelText","Estimated age in months"),invalid:!!(p.touched&&p.error),invalidText:p.error&&e(p.error),value:c.value,min:0,...c,required:!d.value,onBlur:e=>{c.onBlur(e),f("monthsEstimated",!0,!1),N()}}))):n().createElement("div",{className:X},n().createElement(m.OpenmrsDatePicker,{id:"birthdate","data-testid":"birthdate",...l,onChange:v,onBlur:()=>f("birthdate",!0,!1),maxDate:h,labelText:e("dateOfBirthLabelText","Date of birth"),isInvalid:!!(s.touched&&s.error),invalidText:e(s.error),value:l.value}))))},eN=()=>{let{t:e}=(0,b.useTranslation)(),{fieldConfigurations:t}=(0,m.useConfig)(),{setFieldValue:a,setFieldTouched:i}=P(),[r,l]=(0,E.Mt)("gender"),s=t?.gender;return n().createElement("div",{className:J},n().createElement("h4",{className:z},e("sexFieldLabelText","Sex")),n().createElement("div",{className:"-esm-patient-registration__field__sexField___HqJLS"},n().createElement(u.zWQ,{name:"gender",legendText:e("genderLabelText","Sex"),orientation:"vertical",onChange:e=>{a("gender",e),i("gender",!0,!1)},valueSelected:r.value},s.map(t=>n().createElement(u.aaP,{id:`gender-option-${t.value}`,key:t.label??t.value,labelText:e(t.label??t.value,t.label??t.value),value:t.value}))),l.touched&&l.error&&n().createElement("div",{className:"-esm-patient-registration__field__radioFieldError___9Xdn-"},e(l.error,"Gender is required"))))};var eC=a(85848),eD=a(68622),ew=a(95795),ek=a(85951);function eI(e){return ex(e)&&!e.identifierSources.some(e=>!e.autoGenerationOption?.manualEntryEnabled&&e.autoGenerationOption?.automaticGenerationEnabled)}function ex(e){return"UNIQUE"===e.uniquenessBehavior||"LOCATION"===e.uniquenessBehavior}let eS=({patientIdentifier:e,fieldName:t})=>{let{t:a}=(0,b.useTranslation)(),{defaultPatientIdentifierTypes:r}=(0,m.useConfig)(),{identifierTypes:l}=f(),{isOffline:s,values:o,setFieldValue:d}=P(),c=(0,i.useMemo)(()=>l.find(t=>t.uuid===e.identifierTypeUuid),[e,l]),{autoGeneration:p,initialValue:_,identifierValue:h,identifierName:g,required:v,selectedSource:y}=e,T=y?.autoGenerationOption?.manualEntryEnabled,[N,C]=(0,i.useState)(p||_===h),D=`identifiers.${t}.identifierValue`,[w,k]=(0,E.Mt)(D),I=s&&eI(c),x=(0,i.useMemo)(()=>{let e={};return r?.forEach(t=>{e[t]=!0}),e},[r]),S=(0,i.useCallback)(()=>{C(!0),d(`identifiers.${t}`,{...e,identifierValue:_,selectedSource:y,autoGeneration:p})},[_,C]),F=!v&&N&&(!!_||T),q=!!_&&_!==h||!N&&T;return n().createElement("div",{className:A.IDInput},N?n().createElement("div",{className:A.textID},n().createElement("p",{"data-testid":"identifier-label",className:A.label},v?g:`${a("optionalIdentifierLabel",{identifierName:g})}`),n().createElement("p",{"data-testid":"identifier-placeholder",className:A.bodyShort02},p?a("autoGeneratedPlaceholderText","Auto-generated"):h),n().createElement("input",{"data-testid":"identifier-input",type:"hidden",...w,disabled:!0}),!!(k.touched&&k.error)&&n().createElement("span",{className:A.dangerLabel01},k.error&&a(k.error))):n().createElement(E.D0,{name:D,validate:e=>{if(e&&""!==e&&c?.format)try{if(new RegExp(c.format).test(e))return;return c.formatDescription??`Expected format: ${c.format}`}catch(e){console.error("Invalid regex pattern:",c.format);return}}},({field:e,form:{touched:t,errors:i}})=>n().createElement(B,{id:D,labelText:g,name:D,disabled:I,required:v,invalid:i[D]&&t[D],invalidText:i[D]&&a(i[D]),...e})),n().createElement("div",{className:A.actionButtonContainer},F&&n().createElement(m.UserHasAccess,{privilege:"Edit Patient Identifiers"},n().createElement(u.$nd,{"data-testid":"edit-button",size:"md",kind:"ghost",onClick:()=>{C(!1),d(`identifiers.${t}`,{...e,...eL(c?.identifierSources?.[0],_,_),...p&&T&&{identifierValue:_??""}})},iconDescription:a("editIdentifierTooltip","Edit"),disabled:I,hasIconOnly:!0},n().createElement(eD.ff,{size:16}))),q&&n().createElement(m.UserHasAccess,{privilege:"Edit Patient Identifiers"},n().createElement(u.$nd,{size:"md",kind:"ghost",onClick:S,iconDescription:a("resetIdentifierTooltip","Reset"),disabled:I,hasIconOnly:!0},n().createElement(ew.Yn,{size:16}))),!e.required&&!x[e.identifierTypeUuid]&&n().createElement(m.UserHasAccess,{privilege:"Delete Patient Identifiers"},n().createElement(u.$nd,{size:"md",kind:"ghost",onClick:()=>{if(_){let e=(0,m.showModal)("delete-identifier-confirmation-modal",{closeModal:()=>e(),deleteIdentifier:a=>{a&&d("identifiers",eM(o.identifiers,t)),e()},identifierName:g,identifierValue:_})}else d("identifiers",eM(o.identifiers,t))},iconDescription:a("deleteIdentifierTooltip","Delete"),disabled:I,hasIconOnly:!0},n().createElement(ek.zH,{size:16})))))};var eF=a(60529);let eA="-esm-patient-registration__overlay__headerContent___CzZgW",eq=({close:e,children:t,header:a,buttonsGroup:i})=>{let{t:r}=(0,b.useTranslation)(),l=(0,m.useLayoutType)();return n().createElement("div",{className:(0,m.isDesktop)(l)?"-esm-patient-registration__overlay__desktopOverlay___Aty9R":"-esm-patient-registration__overlay__tabletOverlay___1eFEE"},(0,m.isDesktop)(l)?n().createElement("div",{className:"-esm-patient-registration__overlay__desktopHeader___7rEvz"},n().createElement("div",{className:eA},a),n().createElement(u.$nd,{className:"-esm-patient-registration__overlay__closeButton___zV7uq",iconDescription:r("closeOverlay","Close overlay"),onClick:e,kind:"ghost",hasIconOnly:!0,renderIcon:e=>n().createElement(eF.bm,{size:16,...e})})):n().createElement(u.Y9Y,{className:"-esm-patient-registration__overlay__tabletOverlayHeader___YrcPp","aria-label":"Overlay header"},n().createElement(u.$nd,{kind:"ghost",onClick:e,hasIconOnly:!0,iconDescription:r("closeOverlay","Close overlay"),renderIcon:t=>n().createElement(eC.nk,{size:16,onClick:e,...t})}),n().createElement("div",{className:eA},a)),n().createElement("div",{className:"-esm-patient-registration__overlay__overlayContent___ij63O"},t),n().createElement("div",null,i))},eO={button:"-esm-patient-registration__identifier-selection__button___S0ENh",tablet:"-esm-patient-registration__identifier-selection__tablet___dJebV",desktop:"-esm-patient-registration__identifier-selection__desktop___aYNV9",radioGroup:"-esm-patient-registration__identifier-selection__radioGroup___MqpRj",radioButton:"-esm-patient-registration__identifier-selection__radioButton___H-1qU",space05:"-esm-patient-registration__identifier-selection__space05___Yilpb"},e$=({closeOverlay:e,setFieldValue:t})=>{let a=(0,m.useLayoutType)(),{identifierTypes:r}=f(),{isOffline:l,values:s,initialFormValues:o}=P(),[d,c]=(0,i.useState)(s.identifiers),[p,_]=(0,i.useState)(""),{t:h}=(0,b.useTranslation)(),{defaultPatientIdentifierTypes:g}=(0,m.useConfig)(),E=(0,i.useMemo)(()=>{let e={};return g?.forEach(t=>{e[t]=!0}),e},[g]);(0,i.useEffect)(()=>{c(s.identifiers)},[s.identifiers]);let v=(0,i.useCallback)(e=>_(e?.target?.value??""),[]),y=(0,i.useMemo)(()=>r?.filter(e=>e?.name?.toLowerCase().includes(p.toLowerCase())),[p,r]),T=(0,i.useCallback)((e,t)=>c(a=>t?{...a,[e.fieldName]:eP(e,s.identifiers[e.fieldName]??o.identifiers[e.fieldName]??{})}:a[e.fieldName]?Object.fromEntries(Object.entries(a).filter(([t])=>t!==e.fieldName)):a),[o.identifiers,s.identifiers]),N=(0,i.useMemo)(()=>y.map(e=>{let t=d[e.fieldName],a=e.isPrimary||e.required||E[e.uuid]||s.identifiers[e.fieldName],i=l&&eI(e);return n().createElement("div",{key:e.uuid,className:eO.space05},n().createElement(u.Sc0,{id:e.uuid,value:e.uuid,labelText:e.name,onChange:(t,{checked:a})=>T(e,a),checked:!!t,disabled:a||l&&i}),t&&e?.identifierSources?.length>0&&(!t.initialValue||t?.selectedSource)&&n().createElement("div",{className:eO.radioGroup},n().createElement(u.zWQ,{legendText:h("source","Source"),name:`${e?.fieldName}-identifier-sources`,defaultSelected:t?.selectedSource?.uuid,onChange:t=>c(a=>({...a,[e.fieldName]:{...a[e.fieldName],...eL(e.identifierSources.find(e=>e.uuid===t),a[e.fieldName].identifierValue,a[e.fieldName].initialValue)}})),orientation:"vertical"},e?.identifierSources.map(t=>n().createElement(u.aaP,{key:t.uuid,labelText:t.name,name:t.uuid,value:t.uuid,className:eO.radioButton,disabled:l&&ex(e)&&t.autoGenerationOption?.manualEntryEnabled})))))}),[y,d,E,s.identifiers,l,T,h]),C=(0,i.useCallback)(()=>{t("identifiers",d),e()},[d,t,e]);return n().createElement(eq,{close:e,header:h("configureIdentifiers","Configure identifiers"),buttonsGroup:n().createElement(u.Te$,{className:(0,m.isDesktop)(a)?eO.desktop:eO.tablet},n().createElement(u.$nd,{className:eO.button,kind:"secondary",onClick:e},h("cancel","Cancel")),n().createElement(u.$nd,{className:eO.button,kind:"primary",onClick:C},h("configureIdentifiers","Configure identifiers")))},n().createElement("div",null,n().createElement("p",{className:eO.bodyLong02},h("IDInstructions","Select the identifiers you'd like to add for this patient:")),r.length>7&&n().createElement("div",{className:eO.space05},n().createElement(u.vji,{labelText:h("searchIdentifierPlaceholder","Search identifier"),placeholder:h("searchIdentifierPlaceholder","Search identifier"),onChange:v,value:p})),n().createElement("fieldset",null,N)))};function eL(e,t,a){let i=e?.autoGenerationOption?.automaticGenerationEnabled,n=e?.autoGenerationOption?.manualEntryEnabled;return{selectedSource:e,autoGeneration:i,identifierValue:i&&!n?"auto-generated":"auto-generated"!==t?t:a}}function eP(e,t){return{identifierTypeUuid:e.uuid,identifierName:e.name,preferred:e.isPrimary,initialValue:"",required:e.isPrimary||e.required,...t,...eL(t?.selectedSource??e.identifierSources?.[0],t?.identifierValue,t?.initialValue??"")}}function eM(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}let eR=()=>{let{identifierTypes:e}=f(),t=!e?.length,{values:a,setFieldValue:r,initialFormValues:l,isOffline:s}=P(),{t:o}=(0,b.useTranslation)(),d=(0,m.useLayoutType)(),[c,p]=(0,i.useState)(!1),{defaultPatientIdentifierTypes:_}=(0,m.useConfig)();(0,i.useEffect)(()=>{if(e){let t={};e.filter(e=>e.isPrimary||e.required||!!_?.find(t=>t===e.uuid)).filter(e=>!a.identifiers[e.fieldName]).forEach(e=>{t[e.fieldName]=eP(e,a.identifiers[e.uuid]??l.identifiers[e.uuid]??{})}),Object.keys(t).length&&r("identifiers",{...a.identifiers,...t})}},[e,r,_,a.identifiers,eP]);let h=(0,i.useCallback)(()=>p(!1),[p]);return t&&!s?n().createElement("div",{className:J},n().createElement("div",{className:Z},n().createElement("h4",{className:z},o("idFieldLabelText","Identifiers"))),n().createElement("div",{role:"progressbar","aria-label":o("loading","Loading")},n().createElement(u.rrI,null))):n().createElement("div",{className:J},n().createElement(m.UserHasAccess,{privilege:["Get Identifier Types","Add Patient Identifiers"]},n().createElement("div",{className:Z},n().createElement("h4",{className:z},o("idFieldLabelText","Identifiers")),n().createElement(u.$nd,{kind:"ghost",className:"-esm-patient-registration__field__configureIdentifiersButton___PYKaV",onClick:()=>p(!0),size:(0,m.isDesktop)(d)?"sm":"md"},o("configure","Configure")," ",n().createElement(eC.Qp,{className:"-esm-patient-registration__field__arrowRightIcon___slDqt",size:16})))),n().createElement("div",null,Object.entries(a.identifiers).map(([e,t])=>n().createElement(eS,{key:e,fieldName:e,patientIdentifier:t})),c&&n().createElement(e$,{setFieldValue:r,closeOverlay:h})))},eB="8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",eU=/^([^0-9]*)$/;function ej(e){if(!eU.test(e))return"numberInNameDubious"}let eV=()=>{let{t:e}=(0,b.useTranslation)(),{setCapturePhotoProps:t,currentPhoto:a,setFieldValue:r,setFieldTouched:l}=P(),{fieldConfigurations:{name:{displayCapturePhoto:s,allowUnidentifiedPatients:o,defaultUnknownGivenName:d,defaultUnknownFamilyName:c,displayMiddleName:p,displayReverseFieldOrder:_}}}=(0,m.useConfig)(),[{value:f},,{setValue:h}]=(0,E.Mt)(`attributes.${eB}`),g="true"===f,v=(0,i.useCallback)((e,a)=>{t&&(t({imageData:e,dateTime:a}),l("photo",!0,!1))},[t,l]),y=n().createElement(B,{id:"givenName",name:"givenName",labelText:e("givenNameLabelText","First Name"),checkWarning:ej,required:!0}),T=p&&n().createElement(B,{id:"middleName",name:"middleName",labelText:e("middleNameLabelText","Middle Name"),checkWarning:ej}),N=n().createElement(B,{id:"familyName",name:"familyName",labelText:e("familyNameLabelText","Family Name"),checkWarning:ej,required:!0});return n().createElement("div",null,n().createElement("h4",{className:z},e("fullNameLabelText","Full Name")),n().createElement("div",{className:K},s&&n().createElement(m.ExtensionSlot,{className:"-esm-patient-registration__field__photoExtension___2oTk6",name:"capture-patient-photo-slot",state:{onCapturePhoto:v,initialState:a}}),n().createElement("div",{className:"-esm-patient-registration__field__nameField___yn8u2"},(o||g)&&n().createElement(n().Fragment,null,n().createElement("div",{className:Q},n().createElement("span",{className:W},e("patientNameKnown","Patient's Name is Known?"))),n().createElement(u.Tps,{className:"-esm-patient-registration__field__contentSwitcher___G0UXd",size:"md",selectedIndex:+!!g,onChange:e=>{"known"===e.name?(r("givenName",""),r("familyName",""),h("false")):(r("givenName",d),r("familyName",c),h("true")),l("givenName",!0),l("familyName",!0),l(`attributes.${eB}`,!0,!1)}},n().createElement(u.dOG,{name:"known"},e("yes","Yes")),n().createElement(u.dOG,{name:"unknown"},e("no","No")))),!g&&(_?n().createElement(n().Fragment,null,N,T,y):n().createElement(n().Fragment,null,y,T,N)))))};function eY(){let e=(0,m.useConfig)(),t={id:"phone",type:"person attribute",uuid:e.fieldConfigurations.phone.personAttributeUuid,validation:e.fieldConfigurations.phone.validation,showHeading:!1};return n().createElement(eh,{fieldDefinition:t})}function eG({name:e}){let t=(0,m.useConfig)();if(!v.t_.includes(e)&&!t.fieldDefinitions.some(t=>t.id===e))return(0,m.reportError)(`Invalid field name '${e}'. Valid options are '${t.fieldDefinitions.map(e=>e.id).concat(v.t_).join("', '")}'.`),null;switch(e){case"name":return n().createElement(eV,null);case"gender":return n().createElement(eN,null);case"dob":return n().createElement(eT,null);case"dateAndTimeOfDeath":return n().createElement(eb,null);case"causeOfDeath":return n().createElement(en,null);case"address":return n().createElement(et,null);case"id":return n().createElement(eR,null);case"phone":return n().createElement(eY,null);default:return n().createElement(eg,{name:e})}}let eH=({sectionDefinition:e})=>n().createElement("section",{"aria-label":`${e.name} Section`},e.fields.map(t=>n().createElement(eG,{key:`${e.name}-${t}`,name:t}))),ez={label01:"-esm-patient-registration__section__label01___ECvmT",productiveHeading02:"-esm-patient-registration__section__productiveHeading02___7AMo6",isDeadFieldContainer:"-esm-patient-registration__section__isDeadFieldContainer___ZGgBz"},eW=({fields:e})=>{let{t}=(0,b.useTranslation)(),{values:a,setFieldValue:i}=P(),[r,l]=(0,E.Mt)("deathDate");return n().createElement("section",{className:ez.formSection,"aria-label":"Death Info Section"},n().createElement("section",{className:ez.fieldGroup},n().createElement(u.Wdr,null,n().createElement("div",{className:ez.isDeadFieldContainer},n().createElement(u.Sc0,{checked:a.isDead,id:"isDead",labelText:t("isDeadInputLabel","Is dead"),onChange:(e,{checked:t,id:a})=>i(a,t)}))),a.isDead?e.map(e=>n().createElement(eG,{key:`death-info-${e}`,name:e})):null))},eK=({fields:e})=>{let[t,a]=(0,E.Mt)("addNameInLocalLanguage"),{setFieldValue:r}=P();return(0,i.useEffect)(()=>{!t.value&&a.touched&&(r("additionalGivenName",""),r("additionalMiddleName",""),r("additionalFamilyName",""))},[t.value,a.touched,r]),n().createElement("section",{className:ez.formSection,"aria-label":"Demographics Section"},e.map(e=>n().createElement(eG,{key:`demographics-${e}`,name:e})))},eJ=({getDisplayValue:e,getFieldValue:t,getSearchResults:a,onSuggestionSelected:r,invalid:s,invalidText:o,...d})=>{let[m,c]=(0,i.useState)([]),p=(0,i.useRef)(null),_=(0,i.useRef)(null),{id:f,labelText:h}=d;(0,i.useEffect)(()=>(document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}),[_]);let g=e=>{_.current&&!_.current.contains(e.target)&&c([])};return n().createElement("div",{className:"-esm-patient-registration__autosuggest__autocomplete___95MR4",ref:_},n().createElement("label",{className:"cds--label"},h),n().createElement(u.Wdr,{className:l()({"-esm-patient-registration__autosuggest__invalid___WU59X":s})},n().createElement(u.vji,{id:"autosuggest",onChange:e=>{let t=e.target.value;r(f,void 0),t?a(t).then(e=>{c(e)}):c([])},onClear:()=>{r(f,void 0)},ref:p,className:"-esm-patient-registration__autosuggest__autocompleteSearch___P2UOw",labelText:h,...d})),m.length>0&&n().createElement("ul",{className:"-esm-patient-registration__autosuggest__suggestions___SpgLN"},m.map((a,i)=>n().createElement("li",{key:i,onClick:a=>{let n,l;return n=e(m[i]),l=t(m[i]),void(p.current.value=n,r(f,l),c([]))}},e(a)))),s?n().createElement("label",{className:l()("-esm-patient-registration__autosuggest__invalidMsg___iR7AK")},o):n().createElement(n().Fragment,null))},eX={labelText:"-esm-patient-registration__relationships__labelText___yNoLO",bodyShort02:"-esm-patient-registration__relationships__bodyShort02___hnV3v",searchBox:"-esm-patient-registration__relationships__searchBox___lB3ot",relationshipHeader:"-esm-patient-registration__relationships__relationshipHeader___pFsXl",productiveHeading:"-esm-patient-registration__relationships__productiveHeading___-0fjP",trashCan:"-esm-patient-registration__relationships__trashCan___DVwNy"},eQ=({relationship:e,index:t,displayRelationshipTypes:a,remove:r})=>{let{t:l}=(0,b.useTranslation)(),{setFieldValue:s}=P(),[o,d]=(0,i.useState)(!1),m=!e.uuid,c=(0,i.useId)(),p=(0,i.useCallback)(a=>{let{target:i}=a;s(i.name,i.options[i.selectedIndex].value),e?.action||s(`relationships[${t}].action`,"UPDATE")},[t,e?.action,s]),_=(0,i.useCallback)((e,t)=>{d(!t),s(e,t)},[s]),f=async e=>{let t=new AbortController;return await (0,S.uH)(e,t)},h=(0,i.useCallback)(()=>{"ADD"===e.action?r(t):s(`relationships[${t}].action`,"DELETE")},[e,t,r,s]),g=(0,i.useCallback)(()=>{s(`relationships[${t}]`,{...e,action:void 0,relationshipType:e.initialrelationshipTypeValue})},[t,s,e]);return"DELETE"!==e.action?n().createElement("div",{className:eX.relationship},n().createElement("div",{className:eX.searchBox},n().createElement("div",{className:eX.relationshipHeader},n().createElement("h4",{className:eX.productiveHeading},l("relationshipPlaceholder","Relationship")),n().createElement(u.$nd,{kind:"ghost",iconDescription:l("deleteRelationshipTooltipText","Delete"),hasIconOnly:!0,onClick:h},n().createElement(ek.zH,{size:16,className:eX.trashCan}))),n().createElement("div",null,m?n().createElement(eJ,{id:`relationships[${t}].relatedPersonUuid`,labelText:l("relativeFullNameLabelText","Full name"),placeholder:l("relativeNamePlaceholder","Firstname Familyname"),defaultValue:e.relatedPersonName,onSuggestionSelected:_,invalid:o,invalidText:l("relationshipPersonMustExist","Related person must be an existing person"),getSearchResults:f,getDisplayValue:e=>e.display,getFieldValue:e=>e.uuid}):n().createElement(n().Fragment,null,n().createElement("span",{className:eX.labelText},l("relativeFullNameLabelText","Full name")),n().createElement("p",{className:eX.bodyShort02},e.relatedPersonName)))),n().createElement("div",{className:eX.selectRelationshipType,style:{marginBottom:"1rem"}},n().createElement(u.Wdr,null,n().createElement(u.l6P,{id:c,labelText:l("relationship","Relationship"),onChange:p,name:`relationships[${t}].relationshipType`,value:e.relationshipType||"placeholder-item"},n().createElement(u.ebT,{disabled:!0,hidden:!0,value:"placeholder-item",text:l("relationshipToPatient","Relationship to patient")}),a.map((e,t)=>n().createElement(u.ebT,{text:e.display,value:`${e.uuid}/${e.direction}`,key:`relationship-${e.uuid}-${t}`})))))):n().createElement(u.kZS,{kind:"info",title:l("relationshipRemovedText","Relationship removed"),actionButtonLabel:l("restoreRelationshipActionButton","Undo"),onActionButtonClick:g})},eZ=()=>{let{relationshipTypes:e}=f(),[t,a]=(0,i.useState)([]),{t:r}=(0,b.useTranslation)();return((0,i.useEffect)(()=>{if(e){let t=[];e.results.forEach(e=>{let a={display:e.displayAIsToB?e.displayAIsToB:e.displayBIsToA,uuid:e.uuid,direction:"aIsToB"},i={display:e.displayBIsToA?e.displayBIsToA:e.displayAIsToB,uuid:e.uuid,direction:"bIsToA"};a.display===i.display?t.push(a):"Patient"===i.display?t.push(a,{display:`Patient (${a.display})`,uuid:e.uuid,direction:"bIsToA"}):t.push(a,i)}),a(t)}},[e]),e)?n().createElement("section",{"aria-label":"Relationships section"},n().createElement(E.ED,{name:"relationships"},({push:e,remove:a,form:{values:{relationships:i}}})=>n().createElement("div",null,i&&i.length>0?i.map((e,i)=>n().createElement("div",{key:e.uuid??e.clientId,className:ez.formSection},n().createElement(eQ,{relationship:e,index:i,displayRelationshipTypes:t,remove:a}))):null,n().createElement("div",{className:eX.actions},n().createElement(u.$nd,{kind:"ghost",onClick:()=>e({clientId:(0,F.A)(),relatedPersonUuid:"",action:"ADD"})},r("addRelationshipButtonText","Add Relationship")))))):n().createElement("section",{"aria-label":"Loading relationships section"},n().createElement("div",{role:"progressbar","aria-label":r("loading","Loading")},n().createElement(u.rrI,null)))};function e0({sectionDefinition:e}){switch(e.id){case"demographics":return n().createElement(eK,{fields:e.fields});case"death":return n().createElement(eW,{fields:e.fields});case"relationships":return n().createElement(eZ,null);default:return n().createElement(eH,{sectionDefinition:e})}}let e1=({sectionDefinition:e,index:t})=>{let{t:a}=(0,b.useTranslation)();return n().createElement("div",{id:e.id,style:{scrollMarginTop:"1rem"}},n().createElement("h3",{className:ez.productiveHeading02,style:{color:"#161616"}},t+1,". ",a(`${e.id}Section`,e.name)),n().createElement("span",{className:ez.label01},a("allFieldsRequiredText","All fields are required unless marked optional")),n().createElement("div",{style:{margin:"1rem 0 1rem"}},n().createElement(u.FAs,null,n().createElement(e0,{sectionDefinition:e}))))};var e2=a(57003);async function e5(e){return(await (0,m.getSynchronizationItems)(e2.dR)).find(t=>t._patientRegistrationData.formValues.patientUuid===e)}function e4(e){let{data:t,error:a,isLoading:n}=e_()(e?`${m.restBaseUrl}/person/${e}/attribute?v=custom:(uuid,display,attributeType:(uuid,display,format),value)`:null,m.openmrsFetch);return(0,i.useMemo)(()=>({data:t?.data?.results,isLoading:n}),[t?.data?.results,n])}let e6=({when:e,redirect:t})=>{let{t:a}=(0,b.useTranslation)(),n=(0,i.useRef)(!1),[r,l]=(0,i.useState)(),s=r||t,o=(0,i.useCallback)(e=>{let t=a("discardModalBody","The changes you made to this patient's details have not been saved. Discard changes?");return e.preventDefault(),e.returnValue=t,t},[a]),d=(0,i.useCallback)(e=>{if(!e.detail.navigationIsCanceled&&!n.current){n.current=!0,e.detail.cancelNavigation();let t=(0,m.showModal)("cancel-patient-edit-modal",{onConfirm:()=>{l(e.detail.newUrl),t()}},()=>{n.current=!1})}},[]);return(0,i.useEffect)(()=>{if(e&&void 0===s)return window.addEventListener("single-spa:before-routing-event",d),window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o),window.removeEventListener("single-spa:before-routing-event",d)}},[s,e,o,d]),(0,i.useEffect)(()=>{"string"==typeof s&&(0,m.navigate)({to:`\${openmrsSpaBase}/${s.split(window.getOpenmrsSpaBase())?.[1]}`})},[s]),null},e3={submit:"-esm-patient-registration__patient-registration__submit___5UPB7",cancelButton:"-esm-patient-registration__patient-registration__cancelButton___eEF4p",submitButton:"-esm-patient-registration__patient-registration__submitButton___4RhNt",infoGrid:"-esm-patient-registration__patient-registration__infoGrid___GxoOx",label01:"-esm-patient-registration__patient-registration__label01___dP1a4",space05:"-esm-patient-registration__patient-registration__space05___g8aca",divider:"-esm-patient-registration__patient-registration__divider___ftgRA",formContainer:"-esm-patient-registration__patient-registration__formContainer___LUBOk",stickyColumn:"-esm-patient-registration__patient-registration__stickyColumn___pGyZY",touchTarget:"-esm-patient-registration__patient-registration__touchTarget___OvQJY",linkName:"-esm-patient-registration__patient-registration__linkName___KqHmO",spinner:"-esm-patient-registration__patient-registration__spinner___wUSXi"},e7=({savePatientForm:e,isOffline:t})=>{let{t:a}=(0,b.useTranslation)(),{currentSession:r,identifierTypes:s}=f(),{patientUuid:o}=(0,d.useParams)(),{search:c}=(0,d.useLocation)(),{isLoading:p,patient:_}=(0,m.usePatient)(o),D=(0,m.useConfig)(),[I,A]=function(e,t,a){let{freeTextFieldConceptUuid:n}=(0,m.useConfig)(),{data:r,isLoading:l}=function(e){let{data:t,error:a,isLoading:n}=e_()(e?`${m.restBaseUrl}/person/${e}?v=custom:(uuid,display,causeOfDeath,dead,deathDate,causeOfDeathNonCoded)`:null,m.openmrsFetch);return(0,i.useMemo)(()=>({data:t?.data,isLoading:n}),[t?.data,n])}(a),{data:s,isLoading:o}=e4(a),{data:d,isLoading:u}=function(e){let{data:t,error:a,isLoading:n}=e_()(e?`${m.restBaseUrl}/patient/${e}/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)`:null,m.openmrsFetch);return(0,i.useMemo)(()=>{let e={};return t?.data?.results?.forEach(t=>{e[(0,y.A)(t.identifierType.name)]={identifierUuid:t.uuid,preferred:t.preferred,initialValue:t.identifier,identifierValue:t.identifier,identifierTypeUuid:t.identifierType.uuid,identifierName:t.identifierType.name,required:t.identifierType.required,selectedSource:null,autoGeneration:!1}}),{data:e,isLoading:n}},[t?.data?.results,n])}(a),{data:c,isLoading:p}=function(e){let t=!!e,{data:a,error:n,isLoading:r}=e_()(t?`${m.restBaseUrl}/relationship?v=${e2.DA}&person=${e}`:null,m.openmrsFetch);return(0,i.useMemo)(()=>({data:a?.data?.results.map(t=>t.personA.uuid===e?{relatedPersonName:t.personB.display,relatedPersonUuid:t.personB.uuid,relation:t.relationshipType.bIsToA,relationshipType:`${t.relationshipType.uuid}/bIsToA`,initialrelationshipTypeValue:`${t.relationshipType.uuid}/bIsToA`,uuid:t.uuid}:{relatedPersonName:t.personA.display,relatedPersonUuid:t.personA.uuid,relation:t.relationshipType.aIsToB,relationshipType:`${t.relationshipType.uuid}/aIsToB`,initialrelationshipTypeValue:`${t.relationshipType.uuid}/aIsToB`,uuid:t.uuid}),error:n,isLoading:r}),[a?.data?.results,n,r,e])}(a),{data:_}=function(e,t){let{registrationObs:a}=(0,m.useConfig)(),{data:i,error:n,isLoading:r}=e_()(t&&a.encounterTypeUuid?`${m.restBaseUrl}/encounter?patient=${e}&v=custom:(encounterDatetime,obs:(concept:ref,value:ref))&encounterType=${a.encounterTypeUuid}`:null,m.openmrsFetch),l=i?.data.results.sort(C)?.at(0)?.obs;return{data:l?.map(({concept:e,value:t})=>({[e.uuid]:"object"==typeof t?t?.uuid:t})).reduce((e,t)=>Object.assign(e,t),{}),isLoading:r,error:n}}(a,t),[f,h]=(0,i.useState)({additionalFamilyName:"",additionalGivenName:"",additionalMiddleName:"",addNameInLocalLanguage:!1,address:{},birthdate:null,birthdateEstimated:!1,deathCause:"",deathDate:void 0,deathTime:void 0,deathTimeFormat:"AM",familyName:"",gender:"",givenName:"",identifiers:{},isDead:!1,middleName:"",monthsEstimated:0,nonCodedCauseOfDeath:"",patientUuid:(0,F.A)(),relationships:[],telephoneNumber:"",yearsEstimated:0});return(0,i.useEffect)(()=>{(async()=>{if(t){let e=!/^\d{4}-\d{2}-\d{2}$/.test(t.birthDate),[a=0,i=0]=t.birthDate.split("-").map(e=>parseInt(e)),n=t.birthDate.split("-").length>1,r=e?Math.floor(w()().diff(t.birthDate,"month")/12):0,l=e&&n?w()().diff(t.birthDate,"month")%12:0;h(e=>{let a,i,n,s;return{...e,...(a={},i=t.name[0],n=t.name[1],a.patientUuid=t.id,a.givenName=i?.given[0],a.middleName=i?.given[1],a.familyName=i?.family,a.addNameInLocalLanguage=!!n||void 0,a.additionalGivenName=n?.given[0],a.additionalMiddleName=n?.given[1],a.additionalFamilyName=n?.family,a.gender=t.gender,a.birthdate=t.birthDate?(0,m.parseDate)(t.birthDate):void 0,a.telephoneNumber=t.telecom?t.telecom[0].value:"",{...a,...t.identifier.map(e=>({[(0,y.A)(e.system||e.type.text)]:e.value}))}),address:N(t),...(s={},t.telecom&&(s.phone=t.telecom[0].value),s),birthdateEstimated:!/^\d{4}-\d{2}-\d{2}$/.test(t.birthDate),yearsEstimated:r,monthsEstimated:l}})}else if(!e&&a){let e=await e5(a);if(!e._patientRegistrationData.formValues)return console.error(`Found a queued offline patient registration for patient ${a}, but without form values. Not using these values.`);h(e._patientRegistrationData.formValues)}})()},[e,t,a]),(0,i.useEffect)(()=>{if(!l&&r?.dead){let e=r.deathDate||null,t=e?new Date(e):void 0,a=t?w()(t).format("hh:mm"):void 0,i=t&&w()(t).hour()>=12?"PM":"AM";h(e=>({...e,isDead:r.dead||!1,deathDate:t,deathTime:a,deathTimeFormat:i,deathCause:r.causeOfDeathNonCoded?n:r.causeOfDeath?.uuid,nonCodedCauseOfDeath:r.causeOfDeathNonCoded}))}},[l,r,n]),(0,i.useEffect)(()=>{!p&&c&&h(e=>({...e,relationships:c})),!u&&d&&h(e=>({...e,identifiers:d}))},[p,c,u,d]),(0,i.useEffect)(()=>{if(!o&&s){let e=s.reduce((e,t)=>({...e,[t.attributeType.uuid]:"org.openmrs.Concept"===t.attributeType.format&&"object"==typeof t.value?t.value?.uuid:t.value}),{});h(t=>({...t,attributes:e}))}},[s,o]),(0,i.useEffect)(()=>{t&&_&&h(e=>({...e,obs:_}))},[_,t]),[f,h]}(p,_,o),[q]=function(e={},t,a,n){let r=(0,i.useRef)(e),[l,s]=(0,i.useState)(r.current);return(0,i.useEffect)(()=>{(async()=>{if(a)s(e=>({...e,address:N(a)}));else if(!t&&n){let e=await e5(n);s(e?._patientRegistrationData.initialAddressFieldValues??r.current)}})()},[t,a,n]),[l,s]}({},p,_,o),[$]=function(e={},t,a,n){let r=(0,i.useRef)(e),[l,s]=(0,i.useState)(r.current),{data:o}=e4(n);return(0,i.useEffect)(()=>{let e=new AbortController;return async function(){if(a)s(e=>{let t,i,n;return{...e,...(t=a.name[0],i=a.name[1],n=a.address?.[0],{preferredNameUuid:t?.id,additionalNameUuid:i?.id,preferredAddressUuid:n?.id,...a.identifier.map(e=>({[(0,y.A)(e.system||e.type.text)]:{uuid:e.id,value:e.value}}))})}});else if(!t&&n)try{let t=await e5(n);e.signal.aborted||s(t?._patientRegistrationData.patientUuidMap??r.current)}catch(t){e.signal.aborted||console.error("Failed to get patient registration:",t)}}(),()=>e.abort()},[t,a,n]),(0,i.useEffect)(()=>{o&&s(e=>{let t;return{...e,...(t={},o.forEach(e=>{t[`attribute.${e?.attributeType?.uuid}`]=e?.uuid}),t)}})},[o]),[l,s]}({},p,_,o),[P,M]=(0,i.useState)(),[R,B]=(0,i.useState)(null),U=r?.sessionLocation?.uuid,j=p?void 0:!!(o&&_),V=(0,i.useMemo)(()=>"true"===localStorage.getItem("openmrs:devtools")&&!j,[j]),{data:Y}=(0,m.usePatientPhoto)(_?.id),G=(0,i.useRef)(new h.u),H=k.Ik({givenName:k.Yj().required(a("givenNameRequired","Given name is required")),familyName:k.Yj().required(a("familyNameRequired","Family name is required")),additionalGivenName:k.Yj().when("addNameInLocalLanguage",{is:!0,then:k.Yj().required(a("givenNameRequired","Given name is required")),otherwise:k.Yj().notRequired()}),additionalFamilyName:k.Yj().when("addNameInLocalLanguage",{is:!0,then:k.Yj().required(a("familyNameRequired","Family name is required")),otherwise:k.Yj().notRequired()}),gender:k.Yj().oneOf(D.fieldConfigurations.gender.map(e=>e.value),a("genderUnspecified","Gender unspecified")).required(a("genderRequired","Gender is required")),birthdate:k.p6().when("birthdateEstimated",{is:!1,then:k.p6().required(a("birthdayRequired","Birthday is required")).max(Date(),a("birthdayNotInTheFuture","Birthday cannot be in future")).min(w()().subtract(140,"years").toDate(),a("birthdayNotOver140YearsAgo","Birthday cannot be more than 140 years ago")).nullable(),otherwise:k.p6().nullable()}),yearsEstimated:k.ai().when("birthdateEstimated",{is:!0,then:k.ai().required(a("yearsEstimateRequired","Estimated years required")).min(0,a("negativeYears","Estimated years cannot be negative")).max(140,a("nonsensicalYears","Estimated years cannot be more than 140")),otherwise:k.ai().nullable()}),monthsEstimated:k.ai().min(0,a("negativeMonths","Estimated months cannot be negative")),isDead:k.zM(),deathDate:k.p6().when("isDead",{is:!0,then:k.p6().required(a("deathDateRequired","Death date is required")),otherwise:k.p6().nullable()}).max(new Date,a("deathDateInFuture","Death date cannot be in future")).test("deathDate-not-before-birthdate",a("deathdayBeforeBirthday","Death date and time cannot be before the birthday"),function(e){let{birthdate:t}=this.parent;return!t||!e||!w()(e).isBefore(t,"day")}).test("deathDate-before-today",a("deathDateInFuture","Death date cannot be in future"),function(e){let{deathTime:t,deathTimeFormat:a}=this.parent;return!(e&&t&&a&&/^(1[0-2]|0?[1-9]):([0-5]?[0-9])$/.test(t))||w()((0,S.oq)(e,t,a)).isBefore(w()())}),deathTime:k.Yj().when("isDead",{is:!0,then:k.Yj().required(a("deathTimeRequired","Death time is required")),otherwise:k.Yj().nullable()}).matches(/^(1[0-2]|0?[1-9]):([0-5]?[0-9])$/,a("deathTimeInvalid","Time doesn't match the format 'hh:mm'")),deathTimeFormat:k.Yj().when("isDead",{is:!0,then:k.Yj().required(a("deathTimeFormatRequired","Time format is required")),otherwise:k.Yj().nullable()}).oneOf(["AM","PM"],a("deathTimeFormatInvalid","Time format is invalid")),deathCause:k.Yj().when("isDead",{is:!0,then:k.Yj().required(a("deathCauseRequired","Cause of death is required")),otherwise:k.Yj().nullable()}),nonCodedCauseOfDeath:k.Yj().when(["isDead","deathCause"],{is:(e,t)=>e&&t===D.freeTextFieldConceptUuid,then:k.Yj().required(a("nonCodedCauseOfDeathRequiredWhenSelected","Non-coded cause of death is required")),otherwise:k.Yj().nullable()}),email:k.Yj().optional().email(a("invalidEmail","Invalid email")),identifiers:k.RZ(e=>k.Ik(x()(e,()=>k.Ik({required:k.lc(),identifierValue:k.Yj().when("required",{is:!0,then:k.Yj().required(a("identifierValueRequired","Identifier value is required")),otherwise:k.Yj().notRequired()})})))),relationships:k.YO().of(k.Ik().shape({relatedPersonUuid:k.Yj().required(),relationshipType:k.Yj().required()}))});(0,i.useEffect)(()=>{},[I]);let z=(0,i.useMemo)(()=>D.sections.map(e=>D.sectionDefinitions.filter(t=>t.id===e)[0]??v.yk.filter(t=>t.id===e)[0]).filter(e=>e),[D.sections,D.sectionDefinitions]),W=async(t,i)=>{let n=new AbortController;i.setSubmitting(!0);let l={...t,identifiers:Object.fromEntries(Object.entries(t.identifiers).filter(([e,t])=>t.autoGeneration&&t.selectedSource.autoGenerationOption.manualEntryEnabled||void 0!==t.identifierValue))};try{await e(!j,l,$,q,R,U,I.identifiers,r,D,G.current,n),(0,m.showSnackbar)({subtitle:j?a("updatePatientSuccessSnackbarSubtitle","The patient's information has been successfully updated"):a("registerPatientSuccessSnackbarSubtitle","The patient can now be found by searching for them using their name or ID number"),title:j?a("updatePatientSuccessSnackbarTitle","Patient Details Updated"):a("registerPatientSuccessSnackbarTitle","New Patient Created"),kind:"success",isLowContrast:!0});let i=new URLSearchParams(c).get("afterUrl"),s=(0,m.interpolateUrl)(i||D.links.submitButton,{patientUuid:t.patientUuid});M(s)}catch(e){e.responseBody?.error?.globalErrors?e.responseBody.error.globalErrors.forEach(e=>{(0,m.showSnackbar)({title:j?a("updatePatientErrorSnackbarTitle","Patient Details Update Failed"):a("registrationErrorSnackbarTitle","Patient Registration Failed"),subtitle:e.message,kind:"error"})}):e.responseBody?.error?.message?(0,m.showSnackbar)({title:j?a("updatePatientErrorSnackbarTitle","Patient Details Update Failed"):a("registrationErrorSnackbarTitle","Patient Registration Failed"),subtitle:e.responseBody.error.message,kind:"error"}):(0,m.createErrorHandler)()(e),i.setSubmitting(!1)}},K=(0,i.useCallback)(e=>({identifierTypes:s,validationSchema:H,values:e.values,inEditMode:j,setFieldValue:e.setFieldValue,setFieldTouched:e.setFieldTouched,setCapturePhotoProps:B,currentPhoto:Y?.imageSrc,isOffline:t,initialFormValues:e.initialValues,setInitialFormValues:A}),[s,H,j,B,Y?.imageSrc,t,A]);return n().createElement(E.l1,{enableReinitialize:!0,initialValues:I,onSubmit:W,validationSchema:H},e=>n().createElement(E.lV,{className:e3.form},n().createElement(e6,{when:Object.keys(e.touched).length>0,redirect:P}),n().createElement("div",{className:e3.formContainer},n().createElement("div",{className:e3.stickyColumn},n().createElement("h4",null,j?a("editPatientDetails","Edit patient details"):a("createNewPatient","Create new patient")),V&&n().createElement(O,{setValues:e.setValues}),n().createElement("p",{className:e3.label01},a("jumpTo","Jump to")),z.map(e=>n().createElement("div",{className:l()(e3.space05,e3.touchTarget),key:e.name},n().createElement(u.N_E,{className:e3.linkName,onClick:()=>{var t;return t=e.id,void document.getElementById(t)?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"})}},n().createElement(g.WX,{size:16})," ",a(`${e.id}Section`,e.name)))),n().createElement("hr",{className:e3.divider}),n().createElement(u.$nd,{className:e3.submitButton,type:"submit",onClick:()=>e.validateForm().then(e=>{e&&"object"==typeof e&&Object.keys(e).length&&(0,m.showSnackbar)({isLowContrast:!0,kind:"warning",title:a("fieldsWithErrors","The following fields have errors:"),subtitle:n().createElement(n().Fragment,null,n().createElement("ul",{style:{listStyle:"inside"}},Object.keys(e).map((e,t)=>n().createElement("li",{key:t},a(`${e}LabelText`,e)))))})}),disabled:!r||!s||e.isSubmitting},e.isSubmitting?n().createElement(u.OuH,{className:e3.spinner,description:`${a("submitting","Submitting")} ...`,iconDescription:"submitting"}):j?a("updatePatient","Update patient"):a("registerPatient","Register patient")),n().createElement(u.$nd,{className:e3.cancelButton,kind:"secondary",onClick:T},a("cancel","Cancel"))),n().createElement("div",{className:e3.infoGrid},n().createElement(L,{value:K(e)},z.map((e,t)=>n().createElement(e1,{key:`registration-section-${e.id}`,sectionDefinition:e,index:t})))))))};function e9(){let e=(0,m.useConnectivity)(),t=(0,m.useSession)(),{data:a}=o()("patientRegistrationAddressTemplate",c.pX),{data:r}=o()("patientRegistrationRelationshipTypes",c.zL),{data:s}=o()("patientRegistrationPatientIdentifiers",c.Qi),p=(0,i.useMemo)(()=>e?h.A.savePatientFormOnline:h.A.savePatientFormOffline,[e]);return n().createElement("main",{className:l()("omrs-main-content","-esm-patient-registration__root__root___vsTSI")},n().createElement(u.xA9,{className:"-esm-patient-registration__root__grid___fHLiE"},n().createElement(_,{value:{addressTemplate:a,relationshipTypes:r,identifierTypes:s,currentSession:t}},n().createElement(d.BrowserRouter,{basename:window.getOpenmrsSpaBase()},n().createElement(d.Routes,null,n().createElement(d.Route,{path:"patient-registration",element:n().createElement(e7,{savePatientForm:p,isOffline:!e})}),n().createElement(d.Route,{path:"patient/:patientUuid/edit",element:n().createElement(e7,{savePatientForm:p,isOffline:!e})}))))))}}}]);