@openmrs/esm-react-utils 5.1.1-pre.997 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -13
- package/dist/openmrs-esm-react-utils.js +1 -2
- package/dist/openmrs-esm-react-utils.js.map +1 -1
- package/package.json +12 -11
- package/src/index.ts +1 -0
- package/src/public.ts +1 -0
- package/src/useDebounce.ts +43 -0
- package/dist/openmrs-esm-react-utils.js.LICENSE.txt +0 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
[32m@openmrs/esm-react-utils:build[0m: cache hit, replaying output [
|
|
2
|
-
[32m@openmrs/esm-react-utils:build: [0masset [1m[32mopenmrs-esm-react-utils.js[39m[22m
|
|
3
|
-
[32m@openmrs/esm-react-utils:build: [0morphan modules
|
|
1
|
+
[32m@openmrs/esm-react-utils:build[0m: cache hit, replaying output [2m02b9930f60a6cdba[0m
|
|
2
|
+
[32m@openmrs/esm-react-utils:build: [0masset [1m[32mopenmrs-esm-react-utils.js[39m[22m 64.4 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (name: main) 1 related asset
|
|
3
|
+
[32m@openmrs/esm-react-utils:build: [0morphan modules 162 KiB [1m[33m[orphan][39m[22m 119 modules
|
|
4
4
|
[32m@openmrs/esm-react-utils:build: [0mruntime modules 937 bytes 4 modules
|
|
5
|
-
[32m@openmrs/esm-react-utils:build: [0mbuilt modules
|
|
6
|
-
[32m@openmrs/esm-react-utils:build: [0m cacheable modules
|
|
7
|
-
[32m@openmrs/esm-react-utils:build: [0m modules by path [1m../../../node_modules/[39m[22m
|
|
5
|
+
[32m@openmrs/esm-react-utils:build: [0mbuilt modules 178 KiB [1m[33m[built][39m[22m
|
|
6
|
+
[32m@openmrs/esm-react-utils:build: [0m cacheable modules 178 KiB
|
|
7
|
+
[32m@openmrs/esm-react-utils:build: [0m modules by path [1m../../../node_modules/[39m[22m 984 bytes 2 modules
|
|
8
8
|
[32m@openmrs/esm-react-utils:build: [0m + 3 modules
|
|
9
9
|
[32m@openmrs/esm-react-utils:build: [0m modules by path [1mexternal "@openmrs/[39m[22m 168 bytes
|
|
10
10
|
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "@openmrs/esm-config"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
11
11
|
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "@openmrs/esm-extensions"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
12
|
-
[32m@openmrs/esm-react-utils:build: [0m
|
|
13
|
-
[32m@openmrs/esm-react-utils:build: [0m
|
|
14
|
-
[32m@openmrs/esm-react-utils:build: [
|
|
15
|
-
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "react-i18next"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
16
|
-
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "dayjs"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
17
|
-
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "react-dom"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
18
|
-
[32m@openmrs/esm-react-utils:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in 7073 ms
|
|
12
|
+
[32m@openmrs/esm-react-utils:build: [0m + 2 modules
|
|
13
|
+
[32m@openmrs/esm-react-utils:build: [0m + 5 modules
|
|
14
|
+
[32m@openmrs/esm-react-utils:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in 8990 ms
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/*! For license information please see openmrs-esm-react-utils.js.LICENSE.txt */
|
|
2
|
-
System.register(["react","@openmrs/esm-config","@openmrs/esm-extensions","@openmrs/esm-globals","react-dom","react-i18next","@openmrs/esm-api","dayjs"],(function(e,t){var n={},r={},o={},i={},a={},u={},c={},l={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(a,"__esModule",{value:!0}),{setters:[function(e){Object.keys(e).forEach((function(t){n[t]=e[t]}))},function(e){r.getConfigStore=e.getConfigStore,r.getExtensionConfigFromStore=e.getExtensionConfigFromStore,r.getExtensionsConfigStore=e.getExtensionsConfigStore,r.interpolateUrl=e.interpolateUrl,r.navigate=e.navigate},function(e){o.getConnectedExtensions=e.getConnectedExtensions,o.getExtensionInternalStore=e.getExtensionInternalStore,o.getExtensionStore=e.getExtensionStore,o.registerExtensionSlot=e.registerExtensionSlot,o.renderExtension=e.renderExtension},function(e){i.subscribeConnectivityChanged=e.subscribeConnectivityChanged},function(e){Object.keys(e).forEach((function(t){a[t]=e[t]}))},function(e){u.I18nextProvider=e.I18nextProvider},function(e){c.defaultVisitCustomRepresentation=e.defaultVisitCustomRepresentation,c.fetchCurrentPatient=e.fetchCurrentPatient,c.getCurrentUser=e.getCurrentUser,c.getLocations=e.getLocations,c.getSessionStore=e.getSessionStore,c.getVisitStore=e.getVisitStore,c.getVisitTypes=e.getVisitTypes,c.openmrsFetch=e.openmrsFetch,c.userHasAccess=e.userHasAccess},function(e){l.default=e.default}],execute:function(){e((()=>{var e={332:function(e){e.exports=function(){"use strict";return function(e,t,n){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=n();return this.format(e)===t.format(e)}}}()},645:(e,t,n)=>{"use strict";var r=n(493);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},570:()=>{System.register(["@openmrs/esm-state"],(function(e,t){var n={};return{setters:[function(e){n.getGlobalStore=e.getGlobalStore}],execute:function(){e(function(){"use strict";var e={685:function(e){e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){var e=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},t=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},n=function(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(n){t(e,n,r[n])}))}return e},i=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e},a=function(e,r,o){var a;d.setState((function(u){var c;return{flags:i(n({},u.flags),t({},e,{enabled:null!==(a=null===(c=u.flags[e])||void 0===c?void 0:c.enabled)&&void 0!==a&&a,label:r,description:o}))}}))},u=function(e){return d.getState().flags[e].enabled},c=function(e,t){d.subscribe((function(n){t(n.flags[e].enabled)}))},l=function(e,r){d.setState((function(o){return{flags:i(n({},o.flags),t({},e,i(n({},o.flags[e]),{enabled:r})))}}))};r.r(o),r.d(o,{featureFlagsStore:function(){return d},getFeatureFlag:function(){return u},registerFeatureFlag:function(){return a},setFeatureFlag:function(){return l},subscribeToFeatureFlag:function(){return c}});var s=r(685),f={flags:function(){var e={},t=!0,r=!1,o=void 0;try{for(var i,a=Object.keys(localStorage)[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var u=i.value;if(u.startsWith("openmrs:feature-flag:")){var c=u.replace("openmrs:feature-flag:",""),l=JSON.parse(localStorage.getItem("openmrs:feature-flag-meta:".concat(c))||"{}");e[c]=n({enabled:"true"===localStorage.getItem(u)},l)}}}catch(e){r=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw o}}return e}()},d=(0,s.getGlobalStore)("feature-flags",f);d.subscribe((function(t){var n,r=!0,o=!1,i=void 0;try{for(var a,u=Object.entries(t.flags)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=function(e){if(Array.isArray(e))return e}(n=a.value)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(n)||function(t,n){if(t){if("string"==typeof t)return e(t,2);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)?e(t,2):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=c[0],s=c[1];localStorage.setItem("openmrs:feature-flag:".concat(l),s.enabled.toString()),localStorage.setItem("openmrs:feature-flag-meta:".concat(l),JSON.stringify({label:s.label,description:s.description}))}}catch(t){o=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}}))}(),o}())}}}))},385:()=>{System.register([],(function(e,t){return{execute:function(){e(function(){"use strict";var e=function(e,t){var n=u[e];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(t,!0),n.active=!0,n.value;var r=a()((function(){return t}));return u[e]={value:r,active:!0},r},t=function(e,t){var n=u[e];if(!n){var r=a()((function(){return null!=t?t:{}}));return u[e]={value:r,active:!1},r}return n.value},n=function(e,t,n){var r=t(e.getState());return e.subscribe((function(e){var o=t(e);o!==r&&(r=o,n(o))}))},r={d:function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};r.r(o),r.d(o,{createGlobalStore:function(){return e},getGlobalStore:function(){return t},subscribeTo:function(){return n}});var i=function(e){var t,n=new Set,r=function(e,r){var o="function"==typeof e?e(t):e;if(!Object.is(o,t)){var i=t;t=(null!=r?r:"object"!=typeof o)?o:Object.assign({},t,o),n.forEach((function(e){return e(t,i)}))}},o=function(){return t},i={setState:r,getState:o,subscribe:function(e){return n.add(e),function(){return n.delete(e)}},destroy:function(){console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(r,o,i),i},a=function(e){return e?i(e):i},u={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=u)}),1e3),o}())}}}))},173:(e,t,n)=>{"use strict";var r=n(954),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,u=r.useLayoutEffect,c=r.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var s="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,s=r[1];return u((function(){o.value=n,o.getSnapshot=t,l(o)&&s({inst:o})}),[e,n,t]),a((function(){return l(o)&&s({inst:o}),e((function(){l(o)&&s({inst:o})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:s},374:(e,t,n)=>{"use strict";e.exports=n(173)},766:e=>{"use strict";e.exports=c},824:e=>{"use strict";e.exports=r},45:e=>{"use strict";e.exports=o},728:e=>{"use strict";e.exports=i},688:e=>{"use strict";e.exports=l},954:e=>{"use strict";e.exports=n},493:e=>{"use strict";e.exports=a},281:e=>{"use strict";e.exports=u}},t={};function s(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};return(()=>{"use strict";s.r(f),s.d(f,{ComponentContext:()=>t,ConfigurableLink:()=>o,Extension:()=>l,ExtensionSlot:()=>Lt,UserHasAccess:()=>Zn,createUseStore:()=>Ct,getAsyncExtensionLifecycle:()=>pn,getAsyncLifecycle:()=>fn,getLifecycle:()=>sn,getSyncLifecycle:()=>dn,isDesktop:()=>Gn,openmrsComponentDecorator:()=>ln,useAssignedExtensionIds:()=>mn,useAssignedExtensions:()=>gt,useBodyScrollLock:()=>bn,useConfig:()=>En,useConnectedExtensions:()=>Tt,useConnectivity:()=>y,useExtensionInternalStore:()=>Dn,useExtensionSlot:()=>kt,useExtensionSlotMeta:()=>Un,useExtensionStore:()=>Nn,useFeatureFlag:()=>Ln,useForceUpdate:()=>Vn,useLayoutType:()=>$n,useLocations:()=>qn,useOnClickOutside:()=>Hn,usePagination:()=>Zr,usePatient:()=>kn,useSession:()=>Xn,useStore:()=>Pt,useStoreWithActions:()=>At,useVisit:()=>qr,useVisitTypes:()=>Jr});var e=s(954),t=e.default.createContext({moduleName:""}),n=s(824);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(t){var o=t.to,i=t.templateParams,a=t.children,u=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["to","templateParams","children"]);return e.default.createElement("a",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){r(e,t,n[t])}))}return e}({onClick:function(e){return function(e,t,r){e.metaKey||e.ctrlKey||e.shiftKey||0!=e.button||(e.preventDefault(),(0,n.navigate)({to:t,templateParams:r}))}(e,o,i)},href:(0,n.interpolateUrl)(o,i)},u),a)}var i=s(45);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){u(e,t,n[t])}))}return e}var l=function(n){var r=n.state,o=n.children,u=n.wrap,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["state","children","wrap"]),s=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(),2),f=s[0],d=s[1],p=(0,e.useContext)(t).extension,y=(0,e.useRef)(null),m=(0,e.useRef)(Promise.resolve()),b=(0,e.useRef)(!1);(0,e.useEffect)((function(){u&&console.warn("'wrap' prop of Extension is being used ".concat((null==p?void 0:p.extensionId)?"by ".concat(p.extensionId," in ").concat(p.extensionSlotName):"",". This will be removed in a future release."))}),[]);var v=(0,e.useCallback)((function(e){d(e)}),[d]);(0,e.useEffect)((function(){if(null!=f&&(null==p?void 0:p.extensionSlotName)&&p.extensionSlotModuleName&&p.extensionSlotModuleName&&!y.current&&!b.current)return b.current=!0,(0,i.renderExtension)(f,p.extensionSlotName,p.extensionSlotModuleName,p.extensionId,void 0,r).then((function(e){y.current=e,b.current=!1})),function(){if(y&&y.current)switch(y.current.getStatus()){case"MOUNTING":y.current.mountPromise.then((function(){var e;"MOUNTED"===(null===(e=y.current)||void 0===e?void 0:e.getStatus())&&y.current.unmount()}));break;case"MOUNTED":y.current.unmount();break;case"UPDATING":m.current&&m.current.then((function(){var e;"MOUNTED"===(null===(e=y.current)||void 0===e?void 0:e.getStatus())&&y.current.unmount()}))}}}),[null==p?void 0:p.extensionSlotName,null==p?void 0:p.extensionId,null==p?void 0:p.extensionSlotModuleName,f]),(0,e.useEffect)((function(){y.current&&y.current.update&&"UNMOUNTING"!==y.current.getStatus()&&Promise.all([y.current.mountPromise,m.current]).then((function(){var e;"MOUNTED"===(null==y||null===(e=y.current)||void 0===e?void 0:e.getStatus())&&y.current.update&&(m.current=y.current.update(c({},r)).catch((function(e){var t,n,r;if(n=e,!(null!=(r=Error)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)||!e.message.includes("minified message #32")||"MOUNTED"===(null===(t=y.current)||void 0===t?void 0:t.getStatus()))throw e})))}))}),[r]);var g=e.default.createElement("div",c({ref:v,"data-extension-id":null==p?void 0:p.extensionId,style:{position:"relative"}},l));return"function"!=typeof o||e.default.isValidElement(o)?p&&u?u(g,p):g:e.default.createElement(e.default.Fragment,null,o(g,p))},d=s(728);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(window.navigator.onLine),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){return(0,d.subscribeConnectivityChanged)((function(e){var t=e.online;return r(t)}))}),[]),n}const m=function(e,t){return e===t||e!=e&&t!=t},b=function(e,t){for(var n=e.length;n--;)if(m(e[n][0],t))return n;return-1};var v=Array.prototype.splice;function g(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}g.prototype.clear=function(){this.__data__=[],this.size=0},g.prototype.delete=function(e){var t=this.__data__,n=b(t,e);return!(n<0||(n==t.length-1?t.pop():v.call(t,n,1),--this.size,0))},g.prototype.get=function(e){var t=this.__data__,n=b(t,e);return n<0?void 0:t[n][1]},g.prototype.has=function(e){return b(this.__data__,e)>-1},g.prototype.set=function(e,t){var n=this.__data__,r=b(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};const h=g,S="object"==typeof global&&global&&global.Object===Object&&global;var w="object"==typeof self&&self&&self.Object===Object&&self;const O=S||w||Function("return this")(),j=O.Symbol;var E=Object.prototype,x=E.hasOwnProperty,_=E.toString,P=j?j.toStringTag:void 0;var A=Object.prototype.toString;var C=j?j.toStringTag:void 0;const I=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":C&&C in Object(e)?function(e){var t=x.call(e,P),n=e[P];try{e[P]=void 0;var r=!0}catch(e){}var o=_.call(e);return r&&(t?e[P]=n:delete e[P]),o}(e):function(e){return A.call(e)}(e)},R=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},M=function(e){if(!R(e))return!1;var t=I(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},T=O["__core-js_shared__"];var k,D=(k=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var U=Function.prototype.toString;const N=function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var L=/^\[object .+?Constructor\]$/,F=Function.prototype,V=Object.prototype,B=F.toString,z=V.hasOwnProperty,$=RegExp("^"+B.call(z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const G=function(e){return!(!R(e)||(t=e,D&&D in t))&&(M(e)?$:L).test(N(e));var t},W=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return G(n)?n:void 0},q=W(O,"Map"),H=W(Object,"create");var J=Object.prototype.hasOwnProperty;var Y=Object.prototype.hasOwnProperty;function K(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}K.prototype.clear=function(){this.__data__=H?H(null):{},this.size=0},K.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},K.prototype.get=function(e){var t=this.__data__;if(H){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return J.call(t,e)?t[e]:void 0},K.prototype.has=function(e){var t=this.__data__;return H?void 0!==t[e]:Y.call(t,e)},K.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=H&&void 0===t?"__lodash_hash_undefined__":t,this};const Z=K,Q=function(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map};function X(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}X.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(q||h),string:new Z}},X.prototype.delete=function(e){var t=Q(this,e).delete(e);return this.size-=t?1:0,t},X.prototype.get=function(e){return Q(this,e).get(e)},X.prototype.has=function(e){return Q(this,e).has(e)},X.prototype.set=function(e,t){var n=Q(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};const ee=X;function te(e){var t=this.__data__=new h(e);this.size=t.size}te.prototype.clear=function(){this.__data__=new h,this.size=0},te.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},te.prototype.get=function(e){return this.__data__.get(e)},te.prototype.has=function(e){return this.__data__.has(e)},te.prototype.set=function(e,t){var n=this.__data__;if(n instanceof h){var r=n.__data__;if(!q||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ee(r)}return n.set(e,t),this.size=n.size,this};const ne=te;function re(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ee;++t<n;)this.add(e[t])}re.prototype.add=re.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},re.prototype.has=function(e){return this.__data__.has(e)};const oe=re,ie=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},ae=function(e,t){return e.has(t)},ue=function(e,t,n,r,o,i){var a=1&n,u=e.length,c=t.length;if(u!=c&&!(a&&c>u))return!1;var l=i.get(e),s=i.get(t);if(l&&s)return l==t&&s==e;var f=-1,d=!0,p=2&n?new oe:void 0;for(i.set(e,t),i.set(t,e);++f<u;){var y=e[f],m=t[f];if(r)var b=a?r(m,y,f,t,e,i):r(y,m,f,e,t,i);if(void 0!==b){if(b)continue;d=!1;break}if(p){if(!ie(t,(function(e,t){if(!ae(p,t)&&(y===e||o(y,e,n,r,i)))return p.push(t)}))){d=!1;break}}else if(y!==m&&!o(y,m,n,r,i)){d=!1;break}}return i.delete(e),i.delete(t),d},ce=O.Uint8Array,le=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n},se=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var fe=j?j.prototype:void 0,de=fe?fe.valueOf:void 0;const pe=Array.isArray;var ye=Object.prototype.propertyIsEnumerable,me=Object.getOwnPropertySymbols;const be=me?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}(me(e),(function(t){return ye.call(e,t)})))}:function(){return[]},ve=function(e){return null!=e&&"object"==typeof e},ge=function(e){return ve(e)&&"[object Arguments]"==I(e)};var he=Object.prototype,Se=he.hasOwnProperty,we=he.propertyIsEnumerable,Oe=ge(function(){return arguments}())?ge:function(e){return ve(e)&&Se.call(e,"callee")&&!we.call(e,"callee")};const je=Oe;var Ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,xe=Ee&&"object"==typeof module&&module&&!module.nodeType&&module,_e=xe&&xe.exports===Ee?O.Buffer:void 0;const Pe=(_e?_e.isBuffer:void 0)||function(){return!1};var Ae=/^(?:0|[1-9]\d*)$/;const Ce=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ae.test(e))&&e>-1&&e%1==0&&e<t},Ie=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Re={};Re["[object Float32Array]"]=Re["[object Float64Array]"]=Re["[object Int8Array]"]=Re["[object Int16Array]"]=Re["[object Int32Array]"]=Re["[object Uint8Array]"]=Re["[object Uint8ClampedArray]"]=Re["[object Uint16Array]"]=Re["[object Uint32Array]"]=!0,Re["[object Arguments]"]=Re["[object Array]"]=Re["[object ArrayBuffer]"]=Re["[object Boolean]"]=Re["[object DataView]"]=Re["[object Date]"]=Re["[object Error]"]=Re["[object Function]"]=Re["[object Map]"]=Re["[object Number]"]=Re["[object Object]"]=Re["[object RegExp]"]=Re["[object Set]"]=Re["[object String]"]=Re["[object WeakMap]"]=!1;var Me="object"==typeof exports&&exports&&!exports.nodeType&&exports,Te=Me&&"object"==typeof module&&module&&!module.nodeType&&module,ke=Te&&Te.exports===Me&&S.process,De=function(){try{return Te&&Te.require&&Te.require("util").types||ke&&ke.binding&&ke.binding("util")}catch(e){}}(),Ue=De&&De.isTypedArray;const Ne=Ue?(Le=Ue,function(e){return Le(e)}):function(e){return ve(e)&&Ie(e.length)&&!!Re[I(e)]};var Le,Fe=Object.prototype.hasOwnProperty;const Ve=function(e,t){var n=pe(e),r=!n&&je(e),o=!n&&!r&&Pe(e),i=!n&&!r&&!o&&Ne(e),a=n||r||o||i,u=a?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=u.length;for(var l in e)!t&&!Fe.call(e,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ce(l,c))||u.push(l);return u};var Be=Object.prototype;const ze=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object);var $e=Object.prototype.hasOwnProperty;const Ge=function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||Be))return ze(e);var t,n,r=[];for(var o in Object(e))$e.call(e,o)&&"constructor"!=o&&r.push(o);return r},We=function(e){return null!=(t=e)&&Ie(t.length)&&!M(t)?Ve(e):Ge(e);var t},qe=function(e){return function(e,t,n){var r=t(e);return pe(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,We,be)};var He=Object.prototype.hasOwnProperty;const Je=W(O,"DataView"),Ye=W(O,"Promise"),Ke=W(O,"Set"),Ze=W(O,"WeakMap");var Qe="[object Map]",Xe="[object Promise]",et="[object Set]",tt="[object WeakMap]",nt="[object DataView]",rt=N(Je),ot=N(q),it=N(Ye),at=N(Ke),ut=N(Ze),ct=I;(Je&&ct(new Je(new ArrayBuffer(1)))!=nt||q&&ct(new q)!=Qe||Ye&&ct(Ye.resolve())!=Xe||Ke&&ct(new Ke)!=et||Ze&&ct(new Ze)!=tt)&&(ct=function(e){var t=I(e),n="[object Object]"==t?e.constructor:void 0,r=n?N(n):"";if(r)switch(r){case rt:return nt;case ot:return Qe;case it:return Xe;case at:return et;case ut:return tt}return t});const lt=ct;var st="[object Arguments]",ft="[object Array]",dt="[object Object]",pt=Object.prototype.hasOwnProperty;const yt=function(e,t,n,r,o,i){var a=pe(e),u=pe(t),c=a?ft:lt(e),l=u?ft:lt(t),s=(c=c==st?dt:c)==dt,f=(l=l==st?dt:l)==dt,d=c==l;if(d&&Pe(e)){if(!Pe(t))return!1;a=!0,s=!1}if(d&&!s)return i||(i=new ne),a||Ne(e)?ue(e,t,n,r,o,i):function(e,t,n,r,o,i,a){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new ce(e),new ce(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return m(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var u=le;case"[object Set]":var c=1&r;if(u||(u=se),e.size!=t.size&&!c)return!1;var l=a.get(e);if(l)return l==t;r|=2,a.set(e,t);var s=ue(u(e),u(t),r,o,i,a);return a.delete(e),s;case"[object Symbol]":if(de)return de.call(e)==de.call(t)}return!1}(e,t,c,n,r,o,i);if(!(1&n)){var p=s&&pt.call(e,"__wrapped__"),y=f&&pt.call(t,"__wrapped__");if(p||y){var b=p?e.value():e,v=y?t.value():t;return i||(i=new ne),o(b,v,n,r,i)}}return!!d&&(i||(i=new ne),function(e,t,n,r,o,i){var a=1&n,u=qe(e),c=u.length;if(c!=qe(t).length&&!a)return!1;for(var l=c;l--;){var s=u[l];if(!(a?s in t:He.call(t,s)))return!1}var f=i.get(e),d=i.get(t);if(f&&d)return f==t&&d==e;var p=!0;i.set(e,t),i.set(t,e);for(var y=a;++l<c;){var m=e[s=u[l]],b=t[s];if(r)var v=a?r(b,m,s,t,e,i):r(m,b,s,e,t,i);if(!(void 0===v?m===b||o(m,b,n,r,i):v)){p=!1;break}y||(y="constructor"==s)}if(p&&!y){var g=e.constructor,h=t.constructor;g==h||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof h&&h instanceof h||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,r,o,i))},mt=function e(t,n,r,o,i){return t===n||(null==t||null==n||!ve(t)&&!ve(n)?t!=t&&n!=n:yt(t,n,r,o,e,i))},bt=function(e,t){return mt(e,t)};function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gt(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)([]),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){var e=function(e){var n,i,a=null!==(i=null===(n=e.slots[t])||void 0===n?void 0:n.assignedExtensions)&&void 0!==i?i:[];bt(a,r)||o(a)};return e((0,i.getExtensionStore)().getState()),(0,i.getExtensionStore)().subscribe(e)}),[t,r]),r}var ht=s(385);function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){wt(e,t,n[t])}))}return e}function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||Et(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Et(e,t){if(e){if("string"==typeof e)return St(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?St(e,t):void 0}}function xt(e,t){var n=function(n){r[n]=function(){var r=arguments;e.setState((function(e){for(var o,i=[e],a=0;a<r.length;a++)i.push(r[a]);return(o=t)[n].apply(o,function(e){if(Array.isArray(e))return St(e)}(u=i)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(u)||Et(u)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var u}))}};"function"==typeof t&&(t=t(e));var r={};for(var o in t)n(o);return r}var _t=function(e){return e};function Pt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_t,r=arguments.length>2?arguments[2]:void 0,o=jt((0,e.useState)((function(){return n(t.getState())})),2),i=o[0],a=o[1];return(0,e.useEffect)((function(){return(0,ht.subscribeTo)(t,n,a)}),[t,n]),Ot({},i,(0,e.useMemo)((function(){return r?xt(t,r):{}}),[t,r]))}function At(e,t){return Pt(e,_t,t)}function Ct(t){return function(n){var r=jt((0,e.useState)(t.getState()),2),o=r[0],i=r[1];return(0,e.useEffect)((function(){return t.subscribe((function(e){return i(e)}))}),[]),Ot({},o,(0,e.useMemo)((function(){return n?xt(t,n):{}}),[n]))}}var It=s(570);function Rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Mt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tt(t){var n=y(),r=gt(t),o=Pt(It.featureFlagsStore),a=(0,e.useMemo)((function(){return Object.entries(o.flags).filter((function(e){return Mt(e,2)[1].enabled})).map((function(e){return Mt(e,1)[0]}))}),[o.flags]);return(0,e.useMemo)((function(){return(0,i.getConnectedExtensions)(r,n,a)}),[r,n,a])}function kt(n){var r=(0,e.useContext)(t).moduleName;if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,e.useEffect)((function(){(0,i.registerExtensionSlot)(r,n)}),[]),{extensions:Tt(n),extensionSlotName:n,extensionSlotModuleName:r}}function Dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Dt(e,t,n[t])}))}return e}function Nt(e){return e}function Lt(n){var r=n.name,o=n.extensionSlotName,i=n.select,a=void 0===i?Nt:i,u=n.children,c=n.state,s=n.style,f=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["name","extensionSlotName","select","children","state","style"]);if(u&&c)throw new Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");var d,p,y,m,b=null!=r?r:o,v=(0,e.useRef)(null),g=kt(b),h=g.extensions,S=g.extensionSlotModuleName,w=(0,e.useMemo)((function(){return a(h)}),[a,h]),O=(0,e.useMemo)((function(){if("function"==typeof u&&!e.default.isValidElement(u))return w.map((function(e){return u(e)}))}),[u,w]);return e.default.createElement("div",Ut({ref:v,"data-extension-slot-name":b,"data-extension-slot-module-name":S,style:(y=Ut({},s),m={position:"relative"},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(m)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(m)).forEach((function(e){Object.defineProperty(y,e,Object.getOwnPropertyDescriptor(m,e))})),y)},f),b&&w.map((function(n,r){return e.default.createElement(t.Provider,{key:n.id,value:{moduleName:S,extension:{extensionId:n.id,extensionSlotName:b,extensionSlotModuleName:S}}},null!==(p=null!==(d=null==O?void 0:O[r])&&void 0!==d?d:"function"!=typeof u?u:null)&&void 0!==p?p:e.default.createElement(l,{state:c}))})))}var Ft=s(645);function Vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach((function(t){$t(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zt(e){return(zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gt(e){return(Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Wt(e,t){var n;if("function"!=typeof(n=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(Gt(n)));return function(){var e=n(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(Gt(e)));return e}}var qt=null;try{qt=require("react").createContext()}catch(Vt){}var Ht={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,renderType:"createRoot",errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function Jt(e){if("object"!==zt(e))throw new Error("single-spa-react requires a configuration object");var t=Bt(Bt({},Ht),e);if(!t.React)throw new Error("single-spa-react must be passed opts.React");if(!t.ReactDOM&&!t.ReactDOMClient)throw new Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(!t.rootComponent&&!t.loadRootComponent)throw new Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(t.errorBoundary&&"function"!=typeof t.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!qt&&t.React.createContext&&(qt=t.React.createContext()),t.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(t);var n={bootstrap:Yt.bind(null,t),mount:Kt.bind(null,t),unmount:Zt.bind(null,t)};return t.parcelCanUpdate&&(n.update=Qt.bind(null,t)),n}function Yt(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function Kt(e,t){return new Promise((function(n,r){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var o=tn(e,t,(function(){n(this)})),i=Wt(e,t)(),a=function(e){var t=e.renderType,n=e.elementToRender,r=e.domElement,o=e.reactDom[t];if("function"!=typeof o)throw new Error('renderType "'.concat(t,'" did not return a function.'));switch(t){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(r);return i.render(n),i;case"hydrateRoot":return o(r,n);default:return o(n,r),null}}({elementToRender:o,domElement:i,reactDom:Xt(e),renderType:en(e)});e.domElements[t.name]=i,e.renderResults[t.name]=a}))}function Zt(e,t){return new Promise((function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():Xt(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function Qt(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=tn(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(r);else{var i=Wt(e,t)();Xt(e).render(r,i)}}))}function Xt(e){return e.ReactDOMClient||e.ReactDOM}function en(e){return"function"==typeof e.renderType?e.renderType():e.renderType}function tn(e,t,n){var r=e.React.createElement(e.rootComponent,t),o=qt?e.React.createElement(qt.Provider,{value:t},r):r;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function n(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},n}(e,t),o=e.React.createElement(e.errorBoundaryClass,t,o)),e.React.createElement(e.SingleSpaRoot,Bt(Bt({},t),{},{mountFinished:n,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach((function(e){return e()})),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),o)}var nn=s(281);function rn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function on(e){return on=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},on(e)}function an(e,t){return an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},an(e,t)}function un(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=on(e);if(t){var o=on(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!=((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t;var n}(this,n)}}var cn={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1};function ln(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},cn,n);return function(n){var o,i,a,u;return i=o=function(o){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&an(e,t)}(c,o);var i,a,u=un(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.call(this,e)).state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:e._extensionContext}},t}return i=c,(a=[{key:"componentDidCatch",value:function(e,t){t&&t.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:t.componentStack})),r.throwErrorsToConsole&&setTimeout((function(){throw e})),this.setState({caughtError:e,caughtErrorInfo:t})}},{key:"render",value:function(){if(this.state.caughtError)return e.default.createElement("div",null,"An error has occurred. Please try reloading the page.");var o=e.default.createElement(e.Suspense,{fallback:null},e.default.createElement(t.Provider,{value:this.state.config},r.disableTranslations?e.default.createElement(n,this.props):e.default.createElement(nn.I18nextProvider,{i18n:window.i18next,defaultNS:r.moduleName},e.default.createElement(n,this.props))));return r.strictMode||!e.default.StrictMode?o:e.default.createElement(e.default.StrictMode,null,o)}}])&&rn(i.prototype,a),c}(e.default.Component),a="displayName",u="OpenmrsReactComponent(".concat(r.featureName,")"),a in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,o}}function sn(t,n){return Jt({React:e.default,ReactDOMClient:Ft,rootComponent:ln(n)(t)})}function fn(e,t){return function(){return e().then((function(e){return sn(e.default,t)}))}}function dn(e,t){return function(){return Promise.resolve(sn(e,t))}}var pn=fn;function yn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mn(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)([]),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){return(0,i.getExtensionStore)().subscribe((function(e){var n,i,a=null!==(i=null===(n=e.slots[t])||void 0===n?void 0:n.assignedExtensions.map((function(e){return e.id})))&&void 0!==i?i:[];bt(a,r)||o(a)}))}),[]),r}function bn(t){(0,e.useEffect)((function(){if(t){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}}),[t])}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){gn(e,t,n[t])}))}return e}function Sn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var wn={},On='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function jn(t){var r=(0,e.useMemo)(n.getExtensionsConfigStore,[]),o=function(t,r){var o=Sn((0,e.useState)(function(e,t){return t?function(){var r=e.getState(),o=(0,n.getExtensionConfigFromStore)(r,t.extensionSlotName,t.extensionId);if(o.loaded&&o.config)return o.config}:null}(t,r)),2),i=o[0],a=o[1];return(0,e.useEffect)((function(){if(r)return t.subscribe((function(e){var t=(0,n.getExtensionConfigFromStore)(e,r.extensionSlotName,r.extensionId);t.loaded&&t.config&&!bt(t.config,i)&&a(t.config)}))}),[t,r,i]),i}(r,t);if(!o&&t){var i="".concat(t.extensionSlotName,"-").concat(t.extensionId);throw!wn[i]&&r&&(wn[i]=function(e,t){return new Promise((function(r){var o=e.subscribe((function(e){var i=(0,n.getExtensionConfigFromStore)(e,t.extensionSlotName,t.extensionId);i.loaded&&i.config&&(r(i.config),o())}))}))}(r,t)),wn[i]}return o||{}}function En(r){var o,i=(0,e.useContext)(t),a=i.moduleName,u=i.extension,c=null!==(o=null==r?void 0:r.externalModuleName)&&void 0!==o?o:a;if(!c&&!u)throw Error(On);var l=function(t){var r=(0,e.useMemo)((function(){return(0,n.getConfigStore)(t)}),[t]),o=t,i=function(t){var n=Sn((0,e.useState)(function(e){return function(){var t=e.getState();return t.loaded&&t.config?t.config:null}}(t)),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){return null==t?void 0:t.subscribe((function(e){e.loaded&&e.config&&o(e.config)}))}),[t]),r}(r);if(!i)throw wn[o]||(wn[o]=function(e){return new Promise((function(t){var n=e.subscribe((function(e){e.loaded&&e.config&&(t(e.config),n())}))}))}(r)),wn[o];return i}(c),s=jn(u);return(0,e.useMemo)((function(){return(null==r?void 0:r.externalModuleName)&&c===r.externalModuleName?hn({},l):hn({},l,s)}),[c,null==r?void 0:r.externalModuleName,l,s])}var xn,_n=s(766);function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function An(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){An(e,t,n[t])}))}return e}function In(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}!function(e){e.loadPatient="loadPatient",e.newPatient="newPatient",e.loadError="patientLoadError"}(xn||(xn={}));var Rn={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function Mn(){var e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function Tn(e,t){switch(t.type){case xn.loadPatient:return In(Cn({},e),{patientUuid:t.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case xn.newPatient:return In(Cn({},e),{patient:t.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case xn.loadError:return In(Cn({},e),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:t.err});default:return e}}function kn(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useReducer)(Tn,In(Cn({},Rn),{patientUuid:null!=t?t:null,isPendingUuid:!t,isLoadingPatient:!!t})),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){if(r.isPendingUuid){var e=Mn();o(e?{type:xn.loadPatient,patientUuid:e}:{type:xn.newPatient,patient:null})}var t=!0;return r.isLoadingPatient&&r.patientUuid&&(0,_n.fetchCurrentPatient)(r.patientUuid).then((function(e){return t&&o({patient:e,type:xn.newPatient})}),(function(e){return t&&o({err:e,type:xn.loadError})})),function(){t=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,e.useEffect)((function(){var e=function(e){var t=Mn();t!=r.patientUuid&&o({type:xn.loadPatient,patientUuid:t})};return window.addEventListener("single-spa:routing-event",e),function(){return window.removeEventListener("single-spa:routing-event",e)}}),[r.patientUuid]),{isLoading:r.isPendingUuid||r.isLoadingPatient,patient:r.patient,patientUuid:null!=t?t:r.patientUuid,error:r.err}}var Dn=Ct((0,i.getExtensionInternalStore)());function Un(t){var n=Tt(t);return(0,e.useMemo)((function(){return Object.fromEntries(n.map((function(e){return[e.name,e.meta]})))}),[n])}var Nn=Ct((0,i.getExtensionStore)());function Ln(t){var n,r=Pt(It.featureFlagsStore).flags;return(0,e.useEffect)((function(){r[t]||console.error('useFeatureFlag: Attempted to get value of non-existent flag "'.concat(t,'". Did you forget to call registerFeatureFlag?'))}),[r[t]]),null===(n=r[t])||void 0===n?void 0:n.enabled}function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Vn(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(0),2)[1];return(0,e.useCallback)((function(){t((function(e){return e+1}))}),[])}function Bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function zn(){var e="tablet";return document.body.classList.forEach((function(t){switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}})),e}function $n(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(zn),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){var e=function(){r(zn())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n}var Gn=function(e){return"small-desktop"===e||"large-desktop"===e};function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qn(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)([]),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){var e=(0,_n.getLocations)().subscribe((function(e){r(e)}),(function(e){console.error(e)}));return function(){return e.unsubscribe()}}),[]),n}function Hn(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,e.useRef)(null);return(0,e.useEffect)((function(){if(n){var e=function(e){var n;(null==r||null===(n=r.current)||void 0===n?void 0:n.contains(e.target))||t(e)};return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}}),[t,n]),r}function Jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Yn,Kn,Zn=function(t){var n=t.privilege,r=t.fallback,o=t.children,i=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(null),2),a=i[0],u=i[1];return(0,e.useEffect)((function(){var e=(0,_n.getCurrentUser)({includeAuthStatus:!1}).subscribe(u);return function(){return e.unsubscribe()}}),[]),a&&(0,_n.userHasAccess)(n,a)?e.default.createElement(e.default.Fragment,null,o):r?e.default.createElement(e.default.Fragment,null,r):null};function Qn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xn(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(null),2),n=t[0],r=t[1],o=null;if(!n){if(Yn){var i=(0,_n.getSessionStore)().getState();i.loaded&&(o=i.session)}else Yn=new Promise((function(e){var t=function(t){var n=t.loaded,r=t.session;n&&(e(r),o=r,Kn&&Kn(),Kn=void 0)};t((0,_n.getSessionStore)().getState()),o||(Kn=(0,_n.getSessionStore)().subscribe(t))}));if(!o)throw Yn;r(o)}(0,e.useEffect)((function(){return Kn||(Kn=(0,_n.getSessionStore)().subscribe((function(e){var t=e.loaded,n=e.session;t&&(o=n,r(n))}))),function(){Kn&&Kn(),Kn=void 0}}),[]);var a=n||o;if(!a)throw Yn?(console.warn("useSession is in an unexpected state. Attempting to recover."),Yn):Error("useSession is in an invalid state.");return a}var er=s(374);const tr=new WeakMap,nr={},rr=()=>{},or=rr(),ir=Object,ar=e=>e===or,ur=e=>"function"==typeof e,cr=(e,t)=>({...e,...t}),lr="undefined",sr=typeof window!=lr,fr=typeof document!=lr,dr=(e,t)=>{const n=tr.get(e);return[()=>e.get(t)||nr,r=>{const o=e.get(t);n[5](t,cr(o,r),o||nr)},n[6]]},pr=new WeakMap;let yr=0;const mr=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let o,i;if(ir(e)!==e||r||n==RegExp)o=r?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=pr.get(e),o)return o;if(o=++yr+"~",pr.set(e,o),n==Array){for(o="@",i=0;i<e.length;i++)o+=mr(e[i])+",";pr.set(e,o)}if(n==ir){o="#";const t=ir.keys(e).sort();for(;!ar(i=t.pop());)ar(e[i])||(o+=i+":"+mr(e[i])+",");pr.set(e,o)}}return o};let br=!0;const[vr,gr]=sr&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[rr,rr],hr={isOnline:()=>br,isVisible:()=>{const e=fr&&document.visibilityState;return ar(e)||"hidden"!==e}},Sr={initFocus:e=>(fr&&document.addEventListener("visibilitychange",e),vr("focus",e),()=>{fr&&document.removeEventListener("visibilitychange",e),gr("focus",e)}),initReconnect:e=>{const t=()=>{br=!0,e()},n=()=>{br=!1};return vr("online",t),vr("offline",n),()=>{gr("online",t),gr("offline",n)}}},wr=!e.default.useId,Or=!sr||"Deno"in window,jr=Or?e.useEffect:e.useLayoutEffect,Er="undefined"!=typeof navigator&&navigator.connection,xr=!Or&&Er&&(["slow-2g","2g"].includes(Er.effectiveType)||Er.saveData),_r=e=>{if(ur(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?mr(e):"",t]};let Pr=0;const Ar=()=>++Pr;async function Cr(...e){const[t,n,r,o]=e,i=cr({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let a=i.populateCache;const u=i.rollbackOnError;let c=i.optimisticData;const l=!1!==i.revalidate,s=i.throwOnError;if(ur(n)){const e=n,r=[],o=t.keys();for(let n=o.next();!n.done;n=o.next()){const o=n.value;!o.startsWith("$inf$")&&e(t.get(o)._k)&&r.push(o)}return Promise.all(r.map(f))}return f(n);async function f(n){const[o]=_r(n);if(!o)return;const[i,f]=dr(t,o),[d,p,y]=tr.get(t),m=d[o],b=()=>l&&(delete y[o],m&&m[0])?m[0](2).then((()=>i().data)):i().data;if(e.length<3)return b();let v,g=r;const h=Ar();p[o]=[h,0];const S=!ar(c),w=i(),O=w.data,j=w._c,E=ar(j)?O:j;if(S&&(c=ur(c)?c(E):c,f({data:c,_c:E})),ur(g))try{g=g(E)}catch(e){v=e}if(g&&ur(g.then)){if(g=await g.catch((e=>{v=e})),h!==p[o][0]){if(v)throw v;return g}v&&S&&(e=>"function"==typeof u?u(e):!1!==u)(v)&&(a=!0,g=E,f({data:g,_c:or}))}a&&(v||(ur(a)&&(g=a(g,E)),f({data:g,_c:or}))),p[o][1]=Ar();const x=await b();if(f({_c:or}),!v)return a?x:g;if(s)throw v}}const Ir=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Rr=(e,t)=>{if(!tr.has(e)){const n=cr(Sr,t),r={},o=Cr.bind(or,e);let i=rr;const a={},u=(e,t)=>{const n=a[e]||[];return a[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},c=(t,n,r)=>{e.set(t,n);const o=a[t];if(o)for(let e=o.length;e--;)o[e](r,n)},l=()=>{if(!tr.has(e)&&(tr.set(e,[r,{},{},{},o,c,u]),!Or)){const t=n.initFocus(setTimeout.bind(or,Ir.bind(or,r,0))),o=n.initReconnect(setTimeout.bind(or,Ir.bind(or,r,1)));i=()=>{t&&t(),o&&o(),tr.delete(e)}}};return l(),[e,o,l,i]}return[e,tr.get(e)[4]]},[Mr,Tr]=Rr(new Map),kr=cr({onLoadingSlow:rr,onSuccess:rr,onError:rr,onErrorRetry:(e,t,n,r,o)=>{const i=n.errorRetryCount,a=o.retryCount,u=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!ar(i)&&a>i||setTimeout(r,u,o)},onDiscarded:rr,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:xr?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:xr?5e3:3e3,compare:(e,t)=>mr(e)==mr(t),isPaused:()=>!1,cache:Mr,mutate:Tr,fallback:{}},hr),Dr=(e,t)=>{const n=cr(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=cr(o,a))}return n},Ur=(0,e.createContext)({}),Nr=sr&&window.__SWR_DEVTOOLS_USE__,Lr=Nr?window.__SWR_DEVTOOLS_USE__:[],Fr=Lr.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const r=_r(t)[0],[,,,o]=tr.get(Mr),i=o[r];return i?(delete o[r],i):n(...e)}),r)));Nr&&(window.__SWR_DEVTOOLS_REACT__=e.default);const Vr={dedupe:!0};ir.defineProperty((t=>{const{value:n}=t,r=(0,e.useContext)(Ur),o=ur(n),i=(0,e.useMemo)((()=>o?n(r):n),[o,r,n]),a=(0,e.useMemo)((()=>o?i:Dr(r,i)),[o,r,i]),u=i&&i.provider,[c]=(0,e.useState)((()=>u?Rr(u(a.cache||Mr),i):or));return c&&(a.cache=c[0],a.mutate=c[1]),jr((()=>{if(c)return c[2]&&c[2](),c[3]}),[]),(0,e.createElement)(Ur.Provider,cr(t,{value:a}))}),"defaultValue",{value:kr});var Br,zr=(Br=(t,n,r)=>{const{cache:o,compare:i,suspense:a,fallbackData:u,revalidateOnMount:c,refreshInterval:l,refreshWhenHidden:s,refreshWhenOffline:f,keepPreviousData:d}=r,[p,y,m]=tr.get(o),[b,v]=_r(t),g=(0,e.useRef)(!1),h=(0,e.useRef)(!1),S=(0,e.useRef)(b),w=(0,e.useRef)(n),O=(0,e.useRef)(r),j=()=>O.current,E=()=>j().isVisible()&&j().isOnline(),[x,_,P]=dr(o,b),A=(0,e.useRef)({}).current,C=ar(u)?r.fallback[b]:u,I=(e,t)=>{let n=!0;for(const r in A){const o=r;i(t[o],e[o])||"data"===o&&ar(e[o])&&i(t[o],L)||(n=!1)}return n},R=(0,e.useMemo)((()=>{const e=!!b&&!!n&&(ar(c)?!j().isPaused()&&!a:c),t=()=>{const t=x(),n=cr(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n};let r=t();return()=>{const e=t();return I(e,r)?r:r=e}}),[o,b]),M=(0,er.useSyncExternalStore)((0,e.useCallback)((e=>P(b,((t,n)=>{I(t,n)||e()}))),[o,b]),R,R),T=!g.current,k=M.data,D=ar(k)?C:k,U=M.error,N=(0,e.useRef)(D),L=d?ar(k)?N.current:k:D,F=T&&!ar(c)?c:!j().isPaused()&&(a?!ar(D)&&r.revalidateIfStale:ar(D)||r.revalidateIfStale),V=!!(b&&n&&T&&F),B=ar(M.isValidating)?V:M.isValidating,z=ar(M.isLoading)?V:M.isLoading,$=(0,e.useCallback)((async e=>{const t=w.current;if(!b||!t||h.current||j().isPaused())return!1;let n,o,a=!0;const u=e||{},c=!m[b]||!u.dedupe,l=()=>wr?!h.current&&b===S.current&&g.current:b===S.current,s={isValidating:!1,isLoading:!1},f=()=>{_(s)},d=()=>{const e=m[b];e&&e[1]===o&&delete m[b]},p={isValidating:!0};ar(x().data)&&(p.isLoading=!0);try{if(c&&(_(p),r.loadingTimeout&&ar(x().data)&&setTimeout((()=>{a&&l()&&j().onLoadingSlow(b,r)}),r.loadingTimeout),m[b]=[t(v),Ar()]),[n,o]=m[b],n=await n,c&&setTimeout(d,r.dedupingInterval),!m[b]||m[b][1]!==o)return c&&l()&&j().onDiscarded(b),!1;s.error=or;const e=y[b];if(!ar(e)&&(o<=e[0]||o<=e[1]||0===e[1]))return f(),c&&l()&&j().onDiscarded(b),!1;const u=x().data;s.data=i(u,n)?u:n,c&&l()&&j().onSuccess(n,b,r)}catch(e){d();const t=j(),{shouldRetryOnError:n}=t;t.isPaused()||(s.error=e,c&&l()&&(t.onError(e,b,t),(!0===n||ur(n)&&n(e))&&E()&&t.onErrorRetry(e,b,t,$,{retryCount:(u.retryCount||0)+1,dedupe:!0})))}return a=!1,f(),!0}),[b,o]),G=(0,e.useCallback)(((...e)=>Cr(o,S.current,...e)),[]);if(jr((()=>{w.current=n,O.current=r,ar(k)||(N.current=k)})),jr((()=>{if(!b)return;const e=$.bind(or,Vr);let t=0;const n=((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())}})(b,p,(n=>{if(0==n){const n=Date.now();j().revalidateOnFocus&&n>t&&E()&&(t=n+j().focusThrottleInterval,e())}else if(1==n)j().revalidateOnReconnect&&E()&&e();else if(2==n)return $()}));return h.current=!1,S.current=b,g.current=!0,_({_k:v}),F&&(ar(D)||Or?e():(e=>{sr&&typeof window.requestAnimationFrame!=lr?window.requestAnimationFrame(e):setTimeout(e,1)})(e)),()=>{h.current=!0,n()}}),[b]),jr((()=>{let e;function t(){const t=ur(l)?l(D):l;t&&-1!==e&&(e=setTimeout(n,t))}function n(){x().error||!s&&!j().isVisible()||!f&&!j().isOnline()?t():$(Vr).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[l,s,f,b]),(0,e.useDebugValue)(L),a&&ar(D)&&b){if(!wr&&Or)throw new Error("Fallback data is required when using suspense in SSR.");throw w.current=n,O.current=r,h.current=!1,ar(U)?$(Vr):U}return{mutate:G,get data(){return A.data=!0,L},get error(){return A.error=!0,U},get isValidating(){return A.isValidating=!0,B},get isLoading(){return A.isLoading=!0,z}}},function(...t){const n=cr(kr,(0,e.useContext)(Ur)),[r,o,i]=(e=>ur(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}])(t),a=Dr(n,i);let u=Br;const{use:c}=a,l=(c||[]).concat(Fr);for(let e=l.length;e--;)u=l[e](u);return u(r,o||a.fetcher||null,a)}),$r=s(688),Gr=s(332),Wr=s.n(Gr);function qr(t){var n,r=Pt((0,_n.getVisitStore)()),o=r.patientUuid,i=r.manuallySetVisitUuid,a=t&&o==t?i:null,u="?patient=".concat(t,"&v=").concat(_n.defaultVisitCustomRepresentation,"&includeInactive=false"),c="/".concat(a),l=zr(t?"/ws/rest/v1/visit".concat(u):null,_n.openmrsFetch),s=l.data,f=l.error,d=l.mutate,p=l.isValidating,y=zr(t&&a?"/ws/rest/v1/visit".concat(c):null,_n.openmrsFetch),m=y.data,b=y.error,v=y.mutate,g=y.isValidating,h=(0,e.useMemo)((function(){return null!==(n=null==s?void 0:s.data.results.find((function(e){return null===e.stopDatetime})))&&void 0!==n?n:null}),[s]),S=(0,e.useMemo)((function(){return a?null==m?void 0:m.data:null!=h?h:null}),[m,h,a]);return{error:f||b,mutate:function(){d(),v()},isValidating:p||g,activeVisit:h,currentVisit:S,currentVisitIsRetrospective:Boolean(a),isLoading:Boolean((!s||a&&!m)&&(!f||!b))}}function Hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jr(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Hr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)([]),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){var e=(0,_n.getVisitTypes)().subscribe((function(e){r(e)}),(function(e){return console.error(e)}));return function(){return e.unsubscribe()}}),[]),n}function Yr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}$r.default.extend(Wr());var Kr=10;function Zr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kr,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(1),2),o=r[0],i=r[1],a=(0,e.useMemo)((function(){return"number"==typeof n&&n>0?Math.max(1,Math.ceil(t.length/n)):1}),[t.length,n]),u=(0,e.useMemo)((function(){var e=(o-1)*n,r=(o+0)*n;return t.slice(e,r)}),[t,o,n]),c=(0,e.useCallback)((function(e){i(Math.max(1,Math.min(a,e)))}),[i,a]),l=(0,e.useCallback)((function(){o<a&&i(o+1)}),[o,a,i]),s=(0,e.useCallback)((function(){o>1&&i(o-1)}),[o,i]);return(0,e.useMemo)((function(){return{results:u,totalPages:a,currentPage:o,paginated:t.length>n,showNextButton:o<a,showPreviousButton:o>1,goTo:c,goToNext:l,goToPrevious:s}}),[u,a,t.length,n,o,c,l,s])}})(),f})())}}}));
|
|
1
|
+
System.register(["react","@openmrs/esm-config","@openmrs/esm-extensions","@openmrs/esm-globals","react-dom","react-i18next","@openmrs/esm-api","swr","dayjs"],(function(t,e){var n={},r={},o={},i={},u={},a={},c={},l={},s={};return Object.defineProperty(u,"__esModule",{value:!0}),{setters:[function(t){n.Suspense=t.Suspense,n.default=t.default,n.useCallback=t.useCallback,n.useContext=t.useContext,n.useEffect=t.useEffect,n.useMemo=t.useMemo,n.useReducer=t.useReducer,n.useRef=t.useRef,n.useState=t.useState},function(t){r.getConfigStore=t.getConfigStore,r.getExtensionConfigFromStore=t.getExtensionConfigFromStore,r.getExtensionsConfigStore=t.getExtensionsConfigStore,r.interpolateUrl=t.interpolateUrl,r.navigate=t.navigate},function(t){o.getConnectedExtensions=t.getConnectedExtensions,o.getExtensionInternalStore=t.getExtensionInternalStore,o.getExtensionStore=t.getExtensionStore,o.registerExtensionSlot=t.registerExtensionSlot,o.renderExtension=t.renderExtension},function(t){i.subscribeConnectivityChanged=t.subscribeConnectivityChanged},function(t){Object.keys(t).forEach((function(e){u[e]=t[e]}))},function(t){a.I18nextProvider=t.I18nextProvider},function(t){c.defaultVisitCustomRepresentation=t.defaultVisitCustomRepresentation,c.fetchCurrentPatient=t.fetchCurrentPatient,c.getCurrentUser=t.getCurrentUser,c.getLocations=t.getLocations,c.getSessionStore=t.getSessionStore,c.getVisitStore=t.getVisitStore,c.getVisitTypes=t.getVisitTypes,c.openmrsFetch=t.openmrsFetch,c.userHasAccess=t.userHasAccess},function(t){l.default=t.default},function(t){s.default=t.default}],execute:function(){t((()=>{var t={332:function(t){t.exports=function(){"use strict";return function(t,e,n){e.prototype.isToday=function(){var t="YYYY-MM-DD",e=n();return this.format(t)===e.format(t)}}}()},645:(t,e,n)=>{"use strict";var r=n(493);e.createRoot=r.createRoot,e.hydrateRoot=r.hydrateRoot},570:()=>{System.register(["@openmrs/esm-state"],(function(t,e){var n={};return{setters:[function(t){n.getGlobalStore=t.getGlobalStore}],execute:function(){t(function(){"use strict";var t={685:function(t){t.exports=n}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){var t=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},e=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},n=function(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),o.forEach((function(n){e(t,n,r[n])}))}return t},i=function(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n}(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},u=function(t,r,o){var u;p.setState((function(a){var c;return{flags:i(n({},a.flags),e({},t,{enabled:null!==(u=null===(c=a.flags[t])||void 0===c?void 0:c.enabled)&&void 0!==u&&u,label:r,description:o}))}}))},a=function(t){return p.getState().flags[t].enabled},c=function(t,e){p.subscribe((function(n){e(n.flags[t].enabled)}))},l=function(t,r){p.setState((function(o){return{flags:i(n({},o.flags),e({},t,i(n({},o.flags[t]),{enabled:r})))}}))};r.r(o),r.d(o,{featureFlagsStore:function(){return p},getFeatureFlag:function(){return a},registerFeatureFlag:function(){return u},setFeatureFlag:function(){return l},subscribeToFeatureFlag:function(){return c}});var s=r(685),f={flags:function(){var t={},e=!0,r=!1,o=void 0;try{for(var i,u=Object.keys(localStorage)[Symbol.iterator]();!(e=(i=u.next()).done);e=!0){var a=i.value;if(a.startsWith("openmrs:feature-flag:")){var c=a.replace("openmrs:feature-flag:",""),l=JSON.parse(localStorage.getItem("openmrs:feature-flag-meta:".concat(c))||"{}");t[c]=n({enabled:"true"===localStorage.getItem(a)},l)}}}catch(t){r=!0,o=t}finally{try{e||null==u.return||u.return()}finally{if(r)throw o}}return t}()},p=(0,s.getGlobalStore)("feature-flags",f);p.subscribe((function(e){var n,r=!0,o=!1,i=void 0;try{for(var u,a=Object.entries(e.flags)[Symbol.iterator]();!(r=(u=a.next()).done);r=!0){var c=function(t){if(Array.isArray(t))return t}(n=u.value)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),2!==i.length);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(n)||function(e,n){if(e){if("string"==typeof e)return t(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,2):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=c[0],s=c[1];localStorage.setItem("openmrs:feature-flag:".concat(l),s.enabled.toString()),localStorage.setItem("openmrs:feature-flag-meta:".concat(l),JSON.stringify({label:s.label,description:s.description}))}}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}}))}(),o}())}}}))},385:()=>{System.register([],(function(t,e){return{execute:function(){t(function(){"use strict";var t=function(t,e){var n=a[t];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(e,!0),n.active=!0,n.value;var r=u()((function(){return e}));return a[t]={value:r,active:!0},r},e=function(t,e){var n=a[t];if(!n){var r=u()((function(){return null!=e?e:{}}));return a[t]={value:r,active:!1},r}return n.value},n=function(t,e,n){var r=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==r&&(r=o,n(o))}))},r={d:function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};r.r(o),r.d(o,{createGlobalStore:function(){return t},getGlobalStore:function(){return e},subscribeTo:function(){return n}});var i=function(t){var e,n=new Set,r=function(t,r){var o="function"==typeof t?t(e):t;if(!Object.is(o,e)){var i=e;e=(null!=r?r:"object"!=typeof o)?o:Object.assign({},e,o),n.forEach((function(t){return t(e,i)}))}},o=function(){return e},i={setState:r,getState:o,subscribe:function(t){return n.add(t),function(){return n.delete(t)}},destroy:function(){console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(r,o,i),i},u=function(t){return t?i(t):i},a={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=a)}),1e3),o}())}}}))},766:t=>{"use strict";t.exports=c},824:t=>{"use strict";t.exports=r},45:t=>{"use strict";t.exports=o},728:t=>{"use strict";t.exports=i},688:t=>{"use strict";t.exports=s},954:t=>{"use strict";t.exports=n},493:t=>{"use strict";t.exports=u},281:t=>{"use strict";t.exports=a},725:t=>{"use strict";t.exports=l}},e={};function f(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,f),o.exports}f.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return f.d(e,{a:e}),e},f.d=(t,e)=>{for(var n in e)f.o(e,n)&&!f.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},f.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),f.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var p={};return(()=>{"use strict";f.r(p),f.d(p,{ComponentContext:()=>e,ConfigurableLink:()=>o,Extension:()=>l,ExtensionSlot:()=>De,UserHasAccess:()=>Jn,createUseStore:()=>_e,getAsyncExtensionLifecycle:()=>pn,getAsyncLifecycle:()=>sn,getLifecycle:()=>ln,getSyncLifecycle:()=>fn,isDesktop:()=>$n,openmrsComponentDecorator:()=>cn,useAssignedExtensionIds:()=>yn,useAssignedExtensions:()=>ve,useBodyScrollLock:()=>mn,useConfig:()=>jn,useConnectedExtensions:()=>Re,useConnectivity:()=>y,useDebounce:()=>sr,useExtensionInternalStore:()=>Un,useExtensionSlot:()=>Te,useExtensionSlotMeta:()=>kn,useExtensionStore:()=>Nn,useFeatureFlag:()=>Dn,useForceUpdate:()=>Ln,useLayoutType:()=>Vn,useLocations:()=>Wn,useOnClickOutside:()=>Hn,usePagination:()=>cr,usePatient:()=>Tn,useSession:()=>Qn,useStore:()=>Pe,useStoreWithActions:()=>Ae,useVisit:()=>rr,useVisitTypes:()=>ir});var t=f(954),e=t.default.createContext({moduleName:""}),n=f(824);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(e){var o=e.to,i=e.templateParams,u=e.children,a=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(e,["to","templateParams","children"]);return t.default.createElement("a",function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),o.forEach((function(e){r(t,e,n[e])}))}return t}({onClick:function(t){return function(t,e,r){t.metaKey||t.ctrlKey||t.shiftKey||0!=t.button||(t.preventDefault(),(0,n.navigate)({to:e,templateParams:r}))}(t,o,i)},href:(0,n.interpolateUrl)(o,i)},a),u)}var i=f(45);function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){a(t,e,n[e])}))}return t}var l=function(n){var r=n.state,o=n.children,a=n.wrap,l=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(n,["state","children","wrap"]),s=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(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.")}()}((0,t.useState)(),2),f=s[0],p=s[1],d=(0,t.useContext)(e).extension,y=(0,t.useRef)(null),m=(0,t.useRef)(Promise.resolve()),b=(0,t.useRef)(!1);(0,t.useEffect)((function(){a&&console.warn("'wrap' prop of Extension is being used ".concat((null==d?void 0:d.extensionId)?"by ".concat(d.extensionId," in ").concat(d.extensionSlotName):"",". This will be removed in a future release."))}),[]);var v=(0,t.useCallback)((function(t){p(t)}),[p]);(0,t.useEffect)((function(){if(null!=f&&(null==d?void 0:d.extensionSlotName)&&d.extensionSlotModuleName&&d.extensionSlotModuleName&&!y.current&&!b.current)return b.current=!0,(0,i.renderExtension)(f,d.extensionSlotName,d.extensionSlotModuleName,d.extensionId,void 0,r).then((function(t){y.current=t,b.current=!1})),function(){if(y&&y.current)switch(y.current.getStatus()){case"MOUNTING":y.current.mountPromise.then((function(){var t;"MOUNTED"===(null===(t=y.current)||void 0===t?void 0:t.getStatus())&&y.current.unmount()}));break;case"MOUNTED":y.current.unmount();break;case"UPDATING":m.current&&m.current.then((function(){var t;"MOUNTED"===(null===(t=y.current)||void 0===t?void 0:t.getStatus())&&y.current.unmount()}))}}}),[null==d?void 0:d.extensionSlotName,null==d?void 0:d.extensionId,null==d?void 0:d.extensionSlotModuleName,f]),(0,t.useEffect)((function(){y.current&&y.current.update&&"UNMOUNTING"!==y.current.getStatus()&&Promise.all([y.current.mountPromise,m.current]).then((function(){var t;"MOUNTED"===(null==y||null===(t=y.current)||void 0===t?void 0:t.getStatus())&&y.current.update&&(m.current=y.current.update(c({},r)).catch((function(t){var e,n,r;if(n=t,!(null!=(r=Error)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)||!t.message.includes("minified message #32")||"MOUNTED"===(null===(e=y.current)||void 0===e?void 0:e.getStatus()))throw t})))}))}),[r]);var g=t.default.createElement("div",c({ref:v,"data-extension-id":null==d?void 0:d.extensionId,style:{position:"relative"}},l));return"function"!=typeof o||t.default.isValidElement(o)?d&&a?a(g,d):g:t.default.createElement(t.default.Fragment,null,o(g,d))},s=f(728);function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function y(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(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.")}()}((0,t.useState)(window.navigator.onLine),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){return(0,s.subscribeConnectivityChanged)((function(t){var e=t.online;return r(e)}))}),[]),n}const m=function(t,e){return t===e||t!=t&&e!=e},b=function(t,e){for(var n=t.length;n--;)if(m(t[n][0],e))return n;return-1};var v=Array.prototype.splice;function g(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}g.prototype.clear=function(){this.__data__=[],this.size=0},g.prototype.delete=function(t){var e=this.__data__,n=b(e,t);return!(n<0||(n==e.length-1?e.pop():v.call(e,n,1),--this.size,0))},g.prototype.get=function(t){var e=this.__data__,n=b(e,t);return n<0?void 0:e[n][1]},g.prototype.has=function(t){return b(this.__data__,t)>-1},g.prototype.set=function(t,e){var n=this.__data__,r=b(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};const h=g,S="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const w=S||O||Function("return this")(),j=w.Symbol;var E=Object.prototype,x=E.hasOwnProperty,P=E.toString,A=j?j.toStringTag:void 0;var _=Object.prototype.toString;var C=j?j.toStringTag:void 0;const I=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":C&&C in Object(t)?function(t){var e=x.call(t,A),n=t[A];try{t[A]=void 0;var r=!0}catch(t){}var o=P.call(t);return r&&(e?t[A]=n:delete t[A]),o}(t):function(t){return _.call(t)}(t)},M=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},R=function(t){if(!M(t))return!1;var e=I(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},T=w["__core-js_shared__"];var U,k=(U=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"";var N=Function.prototype.toString;const D=function(t){if(null!=t){try{return N.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var F=/^\[object .+?Constructor\]$/,L=Function.prototype,B=Object.prototype,z=L.toString,V=B.hasOwnProperty,$=RegExp("^"+z.call(V).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const G=function(t){return!(!M(t)||(e=t,k&&k in e))&&(R(t)?$:F).test(D(t));var e},W=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return G(n)?n:void 0},H=W(w,"Map"),q=W(Object,"create");var Y=Object.prototype.hasOwnProperty;var K=Object.prototype.hasOwnProperty;function J(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}J.prototype.clear=function(){this.__data__=q?q(null):{},this.size=0},J.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},J.prototype.get=function(t){var e=this.__data__;if(q){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Y.call(e,t)?e[t]:void 0},J.prototype.has=function(t){var e=this.__data__;return q?void 0!==e[t]:K.call(e,t)},J.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=q&&void 0===e?"__lodash_hash_undefined__":e,this};const Z=J,Q=function(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map};function X(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}X.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(H||h),string:new Z}},X.prototype.delete=function(t){var e=Q(this,t).delete(t);return this.size-=e?1:0,e},X.prototype.get=function(t){return Q(this,t).get(t)},X.prototype.has=function(t){return Q(this,t).has(t)},X.prototype.set=function(t,e){var n=Q(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};const tt=X;function et(t){var e=this.__data__=new h(t);this.size=e.size}et.prototype.clear=function(){this.__data__=new h,this.size=0},et.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},et.prototype.get=function(t){return this.__data__.get(t)},et.prototype.has=function(t){return this.__data__.has(t)},et.prototype.set=function(t,e){var n=this.__data__;if(n instanceof h){var r=n.__data__;if(!H||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new tt(r)}return n.set(t,e),this.size=n.size,this};const nt=et;function rt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new tt;++e<n;)this.add(t[e])}rt.prototype.add=rt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},rt.prototype.has=function(t){return this.__data__.has(t)};const ot=rt,it=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1},ut=function(t,e,n,r,o,i){var u=1&n,a=t.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var l=i.get(t),s=i.get(e);if(l&&s)return l==e&&s==t;var f=-1,p=!0,d=2&n?new ot:void 0;for(i.set(t,e),i.set(e,t);++f<a;){var y=t[f],m=e[f];if(r)var b=u?r(m,y,f,e,t,i):r(y,m,f,t,e,i);if(void 0!==b){if(b)continue;p=!1;break}if(d){if(!it(e,(function(t,e){if(u=e,!d.has(u)&&(y===t||o(y,t,n,r,i)))return d.push(e);var u}))){p=!1;break}}else if(y!==m&&!o(y,m,n,r,i)){p=!1;break}}return i.delete(t),i.delete(e),p},at=w.Uint8Array,ct=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},lt=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n};var st=j?j.prototype:void 0,ft=st?st.valueOf:void 0;const pt=Array.isArray;var dt=Object.prototype.propertyIsEnumerable,yt=Object.getOwnPropertySymbols;const mt=yt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var u=t[n];e(u,n,t)&&(i[o++]=u)}return i}(yt(t),(function(e){return dt.call(t,e)})))}:function(){return[]},bt=function(t){return null!=t&&"object"==typeof t},vt=function(t){return bt(t)&&"[object Arguments]"==I(t)};var gt=Object.prototype,ht=gt.hasOwnProperty,St=gt.propertyIsEnumerable,Ot=vt(function(){return arguments}())?vt:function(t){return bt(t)&&ht.call(t,"callee")&&!St.call(t,"callee")};const wt=Ot;var jt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Et=jt&&"object"==typeof module&&module&&!module.nodeType&&module,xt=Et&&Et.exports===jt?w.Buffer:void 0;const Pt=(xt?xt.isBuffer:void 0)||function(){return!1};var At=/^(?:0|[1-9]\d*)$/;const _t=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&At.test(t))&&t>-1&&t%1==0&&t<e},Ct=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var It={};It["[object Float32Array]"]=It["[object Float64Array]"]=It["[object Int8Array]"]=It["[object Int16Array]"]=It["[object Int32Array]"]=It["[object Uint8Array]"]=It["[object Uint8ClampedArray]"]=It["[object Uint16Array]"]=It["[object Uint32Array]"]=!0,It["[object Arguments]"]=It["[object Array]"]=It["[object ArrayBuffer]"]=It["[object Boolean]"]=It["[object DataView]"]=It["[object Date]"]=It["[object Error]"]=It["[object Function]"]=It["[object Map]"]=It["[object Number]"]=It["[object Object]"]=It["[object RegExp]"]=It["[object Set]"]=It["[object String]"]=It["[object WeakMap]"]=!1;var Mt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Rt=Mt&&"object"==typeof module&&module&&!module.nodeType&&module,Tt=Rt&&Rt.exports===Mt&&S.process,Ut=function(){try{return Rt&&Rt.require&&Rt.require("util").types||Tt&&Tt.binding&&Tt.binding("util")}catch(t){}}(),kt=Ut&&Ut.isTypedArray;const Nt=kt?(Dt=kt,function(t){return Dt(t)}):function(t){return bt(t)&&Ct(t.length)&&!!It[I(t)]};var Dt,Ft=Object.prototype.hasOwnProperty;const Lt=function(t,e){var n=pt(t),r=!n&&wt(t),o=!n&&!r&&Pt(t),i=!n&&!r&&!o&&Nt(t),u=n||r||o||i,a=u?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var l in t)!e&&!Ft.call(t,l)||u&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||_t(l,c))||a.push(l);return a};var Bt=Object.prototype;const zt=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object);var Vt=Object.prototype.hasOwnProperty;const $t=function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||Bt))return zt(t);var e,n,r=[];for(var o in Object(t))Vt.call(t,o)&&"constructor"!=o&&r.push(o);return r},Gt=function(t){return null!=(e=t)&&Ct(e.length)&&!R(e)?Lt(t):$t(t);var e},Wt=function(t){return function(t,e,n){var r=e(t);return pt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,Gt,mt)};var Ht=Object.prototype.hasOwnProperty;const qt=W(w,"DataView"),Yt=W(w,"Promise"),Kt=W(w,"Set"),Jt=W(w,"WeakMap");var Zt="[object Map]",Qt="[object Promise]",Xt="[object Set]",te="[object WeakMap]",ee="[object DataView]",ne=D(qt),re=D(H),oe=D(Yt),ie=D(Kt),ue=D(Jt),ae=I;(qt&&ae(new qt(new ArrayBuffer(1)))!=ee||H&&ae(new H)!=Zt||Yt&&ae(Yt.resolve())!=Qt||Kt&&ae(new Kt)!=Xt||Jt&&ae(new Jt)!=te)&&(ae=function(t){var e=I(t),n="[object Object]"==e?t.constructor:void 0,r=n?D(n):"";if(r)switch(r){case ne:return ee;case re:return Zt;case oe:return Qt;case ie:return Xt;case ue:return te}return e});const ce=ae;var le="[object Arguments]",se="[object Array]",fe="[object Object]",pe=Object.prototype.hasOwnProperty;const de=function(t,e,n,r,o,i){var u=pt(t),a=pt(e),c=u?se:ce(t),l=a?se:ce(e),s=(c=c==le?fe:c)==fe,f=(l=l==le?fe:l)==fe,p=c==l;if(p&&Pt(t)){if(!Pt(e))return!1;u=!0,s=!1}if(p&&!s)return i||(i=new nt),u||Nt(t)?ut(t,e,n,r,o,i):function(t,e,n,r,o,i,u){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new at(t),new at(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return m(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=ct;case"[object Set]":var c=1&r;if(a||(a=lt),t.size!=e.size&&!c)return!1;var l=u.get(t);if(l)return l==e;r|=2,u.set(t,e);var s=ut(a(t),a(e),r,o,i,u);return u.delete(t),s;case"[object Symbol]":if(ft)return ft.call(t)==ft.call(e)}return!1}(t,e,c,n,r,o,i);if(!(1&n)){var d=s&&pe.call(t,"__wrapped__"),y=f&&pe.call(e,"__wrapped__");if(d||y){var b=d?t.value():t,v=y?e.value():e;return i||(i=new nt),o(b,v,n,r,i)}}return!!p&&(i||(i=new nt),function(t,e,n,r,o,i){var u=1&n,a=Wt(t),c=a.length;if(c!=Wt(e).length&&!u)return!1;for(var l=c;l--;){var s=a[l];if(!(u?s in e:Ht.call(e,s)))return!1}var f=i.get(t),p=i.get(e);if(f&&p)return f==e&&p==t;var d=!0;i.set(t,e),i.set(e,t);for(var y=u;++l<c;){var m=t[s=a[l]],b=e[s];if(r)var v=u?r(b,m,s,e,t,i):r(m,b,s,t,e,i);if(!(void 0===v?m===b||o(m,b,n,r,i):v)){d=!1;break}y||(y="constructor"==s)}if(d&&!y){var g=t.constructor,h=e.constructor;g==h||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof h&&h instanceof h||(d=!1)}return i.delete(t),i.delete(e),d}(t,e,n,r,o,i))},ye=function t(e,n,r,o,i){return e===n||(null==e||null==n||!bt(e)&&!bt(n)?e!=e&&n!=n:de(e,n,r,o,t,i))},me=function(t,e){return ye(t,e)};function be(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ve(e){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return be(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?be(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.")}()}((0,t.useState)([]),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){var t=function(t){var n,i,u=null!==(i=null===(n=t.slots[e])||void 0===n?void 0:n.assignedExtensions)&&void 0!==i?i:[];me(u,r)||o(u)};return t((0,i.getExtensionStore)().getState()),(0,i.getExtensionStore)().subscribe(t)}),[e,r]),r}var ge=f(385);function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Se(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Oe(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Se(t,e,n[e])}))}return t}function we(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||je(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.")}()}function je(t,e){if(t){if("string"==typeof t)return he(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?he(t,e):void 0}}function Ee(t,e){var n=function(n){r[n]=function(){var r=arguments;t.setState((function(t){for(var o,i=[t],u=0;u<r.length;u++)i.push(r[u]);return(o=e)[n].apply(o,function(t){if(Array.isArray(t))return he(t)}(a=i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||je(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var a}))}};"function"==typeof e&&(e=e(t));var r={};for(var o in e)n(o);return r}var xe=function(t){return t};function Pe(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xe,r=arguments.length>2?arguments[2]:void 0,o=we((0,t.useState)((function(){return n(e.getState())})),2),i=o[0],u=o[1];return(0,t.useEffect)((function(){return(0,ge.subscribeTo)(e,n,u)}),[e,n]),Oe({},i,(0,t.useMemo)((function(){return r?Ee(e,r):{}}),[e,r]))}function Ae(t,e){return Pe(t,xe,e)}function _e(e){return function(n){var r=we((0,t.useState)(e.getState()),2),o=r[0],i=r[1];return(0,t.useEffect)((function(){return e.subscribe((function(t){return i(t)}))}),[]),Oe({},o,(0,t.useMemo)((function(){return n?Ee(e,n):{}}),[n]))}}var Ce=f(570);function Ie(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Me(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ie(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(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.")}()}function Re(e){var n=y(),r=ve(e),o=Pe(Ce.featureFlagsStore),u=(0,t.useMemo)((function(){return Object.entries(o.flags).filter((function(t){return Me(t,2)[1].enabled})).map((function(t){return Me(t,1)[0]}))}),[o.flags]);return(0,t.useMemo)((function(){return(0,i.getConnectedExtensions)(r,n,u)}),[r,n,u])}function Te(n){var r=(0,t.useContext)(e).moduleName;if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,t.useEffect)((function(){(0,i.registerExtensionSlot)(r,n)}),[]),{extensions:Re(n),extensionSlotName:n,extensionSlotModuleName:r}}function Ue(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ke(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Ue(t,e,n[e])}))}return t}function Ne(t){return t}function De(n){var r=n.name,o=n.extensionSlotName,i=n.select,u=void 0===i?Ne:i,a=n.children,c=n.state,s=n.style,f=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(n,["name","extensionSlotName","select","children","state","style"]);if(a&&c)throw new Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");var p,d,y,m,b=null!=r?r:o,v=(0,t.useRef)(null),g=Te(b),h=g.extensions,S=g.extensionSlotModuleName,O=(0,t.useMemo)((function(){return u(h)}),[u,h]),w=(0,t.useMemo)((function(){if("function"==typeof a&&!t.default.isValidElement(a))return O.map((function(t){return a(t)}))}),[a,O]);return t.default.createElement("div",ke({ref:v,"data-extension-slot-name":b,"data-extension-slot-module-name":S,style:(y=ke({},s),m={position:"relative"},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(m)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n}(Object(m)).forEach((function(t){Object.defineProperty(y,t,Object.getOwnPropertyDescriptor(m,t))})),y)},f),b&&O.map((function(n,r){return t.default.createElement(e.Provider,{key:n.id,value:{moduleName:S,extension:{extensionId:n.id,extensionSlotName:b,extensionSlotModuleName:S}}},null!==(d=null!==(p=null==w?void 0:w[r])&&void 0!==p?p:"function"!=typeof a?a:null)&&void 0!==d?d:t.default.createElement(l,{state:c}))})))}var Fe=f(645);function Le(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Be(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Le(Object(n),!0).forEach((function(e){Ve(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function ze(t){return(ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ve(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $e(t){return($e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ge(t,e){var n;if("function"!=typeof(n=e.domElement?function(){return e.domElement}:e.domElementGetter?e.domElementGetter:t.domElementGetter?t.domElementGetter:function(t){var e=t.appName||t.name;if(!e)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var n="single-spa-application:".concat(e);return function(){var t=document.getElementById(n);return t||((t=document.createElement("div")).id=n,document.body.appendChild(t)),t}}(e)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(e.name,"'. Expected a function, received ").concat($e(n)));return function(){var t=n(e);if(!(t instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(e.name,"'. Expected HTMLElement, received ").concat($e(t)));return t}}var We=null;try{We=require("react").createContext()}catch(Le){}var He={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,renderType:"createRoot",errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function qe(t){if("object"!==ze(t))throw new Error("single-spa-react requires a configuration object");var e=Be(Be({},He),t);if(!e.React)throw new Error("single-spa-react must be passed opts.React");if(!e.ReactDOM&&!e.ReactDOMClient)throw new Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(!e.rootComponent&&!e.loadRootComponent)throw new Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(e.errorBoundary&&"function"!=typeof e.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!We&&e.React.createContext&&(We=e.React.createContext()),e.SingleSpaRoot=function(t){function e(t){e.displayName="SingleSpaRoot(".concat(t.name,")")}return e.prototype=Object.create(t.React.Component.prototype),e.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},e.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},e.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},e}(e);var n={bootstrap:Ye.bind(null,e),mount:Ke.bind(null,e),unmount:Je.bind(null,e)};return e.parcelCanUpdate&&(n.update=Ze.bind(null,e)),n}function Ye(t,e){return t.rootComponent?Promise.resolve():t.loadRootComponent(e).then((function(e){t.rootComponent=e}))}function Ke(t,e){return new Promise((function(n,r){t.suppressComponentDidCatchWarning||!function(t){if(!(t&&"string"==typeof t.version&&t.version.indexOf(".")>=0))return!1;var e=t.version.slice(0,t.version.indexOf("."));try{return Number(e)>=16}catch(t){return!1}}(t.React)||t.errorBoundary||t.errorBoundaryClass||(t.rootComponent.prototype?t.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(e.name||e.appName||e.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(e.name||e.appName||e.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var o=tn(t,e,(function(){n(this)})),i=Ge(t,e)(),u=function(t){var e=t.renderType,n=t.elementToRender,r=t.domElement,o=t.reactDom[e];if("function"!=typeof o)throw new Error('renderType "'.concat(e,'" did not return a function.'));switch(e){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(r);return i.render(n),i;case"hydrateRoot":return o(r,n);default:return o(n,r),null}}({elementToRender:o,domElement:i,reactDom:Qe(t),renderType:Xe(t)});t.domElements[e.name]=i,t.renderResults[e.name]=u}))}function Je(t,e){return new Promise((function(n){t.unmountResolves[e.name]=n;var r=t.renderResults[e.name];r&&r.unmount?r.unmount():Qe(t).unmountComponentAtNode(t.domElements[e.name]),delete t.domElements[e.name],delete t.renderResults[e.name]}))}function Ze(t,e){return new Promise((function(n){t.updateResolves[e.name]||(t.updateResolves[e.name]=[]),t.updateResolves[e.name].push(n);var r=tn(t,e,null),o=t.renderResults[e.name];if(o&&o.render)o.render(r);else{var i=Ge(t,e)();Qe(t).render(r,i)}}))}function Qe(t){return t.ReactDOMClient||t.ReactDOM}function Xe(t){return"function"==typeof t.renderType?t.renderType():t.renderType}function tn(t,e,n){var r=t.React.createElement(t.rootComponent,e),o=We?t.React.createElement(We.Provider,{value:e},r):r;return(t.errorBoundary||e.errorBoundary||t.errorBoundaryClass||e.errorBoundaryClass)&&(t.errorBoundaryClass=t.errorBoundaryClass||e.errorBoundaryClass||function(t,e){function n(e){t.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(e.name,")")}return n.prototype=Object.create(t.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(t.errorBoundary||e.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(t,e){this.setState({caughtError:t,caughtErrorInfo:e})},n}(t,e),o=t.React.createElement(t.errorBoundaryClass,e,o)),t.React.createElement(t.SingleSpaRoot,Be(Be({},e),{},{mountFinished:n,updateFinished:function(){t.updateResolves[e.name]&&(t.updateResolves[e.name].forEach((function(t){return t()})),delete t.updateResolves[e.name])},unmountFinished:function(){t.unmountResolves[e.name]&&(t.unmountResolves[e.name](),delete t.unmountResolves[e.name])}}),o)}var en=f(281);function nn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rn(t){return rn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},rn(t)}function on(t,e){return on=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},on(t,e)}function un(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=rn(t);if(e){var o=rn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(t,e){return!e||"object"!=((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e;var n}(this,n)}}var an={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1};function cn(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},an,n);return function(n){var o,i,u,a;return i=o=function(o){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&on(t,e)}(c,o);var i,u,a=un(c);function c(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=a.call(this,t)).state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:t._extensionContext}},e}return i=c,(u=[{key:"componentDidCatch",value:function(t,e){e&&e.componentStack&&(t.extra=Object.assign(t.extra||{},{componentStack:e.componentStack})),r.throwErrorsToConsole&&setTimeout((function(){throw t})),this.setState({caughtError:t,caughtErrorInfo:e})}},{key:"render",value:function(){if(this.state.caughtError)return t.default.createElement("div",null,"An error has occurred. Please try reloading the page.");var o=t.default.createElement(t.Suspense,{fallback:null},t.default.createElement(e.Provider,{value:this.state.config},r.disableTranslations?t.default.createElement(n,this.props):t.default.createElement(en.I18nextProvider,{i18n:window.i18next,defaultNS:r.moduleName},t.default.createElement(n,this.props))));return r.strictMode||!t.default.StrictMode?o:t.default.createElement(t.default.StrictMode,null,o)}}])&&nn(i.prototype,u),c}(t.default.Component),u="displayName",a="OpenmrsReactComponent(".concat(r.featureName,")"),u in i?Object.defineProperty(i,u,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[u]=a,o}}function ln(e,n){return qe({React:t.default,ReactDOMClient:Fe,rootComponent:cn(n)(e)})}function sn(t,e){return function(){return t().then((function(t){return ln(t.default,e)}))}}function fn(t,e){return function(){return Promise.resolve(ln(t,e))}}var pn=sn;function dn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function yn(e){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return dn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dn(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.")}()}((0,t.useState)([]),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){return(0,i.getExtensionStore)().subscribe((function(t){var n,i,u=null!==(i=null===(n=t.slots[e])||void 0===n?void 0:n.assignedExtensions.map((function(t){return t.id})))&&void 0!==i?i:[];me(u,r)||o(u)}))}),[]),r}function mn(e){(0,t.useEffect)((function(){if(e){var t=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=t}}}),[e])}function bn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function vn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){vn(t,e,n[e])}))}return t}function hn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return bn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bn(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 Sn={},On='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function wn(e){var r=(0,t.useMemo)(n.getExtensionsConfigStore,[]),o=function(e,r){var o=hn((0,t.useState)(function(t,e){return e?function(){var r=t.getState(),o=(0,n.getExtensionConfigFromStore)(r,e.extensionSlotName,e.extensionId);if(o.loaded&&o.config)return o.config}:null}(e,r)),2),i=o[0],u=o[1];return(0,t.useEffect)((function(){if(r)return e.subscribe((function(t){var e=(0,n.getExtensionConfigFromStore)(t,r.extensionSlotName,r.extensionId);e.loaded&&e.config&&!me(e.config,i)&&u(e.config)}))}),[e,r,i]),i}(r,e);if(!o&&e){var i="".concat(e.extensionSlotName,"-").concat(e.extensionId);throw!Sn[i]&&r&&(Sn[i]=function(t,e){return new Promise((function(r){var o=t.subscribe((function(t){var i=(0,n.getExtensionConfigFromStore)(t,e.extensionSlotName,e.extensionId);i.loaded&&i.config&&(r(i.config),o())}))}))}(r,e)),Sn[i]}return o||{}}function jn(r){var o,i=(0,t.useContext)(e),u=i.moduleName,a=i.extension,c=null!==(o=null==r?void 0:r.externalModuleName)&&void 0!==o?o:u;if(!c&&!a)throw Error(On);var l=function(e){var r=(0,t.useMemo)((function(){return(0,n.getConfigStore)(e)}),[e]),o=e,i=function(e){var n=hn((0,t.useState)(function(t){return function(){var e=t.getState();return e.loaded&&e.config?e.config:null}}(e)),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){return null==e?void 0:e.subscribe((function(t){t.loaded&&t.config&&o(t.config)}))}),[e]),r}(r);if(!i)throw Sn[o]||(Sn[o]=function(t){return new Promise((function(e){var n=t.subscribe((function(t){t.loaded&&t.config&&(e(t.config),n())}))}))}(r)),Sn[o];return i}(c),s=wn(a);return(0,t.useMemo)((function(){return(null==r?void 0:r.externalModuleName)&&c===r.externalModuleName?gn({},l):gn({},l,s)}),[c,null==r?void 0:r.externalModuleName,l,s])}var En,xn=f(766);function Pn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function An(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){An(t,e,n[e])}))}return t}function Cn(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n}(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t}!function(t){t.loadPatient="loadPatient",t.newPatient="newPatient",t.loadError="patientLoadError"}(En||(En={}));var In={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function Mn(){var t=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return t&&t[1]}function Rn(t,e){switch(e.type){case En.loadPatient:return Cn(_n({},t),{patientUuid:e.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case En.newPatient:return Cn(_n({},t),{patient:e.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case En.loadError:return Cn(_n({},t),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:e.err});default:return t}}function Tn(e){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Pn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pn(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.")}()}((0,t.useReducer)(Rn,Cn(_n({},In),{patientUuid:null!=e?e:null,isPendingUuid:!e,isLoadingPatient:!!e})),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){if(r.isPendingUuid){var t=Mn();o(t?{type:En.loadPatient,patientUuid:t}:{type:En.newPatient,patient:null})}var e=!0;return r.isLoadingPatient&&r.patientUuid&&(0,xn.fetchCurrentPatient)(r.patientUuid).then((function(t){return e&&o({patient:t,type:En.newPatient})}),(function(t){return e&&o({err:t,type:En.loadError})})),function(){e=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,t.useEffect)((function(){var t=function(t){var e=Mn();e!=r.patientUuid&&o({type:En.loadPatient,patientUuid:e})};return window.addEventListener("single-spa:routing-event",t),function(){return window.removeEventListener("single-spa:routing-event",t)}}),[r.patientUuid]),{isLoading:r.isPendingUuid||r.isLoadingPatient,patient:r.patient,patientUuid:null!=e?e:r.patientUuid,error:r.err}}var Un=_e((0,i.getExtensionInternalStore)());function kn(e){var n=Re(e);return(0,t.useMemo)((function(){return Object.fromEntries(n.map((function(t){return[t.name,t.meta]})))}),[n])}var Nn=_e((0,i.getExtensionStore)());function Dn(e){var n,r=Pe(Ce.featureFlagsStore).flags;return(0,t.useEffect)((function(){r[e]||console.error('useFeatureFlag: Attempted to get value of non-existent flag "'.concat(e,'". Did you forget to call registerFeatureFlag?'))}),[r[e]]),null===(n=r[e])||void 0===n?void 0:n.enabled}function Fn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ln(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Fn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(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.")}()}((0,t.useState)(0),2)[1];return(0,t.useCallback)((function(){e((function(t){return t+1}))}),[])}function Bn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function zn(){var t="tablet";return document.body.classList.forEach((function(e){switch(e){case"omrs-breakpoint-lt-tablet":t="phone";break;case"omrs-breakpoint-gt-small-desktop":t="large-desktop";break;case"omrs-breakpoint-gt-tablet":t="small-desktop"}})),t}function Vn(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Bn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(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.")}()}((0,t.useState)(zn),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){var t=function(){r(zn())};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[]),n}var $n=function(t){return"small-desktop"===t||"large-desktop"===t};function Gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Wn(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Gn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gn(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.")}()}((0,t.useState)([]),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){var t=(0,xn.getLocations)().subscribe((function(t){r(t)}),(function(t){console.error(t)}));return function(){return t.unsubscribe()}}),[]),n}function Hn(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,t.useRef)(null);return(0,t.useEffect)((function(){if(n){var t=function(t){var n;(null==r||null===(n=r.current)||void 0===n?void 0:n.contains(t.target))||e(t)};return window.addEventListener("click",t),function(){return window.removeEventListener("click",t)}}}),[e,n]),r}function qn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Yn,Kn,Jn=function(e){var n=e.privilege,r=e.fallback,o=e.children,i=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return qn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qn(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.")}()}((0,t.useState)(null),2),u=i[0],a=i[1];return(0,t.useEffect)((function(){var t=(0,xn.getCurrentUser)({includeAuthStatus:!1}).subscribe(a);return function(){return t.unsubscribe()}}),[]),u&&(0,xn.userHasAccess)(n,u)?t.default.createElement(t.default.Fragment,null,o):r?t.default.createElement(t.default.Fragment,null,r):null};function Zn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Qn(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Zn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zn(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.")}()}((0,t.useState)(null),2),n=e[0],r=e[1],o=null;if(!n){if(Yn){var i=(0,xn.getSessionStore)().getState();i.loaded&&(o=i.session)}else Yn=new Promise((function(t){var e=function(e){var n=e.loaded,r=e.session;n&&(t(r),o=r,Kn&&Kn(),Kn=void 0)};e((0,xn.getSessionStore)().getState()),o||(Kn=(0,xn.getSessionStore)().subscribe(e))}));if(!o)throw Yn;r(o)}(0,t.useEffect)((function(){return Kn||(Kn=(0,xn.getSessionStore)().subscribe((function(t){var e=t.loaded,n=t.session;e&&(o=n,r(n))}))),function(){Kn&&Kn(),Kn=void 0}}),[]);var u=n||o;if(!u)throw Yn?(console.warn("useSession is in an unexpected state. Attempting to recover."),Yn):Error("useSession is in an invalid state.");return u}var Xn=f(725),tr=f(688),er=f(332),nr=f.n(er);function rr(e){var n,r=Pe((0,xn.getVisitStore)()),o=r.patientUuid,i=r.manuallySetVisitUuid,u=e&&o==e?i:null,a="?patient=".concat(e,"&v=").concat(xn.defaultVisitCustomRepresentation,"&includeInactive=false"),c="/".concat(u),l=(0,Xn.default)(e?"/ws/rest/v1/visit".concat(a):null,xn.openmrsFetch),s=l.data,f=l.error,p=l.mutate,d=l.isValidating,y=(0,Xn.default)(e&&u?"/ws/rest/v1/visit".concat(c):null,xn.openmrsFetch),m=y.data,b=y.error,v=y.mutate,g=y.isValidating,h=(0,t.useMemo)((function(){return null!==(n=null==s?void 0:s.data.results.find((function(t){return null===t.stopDatetime})))&&void 0!==n?n:null}),[s]),S=(0,t.useMemo)((function(){return u?null==m?void 0:m.data:null!=h?h:null}),[m,h,u]);return{error:f||b,mutate:function(){p(),v()},isValidating:d||g,activeVisit:h,currentVisit:S,currentVisitIsRetrospective:Boolean(u),isLoading:Boolean((!s||u&&!m)&&(!f||!b))}}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ir(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return or(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?or(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.")}()}((0,t.useState)([]),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){var t=(0,xn.getVisitTypes)().subscribe((function(t){r(t)}),(function(t){return console.error(t)}));return function(){return t.unsubscribe()}}),[]),n}function ur(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}tr.default.extend(nr());var ar=10;function cr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ar,r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ur(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ur(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.")}()}((0,t.useState)(1),2),o=r[0],i=r[1],u=(0,t.useMemo)((function(){return"number"==typeof n&&n>0?Math.max(1,Math.ceil(e.length/n)):1}),[e.length,n]),a=(0,t.useMemo)((function(){var t=(o-1)*n,r=(o+0)*n;return e.slice(t,r)}),[e,o,n]),c=(0,t.useCallback)((function(t){i(Math.max(1,Math.min(u,t)))}),[i,u]),l=(0,t.useCallback)((function(){o<u&&i(o+1)}),[o,u,i]),s=(0,t.useCallback)((function(){o>1&&i(o-1)}),[o,i]);return(0,t.useMemo)((function(){return{results:a,totalPages:u,currentPage:o,paginated:e.length>n,showNextButton:o<u,showPreviousButton:o>1,goTo:c,goToNext:l,goToPrevious:s}}),[a,u,e.length,n,o,c,l,s])}function lr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function sr(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return lr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lr(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.")}()}((0,t.useState)(e),2),o=r[0],i=r[1];return(0,t.useEffect)((function(){var t=setTimeout((function(){i(e)}),n);return function(){clearTimeout(t)}}),[e,n]),o}})(),p})())}}}));
|
|
3
2
|
//# sourceMappingURL=openmrs-esm-react-utils.js.map
|