@openmrs/esm-fast-data-entry-app 1.0.1-pre.93 → 1.0.1-pre.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/136.js +1 -0
- package/dist/136.js.map +1 -0
- package/dist/141.js +2 -0
- package/dist/{595.js.LICENSE.txt → 141.js.LICENSE.txt} +2 -0
- package/dist/141.js.map +1 -0
- package/dist/233.js +2 -0
- package/dist/233.js.map +1 -0
- package/dist/242.js +1 -0
- package/dist/242.js.map +1 -0
- package/dist/294.js +1 -1
- package/dist/294.js.map +1 -0
- package/dist/327.js +1 -1
- package/dist/327.js.map +1 -0
- package/dist/387.js +1 -0
- package/dist/387.js.map +1 -0
- package/dist/405.js +1 -0
- package/dist/405.js.map +1 -0
- package/dist/409.js +2 -0
- package/dist/409.js.map +1 -0
- package/dist/431.js +1 -0
- package/dist/431.js.map +1 -0
- package/dist/559.js +1 -0
- package/dist/559.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/757.js +1 -1
- package/dist/820.js +1 -1
- package/dist/820.js.map +1 -0
- package/dist/846.js +1 -0
- package/dist/846.js.map +1 -0
- package/dist/885.js +1 -0
- package/dist/885.js.map +1 -0
- package/dist/897.js +2 -0
- package/dist/897.js.map +1 -0
- package/dist/92.js +1 -0
- package/dist/92.js.map +1 -0
- package/dist/935.js +1 -1
- package/dist/935.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +189 -197
- package/dist/openmrs-esm-fast-data-entry-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/package.json +5 -2
- package/src/index.ts +13 -65
- package/src/routes.json +24 -0
- package/dist/132.js +0 -1
- package/dist/153.js +0 -1
- package/dist/229.js +0 -1
- package/dist/247.js +0 -1
- package/dist/255.js +0 -1
- package/dist/32.js +0 -1
- package/dist/571.js +0 -1
- package/dist/595.js +0 -2
- package/dist/617.js +0 -1
- package/dist/656.js +0 -2
- package/dist/658.js +0 -2
- package/dist/68.js +0 -2
- package/dist/74.js +0 -1
- package/dist/776.js +0 -1
- package/dist/804.js +0 -1
- package/dist/openmrs-esm-fast-data-entry-app.old +0 -1
- /package/dist/{656.js.LICENSE.txt → 233.js.LICENSE.txt} +0 -0
- /package/dist/{658.js.LICENSE.txt → 409.js.LICENSE.txt} +0 -0
- /package/dist/{68.js.LICENSE.txt → 897.js.LICENSE.txt} +0 -0
package/dist/617.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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(5591);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,r;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(i){return a(!0),e=o,t.uuid&&(e+="/"+t.uuid),r={},[2,(0,n.openmrsFetch)(e,(r.method="POST",r.headers={"Content-Type":"application/json"},r.body=t,r)).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}}}}]);
|
package/dist/656.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 656.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[656],{3645:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(o[a]=!0)}for(var s=0;s<e.length;s++){var u=[].concat(e[s]);r&&o[u[0]]||(n&&(u[2]?u[2]="".concat(n," and ").concat(u[2]):u[2]=n),t.push(u))}},t}},3379:e=>{var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},a=[],s=0;s<e.length;s++){var u=e[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,d="".concat(c," ").concat(l);i[c]=l+1;var f=n(d),p={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==f)t[f].references++,t[f].updater(p);else{var v=o(p,r);r.byIndex=s,t.splice(s,0,{identifier:d,updater:v,references:1})}a.push(d)}return a}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var i=r(e=e||[],o=o||{});return function(e){e=e||[];for(var a=0;a<i.length;a++){var s=n(i[a]);t[s].references--}for(var u=r(e,o),c=0;c<i.length;c++){var l=n(i[c]);0===t[l].references&&(t[l].updater(),t.splice(l,1))}i=u}}},569:e=>{var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},9216:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},3250:(e,t,n)=>{var r=n(1672),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,s=r.useLayoutEffect,u=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,l=r[1];return s((function(){o.value=n,o.getSnapshot=t,c(o)&&l({inst:o})}),[e,n,t]),a((function(){return c(o)&&l({inst:o}),e((function(){c(o)&&l({inst:o})}))}),[e]),u(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:l},1688:(e,t,n)=>{e.exports=n(3250)},1753:(e,t,n)=>{n.d(t,{$l:()=>c,BN:()=>M,DY:()=>o,J$:()=>q,JN:()=>g,LI:()=>L,PM:()=>f,W6:()=>O,i_:()=>u,ko:()=>z,kw:()=>C,mf:()=>d,o8:()=>l,qC:()=>x,s6:()=>Z,sj:()=>I,u3:()=>D,u_:()=>W,w6:()=>S,xD:()=>G});var r=n(1672);const o=new WeakMap,i={},a={},s=()=>{},u=s(),c=Object,l=e=>e===u,d=e=>"function"==typeof e,f=(e,t)=>({...e,...t}),p="undefined",v=typeof window!=p,h=typeof document!=p,g=(e,t)=>{const n=o.get(e);return[()=>!l(t)&&e.get(t)||i,r=>{if(!l(t)){const o=e.get(t);t in a||(a[t]=o),n[5](t,f(o,r),o||i)}},n[6],()=>!l(t)&&t in a?a[t]:!l(t)&&e.get(t)||i]},m=new WeakMap;let E=0;const y=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let o,i;if(c(e)!==e||r||n==RegExp)o=r?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=m.get(e),o)return o;if(o=++E+"~",m.set(e,o),n==Array){for(o="@",i=0;i<e.length;i++)o+=y(e[i])+",";m.set(e,o)}if(n==c){o="#";const t=c.keys(e).sort();for(;!l(i=t.pop());)l(e[i])||(o+=i+":"+y(e[i])+",");m.set(e,o)}}return o};let w=!0;const[_,b]=v&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[s,s],T={isOnline:()=>w,isVisible:()=>{const e=h&&document.visibilityState;return l(e)||"hidden"!==e}},R={initFocus:e=>(h&&document.addEventListener("visibilitychange",e),_("focus",e),()=>{h&&document.removeEventListener("visibilitychange",e),b("focus",e)}),initReconnect:e=>{const t=()=>{w=!0,e()},n=()=>{w=!1};return _("online",t),_("offline",n),()=>{b("online",t),b("offline",n)}}},S=!r.useId,O=!v||"Deno"in window,C=e=>v&&typeof window.requestAnimationFrame!=p?window.requestAnimationFrame(e):setTimeout(e,1),L=O?r.useEffect:r.useLayoutEffect,V="undefined"!=typeof navigator&&navigator.connection,k=!O&&V&&(["slow-2g","2g"].includes(V.effectiveType)||V.saveData),x=e=>{if(d(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?y(e):"",t]};let N=0;const D=()=>++N;var I={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:2,RECONNECT_EVENT:1};async function M(...e){const[t,n,r,i]=e,a=f({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{});let s=a.populateCache;const c=a.rollbackOnError;let p=a.optimisticData;const v=!1!==a.revalidate,h=a.throwOnError;if(d(n)){const e=n,r=[],o=t.keys();for(let n=o.next();!n.done;n=o.next()){const o=n.value;!/^\$(inf|sub)\$/.test(o)&&e(t.get(o)._k)&&r.push(o)}return Promise.all(r.map(m))}return m(n);async function m(n){const[i]=x(n);if(!i)return;const[a,f]=g(t,i),[m,E,y]=o.get(t),w=m[i],_=()=>v&&(delete y[i],w&&w[0])?w[0](2).then((()=>a().data)):a().data;if(e.length<3)return _();let b,T=r;const R=D();E[i]=[R,0];const S=!l(p),O=a(),C=O.data,L=O._c,V=l(L)?C:L;if(S&&(p=d(p)?p(V):p,f({data:p,_c:V})),d(T))try{T=T(V)}catch(e){b=e}if(T&&d(T.then)){if(T=await T.catch((e=>{b=e})),R!==E[i][0]){if(b)throw b;return T}b&&S&&(e=>"function"==typeof c?c(e):!1!==c)(b)&&(s=!0,T=V,f({data:T,_c:u}))}s&&(b||(d(s)&&(T=s(T,V)),f({data:T,_c:u}))),E[i][1]=D();const k=await _();if(f({_c:u}),!b)return s?k:T;if(h)throw b}}const A=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},P=(e,t)=>{if(!o.has(e)){const n=f(R,t),r={},i=M.bind(u,e);let a=s;const c={},l=(e,t)=>{const n=c[e]||[];return c[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},d=(t,n,r)=>{e.set(t,n);const o=c[t];if(o)for(const e of o)e(n,r)},p=()=>{if(!o.has(e)&&(o.set(e,[r,{},{},{},i,d,l]),!O)){const t=n.initFocus(setTimeout.bind(u,A.bind(u,r,0))),i=n.initReconnect(setTimeout.bind(u,A.bind(u,r,1)));a=()=>{t&&t(),i&&i(),o.delete(e)}}};return p(),[e,i,p,a]}return[e,o.get(e)[4]]},[j,F]=P(new Map),W=f({onLoadingSlow:s,onSuccess:s,onError:s,onErrorRetry:(e,t,n,r,o)=>{const i=n.errorRetryCount,a=o.retryCount,s=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!l(i)&&a>i||setTimeout(r,s,o)},onDiscarded:s,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:k?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:k?5e3:3e3,compare:(e,t)=>y(e)==y(t),isPaused:()=>!1,cache:j,mutate:F,fallback:{}},T),U=(e,t)=>{const n=f(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:a}=t;r&&i&&(n.use=r.concat(i)),o&&a&&(n.fallback=f(o,a))}return n},J=(0,r.createContext)({}),q=e=>{const{value:t}=e,n=(0,r.useContext)(J),o=d(t),i=(0,r.useMemo)((()=>o?t(n):t),[o,n,t]),a=(0,r.useMemo)((()=>o?i:U(n,i)),[o,n,i]),s=i&&i.provider,c=(0,r.useRef)(u);s&&!c.current&&(c.current=P(s(a.cache||j),i));const l=c.current;return l&&(a.cache=l[0],a.mutate=l[1]),L((()=>{if(l)return l[2]&&l[2](),l[3]}),[]),(0,r.createElement)(J.Provider,f(e,{value:a}))},$=v&&window.__SWR_DEVTOOLS_USE__,H=$?window.__SWR_DEVTOOLS_USE__:[],B=e=>d(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],Y=H.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const[r]=x(t),[,,,i]=o.get(j),a=i[r];return a?(delete i[r],a):n(...e)}),r))),Z=e=>function(...t){const n=f(W,(0,r.useContext)(J)),[o,i,a]=B(t),s=U(n,a);let u=e;const{use:c}=s,l=(c||[]).concat(Y);for(let e=l.length;e--;)u=l[e](u);return u(o,i||s.fetcher||null,s)},z=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}},G=(e,t)=>(...n)=>{const[r,o,i]=B(n),a=(i.use||[]).concat(t);return e(r,o,{...i,use:a})};$&&(window.__SWR_DEVTOOLS_REACT__=r)},5591:(e,t,n)=>{n.d(t,{ZP:()=>s});var r=n(1672),o=n(1688),i=n(1753);const a={dedupe:!0},s=(i.$l.defineProperty(i.J$,"defaultValue",{value:i.u_}),(0,i.s6)(((e,t,n)=>{const{cache:s,compare:u,suspense:c,fallbackData:l,revalidateOnMount:d,revalidateIfStale:f,refreshInterval:p,refreshWhenHidden:v,refreshWhenOffline:h,keepPreviousData:g}=n,[m,E,y]=i.DY.get(s),[w,_]=(0,i.qC)(e),b=(0,r.useRef)(!1),T=(0,r.useRef)(!1),R=(0,r.useRef)(w),S=(0,r.useRef)(t),O=(0,r.useRef)(n),C=()=>O.current,L=()=>C().isVisible()&&C().isOnline(),[V,k,x,N]=(0,i.JN)(s,w),D=(0,r.useRef)({}).current,I=(0,i.o8)(l)?n.fallback[w]:l,M=(e,t)=>{for(const n in D){const r=n;if("data"===r){if(!u(e[r],t[r])){if(!(0,i.o8)(e[r]))return!1;if(!u($,t[r]))return!1}}else if(t[r]!==e[r])return!1}return!0},A=(0,r.useMemo)((()=>{const e=!!w&&!!t&&((0,i.o8)(d)?!C().isPaused()&&!c&&(!!(0,i.o8)(f)||f):d),n=t=>{const n=(0,i.PM)(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n},r=V(),o=N(),a=n(r),s=r===o?a:n(o);let u=a;return[()=>{const e=n(V());return M(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>s]}),[s,w]),P=(0,o.useSyncExternalStore)((0,r.useCallback)((e=>x(w,((t,n)=>{M(n,t)||e()}))),[s,w]),A[0],A[1]),j=!b.current,F=m[w]&&m[w].length>0,W=P.data,U=(0,i.o8)(W)?I:W,J=P.error,q=(0,r.useRef)(U),$=g?(0,i.o8)(W)?q.current:W:U,H=!(F&&!(0,i.o8)(J))&&(j&&!(0,i.o8)(d)?d:!C().isPaused()&&(c?!(0,i.o8)(U)&&f:(0,i.o8)(U)||f)),B=!!(w&&t&&j&&H),Y=(0,i.o8)(P.isValidating)?B:P.isValidating,Z=(0,i.o8)(P.isLoading)?B:P.isLoading,z=(0,r.useCallback)((async e=>{const t=S.current;if(!w||!t||T.current||C().isPaused())return!1;let r,o,a=!0;const s=e||{},c=!y[w]||!s.dedupe,l=()=>i.w6?!T.current&&w===R.current&&b.current:w===R.current,d={isValidating:!1,isLoading:!1},f=()=>{k(d)},p=()=>{const e=y[w];e&&e[1]===o&&delete y[w]},v={isValidating:!0};(0,i.o8)(V().data)&&(v.isLoading=!0);try{if(c&&(k(v),n.loadingTimeout&&(0,i.o8)(V().data)&&setTimeout((()=>{a&&l()&&C().onLoadingSlow(w,n)}),n.loadingTimeout),y[w]=[t(_),(0,i.u3)()]),[r,o]=y[w],r=await r,c&&setTimeout(p,n.dedupingInterval),!y[w]||y[w][1]!==o)return c&&l()&&C().onDiscarded(w),!1;d.error=i.i_;const e=E[w];if(!(0,i.o8)(e)&&(o<=e[0]||o<=e[1]||0===e[1]))return f(),c&&l()&&C().onDiscarded(w),!1;const s=V().data;d.data=u(s,r)?s:r,c&&l()&&C().onSuccess(r,w,n)}catch(e){p();const t=C(),{shouldRetryOnError:n}=t;t.isPaused()||(d.error=e,c&&l()&&(t.onError(e,w,t),(!0===n||(0,i.mf)(n)&&n(e))&&L()&&t.onErrorRetry(e,w,t,(e=>{const t=m[w];t&&t[0]&&t[0](i.sj.ERROR_REVALIDATE_EVENT,e)}),{retryCount:(s.retryCount||0)+1,dedupe:!0})))}return a=!1,f(),!0}),[w,s]),G=(0,r.useCallback)(((...e)=>(0,i.BN)(s,R.current,...e)),[]);if((0,i.LI)((()=>{S.current=t,O.current=n,(0,i.o8)(W)||(q.current=W)})),(0,i.LI)((()=>{if(!w)return;const e=z.bind(i.i_,a);let t=0;const n=(0,i.ko)(w,m,((n,r={})=>{if(n==i.sj.FOCUS_EVENT){const n=Date.now();C().revalidateOnFocus&&n>t&&L()&&(t=n+C().focusThrottleInterval,e())}else if(n==i.sj.RECONNECT_EVENT)C().revalidateOnReconnect&&L()&&e();else{if(n==i.sj.MUTATE_EVENT)return z();if(n==i.sj.ERROR_REVALIDATE_EVENT)return z(r)}}));return T.current=!1,R.current=w,b.current=!0,k({_k:_}),H&&((0,i.o8)(U)||i.W6?e():(0,i.kw)(e)),()=>{T.current=!0,n()}}),[w]),(0,i.LI)((()=>{let e;function t(){const t=(0,i.mf)(p)?p(V().data):p;t&&-1!==e&&(e=setTimeout(n,t))}function n(){V().error||!v&&!C().isVisible()||!h&&!C().isOnline()?t():z(a).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[p,v,h,w]),(0,r.useDebugValue)($),c&&(0,i.o8)(U)&&w){if(!i.w6&&i.W6)throw new Error("Fallback data is required when using suspense in SSR.");throw S.current=t,O.current=n,T.current=!1,(0,i.o8)(J)?z(a):J}return{mutate:G,get data(){return D.data=!0,$},get error(){return D.error=!0,J},get isValidating(){return D.isValidating=!0,Y},get isLoading(){return D.isLoading=!0,Z}}})))}}]);
|