@openmrs/esm-react-utils 5.0.3-pre.876 → 5.0.3-pre.880

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.
@@ -1,11 +1,11 @@
1
- @openmrs/esm-react-utils:build: cache hit, replaying output 523dd8608f148d50
2
- @openmrs/esm-react-utils:build: asset openmrs-esm-react-utils.js 67.9 KiB [emitted] [minimized] (name: main) 2 related assets
3
- @openmrs/esm-react-utils:build: orphan modules 201 KiB [orphan] 120 modules
1
+ @openmrs/esm-react-utils:build: cache hit, replaying output a0389c59d6be50b8
2
+ @openmrs/esm-react-utils:build: asset openmrs-esm-react-utils.js 67.1 KiB [emitted] [minimized] (name: main) 2 related assets
3
+ @openmrs/esm-react-utils:build: orphan modules 200 KiB [orphan] 120 modules
4
4
  @openmrs/esm-react-utils:build: runtime modules 937 bytes 4 modules
5
- @openmrs/esm-react-utils:build: built modules 209 KiB [built]
6
- @openmrs/esm-react-utils:build:  cacheable modules 209 KiB
5
+ @openmrs/esm-react-utils:build: built modules 208 KiB [built]
6
+ @openmrs/esm-react-utils:build:  cacheable modules 208 KiB
7
7
  @openmrs/esm-react-utils:build:  modules by path ../../../node_modules/ 2.21 KiB 4 modules
8
- @openmrs/esm-react-utils:build:  ./src/index.ts + 120 modules 202 KiB [built] [code generated]
8
+ @openmrs/esm-react-utils:build:  ./src/index.ts + 120 modules 201 KiB [built] [code generated]
9
9
  @openmrs/esm-react-utils:build:  ../esm-state/dist/openmrs-esm-state.js 4.45 KiB [built] [code generated]
10
10
  @openmrs/esm-react-utils:build:  modules by path external "@openmrs/ 168 bytes
11
11
  @openmrs/esm-react-utils:build:  external "@openmrs/esm-config" 42 bytes [built] [code generated]
@@ -15,4 +15,4 @@
15
15
  @openmrs/esm-react-utils:build:  external "react-i18next" 42 bytes [built] [code generated]
16
16
  @openmrs/esm-react-utils:build:  external "dayjs" 42 bytes [built] [code generated]
17
17
  @openmrs/esm-react-utils:build:  external "react-dom" 42 bytes [built] [code generated]
