@openmrs/esm-fast-data-entry-app 1.0.1-pre.8 → 1.0.1-pre.85

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.
Files changed (86) hide show
  1. package/README.md +21 -2
  2. package/dist/132.js +1 -0
  3. package/dist/168.js +1 -0
  4. package/dist/229.js +1 -0
  5. package/dist/247.js +1 -0
  6. package/dist/255.js +1 -0
  7. package/dist/294.js +2 -0
  8. package/dist/294.js.LICENSE.txt +9 -0
  9. package/dist/32.js +1 -0
  10. package/dist/327.js +1 -0
  11. package/dist/403.js +2 -0
  12. package/dist/403.js.LICENSE.txt +14 -0
  13. package/dist/553.js +2 -0
  14. package/dist/553.js.LICENSE.txt +14 -0
  15. package/dist/574.js +1 -0
  16. package/dist/595.js +2 -0
  17. package/dist/595.js.LICENSE.txt +3 -0
  18. package/dist/617.js +1 -0
  19. package/dist/658.js +2 -0
  20. package/dist/658.js.LICENSE.txt +27 -0
  21. package/dist/68.js +2 -0
  22. package/dist/68.js.LICENSE.txt +21 -0
  23. package/dist/74.js +1 -0
  24. package/dist/757.js +1 -0
  25. package/dist/776.js +1 -0
  26. package/dist/804.js +1 -0
  27. package/dist/820.js +1 -0
  28. package/dist/935.js +2 -0
  29. package/dist/935.js.LICENSE.txt +19 -0
  30. package/dist/main.js +1 -0
  31. package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
  32. package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +612 -0
  33. package/dist/openmrs-esm-fast-data-entry-app.old +1 -0
  34. package/jest.config.json +2 -1
  35. package/package.json +9 -9
  36. package/src/CancelModal.tsx +48 -0
  37. package/src/CompleteModal.tsx +46 -0
  38. package/src/FormBootstrap.tsx +18 -3
  39. package/src/add-group-modal/AddGroupModal.tsx +80 -27
  40. package/src/add-group-modal/styles.scss +14 -4
  41. package/src/config-schema.ts +22 -0
  42. package/src/context/FormWorkflowContext.tsx +13 -1
  43. package/src/context/FormWorkflowReducer.ts +13 -3
  44. package/src/context/GroupFormWorkflowContext.tsx +41 -6
  45. package/src/context/GroupFormWorkflowReducer.ts +170 -12
  46. package/src/form-entry-workflow/FormEntryWorkflow.tsx +67 -101
  47. package/src/form-entry-workflow/styles.scss +2 -1
  48. package/src/forms-page/FormsPage.tsx +8 -3
  49. package/src/forms-page/forms-table/FormsTable.tsx +11 -5
  50. package/src/group-form-entry-workflow/GroupFormEntryWorkflow.tsx +13 -400
  51. package/src/group-form-entry-workflow/GroupSessionWorkspace.tsx +247 -0
  52. package/src/group-form-entry-workflow/SessionDetailsForm.tsx +122 -0
  53. package/src/group-form-entry-workflow/SessionMetaWorkspace.tsx +107 -0
  54. package/src/group-form-entry-workflow/attendance-table/AttendanceTable.tsx +105 -0
  55. package/src/group-form-entry-workflow/attendance-table/index.ts +1 -0
  56. package/src/group-form-entry-workflow/{group-banner/GroupBanner.test.tsx → group-display-header/GroupDisplayHeader.test.tsx} +2 -2
  57. package/src/group-form-entry-workflow/{group-banner/GroupBanner.tsx → group-display-header/GroupDisplayHeader.tsx} +23 -5
  58. package/src/group-form-entry-workflow/group-display-header/index.ts +3 -0
  59. package/src/group-form-entry-workflow/group-search/CompactGroupResults.tsx +61 -28
  60. package/src/group-form-entry-workflow/group-search/CompactGroupSearch.tsx +5 -0
  61. package/src/group-form-entry-workflow/group-search/GroupSearch.tsx +65 -8
  62. package/src/group-form-entry-workflow/group-search/group-search.scss +8 -6
  63. package/src/group-form-entry-workflow/group-search-header/GroupSearchHeader.tsx +11 -7
  64. package/src/group-form-entry-workflow/styles.scss +12 -1
  65. package/src/hooks/index.ts +1 -0
  66. package/src/hooks/useGetPatient.ts +1 -1
  67. package/src/hooks/useGetSystemSetting.ts +38 -0
  68. package/src/hooks/usePostEndpoint.ts +70 -0
  69. package/src/hooks/useSearchEndpoint.ts +120 -0
  70. package/src/hooks/useStartVisit.ts +92 -0
  71. package/src/patient-card/styles.scss +1 -0
  72. package/tools/i18next-parser.config.js +93 -0
  73. package/translations/en.json +27 -9
  74. package/translations/fr.json +50 -0
  75. package/.editorconfig +0 -12
  76. package/.eslintignore +0 -2
  77. package/.eslintrc.js +0 -10
  78. package/.husky/pre-push +0 -1
  79. package/.prettierignore +0 -14
  80. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +0 -550
  81. package/.yarn/versions/7ee3eceb.yml +0 -0
  82. package/src/group-form-entry-workflow/group-banner/index.ts +0 -3
  83. package/src/group-form-entry-workflow/group-search/mock-group-data.ts +0 -79
  84. package/src/group-form-entry-workflow/group-search/useGroupSearch.ts +0 -14
  85. package/src/hooks/usePostCohort.ts +0 -18
  86. /package/src/group-form-entry-workflow/{group-banner → group-display-header}/styles.scss +0 -0