18
- @openmrs/esm-react-utils:build: webpack 5.88.0 compiled successfully in 7181 ms
18
+ @openmrs/esm-react-utils:build: webpack 5.88.0 compiled successfully in 6897 ms
@@ -1,3 +1,3 @@
1
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={},u={},a={},c={},l={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(u,"__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){u[t]=e[t]}))},function(e){a.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.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},385:()=>{System.register([],(function(e,t){return{execute:function(){e(function(){"use strict";var e=function(e,t){var n=l[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=c()((function(){return t}));return l[e]={value:r,active:!0},r},t=function(e,t){var n=l[e];if(!n){var r=c()((function(){return null!=t?t:{}}));return l[e]={value:r,active:!1},r}return n.value},n=function(t){return e("app",t)},r=function(){return t("app",{})},o=function(e,t,n){var r=t(e.getState());return e.subscribe((function(e){var o=t(e);o!==r&&(r=o,n(o))}))},i={d:function(e,t){for(var n in t)i.o(t,n)&&!i.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})}},u={};i.r(u),i.d(u,{createAppState:function(){return n},createGlobalStore:function(){return e},getAppState:function(){return r},getGlobalStore:function(){return t},subscribeTo:function(){return o}});var a=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},c=function(e){return e?a(e):a},l={};return u}())}}}))},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,u=r.useEffect,a=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 a((function(){o.value=n,o.getSnapshot=t,l(o)&&s({inst:o})}),[e,n,t]),u((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=u},281:e=>{"use strict";e.exports=a}},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:()=>y,ExtensionSlot:()=>Pt,UserHasAccess:()=>Fn,createUseStore:()=>a,getAsyncExtensionLifecycle:()=>rn,getAsyncLifecycle:()=>tn,getLifecycle:()=>en,getSyncLifecycle:()=>nn,isDesktop:()=>Mn,openmrsComponentDecorator:()=>Xt,useAssignedExtensionIds:()=>un,useAssignedExtensions:()=>wt,useBodyScrollLock:()=>an,useConfig:()=>yn,useConnectedExtensions:()=>Ot,useConnectivity:()=>b,useExtensionInternalStore:()=>xn,useExtensionSlot:()=>jt,useExtensionSlotMeta:()=>_n,useExtensionStore:()=>Pn,useForceUpdate:()=>Cn,useLayoutType:()=>Tn,useLocations:()=>Dn,useOnClickOutside:()=>Un,usePagination:()=>Hr,usePatient:()=>En,useSession:()=>zn,useStore:()=>Yn,useStoreWithActions:()=>Kn,useVisit:()=>zr,useVisitTypes:()=>Wr});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,u=t.children,a=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)},a),u)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function 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 a(t){return function(n){var 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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(t.getState()),2),o=r[0],a=r[1];(0,e.useEffect)((function(){return t.subscribe((function(e){return a(e)}))}),[]);var c=(0,e.useMemo)((function(){return n?function(e,t){var n=function(n){o[n]=function(){var o=r;e.setState((function(e){for(var r=[e],i=0;i<o.length;i++)r.push(o[i]);return t[n](r)}))}},r=arguments;"function"==typeof t&&(t=t(e));var o={};for(var i in t)n(i);return o}(t,n):{}}),[n]);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){u(e,t,n[t])}))}return e}({},o,c)}}var c=s(45);function l(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 d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(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){d(e,t,n[t])}))}return e}var y=function(n){var r=n.state,o=n.children,i=n.wrap,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}(n,["state","children","wrap"]),a=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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(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)?l(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),s=a[0],f=a[1],d=(0,e.useContext)(t).extension,y=(0,e.useRef)(null),m=(0,e.useRef)(),v=(0,e.useRef)(!1);(0,e.useEffect)((function(){i&&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 b=(0,e.useCallback)((function(e){f(e)}),[f]);(0,e.useEffect)((function(){if(null!=s&&(null==d?void 0:d.extensionSlotName)&&d.extensionSlotModuleName&&d.extensionSlotModuleName&&!y.current&&!v.current)return v.current=!0,(0,c.renderExtension)(s,d.extensionSlotName,d.extensionSlotModuleName,d.extensionId,void 0,r).then((function(e){y.current=e,v.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==d?void 0:d.extensionSlotName,null==d?void 0:d.extensionId,null==d?void 0:d.extensionSlotModuleName,s]),(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(p({},r)))}))}),[r]);var h=e.default.createElement("div",p({ref:b,"data-extension-id":null==d?void 0:d.extensionId,style:{position:"relative"}},u));return"function"!=typeof o||e.default.isValidElement(o)?d&&i?i(h,d):h:e.default.createElement(e.default.Fragment,null,o(h,d))},m=s(728);function v(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 b(){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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return v(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)?v(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,m.subscribeConnectivityChanged)((function(e){var t=e.online;return r(t)}))}),[]),n}const h=function(e,t){return e===t||e!=e&&t!=t},g=function(e,t){for(var n=e.length;n--;)if(h(e[n][0],t))return n;return-1};var S=Array.prototype.splice;function w(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])}}w.prototype.clear=function(){this.__data__=[],this.size=0},w.prototype.delete=function(e){var t=this.__data__,n=g(t,e);return!(n<0||(n==t.length-1?t.pop():S.call(t,n,1),--this.size,0))},w.prototype.get=function(e){var t=this.__data__,n=g(t,e);return n<0?void 0:t[n][1]},w.prototype.has=function(e){return g(this.__data__,e)>-1},w.prototype.set=function(e,t){var n=this.__data__,r=g(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};const O=w,j="object"==typeof global&&global&&global.Object===Object&&global;var E="object"==typeof self&&self&&self.Object===Object&&self;const x=j||E||Function("return this")(),_=x.Symbol;var P=Object.prototype,A=P.hasOwnProperty,C=P.toString,R=_?_.toStringTag:void 0;var I=Object.prototype.toString;var T=_?_.toStringTag:void 0;const M=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?function(e){var t=A.call(e,R),n=e[R];try{e[R]=void 0;var r=!0}catch(e){}var o=C.call(e);return r&&(t?e[R]=n:delete e[R]),o}(e):function(e){return I.call(e)}(e)},k=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},D=function(e){if(!k(e))return!1;var t=M(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},U=x["__core-js_shared__"];var N,L=(N=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var B=Function.prototype.toString;const F=function(e){if(null!=e){try{return B.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var V=/^\[object .+?Constructor\]$/,z=Function.prototype,$=Object.prototype,W=z.toString,G=$.hasOwnProperty,q=RegExp("^"+W.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const H=function(e){return!(!k(e)||(t=e,L&&L in t))&&(D(e)?q:V).test(F(e));var t},Y=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return H(n)?n:void 0},K=Y(x,"Map"),J=Y(Object,"create");var Z=Object.prototype.hasOwnProperty;var Q=Object.prototype.hasOwnProperty;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.__data__=J?J(null):{},this.size=0},X.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},X.prototype.get=function(e){var t=this.__data__;if(J){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Z.call(t,e)?t[e]:void 0},X.prototype.has=function(e){var t=this.__data__;return J?void 0!==t[e]:Q.call(t,e)},X.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=J&&void 0===t?"__lodash_hash_undefined__":t,this};const ee=X,te=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 ne(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])}}ne.prototype.clear=function(){this.size=0,this.__data__={hash:new ee,map:new(K||O),string:new ee}},ne.prototype.delete=function(e){var t=te(this,e).delete(e);return this.size-=t?1:0,t},ne.prototype.get=function(e){return te(this,e).get(e)},ne.prototype.has=function(e){return te(this,e).has(e)},ne.prototype.set=function(e,t){var n=te(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};const re=ne;function oe(e){var t=this.__data__=new O(e);this.size=t.size}oe.prototype.clear=function(){this.__data__=new O,this.size=0},oe.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},oe.prototype.get=function(e){return this.__data__.get(e)},oe.prototype.has=function(e){return this.__data__.has(e)},oe.prototype.set=function(e,t){var n=this.__data__;if(n instanceof O){var r=n.__data__;if(!K||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new re(r)}return n.set(e,t),this.size=n.size,this};const ie=oe;function ue(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new re;++t<n;)this.add(e[t])}ue.prototype.add=ue.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ue.prototype.has=function(e){return this.__data__.has(e)};const ae=ue,ce=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},le=function(e,t){return e.has(t)},se=function(e,t,n,r,o,i){var u=1&n,a=e.length,c=t.length;if(a!=c&&!(u&&c>a))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 ae:void 0;for(i.set(e,t),i.set(t,e);++f<a;){var y=e[f],m=t[f];if(r)var v=u?r(m,y,f,t,e,i):r(y,m,f,e,t,i);if(void 0!==v){if(v)continue;d=!1;break}if(p){if(!ce(t,(function(e,t){if(!le(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},fe=x.Uint8Array,de=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n},pe=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var ye=_?_.prototype:void 0,me=ye?ye.valueOf:void 0;const ve=Array.isArray;var be=Object.prototype.propertyIsEnumerable,he=Object.getOwnPropertySymbols;const ge=he?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 u=e[n];t(u,n,e)&&(i[o++]=u)}return i}(he(e),(function(t){return be.call(e,t)})))}:function(){return[]},Se=function(e){return null!=e&&"object"==typeof e},we=function(e){return Se(e)&&"[object Arguments]"==M(e)};var Oe=Object.prototype,je=Oe.hasOwnProperty,Ee=Oe.propertyIsEnumerable,xe=we(function(){return arguments}())?we:function(e){return Se(e)&&je.call(e,"callee")&&!Ee.call(e,"callee")};const _e=xe;var Pe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ae=Pe&&"object"==typeof module&&module&&!module.nodeType&&module,Ce=Ae&&Ae.exports===Pe?x.Buffer:void 0;const Re=(Ce?Ce.isBuffer:void 0)||function(){return!1};var Ie=/^(?:0|[1-9]\d*)$/;const Te=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ie.test(e))&&e>-1&&e%1==0&&e<t},Me=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ke={};ke["[object Float32Array]"]=ke["[object Float64Array]"]=ke["[object Int8Array]"]=ke["[object Int16Array]"]=ke["[object Int32Array]"]=ke["[object Uint8Array]"]=ke["[object Uint8ClampedArray]"]=ke["[object Uint16Array]"]=ke["[object Uint32Array]"]=!0,ke["[object Arguments]"]=ke["[object Array]"]=ke["[object ArrayBuffer]"]=ke["[object Boolean]"]=ke["[object DataView]"]=ke["[object Date]"]=ke["[object Error]"]=ke["[object Function]"]=ke["[object Map]"]=ke["[object Number]"]=ke["[object Object]"]=ke["[object RegExp]"]=ke["[object Set]"]=ke["[object String]"]=ke["[object WeakMap]"]=!1;var De="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ue=De&&"object"==typeof module&&module&&!module.nodeType&&module,Ne=Ue&&Ue.exports===De&&j.process,Le=function(){try{return Ue&&Ue.require&&Ue.require("util").types||Ne&&Ne.binding&&Ne.binding("util")}catch(e){}}(),Be=Le&&Le.isTypedArray;const Fe=Be?(Ve=Be,function(e){return Ve(e)}):function(e){return Se(e)&&Me(e.length)&&!!ke[M(e)]};var Ve,ze=Object.prototype.hasOwnProperty;const $e=function(e,t){var n=ve(e),r=!n&&_e(e),o=!n&&!r&&Re(e),i=!n&&!r&&!o&&Fe(e),u=n||r||o||i,a=u?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var l in e)!t&&!ze.call(e,l)||u&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Te(l,c))||a.push(l);return a};var We=Object.prototype;const Ge=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object);var qe=Object.prototype.hasOwnProperty;const He=function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||We))return Ge(e);var t,n,r=[];for(var o in Object(e))qe.call(e,o)&&"constructor"!=o&&r.push(o);return r},Ye=function(e){return null!=(t=e)&&Me(t.length)&&!D(t)?$e(e):He(e);var t},Ke=function(e){return function(e,t,n){var r=t(e);return ve(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,Ye,ge)};var Je=Object.prototype.hasOwnProperty;const Ze=Y(x,"DataView"),Qe=Y(x,"Promise"),Xe=Y(x,"Set"),et=Y(x,"WeakMap");var tt="[object Map]",nt="[object Promise]",rt="[object Set]",ot="[object WeakMap]",it="[object DataView]",ut=F(Ze),at=F(K),ct=F(Qe),lt=F(Xe),st=F(et),ft=M;(Ze&&ft(new Ze(new ArrayBuffer(1)))!=it||K&&ft(new K)!=tt||Qe&&ft(Qe.resolve())!=nt||Xe&&ft(new Xe)!=rt||et&&ft(new et)!=ot)&&(ft=function(e){var t=M(e),n="[object Object]"==t?e.constructor:void 0,r=n?F(n):"";if(r)switch(r){case ut:return it;case at:return tt;case ct:return nt;case lt:return rt;case st:return ot}return t});const dt=ft;var pt="[object Arguments]",yt="[object Array]",mt="[object Object]",vt=Object.prototype.hasOwnProperty;const bt=function(e,t,n,r,o,i){var u=ve(e),a=ve(t),c=u?yt:dt(e),l=a?yt:dt(t),s=(c=c==pt?mt:c)==mt,f=(l=l==pt?mt:l)==mt,d=c==l;if(d&&Re(e)){if(!Re(t))return!1;u=!0,s=!1}if(d&&!s)return i||(i=new ie),u||Fe(e)?se(e,t,n,r,o,i):function(e,t,n,r,o,i,u){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 fe(e),new fe(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return h(+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 a=de;case"[object Set]":var c=1&r;if(a||(a=pe),e.size!=t.size&&!c)return!1;var l=u.get(e);if(l)return l==t;r|=2,u.set(e,t);var s=se(a(e),a(t),r,o,i,u);return u.delete(e),s;case"[object Symbol]":if(me)return me.call(e)==me.call(t)}return!1}(e,t,c,n,r,o,i);if(!(1&n)){var p=s&&vt.call(e,"__wrapped__"),y=f&&vt.call(t,"__wrapped__");if(p||y){var m=p?e.value():e,v=y?t.value():t;return i||(i=new ie),o(m,v,n,r,i)}}return!!d&&(i||(i=new ie),function(e,t,n,r,o,i){var u=1&n,a=Ke(e),c=a.length;if(c!=Ke(t).length&&!u)return!1;for(var l=c;l--;){var s=a[l];if(!(u?s in t:Je.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=u;++l<c;){var m=e[s=a[l]],v=t[s];if(r)var b=u?r(v,m,s,t,e,i):r(m,v,s,e,t,i);if(!(void 0===b?m===v||o(m,v,n,r,i):b)){p=!1;break}y||(y="constructor"==s)}if(p&&!y){var h=e.constructor,g=t.constructor;h==g||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof g&&g instanceof g||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,r,o,i))},ht=function e(t,n,r,o,i){return t===n||(null==t||null==n||!Se(t)&&!Se(n)?t!=t&&n!=n:bt(t,n,r,o,e,i))},gt=function(e,t){return ht(e,t)};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(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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(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}}(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,u=null!==(i=null===(n=e.slots[t])||void 0===n?void 0:n.assignedExtensions)&&void 0!==i?i:[];gt(u,r)||o(u)};return e((0,c.getExtensionStore)().getState()),(0,c.getExtensionStore)().subscribe(e)}),[t,r]),r}function Ot(t){var n=b(),r=wt(t);return(0,e.useMemo)((function(){return(0,c.getConnectedExtensions)(r,n)}),[r,n])}function jt(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,c.registerExtensionSlot)(r,n)}),[]),{extensions:Ot(n),extensionSlotName:n,extensionSlotModuleName:r}}function Et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xt(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){Et(e,t,n[t])}))}return e}function _t(e){return e}function Pt(n){var r=n.name,o=n.extensionSlotName,i=n.select,u=void 0===i?_t:i,a=n.children,c=n.state,l=n.style,s=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(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 f,d,p,m,v=null!=r?r:o,b=(0,e.useRef)(null),h=jt(v),g=h.extensions,S=h.extensionSlotModuleName,w=(0,e.useMemo)((function(){return u(g)}),[u,g]),O=(0,e.useMemo)((function(){if("function"==typeof a&&!e.default.isValidElement(a))return w.map((function(e){return a(e)}))}),[a,w]);return e.default.createElement("div",xt({ref:b,"data-extension-slot-name":v,"data-extension-slot-module-name":S,style:(p=xt({},l),m={position:"relative"},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(p,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(p,e,Object.getOwnPropertyDescriptor(m,e))})),p)},s),v&&w.map((function(n,r){return e.default.createElement(t.Provider,{key:n.id,value:{moduleName:S,extension:{extensionId:n.id,extensionSlotName:v,extensionSlotModuleName:S}}},null!==(d=null!==(f=null==O?void 0:O[r])&&void 0!==f?f:"function"!=typeof a?a:null)&&void 0!==d?d:e.default.createElement(y,{state:c}))})))}var At=s(645);function Ct(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 Rt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(n),!0).forEach((function(t){Tt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function It(e){return(It="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 Tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(e){return(Mt="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 kt(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(Mt(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(Mt(e)));return e}}var Dt=null;try{Dt=require("react").createContext()}catch(Ct){}var Ut={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 Nt(e){if("object"!==It(e))throw new Error("single-spa-react requires a configuration object");var t=Rt(Rt({},Ut),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");!Dt&&t.React.createContext&&(Dt=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:Lt.bind(null,t),mount:Bt.bind(null,t),unmount:Ft.bind(null,t)};return t.parcelCanUpdate&&(n.update=Vt.bind(null,t)),n}function Lt(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function Bt(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=Wt(e,t,(function(){n(this)})),i=kt(e,t)(),u=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:zt(e),renderType:$t(e)});e.domElements[t.name]=i,e.renderResults[t.name]=u}))}function Ft(e,t){return new Promise((function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():zt(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function Vt(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=Wt(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(r);else{var i=kt(e,t)();zt(e).render(r,i)}}))}function zt(e){return e.ReactDOMClient||e.ReactDOM}function $t(e){return"function"==typeof e.renderType?e.renderType():e.renderType}function Wt(e,t,n){var r=e.React.createElement(e.rootComponent,t),o=Dt?e.React.createElement(Dt.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,Rt(Rt({},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 Gt=s(281);function qt(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 Ht(e){return Ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ht(e)}function Yt(e,t){return Yt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Yt(e,t)}function Kt(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=Ht(e);if(t){var o=Ht(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 Jt=window.i18next,Zt={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},Qt=function(t){(0,e.useEffect)((function(){return Jt.on("languageChanged",t.forceUpdate),function(){return Jt.off("languageChanged",t.forceUpdate)}}),[t.forceUpdate]);var n=(0,e.useRef)(null);if(n.current)throw n.current;if(!Jt.hasLoadedNamespace(t.ns)){var r=setTimeout((function(){console.warn("openmrsComponentDecorator: the React suspense promise for i18next.loadNamespaces(['".concat(t.ns,"']) did not resolve nor reject after three seconds. This could mean you have multiple versions of i18next and haven't made i18next a webpack external in all projects."))}),3e3);throw Jt.loadNamespaces([t.ns]).then((function(){return clearTimeout(r)})).catch((function(e){clearTimeout(r),n.current=e}))}return e.default.createElement(e.default.Fragment,null,t.children)};function Xt(n){if(void 0===Jt&&void 0!==window.i18next&&(Jt=window.i18next),"object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},Zt,n);return function(n){var o,i,u,a;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&&Yt(e,t)}(c,o);var i,u,a=Kt(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=a.call(this,e)).state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:e._extensionContext}},t}return i=c,(u=[{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(){var o=this;if(this.state.caughtError)return e.default.createElement("div",null,"An error has occurred. Please try reloading the page.");var i=e.default.createElement(t.Provider,{value:this.state.config},e.default.createElement(e.default.Suspense,{fallback:null},r.disableTranslations?e.default.createElement(n,this.props):e.default.createElement(Qt,{ns:r.moduleName,forceUpdate:function(){return o.forceUpdate()}},e.default.createElement(Gt.I18nextProvider,{i18n:Jt,defaultNS:r.moduleName},e.default.createElement(n,this.props)))));return r.strictMode||!e.default.StrictMode?i:e.default.createElement(e.default.StrictMode,null,i)}}])&&qt(i.prototype,u),c}(e.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 en(t,n){return Nt({React:e.default,ReactDOMClient:At,rootComponent:Xt(n)(t)})}function tn(e,t){return function(){return e().then((function(e){return en(e.default,t)}))}}function nn(e,t){return function(){return Promise.resolve(en(e,t))}}var rn=tn;function on(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 un(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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return on(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)?on(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,c.getExtensionStore)().subscribe((function(e){var n,i,u=null!==(i=null===(n=e.slots[t])||void 0===n?void 0:n.assignedExtensions.map((function(e){return e.id})))&&void 0!==i?i:[];gt(u,r)||o(u)}))}),[]),r}function an(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 cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ln(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cn(e,t):void 0}}(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 fn={},dn='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function pn(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],u=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&&!gt(t.config,i)&&u(t.config)}))}),[t,r,i]),i}(r,t);if(!o&&t){var i="".concat(t.extensionSlotName,"-").concat(t.extensionId);throw!fn[i]&&r&&(fn[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)),fn[i]}return o||{}}function yn(){var r=(0,e.useContext)(t),o=r.moduleName,i=r.extension;if(!o&&!i)throw Error(dn);var u=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 fn[o]||(fn[o]=function(e){return new Promise((function(t){var n=e.subscribe((function(e){e.loaded&&e.config&&(t(e.config),n())}))}))}(r)),fn[o];return i}(o),a=pn(i),c=(0,e.useMemo)((function(){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ln(e,t,n[t])}))}return e}({},u,a)}),[u,a]);return c}var mn,vn=s(766);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 hn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){hn(e,t,n[t])}))}return e}function Sn(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"}(mn||(mn={}));var wn={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function On(){var e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function jn(e,t){switch(t.type){case mn.loadPatient:return Sn(gn({},e),{patientUuid:t.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case mn.newPatient:return Sn(gn({},e),{patient:t.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case mn.loadError:return Sn(gn({},e),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:t.err});default:return e}}function En(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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)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.useReducer)(jn,Sn(gn({},wn),{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=On();o(e?{type:mn.loadPatient,patientUuid:e}:{type:mn.newPatient,patient:null})}var t=!0;return r.isLoadingPatient&&r.patientUuid&&(0,vn.fetchCurrentPatient)(r.patientUuid).then((function(e){return t&&o({patient:e,type:mn.newPatient})}),(function(e){return t&&o({err:e,type:mn.loadError})})),function(){t=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,e.useEffect)((function(){var e=function(e){var t=On();t!=r.patientUuid&&o({type:mn.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 xn=a((0,c.getExtensionInternalStore)());function _n(t){var n=Ot(t);return(0,e.useMemo)((function(){return Object.fromEntries(n.map((function(e){return[e.name,e.meta]})))}),[n])}var Pn=a((0,c.getExtensionStore)());function An(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Cn(){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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return An(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?An(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(0),2)[1];return(0,e.useCallback)((function(){t((function(e){return e+1}))}),[])}function Rn(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 In(){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 Tn(){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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rn(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)?Rn(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)(In),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){var e=function(){r(In())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n}var Mn=function(e){return"small-desktop"===e||"large-desktop"===e};function kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Dn(){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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kn(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)?kn(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,vn.getLocations)().subscribe((function(e){r(e)}),(function(e){console.error(e)}));return function(){return e.unsubscribe()}}),[]),n}function Un(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 Nn(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 Ln,Bn,Fn=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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nn(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)?Nn(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),u=i[0],a=i[1];return(0,e.useEffect)((function(){var e=(0,vn.getCurrentUser)({includeAuthStatus:!1}).subscribe(a);return function(){return e.unsubscribe()}}),[]),u&&(0,vn.userHasAccess)(n,u)?e.default.createElement(e.default.Fragment,null,o):r?e.default.createElement(e.default.Fragment,null,r):null};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 zn(){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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)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.")}()}((0,e.useState)(null),2),n=t[0],r=t[1],o=null;if(!n){if(Ln){var i=(0,vn.getSessionStore)().getState();i.loaded&&(o=i.session)}else Ln=new Promise((function(e){var t=function(t){var n=t.loaded,r=t.session;n&&(e(r),o=r,Bn&&Bn(),Bn=void 0)};t((0,vn.getSessionStore)().getState()),o||(Bn=(0,vn.getSessionStore)().subscribe(t))}));if(!o)throw Ln;r(o)}(0,e.useEffect)((function(){return Bn||(Bn=(0,vn.getSessionStore)().subscribe((function(e){var t=e.loaded,n=e.session;t&&(o=n,r(n))}))),function(){Bn&&Bn(),Bn=void 0}}),[]);var u=n||o;if(!u)throw Ln?(console.warn("useSession is in an unexpected state. Attempting to recover."),Ln):Error("useSession is in an invalid state.");return u}var $n=s(385);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 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 qn(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}}var Hn=function(e){return e};function Yn(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hn,r=arguments.length>2?arguments[2]:void 0,o=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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||qn(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)((function(){return n(t.getState())})),2),i=o[0],u=o[1];(0,e.useEffect)((function(){return(0,$n.subscribeTo)(t,n,u)}),[t,n]);var a=(0,e.useMemo)((function(){return r?function(e,t){var n=function(n){o[n]=function(){var o=r;e.setState((function(e){for(var r,i=[e],u=0;u<o.length;u++)i.push(o[u]);return(r=t)[n].apply(r,function(e){if(Array.isArray(e))return Wn(e)}(a=i)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||qn(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}))}},r=arguments;"function"==typeof t&&(t=t(e));var o={};for(var i in t)n(i);return o}(t,r):{}}),[t,r]);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Gn(e,t,n[t])}))}return e}({},i,a)}function Kn(e,t){return Yn(e,Hn,t)}var Jn=s(374);const Zn=new WeakMap,Qn={},Xn=()=>{},er=Xn(),tr=Object,nr=e=>e===er,rr=e=>"function"==typeof e,or=(e,t)=>({...e,...t}),ir="undefined",ur=typeof window!=ir,ar=typeof document!=ir,cr=(e,t)=>{const n=Zn.get(e);return[()=>e.get(t)||Qn,r=>{const o=e.get(t);n[5](t,or(o,r),o||Qn)},n[6]]},lr=new WeakMap;let sr=0;const fr=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let o,i;if(tr(e)!==e||r||n==RegExp)o=r?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=lr.get(e),o)return o;if(o=++sr+"~",lr.set(e,o),n==Array){for(o="@",i=0;i<e.length;i++)o+=fr(e[i])+",";lr.set(e,o)}if(n==tr){o="#";const t=tr.keys(e).sort();for(;!nr(i=t.pop());)nr(e[i])||(o+=i+":"+fr(e[i])+",");lr.set(e,o)}}return o};let dr=!0;const[pr,yr]=ur&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Xn,Xn],mr={isOnline:()=>dr,isVisible:()=>{const e=ar&&document.visibilityState;return nr(e)||"hidden"!==e}},vr={initFocus:e=>(ar&&document.addEventListener("visibilitychange",e),pr("focus",e),()=>{ar&&document.removeEventListener("visibilitychange",e),yr("focus",e)}),initReconnect:e=>{const t=()=>{dr=!0,e()},n=()=>{dr=!1};return pr("online",t),pr("offline",n),()=>{yr("online",t),yr("offline",n)}}},br=!e.default.useId,hr=!ur||"Deno"in window,gr=hr?e.useEffect:e.useLayoutEffect,Sr="undefined"!=typeof navigator&&navigator.connection,wr=!hr&&Sr&&(["slow-2g","2g"].includes(Sr.effectiveType)||Sr.saveData),Or=e=>{if(rr(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?fr(e):"",t]};let jr=0;const Er=()=>++jr;async function xr(...e){const[t,n,r,o]=e,i=or({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let u=i.populateCache;const a=i.rollbackOnError;let c=i.optimisticData;const l=!1!==i.revalidate,s=i.throwOnError;if(rr(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]=Or(n);if(!o)return;const[i,f]=cr(t,o),[d,p,y]=Zn.get(t),m=d[o],v=()=>l&&(delete y[o],m&&m[0])?m[0](2).then((()=>i().data)):i().data;if(e.length<3)return v();let b,h=r;const g=Er();p[o]=[g,0];const S=!nr(c),w=i(),O=w.data,j=w._c,E=nr(j)?O:j;if(S&&(c=rr(c)?c(E):c,f({data:c,_c:E})),rr(h))try{h=h(E)}catch(e){b=e}if(h&&rr(h.then)){if(h=await h.catch((e=>{b=e})),g!==p[o][0]){if(b)throw b;return h}b&&S&&(e=>"function"==typeof a?a(e):!1!==a)(b)&&(u=!0,h=E,f({data:h,_c:er}))}u&&(b||(rr(u)&&(h=u(h,E)),f({data:h,_c:er}))),p[o][1]=Er();const x=await v();if(f({_c:er}),!b)return u?x:h;if(s)throw b}}const _r=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Pr=(e,t)=>{if(!Zn.has(e)){const n=or(vr,t),r={},o=xr.bind(er,e);let i=Xn;const u={},a=(e,t)=>{const n=u[e]||[];return u[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},c=(t,n,r)=>{e.set(t,n);const o=u[t];if(o)for(let e=o.length;e--;)o[e](r,n)},l=()=>{if(!Zn.has(e)&&(Zn.set(e,[r,{},{},{},o,c,a]),!hr)){const t=n.initFocus(setTimeout.bind(er,_r.bind(er,r,0))),o=n.initReconnect(setTimeout.bind(er,_r.bind(er,r,1)));i=()=>{t&&t(),o&&o(),Zn.delete(e)}}};return l(),[e,o,l,i]}return[e,Zn.get(e)[4]]},[Ar,Cr]=Pr(new Map),Rr=or({onLoadingSlow:Xn,onSuccess:Xn,onError:Xn,onErrorRetry:(e,t,n,r,o)=>{const i=n.errorRetryCount,u=o.retryCount,a=~~((Math.random()+.5)*(1<<(u<8?u:8)))*n.errorRetryInterval;!nr(i)&&u>i||setTimeout(r,a,o)},onDiscarded:Xn,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:wr?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:wr?5e3:3e3,compare:(e,t)=>fr(e)==fr(t),isPaused:()=>!1,cache:Ar,mutate:Cr,fallback:{}},mr),Ir=(e,t)=>{const n=or(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:u}=t;r&&i&&(n.use=r.concat(i)),o&&u&&(n.fallback=or(o,u))}return n},Tr=(0,e.createContext)({}),Mr=ur&&window.__SWR_DEVTOOLS_USE__,kr=Mr?window.__SWR_DEVTOOLS_USE__:[],Dr=kr.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const r=Or(t)[0],[,,,o]=Zn.get(Ar),i=o[r];return i?(delete o[r],i):n(...e)}),r)));Mr&&(window.__SWR_DEVTOOLS_REACT__=e.default);const Ur={dedupe:!0};tr.defineProperty((t=>{const{value:n}=t,r=(0,e.useContext)(Tr),o=rr(n),i=(0,e.useMemo)((()=>o?n(r):n),[o,r,n]),u=(0,e.useMemo)((()=>o?i:Ir(r,i)),[o,r,i]),a=i&&i.provider,[c]=(0,e.useState)((()=>a?Pr(a(u.cache||Ar),i):er));return c&&(u.cache=c[0],u.mutate=c[1]),gr((()=>{if(c)return c[2]&&c[2](),c[3]}),[]),(0,e.createElement)(Tr.Provider,or(t,{value:u}))}),"defaultValue",{value:Rr});var Nr,Lr=(Nr=(t,n,r)=>{const{cache:o,compare:i,suspense:u,fallbackData:a,revalidateOnMount:c,refreshInterval:l,refreshWhenHidden:s,refreshWhenOffline:f,keepPreviousData:d}=r,[p,y,m]=Zn.get(o),[v,b]=Or(t),h=(0,e.useRef)(!1),g=(0,e.useRef)(!1),S=(0,e.useRef)(v),w=(0,e.useRef)(n),O=(0,e.useRef)(r),j=()=>O.current,E=()=>j().isVisible()&&j().isOnline(),[x,_,P]=cr(o,v),A=(0,e.useRef)({}).current,C=nr(a)?r.fallback[v]:a,R=(e,t)=>{let n=!0;for(const r in A){const o=r;i(t[o],e[o])||"data"===o&&nr(e[o])&&i(t[o],L)||(n=!1)}return n},I=(0,e.useMemo)((()=>{const e=!!v&&!!n&&(nr(c)?!j().isPaused()&&!u:c),t=()=>{const t=x(),n=or(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n};let r=t();return()=>{const e=t();return R(e,r)?r:r=e}}),[o,v]),T=(0,Jn.useSyncExternalStore)((0,e.useCallback)((e=>P(v,((t,n)=>{R(t,n)||e()}))),[o,v]),I,I),M=!h.current,k=T.data,D=nr(k)?C:k,U=T.error,N=(0,e.useRef)(D),L=d?nr(k)?N.current:k:D,B=M&&!nr(c)?c:!j().isPaused()&&(u?!nr(D)&&r.revalidateIfStale:nr(D)||r.revalidateIfStale),F=!!(v&&n&&M&&B),V=nr(T.isValidating)?F:T.isValidating,z=nr(T.isLoading)?F:T.isLoading,$=(0,e.useCallback)((async e=>{const t=w.current;if(!v||!t||g.current||j().isPaused())return!1;let n,o,u=!0;const a=e||{},c=!m[v]||!a.dedupe,l=()=>br?!g.current&&v===S.current&&h.current:v===S.current,s={isValidating:!1,isLoading:!1},f=()=>{_(s)},d=()=>{const e=m[v];e&&e[1]===o&&delete m[v]},p={isValidating:!0};nr(x().data)&&(p.isLoading=!0);try{if(c&&(_(p),r.loadingTimeout&&nr(x().data)&&setTimeout((()=>{u&&l()&&j().onLoadingSlow(v,r)}),r.loadingTimeout),m[v]=[t(b),Er()]),[n,o]=m[v],n=await n,c&&setTimeout(d,r.dedupingInterval),!m[v]||m[v][1]!==o)return c&&l()&&j().onDiscarded(v),!1;s.error=er;const e=y[v];if(!nr(e)&&(o<=e[0]||o<=e[1]||0===e[1]))return f(),c&&l()&&j().onDiscarded(v),!1;const a=x().data;s.data=i(a,n)?a:n,c&&l()&&j().onSuccess(n,v,r)}catch(e){d();const t=j(),{shouldRetryOnError:n}=t;t.isPaused()||(s.error=e,c&&l()&&(t.onError(e,v,t),(!0===n||rr(n)&&n(e))&&E()&&t.onErrorRetry(e,v,t,$,{retryCount:(a.retryCount||0)+1,dedupe:!0})))}return u=!1,f(),!0}),[v,o]),W=(0,e.useCallback)(((...e)=>xr(o,S.current,...e)),[]);if(gr((()=>{w.current=n,O.current=r,nr(k)||(N.current=k)})),gr((()=>{if(!v)return;const e=$.bind(er,Ur);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())}})(v,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 g.current=!1,S.current=v,h.current=!0,_({_k:b}),B&&(nr(D)||hr?e():(e=>{ur&&typeof window.requestAnimationFrame!=ir?window.requestAnimationFrame(e):setTimeout(e,1)})(e)),()=>{g.current=!0,n()}}),[v]),gr((()=>{let e;function t(){const t=rr(l)?l(D):l;t&&-1!==e&&(e=setTimeout(n,t))}function n(){x().error||!s&&!j().isVisible()||!f&&!j().isOnline()?t():$(Ur).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[l,s,f,v]),(0,e.useDebugValue)(L),u&&nr(D)&&v){if(!br&&hr)throw new Error("Fallback data is required when using suspense in SSR.");throw w.current=n,O.current=r,g.current=!1,nr(U)?$(Ur):U}return{mutate:W,get data(){return A.data=!0,L},get error(){return A.error=!0,U},get isValidating(){return A.isValidating=!0,V},get isLoading(){return A.isLoading=!0,z}}},function(...t){const n=or(Rr,(0,e.useContext)(Tr)),[r,o,i]=(e=>rr(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}])(t),u=Ir(n,i);let a=Nr;const{use:c}=u,l=(c||[]).concat(Dr);for(let e=l.length;e--;)a=l[e](a);return a(r,o||u.fetcher||null,u)}),Br=s(688),Fr=s(332),Vr=s.n(Fr);function zr(t){var n,r=Lr(t?"/ws/rest/v1/visit?patient=".concat(t,"&v=").concat(vn.defaultVisitCustomRepresentation,"&includeInactive=false"):null,vn.openmrsFetch),o=r.data,i=r.error;return{error:i,mutate:r.mutate,isValidating:r.isValidating,currentVisit:(0,e.useMemo)((function(){return null!==(n=null==o?void 0:o.data.results.find((function(e){return null===e.stopDatetime})))&&void 0!==n?n:null}),[null==o?void 0:o.data.results]),isLoading:!o&&!i}}function $r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wr(){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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $r(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)?$r(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,vn.getVisitTypes)().subscribe((function(e){r(e)}),(function(e){return console.error(e)}));return function(){return e.unsubscribe()}}),[]),n}function Gr(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}Br.default.extend(Vr());var qr=10;function Hr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qr,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=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gr(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)?Gr(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],u=(0,e.useMemo)((function(){return"number"==typeof n&&n>0?Math.max(1,Math.ceil(t.length/n)):1}),[t.length,n]);return{results:(0,e.useMemo)((function(){var e=(o-1)*n,r=(o+0)*n;return t.slice(e,r)}),[t,o,n]),totalPages:u,currentPage:o,paginated:t.length>n,showNextButton:o<u,showPreviousButton:o>1,goTo:function(e){i(Math.max(1,Math.min(u,e)))},goToNext:function(){o<u&&i(o+1)},goToPrevious:function(){o>1&&i(o-1)}}}})(),f})())}}}));
2
+ System.register(["react","@openmrs/esm-config","@openmrs/esm-extensions","@openmrs/esm-globals","react-dom","react-i18next","@openmrs/esm-api","dayjs"],(function(t,e){var n={},r={},o={},i={},u={},a={},c={},l={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(u,"__esModule",{value:!0}),{setters:[function(t){Object.keys(t).forEach((function(e){n[e]=t[e]}))},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}],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},385:()=>{System.register([],(function(t,e){return{execute:function(){t(function(){"use strict";var t=function(t,e){var n=l[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=c()((function(){return e}));return l[t]={value:r,active:!0},r},e=function(t,e){var n=l[t];if(!n){var r=c()((function(){return null!=e?e:{}}));return l[t]={value:r,active:!1},r}return n.value},n=function(e){return t("app",e)},r=function(){return e("app",{})},o=function(t,e,n){var r=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==r&&(r=o,n(o))}))},i={d:function(t,e){for(var n in e)i.o(e,n)&&!i.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})}},u={};i.r(u),i.d(u,{createAppState:function(){return n},createGlobalStore:function(){return t},getAppState:function(){return r},getGlobalStore:function(){return e},subscribeTo:function(){return o}});var a=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},c=function(t){return t?a(t):a},l={};return u}())}}}))},173:(t,e,n)=>{"use strict";var r=n(954),o="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},i=r.useState,u=r.useEffect,a=r.useLayoutEffect,c=r.useDebugValue;function l(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!o(t,n)}catch(t){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,e){return e()}:function(t,e){var n=e(),r=i({inst:{value:n,getSnapshot:e}}),o=r[0].inst,s=r[1];return a((function(){o.value=n,o.getSnapshot=e,l(o)&&s({inst:o})}),[t,n,e]),u((function(){return l(o)&&s({inst:o}),t((function(){l(o)&&s({inst:o})}))}),[t]),c(n),n};e.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:s},374:(t,e,n)=>{"use strict";t.exports=n(173)},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=l},954:t=>{"use strict";t.exports=n},493:t=>{"use strict";t.exports=u},281:t=>{"use strict";t.exports=a}},e={};function s(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,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var f={};return(()=>{"use strict";s.r(f),s.d(f,{ComponentContext:()=>e,ConfigurableLink:()=>o,Extension:()=>y,ExtensionSlot:()=>Pe,UserHasAccess:()=>Nn,createUseStore:()=>a,getAsyncExtensionLifecycle:()=>en,getAsyncLifecycle:()=>Xe,getLifecycle:()=>Qe,getSyncLifecycle:()=>tn,isDesktop:()=>In,openmrsComponentDecorator:()=>Ze,useAssignedExtensionIds:()=>rn,useAssignedExtensions:()=>we,useBodyScrollLock:()=>on,useConfig:()=>dn,useConnectedExtensions:()=>Oe,useConnectivity:()=>b,useExtensionInternalStore:()=>jn,useExtensionSlot:()=>je,useExtensionSlotMeta:()=>En,useExtensionStore:()=>xn,useForceUpdate:()=>Pn,useLayoutType:()=>Rn,useLocations:()=>Mn,useOnClickOutside:()=>kn,usePagination:()=>Gr,usePatient:()=>On,useSession:()=>Bn,useStore:()=>qn,useStoreWithActions:()=>Hn,useVisit:()=>Br,useVisitTypes:()=>zr});var t=s(954),e=t.default.createContext({moduleName:""}),n=s(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)}function i(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 u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(e){return function(n){var 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 i(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)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(e.getState()),2),o=r[0],a=r[1];(0,t.useEffect)((function(){return e.subscribe((function(t){return a(t)}))}),[]);var c=(0,t.useMemo)((function(){return n?function(t,e){var n=function(n){o[n]=function(){var o=r;t.setState((function(t){for(var r=[t],i=0;i<o.length;i++)r.push(o[i]);return e[n](r)}))}},r=arguments;"function"==typeof e&&(e=e(t));var o={};for(var i in e)n(i);return o}(e,n):{}}),[n]);return function(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){u(t,e,n[e])}))}return t}({},o,c)}}var c=s(45);function l(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 d(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p(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){d(t,e,n[e])}))}return t}var y=function(n){var r=n.state,o=n.children,i=n.wrap,u=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"]),a=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 l(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)?l(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),s=a[0],f=a[1],d=(0,t.useContext)(e).extension,y=(0,t.useRef)(null),m=(0,t.useRef)(),v=(0,t.useRef)(!1);(0,t.useEffect)((function(){i&&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 b=(0,t.useCallback)((function(t){f(t)}),[f]);(0,t.useEffect)((function(){if(null!=s&&(null==d?void 0:d.extensionSlotName)&&d.extensionSlotModuleName&&d.extensionSlotModuleName&&!y.current&&!v.current)return v.current=!0,(0,c.renderExtension)(s,d.extensionSlotName,d.extensionSlotModuleName,d.extensionId,void 0,r).then((function(t){y.current=t,v.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,s]),(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(p({},r)))}))}),[r]);var h=t.default.createElement("div",p({ref:b,"data-extension-id":null==d?void 0:d.extensionId,style:{position:"relative"}},u));return"function"!=typeof o||t.default.isValidElement(o)?d&&i?i(h,d):h:t.default.createElement(t.default.Fragment,null,o(h,d))},m=s(728);function v(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 b(){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 v(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)?v(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,m.subscribeConnectivityChanged)((function(t){var e=t.online;return r(e)}))}),[]),n}const h=function(t,e){return t===e||t!=t&&e!=e},g=function(t,e){for(var n=t.length;n--;)if(h(t[n][0],e))return n;return-1};var S=Array.prototype.splice;function w(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])}}w.prototype.clear=function(){this.__data__=[],this.size=0},w.prototype.delete=function(t){var e=this.__data__,n=g(e,t);return!(n<0||(n==e.length-1?e.pop():S.call(e,n,1),--this.size,0))},w.prototype.get=function(t){var e=this.__data__,n=g(e,t);return n<0?void 0:e[n][1]},w.prototype.has=function(t){return g(this.__data__,t)>-1},w.prototype.set=function(t,e){var n=this.__data__,r=g(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};const O=w,j="object"==typeof global&&global&&global.Object===Object&&global;var E="object"==typeof self&&self&&self.Object===Object&&self;const x=j||E||Function("return this")(),_=x.Symbol;var P=Object.prototype,A=P.hasOwnProperty,C=P.toString,R=_?_.toStringTag:void 0;var I=Object.prototype.toString;var T=_?_.toStringTag:void 0;const M=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":T&&T in Object(t)?function(t){var e=A.call(t,R),n=t[R];try{t[R]=void 0;var r=!0}catch(t){}var o=C.call(t);return r&&(e?t[R]=n:delete t[R]),o}(t):function(t){return I.call(t)}(t)},k=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},D=function(t){if(!k(t))return!1;var e=M(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},U=x["__core-js_shared__"];var L,N=(L=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+L:"";var V=Function.prototype.toString;const B=function(t){if(null!=t){try{return V.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var F=/^\[object .+?Constructor\]$/,z=Function.prototype,$=Object.prototype,W=z.toString,G=$.hasOwnProperty,q=RegExp("^"+W.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const H=function(t){return!(!k(t)||(e=t,N&&N in e))&&(D(t)?q:F).test(B(t));var e},Y=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return H(n)?n:void 0},K=Y(x,"Map"),J=Y(Object,"create");var Z=Object.prototype.hasOwnProperty;var Q=Object.prototype.hasOwnProperty;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.__data__=J?J(null):{},this.size=0},X.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},X.prototype.get=function(t){var e=this.__data__;if(J){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Z.call(e,t)?e[t]:void 0},X.prototype.has=function(t){var e=this.__data__;return J?void 0!==e[t]:Q.call(e,t)},X.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=J&&void 0===e?"__lodash_hash_undefined__":e,this};const tt=X,et=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 nt(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])}}nt.prototype.clear=function(){this.size=0,this.__data__={hash:new tt,map:new(K||O),string:new tt}},nt.prototype.delete=function(t){var e=et(this,t).delete(t);return this.size-=e?1:0,e},nt.prototype.get=function(t){return et(this,t).get(t)},nt.prototype.has=function(t){return et(this,t).has(t)},nt.prototype.set=function(t,e){var n=et(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};const rt=nt;function ot(t){var e=this.__data__=new O(t);this.size=e.size}ot.prototype.clear=function(){this.__data__=new O,this.size=0},ot.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},ot.prototype.get=function(t){return this.__data__.get(t)},ot.prototype.has=function(t){return this.__data__.has(t)},ot.prototype.set=function(t,e){var n=this.__data__;if(n instanceof O){var r=n.__data__;if(!K||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new rt(r)}return n.set(t,e),this.size=n.size,this};const it=ot;function ut(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new rt;++e<n;)this.add(t[e])}ut.prototype.add=ut.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ut.prototype.has=function(t){return this.__data__.has(t)};const at=ut,ct=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},lt=function(t,e){return t.has(e)},st=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,d=!0,p=2&n?new at:void 0;for(i.set(t,e),i.set(e,t);++f<a;){var y=t[f],m=e[f];if(r)var v=u?r(m,y,f,e,t,i):r(y,m,f,t,e,i);if(void 0!==v){if(v)continue;d=!1;break}if(p){if(!ct(e,(function(t,e){if(!lt(p,e)&&(y===t||o(y,t,n,r,i)))return p.push(e)}))){d=!1;break}}else if(y!==m&&!o(y,m,n,r,i)){d=!1;break}}return i.delete(t),i.delete(e),d},ft=x.Uint8Array,dt=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},pt=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n};var yt=_?_.prototype:void 0,mt=yt?yt.valueOf:void 0;const vt=Array.isArray;var bt=Object.prototype.propertyIsEnumerable,ht=Object.getOwnPropertySymbols;const gt=ht?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}(ht(t),(function(e){return bt.call(t,e)})))}:function(){return[]},St=function(t){return null!=t&&"object"==typeof t},wt=function(t){return St(t)&&"[object Arguments]"==M(t)};var Ot=Object.prototype,jt=Ot.hasOwnProperty,Et=Ot.propertyIsEnumerable,xt=wt(function(){return arguments}())?wt:function(t){return St(t)&&jt.call(t,"callee")&&!Et.call(t,"callee")};const _t=xt;var Pt="object"==typeof exports&&exports&&!exports.nodeType&&exports,At=Pt&&"object"==typeof module&&module&&!module.nodeType&&module,Ct=At&&At.exports===Pt?x.Buffer:void 0;const Rt=(Ct?Ct.isBuffer:void 0)||function(){return!1};var It=/^(?:0|[1-9]\d*)$/;const Tt=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&It.test(t))&&t>-1&&t%1==0&&t<e},Mt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var kt={};kt["[object Float32Array]"]=kt["[object Float64Array]"]=kt["[object Int8Array]"]=kt["[object Int16Array]"]=kt["[object Int32Array]"]=kt["[object Uint8Array]"]=kt["[object Uint8ClampedArray]"]=kt["[object Uint16Array]"]=kt["[object Uint32Array]"]=!0,kt["[object Arguments]"]=kt["[object Array]"]=kt["[object ArrayBuffer]"]=kt["[object Boolean]"]=kt["[object DataView]"]=kt["[object Date]"]=kt["[object Error]"]=kt["[object Function]"]=kt["[object Map]"]=kt["[object Number]"]=kt["[object Object]"]=kt["[object RegExp]"]=kt["[object Set]"]=kt["[object String]"]=kt["[object WeakMap]"]=!1;var Dt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ut=Dt&&"object"==typeof module&&module&&!module.nodeType&&module,Lt=Ut&&Ut.exports===Dt&&j.process,Nt=function(){try{return Ut&&Ut.require&&Ut.require("util").types||Lt&&Lt.binding&&Lt.binding("util")}catch(t){}}(),Vt=Nt&&Nt.isTypedArray;const Bt=Vt?(Ft=Vt,function(t){return Ft(t)}):function(t){return St(t)&&Mt(t.length)&&!!kt[M(t)]};var Ft,zt=Object.prototype.hasOwnProperty;const $t=function(t,e){var n=vt(t),r=!n&&_t(t),o=!n&&!r&&Rt(t),i=!n&&!r&&!o&&Bt(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&&!zt.call(t,l)||u&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Tt(l,c))||a.push(l);return a};var Wt=Object.prototype;const Gt=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object);var qt=Object.prototype.hasOwnProperty;const Ht=function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||Wt))return Gt(t);var e,n,r=[];for(var o in Object(t))qt.call(t,o)&&"constructor"!=o&&r.push(o);return r},Yt=function(t){return null!=(e=t)&&Mt(e.length)&&!D(e)?$t(t):Ht(t);var e},Kt=function(t){return function(t,e,n){var r=e(t);return vt(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,Yt,gt)};var Jt=Object.prototype.hasOwnProperty;const Zt=Y(x,"DataView"),Qt=Y(x,"Promise"),Xt=Y(x,"Set"),te=Y(x,"WeakMap");var ee="[object Map]",ne="[object Promise]",re="[object Set]",oe="[object WeakMap]",ie="[object DataView]",ue=B(Zt),ae=B(K),ce=B(Qt),le=B(Xt),se=B(te),fe=M;(Zt&&fe(new Zt(new ArrayBuffer(1)))!=ie||K&&fe(new K)!=ee||Qt&&fe(Qt.resolve())!=ne||Xt&&fe(new Xt)!=re||te&&fe(new te)!=oe)&&(fe=function(t){var e=M(t),n="[object Object]"==e?t.constructor:void 0,r=n?B(n):"";if(r)switch(r){case ue:return ie;case ae:return ee;case ce:return ne;case le:return re;case se:return oe}return e});const de=fe;var pe="[object Arguments]",ye="[object Array]",me="[object Object]",ve=Object.prototype.hasOwnProperty;const be=function(t,e,n,r,o,i){var u=vt(t),a=vt(e),c=u?ye:de(t),l=a?ye:de(e),s=(c=c==pe?me:c)==me,f=(l=l==pe?me:l)==me,d=c==l;if(d&&Rt(t)){if(!Rt(e))return!1;u=!0,s=!1}if(d&&!s)return i||(i=new it),u||Bt(t)?st(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 ft(t),new ft(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return h(+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=dt;case"[object Set]":var c=1&r;if(a||(a=pt),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=st(a(t),a(e),r,o,i,u);return u.delete(t),s;case"[object Symbol]":if(mt)return mt.call(t)==mt.call(e)}return!1}(t,e,c,n,r,o,i);if(!(1&n)){var p=s&&ve.call(t,"__wrapped__"),y=f&&ve.call(e,"__wrapped__");if(p||y){var m=p?t.value():t,v=y?e.value():e;return i||(i=new it),o(m,v,n,r,i)}}return!!d&&(i||(i=new it),function(t,e,n,r,o,i){var u=1&n,a=Kt(t),c=a.length;if(c!=Kt(e).length&&!u)return!1;for(var l=c;l--;){var s=a[l];if(!(u?s in e:Jt.call(e,s)))return!1}var f=i.get(t),d=i.get(e);if(f&&d)return f==e&&d==t;var p=!0;i.set(t,e),i.set(e,t);for(var y=u;++l<c;){var m=t[s=a[l]],v=e[s];if(r)var b=u?r(v,m,s,e,t,i):r(m,v,s,t,e,i);if(!(void 0===b?m===v||o(m,v,n,r,i):b)){p=!1;break}y||(y="constructor"==s)}if(p&&!y){var h=t.constructor,g=e.constructor;h==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof h&&h instanceof h&&"function"==typeof g&&g instanceof g||(p=!1)}return i.delete(t),i.delete(e),p}(t,e,n,r,o,i))},he=function t(e,n,r,o,i){return e===n||(null==e||null==n||!St(e)&&!St(n)?e!=e&&n!=n:be(e,n,r,o,t,i))},ge=function(t,e){return he(t,e)};function Se(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 we(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 Se(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)?Se(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:[];ge(u,r)||o(u)};return t((0,c.getExtensionStore)().getState()),(0,c.getExtensionStore)().subscribe(t)}),[e,r]),r}function Oe(e){var n=b(),r=we(e);return(0,t.useMemo)((function(){return(0,c.getConnectedExtensions)(r,n)}),[r,n])}function je(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,c.registerExtensionSlot)(r,n)}),[]),{extensions:Oe(n),extensionSlotName:n,extensionSlotModuleName:r}}function Ee(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xe(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){Ee(t,e,n[e])}))}return t}function _e(t){return t}function Pe(n){var r=n.name,o=n.extensionSlotName,i=n.select,u=void 0===i?_e:i,a=n.children,c=n.state,l=n.style,s=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 f,d,p,m,v=null!=r?r:o,b=(0,t.useRef)(null),h=je(v),g=h.extensions,S=h.extensionSlotModuleName,w=(0,t.useMemo)((function(){return u(g)}),[u,g]),O=(0,t.useMemo)((function(){if("function"==typeof a&&!t.default.isValidElement(a))return w.map((function(t){return a(t)}))}),[a,w]);return t.default.createElement("div",xe({ref:b,"data-extension-slot-name":v,"data-extension-slot-module-name":S,style:(p=xe({},l),m={position:"relative"},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(p,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(p,t,Object.getOwnPropertyDescriptor(m,t))})),p)},s),v&&w.map((function(n,r){return t.default.createElement(e.Provider,{key:n.id,value:{moduleName:S,extension:{extensionId:n.id,extensionSlotName:v,extensionSlotModuleName:S}}},null!==(d=null!==(f=null==O?void 0:O[r])&&void 0!==f?f:"function"!=typeof a?a:null)&&void 0!==d?d:t.default.createElement(y,{state:c}))})))}var Ae=s(645);function Ce(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 Re(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ce(Object(n),!0).forEach((function(e){Te(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ie(t){return(Ie="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 Te(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Me(t){return(Me="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 ke(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(Me(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(Me(t)));return t}}var De=null;try{De=require("react").createContext()}catch(Ce){}var Ue={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 Le(t){if("object"!==Ie(t))throw new Error("single-spa-react requires a configuration object");var e=Re(Re({},Ue),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");!De&&e.React.createContext&&(De=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:Ne.bind(null,e),mount:Ve.bind(null,e),unmount:Be.bind(null,e)};return e.parcelCanUpdate&&(n.update=Fe.bind(null,e)),n}function Ne(t,e){return t.rootComponent?Promise.resolve():t.loadRootComponent(e).then((function(e){t.rootComponent=e}))}function Ve(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=We(t,e,(function(){n(this)})),i=ke(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:ze(t),renderType:$e(t)});t.domElements[e.name]=i,t.renderResults[e.name]=u}))}function Be(t,e){return new Promise((function(n){t.unmountResolves[e.name]=n;var r=t.renderResults[e.name];r&&r.unmount?r.unmount():ze(t).unmountComponentAtNode(t.domElements[e.name]),delete t.domElements[e.name],delete t.renderResults[e.name]}))}function Fe(t,e){return new Promise((function(n){t.updateResolves[e.name]||(t.updateResolves[e.name]=[]),t.updateResolves[e.name].push(n);var r=We(t,e,null),o=t.renderResults[e.name];if(o&&o.render)o.render(r);else{var i=ke(t,e)();ze(t).render(r,i)}}))}function ze(t){return t.ReactDOMClient||t.ReactDOM}function $e(t){return"function"==typeof t.renderType?t.renderType():t.renderType}function We(t,e,n){var r=t.React.createElement(t.rootComponent,e),o=De?t.React.createElement(De.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,Re(Re({},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 Ge=s(281);function qe(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 He(t){return He=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},He(t)}function Ye(t,e){return Ye=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ye(t,e)}function Ke(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=He(t);if(e){var o=He(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 Je={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1};function Ze(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},Je,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&&Ye(t,e)}(c,o);var i,u,a=Ke(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(e.Provider,{value:this.state.config},r.disableTranslations?t.default.createElement(n,this.props):t.default.createElement(Ge.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)}}])&&qe(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 Qe(e,n){return Le({React:t.default,ReactDOMClient:Ae,rootComponent:Ze(n)(e)})}function Xe(t,e){return function(){return t().then((function(t){return Qe(t.default,e)}))}}function tn(t,e){return function(){return Promise.resolve(Qe(t,e))}}var en=Xe;function nn(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 rn(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 nn(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)?nn(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,c.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:[];ge(u,r)||o(u)}))}),[]),r}function on(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 un(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 cn(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 un(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)?un(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 ln={},sn='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function fn(e){var r=(0,t.useMemo)(n.getExtensionsConfigStore,[]),o=function(e,r){var o=cn((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&&!ge(e.config,i)&&u(e.config)}))}),[e,r,i]),i}(r,e);if(!o&&e){var i="".concat(e.extensionSlotName,"-").concat(e.extensionId);throw!ln[i]&&r&&(ln[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)),ln[i]}return o||{}}function dn(){var r=(0,t.useContext)(e),o=r.moduleName,i=r.extension;if(!o&&!i)throw Error(sn);var u=function(e){var r=(0,t.useMemo)((function(){return(0,n.getConfigStore)(e)}),[e]),o=e,i=function(e){var n=cn((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 ln[o]||(ln[o]=function(t){return new Promise((function(e){var n=t.subscribe((function(t){t.loaded&&t.config&&(e(t.config),n())}))}))}(r)),ln[o];return i}(o),a=fn(i),c=(0,t.useMemo)((function(){return function(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}({},u,a)}),[u,a]);return c}var pn,yn=s(766);function mn(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 bn(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 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"}(pn||(pn={}));var gn={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function Sn(){var t=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return t&&t[1]}function wn(t,e){switch(e.type){case pn.loadPatient:return hn(bn({},t),{patientUuid:e.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case pn.newPatient:return hn(bn({},t),{patient:e.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case pn.loadError:return hn(bn({},t),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:e.err});default:return t}}function On(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 mn(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)?mn(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)(wn,hn(bn({},gn),{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=Sn();o(t?{type:pn.loadPatient,patientUuid:t}:{type:pn.newPatient,patient:null})}var e=!0;return r.isLoadingPatient&&r.patientUuid&&(0,yn.fetchCurrentPatient)(r.patientUuid).then((function(t){return e&&o({patient:t,type:pn.newPatient})}),(function(t){return e&&o({err:t,type:pn.loadError})})),function(){e=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,t.useEffect)((function(){var t=function(t){var e=Sn();e!=r.patientUuid&&o({type:pn.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 jn=a((0,c.getExtensionInternalStore)());function En(e){var n=Oe(e);return(0,t.useMemo)((function(){return Object.fromEntries(n.map((function(t){return[t.name,t.meta]})))}),[n])}var xn=a((0,c.getExtensionStore)());function _n(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 Pn(){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 _n(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)?_n(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 An(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 Cn(){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 Rn(){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 An(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)?An(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)(Cn),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){var t=function(){r(Cn())};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[]),n}var In=function(t){return"small-desktop"===t||"large-desktop"===t};function Tn(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 Mn(){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 Tn(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)?Tn(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,yn.getLocations)().subscribe((function(t){r(t)}),(function(t){console.error(t)}));return function(){return t.unsubscribe()}}),[]),n}function kn(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 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}var Un,Ln,Nn=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 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)(null),2),u=i[0],a=i[1];return(0,t.useEffect)((function(){var t=(0,yn.getCurrentUser)({includeAuthStatus:!1}).subscribe(a);return function(){return t.unsubscribe()}}),[]),u&&(0,yn.userHasAccess)(n,u)?t.default.createElement(t.default.Fragment,null,o):r?t.default.createElement(t.default.Fragment,null,r):null};function Vn(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 Bn(){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 Vn(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)?Vn(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(Un){var i=(0,yn.getSessionStore)().getState();i.loaded&&(o=i.session)}else Un=new Promise((function(t){var e=function(e){var n=e.loaded,r=e.session;n&&(t(r),o=r,Ln&&Ln(),Ln=void 0)};e((0,yn.getSessionStore)().getState()),o||(Ln=(0,yn.getSessionStore)().subscribe(e))}));if(!o)throw Un;r(o)}(0,t.useEffect)((function(){return Ln||(Ln=(0,yn.getSessionStore)().subscribe((function(t){var e=t.loaded,n=t.session;e&&(o=n,r(n))}))),function(){Ln&&Ln(),Ln=void 0}}),[]);var u=n||o;if(!u)throw Un?(console.warn("useSession is in an unexpected state. Attempting to recover."),Un):Error("useSession is in an invalid state.");return u}var Fn=s(385);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 $n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wn(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}}var Gn=function(t){return t};function qn(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gn,r=arguments.length>2?arguments[2]:void 0,o=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)||Wn(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)((function(){return n(e.getState())})),2),i=o[0],u=o[1];(0,t.useEffect)((function(){return(0,Fn.subscribeTo)(e,n,u)}),[e,n]);var a=(0,t.useMemo)((function(){return r?function(t,e){var n=function(n){o[n]=function(){var o=r;t.setState((function(t){for(var r,i=[t],u=0;u<o.length;u++)i.push(o[u]);return(r=e)[n].apply(r,function(t){if(Array.isArray(t))return zn(t)}(a=i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||Wn(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}))}},r=arguments;"function"==typeof e&&(e=e(t));var o={};for(var i in e)n(i);return o}(e,r):{}}),[e,r]);return function(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){$n(t,e,n[e])}))}return t}({},i,a)}function Hn(t,e){return qn(t,Gn,e)}var Yn=s(374);const Kn=new WeakMap,Jn={},Zn=()=>{},Qn=Zn(),Xn=Object,tr=t=>t===Qn,er=t=>"function"==typeof t,nr=(t,e)=>({...t,...e}),rr="undefined",or=typeof window!=rr,ir=typeof document!=rr,ur=(t,e)=>{const n=Kn.get(t);return[()=>t.get(e)||Jn,r=>{const o=t.get(e);n[5](e,nr(o,r),o||Jn)},n[6]]},ar=new WeakMap;let cr=0;const lr=t=>{const e=typeof t,n=t&&t.constructor,r=n==Date;let o,i;if(Xn(t)!==t||r||n==RegExp)o=r?t.toJSON():"symbol"==e?t.toString():"string"==e?JSON.stringify(t):""+t;else{if(o=ar.get(t),o)return o;if(o=++cr+"~",ar.set(t,o),n==Array){for(o="@",i=0;i<t.length;i++)o+=lr(t[i])+",";ar.set(t,o)}if(n==Xn){o="#";const e=Xn.keys(t).sort();for(;!tr(i=e.pop());)tr(t[i])||(o+=i+":"+lr(t[i])+",");ar.set(t,o)}}return o};let sr=!0;const[fr,dr]=or&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Zn,Zn],pr={isOnline:()=>sr,isVisible:()=>{const t=ir&&document.visibilityState;return tr(t)||"hidden"!==t}},yr={initFocus:t=>(ir&&document.addEventListener("visibilitychange",t),fr("focus",t),()=>{ir&&document.removeEventListener("visibilitychange",t),dr("focus",t)}),initReconnect:t=>{const e=()=>{sr=!0,t()},n=()=>{sr=!1};return fr("online",e),fr("offline",n),()=>{dr("online",e),dr("offline",n)}}},mr=!t.default.useId,vr=!or||"Deno"in window,br=vr?t.useEffect:t.useLayoutEffect,hr="undefined"!=typeof navigator&&navigator.connection,gr=!vr&&hr&&(["slow-2g","2g"].includes(hr.effectiveType)||hr.saveData),Sr=t=>{if(er(t))try{t=t()}catch(e){t=""}const e=t;return[t="string"==typeof t?t:(Array.isArray(t)?t.length:t)?lr(t):"",e]};let wr=0;const Or=()=>++wr;async function jr(...t){const[e,n,r,o]=t,i=nr({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let u=i.populateCache;const a=i.rollbackOnError;let c=i.optimisticData;const l=!1!==i.revalidate,s=i.throwOnError;if(er(n)){const t=n,r=[],o=e.keys();for(let n=o.next();!n.done;n=o.next()){const o=n.value;!o.startsWith("$inf$")&&t(e.get(o)._k)&&r.push(o)}return Promise.all(r.map(f))}return f(n);async function f(n){const[o]=Sr(n);if(!o)return;const[i,f]=ur(e,o),[d,p,y]=Kn.get(e),m=d[o],v=()=>l&&(delete y[o],m&&m[0])?m[0](2).then((()=>i().data)):i().data;if(t.length<3)return v();let b,h=r;const g=Or();p[o]=[g,0];const S=!tr(c),w=i(),O=w.data,j=w._c,E=tr(j)?O:j;if(S&&(c=er(c)?c(E):c,f({data:c,_c:E})),er(h))try{h=h(E)}catch(t){b=t}if(h&&er(h.then)){if(h=await h.catch((t=>{b=t})),g!==p[o][0]){if(b)throw b;return h}b&&S&&(t=>"function"==typeof a?a(t):!1!==a)(b)&&(u=!0,h=E,f({data:h,_c:Qn}))}u&&(b||(er(u)&&(h=u(h,E)),f({data:h,_c:Qn}))),p[o][1]=Or();const x=await v();if(f({_c:Qn}),!b)return u?x:h;if(s)throw b}}const Er=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},xr=(t,e)=>{if(!Kn.has(t)){const n=nr(yr,e),r={},o=jr.bind(Qn,t);let i=Zn;const u={},a=(t,e)=>{const n=u[t]||[];return u[t]=n,n.push(e),()=>n.splice(n.indexOf(e),1)},c=(e,n,r)=>{t.set(e,n);const o=u[e];if(o)for(let t=o.length;t--;)o[t](r,n)},l=()=>{if(!Kn.has(t)&&(Kn.set(t,[r,{},{},{},o,c,a]),!vr)){const e=n.initFocus(setTimeout.bind(Qn,Er.bind(Qn,r,0))),o=n.initReconnect(setTimeout.bind(Qn,Er.bind(Qn,r,1)));i=()=>{e&&e(),o&&o(),Kn.delete(t)}}};return l(),[t,o,l,i]}return[t,Kn.get(t)[4]]},[_r,Pr]=xr(new Map),Ar=nr({onLoadingSlow:Zn,onSuccess:Zn,onError:Zn,onErrorRetry:(t,e,n,r,o)=>{const i=n.errorRetryCount,u=o.retryCount,a=~~((Math.random()+.5)*(1<<(u<8?u:8)))*n.errorRetryInterval;!tr(i)&&u>i||setTimeout(r,a,o)},onDiscarded:Zn,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:gr?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:gr?5e3:3e3,compare:(t,e)=>lr(t)==lr(e),isPaused:()=>!1,cache:_r,mutate:Pr,fallback:{}},pr),Cr=(t,e)=>{const n=nr(t,e);if(e){const{use:r,fallback:o}=t,{use:i,fallback:u}=e;r&&i&&(n.use=r.concat(i)),o&&u&&(n.fallback=nr(o,u))}return n},Rr=(0,t.createContext)({}),Ir=or&&window.__SWR_DEVTOOLS_USE__,Tr=Ir?window.__SWR_DEVTOOLS_USE__:[],Mr=Tr.concat((t=>(e,n,r)=>t(e,n&&((...t)=>{const r=Sr(e)[0],[,,,o]=Kn.get(_r),i=o[r];return i?(delete o[r],i):n(...t)}),r)));Ir&&(window.__SWR_DEVTOOLS_REACT__=t.default);const kr={dedupe:!0};Xn.defineProperty((e=>{const{value:n}=e,r=(0,t.useContext)(Rr),o=er(n),i=(0,t.useMemo)((()=>o?n(r):n),[o,r,n]),u=(0,t.useMemo)((()=>o?i:Cr(r,i)),[o,r,i]),a=i&&i.provider,[c]=(0,t.useState)((()=>a?xr(a(u.cache||_r),i):Qn));return c&&(u.cache=c[0],u.mutate=c[1]),br((()=>{if(c)return c[2]&&c[2](),c[3]}),[]),(0,t.createElement)(Rr.Provider,nr(e,{value:u}))}),"defaultValue",{value:Ar});var Dr,Ur=(Dr=(e,n,r)=>{const{cache:o,compare:i,suspense:u,fallbackData:a,revalidateOnMount:c,refreshInterval:l,refreshWhenHidden:s,refreshWhenOffline:f,keepPreviousData:d}=r,[p,y,m]=Kn.get(o),[v,b]=Sr(e),h=(0,t.useRef)(!1),g=(0,t.useRef)(!1),S=(0,t.useRef)(v),w=(0,t.useRef)(n),O=(0,t.useRef)(r),j=()=>O.current,E=()=>j().isVisible()&&j().isOnline(),[x,_,P]=ur(o,v),A=(0,t.useRef)({}).current,C=tr(a)?r.fallback[v]:a,R=(t,e)=>{let n=!0;for(const r in A){const o=r;i(e[o],t[o])||"data"===o&&tr(t[o])&&i(e[o],N)||(n=!1)}return n},I=(0,t.useMemo)((()=>{const t=!!v&&!!n&&(tr(c)?!j().isPaused()&&!u:c),e=()=>{const e=x(),n=nr(e);return delete n._k,t?{isValidating:!0,isLoading:!0,...n}:n};let r=e();return()=>{const t=e();return R(t,r)?r:r=t}}),[o,v]),T=(0,Yn.useSyncExternalStore)((0,t.useCallback)((t=>P(v,((e,n)=>{R(e,n)||t()}))),[o,v]),I,I),M=!h.current,k=T.data,D=tr(k)?C:k,U=T.error,L=(0,t.useRef)(D),N=d?tr(k)?L.current:k:D,V=M&&!tr(c)?c:!j().isPaused()&&(u?!tr(D)&&r.revalidateIfStale:tr(D)||r.revalidateIfStale),B=!!(v&&n&&M&&V),F=tr(T.isValidating)?B:T.isValidating,z=tr(T.isLoading)?B:T.isLoading,$=(0,t.useCallback)((async t=>{const e=w.current;if(!v||!e||g.current||j().isPaused())return!1;let n,o,u=!0;const a=t||{},c=!m[v]||!a.dedupe,l=()=>mr?!g.current&&v===S.current&&h.current:v===S.current,s={isValidating:!1,isLoading:!1},f=()=>{_(s)},d=()=>{const t=m[v];t&&t[1]===o&&delete m[v]},p={isValidating:!0};tr(x().data)&&(p.isLoading=!0);try{if(c&&(_(p),r.loadingTimeout&&tr(x().data)&&setTimeout((()=>{u&&l()&&j().onLoadingSlow(v,r)}),r.loadingTimeout),m[v]=[e(b),Or()]),[n,o]=m[v],n=await n,c&&setTimeout(d,r.dedupingInterval),!m[v]||m[v][1]!==o)return c&&l()&&j().onDiscarded(v),!1;s.error=Qn;const t=y[v];if(!tr(t)&&(o<=t[0]||o<=t[1]||0===t[1]))return f(),c&&l()&&j().onDiscarded(v),!1;const a=x().data;s.data=i(a,n)?a:n,c&&l()&&j().onSuccess(n,v,r)}catch(t){d();const e=j(),{shouldRetryOnError:n}=e;e.isPaused()||(s.error=t,c&&l()&&(e.onError(t,v,e),(!0===n||er(n)&&n(t))&&E()&&e.onErrorRetry(t,v,e,$,{retryCount:(a.retryCount||0)+1,dedupe:!0})))}return u=!1,f(),!0}),[v,o]),W=(0,t.useCallback)(((...t)=>jr(o,S.current,...t)),[]);if(br((()=>{w.current=n,O.current=r,tr(k)||(L.current=k)})),br((()=>{if(!v)return;const t=$.bind(Qn,kr);let e=0;const n=((t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const t=r.indexOf(n);t>=0&&(r[t]=r[r.length-1],r.pop())}})(v,p,(n=>{if(0==n){const n=Date.now();j().revalidateOnFocus&&n>e&&E()&&(e=n+j().focusThrottleInterval,t())}else if(1==n)j().revalidateOnReconnect&&E()&&t();else if(2==n)return $()}));return g.current=!1,S.current=v,h.current=!0,_({_k:b}),V&&(tr(D)||vr?t():(t=>{or&&typeof window.requestAnimationFrame!=rr?window.requestAnimationFrame(t):setTimeout(t,1)})(t)),()=>{g.current=!0,n()}}),[v]),br((()=>{let t;function e(){const e=er(l)?l(D):l;e&&-1!==t&&(t=setTimeout(n,e))}function n(){x().error||!s&&!j().isVisible()||!f&&!j().isOnline()?e():$(kr).then(e)}return e(),()=>{t&&(clearTimeout(t),t=-1)}}),[l,s,f,v]),(0,t.useDebugValue)(N),u&&tr(D)&&v){if(!mr&&vr)throw new Error("Fallback data is required when using suspense in SSR.");throw w.current=n,O.current=r,g.current=!1,tr(U)?$(kr):U}return{mutate:W,get data(){return A.data=!0,N},get error(){return A.error=!0,U},get isValidating(){return A.isValidating=!0,F},get isLoading(){return A.isLoading=!0,z}}},function(...e){const n=nr(Ar,(0,t.useContext)(Rr)),[r,o,i]=(t=>er(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(null===t[1]?t[2]:t[1])||{}])(e),u=Cr(n,i);let a=Dr;const{use:c}=u,l=(c||[]).concat(Mr);for(let t=l.length;t--;)a=l[t](a);return a(r,o||u.fetcher||null,u)}),Lr=s(688),Nr=s(332),Vr=s.n(Nr);function Br(e){var n,r=qn((0,yn.getVisitStore)()),o=r.patientUuid,i=r.manuallySetVisitUuid,u=e&&o==e?i:null,a=u?"/".concat(u):"?patient=".concat(e,"&v=").concat(yn.defaultVisitCustomRepresentation,"&includeInactive=false"),c=Ur(e?"/ws/rest/v1/visit".concat(a):null,yn.openmrsFetch),l=c.data,s=c.error;return{error:s,mutate:c.mutate,isValidating:c.isValidating,currentVisit:(0,t.useMemo)((function(){return u?null==l?void 0:l.data:null!==(n=null==l?void 0:l.data.results.find((function(t){return null===t.stopDatetime})))&&void 0!==n?n:null}),[l]),isRetrospective:Boolean(u),isLoading:!l&&!s}}function Fr(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 zr(){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 Fr(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)?Fr(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,yn.getVisitTypes)().subscribe((function(t){r(t)}),(function(t){return console.error(t)}));return function(){return t.unsubscribe()}}),[]),n}function $r(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}Lr.default.extend(Vr());var Wr=10;function Gr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wr,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 $r(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)?$r(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]);return{results:(0,t.useMemo)((function(){var t=(o-1)*n,r=(o+0)*n;return e.slice(t,r)}),[e,o,n]),totalPages:u,currentPage:o,paginated:e.length>n,showNextButton:o<u,showPreviousButton:o>1,goTo:function(t){i(Math.max(1,Math.min(u,t)))},goToNext:function(){o<u&&i(o+1)},goToPrevious:function(){o>1&&i(o-1)}}}})(),f})())}}}));
3
3
  //# sourceMappingURL=openmrs-esm-react-utils.js.map