@@ -0,0 +1,3 @@
1
+ /*! For license information please see openmrs-esm-api.js.LICENSE.txt */
2
+
3
+ /*! For license information please see openmrs-esm-react-utils.js.LICENSE.txt */
package/dist/617.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[617],{5672:(t,e,r)=>{r.d(e,{AB:()=>p,ZP:()=>y,ol:()=>v});var n=r(1672),o=r.n(n),i=r(2126),u=r(1338),a=r(7612),l=r(1132);function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){s(t,e,r[e])}))}return t}var d={addPatient:function(t){},openPatientSearch:function(){},saveEncounter:function(t){},editEncounter:function(t){},submitForNext:function(){},submitForReview:function(){},submitForComplete:function(){},goToReview:function(){},destroySession:function(){},closeSession:function(){}},v={activeFormUuid:null,forms:{},workflowState:null,activePatientUuid:null,activeEncounterUuid:null,patientUuids:[],encounters:{},singleSessionVisitTypeUuid:null,userUuid:null},m=o().createContext(f({},v,d)),p=function(t){var e,r,s,p,y,b,w,h,U,S,E,O,g,P,F,T,_,I,k,j,A,R,N,C=t.children,x=(0,l.useSession)().user,M=(0,u.useParams)().formUuid.split("&")[0],D=(0,u.useLocation)().search,B=new URLSearchParams(D).get("patientUuid"),W=(j=(0,n.useReducer)(i.ZP,f({},v,d)),A=2,function(t){if(Array.isArray(t))return t}(j)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(j,A)||function(t,e){if(t){if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}}(j,A)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),V=W[0],L=W[1],Z=(0,a.Z)("@openmrs/esm-fast-data-entry-app.groupSessionVisitTypeUuid"),$=null==Z||null===(e=Z.result)||void 0===e||null===(r=e.data)||void 0===r||null===(s=r.results)||void 0===s||null===(p=s[0])||void 0===p?void 0:p.value,G=(0,n.useMemo)((function(){return{initializeWorkflowState:function(t){var e=t.activeFormUuid,r=t.newPatientUuid;return L({type:"INITIALIZE_WORKFLOW_STATE",activeFormUuid:e,newPatientUuid:r,userUuid:x.uuid})},addPatient:function(t){return L({type:"ADD_PATIENT",patientUuid:t})},openPatientSearch:function(){return L({type:"OPEN_PATIENT_SEARCH"})},saveEncounter:function(t){return L({type:"SAVE_ENCOUNTER",encounterUuid:t})},submitForNext:function(){return L({type:"SUBMIT_FOR_NEXT"})},submitForReview:function(){return L({type:"SUBMIT_FOR_REVIEW"})},submitForComplete:function(){return L({type:"SUBMIT_FOR_COMPLETE"})},editEncounter:function(t){return L({type:"EDIT_ENCOUNTER",patientUuid:t})},goToReview:function(){return L({type:"GO_TO_REVIEW"})},destroySession:function(){return L({type:"DESTROY_SESSION"})},closeSession:function(){return L({type:"CLOSE_SESSION"})}}}),[x]);return(0,n.useEffect)((function(){null===(null==V?void 0:V.workflowState)&&M&&G.initializeWorkflowState({activeFormUuid:M,newPatientUuid:B})}),[M,B,null==V?void 0:V.workflowState,G]),o().createElement(m.Provider,{value:(R=f({},V,G),N={workflowState:null!==(F=null===(y=V.forms)||void 0===y||null===(b=y[V.activeFormUuid])||void 0===b?void 0:b.workflowState)&&void 0!==F?F:v.workflowState,activePatientUuid:null!==(T=null===(w=V.forms)||void 0===w||null===(h=w[V.activeFormUuid])||void 0===h?void 0:h.activePatientUuid)&&void 0!==T?T:v.activePatientUuid,activeEncounterUuid:null!==(_=null===(U=V.forms)||void 0===U||null===(S=U[V.activeFormUuid])||void 0===S?void 0:S.activeEncounterUuid)&&void 0!==_?_:v.activeEncounterUuid,patientUuids:null!==(I=null===(E=V.forms)||void 0===E||null===(O=E[V.activeFormUuid])||void 0===O?void 0:O.patientUuids)&&void 0!==I?I:v.patientUuids,encounters:null!==(k=null===(g=V.forms)||void 0===g||null===(P=g[V.activeFormUuid])||void 0===P?void 0:P.encounters)&&void 0!==k?k:v.encounters,singleSessionVisitTypeUuid:$},N=null!=N?N:{},Object.getOwnPropertyDescriptors?Object.defineProperties(R,Object.getOwnPropertyDescriptors(N)):function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r.push.apply(r,n)}return r}(Object(N)).forEach((function(t){Object.defineProperty(R,t,Object.getOwnPropertyDescriptor(N,t))})),R)},C)};const y=m},2126:(t,e,r)=>{r.d(e,{Go:()=>v,IE:()=>d,ZP:()=>y});var n=r(1132),o=r(5672);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){u(t,e,r[e])}))}return t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r.push.apply(r,n)}return r}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}function c(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function s(t){var e=function(t,e){if("object"!==f(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!==f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"===f(e)?e:String(e)}var f=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},d="1.1.0",v="openmrs:fastDataEntryWorkflowState",m=function(t){localStorage.setItem(v+":"+t.userUuid,JSON.stringify(t))},p={workflowState:"NEW_PATIENT",activePatientUuid:null,activeEncounterUuid:null,patientUuids:[],encounters:{}};const y=function(t,e){switch(e.type){case"INITIALIZE_WORKFLOW_STATE":var r,f=localStorage.getItem(v+":"+e.userUuid),y=f?JSON.parse(f):{},b={},w=e.newPatientUuid?{activePatientUuid:e.newPatientUuid,workflowState:"EDIT_FORM"}:{};return f&&y._storageVersion===d?(b=l(a({},y),{activeFormUuid:e.activeFormUuid,forms:l(a({},y.forms),u({},e.activeFormUuid,l(a({},p,y.forms[e.activeFormUuid],w),{patientUuids:(null===(r=y.forms[e.activeFormUuid])||void 0===r?void 0:r.patientUuids)||p.patientUuids})))}),e.newPatientUuid&&!b.forms[e.activeFormUuid].patientUuids.includes(e.newPatientUuid)&&b.forms[e.activeFormUuid].patientUuids.push(e.newPatientUuid)):b=l(a({},o.ol),{_storageVersion:d,forms:u({},e.activeFormUuid,p),activeFormUuid:e.activeFormUuid,userUuid:e.userUuid}),m(b),a({},b);case"ADD_PATIENT":var h=l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{patientUuids:(R=t.forms[t.activeFormUuid].patientUuids,function(t){if(Array.isArray(t))return i(t)}(R)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(R)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(R)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([e.patientUuid]),activePatientUuid:e.patientUuid,activeEncounterUuid:null,workflowState:"EDIT_FORM"})))});return m(h),h;case"OPEN_PATIENT_SEARCH":var U=l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{activePatientUuid:null,activeEncounterUuid:null,workflowState:"NEW_PATIENT"})))});return m(U),U;case"SAVE_ENCOUNTER":if("SUBMIT_FOR_COMPLETE"===t.forms[t.activeFormUuid].workflowState){var S=t.forms,E=t.activeFormUuid,O=(S[E],c(S,[E].map(s))),g=l(a({},t),{forms:O,activeFormUuid:null});return m(g),(0,n.navigate)({to:"${openmrsSpaBase}/forms"}),g}var P=l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{encounters:l(a({},t.forms[t.activeFormUuid].encounters),u({},t.forms[t.activeFormUuid].activePatientUuid,e.encounterUuid)),activePatientUuid:null,activeEncounterUuid:null,workflowState:"SUBMIT_FOR_NEXT"===t.forms[t.activeFormUuid].workflowState?"NEW_PATIENT":"SUBMIT_FOR_REVIEW"===t.forms[t.activeFormUuid].workflowState?"REVIEW":t.forms[t.activeFormUuid].workflowState})))});return m(P),P;case"EDIT_ENCOUNTER":var F=l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{activeEncounterUuid:t.forms[t.activeFormUuid].encounters[e.patientUuid],activePatientUuid:e.patientUuid,workflowState:"EDIT_FORM"})))});return m(F),F;case"SUBMIT_FOR_NEXT":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_NEXT"})))});case"SUBMIT_FOR_REVIEW":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_REVIEW"})))});case"SUBMIT_FOR_COMPLETE":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_COMPLETE"})))});case"GO_TO_REVIEW":var T=l(a({},t),{forms:l(a({},t.forms),u({},t.activeFormUuid,l(a({},t.forms[t.activeFormUuid]),{activeEncounterUuid:null,activePatientUuid:null,workflowState:"REVIEW"})))});return m(T),T;case"DESTROY_SESSION":var _=t.forms,I=t.activeFormUuid,k=(_[I],c(_,[I].map(s))),j=l(a({},t),{forms:k,activeFormUuid:null});return m(j),(0,n.navigate)({to:"${openmrsSpaBase}/forms"}),j;case"CLOSE_SESSION":var A=l(a({},t),{activeFormUuid:null});return m(A),(0,n.navigate)({to:"${openmrsSpaBase}/forms"}),A;default:return t}var R}},282:(t,e,r)=>{r.d(e,{wJ:()=>f,lQ:()=>y,Eu:()=>d.Z,zg:()=>S});var n=r(1132),o=r(821);function i(t,e,r,n,o,i,u){try{var a=t[i](u),l=a.value}catch(t){return void r(t)}a.done?e(l):Promise.resolve(l).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var u=t.apply(e,r);function a(t){i(u,n,o,a,l,"next",t)}function l(t){i(u,n,o,a,l,"throw",t)}a(void 0)}))}}var a=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},l="(uuid,name,display,encounterType:(uuid,name,viewPrivilege,editPrivilege),version,published,retired,resources:(uuid,name,dataType,valueReference))",c="/ws/rest/v1/form?v=custom:".concat(l),s="/ws/rest/v1/form?v=custom:".concat(l,"&q=poc");const f=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=(0,n.useSession)(),r=!0,i=r?c:s,l=(0,o.ZP)([i,t],u((function(){var t,e,r,o;return a(this,(function(u){switch(u.label){case 0:return[4,(0,n.openmrsFetch)(i)];case 1:return r=u.sent(),[2,null!==(o=null===(t=r.data)||void 0===t||null===(e=t.results)||void 0===e?void 0:e.filter((function(t){return t.published&&!/component/i.test(t.name)})))&&void 0!==o?o:[]]}}))}))),f=l.data,d=l.error;return{forms:null==f?void 0:f.filter((function(t){var r,o;return Boolean((0,n.userHasAccess)(null===(r=t.encounterType)||void 0===r||null===(o=r.editPrivilege)||void 0===o?void 0:o.display,null==e?void 0:e.user))})),isLoading:!d&&!f,error:d}};var d=r(4439),v=r(1672);function m(t,e,r,n,o,i,u){try{var a=t[i](u),l=a.value}catch(t){return void r(t)}a.done?e(l):Promise.resolve(l).then(n,o)}function p(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))}}const y=function(t){var e="".concat("/ws/rest/v1/encounter/").concat(t),r=(0,o.ZP)(e,p((function(){return function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(t){switch(t.label){case 0:return[4,(0,n.openmrsFetch)(e)];case 1:return[2,t.sent().data||null]}}))}))),i=r.data,u=r.error;return{encounter:i,isLoading:!u&&i,error:u}};function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function w(t,e,r,n,o,i,u){try{var a=t[i](u),l=a.value}catch(t){return void r(t)}a.done?e(l):Promise.resolve(l).then(n,o)}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var U=function(t){var e,r,o=t.endpointUrl,i=h((0,v.useState)(null),2),u=i[0],a=i[1],l=h((0,v.useState)(null),2),c=l[0],s=l[1],f=h((0,v.useState)(null),2),d=f[0],m=f[1],p=(0,v.useCallback)((function(t){a(!1),d&&m(null),s(t.data)}),[d]),y=(0,v.useCallback)((function(t){var e,r,n;a(!1),c&&s(null),m(null!==(n=null!==(r=null==t||null===(e=t.responseBody)||void 0===e?void 0:e.error)&&void 0!==r?r:null==t?void 0:t.responseBody)&&void 0!==n?n:t)}),[c]),b=(0,v.useCallback)((e=function(t){var e;return function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(r){return a(!0),e={},[2,(0,n.openmrsFetch)(o,(e.method="POST",e.headers={"Content-Type":"application/json"},e.body=t,e)).then(p).catch(y)]}))},r=function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){w(i,n,o,u,a,"next",t)}function a(t){w(i,n,o,u,a,"throw",t)}u(void 0)}))},function(t){return r.apply(this,arguments)}),[o,y,p]);return{post:b,isPosting:u,result:c,error:d,reset:function(){a(null),s(null),m(null)}}},S=function(){return U({endpointUrl:"/ws/rest/v1/cohortm/cohort"})}},4439:(t,e,r)=>{r.d(e,{Z:()=>a});var n=r(1132),o=r(1672);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e,r,n,o,i,u){try{var a=t[i](u),l=a.value}catch(t){return void r(t)}a.done?e(l):Promise.resolve(l).then(n,o)}const a=function(t){var e,r,a=(e=(0,o.useState)(null),r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,r)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=a[0],c=a[1];(0,o.useEffect)((function(){t?d(t):c(null)}),[t]);var s,f,d=(s=function(t){var e;return function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(r){switch(r.label){case 0:return[4,(0,n.fetchCurrentPatient)(t)];case 1:return e=r.sent(),c(e),[2]}}))},f=function(){var t=this,e=arguments;return new Promise((function(r,n){var o=s.apply(t,e);function i(t){u(o,r,n,i,a,"next",t)}function a(t){u(o,r,n,i,a,"throw",t)}i(void 0)}))},function(t){return f.apply(this,arguments)});return l}},7612:(t,e,r)=>{r.d(e,{Z:()=>a});var n=r(1672),o=r(1132);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const a=function(t){var e=u((0,n.useState)(!1),2),r=e[0],i=e[1],a=u((0,n.useState)(null),2),l=a[0],c=a[1],s=u((0,n.useState)(null),2),f=s[0],d=s[1],v=(0,n.useCallback)((function(t){i(!1),d(!1),c(t)}),[]),m=(0,n.useCallback)((function(t){i(!1),c(null),d(t)}),[]),p=(0,n.useCallback)((function(){(0,o.openmrsFetch)("/ws/rest/v1/systemsetting?q=".concat(t,"&v=default")).then(v).catch(m)}),[m,v,t]);return(0,n.useEffect)((function(){p()}),[p]),{result:l,error:f,isSubmitting:r}}}}]);