@openmrs/esm-config 5.3.3-pre.1421 → 5.3.3-pre.1425

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,8 +1,8 @@
1
- @openmrs/esm-config:build: cache hit, replaying output 77fc06c332b95e4f
2
- @openmrs/esm-config:build: asset openmrs-esm-module-config.js 25.3 KiB [emitted] [minimized] (name: main) 1 related asset
3
- @openmrs/esm-config:build: orphan modules 377 KiB [orphan] 335 modules
1
+ @openmrs/esm-config:build: cache hit, replaying output 7a8183253b1a79ea
2
+ @openmrs/esm-config:build: asset openmrs-esm-module-config.js 26.3 KiB [emitted] [minimized] (name: main) 1 related asset
3
+ @openmrs/esm-config:build: orphan modules 381 KiB [orphan] 335 modules
4
4
  @openmrs/esm-config:build: runtime modules 670 bytes 3 modules
5
- @openmrs/esm-config:build: built modules 79.6 KiB [built]
6
- @openmrs/esm-config:build:  ./src/index.ts + 36 modules 79.5 KiB [built] [code generated]
5
+ @openmrs/esm-config:build: built modules 82.6 KiB [built]
6
+ @openmrs/esm-config:build:  ./src/index.ts + 36 modules 82.6 KiB [built] [code generated]
7
7
  @openmrs/esm-config:build:  external "@openmrs/esm-state" 42 bytes [built] [code generated]
8
- @openmrs/esm-config:build: webpack 5.88.0 compiled successfully in 7380 ms
8
+ @openmrs/esm-config:build: webpack 5.88.0 compiled successfully in 7414 ms
@@ -1,2 +1,2 @@
1
- System.register(["@openmrs/esm-state"],(function(e,t){var n={};return{setters:[function(e){n.createGlobalStore=e.createGlobalStore,n.getGlobalStore=e.getGlobalStore}],execute:function(){e((()=>{"use strict";var e={685:e=>{e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{function e(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function t(t){return function n(r){return 0===arguments.length||e(r)?n:t.apply(this,arguments)}}function n(n){return function r(o,a){switch(arguments.length){case 0:return r;case 1:return e(o)?r:t((function(e){return n(o,e)}));default:return e(o)&&e(a)?r:e(o)?t((function(e){return n(e,a)})):e(a)?t((function(e){return n(o,e)})):n(o,a)}}}function a(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function i(e,t,n){for(var r=0,o=n.length;r<o;){if(e(t,n[r]))return!0;r+=1}return!1}function c(e,t){return Object.prototype.hasOwnProperty.call(t,e)}r.r(o),r.d(o,{Type:()=>R,clearConfigErrors:()=>Fe,configExtensionStore:()=>Q,configInternalStore:()=>H,defineConfigSchema:()=>pe,defineExtensionConfigSchema:()=>be,getConfig:()=>me,getConfigInternal:()=>Se,getConfigStore:()=>V,getExtensionConfig:()=>ne,getExtensionConfigFromStore:()=>re,getExtensionSlotConfig:()=>Z,getExtensionSlotConfigFromStore:()=>ee,getExtensionSlotsConfigStore:()=>Y,getExtensionsConfigStore:()=>te,implementerToolsConfigStore:()=>oe,inRange:()=>$e,isUrl:()=>Je,isUrlWithTemplateParameters:()=>ze,oneOf:()=>Le,processConfig:()=>Oe,provide:()=>he,temporaryConfigStore:()=>K,validator:()=>B,validators:()=>Xe});const u="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var s=Object.prototype.toString,l=function(){return"[object Arguments]"===s.call(arguments)?function(e){return"[object Arguments]"===s.call(e)}:function(e){return c("callee",e)}}();const f=l;var y=!{toString:null}.propertyIsEnumerable("toString"),d=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],v=function(){return arguments.propertyIsEnumerable("length")}(),g=function(e,t){for(var n=0;n<e.length;){if(e[n]===t)return!0;n+=1}return!1};const p="function"!=typeof Object.keys||v?t((function(e){if(Object(e)!==e)return[];var t,n,r=[],o=v&&f(e);for(t in e)!c(t,e)||o&&"length"===t||(r[r.length]=t);if(y)for(n=d.length-1;n>=0;)c(t=d[n],e)&&!g(r,t)&&(r[r.length]=t),n-=1;return r})):t((function(e){return Object(e)!==e?[]:Object.keys(e)})),b=t((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function h(e,t,n,r){var o=a(e);function c(e,t){return m(e,t,n.slice(),r.slice())}return!i((function(e,t){return!i(c,t,e)}),a(t),o)}function m(e,t,n,r){if(u(e,t))return!0;var o,a,i=b(e);if(i!==b(t))return!1;if(null==e||null==t)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(o=e.constructor,null==(a=String(o).match(/^function (\w*)/))?"":a[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!u(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!u(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var s=n.length-1;s>=0;){if(n[s]===e)return r[s]===t;s-=1}switch(i){case"Map":return e.size===t.size&&h(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&h(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var l=p(e);if(l.length!==p(t).length)return!1;var f=n.concat([e]),y=r.concat([t]);for(s=l.length-1;s>=0;){var d=l[s];if(!c(d,t)||!m(t[d],e[d],f,y))return!1;s-=1}return!0}const S=n((function(e,t){return m(e,t,[],[])}));function O(r){return function o(a,i,c){switch(arguments.length){case 0:return o;case 1:return e(a)?o:n((function(e,t){return r(a,e,t)}));case 2:return e(a)&&e(i)?o:e(a)?n((function(e,t){return r(e,i,t)})):e(i)?n((function(e,t){return r(a,e,t)})):t((function(e){return r(a,i,e)}));default:return e(a)&&e(i)&&e(c)?o:e(a)&&e(i)?n((function(e,t){return r(e,t,c)})):e(a)&&e(c)?n((function(e,t){return r(e,i,t)})):e(i)&&e(c)?n((function(e,t){return r(a,e,t)})):e(a)?t((function(e){return r(e,i,c)})):e(i)?t((function(e){return r(a,e,c)})):e(c)?t((function(e){return r(a,i,e)})):r(a,i,c)}}}function j(e){return"[object Object]"===Object.prototype.toString.call(e)}const w=O((function(e,t,n){var r,o={};for(r in t)c(r,t)&&(o[r]=c(r,n)?e(r,t[r],n[r]):t[r]);for(r in n)c(r,n)&&!c(r,o)&&(o[r]=n[r]);return o})),x=O((function e(t,n,r){return w((function(n,r,o){return j(r)&&j(o)?e(t,r,o):t(n,r,o)}),n,r)})),A=n((function(e,t){return x((function(e,t,n){return n}),e,t)})),_=n((function(e,t){for(var n={},r={},o=0,a=e.length;o<a;)r[e[o]]=1,o+=1;for(var i in t)r.hasOwnProperty(i)||(n[i]=t[i]);return n}));function P(e,t,n,r){var o,a=function(o){for(var a=t.length,i=0;i<a;){if(e===t[i])return n[i];i+=1}for(var c in t[i+1]=e,n[i+1]=o,e)o[c]=r?P(e[c],t,n,!0):e[c];return o};switch(b(e)){case"Object":return a({});case"Array":return a([]);case"Date":return new Date(e.valueOf());case"RegExp":return o=e,new RegExp(o.source,(o.global?"g":"")+(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.sticky?"y":"")+(o.unicode?"u":""));default:return e}}const k=t((function(e){return null!=e&&"function"==typeof e.clone?e.clone():P(e,[],[],!0)})),I=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)},E=t((function(e){return!!I(e)||!!e&&"object"==typeof e&&!function(e){return"[object String]"===Object.prototype.toString.call(e)}(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1))}));var C=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),U=n((function(e,t){return function(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,o){return t.apply(this,arguments)};case 5:return function(e,n,r,o,a){return t.apply(this,arguments)};case 6:return function(e,n,r,o,a,i){return t.apply(this,arguments)};case 7:return function(e,n,r,o,a,i,c){return t.apply(this,arguments)};case 8:return function(e,n,r,o,a,i,c,u){return t.apply(this,arguments)};case 9:return function(e,n,r,o,a,i,c,u,s){return t.apply(this,arguments)};case 10:return function(e,n,r,o,a,i,c,u,s,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}(e.length,(function(){return e.apply(t,arguments)}))}));const T=U;function D(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function N(e,t,n,r){return e["@@transducer/result"](n[r](T(e["@@transducer/step"],e),t))}var q="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function G(e,t,n){if("function"==typeof e&&(e=function(e){return new C(e)}(e)),E(n))return function(e,t,n){for(var r=0,o=n.length;r<o;){if((t=e["@@transducer/step"](t,n[r]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r+=1}return e["@@transducer/result"](t)}(e,t,n);if("function"==typeof n["fantasy-land/reduce"])return N(e,t,n,"fantasy-land/reduce");if(null!=n[q])return D(e,t,n[q]());if("function"==typeof n.next)return D(e,t,n);if("function"==typeof n.reduce)return N(e,t,n,"reduce");throw new TypeError("reduce: list must be array or iterable")}const M=O(G);var R;function B(e,t){return function(n){if(!e(n))return"function"==typeof t?t(n):t}}!function(e){e.Array="Array",e.Boolean="Boolean",e.ConceptUuid="ConceptUuid",e.Number="Number",e.Object="Object",e.String="String",e.UUID="UUID",e.PersonAttributeTypeUuid="PersonAttributeTypeUuid",e.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid"}(R||(R={}));var F=B((function(e){return Array.isArray(e)}),"must be an array"),W=B((function(e){return"boolean"==typeof e}),"must be a boolean"),$=B((function(e){return"number"==typeof e}),"must be a number"),z=B((function(e){return"string"==typeof e}),"must be a string"),J=B((function(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}),"must be an object (not an array or null)"),L=B((function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e)}),"must be a valid UUID or a 36-character hexadecimal string"),X=r(685),H=(0,X.createGlobalStore)("config-internal",{providedConfigs:[],schemas:{}}),K=(0,X.createGlobalStore)("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});K.subscribe((function(e){var t;t=e.config,localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}));var Q=(0,X.createGlobalStore)("config-store-of-extension-state",{mountedExtensions:[]});function V(e){return(0,X.getGlobalStore)("config-module-".concat(e),{config:null,loaded:!1})}function Y(){return(0,X.getGlobalStore)("config-extension-slots",{slots:{}})}function Z(e){return ee(Y().getState(),e)}function ee(e,t){var n=e.slots[t];return null!=n?n:{loaded:!1,config:{}}}function te(){return(0,X.getGlobalStore)("config-extensions",{configs:{}})}function ne(e,t){var n=Object.assign({},re(te().getState(),e,t));return n.config=_(["Display conditions","Translation overrides"],n.config),n}function re(e,t,n){var r,o=null===(r=e.configs[t])||void 0===r?void 0:r[n];return null!=o?o:{loaded:!1,config:null}}var oe=(0,X.createGlobalStore)("config-implementer-tools",{config:{}});function ae(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 ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ce(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){ie(e,t,n[t])}))}return e}function ue(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 se(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,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}(e,t)||fe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function le(e){return function(e){if(Array.isArray(e))return ae(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fe(e)||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.")}()}function fe(e,t){if(e){if("string"==typeof e)return ae(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)?ae(e,t):void 0}}function ye(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=Object.keys(e.schemas)[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var c=a.value,u=ke(c,e,t);V(c).setState({loaded:!0,config:u})}}catch(e){r=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}}function de(e,t){var n,r,o=(n=Ee(_e(e,t)),function(e){var t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(e)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=se(o.value,2),c=i[0],u=i[1],s=!0,l=!1,f=void 0;try{for(var y,d=Object.entries(u)[Symbol.iterator]();!(s=(y=d.next()).done);s=!0){var v=se(y.value,2),g=v[0];Ae(v[1],c,g)}}catch(e){l=!0,f=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw f}}}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}(r=Object.keys(n).reduce((function(e,t){var r,o;return(null===(r=n[t])||void 0===r?void 0:r.extensionSlots)&&(e[t]=null===(o=n[t])||void 0===o?void 0:o.extensionSlots),e}),{})),Object.keys(r).reduce((function(e,t){return ce({},e,r[t])}),{})),a=Object.fromEntries(Object.entries(o).map((function(e){var t=se(e,2);return[t[0],{loaded:!0,config:t[1]}]}))),i=Y(),c=i.getState(),u={slots:ce({},c.slots,a)};S(c,u)||i.setState(u)}function ve(e,t){var n=function(e,t){var n=we(k(e.schemas)),r=le(e.providedConfigs.map((function(e){return[e.config,e.source]}))).concat([[t.config,"temporary config"]]),o=!0,a=!1,i=void 0;try{for(var c,u=r[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var s=se(c.value,2);n=Ee([n,xe(s[0],s[1])])}}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}return n}(e,t);oe.setState({config:n})}function ge(e,t,n){var r={},o=!0,a=!1,i=void 0;try{for(var c,u=t.mountedExtensions[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var s=c.value,l=je(s.slotModuleName,s.extensionModuleName,s.slotName,s.extensionId,e,n);r[s.slotName]=ue(ce({},r[s.slotName]),ie({},s.extensionId,{config:l,loaded:!0}))}}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}te().setState({configs:r})}function pe(e,t){Pe(e,t);var n=A(t,We),r=H.getState();H.setState({schemas:ue(ce({},r.schemas),ie({},e,n))})}function be(e,t){Pe(e,t);var n=A(t,We),r=H.getState();r.schemas[e]&&console.error("Config schema for extension ".concat(e," already exists. If there are multiple extensions with this same name, one will probably crash.")),H.setState({schemas:ue(ce({},r.schemas),ie({},e,n))})}function he(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"provided",n=H.getState();H.setState({providedConfigs:le(n.providedConfigs).concat([{source:t,config:e}])})}function me(e){return new Promise((function(t){var n=function(e){if(e.loaded&&e.config){var n=_(["Display conditions","Translation overrides"],e.config);t(n),o&&o()}},r=V(e);n(r.getState());var o=r.subscribe(n)}))}function Se(e){return new Promise((function(t){var n=function(e){if(e.loaded&&e.config){var n=e.config;t(n),o&&o()}},r=V(e);n(r.getState());var o=r.subscribe(n)}))}function Oe(e,t,n){Ce(e,t,n);var r=qe(e,t);return Te(e,r,n),r}function je(e,t,n,r,o,a){var i,c,u,s,l=function(e){return se(e.split("#"),1)[0]}(r),f=o.schemas[l],y=f?l:t,d=_e(o,a),v=Ie(e,d),g=null!==(s=null==v||null===(i=v.extensionSlots)||void 0===i||null===(c=i[n])||void 0===c||null===(u=c.configure)||void 0===u?void 0:u[r])&&void 0!==s?s:{},p=Ee([Ie(y,d),g]),b=null!=f?f:o.schemas[t];Ce(b,p,y);var h=qe(b,p);return Te(b,h,y),delete h.extensionSlots,h}function we(e){return e.hasOwnProperty("_default")?ue(ce({},e),{_value:e._default,_source:"default"}):Me(e)?Object.keys(e).reduce((function(t,n){return t[n]=we(e[n]),t}),{}):{}}function xe(e,t){return Me(e)?Object.keys(e).reduce((function(n,r){return n[r]=xe(e[r],t),n}),{}):{_value:e,_source:t}}function Ae(e,t,n){var r="".concat(t,".extensionSlots.").concat(n),o="Extension slot config '".concat(r,"'"),a=Object.keys(e).filter((function(e){return!["add","remove","order","configure"].includes(e)}));a.length&&Be(r,o+"' contains invalid keys '".concat(a.join("', '"),"'")),e.add&&(Array.isArray(e.add)&&e.add.every((function(e){return"string"==typeof e}))||Be(r,o+".add' is invalid. Must be an array of strings (extension IDs)")),e.remove&&(Array.isArray(e.remove)&&e.remove.every((function(e){return"string"==typeof e}))||Be(r,o+".remove' is invalid. Must be an array of strings (extension IDs)")),e.order&&(Array.isArray(e.order)&&e.order.every((function(e){return"string"==typeof e}))||Be(r,o+".order' is invalid. Must be an array of strings (extension IDs)")),e.configure&&(Me(e.configure)||Be(r,o+".configure' is invalid. Must be an object with extension IDs for keys"))}function _e(e,t){return le(e.providedConfigs.map((function(e){return e.config}))).concat([t.config])}function Pe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="Please verify that you are running the latest version and, if so, alert the maintainer.",o=!0,a=!1,i=void 0;try{for(var c,u=function(){var o=c.value,a=n+(n&&".")+o,i=t[o];if("Display conditions"===a&&console.error("".concat(e,' declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ').concat(r)),"Translation overrides"===a&&console.error("".concat(e,' declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ').concat(r)),!Me(i))return console.error("".concat(e," has bad config schema definition for key '").concat(a,"'. ").concat(r)),"continue";i.hasOwnProperty("_default")||Pe(e,i,a);var u=i._elements;if(Ge(u)&&Pe(e,u,a+"._elements"),i._validators){var s=!0,l=!1,f=void 0;try{for(var y,d=i._validators[Symbol.iterator]();!(s=(y=d.next()).done);s=!0){var v=y.value;"function"!=typeof v&&console.error("".concat(e," has invalid validator for key '").concat(a,"' ").concat(r,".")+"\n\nIf you're the maintainer: validators must be functions that return either "+"undefined or an error string. Received ".concat(v,"."))}}catch(e){l=!0,f=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw f}}}var g=i._type;g&&!Object.values(R).includes(g)&&console.error("".concat(e," has invalid type for key '").concat(a,"' ").concat(r,".")+"\n\nIf you're the maintainer: the allowed types are ".concat(Object.values(R).join(", "),". ")+"Received '".concat(g,"'")),Object.keys(i).every((function(e){return["_description","_validators","_elements","_type"].includes(e)}))&&!n.includes("._elements")&&console.error("".concat(e," has bad config schema definition for key '").concat(a,"'. ").concat(r,".")+"\n\nIf you're the maintainer: all config elements must have a default. "+"Received ".concat(JSON.stringify(i))),u&&g&&![R.Array,R.Object].includes(g)&&console.error("".concat(e," has bad config schema definition for key '").concat(a,"'. ").concat(r,".")+"\n\nIf you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. "+"Received ".concat(JSON.stringify(g)))},s=Object.keys(t).filter((function(e){return!e.startsWith("_")}))[Symbol.iterator]();!(o=(c=s.next()).done);o=!0)u()}catch(e){a=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(a)throw i}}}function ke(e,t,n){if(!t.schemas.hasOwnProperty(e))throw Error("No config schema has been defined for "+e);var r=t.schemas[e],o=Ie(e,_e(t,n));Ce(r,o,e);var a=qe(r,o);return Te(r,a,e),delete a.extensionSlots,a}function Ie(e,t){return Ee(t.map((function(t){return t[e]})).filter((function(e){return!!e})))}function Ee(e){return M(A)({},e)}function Ce(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=!0,o=!1,a=void 0;try{for(var i,c=Object.keys(t)[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=i.value,s=t[u],l=n+"."+u,f=e[u];e.hasOwnProperty(u)?Ue(f,s,l):"extensionSlots"===u&&""!==n||Be(l,"Unknown config key '".concat(l,"' provided. Ignoring."))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}function Ue(e,t,n){De(n,e._type,t),Me(t)?e._type===R.Object?function(e,t,n){if(e._elements){var r=!0,o=!1,a=void 0;try{for(var i,c=Object.keys(t)[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=i.value,s=t[u];Ce(e._elements,s,"".concat(n,".").concat(u))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}}(e,t,n):e.hasOwnProperty("_default")||Ce(e,t,n):e._type===R.Array&&function(e,t,n){if(Ge(e._elements))for(var r=0;r<t.length;r++)Ue(e._elements,t[r],"".concat(n,"[").concat(r,"]"));for(var o=0;o<t.length;o++){var a;De("".concat(n,"[").concat(o,"]"),null===(a=e._elements)||void 0===a?void 0:a._type,t[o])}}(e,t,n)}function Te(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(e)if(t!==e._default&&Ne(n,e._validators,t),Me(t)){var r=!0,o=!1,a=void 0;try{for(var i,c=Object.keys(t)[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=i.value,s=t[u],l=n+"."+u,f=e[u];e._type===R.Object&&e._elements?Te(e._elements,s,l):Te(f,s,l)}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}else if(Array.isArray(t)&&e._elements)for(var y=0;y<t.length;y++)Te(e._elements,t[y],"".concat(n,"[").concat(y,"]"))}function De(e,t,n){t&&Ne(e,[{Array:F,Boolean:W,ConceptUuid:L,Number:$,Object:J,String:z,UUID:L,PersonAttributeTypeUuid:L,PatientIdentifierTypeUuid:L}[t]],n)}function Ne(e,t,n){if(t)try{var r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=(0,i.value)(n);"string"==typeof u&&Be(e,"object"==typeof n?"Invalid configuration for ".concat(e,": ").concat(u):"Invalid configuration value ".concat(n," for ").concat(e,": ").concat(u))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}catch(t){console.error('Skipping invalid validator at "'.concat(e,'". Encountered error\n\t').concat(t))}}ye(H.getState(),K.getState()),H.subscribe((function(e){return ye(e,K.getState())})),K.subscribe((function(e){return ye(H.getState(),e)})),ve(H.getState(),K.getState()),H.subscribe((function(e){return ve(e,K.getState())})),K.subscribe((function(e){return ve(H.getState(),e)})),de(H.getState(),K.getState()),H.subscribe((function(e){return de(e,K.getState())})),K.subscribe((function(e){return de(H.getState(),e)})),ge(H.getState(),Q.getState(),K.getState()),H.subscribe((function(e){ge(e,Q.getState(),K.getState())})),Q.subscribe((function(e){ge(H.getState(),e,K.getState())})),K.subscribe((function(e){ge(H.getState(),Q.getState(),e)}));var qe=function(e,t){var n=k(t);if(!e)return n;var r=!0,o=!1,a=void 0;try{for(var i,c=function(){var t=i.value,r=n[t],o=e[t];if(o&&o.hasOwnProperty("_default")){n.hasOwnProperty(t)||(n[t]=o._default);var a=o._elements;if(r&&Ge(a))if(o._type===R.Array&&Array.isArray(r)){var c=r.map((function(e){return qe(a,e)}));n[t]=c}else if(o._type===R.Object){var u=!0,s=!1,l=void 0;try{for(var f,y=Object.keys(r)[Symbol.iterator]();!(u=(f=y.next()).done);u=!0){var d=f.value;r[d]=qe(a,r[d])}}catch(e){s=!0,l=e}finally{try{u||null==y.return||y.return()}finally{if(s)throw l}}}}else if(Me(o)){var v=n.hasOwnProperty(t)?r:{};Me(v)&&(n[t]=qe(o,v))}},u=Object.keys(e)[Symbol.iterator]();!(r=(i=u.next()).done);r=!0)c()}catch(e){o=!0,a=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n};function Ge(e){return!!e&&Object.keys(e).filter((function(e){return!["_default","_validators"].includes(e)})).length>0}function Me(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}var Re=new Set;function Be(e,t){var n="".concat(e,":::").concat(t);Re.has(n)||(console.error(t),Re.add(n))}function Fe(e){e?Re.forEach((function(t){t.startsWith(e)&&Re.delete(t)})):Re.clear()}var We={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:R.Array,_default:[]}},"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:R.Object,_default:{}}},$e=function(e,t){return B((function(n){return e<=n&&n<=t}),"must be between ".concat(e," and ").concat(t))},ze=function(e){var t=e.concat(["openmrsBase","openmrsSpaBase"]);return B((function(e){if(!e||"string"!=typeof e)return!1;for(var n=/\${(.*?)}/g,r=n.exec(e);r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0}),"Should be a URL or path. The allowed template parameters are "+t.map((function(e){return"${"+e+"}"})).join(", "))},Je=ze([]),Le=function(e){return B((function(t){return e.includes(t)}),"Must be one of the following: '".concat(e.join("', '"),"'."))},Xe={inRange:$e,isUrl:Je,isUrlWithTemplateParameters:ze,oneOf:Le}})(),o})())}}}));
1
+ System.register(["@openmrs/esm-state"],(function(e,t){var n={};return{setters:[function(e){n.createGlobalStore=e.createGlobalStore,n.getGlobalStore=e.getGlobalStore}],execute:function(){e((()=>{"use strict";var e={685:e=>{e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{function e(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function t(t){return function n(r){return 0===arguments.length||e(r)?n:t.apply(this,arguments)}}function n(n){return function r(o,a){switch(arguments.length){case 0:return r;case 1:return e(o)?r:t((function(e){return n(o,e)}));default:return e(o)&&e(a)?r:e(o)?t((function(e){return n(e,a)})):e(a)?t((function(e){return n(o,e)})):n(o,a)}}}function a(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function i(e,t,n){for(var r=0,o=n.length;r<o;){if(e(t,n[r]))return!0;r+=1}return!1}function c(e,t){return Object.prototype.hasOwnProperty.call(t,e)}r.r(o),r.d(o,{Type:()=>L,clearConfigErrors:()=>ze,configExtensionStore:()=>K,configInternalStore:()=>X,defineConfigSchema:()=>pe,defineExtensionConfigSchema:()=>he,getConfig:()=>Se,getConfigStore:()=>Q,getExtensionConfig:()=>ne,getExtensionConfigFromStore:()=>re,getExtensionSlotConfig:()=>Y,getExtensionSlotConfigFromStore:()=>ee,getExtensionSlotsConfigStore:()=>V,getExtensionsConfigStore:()=>te,getTranslationOverrides:()=>Oe,implementerToolsConfigStore:()=>oe,inRange:()=>Fe,isUrl:()=>Ze,isUrlWithTemplateParameters:()=>Je,oneOf:()=>Xe,processConfig:()=>je,provide:()=>me,registerModuleWithConfigSystem:()=>be,temporaryConfigStore:()=>H,validator:()=>R,validators:()=>He});const u="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var s=Object.prototype.toString,l=function(){return"[object Arguments]"===s.call(arguments)?function(e){return"[object Arguments]"===s.call(e)}:function(e){return c("callee",e)}}();const f=l;var y=!{toString:null}.propertyIsEnumerable("toString"),d=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],v=function(){return arguments.propertyIsEnumerable("length")}(),g=function(e,t){for(var n=0;n<e.length;){if(e[n]===t)return!0;n+=1}return!1};const p="function"!=typeof Object.keys||v?t((function(e){if(Object(e)!==e)return[];var t,n,r=[],o=v&&f(e);for(t in e)!c(t,e)||o&&"length"===t||(r[r.length]=t);if(y)for(n=d.length-1;n>=0;)c(t=d[n],e)&&!g(r,t)&&(r[r.length]=t),n-=1;return r})):t((function(e){return Object(e)!==e?[]:Object.keys(e)})),b=t((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function h(e,t,n,r){var o=a(e);function c(e,t){return m(e,t,n.slice(),r.slice())}return!i((function(e,t){return!i(c,t,e)}),a(t),o)}function m(e,t,n,r){if(u(e,t))return!0;var o,a,i=b(e);if(i!==b(t))return!1;if(null==e||null==t)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(o=e.constructor,null==(a=String(o).match(/^function (\w*)/))?"":a[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!u(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!u(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var s=n.length-1;s>=0;){if(n[s]===e)return r[s]===t;s-=1}switch(i){case"Map":return e.size===t.size&&h(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&h(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var l=p(e);if(l.length!==p(t).length)return!1;var f=n.concat([e]),y=r.concat([t]);for(s=l.length-1;s>=0;){var d=l[s];if(!c(d,t)||!m(t[d],e[d],f,y))return!1;s-=1}return!0}const S=n((function(e,t){return m(e,t,[],[])}));function O(r){return function o(a,i,c){switch(arguments.length){case 0:return o;case 1:return e(a)?o:n((function(e,t){return r(a,e,t)}));case 2:return e(a)&&e(i)?o:e(a)?n((function(e,t){return r(e,i,t)})):e(i)?n((function(e,t){return r(a,e,t)})):t((function(e){return r(a,i,e)}));default:return e(a)&&e(i)&&e(c)?o:e(a)&&e(i)?n((function(e,t){return r(e,t,c)})):e(a)&&e(c)?n((function(e,t){return r(e,i,t)})):e(i)&&e(c)?n((function(e,t){return r(a,e,t)})):e(a)?t((function(e){return r(e,i,c)})):e(i)?t((function(e){return r(a,e,c)})):e(c)?t((function(e){return r(a,i,e)})):r(a,i,c)}}}function j(e){return"[object Object]"===Object.prototype.toString.call(e)}const w=O((function(e,t,n){var r,o={};for(r in t)c(r,t)&&(o[r]=c(r,n)?e(r,t[r],n[r]):t[r]);for(r in n)c(r,n)&&!c(r,o)&&(o[r]=n[r]);return o})),x=O((function e(t,n,r){return w((function(n,r,o){return j(r)&&j(o)?e(t,r,o):t(n,r,o)}),n,r)})),A=n((function(e,t){return x((function(e,t,n){return n}),e,t)})),_=n((function(e,t){for(var n={},r={},o=0,a=e.length;o<a;)r[e[o]]=1,o+=1;for(var i in t)r.hasOwnProperty(i)||(n[i]=t[i]);return n}));function k(e,t,n,r){var o,a=function(o){for(var a=t.length,i=0;i<a;){if(e===t[i])return n[i];i+=1}for(var c in t[i+1]=e,n[i+1]=o,e)o[c]=r?k(e[c],t,n,!0):e[c];return o};switch(b(e)){case"Object":return a({});case"Array":return a([]);case"Date":return new Date(e.valueOf());case"RegExp":return o=e,new RegExp(o.source,(o.global?"g":"")+(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.sticky?"y":"")+(o.unicode?"u":""));default:return e}}const P=t((function(e){return null!=e&&"function"==typeof e.clone?e.clone():k(e,[],[],!0)})),I=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)},C=t((function(e){return!!I(e)||!!e&&"object"==typeof e&&!function(e){return"[object String]"===Object.prototype.toString.call(e)}(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1))}));var E=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),T=n((function(e,t){return function(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,o){return t.apply(this,arguments)};case 5:return function(e,n,r,o,a){return t.apply(this,arguments)};case 6:return function(e,n,r,o,a,i){return t.apply(this,arguments)};case 7:return function(e,n,r,o,a,i,c){return t.apply(this,arguments)};case 8:return function(e,n,r,o,a,i,c,u){return t.apply(this,arguments)};case 9:return function(e,n,r,o,a,i,c,u,s){return t.apply(this,arguments)};case 10:return function(e,n,r,o,a,i,c,u,s,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}(e.length,(function(){return e.apply(t,arguments)}))}));const U=T;function D(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function N(e,t,n,r){return e["@@transducer/result"](n[r](U(e["@@transducer/step"],e),t))}var q="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function M(e,t,n){if("function"==typeof e&&(e=function(e){return new E(e)}(e)),C(n))return function(e,t,n){for(var r=0,o=n.length;r<o;){if((t=e["@@transducer/step"](t,n[r]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r+=1}return e["@@transducer/result"](t)}(e,t,n);if("function"==typeof n["fantasy-land/reduce"])return N(e,t,n,"fantasy-land/reduce");if(null!=n[q])return D(e,t,n[q]());if("function"==typeof n.next)return D(e,t,n);if("function"==typeof n.reduce)return N(e,t,n,"reduce");throw new TypeError("reduce: list must be array or iterable")}const G=O(M);var L;function R(e,t){return function(n){if(!e(n))return"function"==typeof t?t(n):t}}!function(e){e.Array="Array",e.Boolean="Boolean",e.ConceptUuid="ConceptUuid",e.Number="Number",e.Object="Object",e.String="String",e.UUID="UUID",e.PersonAttributeTypeUuid="PersonAttributeTypeUuid",e.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid"}(L||(L={}));var B=R((function(e){return Array.isArray(e)}),"must be an array"),$=R((function(e){return"boolean"==typeof e}),"must be a boolean"),z=R((function(e){return"number"==typeof e}),"must be a number"),W=R((function(e){return"string"==typeof e}),"must be a string"),F=R((function(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}),"must be an object (not an array or null)"),J=R((function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e)}),"must be a valid UUID or a 36-character hexadecimal string"),Z=r(685),X=(0,Z.createGlobalStore)("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{}}),H=(0,Z.createGlobalStore)("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});H.subscribe((function(e){var t;t=e.config,localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}));var K=(0,Z.createGlobalStore)("config-store-of-extension-state",{mountedExtensions:[]});function Q(e){return(0,Z.getGlobalStore)("config-module-".concat(e),{config:null,loaded:!1,translationOverridesLoaded:!1})}function V(){return(0,Z.getGlobalStore)("config-extension-slots",{slots:{}})}function Y(e){return ee(V().getState(),e)}function ee(e,t){var n=e.slots[t];return null!=n?n:{loaded:!1,config:{}}}function te(){return(0,Z.getGlobalStore)("config-extensions",{configs:{}})}function ne(e,t){var n=Object.assign({},re(te().getState(),e,t));return n.config=_(["Display conditions","Translation overrides"],n.config),n}function re(e,t,n){var r,o=null===(r=e.configs[t])||void 0===r?void 0:r[n];return null!=o?o:{loaded:!1,config:null}}var oe=(0,Z.createGlobalStore)("config-implementer-tools",{config:{}});function ae(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 ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ce(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){ie(e,t,n[t])}))}return e}function ue(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 se(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,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}(e,t)||fe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function le(e){return function(e){if(Array.isArray(e))return ae(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fe(e)||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.")}()}function fe(e,t){if(e){if("string"==typeof e)return ae(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)?ae(e,t):void 0}}function ye(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=Object.keys(e.schemas)[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var c=a.value,u=Q(c);if(e.moduleLoaded[c]){var s=Ie(c,e,t);u.setState({translationOverridesLoaded:!0,loaded:!0,config:s})}else{var l=Ce(c,e,t);u.setState({translationOverridesLoaded:!0,loaded:!1,config:l})}}}catch(e){r=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}}function de(e,t){var n,r,o=(n=Te(ke(e,t)),function(e){var t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(e)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=se(o.value,2),c=i[0],u=i[1],s=!0,l=!1,f=void 0;try{for(var y,d=Object.entries(u)[Symbol.iterator]();!(s=(y=d.next()).done);s=!0){var v=se(y.value,2),g=v[0];_e(v[1],c,g)}}catch(e){l=!0,f=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw f}}}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}(r=Object.keys(n).reduce((function(e,t){var r,o;return(null===(r=n[t])||void 0===r?void 0:r.extensionSlots)&&(e[t]=null===(o=n[t])||void 0===o?void 0:o.extensionSlots),e}),{})),Object.keys(r).reduce((function(e,t){return ce({},e,r[t])}),{})),a=Object.fromEntries(Object.entries(o).map((function(e){var t=se(e,2);return[t[0],{loaded:!0,config:t[1]}]}))),i=V(),c=i.getState(),u={slots:ce({},c.slots,a)};S(c,u)||i.setState(u)}function ve(e,t){var n=function(e,t){var n=xe(P(e.schemas)),r=le(e.providedConfigs.map((function(e){return[e.config,e.source]}))).concat([[t.config,"temporary config"]]),o=!0,a=!1,i=void 0;try{for(var c,u=r[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var s=se(c.value,2);n=Te([n,Ae(s[0],s[1])])}}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}return n}(e,t);oe.setState({config:n})}function ge(e,t,n){var r={},o=!0,a=!1,i=void 0;try{for(var c,u=t.mountedExtensions[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var s=c.value,l=we(s.slotModuleName,s.extensionModuleName,s.slotName,s.extensionId,e,n);r[s.slotName]=ue(ce({},r[s.slotName]),ie({},s.extensionId,{config:l,loaded:!0}))}}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}te().setState({configs:r})}function pe(e,t){Pe(e,t);var n=A(t,We),r=X.getState();X.setState({schemas:ue(ce({},r.schemas),ie({},e,n)),moduleLoaded:ue(ce({},r.moduleLoaded),ie({},e,!0))})}function be(e){var t=X.getState();X.setState({schemas:ue(ce({},t.schemas),ie({},e,We))})}function he(e,t){Pe(e,t);var n=A(t,We),r=X.getState();r.schemas[e]&&console.error("Config schema for extension ".concat(e," already exists. If there are multiple extensions with this same name, one will probably crash.")),X.setState({schemas:ue(ce({},r.schemas),ie({},e,n))})}function me(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"provided",n=X.getState();X.setState({providedConfigs:le(n.providedConfigs).concat([{source:t,config:e}])})}function Se(e){return new Promise((function(t){var n=function(e){if(e.loaded&&e.config){var n=_(["Display conditions","Translation overrides"],e.config);t(n),o&&o()}},r=Q(e);n(r.getState());var o=r.subscribe(n)}))}function Oe(e){return new Promise((function(t){var n=function(e){if(e.translationOverridesLoaded&&e.config){var n,r=null!==(n=e.config["Translation overrides"])&&void 0!==n?n:{};t(r),o&&o()}},r=Q(e);n(r.getState());var o=r.subscribe(n)}))}function je(e,t,n){Ue(e,t,n);var r=Ge(e,t);return Ne(e,r,n),r}function we(e,t,n,r,o,a){var i,c,u,s,l=function(e){return se(e.split("#"),1)[0]}(r),f=o.schemas[l],y=f?l:t,d=ke(o,a),v=Ee(e,d),g=null!==(s=null==v||null===(i=v.extensionSlots)||void 0===i||null===(c=i[n])||void 0===c||null===(u=c.configure)||void 0===u?void 0:u[r])&&void 0!==s?s:{},p=Te([Ee(y,d),g]),b=null!=f?f:o.schemas[t];Ue(b,p,y);var h=Ge(b,p);return Ne(b,h,y),delete h.extensionSlots,h}function xe(e){return e.hasOwnProperty("_default")?ue(ce({},e),{_value:e._default,_source:"default"}):Re(e)?Object.keys(e).reduce((function(t,n){return t[n]=xe(e[n]),t}),{}):{}}function Ae(e,t){return Re(e)?Object.keys(e).reduce((function(n,r){return n[r]=Ae(e[r],t),n}),{}):{_value:e,_source:t}}function _e(e,t,n){var r="".concat(t,".extensionSlots.").concat(n),o="Extension slot config '".concat(r,"'"),a=Object.keys(e).filter((function(e){return!["add","remove","order","configure"].includes(e)}));a.length&&$e(r,o+"' contains invalid keys '".concat(a.join("', '"),"'")),e.add&&(Array.isArray(e.add)&&e.add.every((function(e){return"string"==typeof e}))||$e(r,o+".add' is invalid. Must be an array of strings (extension IDs)")),e.remove&&(Array.isArray(e.remove)&&e.remove.every((function(e){return"string"==typeof e}))||$e(r,o+".remove' is invalid. Must be an array of strings (extension IDs)")),e.order&&(Array.isArray(e.order)&&e.order.every((function(e){return"string"==typeof e}))||$e(r,o+".order' is invalid. Must be an array of strings (extension IDs)")),e.configure&&(Re(e.configure)||$e(r,o+".configure' is invalid. Must be an object with extension IDs for keys"))}function ke(e,t){return le(e.providedConfigs.map((function(e){return e.config}))).concat([t.config])}function Pe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="Please verify that you are running the latest version and, if so, alert the maintainer.",o=!0,a=!1,i=void 0;try{for(var c,u=function(){var o=c.value,a=n+(n&&".")+o,i=t[o];if("Display conditions"===a&&console.error("".concat(e,' declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ').concat(r)),"Translation overrides"===a&&console.error("".concat(e,' declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ').concat(r)),!Re(i))return console.error("".concat(e," has bad config schema definition for key '").concat(a,"'. ").concat(r)),"continue";i.hasOwnProperty("_default")||Pe(e,i,a);var u=i._elements;if(Le(u)&&Pe(e,u,a+"._elements"),i._validators){var s=!0,l=!1,f=void 0;try{for(var y,d=i._validators[Symbol.iterator]();!(s=(y=d.next()).done);s=!0){var v=y.value;"function"!=typeof v&&console.error("".concat(e," has invalid validator for key '").concat(a,"' ").concat(r,".")+"\n\nIf you're the maintainer: validators must be functions that return either "+"undefined or an error string. Received ".concat(v,"."))}}catch(e){l=!0,f=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw f}}}var g=i._type;g&&!Object.values(L).includes(g)&&console.error("".concat(e," has invalid type for key '").concat(a,"' ").concat(r,".")+"\n\nIf you're the maintainer: the allowed types are ".concat(Object.values(L).join(", "),". ")+"Received '".concat(g,"'")),Object.keys(i).every((function(e){return["_description","_validators","_elements","_type"].includes(e)}))&&!n.includes("._elements")&&console.error("".concat(e," has bad config schema definition for key '").concat(a,"'. ").concat(r,".")+"\n\nIf you're the maintainer: all config elements must have a default. "+"Received ".concat(JSON.stringify(i))),u&&g&&![L.Array,L.Object].includes(g)&&console.error("".concat(e," has bad config schema definition for key '").concat(a,"'. ").concat(r,".")+"\n\nIf you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. "+"Received ".concat(JSON.stringify(g)))},s=Object.keys(t).filter((function(e){return!e.startsWith("_")}))[Symbol.iterator]();!(o=(c=s.next()).done);o=!0)u()}catch(e){a=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(a)throw i}}}function Ie(e,t,n){var r=t.schemas[e],o=Ee(e,ke(t,n));Ue(r,o,e);var a=Ge(r,o);return Ne(r,a,e),delete a.extensionSlots,a}function Ce(e,t,n){var r=Ee(e,ke(t,n)),o=Ge(We,r);return Ne(We,o,e),delete o.extensionSlots,o}function Ee(e,t){return Te(t.map((function(t){return t[e]})).filter((function(e){return!!e})))}function Te(e){return G(A)({},e)}function Ue(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=!0,o=!1,a=void 0;try{for(var i,c=Object.keys(t)[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=i.value,s=t[u],l=n+"."+u,f=e[u];e.hasOwnProperty(u)?De(f,s,l):"extensionSlots"===u&&""!==n||$e(l,"Unknown config key '".concat(l,"' provided. Ignoring."))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}function De(e,t,n){qe(n,e._type,t),Re(t)?e._type===L.Object?function(e,t,n){if(e._elements){var r=!0,o=!1,a=void 0;try{for(var i,c=Object.keys(t)[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=i.value,s=t[u];Ue(e._elements,s,"".concat(n,".").concat(u))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}}(e,t,n):e.hasOwnProperty("_default")||Ue(e,t,n):e._type===L.Array&&function(e,t,n){if(Le(e._elements))for(var r=0;r<t.length;r++)De(e._elements,t[r],"".concat(n,"[").concat(r,"]"));for(var o=0;o<t.length;o++){var a;qe("".concat(n,"[").concat(o,"]"),null===(a=e._elements)||void 0===a?void 0:a._type,t[o])}}(e,t,n)}function Ne(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(e)if(t!==e._default&&Me(n,e._validators,t),Re(t)){var r=!0,o=!1,a=void 0;try{for(var i,c=Object.keys(t)[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=i.value,s=t[u],l=n+"."+u,f=e[u];e._type===L.Object&&e._elements?Ne(e._elements,s,l):Ne(f,s,l)}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}else if(Array.isArray(t)&&e._elements)for(var y=0;y<t.length;y++)Ne(e._elements,t[y],"".concat(n,"[").concat(y,"]"))}function qe(e,t,n){t&&Me(e,[{Array:B,Boolean:$,ConceptUuid:J,Number:z,Object:F,String:W,UUID:J,PersonAttributeTypeUuid:J,PatientIdentifierTypeUuid:J}[t]],n)}function Me(e,t,n){if(t)try{var r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var u=(0,i.value)(n);"string"==typeof u&&$e(e,"object"==typeof n?"Invalid configuration for ".concat(e,": ").concat(u):"Invalid configuration value ".concat(n," for ").concat(e,": ").concat(u))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}catch(t){console.error('Skipping invalid validator at "'.concat(e,'". Encountered error\n\t').concat(t))}}ye(X.getState(),H.getState()),X.subscribe((function(e){return ye(e,H.getState())})),H.subscribe((function(e){return ye(X.getState(),e)})),ve(X.getState(),H.getState()),X.subscribe((function(e){return ve(e,H.getState())})),H.subscribe((function(e){return ve(X.getState(),e)})),de(X.getState(),H.getState()),X.subscribe((function(e){return de(e,H.getState())})),H.subscribe((function(e){return de(X.getState(),e)})),ge(X.getState(),K.getState(),H.getState()),X.subscribe((function(e){ge(e,K.getState(),H.getState())})),K.subscribe((function(e){ge(X.getState(),e,H.getState())})),H.subscribe((function(e){ge(X.getState(),K.getState(),e)}));var Ge=function(e,t){var n=P(t);if(!e)return n;var r=!0,o=!1,a=void 0;try{for(var i,c=function(){var t=i.value,r=n[t],o=e[t];if(o&&o.hasOwnProperty("_default")){n.hasOwnProperty(t)||(n[t]=o._default);var a=o._elements;if(r&&Le(a))if(o._type===L.Array&&Array.isArray(r)){var c=r.map((function(e){return Ge(a,e)}));n[t]=c}else if(o._type===L.Object){var u=!0,s=!1,l=void 0;try{for(var f,y=Object.keys(r)[Symbol.iterator]();!(u=(f=y.next()).done);u=!0){var d=f.value;r[d]=Ge(a,r[d])}}catch(e){s=!0,l=e}finally{try{u||null==y.return||y.return()}finally{if(s)throw l}}}}else if(Re(o)){var v=n.hasOwnProperty(t)?r:{};Re(v)&&(n[t]=Ge(o,v))}},u=Object.keys(e)[Symbol.iterator]();!(r=(i=u.next()).done);r=!0)c()}catch(e){o=!0,a=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n};function Le(e){return!!e&&Object.keys(e).filter((function(e){return!["_default","_validators"].includes(e)})).length>0}function Re(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}var Be=new Set;function $e(e,t){var n="".concat(e,":::").concat(t);Be.has(n)||(console.error(t),Be.add(n))}function ze(e){e?Be.forEach((function(t){t.startsWith(e)&&Be.delete(t)})):Be.clear()}var We={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:L.Array,_default:[]}},"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:L.Object,_default:{},_validators:[R((function(e){return Object.keys(e).every((function(e){return/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)}))}),(function(e){var t=Object.keys(e).filter((function(e){return!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)}));return"The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ".concat(t.join(", "),".")}))]}},Fe=function(e,t){return R((function(n){return e<=n&&n<=t}),"must be between ".concat(e," and ").concat(t))},Je=function(e){var t=e.concat(["openmrsBase","openmrsSpaBase"]);return R((function(e){if(!e||"string"!=typeof e)return!1;for(var n=/\${(.*?)}/g,r=n.exec(e);r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0}),"Should be a URL or path. The allowed template parameters are "+t.map((function(e){return"${"+e+"}"})).join(", "))},Ze=Je([]),Xe=function(e){return R((function(t){return e.includes(t)}),"Must be one of the following: '".concat(e.join("', '"),"'."))},He={inRange:Fe,isUrl:Ze,isUrlWithTemplateParameters:Je,oneOf:Xe}})(),o})())}}}));
2
2
  //# sourceMappingURL=openmrs-esm-module-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openmrs-esm-module-config.js","mappings":"8NAAAA,EAAOC,QAAUC,C,GCCbC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,CAAC,GAOX,OAHAO,EAAoBH,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,OACf,CCrBAG,EAAoBK,EAAI,CAACR,EAASS,KACjC,IAAI,IAAIC,KAAOD,EACXN,EAAoBQ,EAAEF,EAAYC,KAASP,EAAoBQ,EAAEX,EAASU,IAC5EE,OAAOC,eAAeb,EAASU,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDP,EAAoBQ,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFd,EAAoBkB,EAAKrB,IACH,oBAAXsB,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAeb,EAASsB,OAAOC,YAAa,CAAEC,MAAO,WAE7DZ,OAAOC,eAAeb,EAAS,aAAc,CAAEwB,OAAO,GAAO,E,qBCL/C,SAASC,EAAeC,GAChC,OAAY,MAALA,GAA0B,iBAANA,IAAoD,IAAlCA,EAAE,2BACtD,CCQe,SAASC,EAAQC,GAC9B,OAAO,SAASC,EAAGH,GACjB,OAAyB,IAArBI,UAAUC,QAAgBN,EAAeC,GACpCG,EAEAD,E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EACjB,OAAO,EAMT,IAHA,IAAM6Q,EAAK,aACPlQ,EAAQkQ,EAAGC,KAAK9Q,GAEbW,GAAO,CACZ,IAAKiQ,EAAcjD,SAAShN,EAAM,IAChC,OAAO,EAGTA,EAAQkQ,EAAGC,KAAK9Q,EAClB,CAEA,OAAO,CACT,GACA,gEACE4Q,EAAc5G,KAAI,SAAC+G,G,MAAM,KAAOA,EAAI,G,IAAKlD,KAAK,MAEpD,EAOamD,GAAQN,GAA4B,IAMpCO,GAAQ,SAACC,GACpB,OAAOvL,GACL,SAAC3F,G,OAAQkR,EAAcvD,SAAS3N,E,GAChC,kCAA6D,OAA3BkR,EAAcrD,KAAK,QAAQ,MAEjE,EAEayB,GAAa,CACxBiB,QAAAA,GACAS,MAAAA,GACAN,4BAAAA,GACAO,MAAAA,G","sources":["webpack://@openmrs/esm-config/external system \"@openmrs/esm-state\"","webpack://@openmrs/esm-config/webpack/bootstrap","webpack://@openmrs/esm-config/webpack/runtime/define property getters","webpack://@openmrs/esm-config/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-config/webpack/runtime/make namespace object","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isPlaceholder.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_curry1.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_curry2.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_arrayFromIterator.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_includesWith.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_has.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_objectIs.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isArguments.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/keys.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/type.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_equals.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_functionName.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/equals.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_curry3.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isObject.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/mergeWithKey.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/mergeDeepWithKey.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/mergeDeepRight.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/omit.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_clone.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_cloneRegExp.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/clone.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isArray.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isArrayLike.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isString.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_xwrap.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/bind.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_arity.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_reduce.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/reduce.js","webpack://@openmrs/esm-config/./src/types.ts","webpack://@openmrs/esm-config/./src/validators/validator.ts","webpack://@openmrs/esm-config/./src/validators/type-validators.ts","webpack://@openmrs/esm-config/./src/module-config/state.ts","webpack://@openmrs/esm-config/./src/module-config/module-config.ts","webpack://@openmrs/esm-config/./src/validators/validators.ts"],"sourcesContent":["module.exports = __WEBPACK_EXTERNAL_MODULE__685__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export default function _isPlaceholder(a) {\n return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true;\n}","import _isPlaceholder from './_isPlaceholder.js';\n\n/**\n * Optimized internal one-arity curry function.\n *\n * @private\n * @category Function\n * @param {Function} fn The function to curry.\n * @return {Function} The curried function.\n */\nexport default function _curry1(fn) {\n return function f1(a) {\n if (arguments.length === 0 || _isPlaceholder(a)) {\n return f1;\n } else {\n return fn.apply(this, arguments);\n }\n };\n}","import _curry1 from './_curry1.js';\nimport _isPlaceholder from './_isPlaceholder.js';\n\n/**\n * Optimized internal two-arity curry function.\n *\n * @private\n * @category Function\n * @param {Function} fn The function to curry.\n * @return {Function} The curried function.\n */\nexport default function _curry2(fn) {\n return function f2(a, b) {\n switch (arguments.length) {\n case 0:\n return f2;\n case 1:\n return _isPlaceholder(a) ? f2 : _curry1(function (_b) {\n return fn(a, _b);\n });\n default:\n return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {\n return fn(_a, b);\n }) : _isPlaceholder(b) ? _curry1(function (_b) {\n return fn(a, _b);\n }) : fn(a, b);\n }\n };\n}","export default function _arrayFromIterator(iter) {\n var list = [];\n var next;\n while (!(next = iter.next()).done) {\n list.push(next.value);\n }\n return list;\n}","export default function _includesWith(pred, x, list) {\n var idx = 0;\n var len = list.length;\n\n while (idx < len) {\n if (pred(x, list[idx])) {\n return true;\n }\n idx += 1;\n }\n return false;\n}","export default function _has(prop, obj) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}","// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\nfunction _objectIs(a, b) {\n // SameValue algorithm\n if (a === b) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return a !== 0 || 1 / a === 1 / b;\n } else {\n // Step 6.a: NaN == NaN\n return a !== a && b !== b;\n }\n}\n\nexport default typeof Object.is === 'function' ? Object.is : _objectIs;","import _has from './_has.js';\n\nvar toString = Object.prototype.toString;\nvar _isArguments = /*#__PURE__*/function () {\n return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {\n return toString.call(x) === '[object Arguments]';\n } : function _isArguments(x) {\n return _has('callee', x);\n };\n}();\n\nexport default _isArguments;","import _curry1 from './internal/_curry1.js';\nimport _has from './internal/_has.js';\nimport _isArguments from './internal/_isArguments.js';\n\n// cover IE < 9 keys issues\nvar hasEnumBug = ! /*#__PURE__*/{ toString: null }.propertyIsEnumerable('toString');\nvar nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];\n// Safari bug\nvar hasArgsEnumBug = /*#__PURE__*/function () {\n 'use strict';\n\n return arguments.propertyIsEnumerable('length');\n}();\n\nvar contains = function contains(list, item) {\n var idx = 0;\n while (idx < list.length) {\n if (list[idx] === item) {\n return true;\n }\n idx += 1;\n }\n return false;\n};\n\n/**\n * Returns a list containing the names of all the enumerable own properties of\n * the supplied object.\n * Note that the order of the output array is not guaranteed to be consistent\n * across different JS platforms.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Object\n * @sig {k: v} -> [k]\n * @param {Object} obj The object to extract properties from\n * @return {Array} An array of the object's own properties.\n * @see R.keysIn, R.values\n * @example\n *\n * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']\n */\nvar keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? /*#__PURE__*/_curry1(function keys(obj) {\n return Object(obj) !== obj ? [] : Object.keys(obj);\n}) : /*#__PURE__*/_curry1(function keys(obj) {\n if (Object(obj) !== obj) {\n return [];\n }\n var prop, nIdx;\n var ks = [];\n var checkArgsLength = hasArgsEnumBug && _isArguments(obj);\n for (prop in obj) {\n if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {\n ks[ks.length] = prop;\n }\n }\n if (hasEnumBug) {\n nIdx = nonEnumerableProps.length - 1;\n while (nIdx >= 0) {\n prop = nonEnumerableProps[nIdx];\n if (_has(prop, obj) && !contains(ks, prop)) {\n ks[ks.length] = prop;\n }\n nIdx -= 1;\n }\n }\n return ks;\n});\nexport default keys;","import _curry1 from './internal/_curry1.js';\n\n/**\n * Gives a single-word string description of the (native) type of a value,\n * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not\n * attempt to distinguish user Object types any further, reporting them all as\n * 'Object'.\n *\n * @func\n * @memberOf R\n * @since v0.8.0\n * @category Type\n * @sig (* -> {*}) -> String\n * @param {*} val The value to test\n * @return {String}\n * @example\n *\n * R.type({}); //=> \"Object\"\n * R.type(1); //=> \"Number\"\n * R.type(false); //=> \"Boolean\"\n * R.type('s'); //=> \"String\"\n * R.type(null); //=> \"Null\"\n * R.type([]); //=> \"Array\"\n * R.type(/[A-z]/); //=> \"RegExp\"\n * R.type(() => {}); //=> \"Function\"\n * R.type(undefined); //=> \"Undefined\"\n */\nvar type = /*#__PURE__*/_curry1(function type(val) {\n return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);\n});\nexport default type;","import _arrayFromIterator from './_arrayFromIterator.js';\nimport _includesWith from './_includesWith.js';\nimport _functionName from './_functionName.js';\nimport _has from './_has.js';\nimport _objectIs from './_objectIs.js';\nimport keys from '../keys.js';\nimport type from '../type.js';\n\n/**\n * private _uniqContentEquals function.\n * That function is checking equality of 2 iterator contents with 2 assumptions\n * - iterators lengths are the same\n * - iterators values are unique\n *\n * false-positive result will be returned for comparision of, e.g.\n * - [1,2,3] and [1,2,3,4]\n * - [1,1,1] and [1,2,3]\n * */\n\nfunction _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !_includesWith(function (b, aItem) {\n return !_includesWith(eq, aItem, b);\n }, b, a);\n}\n\nexport default function _equals(a, b, stackA, stackB) {\n if (_objectIs(a, b)) {\n return true;\n }\n\n var typeA = type(a);\n\n if (typeA !== type(b)) {\n return false;\n }\n\n if (a == null || b == null) {\n return false;\n }\n\n if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {\n return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);\n }\n\n if (typeof a.equals === 'function' || typeof b.equals === 'function') {\n return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);\n }\n\n switch (typeA) {\n case 'Arguments':\n case 'Array':\n case 'Object':\n if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {\n return a === b;\n }\n break;\n case 'Boolean':\n case 'Number':\n case 'String':\n if (!(typeof a === typeof b && _objectIs(a.valueOf(), b.valueOf()))) {\n return false;\n }\n break;\n case 'Date':\n if (!_objectIs(a.valueOf(), b.valueOf())) {\n return false;\n }\n break;\n case 'Error':\n return a.name === b.name && a.message === b.message;\n case 'RegExp':\n if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {\n return false;\n }\n break;\n }\n\n var idx = stackA.length - 1;\n while (idx >= 0) {\n if (stackA[idx] === a) {\n return stackB[idx] === b;\n }\n idx -= 1;\n }\n\n switch (typeA) {\n case 'Map':\n if (a.size !== b.size) {\n return false;\n }\n\n return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));\n case 'Set':\n if (a.size !== b.size) {\n return false;\n }\n\n return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));\n case 'Arguments':\n case 'Array':\n case 'Object':\n case 'Boolean':\n case 'Number':\n case 'String':\n case 'Date':\n case 'Error':\n case 'RegExp':\n case 'Int8Array':\n case 'Uint8Array':\n case 'Uint8ClampedArray':\n case 'Int16Array':\n case 'Uint16Array':\n case 'Int32Array':\n case 'Uint32Array':\n case 'Float32Array':\n case 'Float64Array':\n case 'ArrayBuffer':\n break;\n default:\n // Values of other types are only equal if identical.\n return false;\n }\n\n var keysA = keys(a);\n if (keysA.length !== keys(b).length) {\n return false;\n }\n\n var extendedStackA = stackA.concat([a]);\n var extendedStackB = stackB.concat([b]);\n\n idx = keysA.length - 1;\n while (idx >= 0) {\n var key = keysA[idx];\n if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {\n return false;\n }\n idx -= 1;\n }\n return true;\n}","export default function _functionName(f) {\n // String(x => x) evaluates to \"x => x\", so the pattern may not match.\n var match = String(f).match(/^function (\\w*)/);\n return match == null ? '' : match[1];\n}","import _curry2 from './internal/_curry2.js';\nimport _equals from './internal/_equals.js';\n\n/**\n * Returns `true` if its arguments are equivalent, `false` otherwise. Handles\n * cyclical data structures.\n *\n * Dispatches symmetrically to the `equals` methods of both arguments, if\n * present.\n *\n * @func\n * @memberOf R\n * @since v0.15.0\n * @category Relation\n * @sig a -> b -> Boolean\n * @param {*} a\n * @param {*} b\n * @return {Boolean}\n * @example\n *\n * R.equals(1, 1); //=> true\n * R.equals(1, '1'); //=> false\n * R.equals([1, 2, 3], [1, 2, 3]); //=> true\n *\n * const a = {}; a.v = a;\n * const b = {}; b.v = b;\n * R.equals(a, b); //=> true\n */\nvar equals = /*#__PURE__*/_curry2(function equals(a, b) {\n return _equals(a, b, [], []);\n});\nexport default equals;","import _curry1 from './_curry1.js';\nimport _curry2 from './_curry2.js';\nimport _isPlaceholder from './_isPlaceholder.js';\n\n/**\n * Optimized internal three-arity curry function.\n *\n * @private\n * @category Function\n * @param {Function} fn The function to curry.\n * @return {Function} The curried function.\n */\nexport default function _curry3(fn) {\n return function f3(a, b, c) {\n switch (arguments.length) {\n case 0:\n return f3;\n case 1:\n return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {\n return fn(a, _b, _c);\n });\n case 2:\n return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {\n return fn(_a, b, _c);\n }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {\n return fn(a, _b, _c);\n }) : _curry1(function (_c) {\n return fn(a, b, _c);\n });\n default:\n return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {\n return fn(_a, _b, c);\n }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {\n return fn(_a, b, _c);\n }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {\n return fn(a, _b, _c);\n }) : _isPlaceholder(a) ? _curry1(function (_a) {\n return fn(_a, b, c);\n }) : _isPlaceholder(b) ? _curry1(function (_b) {\n return fn(a, _b, c);\n }) : _isPlaceholder(c) ? _curry1(function (_c) {\n return fn(a, b, _c);\n }) : fn(a, b, c);\n }\n };\n}","export default function _isObject(x) {\n return Object.prototype.toString.call(x) === '[object Object]';\n}","import _curry3 from './internal/_curry3.js';\nimport _has from './internal/_has.js';\n\n/**\n * Creates a new object with the own properties of the two provided objects. If\n * a key exists in both objects, the provided function is applied to the key\n * and the values associated with the key in each object, with the result being\n * used as the value associated with the key in the returned object.\n *\n * @func\n * @memberOf R\n * @since v0.19.0\n * @category Object\n * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}\n * @param {Function} fn\n * @param {Object} l\n * @param {Object} r\n * @return {Object}\n * @see R.mergeDeepWithKey, R.merge, R.mergeWith\n * @example\n *\n * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r\n * R.mergeWithKey(concatValues,\n * { a: true, thing: 'foo', values: [10, 20] },\n * { b: true, thing: 'bar', values: [15, 35] });\n * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }\n * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 }\n */\nvar mergeWithKey = /*#__PURE__*/_curry3(function mergeWithKey(fn, l, r) {\n var result = {};\n var k;\n\n for (k in l) {\n if (_has(k, l)) {\n result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];\n }\n }\n\n for (k in r) {\n if (_has(k, r) && !_has(k, result)) {\n result[k] = r[k];\n }\n }\n\n return result;\n});\nexport default mergeWithKey;","import _curry3 from './internal/_curry3.js';\nimport _isObject from './internal/_isObject.js';\nimport mergeWithKey from './mergeWithKey.js';\n\n/**\n * Creates a new object with the own properties of the two provided objects.\n * If a key exists in both objects:\n * - and both associated values are also objects then the values will be\n * recursively merged.\n * - otherwise the provided function is applied to the key and associated values\n * using the resulting value as the new value associated with the key.\n * If a key only exists in one object, the value will be associated with the key\n * of the resulting object.\n *\n * @func\n * @memberOf R\n * @since v0.24.0\n * @category Object\n * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}\n * @param {Function} fn\n * @param {Object} lObj\n * @param {Object} rObj\n * @return {Object}\n * @see R.mergeWithKey, R.mergeDeepWith\n * @example\n *\n * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r\n * R.mergeDeepWithKey(concatValues,\n * { a: true, c: { thing: 'foo', values: [10, 20] }},\n * { b: true, c: { thing: 'bar', values: [15, 35] }});\n * //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }}\n */\nvar mergeDeepWithKey = /*#__PURE__*/_curry3(function mergeDeepWithKey(fn, lObj, rObj) {\n return mergeWithKey(function (k, lVal, rVal) {\n if (_isObject(lVal) && _isObject(rVal)) {\n return mergeDeepWithKey(fn, lVal, rVal);\n } else {\n return fn(k, lVal, rVal);\n }\n }, lObj, rObj);\n});\nexport default mergeDeepWithKey;","import _curry2 from './internal/_curry2.js';\nimport mergeDeepWithKey from './mergeDeepWithKey.js';\n\n/**\n * Creates a new object with the own properties of the first object merged with\n * the own properties of the second object. If a key exists in both objects:\n * - and both values are objects, the two values will be recursively merged\n * - otherwise the value from the second object will be used.\n *\n * @func\n * @memberOf R\n * @since v0.24.0\n * @category Object\n * @sig {a} -> {a} -> {a}\n * @param {Object} lObj\n * @param {Object} rObj\n * @return {Object}\n * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey\n * @example\n *\n * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},\n * { age: 40, contact: { email: 'baa@example.com' }});\n * //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }}\n */\nvar mergeDeepRight = /*#__PURE__*/_curry2(function mergeDeepRight(lObj, rObj) {\n return mergeDeepWithKey(function (k, lVal, rVal) {\n return rVal;\n }, lObj, rObj);\n});\nexport default mergeDeepRight;","import _curry2 from './internal/_curry2.js';\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Object\n * @sig [String] -> {String: *} -> {String: *}\n * @param {Array} names an array of String property names to omit from the new object\n * @param {Object} obj The object to copy from\n * @return {Object} A new object with properties from `names` not on it.\n * @see R.pick\n * @example\n *\n * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}\n */\nvar omit = /*#__PURE__*/_curry2(function omit(names, obj) {\n var result = {};\n var index = {};\n var idx = 0;\n var len = names.length;\n\n while (idx < len) {\n index[names[idx]] = 1;\n idx += 1;\n }\n\n for (var prop in obj) {\n if (!index.hasOwnProperty(prop)) {\n result[prop] = obj[prop];\n }\n }\n return result;\n});\nexport default omit;","import _cloneRegExp from './_cloneRegExp.js';\nimport type from '../type.js';\n\n/**\n * Copies an object.\n *\n * @private\n * @param {*} value The value to be copied\n * @param {Array} refFrom Array containing the source references\n * @param {Array} refTo Array containing the copied source references\n * @param {Boolean} deep Whether or not to perform deep cloning.\n * @return {*} The copied value.\n */\nexport default function _clone(value, refFrom, refTo, deep) {\n var copy = function copy(copiedValue) {\n var len = refFrom.length;\n var idx = 0;\n while (idx < len) {\n if (value === refFrom[idx]) {\n return refTo[idx];\n }\n idx += 1;\n }\n refFrom[idx + 1] = value;\n refTo[idx + 1] = copiedValue;\n for (var key in value) {\n copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key];\n }\n return copiedValue;\n };\n switch (type(value)) {\n case 'Object':\n return copy({});\n case 'Array':\n return copy([]);\n case 'Date':\n return new Date(value.valueOf());\n case 'RegExp':\n return _cloneRegExp(value);\n default:\n return value;\n }\n}","export default function _cloneRegExp(pattern) {\n return new RegExp(pattern.source, (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : ''));\n}","import _clone from './internal/_clone.js';\nimport _curry1 from './internal/_curry1.js';\n\n/**\n * Creates a deep copy of the value which may contain (nested) `Array`s and\n * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are\n * assigned by reference rather than copied\n *\n * Dispatches to a `clone` method if present.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Object\n * @sig {*} -> {*}\n * @param {*} value The object or array to clone\n * @return {*} A deeply cloned copy of `val`\n * @example\n *\n * const objects = [{}, {}, {}];\n * const objectsClone = R.clone(objects);\n * objects === objectsClone; //=> false\n * objects[0] === objectsClone[0]; //=> false\n */\nvar clone = /*#__PURE__*/_curry1(function clone(value) {\n return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true);\n});\nexport default clone;","/**\n * Tests whether or not an object is an array.\n *\n * @private\n * @param {*} val The object to test.\n * @return {Boolean} `true` if `val` is an array, `false` otherwise.\n * @example\n *\n * _isArray([]); //=> true\n * _isArray(null); //=> false\n * _isArray({}); //=> false\n */\nexport default Array.isArray || function _isArray(val) {\n return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';\n};","import _curry1 from './_curry1.js';\nimport _isArray from './_isArray.js';\nimport _isString from './_isString.js';\n\n/**\n * Tests whether or not an object is similar to an array.\n *\n * @private\n * @category Type\n * @category List\n * @sig * -> Boolean\n * @param {*} x The object to test.\n * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.\n * @example\n *\n * _isArrayLike([]); //=> true\n * _isArrayLike(true); //=> false\n * _isArrayLike({}); //=> false\n * _isArrayLike({length: 10}); //=> false\n * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true\n */\nvar _isArrayLike = /*#__PURE__*/_curry1(function isArrayLike(x) {\n if (_isArray(x)) {\n return true;\n }\n if (!x) {\n return false;\n }\n if (typeof x !== 'object') {\n return false;\n }\n if (_isString(x)) {\n return false;\n }\n if (x.nodeType === 1) {\n return !!x.length;\n }\n if (x.length === 0) {\n return true;\n }\n if (x.length > 0) {\n return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);\n }\n return false;\n});\nexport default _isArrayLike;","export default function _isString(x) {\n return Object.prototype.toString.call(x) === '[object String]';\n}","var XWrap = /*#__PURE__*/function () {\n function XWrap(fn) {\n this.f = fn;\n }\n XWrap.prototype['@@transducer/init'] = function () {\n throw new Error('init not implemented on XWrap');\n };\n XWrap.prototype['@@transducer/result'] = function (acc) {\n return acc;\n };\n XWrap.prototype['@@transducer/step'] = function (acc, x) {\n return this.f(acc, x);\n };\n\n return XWrap;\n}();\n\nexport default function _xwrap(fn) {\n return new XWrap(fn);\n}","import _arity from './internal/_arity.js';\nimport _curry2 from './internal/_curry2.js';\n\n/**\n * Creates a function that is bound to a context.\n * Note: `R.bind` does not provide the additional argument-binding capabilities of\n * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).\n *\n * @func\n * @memberOf R\n * @since v0.6.0\n * @category Function\n * @category Object\n * @sig (* -> *) -> {*} -> (* -> *)\n * @param {Function} fn The function to bind to context\n * @param {Object} thisObj The context to bind `fn` to\n * @return {Function} A function that will execute in the context of `thisObj`.\n * @see R.partial\n * @example\n *\n * const log = R.bind(console.log, console);\n * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}\n * // logs {a: 2}\n * @symb R.bind(f, o)(a, b) = f.call(o, a, b)\n */\nvar bind = /*#__PURE__*/_curry2(function bind(fn, thisObj) {\n return _arity(fn.length, function () {\n return fn.apply(thisObj, arguments);\n });\n});\nexport default bind;","export default function _arity(n, fn) {\n /* eslint-disable no-unused-vars */\n switch (n) {\n case 0:\n return function () {\n return fn.apply(this, arguments);\n };\n case 1:\n return function (a0) {\n return fn.apply(this, arguments);\n };\n case 2:\n return function (a0, a1) {\n return fn.apply(this, arguments);\n };\n case 3:\n return function (a0, a1, a2) {\n return fn.apply(this, arguments);\n };\n case 4:\n return function (a0, a1, a2, a3) {\n return fn.apply(this, arguments);\n };\n case 5:\n return function (a0, a1, a2, a3, a4) {\n return fn.apply(this, arguments);\n };\n case 6:\n return function (a0, a1, a2, a3, a4, a5) {\n return fn.apply(this, arguments);\n };\n case 7:\n return function (a0, a1, a2, a3, a4, a5, a6) {\n return fn.apply(this, arguments);\n };\n case 8:\n return function (a0, a1, a2, a3, a4, a5, a6, a7) {\n return fn.apply(this, arguments);\n };\n case 9:\n return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {\n return fn.apply(this, arguments);\n };\n case 10:\n return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {\n return fn.apply(this, arguments);\n };\n default:\n throw new Error('First argument to _arity must be a non-negative integer no greater than ten');\n }\n}","import _isArrayLike from './_isArrayLike.js';\nimport _xwrap from './_xwrap.js';\nimport bind from '../bind.js';\n\nfunction _arrayReduce(xf, acc, list) {\n var idx = 0;\n var len = list.length;\n while (idx < len) {\n acc = xf['@@transducer/step'](acc, list[idx]);\n if (acc && acc['@@transducer/reduced']) {\n acc = acc['@@transducer/value'];\n break;\n }\n idx += 1;\n }\n return xf['@@transducer/result'](acc);\n}\n\nfunction _iterableReduce(xf, acc, iter) {\n var step = iter.next();\n while (!step.done) {\n acc = xf['@@transducer/step'](acc, step.value);\n if (acc && acc['@@transducer/reduced']) {\n acc = acc['@@transducer/value'];\n break;\n }\n step = iter.next();\n }\n return xf['@@transducer/result'](acc);\n}\n\nfunction _methodReduce(xf, acc, obj, methodName) {\n return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));\n}\n\nvar symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';\n\nexport default function _reduce(fn, acc, list) {\n if (typeof fn === 'function') {\n fn = _xwrap(fn);\n }\n if (_isArrayLike(list)) {\n return _arrayReduce(fn, acc, list);\n }\n if (typeof list['fantasy-land/reduce'] === 'function') {\n return _methodReduce(fn, acc, list, 'fantasy-land/reduce');\n }\n if (list[symIterator] != null) {\n return _iterableReduce(fn, acc, list[symIterator]());\n }\n if (typeof list.next === 'function') {\n return _iterableReduce(fn, acc, list);\n }\n if (typeof list.reduce === 'function') {\n return _methodReduce(fn, acc, list, 'reduce');\n }\n\n throw new TypeError('reduce: list must be array or iterable');\n}","import _curry3 from './internal/_curry3.js';\nimport _reduce from './internal/_reduce.js';\n\n/**\n * Returns a single item by iterating through the list, successively calling\n * the iterator function and passing it an accumulator value and the current\n * value from the array, and then passing the result to the next call.\n *\n * The iterator function receives two values: *(acc, value)*. It may use\n * [`R.reduced`](#reduced) to shortcut the iteration.\n *\n * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function\n * is *(value, acc)*.\n *\n * Note: `R.reduce` does not skip deleted or unassigned indices (sparse\n * arrays), unlike the native `Array.prototype.reduce` method. For more details\n * on this behavior, see:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description\n *\n * Dispatches to the `reduce` method of the third argument, if present. When\n * doing so, it is up to the user to handle the [`R.reduced`](#reduced)\n * shortcuting, as this is not implemented by `reduce`.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category List\n * @sig ((a, b) -> a) -> a -> [b] -> a\n * @param {Function} fn The iterator function. Receives two values, the accumulator and the\n * current element from the array.\n * @param {*} acc The accumulator value.\n * @param {Array} list The list to iterate over.\n * @return {*} The final, accumulated value.\n * @see R.reduced, R.addIndex, R.reduceRight\n * @example\n *\n * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10\n * // - -10\n * // / \\ / \\\n * // - 4 -6 4\n * // / \\ / \\\n * // - 3 ==> -3 3\n * // / \\ / \\\n * // - 2 -1 2\n * // / \\ / \\\n * // 0 1 0 1\n *\n * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d)\n */\nvar reduce = /*#__PURE__*/_curry3(_reduce);\nexport default reduce;","export enum Type {\n Array = 'Array',\n Boolean = 'Boolean',\n ConceptUuid = 'ConceptUuid',\n Number = 'Number',\n Object = 'Object',\n String = 'String',\n UUID = 'UUID',\n PersonAttributeTypeUuid = 'PersonAttributeTypeUuid',\n PatientIdentifierTypeUuid = 'PatientIdentifierTypeUuid',\n}\n\n// Full-powered typing for Config and Schema trees depends on being able to\n// have types like `string not \"_default\"`. There is an experimental PR\n// for this feature, https://github.com/microsoft/TypeScript/pull/29317\n// But it is not likely to be merged any time terribly soon. (Nov 11, 2020)\nexport interface ConfigSchema {\n [key: string]: ConfigSchema | ConfigValue;\n _type?: Type;\n _validators?: Array<Validator>;\n _elements?: ConfigSchema;\n}\n\nexport interface Config {\n [moduleName: string]: { [key: string]: any };\n}\n\nexport interface ConfigObject {\n [key: string]: any;\n 'Display conditions'?: DisplayConditionsConfigObject;\n 'Translation overrides'?: Record<string, Record<string, string>>;\n}\n\nexport interface DisplayConditionsConfigObject {\n privileges?: string[];\n}\n\nexport type ConfigValue = string | number | boolean | void | Array<any> | object;\n\nexport interface ExtensionSlotConfig {\n add?: Array<string>;\n remove?: Array<string>;\n order?: Array<string>;\n configure?: ExtensionSlotConfigureValueObject;\n}\n\nexport interface ExtensionSlotConfigureValueObject {\n [key: string]: object;\n}\n\nexport interface ExtensionSlotConfigObject {\n /** Additional extension IDs to assign to this slot, in addition to those `attach`ed in code. */\n add?: Array<string>;\n /** Extension IDs which were `attach`ed to the slot but which should not be assigned. */\n remove?: Array<string>;\n /** Overrides the default ordering of extensions. */\n order?: Array<string>;\n}\n\nexport type ProvidedConfig = {\n source: string;\n config: Config;\n};\n\nexport type ValidatorFunction = (value: any) => boolean;\n\nexport type Validator = (value: any) => void | string;\n","/** @module @category Config Validation */\nimport type { Validator, ValidatorFunction } from '../types';\n\n/**\n * Constructs a custom validator.\n *\n * ### Example\n *\n * ```typescript\n * {\n * foo: {\n * _default: 0,\n * _validators: [\n * validator(val => val >= 0, \"Must not be negative.\")\n * ]\n * }\n * }\n * ```\n * @param validationFunction Takes the configured value as input. Returns true\n * if it is valid, false otherwise.\n * @param message A string message that explains why the value is invalid. Can\n * also be a function that takes the value as input and returns a string.\n * @returns A validator ready for use in a config schema\n */\nexport function validator(\n validationFunction: ValidatorFunction,\n message: string | ((value: any) => string),\n): Validator {\n return (value) => {\n if (!validationFunction(value)) {\n if (typeof message === 'function') {\n return message(value);\n } else {\n return message;\n }\n }\n };\n}\n","import { validator } from './validator';\n\nexport const isArray = validator((val) => Array.isArray(val), 'must be an array');\n\nexport const isBoolean = validator((val) => typeof val === 'boolean', 'must be a boolean');\n\nexport const isNumber = validator((val) => typeof val === 'number', 'must be a number');\n\nexport const isString = validator((val) => typeof val === 'string', 'must be a string');\n\nexport const isObject = validator(\n (val) => typeof val === 'object' && !Array.isArray(val) && val !== null,\n 'must be an object (not an array or null)',\n);\n\nexport const isUuid = validator(\n (val) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(val) || /^[0-9a-f]{36}$/i.test(val),\n 'must be a valid UUID or a 36-character hexadecimal string',\n);\n","/** @module @category Config */\nimport { createGlobalStore, getGlobalStore } from '@openmrs/esm-state';\nimport { omit } from 'ramda';\nimport type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfigObject, ProvidedConfig } from '../types';\n\n/**\n * Internal store\n * A store of the inputs and internal state\n * @internal\n */\nexport interface ConfigInternalStore {\n /** Configs added using the `provide` function */\n providedConfigs: Array<ProvidedConfig>;\n /** An object with module names for keys and schemas for values */\n schemas: Record<string, ConfigSchema>;\n /** Whether to use dev defaults or not */\n}\n\nconst configInternalStoreInitialValue = {\n providedConfigs: [],\n schemas: {},\n};\n\n/**\n * @internal\n */\nexport const configInternalStore = createGlobalStore<ConfigInternalStore>(\n 'config-internal',\n configInternalStoreInitialValue,\n);\n\n/**\n * Temporary config\n * LocalStorage-based config used by the implementer tools\n * @internal\n */\nexport interface TemporaryConfigStore {\n config: Config;\n}\n\n/** @internal */\nexport const temporaryConfigStore = createGlobalStore<TemporaryConfigStore>('temporary-config', {\n config: getTemporaryConfig(),\n});\n\ntemporaryConfigStore.subscribe((state) => {\n setTemporaryConfig(state.config);\n});\n\nfunction setTemporaryConfig(value: Config) {\n localStorage.setItem('openmrs:temporaryConfig', JSON.stringify(value));\n}\n\nfunction getTemporaryConfig(): Config {\n try {\n return JSON.parse(localStorage.getItem('openmrs:temporaryConfig') || '{}');\n } catch (e) {\n return {};\n }\n}\n\n/**\n * Config-side extension store\n * Just what esm-config needs to know about extension state. This\n * is to avoid having esm-config depend on esm-extensions, which would\n * create a circular dependency.\n * @internal\n */\nexport interface ConfigExtensionStore {\n mountedExtensions: Array<ConfigExtensionStoreElement>;\n}\n\n/** @internal */\nexport interface ConfigExtensionStoreElement {\n slotModuleName: string;\n extensionModuleName: string;\n slotName: string;\n extensionId: string;\n}\n\n/** @internal */\nexport const configExtensionStore = createGlobalStore<ConfigExtensionStore>('config-store-of-extension-state', {\n mountedExtensions: [],\n});\n\n/**\n * Output configs\n *\n * Each module has its own stores for its config and its extension slots' configs.\n * @internal\n */\nexport interface ConfigStore {\n config: ConfigObject | null;\n loaded: boolean;\n}\n\nfunction initializeConfigStore() {\n return {\n config: null,\n loaded: false,\n };\n}\n\n/** @internal */\nexport function getConfigStore(moduleName: string) {\n // We use a store for each module's config, named `config-${moduleName}`\n return getGlobalStore<ConfigStore>(`config-module-${moduleName}`, initializeConfigStore());\n}\n\n/**\n * Configuration for all the specific extension slots\n * @internal\n */\nexport interface ExtensionSlotsConfigStore {\n slots: {\n [slotName: string]: {\n config: ExtensionSlotConfigObject;\n loaded: boolean;\n };\n };\n}\n\n/** @internal */\nexport function getExtensionSlotsConfigStore() {\n return getGlobalStore<ExtensionSlotsConfigStore>(`config-extension-slots`, {\n slots: {},\n });\n}\n\n/** @internal */\nexport function getExtensionSlotConfig(slotName: string) {\n return getExtensionSlotConfigFromStore(getExtensionSlotsConfigStore().getState(), slotName);\n}\n\n/** @internal */\nexport function getExtensionSlotConfigFromStore(state: ExtensionSlotsConfigStore, slotName: string) {\n const slotConfig = state.slots[slotName];\n return slotConfig ?? { loaded: false, config: {} };\n}\n\n/** @internal */\nexport interface ExtensionsConfigStore {\n configs: {\n [slotName: string]: {\n [extensionId: string]: ConfigStore;\n };\n };\n}\n\n/**\n * One store for all the extensions\n * @internal\n */\nexport function getExtensionsConfigStore() {\n return getGlobalStore<ExtensionsConfigStore>(`config-extensions`, {\n configs: {},\n });\n}\n\n/** @internal */\nexport function getExtensionConfig(slotName: string, extensionId: string) {\n const extensionConfig = Object.assign(\n {},\n getExtensionConfigFromStore(getExtensionsConfigStore().getState(), slotName, extensionId),\n );\n extensionConfig.config = omit(['Display conditions', 'Translation overrides'], extensionConfig.config);\n return extensionConfig;\n}\n\n/** @internal */\nexport function getExtensionConfigFromStore(state: ExtensionsConfigStore, slotName: string, extensionId: string) {\n const extensionConfig = state.configs[slotName]?.[extensionId];\n return extensionConfig ?? { loaded: false, config: null };\n}\n\n/**\n * A store of the implementer tools output config\n * @internal\n */\nexport interface ImplementerToolsConfigStore {\n config: Config;\n}\n\n/** @internal */\nexport const implementerToolsConfigStore = createGlobalStore<ImplementerToolsConfigStore>('config-implementer-tools', {\n config: {},\n});\n","/** @module @category Config */\nimport { clone, reduce, mergeDeepRight, equals, omit } from 'ramda';\nimport type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig, ExtensionSlotConfigObject } from '../types';\nimport { Type } from '../types';\nimport { isArray, isBoolean, isUuid, isNumber, isObject, isString } from '../validators/type-validators';\nimport type { ConfigExtensionStore, ConfigInternalStore, ConfigStore } from './state';\nimport {\n configInternalStore,\n configExtensionStore,\n getConfigStore,\n getExtensionsConfigStore,\n implementerToolsConfigStore,\n temporaryConfigStore,\n getExtensionSlotsConfigStore,\n} from './state';\nimport type {} from '@openmrs/esm-globals';\nimport type { TemporaryConfigStore } from '..';\n\n/**\n * Store setup\n *\n *\n * Set up stores and subscriptions so that inputs get processed appropriately.\n *\n * There are *input* stores and *output* stores. The *input* stores\n * are configInternalStore, temporaryConfigStore, and configExtensionStore. The\n * output stores are set in the `compute...` functions. They are the module\n * config stores, the extension slot config stores (by module), the extension\n * config stores, and the implementer tools config store.\n *\n * This code sets up the subscriptions so that when an input store changes,\n * the correct set of output stores are updated.\n *\n * All `compute...` functions except `computeExtensionConfigs` are pure\n * (or are supposed to be), other than the fact that they all `setState`\n * store values at the end. `computeExtensionConfigs` calls `getGlobalStore`,\n * which creates stores.\n */\ncomputeModuleConfig(configInternalStore.getState(), temporaryConfigStore.getState());\nconfigInternalStore.subscribe((configState) => computeModuleConfig(configState, temporaryConfigStore.getState()));\ntemporaryConfigStore.subscribe((tempConfigState) =>\n computeModuleConfig(configInternalStore.getState(), tempConfigState),\n);\n\ncomputeImplementerToolsConfig(configInternalStore.getState(), temporaryConfigStore.getState());\nconfigInternalStore.subscribe((configState) =>\n computeImplementerToolsConfig(configState, temporaryConfigStore.getState()),\n);\ntemporaryConfigStore.subscribe((tempConfigState) =>\n computeImplementerToolsConfig(configInternalStore.getState(), tempConfigState),\n);\n\ncomputeExtensionSlotConfigs(configInternalStore.getState(), temporaryConfigStore.getState());\nconfigInternalStore.subscribe((configState) =>\n computeExtensionSlotConfigs(configState, temporaryConfigStore.getState()),\n);\ntemporaryConfigStore.subscribe((tempConfigState) =>\n computeExtensionSlotConfigs(configInternalStore.getState(), tempConfigState),\n);\n\ncomputeExtensionConfigs(\n configInternalStore.getState(),\n configExtensionStore.getState(),\n temporaryConfigStore.getState(),\n);\nconfigInternalStore.subscribe((configState) => {\n computeExtensionConfigs(configState, configExtensionStore.getState(), temporaryConfigStore.getState());\n});\nconfigExtensionStore.subscribe((extensionState) => {\n computeExtensionConfigs(configInternalStore.getState(), extensionState, temporaryConfigStore.getState());\n});\ntemporaryConfigStore.subscribe((tempConfigState) => {\n computeExtensionConfigs(configInternalStore.getState(), configExtensionStore.getState(), tempConfigState);\n});\n\nfunction computeModuleConfig(state: ConfigInternalStore, tempState: TemporaryConfigStore) {\n for (let moduleName of Object.keys(state.schemas)) {\n const config = getConfigForModule(moduleName, state, tempState);\n const moduleStore = getConfigStore(moduleName);\n moduleStore.setState({ loaded: true, config });\n }\n}\n\nfunction computeExtensionSlotConfigs(state: ConfigInternalStore, tempState: TemporaryConfigStore) {\n const slotConfigs = getExtensionSlotConfigs(state, tempState);\n const newSlotStoreEntries = Object.fromEntries(\n Object.entries(slotConfigs).map(([slotName, config]) => [slotName, { loaded: true, config }]),\n );\n const slotStore = getExtensionSlotsConfigStore();\n const oldState = slotStore.getState();\n const newState = { slots: { ...oldState.slots, ...newSlotStoreEntries } };\n if (!equals(oldState, newState)) {\n slotStore.setState(newState);\n }\n}\n\nfunction computeImplementerToolsConfig(state: ConfigInternalStore, tempConfigState: TemporaryConfigStore) {\n const config = getImplementerToolsConfig(state, tempConfigState);\n implementerToolsConfigStore.setState({ config });\n}\n\nfunction computeExtensionConfigs(\n configState: ConfigInternalStore,\n extensionState: ConfigExtensionStore,\n tempConfigState: TemporaryConfigStore,\n) {\n const configs = {};\n for (let extension of extensionState.mountedExtensions) {\n const config = computeExtensionConfig(\n extension.slotModuleName,\n extension.extensionModuleName,\n extension.slotName,\n extension.extensionId,\n configState,\n tempConfigState,\n );\n configs[extension.slotName] = {\n ...configs[extension.slotName],\n [extension.extensionId]: { config, loaded: true },\n };\n }\n getExtensionsConfigStore().setState({ configs });\n}\n\n/*\n * API\n *\n */\n\n/**\n * This defines a configuration schema for a module. The schema tells the\n * configuration system how the module can be configured. It specifies\n * what makes configuration valid or invalid.\n *\n * See [Configuration System](https://o3-docs.openmrs.org/docs/configuration-system)\n * for more information about defining a config schema.\n *\n * @param moduleName Name of the module the schema is being defined for. Generally\n * should be the one in which the `defineConfigSchema` call takes place.\n * @param schema The config schema for the module\n */\nexport function defineConfigSchema(moduleName: string, schema: ConfigSchema) {\n validateConfigSchema(moduleName, schema);\n const enhancedSchema = mergeDeepRight(schema, implicitConfigSchema) as ConfigSchema;\n\n const state = configInternalStore.getState();\n configInternalStore.setState({\n schemas: { ...state.schemas, [moduleName]: enhancedSchema },\n });\n}\n\n/**\n * This defines a configuration schema for an extension. When a schema is defined\n * for an extension, that extension will receive the configuration corresponding\n * to that schema, rather than the configuration corresponding to the module\n * in which it is defined.\n *\n * The schema tells the configuration system how the module can be configured.\n * It specifies what makes configuration valid or invalid.\n *\n * See [Configuration System](https://o3-docs.openmrs.org/docs/configuration-system)\n * for more information about defining a config schema.\n *\n * @param extensionName Name of the extension the schema is being defined for.\n * Should match the `name` of one of the `extensions` entries being returned\n * by `setupOpenMRS`.\n * @param schema The config schema for the extension\n */\nexport function defineExtensionConfigSchema(extensionName: string, schema: ConfigSchema) {\n validateConfigSchema(extensionName, schema);\n const enhancedSchema = mergeDeepRight(schema, implicitConfigSchema) as ConfigSchema;\n\n const state = configInternalStore.getState();\n if (state.schemas[extensionName]) {\n console.error(\n `Config schema for extension ${extensionName} already exists. If there are multiple extensions with this same name, one will probably crash.`,\n );\n }\n\n configInternalStore.setState({\n schemas: { ...state.schemas, [extensionName]: enhancedSchema },\n });\n}\n\nexport function provide(config: Config, sourceName = 'provided') {\n const state = configInternalStore.getState();\n configInternalStore.setState({\n providedConfigs: [...state.providedConfigs, { source: sourceName, config }],\n });\n}\n\n/**\n * A promise-based way to access the config as soon as it is fully loaded.\n * If it is already loaded, resolves the config in its present state.\n *\n * This is a useful function if you need to get the config in the course\n * of the execution of a function.\n *\n * @param moduleName The name of the module for which to look up the config\n */\nexport function getConfig<T = Record<string, any>>(moduleName: string): Promise<T> {\n return new Promise<T>((resolve) => {\n const store = getConfigStore(moduleName);\n function update(state: ConfigStore) {\n if (state.loaded && state.config) {\n const config = omit(['Display conditions', 'Translation overrides'], state.config);\n resolve(config as T);\n unsubscribe && unsubscribe();\n }\n }\n update(store.getState());\n const unsubscribe = store.subscribe(update);\n });\n}\n\n/** @internal */\nexport function getConfigInternal(moduleName: string): Promise<Config> {\n return new Promise<Config>((resolve) => {\n const store = getConfigStore(moduleName);\n function update(state: ConfigStore) {\n if (state.loaded && state.config) {\n const config = state.config;\n resolve(config);\n unsubscribe && unsubscribe();\n }\n }\n update(store.getState());\n const unsubscribe = store.subscribe(update);\n });\n}\n\n/**\n * Validate and interpolate defaults for `providedConfig` according to `schema`\n *\n * @param schema a configuration schema\n * @param providedConfig an object of config values (without the top-level module name)\n * @param keyPathContext a dot-deparated string which helps the user figure out where\n * the provided config came from\n * @internal\n */\nexport function processConfig(schema: ConfigSchema, providedConfig: ConfigObject, keyPathContext: string) {\n validateStructure(schema, providedConfig, keyPathContext);\n const config = setDefaults(schema, providedConfig);\n runAllValidatorsInConfigTree(schema, config, keyPathContext);\n return config;\n}\n\n/*\n * Helper functions\n *\n */\n\n/**\n * Returns the configuration for an extension. This configuration is specific\n * to the slot in which it is mounted, and its ID within that slot.\n *\n * The schema for that configuration is the extension schema. If no extension\n * schema has been provided, the schema used is the schema of the module in\n * which the extension is defined.\n *\n * @param slotModuleName The name of the module which defines the extension slot\n * @param extensionModuleName The name of the module which defines the extension (and therefore the config schema)\n * @param slotName The name of the extension slot where the extension is mounted\n * @param extensionId The ID of the extension in its slot\n */\nfunction computeExtensionConfig(\n slotModuleName: string,\n extensionModuleName: string,\n slotName: string,\n extensionId: string,\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n) {\n const extensionName = getExtensionNameFromId(extensionId);\n const extensionConfigSchema = configState.schemas[extensionName];\n const nameOfSchemaSource = extensionConfigSchema ? extensionName : extensionModuleName;\n const providedConfigs = getProvidedConfigs(configState, tempConfigState);\n const slotModuleConfig = mergeConfigsFor(slotModuleName, providedConfigs);\n const configOverride = slotModuleConfig?.extensionSlots?.[slotName]?.configure?.[extensionId] ?? {};\n const extensionConfig = mergeConfigsFor(nameOfSchemaSource, providedConfigs);\n const combinedConfig = mergeConfigs([extensionConfig, configOverride]);\n // TODO: validate that a schema exists for the module\n const schema = extensionConfigSchema ?? configState.schemas[extensionModuleName];\n validateStructure(schema, combinedConfig, nameOfSchemaSource);\n const config = setDefaults(schema, combinedConfig);\n runAllValidatorsInConfigTree(schema, config, nameOfSchemaSource);\n delete config.extensionSlots;\n return config;\n}\n\nfunction getImplementerToolsConfig(\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n): Record<string, Config> {\n let result = getSchemaWithValuesAndSources(clone(configState.schemas));\n const configsAndSources = [\n ...configState.providedConfigs.map((c) => [c.config, c.source]),\n [tempConfigState.config, 'temporary config'],\n ] as Array<[Config, string]>;\n for (let [config, source] of configsAndSources) {\n result = mergeConfigs([result, createValuesAndSourcesTree(config, source)]);\n }\n return result;\n}\n\nfunction getSchemaWithValuesAndSources(schema) {\n if (schema.hasOwnProperty('_default')) {\n return { ...schema, _value: schema._default, _source: 'default' };\n } else if (isOrdinaryObject(schema)) {\n return Object.keys(schema).reduce((obj, key) => {\n obj[key] = getSchemaWithValuesAndSources(schema[key]);\n return obj;\n }, {});\n } else {\n // at this point, the schema is bad and an error will have been logged during schema validation\n return {};\n }\n}\n\nfunction createValuesAndSourcesTree(config: ConfigObject, source: string) {\n if (isOrdinaryObject(config)) {\n return Object.keys(config).reduce((obj, key) => {\n obj[key] = createValuesAndSourcesTree(config[key], source);\n return obj;\n }, {});\n } else {\n return { _value: config, _source: source };\n }\n}\n\nfunction getExtensionSlotConfigs(\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n): Record<string, ExtensionSlotConfigObject> {\n const allConfigs = mergeConfigs(getProvidedConfigs(configState, tempConfigState));\n const slotConfigPerModule: Record<string, Record<string, ExtensionSlotConfig>> = Object.keys(allConfigs).reduce(\n (obj, key) => {\n if (allConfigs[key]?.extensionSlots) {\n obj[key] = allConfigs[key]?.extensionSlots;\n }\n return obj;\n },\n {},\n );\n validateAllExtensionSlotConfigs(slotConfigPerModule);\n const slotConfigs = Object.keys(slotConfigPerModule).reduce((obj, key) => {\n obj = { ...obj, ...slotConfigPerModule[key] };\n return obj;\n }, {});\n return slotConfigs;\n}\n\nfunction validateAllExtensionSlotConfigs(slotConfigPerModule: Record<string, Record<string, ExtensionSlotConfig>>) {\n for (let [moduleName, configBySlotName] of Object.entries(slotConfigPerModule)) {\n for (let [slotName, config] of Object.entries(configBySlotName)) {\n validateExtensionSlotConfig(config, moduleName, slotName);\n }\n }\n}\n\nfunction validateExtensionSlotConfig(config: ExtensionSlotConfig, moduleName: string, slotName: string): void {\n const keyPath = `${moduleName}.extensionSlots.${slotName}`;\n const errorPrefix = `Extension slot config '${keyPath}'`;\n const invalidKeys = Object.keys(config).filter((k) => !['add', 'remove', 'order', 'configure'].includes(k));\n if (invalidKeys.length) {\n logError(keyPath, errorPrefix + `' contains invalid keys '${invalidKeys.join(\"', '\")}'`);\n }\n if (config.add) {\n if (!Array.isArray(config.add) || !config.add.every((n) => typeof n === 'string')) {\n logError(keyPath, errorPrefix + `.add' is invalid. Must be an array of strings (extension IDs)`);\n }\n }\n if (config.remove) {\n if (!Array.isArray(config.remove) || !config.remove.every((n) => typeof n === 'string')) {\n logError(keyPath, errorPrefix + `.remove' is invalid. Must be an array of strings (extension IDs)`);\n }\n }\n if (config.order) {\n if (!Array.isArray(config.order) || !config.order.every((n) => typeof n === 'string')) {\n logError(keyPath, errorPrefix + `.order' is invalid. Must be an array of strings (extension IDs)`);\n }\n }\n if (config.configure) {\n if (!isOrdinaryObject(config.configure)) {\n logError(keyPath, errorPrefix + `.configure' is invalid. Must be an object with extension IDs for keys`);\n }\n }\n}\n\nfunction getProvidedConfigs(configState: ConfigInternalStore, tempConfigState: TemporaryConfigStore): Array<Config> {\n return [...configState.providedConfigs.map((c) => c.config), tempConfigState.config];\n}\n\n/**\n * Validates the config schema for a module. Since problems identified here are programming errors\n * that hopefully will be caught during development, this function logs errors to the console directly;\n * it's fine if we spam the user with these errors.\n */\nfunction validateConfigSchema(moduleName: string, schema: ConfigSchema, keyPath = '') {\n const updateMessage = `Please verify that you are running the latest version and, if so, alert the maintainer.`;\n\n for (const key of Object.keys(schema).filter((k) => !k.startsWith('_'))) {\n const thisKeyPath = keyPath + (keyPath && '.') + key;\n const schemaPart = schema[key] as ConfigSchema;\n\n if (thisKeyPath === 'Display conditions') {\n console.error(\n `${moduleName} declares a configuration option called \"Display conditions\"; the \"Display conditions\" option is a reserved name. ${updateMessage}`,\n );\n }\n\n if (thisKeyPath === 'Translation overrides') {\n console.error(\n `${moduleName} declares a configuration option called \"Translation overrides\"; the \"Translation overrides\" option is a reserved name. ${updateMessage}`,\n );\n }\n\n if (!isOrdinaryObject(schemaPart)) {\n console.error(`${moduleName} has bad config schema definition for key '${thisKeyPath}'. ${updateMessage}`);\n continue;\n }\n\n if (!schemaPart.hasOwnProperty('_default')) {\n // recurse for nested config keys\n validateConfigSchema(moduleName, schemaPart, thisKeyPath);\n }\n\n const elements = schemaPart._elements;\n if (hasObjectSchema(elements)) {\n validateConfigSchema(moduleName, elements, thisKeyPath + '._elements');\n }\n\n if (schemaPart._validators) {\n for (let validator of schemaPart._validators) {\n if (typeof validator !== 'function') {\n console.error(\n `${moduleName} has invalid validator for key '${thisKeyPath}' ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: validators must be functions that return either ` +\n `undefined or an error string. Received ${validator}.`,\n );\n }\n }\n }\n\n const valueType = schemaPart._type;\n if (valueType && !Object.values(Type).includes(valueType)) {\n console.error(\n `${moduleName} has invalid type for key '${thisKeyPath}' ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: the allowed types are ${Object.values(Type).join(', ')}. ` +\n `Received '${valueType}'`,\n );\n }\n\n if (\n Object.keys(schemaPart).every((k) => ['_description', '_validators', '_elements', '_type'].includes(k)) &&\n !keyPath.includes('._elements')\n ) {\n console.error(\n `${moduleName} has bad config schema definition for key '${thisKeyPath}'. ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: all config elements must have a default. ` +\n `Received ${JSON.stringify(schemaPart)}`,\n );\n }\n\n if (elements && valueType && ![Type.Array, Type.Object].includes(valueType)) {\n console.error(\n `${moduleName} has bad config schema definition for key '${thisKeyPath}'. ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. ` +\n `Received ${JSON.stringify(valueType)}`,\n );\n }\n }\n}\n\nfunction getConfigForModule(\n moduleName: string,\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n): ConfigObject {\n if (!configState.schemas.hasOwnProperty(moduleName)) {\n throw Error('No config schema has been defined for ' + moduleName);\n }\n\n const schema = configState.schemas[moduleName];\n const inputConfig = mergeConfigsFor(moduleName, getProvidedConfigs(configState, tempConfigState));\n validateStructure(schema, inputConfig, moduleName);\n const config = setDefaults(schema, inputConfig);\n runAllValidatorsInConfigTree(schema, config, moduleName);\n delete config.extensionSlots;\n return config;\n}\n\nfunction mergeConfigsFor(moduleName: string, allConfigs: Array<Config>): ConfigObject {\n const allConfigsForModule = allConfigs.map(({ [moduleName]: c }) => c).filter((c) => !!c);\n\n return mergeConfigs(allConfigsForModule);\n}\n\nfunction mergeConfigs(configs: Array<Config>) {\n const mergeDeepAll = reduce(mergeDeepRight);\n return mergeDeepAll({}, configs) as Config;\n}\n\n/**\n * Recursively check the provided config tree to make sure that all\n * of the provided properties exist in the schema, and that types are\n * correct. Does not run validators yet, since those will be run on\n * the config with the defaults filled in.\n */\nfunction validateStructure(schema: ConfigSchema, config: ConfigObject, keyPath = '') {\n // validate each constituent element\n for (const key of Object.keys(config)) {\n const value = config[key];\n const thisKeyPath = keyPath + '.' + key;\n const schemaPart = schema[key] as ConfigSchema;\n\n if (!schema.hasOwnProperty(key)) {\n if (!(key === 'extensionSlots' && keyPath !== '')) {\n logError(thisKeyPath, `Unknown config key '${thisKeyPath}' provided. Ignoring.`);\n }\n\n continue;\n }\n\n validateBranchStructure(schemaPart, value, thisKeyPath);\n }\n}\n\nfunction validateBranchStructure(schemaPart: ConfigSchema, value: any, keyPath: string) {\n checkType(keyPath, schemaPart._type, value);\n\n if (isOrdinaryObject(value)) {\n // structurally validate only if there's elements specified\n // or there's no `_default` value (which would indicate a freeform object)\n if (schemaPart._type === Type.Object) {\n validateDictionaryStructure(schemaPart, value, keyPath);\n } else if (!schemaPart.hasOwnProperty('_default')) {\n // recurse to validate nested object structure\n validateStructure(schemaPart, value, keyPath);\n }\n } else {\n if (schemaPart._type === Type.Array) {\n validateArrayStructure(schemaPart, value, keyPath);\n }\n }\n}\n\nfunction validateDictionaryStructure(dictionarySchema: ConfigSchema, config: ConfigObject, keyPath: string) {\n if (dictionarySchema._elements) {\n for (const key of Object.keys(config)) {\n const value = config[key];\n validateStructure(dictionarySchema._elements, value, `${keyPath}.${key}`);\n }\n }\n}\n\nfunction validateArrayStructure(arraySchema: ConfigSchema, value: ConfigObject, keyPath: string) {\n // if there is an array element object schema, verify that elements match it\n if (hasObjectSchema(arraySchema._elements)) {\n for (let i = 0; i < value.length; i++) {\n validateBranchStructure(arraySchema._elements, value[i], `${keyPath}[${i}]`);\n }\n }\n\n for (let i = 0; i < value.length; i++) {\n checkType(`${keyPath}[${i}]`, arraySchema._elements?._type, value[i]);\n }\n}\n\n/**\n * Run all the validators in the config tree. This should be run\n * on the config object after it has been filled in with all the defaults, since\n * higher-level validators may refer to default values.\n */\nfunction runAllValidatorsInConfigTree(schema: ConfigSchema, config: ConfigObject, keyPath = '') {\n // If `!schema`, there should have been a structural validation error printed already.\n if (schema) {\n if (config !== schema._default) {\n runValidators(keyPath, schema._validators, config);\n }\n\n if (isOrdinaryObject(config)) {\n for (const key of Object.keys(config)) {\n const value = config[key];\n const thisKeyPath = keyPath + '.' + key;\n const schemaPart = schema[key] as ConfigSchema;\n if (schema._type === Type.Object && schema._elements) {\n runAllValidatorsInConfigTree(schema._elements, value, thisKeyPath);\n } else {\n runAllValidatorsInConfigTree(schemaPart, value, thisKeyPath);\n }\n }\n } else if (Array.isArray(config) && schema._elements) {\n for (let i = 0; i < config.length; i++) {\n runAllValidatorsInConfigTree(schema._elements, config[i], `${keyPath}[${i}]`);\n }\n }\n }\n}\n\nfunction checkType(keyPath: string, _type: Type | undefined, value: any) {\n if (_type) {\n const validator: Record<string, Function> = {\n Array: isArray,\n Boolean: isBoolean,\n ConceptUuid: isUuid,\n Number: isNumber,\n Object: isObject,\n String: isString,\n UUID: isUuid,\n PersonAttributeTypeUuid: isUuid,\n PatientIdentifierTypeUuid: isUuid,\n };\n runValidators(keyPath, [validator[_type]], value);\n }\n}\n\nfunction runValidators(keyPath: string, validators: Array<Function> | undefined, value: any) {\n if (validators) {\n try {\n for (let validator of validators) {\n const validatorResult = validator(value);\n\n if (typeof validatorResult === 'string') {\n const message =\n typeof value === 'object'\n ? `Invalid configuration for ${keyPath}: ${validatorResult}`\n : `Invalid configuration value ${value} for ${keyPath}: ${validatorResult}`;\n logError(keyPath, message);\n }\n }\n } catch (e) {\n console.error(`Skipping invalid validator at \"${keyPath}\". Encountered error\\n\\t${e}`);\n }\n }\n}\n\n// Recursively fill in the config with values from the schema.\nconst setDefaults = (schema: ConfigSchema, inputConfig: Config) => {\n const config = clone(inputConfig);\n\n if (!schema) {\n return config;\n }\n\n for (const key of Object.keys(schema)) {\n const configPart = config[key];\n const schemaPart = schema[key] as ConfigSchema;\n\n // The `schemaPart &&` clause of this `if` statement will only fail\n // if the schema is very invalid. It is there to prevent the app from\n // crashing completely, though it will produce unexpected behavior.\n // If this happens, there should be legible errors in the console from\n // the schema validator.\n if (schemaPart && schemaPart.hasOwnProperty('_default')) {\n // We assume that schemaPart defines a config value, since it has\n // a property `_default`.\n if (!config.hasOwnProperty(key)) {\n (config[key] as any) = schemaPart['_default'];\n }\n\n // We also check if it is an object or array with object elements, in which case we recurse\n const elements = schemaPart._elements;\n\n if (configPart && hasObjectSchema(elements)) {\n if (schemaPart._type === Type.Array && Array.isArray(configPart)) {\n const configWithDefaults = configPart.map((conf: Config) => setDefaults(elements, conf));\n config[key] = configWithDefaults;\n } else if (schemaPart._type === Type.Object) {\n for (let objectKey of Object.keys(configPart)) {\n configPart[objectKey] = setDefaults(elements, configPart[objectKey]);\n }\n }\n }\n } else if (isOrdinaryObject(schemaPart)) {\n // Since schemaPart has no property \"_default\", if it's an ordinary object\n // (unlike, importantly, the validators array), we assume it is a parent config property.\n // We recurse to config[key] and schema[key]. Default config[key] to {}.\n const selectedConfigPart = config.hasOwnProperty(key) ? configPart : {};\n\n if (isOrdinaryObject(selectedConfigPart)) {\n config[key] = setDefaults(schemaPart, selectedConfigPart);\n }\n }\n }\n\n return config;\n};\n\nfunction hasObjectSchema(elementsSchema: Object | undefined): elementsSchema is ConfigSchema {\n return (\n !!elementsSchema && Object.keys(elementsSchema).filter((e) => !['_default', '_validators'].includes(e)).length > 0\n );\n}\n\nfunction isOrdinaryObject(value) {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/** Keep track of which validation errors we have displayed. Each one should only be displayed once. */\nconst displayedValidationMessages = new Set<string>();\n\nfunction logError(keyPath: string, message: string) {\n const key = `${keyPath}:::${message}`;\n if (!displayedValidationMessages.has(key)) {\n console.error(message);\n displayedValidationMessages.add(key);\n }\n}\n\n/**\n * Normally, configuration errors are only displayed once. This function clears the list of\n * displayed errors, so that they will be displayed again.\n *\n * @internal\n */\nexport function clearConfigErrors(keyPath?: string) {\n if (keyPath) {\n displayedValidationMessages.forEach((key) => {\n if (key.startsWith(keyPath)) {\n displayedValidationMessages.delete(key);\n }\n });\n } else {\n displayedValidationMessages.clear();\n }\n}\n\n/**\n * Copied over from esm-extensions. It rightly belongs to that module, but esm-config\n * cannot depend on esm-extensions.\n */\nfunction getExtensionNameFromId(extensionId: string) {\n const [extensionName] = extensionId.split('#');\n return extensionName;\n}\n\n/**\n * The implicitConfigSchema is implicitly included in every configuration schema\n */\nconst implicitConfigSchema: ConfigSchema = {\n 'Display conditions': {\n privileges: {\n _description: 'The privilege(s) the user must have to use this extension',\n _type: Type.Array,\n _default: [],\n },\n },\n 'Translation overrides': {\n _description:\n 'Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value',\n _type: Type.Object,\n _default: {},\n },\n};\n","/** @module @category Config Validation */\nimport { validator } from './validator';\n\n/**\n * Verifies that the value is between the provided minimum and maximum\n *\n * @param min Minimum acceptable value\n * @param max Maximum acceptable value\n */\nexport const inRange = (min: number, max: number) => {\n return validator((val) => min <= val && val <= max, `must be between ${min} and ${max}`);\n};\n\n/**\n * Verifies that a string contains only the default URL template\n * parameters, plus any specified in `allowedTemplateParameters`.\n *\n * @param allowedTemplateParameters To be added to `openmrsBase` and `openmrsSpaBase`\n * @category Navigation\n */\nexport const isUrlWithTemplateParameters = (allowedTemplateParameters: string[]) => {\n const allowedParams = allowedTemplateParameters.concat(['openmrsBase', 'openmrsSpaBase']);\n return validator(\n (val) => {\n if (!val || typeof val != 'string') {\n return false;\n }\n\n const rx = /\\${(.*?)}/g;\n let match = rx.exec(val);\n\n while (match) {\n if (!allowedParams.includes(match[1])) {\n return false;\n }\n\n match = rx.exec(val);\n }\n\n return true;\n },\n 'Should be a URL or path. The allowed template parameters are ' +\n allowedParams.map((p) => '${' + p + '}').join(', '),\n );\n};\n\n/**\n * Verifies that a string contains only the default URL template parameters.\n *\n * @category Navigation\n */\nexport const isUrl = isUrlWithTemplateParameters([]);\n\n/**\n * Verifies that the value is one of the allowed options.\n * @param allowedValues The list of allowable values\n */\nexport const oneOf = (allowedValues: Array<any>) => {\n return validator(\n (val) => allowedValues.includes(val),\n `Must be one of the following: '${allowedValues.join(\"', '\")}'.`,\n );\n};\n\nexport const validators = {\n inRange,\n isUrl,\n isUrlWithTemplateParameters,\n oneOf,\n};\n"],"names":["module","exports","__WEBPACK_EXTERNAL_MODULE__685__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","_isPlaceholder","a","_curry1","fn","f1","arguments","length","apply","this","_curry2","f2","b","_b","_a","_arrayFromIterator","iter","next","list","done","push","_includesWith","pred","x","idx","len","_has","is","toString","_isArguments","hasEnumBug","propertyIsEnumerable","nonEnumerableProps","hasArgsEnumBug","contains","item","keys","nIdx","ks","checkArgsLength","val","slice","_uniqContentEquals","aIterator","bIterator","stackA","stackB","eq","_equals","aItem","f","match","typeA","equals","constructor","String","valueOf","name","message","source","global","ignoreCase","multiline","sticky","unicode","size","entries","concat","values","keysA","extendedStackA","extendedStackB","_curry3","f3","c","_c","_isObject","l","k","result","mergeDeepWithKey","lObj","rObj","lVal","rVal","names","index","_clone","refFrom","refTo","deep","pattern","copy","copiedValue","Date","RegExp","clone","Array","isArray","_isArray","_isString","nodeType","XWrap","Error","acc","bind","thisObj","n","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","_arity","_iterableReduce","xf","step","_methodReduce","methodName","symIterator","iterator","_reduce","_xwrap","_arrayReduce","reduce","TypeError","validator","validationFunction","Type","Boolean","ConceptUuid","Number","UUID","PersonAttributeTypeUuid","PatientIdentifierTypeUuid","isBoolean","isNumber","isString","isObject","isUuid","test","configInternalStore","createGlobalStore","providedConfigs","schemas","temporaryConfigStore","config","JSON","parse","localStorage","getItem","e","getTemporaryConfig","subscribe","state","setItem","stringify","configExtensionStore","mountedExtensions","getConfigStore","moduleName","getGlobalStore","loaded","getExtensionSlotsConfigStore","slots","getExtensionSlotConfig","slotName","getExtensionSlotConfigFromStore","getState","slotConfig","getExtensionsConfigStore","configs","getExtensionConfig","extensionId","extensionConfig","assign","getExtensionConfigFromStore","omit","implementerToolsConfigStore","computeModuleConfig","tempState","getConfigForModule","setState","computeExtensionSlotConfigs","allConfigs","slotConfigPerModule","slotConfigs","mergeConfigs","getProvidedConfigs","configBySlotName","validateExtensionSlotConfig","validateAllExtensionSlotConfigs","extensionSlots","newSlotStoreEntries","fromEntries","map","slotStore","oldState","newState","computeImplementerToolsConfig","tempConfigState","configState","getSchemaWithValuesAndSources","configsAndSources","createValuesAndSourcesTree","getImplementerToolsConfig","computeExtensionConfigs","extensionState","extension","computeExtensionConfig","slotModuleName","extensionModuleName","defineConfigSchema","schema","validateConfigSchema","enhancedSchema","mergeDeepRight","implicitConfigSchema","defineExtensionConfigSchema","extensionName","console","error","provide","sourceName","getConfig","Promise","resolve","update","unsubscribe","store","getConfigInternal","processConfig","providedConfig","keyPathContext","validateStructure","setDefaults","runAllValidatorsInConfigTree","slotModuleConfig","split","getExtensionNameFromId","extensionConfigSchema","nameOfSchemaSource","mergeConfigsFor","configOverride","configure","combinedConfig","_value","_default","_source","isOrdinaryObject","keyPath","errorPrefix","invalidKeys","filter","includes","logError","join","add","every","remove","order","updateMessage","thisKeyPath","schemaPart","elements","_elements","hasObjectSchema","_validators","valueType","_type","startsWith","inputConfig","mergeDeepAll","validateBranchStructure","checkType","dictionarySchema","validateDictionaryStructure","arraySchema","i","validateArrayStructure","runValidators","validators","validatorResult","configPart","configWithDefaults","conf","objectKey","selectedConfigPart","elementsSchema","displayedValidationMessages","Set","has","clearConfigErrors","forEach","delete","clear","privileges","_description","inRange","min","max","isUrlWithTemplateParameters","allowedTemplateParameters","allowedParams","rx","exec","p","isUrl","oneOf","allowedValues"],"sourceRoot":""}
1
+ {"version":3,"file":"openmrs-esm-module-config.js","mappings":"8NAAAA,EAAOC,QAAUC,C,GCCbC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,CAAC,GAOX,OAHAO,EAAoBH,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,OACf,CCrBAG,EAAoBK,EAAI,CAACR,EAASS,KACjC,IAAI,IAAIC,KAAOD,EACXN,EAAoBQ,EAAEF,EAAYC,KAASP,EAAoBQ,EAAEX,EAASU,IAC5EE,OAAOC,eAAeb,EAASU,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDP,EAAoBQ,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFd,EAAoBkB,EAAKrB,IACH,oBAAXsB,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAeb,EAASsB,OAAOC,YAAa,CAAEC,MAAO,WAE7DZ,OAAOC,eAAeb,EAAS,aAAc,CAAEwB,OAAO,GAAO,E,qBCL/C,SAASC,EAAeC,GAChC,OAAY,MAALA,GAA0B,iBAANA,IAAoD,IAAlCA,EAAE,2BACtD,CCQe,SAASC,EAAQC,GAC9B,OAAO,SAASC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AAK,MAEpD,EAOaoD,GAAQN,GAA4B,IAMpCO,GAAQ,SAACC,GACpB,OAAO9L,GACL,SAAC3F,G,OAAQyR,EAAcxD,SAASjO,E,GAChC,kCAA6D,OAA3ByR,EAActD,KAAK,QAAQ,MAEjE,EAEayB,GAAa,CACxBkB,QAAAA,GACAS,MAAAA,GACAN,4BAAAA,GACAO,MAAAA,G","sources":["webpack://@openmrs/esm-config/external system \"@openmrs/esm-state\"","webpack://@openmrs/esm-config/webpack/bootstrap","webpack://@openmrs/esm-config/webpack/runtime/define property getters","webpack://@openmrs/esm-config/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-config/webpack/runtime/make namespace object","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isPlaceholder.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_curry1.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_curry2.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_arrayFromIterator.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_includesWith.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_has.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_objectIs.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isArguments.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/keys.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/type.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_equals.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_functionName.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/equals.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_curry3.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isObject.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/mergeWithKey.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/mergeDeepWithKey.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/mergeDeepRight.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/omit.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_clone.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_cloneRegExp.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/clone.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isArray.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isArrayLike.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_isString.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_xwrap.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/bind.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_arity.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/internal/_reduce.js","webpack://@openmrs/esm-config/../../../node_modules/ramda/es/reduce.js","webpack://@openmrs/esm-config/./src/types.ts","webpack://@openmrs/esm-config/./src/validators/validator.ts","webpack://@openmrs/esm-config/./src/validators/type-validators.ts","webpack://@openmrs/esm-config/./src/module-config/state.ts","webpack://@openmrs/esm-config/./src/module-config/module-config.ts","webpack://@openmrs/esm-config/./src/validators/validators.ts"],"sourcesContent":["module.exports = __WEBPACK_EXTERNAL_MODULE__685__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export default function _isPlaceholder(a) {\n return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true;\n}","import _isPlaceholder from './_isPlaceholder.js';\n\n/**\n * Optimized internal one-arity curry function.\n *\n * @private\n * @category Function\n * @param {Function} fn The function to curry.\n * @return {Function} The curried function.\n */\nexport default function _curry1(fn) {\n return function f1(a) {\n if (arguments.length === 0 || _isPlaceholder(a)) {\n return f1;\n } else {\n return fn.apply(this, arguments);\n }\n };\n}","import _curry1 from './_curry1.js';\nimport _isPlaceholder from './_isPlaceholder.js';\n\n/**\n * Optimized internal two-arity curry function.\n *\n * @private\n * @category Function\n * @param {Function} fn The function to curry.\n * @return {Function} The curried function.\n */\nexport default function _curry2(fn) {\n return function f2(a, b) {\n switch (arguments.length) {\n case 0:\n return f2;\n case 1:\n return _isPlaceholder(a) ? f2 : _curry1(function (_b) {\n return fn(a, _b);\n });\n default:\n return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {\n return fn(_a, b);\n }) : _isPlaceholder(b) ? _curry1(function (_b) {\n return fn(a, _b);\n }) : fn(a, b);\n }\n };\n}","export default function _arrayFromIterator(iter) {\n var list = [];\n var next;\n while (!(next = iter.next()).done) {\n list.push(next.value);\n }\n return list;\n}","export default function _includesWith(pred, x, list) {\n var idx = 0;\n var len = list.length;\n\n while (idx < len) {\n if (pred(x, list[idx])) {\n return true;\n }\n idx += 1;\n }\n return false;\n}","export default function _has(prop, obj) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}","// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\nfunction _objectIs(a, b) {\n // SameValue algorithm\n if (a === b) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return a !== 0 || 1 / a === 1 / b;\n } else {\n // Step 6.a: NaN == NaN\n return a !== a && b !== b;\n }\n}\n\nexport default typeof Object.is === 'function' ? Object.is : _objectIs;","import _has from './_has.js';\n\nvar toString = Object.prototype.toString;\nvar _isArguments = /*#__PURE__*/function () {\n return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {\n return toString.call(x) === '[object Arguments]';\n } : function _isArguments(x) {\n return _has('callee', x);\n };\n}();\n\nexport default _isArguments;","import _curry1 from './internal/_curry1.js';\nimport _has from './internal/_has.js';\nimport _isArguments from './internal/_isArguments.js';\n\n// cover IE < 9 keys issues\nvar hasEnumBug = ! /*#__PURE__*/{ toString: null }.propertyIsEnumerable('toString');\nvar nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];\n// Safari bug\nvar hasArgsEnumBug = /*#__PURE__*/function () {\n 'use strict';\n\n return arguments.propertyIsEnumerable('length');\n}();\n\nvar contains = function contains(list, item) {\n var idx = 0;\n while (idx < list.length) {\n if (list[idx] === item) {\n return true;\n }\n idx += 1;\n }\n return false;\n};\n\n/**\n * Returns a list containing the names of all the enumerable own properties of\n * the supplied object.\n * Note that the order of the output array is not guaranteed to be consistent\n * across different JS platforms.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Object\n * @sig {k: v} -> [k]\n * @param {Object} obj The object to extract properties from\n * @return {Array} An array of the object's own properties.\n * @see R.keysIn, R.values\n * @example\n *\n * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']\n */\nvar keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? /*#__PURE__*/_curry1(function keys(obj) {\n return Object(obj) !== obj ? [] : Object.keys(obj);\n}) : /*#__PURE__*/_curry1(function keys(obj) {\n if (Object(obj) !== obj) {\n return [];\n }\n var prop, nIdx;\n var ks = [];\n var checkArgsLength = hasArgsEnumBug && _isArguments(obj);\n for (prop in obj) {\n if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {\n ks[ks.length] = prop;\n }\n }\n if (hasEnumBug) {\n nIdx = nonEnumerableProps.length - 1;\n while (nIdx >= 0) {\n prop = nonEnumerableProps[nIdx];\n if (_has(prop, obj) && !contains(ks, prop)) {\n ks[ks.length] = prop;\n }\n nIdx -= 1;\n }\n }\n return ks;\n});\nexport default keys;","import _curry1 from './internal/_curry1.js';\n\n/**\n * Gives a single-word string description of the (native) type of a value,\n * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not\n * attempt to distinguish user Object types any further, reporting them all as\n * 'Object'.\n *\n * @func\n * @memberOf R\n * @since v0.8.0\n * @category Type\n * @sig (* -> {*}) -> String\n * @param {*} val The value to test\n * @return {String}\n * @example\n *\n * R.type({}); //=> \"Object\"\n * R.type(1); //=> \"Number\"\n * R.type(false); //=> \"Boolean\"\n * R.type('s'); //=> \"String\"\n * R.type(null); //=> \"Null\"\n * R.type([]); //=> \"Array\"\n * R.type(/[A-z]/); //=> \"RegExp\"\n * R.type(() => {}); //=> \"Function\"\n * R.type(undefined); //=> \"Undefined\"\n */\nvar type = /*#__PURE__*/_curry1(function type(val) {\n return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);\n});\nexport default type;","import _arrayFromIterator from './_arrayFromIterator.js';\nimport _includesWith from './_includesWith.js';\nimport _functionName from './_functionName.js';\nimport _has from './_has.js';\nimport _objectIs from './_objectIs.js';\nimport keys from '../keys.js';\nimport type from '../type.js';\n\n/**\n * private _uniqContentEquals function.\n * That function is checking equality of 2 iterator contents with 2 assumptions\n * - iterators lengths are the same\n * - iterators values are unique\n *\n * false-positive result will be returned for comparision of, e.g.\n * - [1,2,3] and [1,2,3,4]\n * - [1,1,1] and [1,2,3]\n * */\n\nfunction _uniqContentEquals(aIterator, bIterator, stackA, stackB) {\n var a = _arrayFromIterator(aIterator);\n var b = _arrayFromIterator(bIterator);\n\n function eq(_a, _b) {\n return _equals(_a, _b, stackA.slice(), stackB.slice());\n }\n\n // if *a* array contains any element that is not included in *b*\n return !_includesWith(function (b, aItem) {\n return !_includesWith(eq, aItem, b);\n }, b, a);\n}\n\nexport default function _equals(a, b, stackA, stackB) {\n if (_objectIs(a, b)) {\n return true;\n }\n\n var typeA = type(a);\n\n if (typeA !== type(b)) {\n return false;\n }\n\n if (a == null || b == null) {\n return false;\n }\n\n if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {\n return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);\n }\n\n if (typeof a.equals === 'function' || typeof b.equals === 'function') {\n return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);\n }\n\n switch (typeA) {\n case 'Arguments':\n case 'Array':\n case 'Object':\n if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {\n return a === b;\n }\n break;\n case 'Boolean':\n case 'Number':\n case 'String':\n if (!(typeof a === typeof b && _objectIs(a.valueOf(), b.valueOf()))) {\n return false;\n }\n break;\n case 'Date':\n if (!_objectIs(a.valueOf(), b.valueOf())) {\n return false;\n }\n break;\n case 'Error':\n return a.name === b.name && a.message === b.message;\n case 'RegExp':\n if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {\n return false;\n }\n break;\n }\n\n var idx = stackA.length - 1;\n while (idx >= 0) {\n if (stackA[idx] === a) {\n return stackB[idx] === b;\n }\n idx -= 1;\n }\n\n switch (typeA) {\n case 'Map':\n if (a.size !== b.size) {\n return false;\n }\n\n return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));\n case 'Set':\n if (a.size !== b.size) {\n return false;\n }\n\n return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));\n case 'Arguments':\n case 'Array':\n case 'Object':\n case 'Boolean':\n case 'Number':\n case 'String':\n case 'Date':\n case 'Error':\n case 'RegExp':\n case 'Int8Array':\n case 'Uint8Array':\n case 'Uint8ClampedArray':\n case 'Int16Array':\n case 'Uint16Array':\n case 'Int32Array':\n case 'Uint32Array':\n case 'Float32Array':\n case 'Float64Array':\n case 'ArrayBuffer':\n break;\n default:\n // Values of other types are only equal if identical.\n return false;\n }\n\n var keysA = keys(a);\n if (keysA.length !== keys(b).length) {\n return false;\n }\n\n var extendedStackA = stackA.concat([a]);\n var extendedStackB = stackB.concat([b]);\n\n idx = keysA.length - 1;\n while (idx >= 0) {\n var key = keysA[idx];\n if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {\n return false;\n }\n idx -= 1;\n }\n return true;\n}","export default function _functionName(f) {\n // String(x => x) evaluates to \"x => x\", so the pattern may not match.\n var match = String(f).match(/^function (\\w*)/);\n return match == null ? '' : match[1];\n}","import _curry2 from './internal/_curry2.js';\nimport _equals from './internal/_equals.js';\n\n/**\n * Returns `true` if its arguments are equivalent, `false` otherwise. Handles\n * cyclical data structures.\n *\n * Dispatches symmetrically to the `equals` methods of both arguments, if\n * present.\n *\n * @func\n * @memberOf R\n * @since v0.15.0\n * @category Relation\n * @sig a -> b -> Boolean\n * @param {*} a\n * @param {*} b\n * @return {Boolean}\n * @example\n *\n * R.equals(1, 1); //=> true\n * R.equals(1, '1'); //=> false\n * R.equals([1, 2, 3], [1, 2, 3]); //=> true\n *\n * const a = {}; a.v = a;\n * const b = {}; b.v = b;\n * R.equals(a, b); //=> true\n */\nvar equals = /*#__PURE__*/_curry2(function equals(a, b) {\n return _equals(a, b, [], []);\n});\nexport default equals;","import _curry1 from './_curry1.js';\nimport _curry2 from './_curry2.js';\nimport _isPlaceholder from './_isPlaceholder.js';\n\n/**\n * Optimized internal three-arity curry function.\n *\n * @private\n * @category Function\n * @param {Function} fn The function to curry.\n * @return {Function} The curried function.\n */\nexport default function _curry3(fn) {\n return function f3(a, b, c) {\n switch (arguments.length) {\n case 0:\n return f3;\n case 1:\n return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {\n return fn(a, _b, _c);\n });\n case 2:\n return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {\n return fn(_a, b, _c);\n }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {\n return fn(a, _b, _c);\n }) : _curry1(function (_c) {\n return fn(a, b, _c);\n });\n default:\n return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {\n return fn(_a, _b, c);\n }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {\n return fn(_a, b, _c);\n }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {\n return fn(a, _b, _c);\n }) : _isPlaceholder(a) ? _curry1(function (_a) {\n return fn(_a, b, c);\n }) : _isPlaceholder(b) ? _curry1(function (_b) {\n return fn(a, _b, c);\n }) : _isPlaceholder(c) ? _curry1(function (_c) {\n return fn(a, b, _c);\n }) : fn(a, b, c);\n }\n };\n}","export default function _isObject(x) {\n return Object.prototype.toString.call(x) === '[object Object]';\n}","import _curry3 from './internal/_curry3.js';\nimport _has from './internal/_has.js';\n\n/**\n * Creates a new object with the own properties of the two provided objects. If\n * a key exists in both objects, the provided function is applied to the key\n * and the values associated with the key in each object, with the result being\n * used as the value associated with the key in the returned object.\n *\n * @func\n * @memberOf R\n * @since v0.19.0\n * @category Object\n * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}\n * @param {Function} fn\n * @param {Object} l\n * @param {Object} r\n * @return {Object}\n * @see R.mergeDeepWithKey, R.merge, R.mergeWith\n * @example\n *\n * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r\n * R.mergeWithKey(concatValues,\n * { a: true, thing: 'foo', values: [10, 20] },\n * { b: true, thing: 'bar', values: [15, 35] });\n * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }\n * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 }\n */\nvar mergeWithKey = /*#__PURE__*/_curry3(function mergeWithKey(fn, l, r) {\n var result = {};\n var k;\n\n for (k in l) {\n if (_has(k, l)) {\n result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];\n }\n }\n\n for (k in r) {\n if (_has(k, r) && !_has(k, result)) {\n result[k] = r[k];\n }\n }\n\n return result;\n});\nexport default mergeWithKey;","import _curry3 from './internal/_curry3.js';\nimport _isObject from './internal/_isObject.js';\nimport mergeWithKey from './mergeWithKey.js';\n\n/**\n * Creates a new object with the own properties of the two provided objects.\n * If a key exists in both objects:\n * - and both associated values are also objects then the values will be\n * recursively merged.\n * - otherwise the provided function is applied to the key and associated values\n * using the resulting value as the new value associated with the key.\n * If a key only exists in one object, the value will be associated with the key\n * of the resulting object.\n *\n * @func\n * @memberOf R\n * @since v0.24.0\n * @category Object\n * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}\n * @param {Function} fn\n * @param {Object} lObj\n * @param {Object} rObj\n * @return {Object}\n * @see R.mergeWithKey, R.mergeDeepWith\n * @example\n *\n * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r\n * R.mergeDeepWithKey(concatValues,\n * { a: true, c: { thing: 'foo', values: [10, 20] }},\n * { b: true, c: { thing: 'bar', values: [15, 35] }});\n * //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }}\n */\nvar mergeDeepWithKey = /*#__PURE__*/_curry3(function mergeDeepWithKey(fn, lObj, rObj) {\n return mergeWithKey(function (k, lVal, rVal) {\n if (_isObject(lVal) && _isObject(rVal)) {\n return mergeDeepWithKey(fn, lVal, rVal);\n } else {\n return fn(k, lVal, rVal);\n }\n }, lObj, rObj);\n});\nexport default mergeDeepWithKey;","import _curry2 from './internal/_curry2.js';\nimport mergeDeepWithKey from './mergeDeepWithKey.js';\n\n/**\n * Creates a new object with the own properties of the first object merged with\n * the own properties of the second object. If a key exists in both objects:\n * - and both values are objects, the two values will be recursively merged\n * - otherwise the value from the second object will be used.\n *\n * @func\n * @memberOf R\n * @since v0.24.0\n * @category Object\n * @sig {a} -> {a} -> {a}\n * @param {Object} lObj\n * @param {Object} rObj\n * @return {Object}\n * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey\n * @example\n *\n * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},\n * { age: 40, contact: { email: 'baa@example.com' }});\n * //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }}\n */\nvar mergeDeepRight = /*#__PURE__*/_curry2(function mergeDeepRight(lObj, rObj) {\n return mergeDeepWithKey(function (k, lVal, rVal) {\n return rVal;\n }, lObj, rObj);\n});\nexport default mergeDeepRight;","import _curry2 from './internal/_curry2.js';\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Object\n * @sig [String] -> {String: *} -> {String: *}\n * @param {Array} names an array of String property names to omit from the new object\n * @param {Object} obj The object to copy from\n * @return {Object} A new object with properties from `names` not on it.\n * @see R.pick\n * @example\n *\n * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}\n */\nvar omit = /*#__PURE__*/_curry2(function omit(names, obj) {\n var result = {};\n var index = {};\n var idx = 0;\n var len = names.length;\n\n while (idx < len) {\n index[names[idx]] = 1;\n idx += 1;\n }\n\n for (var prop in obj) {\n if (!index.hasOwnProperty(prop)) {\n result[prop] = obj[prop];\n }\n }\n return result;\n});\nexport default omit;","import _cloneRegExp from './_cloneRegExp.js';\nimport type from '../type.js';\n\n/**\n * Copies an object.\n *\n * @private\n * @param {*} value The value to be copied\n * @param {Array} refFrom Array containing the source references\n * @param {Array} refTo Array containing the copied source references\n * @param {Boolean} deep Whether or not to perform deep cloning.\n * @return {*} The copied value.\n */\nexport default function _clone(value, refFrom, refTo, deep) {\n var copy = function copy(copiedValue) {\n var len = refFrom.length;\n var idx = 0;\n while (idx < len) {\n if (value === refFrom[idx]) {\n return refTo[idx];\n }\n idx += 1;\n }\n refFrom[idx + 1] = value;\n refTo[idx + 1] = copiedValue;\n for (var key in value) {\n copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key];\n }\n return copiedValue;\n };\n switch (type(value)) {\n case 'Object':\n return copy({});\n case 'Array':\n return copy([]);\n case 'Date':\n return new Date(value.valueOf());\n case 'RegExp':\n return _cloneRegExp(value);\n default:\n return value;\n }\n}","export default function _cloneRegExp(pattern) {\n return new RegExp(pattern.source, (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : ''));\n}","import _clone from './internal/_clone.js';\nimport _curry1 from './internal/_curry1.js';\n\n/**\n * Creates a deep copy of the value which may contain (nested) `Array`s and\n * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are\n * assigned by reference rather than copied\n *\n * Dispatches to a `clone` method if present.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Object\n * @sig {*} -> {*}\n * @param {*} value The object or array to clone\n * @return {*} A deeply cloned copy of `val`\n * @example\n *\n * const objects = [{}, {}, {}];\n * const objectsClone = R.clone(objects);\n * objects === objectsClone; //=> false\n * objects[0] === objectsClone[0]; //=> false\n */\nvar clone = /*#__PURE__*/_curry1(function clone(value) {\n return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true);\n});\nexport default clone;","/**\n * Tests whether or not an object is an array.\n *\n * @private\n * @param {*} val The object to test.\n * @return {Boolean} `true` if `val` is an array, `false` otherwise.\n * @example\n *\n * _isArray([]); //=> true\n * _isArray(null); //=> false\n * _isArray({}); //=> false\n */\nexport default Array.isArray || function _isArray(val) {\n return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';\n};","import _curry1 from './_curry1.js';\nimport _isArray from './_isArray.js';\nimport _isString from './_isString.js';\n\n/**\n * Tests whether or not an object is similar to an array.\n *\n * @private\n * @category Type\n * @category List\n * @sig * -> Boolean\n * @param {*} x The object to test.\n * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.\n * @example\n *\n * _isArrayLike([]); //=> true\n * _isArrayLike(true); //=> false\n * _isArrayLike({}); //=> false\n * _isArrayLike({length: 10}); //=> false\n * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true\n */\nvar _isArrayLike = /*#__PURE__*/_curry1(function isArrayLike(x) {\n if (_isArray(x)) {\n return true;\n }\n if (!x) {\n return false;\n }\n if (typeof x !== 'object') {\n return false;\n }\n if (_isString(x)) {\n return false;\n }\n if (x.nodeType === 1) {\n return !!x.length;\n }\n if (x.length === 0) {\n return true;\n }\n if (x.length > 0) {\n return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);\n }\n return false;\n});\nexport default _isArrayLike;","export default function _isString(x) {\n return Object.prototype.toString.call(x) === '[object String]';\n}","var XWrap = /*#__PURE__*/function () {\n function XWrap(fn) {\n this.f = fn;\n }\n XWrap.prototype['@@transducer/init'] = function () {\n throw new Error('init not implemented on XWrap');\n };\n XWrap.prototype['@@transducer/result'] = function (acc) {\n return acc;\n };\n XWrap.prototype['@@transducer/step'] = function (acc, x) {\n return this.f(acc, x);\n };\n\n return XWrap;\n}();\n\nexport default function _xwrap(fn) {\n return new XWrap(fn);\n}","import _arity from './internal/_arity.js';\nimport _curry2 from './internal/_curry2.js';\n\n/**\n * Creates a function that is bound to a context.\n * Note: `R.bind` does not provide the additional argument-binding capabilities of\n * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).\n *\n * @func\n * @memberOf R\n * @since v0.6.0\n * @category Function\n * @category Object\n * @sig (* -> *) -> {*} -> (* -> *)\n * @param {Function} fn The function to bind to context\n * @param {Object} thisObj The context to bind `fn` to\n * @return {Function} A function that will execute in the context of `thisObj`.\n * @see R.partial\n * @example\n *\n * const log = R.bind(console.log, console);\n * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}\n * // logs {a: 2}\n * @symb R.bind(f, o)(a, b) = f.call(o, a, b)\n */\nvar bind = /*#__PURE__*/_curry2(function bind(fn, thisObj) {\n return _arity(fn.length, function () {\n return fn.apply(thisObj, arguments);\n });\n});\nexport default bind;","export default function _arity(n, fn) {\n /* eslint-disable no-unused-vars */\n switch (n) {\n case 0:\n return function () {\n return fn.apply(this, arguments);\n };\n case 1:\n return function (a0) {\n return fn.apply(this, arguments);\n };\n case 2:\n return function (a0, a1) {\n return fn.apply(this, arguments);\n };\n case 3:\n return function (a0, a1, a2) {\n return fn.apply(this, arguments);\n };\n case 4:\n return function (a0, a1, a2, a3) {\n return fn.apply(this, arguments);\n };\n case 5:\n return function (a0, a1, a2, a3, a4) {\n return fn.apply(this, arguments);\n };\n case 6:\n return function (a0, a1, a2, a3, a4, a5) {\n return fn.apply(this, arguments);\n };\n case 7:\n return function (a0, a1, a2, a3, a4, a5, a6) {\n return fn.apply(this, arguments);\n };\n case 8:\n return function (a0, a1, a2, a3, a4, a5, a6, a7) {\n return fn.apply(this, arguments);\n };\n case 9:\n return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {\n return fn.apply(this, arguments);\n };\n case 10:\n return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {\n return fn.apply(this, arguments);\n };\n default:\n throw new Error('First argument to _arity must be a non-negative integer no greater than ten');\n }\n}","import _isArrayLike from './_isArrayLike.js';\nimport _xwrap from './_xwrap.js';\nimport bind from '../bind.js';\n\nfunction _arrayReduce(xf, acc, list) {\n var idx = 0;\n var len = list.length;\n while (idx < len) {\n acc = xf['@@transducer/step'](acc, list[idx]);\n if (acc && acc['@@transducer/reduced']) {\n acc = acc['@@transducer/value'];\n break;\n }\n idx += 1;\n }\n return xf['@@transducer/result'](acc);\n}\n\nfunction _iterableReduce(xf, acc, iter) {\n var step = iter.next();\n while (!step.done) {\n acc = xf['@@transducer/step'](acc, step.value);\n if (acc && acc['@@transducer/reduced']) {\n acc = acc['@@transducer/value'];\n break;\n }\n step = iter.next();\n }\n return xf['@@transducer/result'](acc);\n}\n\nfunction _methodReduce(xf, acc, obj, methodName) {\n return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));\n}\n\nvar symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';\n\nexport default function _reduce(fn, acc, list) {\n if (typeof fn === 'function') {\n fn = _xwrap(fn);\n }\n if (_isArrayLike(list)) {\n return _arrayReduce(fn, acc, list);\n }\n if (typeof list['fantasy-land/reduce'] === 'function') {\n return _methodReduce(fn, acc, list, 'fantasy-land/reduce');\n }\n if (list[symIterator] != null) {\n return _iterableReduce(fn, acc, list[symIterator]());\n }\n if (typeof list.next === 'function') {\n return _iterableReduce(fn, acc, list);\n }\n if (typeof list.reduce === 'function') {\n return _methodReduce(fn, acc, list, 'reduce');\n }\n\n throw new TypeError('reduce: list must be array or iterable');\n}","import _curry3 from './internal/_curry3.js';\nimport _reduce from './internal/_reduce.js';\n\n/**\n * Returns a single item by iterating through the list, successively calling\n * the iterator function and passing it an accumulator value and the current\n * value from the array, and then passing the result to the next call.\n *\n * The iterator function receives two values: *(acc, value)*. It may use\n * [`R.reduced`](#reduced) to shortcut the iteration.\n *\n * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function\n * is *(value, acc)*.\n *\n * Note: `R.reduce` does not skip deleted or unassigned indices (sparse\n * arrays), unlike the native `Array.prototype.reduce` method. For more details\n * on this behavior, see:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description\n *\n * Dispatches to the `reduce` method of the third argument, if present. When\n * doing so, it is up to the user to handle the [`R.reduced`](#reduced)\n * shortcuting, as this is not implemented by `reduce`.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category List\n * @sig ((a, b) -> a) -> a -> [b] -> a\n * @param {Function} fn The iterator function. Receives two values, the accumulator and the\n * current element from the array.\n * @param {*} acc The accumulator value.\n * @param {Array} list The list to iterate over.\n * @return {*} The final, accumulated value.\n * @see R.reduced, R.addIndex, R.reduceRight\n * @example\n *\n * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10\n * // - -10\n * // / \\ / \\\n * // - 4 -6 4\n * // / \\ / \\\n * // - 3 ==> -3 3\n * // / \\ / \\\n * // - 2 -1 2\n * // / \\ / \\\n * // 0 1 0 1\n *\n * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d)\n */\nvar reduce = /*#__PURE__*/_curry3(_reduce);\nexport default reduce;","export enum Type {\n Array = 'Array',\n Boolean = 'Boolean',\n ConceptUuid = 'ConceptUuid',\n Number = 'Number',\n Object = 'Object',\n String = 'String',\n UUID = 'UUID',\n PersonAttributeTypeUuid = 'PersonAttributeTypeUuid',\n PatientIdentifierTypeUuid = 'PatientIdentifierTypeUuid',\n}\n\n// Full-powered typing for Config and Schema trees depends on being able to\n// have types like `string not \"_default\"`. There is an experimental PR\n// for this feature, https://github.com/microsoft/TypeScript/pull/29317\n// But it is not likely to be merged any time terribly soon. (Nov 11, 2020)\nexport interface ConfigSchema {\n [key: string]: ConfigSchema | ConfigValue;\n _type?: Type;\n _validators?: Array<Validator>;\n _elements?: ConfigSchema;\n}\n\nexport interface Config {\n [moduleName: string]: { [key: string]: any };\n}\n\nexport interface ConfigObject {\n [key: string]: any;\n 'Display conditions'?: DisplayConditionsConfigObject;\n 'Translation overrides'?: Record<string, Record<string, string>>;\n}\n\nexport interface DisplayConditionsConfigObject {\n privileges?: string[];\n}\n\nexport type ConfigValue = string | number | boolean | void | Array<any> | object;\n\nexport interface ExtensionSlotConfig {\n add?: Array<string>;\n remove?: Array<string>;\n order?: Array<string>;\n configure?: ExtensionSlotConfigureValueObject;\n}\n\nexport interface ExtensionSlotConfigureValueObject {\n [key: string]: object;\n}\n\nexport interface ExtensionSlotConfigObject {\n /** Additional extension IDs to assign to this slot, in addition to those `attach`ed in code. */\n add?: Array<string>;\n /** Extension IDs which were `attach`ed to the slot but which should not be assigned. */\n remove?: Array<string>;\n /** Overrides the default ordering of extensions. */\n order?: Array<string>;\n}\n\nexport type ProvidedConfig = {\n source: string;\n config: Config;\n};\n\nexport type ValidatorFunction = (value: any) => boolean;\n\nexport type Validator = (value: any) => void | string;\n","/** @module @category Config Validation */\nimport type { Validator, ValidatorFunction } from '../types';\n\n/**\n * Constructs a custom validator.\n *\n * ### Example\n *\n * ```typescript\n * {\n * foo: {\n * _default: 0,\n * _validators: [\n * validator(val => val >= 0, \"Must not be negative.\")\n * ]\n * }\n * }\n * ```\n * @param validationFunction Takes the configured value as input. Returns true\n * if it is valid, false otherwise.\n * @param message A string message that explains why the value is invalid. Can\n * also be a function that takes the value as input and returns a string.\n * @returns A validator ready for use in a config schema\n */\nexport function validator(\n validationFunction: ValidatorFunction,\n message: string | ((value: any) => string),\n): Validator {\n return (value) => {\n if (!validationFunction(value)) {\n if (typeof message === 'function') {\n return message(value);\n } else {\n return message;\n }\n }\n };\n}\n","import { validator } from './validator';\n\nexport const isArray = validator((val) => Array.isArray(val), 'must be an array');\n\nexport const isBoolean = validator((val) => typeof val === 'boolean', 'must be a boolean');\n\nexport const isNumber = validator((val) => typeof val === 'number', 'must be a number');\n\nexport const isString = validator((val) => typeof val === 'string', 'must be a string');\n\nexport const isObject = validator(\n (val) => typeof val === 'object' && !Array.isArray(val) && val !== null,\n 'must be an object (not an array or null)',\n);\n\nexport const isUuid = validator(\n (val) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(val) || /^[0-9a-f]{36}$/i.test(val),\n 'must be a valid UUID or a 36-character hexadecimal string',\n);\n","/** @module @category Config */\nimport { createGlobalStore, getGlobalStore } from '@openmrs/esm-state';\nimport { omit } from 'ramda';\nimport type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfigObject, ProvidedConfig } from '../types';\n\n/**\n * Internal store\n * A store of the inputs and internal state\n * @internal\n */\nexport interface ConfigInternalStore {\n /** Configs added using the `provide` function */\n providedConfigs: Array<ProvidedConfig>;\n /** An object with module names for keys and schemas for values */\n schemas: Record<string, ConfigSchema>;\n /**\n * Before modules are loaded, they get implicit schemas added to `schemas`. Therefore\n * we need to track separately whether they have actually been loaded (that is,\n * whether the schema has actually been defined).\n */\n moduleLoaded: Record<string, boolean>;\n}\n\nconst configInternalStoreInitialValue = {\n providedConfigs: [],\n schemas: {},\n moduleLoaded: {},\n};\n\n/**\n * @internal\n */\nexport const configInternalStore = createGlobalStore<ConfigInternalStore>(\n 'config-internal',\n configInternalStoreInitialValue,\n);\n\n/**\n * Temporary config\n * LocalStorage-based config used by the implementer tools\n * @internal\n */\nexport interface TemporaryConfigStore {\n config: Config;\n}\n\n/** @internal */\nexport const temporaryConfigStore = createGlobalStore<TemporaryConfigStore>('temporary-config', {\n config: getTemporaryConfig(),\n});\n\ntemporaryConfigStore.subscribe((state) => {\n setTemporaryConfig(state.config);\n});\n\nfunction setTemporaryConfig(value: Config) {\n localStorage.setItem('openmrs:temporaryConfig', JSON.stringify(value));\n}\n\nfunction getTemporaryConfig(): Config {\n try {\n return JSON.parse(localStorage.getItem('openmrs:temporaryConfig') || '{}');\n } catch (e) {\n return {};\n }\n}\n\n/**\n * Config-side extension store\n * Just what esm-config needs to know about extension state. This\n * is to avoid having esm-config depend on esm-extensions, which would\n * create a circular dependency.\n * @internal\n */\nexport interface ConfigExtensionStore {\n mountedExtensions: Array<ConfigExtensionStoreElement>;\n}\n\n/** @internal */\nexport interface ConfigExtensionStoreElement {\n slotModuleName: string;\n extensionModuleName: string;\n slotName: string;\n extensionId: string;\n}\n\n/** @internal */\nexport const configExtensionStore = createGlobalStore<ConfigExtensionStore>('config-store-of-extension-state', {\n mountedExtensions: [],\n});\n\n/**\n * Output configs\n *\n * Each module has its own stores for its config and its extension slots' configs.\n * @internal\n */\nexport interface ConfigStore {\n config: ConfigObject | null;\n loaded: boolean;\n translationOverridesLoaded: boolean;\n}\n\nfunction initializeConfigStore() {\n return {\n config: null,\n loaded: false,\n translationOverridesLoaded: false,\n };\n}\n\n/** @internal */\nexport function getConfigStore(moduleName: string) {\n // We use a store for each module's config, named `config-${moduleName}`\n return getGlobalStore<ConfigStore>(`config-module-${moduleName}`, initializeConfigStore());\n}\n\n/**\n * Configuration for all the specific extension slots\n * @internal\n */\nexport interface ExtensionSlotsConfigStore {\n slots: {\n [slotName: string]: {\n config: ExtensionSlotConfigObject;\n loaded: boolean;\n };\n };\n}\n\n/** @internal */\nexport function getExtensionSlotsConfigStore() {\n return getGlobalStore<ExtensionSlotsConfigStore>(`config-extension-slots`, {\n slots: {},\n });\n}\n\n/** @internal */\nexport function getExtensionSlotConfig(slotName: string) {\n return getExtensionSlotConfigFromStore(getExtensionSlotsConfigStore().getState(), slotName);\n}\n\n/** @internal */\nexport function getExtensionSlotConfigFromStore(state: ExtensionSlotsConfigStore, slotName: string) {\n const slotConfig = state.slots[slotName];\n return slotConfig ?? { loaded: false, config: {} };\n}\n\n/** @internal */\nexport interface ExtensionsConfigStore {\n configs: {\n [slotName: string]: {\n [extensionId: string]: ConfigStore;\n };\n };\n}\n\n/**\n * One store for all the extensions\n * @internal\n */\nexport function getExtensionsConfigStore() {\n return getGlobalStore<ExtensionsConfigStore>(`config-extensions`, {\n configs: {},\n });\n}\n\n/** @internal */\nexport function getExtensionConfig(slotName: string, extensionId: string) {\n const extensionConfig = Object.assign(\n {},\n getExtensionConfigFromStore(getExtensionsConfigStore().getState(), slotName, extensionId),\n );\n extensionConfig.config = omit(['Display conditions', 'Translation overrides'], extensionConfig.config);\n return extensionConfig;\n}\n\n/** @internal */\nexport function getExtensionConfigFromStore(state: ExtensionsConfigStore, slotName: string, extensionId: string) {\n const extensionConfig = state.configs[slotName]?.[extensionId];\n return extensionConfig ?? { loaded: false, config: null };\n}\n\n/**\n * A store of the implementer tools output config\n * @internal\n */\nexport interface ImplementerToolsConfigStore {\n config: Config;\n}\n\n/** @internal */\nexport const implementerToolsConfigStore = createGlobalStore<ImplementerToolsConfigStore>('config-implementer-tools', {\n config: {},\n});\n","/** @module @category Config */\nimport { clone, reduce, mergeDeepRight, equals, omit } from 'ramda';\nimport type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig, ExtensionSlotConfigObject } from '../types';\nimport { Type } from '../types';\nimport { isArray, isBoolean, isUuid, isNumber, isObject, isString } from '../validators/type-validators';\nimport { validator } from '../validators/validator';\nimport type { ConfigExtensionStore, ConfigInternalStore, ConfigStore } from './state';\nimport {\n configInternalStore,\n configExtensionStore,\n getConfigStore,\n getExtensionsConfigStore,\n implementerToolsConfigStore,\n temporaryConfigStore,\n getExtensionSlotsConfigStore,\n} from './state';\nimport type {} from '@openmrs/esm-globals';\nimport { type TemporaryConfigStore } from '..';\n\n/**\n * Store setup\n *\n *\n * Set up stores and subscriptions so that inputs get processed appropriately.\n *\n * There are *input* stores and *output* stores. The *input* stores\n * are configInternalStore, temporaryConfigStore, and configExtensionStore. The\n * output stores are set in the `compute...` functions. They are the module\n * config stores, the extension slot config stores (by module), the extension\n * config stores, and the implementer tools config store.\n *\n * This code sets up the subscriptions so that when an input store changes,\n * the correct set of output stores are updated.\n *\n * All `compute...` functions except `computeExtensionConfigs` are pure\n * (or are supposed to be), other than the fact that they all `setState`\n * store values at the end. `computeExtensionConfigs` calls `getGlobalStore`,\n * which creates stores.\n */\ncomputeModuleConfig(configInternalStore.getState(), temporaryConfigStore.getState());\nconfigInternalStore.subscribe((configState) => computeModuleConfig(configState, temporaryConfigStore.getState()));\ntemporaryConfigStore.subscribe((tempConfigState) =>\n computeModuleConfig(configInternalStore.getState(), tempConfigState),\n);\n\ncomputeImplementerToolsConfig(configInternalStore.getState(), temporaryConfigStore.getState());\nconfigInternalStore.subscribe((configState) =>\n computeImplementerToolsConfig(configState, temporaryConfigStore.getState()),\n);\ntemporaryConfigStore.subscribe((tempConfigState) =>\n computeImplementerToolsConfig(configInternalStore.getState(), tempConfigState),\n);\n\ncomputeExtensionSlotConfigs(configInternalStore.getState(), temporaryConfigStore.getState());\nconfigInternalStore.subscribe((configState) =>\n computeExtensionSlotConfigs(configState, temporaryConfigStore.getState()),\n);\ntemporaryConfigStore.subscribe((tempConfigState) =>\n computeExtensionSlotConfigs(configInternalStore.getState(), tempConfigState),\n);\n\ncomputeExtensionConfigs(\n configInternalStore.getState(),\n configExtensionStore.getState(),\n temporaryConfigStore.getState(),\n);\nconfigInternalStore.subscribe((configState) => {\n computeExtensionConfigs(configState, configExtensionStore.getState(), temporaryConfigStore.getState());\n});\nconfigExtensionStore.subscribe((extensionState) => {\n computeExtensionConfigs(configInternalStore.getState(), extensionState, temporaryConfigStore.getState());\n});\ntemporaryConfigStore.subscribe((tempConfigState) => {\n computeExtensionConfigs(configInternalStore.getState(), configExtensionStore.getState(), tempConfigState);\n});\n\nfunction computeModuleConfig(state: ConfigInternalStore, tempState: TemporaryConfigStore) {\n for (let moduleName of Object.keys(state.schemas)) {\n // At this point the schema could be either just the implicit schema or the actually\n // defined schema. We run with just the implicit schema because we want to populate\n // the config store with the translation overrides as soon as possible. In fact, the\n // translation system will throw for Suspense until the translation overrides are\n // available, which as of this writing blocks the schema definition from occurring\n // for modules loaded based on their extensions.\n const moduleStore = getConfigStore(moduleName);\n if (state.moduleLoaded[moduleName]) {\n const config = getConfigForModule(moduleName, state, tempState);\n moduleStore.setState({\n translationOverridesLoaded: true,\n loaded: true,\n config,\n });\n } else {\n const config = getConfigForModuleImplicitSchema(moduleName, state, tempState);\n moduleStore.setState({\n translationOverridesLoaded: true,\n loaded: false,\n config,\n });\n }\n }\n}\n\nfunction computeExtensionSlotConfigs(state: ConfigInternalStore, tempState: TemporaryConfigStore) {\n const slotConfigs = getExtensionSlotConfigs(state, tempState);\n const newSlotStoreEntries = Object.fromEntries(\n Object.entries(slotConfigs).map(([slotName, config]) => [slotName, { loaded: true, config }]),\n );\n const slotStore = getExtensionSlotsConfigStore();\n const oldState = slotStore.getState();\n const newState = { slots: { ...oldState.slots, ...newSlotStoreEntries } };\n if (!equals(oldState, newState)) {\n slotStore.setState(newState);\n }\n}\n\nfunction computeImplementerToolsConfig(state: ConfigInternalStore, tempConfigState: TemporaryConfigStore) {\n const config = getImplementerToolsConfig(state, tempConfigState);\n implementerToolsConfigStore.setState({ config });\n}\n\nfunction computeExtensionConfigs(\n configState: ConfigInternalStore,\n extensionState: ConfigExtensionStore,\n tempConfigState: TemporaryConfigStore,\n) {\n const configs = {};\n // We assume that the module schema has already been defined, since the extension\n // it contains is mounted.\n for (let extension of extensionState.mountedExtensions) {\n const config = computeExtensionConfig(\n extension.slotModuleName,\n extension.extensionModuleName,\n extension.slotName,\n extension.extensionId,\n configState,\n tempConfigState,\n );\n configs[extension.slotName] = {\n ...configs[extension.slotName],\n [extension.extensionId]: { config, loaded: true },\n };\n }\n getExtensionsConfigStore().setState({ configs });\n}\n\n/*\n * API\n *\n */\n\n/**\n * This defines a configuration schema for a module. The schema tells the\n * configuration system how the module can be configured. It specifies\n * what makes configuration valid or invalid.\n *\n * See [Configuration System](https://o3-docs.openmrs.org/docs/configuration-system)\n * for more information about defining a config schema.\n *\n * @param moduleName Name of the module the schema is being defined for. Generally\n * should be the one in which the `defineConfigSchema` call takes place.\n * @param schema The config schema for the module\n */\nexport function defineConfigSchema(moduleName: string, schema: ConfigSchema) {\n validateConfigSchema(moduleName, schema);\n const enhancedSchema = mergeDeepRight(schema, implicitConfigSchema) as ConfigSchema;\n\n const state = configInternalStore.getState();\n configInternalStore.setState({\n schemas: { ...state.schemas, [moduleName]: enhancedSchema },\n moduleLoaded: { ...state.moduleLoaded, [moduleName]: true },\n });\n}\n\n/**\n * This alerts the configuration system that a module exists. This allows config to be\n * processed, while still allowing the extension system to know whether the module has\n * actually had its front bundle executed yet.\n *\n * This should only be used in esm-app-shell.\n *\n * @internal\n * @param moduleName\n */\nexport function registerModuleWithConfigSystem(moduleName: string) {\n const state = configInternalStore.getState();\n configInternalStore.setState({\n schemas: { ...state.schemas, [moduleName]: implicitConfigSchema },\n });\n}\n\n/**\n * This defines a configuration schema for an extension. When a schema is defined\n * for an extension, that extension will receive the configuration corresponding\n * to that schema, rather than the configuration corresponding to the module\n * in which it is defined.\n *\n * The schema tells the configuration system how the module can be configured.\n * It specifies what makes configuration valid or invalid.\n *\n * See [Configuration System](https://o3-docs.openmrs.org/docs/configuration-system)\n * for more information about defining a config schema.\n *\n * @param extensionName Name of the extension the schema is being defined for.\n * Should match the `name` of one of the `extensions` entries being returned\n * by `setupOpenMRS`.\n * @param schema The config schema for the extension\n */\nexport function defineExtensionConfigSchema(extensionName: string, schema: ConfigSchema) {\n validateConfigSchema(extensionName, schema);\n const enhancedSchema = mergeDeepRight(schema, implicitConfigSchema) as ConfigSchema;\n\n const state = configInternalStore.getState();\n if (state.schemas[extensionName]) {\n console.error(\n `Config schema for extension ${extensionName} already exists. If there are multiple extensions with this same name, one will probably crash.`,\n );\n }\n\n configInternalStore.setState({\n schemas: { ...state.schemas, [extensionName]: enhancedSchema },\n });\n}\n\nexport function provide(config: Config, sourceName = 'provided') {\n const state = configInternalStore.getState();\n configInternalStore.setState({\n providedConfigs: [...state.providedConfigs, { source: sourceName, config }],\n });\n}\n\n/**\n * A promise-based way to access the config as soon as it is fully loaded.\n * If it is already loaded, resolves the config in its present state.\n *\n * This is a useful function if you need to get the config in the course\n * of the execution of a function.\n *\n * @param moduleName The name of the module for which to look up the config\n */\nexport function getConfig<T = Record<string, any>>(moduleName: string): Promise<T> {\n return new Promise<T>((resolve) => {\n const store = getConfigStore(moduleName);\n function update(state: ConfigStore) {\n if (state.loaded && state.config) {\n const config = omit(['Display conditions', 'Translation overrides'], state.config);\n resolve(config as T);\n unsubscribe && unsubscribe();\n }\n }\n update(store.getState());\n const unsubscribe = store.subscribe(update);\n });\n}\n\n/** @internal */\nexport function getTranslationOverrides(moduleName: string): Promise<Object> {\n return new Promise<Object>((resolve) => {\n const store = getConfigStore(moduleName);\n function update(state: ConfigStore) {\n if (state.translationOverridesLoaded && state.config) {\n const translationOverrides = state.config['Translation overrides'] ?? {};\n resolve(translationOverrides);\n unsubscribe && unsubscribe();\n }\n }\n update(store.getState());\n const unsubscribe = store.subscribe(update);\n });\n}\n\n/**\n * Validate and interpolate defaults for `providedConfig` according to `schema`\n *\n * @param schema a configuration schema\n * @param providedConfig an object of config values (without the top-level module name)\n * @param keyPathContext a dot-deparated string which helps the user figure out where\n * the provided config came from\n * @internal\n */\nexport function processConfig(schema: ConfigSchema, providedConfig: ConfigObject, keyPathContext: string) {\n validateStructure(schema, providedConfig, keyPathContext);\n const config = setDefaults(schema, providedConfig);\n runAllValidatorsInConfigTree(schema, config, keyPathContext);\n return config;\n}\n\n/*\n * Helper functions\n *\n */\n\n/**\n * Returns the configuration for an extension. This configuration is specific\n * to the slot in which it is mounted, and its ID within that slot.\n *\n * The schema for that configuration is the extension schema. If no extension\n * schema has been provided, the schema used is the schema of the module in\n * which the extension is defined.\n *\n * @param slotModuleName The name of the module which defines the extension slot\n * @param extensionModuleName The name of the module which defines the extension (and therefore the config schema)\n * @param slotName The name of the extension slot where the extension is mounted\n * @param extensionId The ID of the extension in its slot\n */\nfunction computeExtensionConfig(\n slotModuleName: string,\n extensionModuleName: string,\n slotName: string,\n extensionId: string,\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n) {\n const extensionName = getExtensionNameFromId(extensionId);\n const extensionConfigSchema = configState.schemas[extensionName];\n const nameOfSchemaSource = extensionConfigSchema ? extensionName : extensionModuleName;\n const providedConfigs = getProvidedConfigs(configState, tempConfigState);\n const slotModuleConfig = mergeConfigsFor(slotModuleName, providedConfigs);\n const configOverride = slotModuleConfig?.extensionSlots?.[slotName]?.configure?.[extensionId] ?? {};\n const extensionConfig = mergeConfigsFor(nameOfSchemaSource, providedConfigs);\n const combinedConfig = mergeConfigs([extensionConfig, configOverride]);\n const schema = extensionConfigSchema ?? configState.schemas[extensionModuleName];\n validateStructure(schema, combinedConfig, nameOfSchemaSource);\n const config = setDefaults(schema, combinedConfig);\n runAllValidatorsInConfigTree(schema, config, nameOfSchemaSource);\n delete config.extensionSlots;\n return config;\n}\n\nfunction getImplementerToolsConfig(\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n): Record<string, Config> {\n let result = getSchemaWithValuesAndSources(clone(configState.schemas));\n const configsAndSources = [\n ...configState.providedConfigs.map((c) => [c.config, c.source]),\n [tempConfigState.config, 'temporary config'],\n ] as Array<[Config, string]>;\n for (let [config, source] of configsAndSources) {\n result = mergeConfigs([result, createValuesAndSourcesTree(config, source)]);\n }\n return result;\n}\n\nfunction getSchemaWithValuesAndSources(schema) {\n if (schema.hasOwnProperty('_default')) {\n return { ...schema, _value: schema._default, _source: 'default' };\n } else if (isOrdinaryObject(schema)) {\n return Object.keys(schema).reduce((obj, key) => {\n obj[key] = getSchemaWithValuesAndSources(schema[key]);\n return obj;\n }, {});\n } else {\n // at this point, the schema is bad and an error will have been logged during schema validation\n return {};\n }\n}\n\nfunction createValuesAndSourcesTree(config: ConfigObject, source: string) {\n if (isOrdinaryObject(config)) {\n return Object.keys(config).reduce((obj, key) => {\n obj[key] = createValuesAndSourcesTree(config[key], source);\n return obj;\n }, {});\n } else {\n return { _value: config, _source: source };\n }\n}\n\nfunction getExtensionSlotConfigs(\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n): Record<string, ExtensionSlotConfigObject> {\n const allConfigs = mergeConfigs(getProvidedConfigs(configState, tempConfigState));\n const slotConfigPerModule: Record<string, Record<string, ExtensionSlotConfig>> = Object.keys(allConfigs).reduce(\n (obj, key) => {\n if (allConfigs[key]?.extensionSlots) {\n obj[key] = allConfigs[key]?.extensionSlots;\n }\n return obj;\n },\n {},\n );\n validateAllExtensionSlotConfigs(slotConfigPerModule);\n const slotConfigs = Object.keys(slotConfigPerModule).reduce((obj, key) => {\n obj = { ...obj, ...slotConfigPerModule[key] };\n return obj;\n }, {});\n return slotConfigs;\n}\n\nfunction validateAllExtensionSlotConfigs(slotConfigPerModule: Record<string, Record<string, ExtensionSlotConfig>>) {\n for (let [moduleName, configBySlotName] of Object.entries(slotConfigPerModule)) {\n for (let [slotName, config] of Object.entries(configBySlotName)) {\n validateExtensionSlotConfig(config, moduleName, slotName);\n }\n }\n}\n\nfunction validateExtensionSlotConfig(config: ExtensionSlotConfig, moduleName: string, slotName: string): void {\n const keyPath = `${moduleName}.extensionSlots.${slotName}`;\n const errorPrefix = `Extension slot config '${keyPath}'`;\n const invalidKeys = Object.keys(config).filter((k) => !['add', 'remove', 'order', 'configure'].includes(k));\n if (invalidKeys.length) {\n logError(keyPath, errorPrefix + `' contains invalid keys '${invalidKeys.join(\"', '\")}'`);\n }\n if (config.add) {\n if (!Array.isArray(config.add) || !config.add.every((n) => typeof n === 'string')) {\n logError(keyPath, errorPrefix + `.add' is invalid. Must be an array of strings (extension IDs)`);\n }\n }\n if (config.remove) {\n if (!Array.isArray(config.remove) || !config.remove.every((n) => typeof n === 'string')) {\n logError(keyPath, errorPrefix + `.remove' is invalid. Must be an array of strings (extension IDs)`);\n }\n }\n if (config.order) {\n if (!Array.isArray(config.order) || !config.order.every((n) => typeof n === 'string')) {\n logError(keyPath, errorPrefix + `.order' is invalid. Must be an array of strings (extension IDs)`);\n }\n }\n if (config.configure) {\n if (!isOrdinaryObject(config.configure)) {\n logError(keyPath, errorPrefix + `.configure' is invalid. Must be an object with extension IDs for keys`);\n }\n }\n}\n\nfunction getProvidedConfigs(configState: ConfigInternalStore, tempConfigState: TemporaryConfigStore): Array<Config> {\n return [...configState.providedConfigs.map((c) => c.config), tempConfigState.config];\n}\n\n/**\n * Validates the config schema for a module. Since problems identified here are programming errors\n * that hopefully will be caught during development, this function logs errors to the console directly;\n * it's fine if we spam the user with these errors.\n */\nfunction validateConfigSchema(moduleName: string, schema: ConfigSchema, keyPath = '') {\n const updateMessage = `Please verify that you are running the latest version and, if so, alert the maintainer.`;\n\n for (const key of Object.keys(schema).filter((k) => !k.startsWith('_'))) {\n const thisKeyPath = keyPath + (keyPath && '.') + key;\n const schemaPart = schema[key] as ConfigSchema;\n\n if (thisKeyPath === 'Display conditions') {\n console.error(\n `${moduleName} declares a configuration option called \"Display conditions\"; the \"Display conditions\" option is a reserved name. ${updateMessage}`,\n );\n }\n\n if (thisKeyPath === 'Translation overrides') {\n console.error(\n `${moduleName} declares a configuration option called \"Translation overrides\"; the \"Translation overrides\" option is a reserved name. ${updateMessage}`,\n );\n }\n\n if (!isOrdinaryObject(schemaPart)) {\n console.error(`${moduleName} has bad config schema definition for key '${thisKeyPath}'. ${updateMessage}`);\n continue;\n }\n\n if (!schemaPart.hasOwnProperty('_default')) {\n // recurse for nested config keys\n validateConfigSchema(moduleName, schemaPart, thisKeyPath);\n }\n\n const elements = schemaPart._elements;\n if (hasObjectSchema(elements)) {\n validateConfigSchema(moduleName, elements, thisKeyPath + '._elements');\n }\n\n if (schemaPart._validators) {\n for (let validator of schemaPart._validators) {\n if (typeof validator !== 'function') {\n console.error(\n `${moduleName} has invalid validator for key '${thisKeyPath}' ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: validators must be functions that return either ` +\n `undefined or an error string. Received ${validator}.`,\n );\n }\n }\n }\n\n const valueType = schemaPart._type;\n if (valueType && !Object.values(Type).includes(valueType)) {\n console.error(\n `${moduleName} has invalid type for key '${thisKeyPath}' ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: the allowed types are ${Object.values(Type).join(', ')}. ` +\n `Received '${valueType}'`,\n );\n }\n\n if (\n Object.keys(schemaPart).every((k) => ['_description', '_validators', '_elements', '_type'].includes(k)) &&\n !keyPath.includes('._elements')\n ) {\n console.error(\n `${moduleName} has bad config schema definition for key '${thisKeyPath}'. ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: all config elements must have a default. ` +\n `Received ${JSON.stringify(schemaPart)}`,\n );\n }\n\n if (elements && valueType && ![Type.Array, Type.Object].includes(valueType)) {\n console.error(\n `${moduleName} has bad config schema definition for key '${thisKeyPath}'. ${updateMessage}.` +\n `\\n\\nIf you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. ` +\n `Received ${JSON.stringify(valueType)}`,\n );\n }\n }\n}\n\nfunction getConfigForModule(\n moduleName: string,\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n): ConfigObject {\n const schema = configState.schemas[moduleName];\n const inputConfig = mergeConfigsFor(moduleName, getProvidedConfigs(configState, tempConfigState));\n validateStructure(schema, inputConfig, moduleName);\n const config = setDefaults(schema, inputConfig);\n runAllValidatorsInConfigTree(schema, config, moduleName);\n delete config.extensionSlots;\n return config;\n}\n\nfunction getConfigForModuleImplicitSchema(\n moduleName: string,\n configState: ConfigInternalStore,\n tempConfigState: TemporaryConfigStore,\n): ConfigObject {\n const inputConfig = mergeConfigsFor(moduleName, getProvidedConfigs(configState, tempConfigState));\n const config = setDefaults(implicitConfigSchema, inputConfig);\n runAllValidatorsInConfigTree(implicitConfigSchema, config, moduleName);\n delete config.extensionSlots;\n return config;\n}\n\nfunction mergeConfigsFor(moduleName: string, allConfigs: Array<Config>): ConfigObject {\n const allConfigsForModule = allConfigs.map(({ [moduleName]: c }) => c).filter((c) => !!c);\n\n return mergeConfigs(allConfigsForModule);\n}\n\nfunction mergeConfigs(configs: Array<Config>) {\n const mergeDeepAll = reduce(mergeDeepRight);\n return mergeDeepAll({}, configs) as Config;\n}\n\n/**\n * Recursively check the provided config tree to make sure that all\n * of the provided properties exist in the schema, and that types are\n * correct. Does not run validators yet, since those will be run on\n * the config with the defaults filled in.\n */\nfunction validateStructure(schema: ConfigSchema, config: ConfigObject, keyPath = '') {\n // validate each constituent element\n for (const key of Object.keys(config)) {\n const value = config[key];\n const thisKeyPath = keyPath + '.' + key;\n const schemaPart = schema[key] as ConfigSchema;\n\n if (!schema.hasOwnProperty(key)) {\n if (!(key === 'extensionSlots' && keyPath !== '')) {\n logError(thisKeyPath, `Unknown config key '${thisKeyPath}' provided. Ignoring.`);\n }\n\n continue;\n }\n\n validateBranchStructure(schemaPart, value, thisKeyPath);\n }\n}\n\nfunction validateBranchStructure(schemaPart: ConfigSchema, value: any, keyPath: string) {\n checkType(keyPath, schemaPart._type, value);\n\n if (isOrdinaryObject(value)) {\n // structurally validate only if there's elements specified\n // or there's no `_default` value (which would indicate a freeform object)\n if (schemaPart._type === Type.Object) {\n validateDictionaryStructure(schemaPart, value, keyPath);\n } else if (!schemaPart.hasOwnProperty('_default')) {\n // recurse to validate nested object structure\n validateStructure(schemaPart, value, keyPath);\n }\n } else {\n if (schemaPart._type === Type.Array) {\n validateArrayStructure(schemaPart, value, keyPath);\n }\n }\n}\n\nfunction validateDictionaryStructure(dictionarySchema: ConfigSchema, config: ConfigObject, keyPath: string) {\n if (dictionarySchema._elements) {\n for (const key of Object.keys(config)) {\n const value = config[key];\n validateStructure(dictionarySchema._elements, value, `${keyPath}.${key}`);\n }\n }\n}\n\nfunction validateArrayStructure(arraySchema: ConfigSchema, value: ConfigObject, keyPath: string) {\n // if there is an array element object schema, verify that elements match it\n if (hasObjectSchema(arraySchema._elements)) {\n for (let i = 0; i < value.length; i++) {\n validateBranchStructure(arraySchema._elements, value[i], `${keyPath}[${i}]`);\n }\n }\n\n for (let i = 0; i < value.length; i++) {\n checkType(`${keyPath}[${i}]`, arraySchema._elements?._type, value[i]);\n }\n}\n\n/**\n * Run all the validators in the config tree. This should be run\n * on the config object after it has been filled in with all the defaults, since\n * higher-level validators may refer to default values.\n */\nfunction runAllValidatorsInConfigTree(schema: ConfigSchema, config: ConfigObject, keyPath = '') {\n // If `!schema`, there should have been a structural validation error printed already.\n if (schema) {\n if (config !== schema._default) {\n runValidators(keyPath, schema._validators, config);\n }\n\n if (isOrdinaryObject(config)) {\n for (const key of Object.keys(config)) {\n const value = config[key];\n const thisKeyPath = keyPath + '.' + key;\n const schemaPart = schema[key] as ConfigSchema;\n if (schema._type === Type.Object && schema._elements) {\n runAllValidatorsInConfigTree(schema._elements, value, thisKeyPath);\n } else {\n runAllValidatorsInConfigTree(schemaPart, value, thisKeyPath);\n }\n }\n } else if (Array.isArray(config) && schema._elements) {\n for (let i = 0; i < config.length; i++) {\n runAllValidatorsInConfigTree(schema._elements, config[i], `${keyPath}[${i}]`);\n }\n }\n }\n}\n\nfunction checkType(keyPath: string, _type: Type | undefined, value: any) {\n if (_type) {\n const validator: Record<string, Function> = {\n Array: isArray,\n Boolean: isBoolean,\n ConceptUuid: isUuid,\n Number: isNumber,\n Object: isObject,\n String: isString,\n UUID: isUuid,\n PersonAttributeTypeUuid: isUuid,\n PatientIdentifierTypeUuid: isUuid,\n };\n runValidators(keyPath, [validator[_type]], value);\n }\n}\n\nfunction runValidators(keyPath: string, validators: Array<Function> | undefined, value: any) {\n if (validators) {\n try {\n for (let validator of validators) {\n const validatorResult = validator(value);\n\n if (typeof validatorResult === 'string') {\n const message =\n typeof value === 'object'\n ? `Invalid configuration for ${keyPath}: ${validatorResult}`\n : `Invalid configuration value ${value} for ${keyPath}: ${validatorResult}`;\n logError(keyPath, message);\n }\n }\n } catch (e) {\n console.error(`Skipping invalid validator at \"${keyPath}\". Encountered error\\n\\t${e}`);\n }\n }\n}\n\n// Recursively fill in the config with values from the schema.\nconst setDefaults = (schema: ConfigSchema, inputConfig: Config) => {\n const config = clone(inputConfig);\n\n if (!schema) {\n return config;\n }\n\n for (const key of Object.keys(schema)) {\n const configPart = config[key];\n const schemaPart = schema[key] as ConfigSchema;\n\n // The `schemaPart &&` clause of this `if` statement will only fail\n // if the schema is very invalid. It is there to prevent the app from\n // crashing completely, though it will produce unexpected behavior.\n // If this happens, there should be legible errors in the console from\n // the schema validator.\n if (schemaPart && schemaPart.hasOwnProperty('_default')) {\n // We assume that schemaPart defines a config value, since it has\n // a property `_default`.\n if (!config.hasOwnProperty(key)) {\n (config[key] as any) = schemaPart['_default'];\n }\n\n // We also check if it is an object or array with object elements, in which case we recurse\n const elements = schemaPart._elements;\n\n if (configPart && hasObjectSchema(elements)) {\n if (schemaPart._type === Type.Array && Array.isArray(configPart)) {\n const configWithDefaults = configPart.map((conf: Config) => setDefaults(elements, conf));\n config[key] = configWithDefaults;\n } else if (schemaPart._type === Type.Object) {\n for (let objectKey of Object.keys(configPart)) {\n configPart[objectKey] = setDefaults(elements, configPart[objectKey]);\n }\n }\n }\n } else if (isOrdinaryObject(schemaPart)) {\n // Since schemaPart has no property \"_default\", if it's an ordinary object\n // (unlike, importantly, the validators array), we assume it is a parent config property.\n // We recurse to config[key] and schema[key]. Default config[key] to {}.\n const selectedConfigPart = config.hasOwnProperty(key) ? configPart : {};\n\n if (isOrdinaryObject(selectedConfigPart)) {\n config[key] = setDefaults(schemaPart, selectedConfigPart);\n }\n }\n }\n\n return config;\n};\n\nfunction hasObjectSchema(elementsSchema: Object | undefined): elementsSchema is ConfigSchema {\n return (\n !!elementsSchema && Object.keys(elementsSchema).filter((e) => !['_default', '_validators'].includes(e)).length > 0\n );\n}\n\nfunction isOrdinaryObject(value) {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/** Keep track of which validation errors we have displayed. Each one should only be displayed once. */\nconst displayedValidationMessages = new Set<string>();\n\nfunction logError(keyPath: string, message: string) {\n const key = `${keyPath}:::${message}`;\n if (!displayedValidationMessages.has(key)) {\n console.error(message);\n displayedValidationMessages.add(key);\n }\n}\n\n/**\n * Normally, configuration errors are only displayed once. This function clears the list of\n * displayed errors, so that they will be displayed again.\n *\n * @internal\n */\nexport function clearConfigErrors(keyPath?: string) {\n if (keyPath) {\n displayedValidationMessages.forEach((key) => {\n if (key.startsWith(keyPath)) {\n displayedValidationMessages.delete(key);\n }\n });\n } else {\n displayedValidationMessages.clear();\n }\n}\n\n/**\n * Copied over from esm-extensions. It rightly belongs to that module, but esm-config\n * cannot depend on esm-extensions.\n */\nfunction getExtensionNameFromId(extensionId: string) {\n const [extensionName] = extensionId.split('#');\n return extensionName;\n}\n\n/**\n * The implicitConfigSchema is implicitly included in every configuration schema\n */\nconst implicitConfigSchema: ConfigSchema = {\n 'Display conditions': {\n privileges: {\n _description: 'The privilege(s) the user must have to use this extension',\n _type: Type.Array,\n _default: [],\n },\n },\n 'Translation overrides': {\n _description:\n 'Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value',\n _type: Type.Object,\n _default: {},\n _validators: [\n validator(\n (o) => Object.keys(o).every((k) => /^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(k)),\n (o) => {\n const badKeys = Object.keys(o).filter((k) => !/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(k));\n return `The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${badKeys.join(\n ', ',\n )}.`;\n },\n ),\n ],\n },\n};\n","/** @module @category Config Validation */\nimport { validator } from './validator';\n\n/**\n * Verifies that the value is between the provided minimum and maximum\n *\n * @param min Minimum acceptable value\n * @param max Maximum acceptable value\n */\nexport const inRange = (min: number, max: number) => {\n return validator((val) => min <= val && val <= max, `must be between ${min} and ${max}`);\n};\n\n/**\n * Verifies that a string contains only the default URL template\n * parameters, plus any specified in `allowedTemplateParameters`.\n *\n * @param allowedTemplateParameters To be added to `openmrsBase` and `openmrsSpaBase`\n * @category Navigation\n */\nexport const isUrlWithTemplateParameters = (allowedTemplateParameters: string[]) => {\n const allowedParams = allowedTemplateParameters.concat(['openmrsBase', 'openmrsSpaBase']);\n return validator(\n (val) => {\n if (!val || typeof val != 'string') {\n return false;\n }\n\n const rx = /\\${(.*?)}/g;\n let match = rx.exec(val);\n\n while (match) {\n if (!allowedParams.includes(match[1])) {\n return false;\n }\n\n match = rx.exec(val);\n }\n\n return true;\n },\n 'Should be a URL or path. The allowed template parameters are ' +\n allowedParams.map((p) => '${' + p + '}').join(', '),\n );\n};\n\n/**\n * Verifies that a string contains only the default URL template parameters.\n *\n * @category Navigation\n */\nexport const isUrl = isUrlWithTemplateParameters([]);\n\n/**\n * Verifies that the value is one of the allowed options.\n * @param allowedValues The list of allowable values\n */\nexport const oneOf = (allowedValues: Array<any>) => {\n return validator(\n (val) => allowedValues.includes(val),\n `Must be one of the following: '${allowedValues.join(\"', '\")}'.`,\n );\n};\n\nexport const validators = {\n inRange,\n isUrl,\n isUrlWithTemplateParameters,\n oneOf,\n};\n"],"names":["module","exports","__WEBPACK_EXTERNAL_MODULE__685__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","_isPlaceholder","a","_curry1","fn","f1","arguments","length","apply","this","_curry2","f2","b","_b","_a","_arrayFromIterator","iter","next","list","done","push","_includesWith","pred","x","idx","len","_has","is","toString","_isArguments","hasEnumBug","propertyIsEnumerable","nonEnumerableProps","hasArgsEnumBug","contains","item","keys","nIdx","ks","checkArgsLength","val","slice","_uniqContentEquals","aIterator","bIterator","stackA","stackB","eq","_equals","aItem","f","match","typeA","equals","constructor","String","valueOf","name","message","source","global","ignoreCase","multiline","sticky","unicode","size","entries","concat","values","keysA","extendedStackA","extendedStackB","_curry3","f3","c","_c","_isObject","l","k","result","mergeDeepWithKey","lObj","rObj","lVal","rVal","names","index","_clone","refFrom","refTo","deep","pattern","copy","copiedValue","Date","RegExp","clone","Array","isArray","_isArray","_isString","nodeType","XWrap","Error","acc","bind","thisObj","n","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","_arity","_iterableReduce","xf","step","_methodReduce","methodName","symIterator","iterator","_reduce","_xwrap","_arrayReduce","reduce","TypeError","validator","validationFunction","Type","Boolean","ConceptUuid","Number","UUID","PersonAttributeTypeUuid","PatientIdentifierTypeUuid","isBoolean","isNumber","isString","isObject","isUuid","test","configInternalStore","createGlobalStore","providedConfigs","schemas","moduleLoaded","temporaryConfigStore","config","JSON","parse","localStorage","getItem","e","getTemporaryConfig","subscribe","state","setItem","stringify","configExtensionStore","mountedExtensions","getConfigStore","moduleName","getGlobalStore","loaded","translationOverridesLoaded","getExtensionSlotsConfigStore","slots","getExtensionSlotConfig","slotName","getExtensionSlotConfigFromStore","getState","slotConfig","getExtensionsConfigStore","configs","getExtensionConfig","extensionId","extensionConfig","assign","getExtensionConfigFromStore","omit","implementerToolsConfigStore","computeModuleConfig","tempState","moduleStore","getConfigForModule","setState","getConfigForModuleImplicitSchema","computeExtensionSlotConfigs","allConfigs","slotConfigPerModule","slotConfigs","mergeConfigs","getProvidedConfigs","configBySlotName","validateExtensionSlotConfig","validateAllExtensionSlotConfigs","extensionSlots","newSlotStoreEntries","fromEntries","map","slotStore","oldState","newState","computeImplementerToolsConfig","tempConfigState","configState","getSchemaWithValuesAndSources","configsAndSources","createValuesAndSourcesTree","getImplementerToolsConfig","computeExtensionConfigs","extensionState","extension","computeExtensionConfig","slotModuleName","extensionModuleName","defineConfigSchema","schema","validateConfigSchema","enhancedSchema","mergeDeepRight","implicitConfigSchema","registerModuleWithConfigSystem","defineExtensionConfigSchema","extensionName","console","error","provide","sourceName","getConfig","Promise","resolve","update","unsubscribe","store","getTranslationOverrides","translationOverrides","processConfig","providedConfig","keyPathContext","validateStructure","setDefaults","runAllValidatorsInConfigTree","slotModuleConfig","split","getExtensionNameFromId","extensionConfigSchema","nameOfSchemaSource","mergeConfigsFor","configOverride","configure","combinedConfig","_value","_default","_source","isOrdinaryObject","keyPath","errorPrefix","invalidKeys","filter","includes","logError","join","add","every","remove","order","updateMessage","thisKeyPath","schemaPart","elements","_elements","hasObjectSchema","_validators","valueType","_type","startsWith","inputConfig","mergeDeepAll","validateBranchStructure","checkType","dictionarySchema","validateDictionaryStructure","arraySchema","i","validateArrayStructure","runValidators","validators","validatorResult","configPart","configWithDefaults","conf","objectKey","selectedConfigPart","elementsSchema","displayedValidationMessages","Set","has","clearConfigErrors","forEach","delete","clear","privileges","_description","badKeys","inRange","min","max","isUrlWithTemplateParameters","allowedTemplateParameters","allowedParams","rx","exec","p","isUrl","oneOf","allowedValues"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-config",
3
- "version": "5.3.3-pre.1421",
3
+ "version": "5.3.3-pre.1425",
4
4
  "license": "MPL-2.0",
5
5
  "description": "A configuration library for the OpenMRS Single-Spa framework.",
6
6
  "browser": "dist/openmrs-esm-module-config.js",
@@ -46,8 +46,8 @@
46
46
  "single-spa": "5.x"
47
47
  },
48
48
  "devDependencies": {
49
- "@openmrs/esm-globals": "5.3.3-pre.1421",
50
- "@openmrs/esm-state": "5.3.3-pre.1421",
49
+ "@openmrs/esm-globals": "5.3.3-pre.1425",
50
+ "@openmrs/esm-state": "5.3.3-pre.1425",
51
51
  "@types/ramda": "^0.26.44",
52
52
  "single-spa": "^6.0.0"
53
53
  },
@@ -15,6 +15,9 @@ import {
15
15
  import { Type } from '../types';
16
16
  import { getExtensionSlotsConfigStore } from '..';
17
17
 
18
+ // Names from Wikipedia's "Metasyntactic variable" page:
19
+ // foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud
20
+
18
21
  const mockConfigInternalStore = configInternalStore as MockedStore<ConfigInternalStore>;
19
22
  const mockTemporaryConfigStore = temporaryConfigStore as MockedStore<object>;
20
23
  const mockImplementerToolsConfigStore = implementerToolsConfigStore as MockedStore<ImplementerToolsConfigStore>;
@@ -734,6 +737,26 @@ describe('processConfig', () => {
734
737
  describe('implementer tools config', () => {
735
738
  afterEach(resetAll);
736
739
 
740
+ const implicitConfigImplementerToolsResult = {
741
+ 'Display conditions': {
742
+ privileges: {
743
+ _default: [],
744
+ _description: expect.any(String),
745
+ _source: 'default',
746
+ _type: Type.Array,
747
+ _value: [],
748
+ },
749
+ },
750
+ 'Translation overrides': {
751
+ _default: {},
752
+ _description: expect.any(String),
753
+ _source: 'default',
754
+ _type: Type.Object,
755
+ _validators: [expect.any(Function)],
756
+ _value: {},
757
+ },
758
+ };
759
+
737
760
  it('returns all config schemas, with values and sources interpolated', async () => {
738
761
  Config.defineConfigSchema('foo-module', {
739
762
  foo: { _default: 'qux', _description: 'All the foo', _validators: [] },
@@ -751,43 +774,11 @@ describe('implementer tools config', () => {
751
774
  _description: 'All the foo',
752
775
  _validators: [],
753
776
  },
754
- 'Display conditions': {
755
- privileges: {
756
- _default: [],
757
- _description: 'The privilege(s) the user must have to use this extension',
758
- _source: 'default',
759
- _type: Type.Array,
760
- _value: [],
761
- },
762
- },
763
- 'Translation overrides': {
764
- _default: {},
765
- _description:
766
- 'Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value',
767
- _source: 'default',
768
- _type: Type.Object,
769
- _value: {},
770
- },
777
+ ...implicitConfigImplementerToolsResult,
771
778
  },
772
779
  'bar-module': {
773
780
  bar: { _value: 'baz', _source: 'my config source', _default: 'quinn' },
774
- 'Display conditions': {
775
- privileges: {
776
- _default: [],
777
- _description: 'The privilege(s) the user must have to use this extension',
778
- _source: 'default',
779
- _type: Type.Array,
780
- _value: [],
781
- },
782
- },
783
- 'Translation overrides': {
784
- _default: {},
785
- _description:
786
- 'Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value',
787
- _source: 'default',
788
- _type: Type.Object,
789
- _value: {},
790
- },
781
+ ...implicitConfigImplementerToolsResult,
791
782
  },
792
783
  });
793
784
  });
@@ -932,23 +923,8 @@ describe('extension slot config', () => {
932
923
  remove: { _value: ['bar'], _source: 'provided' },
933
924
  },
934
925
  },
935
- 'Display conditions': {
936
- privileges: {
937
- _default: [],
938
- _description: 'The privilege(s) the user must have to use this extension',
939
- _source: 'default',
940
- _type: Type.Array,
941
- _value: [],
942
- },
943
- },
944
- 'Translation overrides': {
945
- _default: {},
946
- _description:
947
- 'Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value',
948
- _source: 'default',
949
- _type: Type.Object,
950
- _value: {},
951
- },
926
+ 'Display conditions': expect.any(Object),
927
+ 'Translation overrides': expect.any(Object),
952
928
  },
953
929
  });
954
930
  });
@@ -1070,6 +1046,7 @@ describe('extension config', () => {
1070
1046
  });
1071
1047
 
1072
1048
  it('does not accept module config parameters for extension if extension config schema is defined', () => {
1049
+ updateConfigExtensionStore();
1073
1050
  Config.defineExtensionConfigSchema('fooExt', {
1074
1051
  qux: { _default: 'quxxy' },
1075
1052
  });
@@ -1097,6 +1074,35 @@ describe('extension config', () => {
1097
1074
  });
1098
1075
  });
1099
1076
 
1077
+ describe('translation overrides', () => {
1078
+ it('allows obtaining translation overrides before schema is registered', async () => {
1079
+ console.error = jest.fn();
1080
+ Config.provide({
1081
+ 'corge-module': {
1082
+ 'Translation overrides': {
1083
+ en: {
1084
+ 'foo.bar': 'baz',
1085
+ },
1086
+ },
1087
+ corges: true,
1088
+ },
1089
+ });
1090
+ Config.registerModuleWithConfigSystem('corge-module');
1091
+ const translationOverrides = await Config.getTranslationOverrides('corge-module');
1092
+ expect(translationOverrides).toStrictEqual({
1093
+ en: {
1094
+ 'foo.bar': 'baz',
1095
+ },
1096
+ });
1097
+ Config.defineConfigSchema('corge-module', {
1098
+ corges: { _default: false, _type: Type.Boolean },
1099
+ });
1100
+ const config = Config.getConfig('corge-module');
1101
+ expect(config).resolves.toStrictEqual({ corges: true });
1102
+ expect(console.error).not.toHaveBeenCalled();
1103
+ });
1104
+ });
1105
+
1100
1106
  function updateConfigExtensionStore(extensionId = 'fooExt') {
1101
1107
  configExtensionStore.setState({
1102
1108
  mountedExtensions: [
@@ -3,6 +3,7 @@ import { clone, reduce, mergeDeepRight, equals, omit } from 'ramda';
3
3
  import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig, ExtensionSlotConfigObject } from '../types';
4
4
  import { Type } from '../types';
5
5
  import { isArray, isBoolean, isUuid, isNumber, isObject, isString } from '../validators/type-validators';
6
+ import { validator } from '../validators/validator';
6
7
  import type { ConfigExtensionStore, ConfigInternalStore, ConfigStore } from './state';
7
8
  import {
8
9
  configInternalStore,
@@ -14,7 +15,7 @@ import {
14
15
  getExtensionSlotsConfigStore,
15
16
  } from './state';
16
17
  import type {} from '@openmrs/esm-globals';
17
- import type { TemporaryConfigStore } from '..';
18
+ import { type TemporaryConfigStore } from '..';
18
19
 
19
20
  /**
20
21
  * Store setup
@@ -75,9 +76,28 @@ temporaryConfigStore.subscribe((tempConfigState) => {
75
76
 
76
77
  function computeModuleConfig(state: ConfigInternalStore, tempState: TemporaryConfigStore) {
77
78
  for (let moduleName of Object.keys(state.schemas)) {
78
- const config = getConfigForModule(moduleName, state, tempState);
79
+ // At this point the schema could be either just the implicit schema or the actually
80
+ // defined schema. We run with just the implicit schema because we want to populate
81
+ // the config store with the translation overrides as soon as possible. In fact, the
82
+ // translation system will throw for Suspense until the translation overrides are
83
+ // available, which as of this writing blocks the schema definition from occurring
84
+ // for modules loaded based on their extensions.
79
85
  const moduleStore = getConfigStore(moduleName);
80
- moduleStore.setState({ loaded: true, config });
86
+ if (state.moduleLoaded[moduleName]) {
87
+ const config = getConfigForModule(moduleName, state, tempState);
88
+ moduleStore.setState({
89
+ translationOverridesLoaded: true,
90
+ loaded: true,
91
+ config,
92
+ });
93
+ } else {
94
+ const config = getConfigForModuleImplicitSchema(moduleName, state, tempState);
95
+ moduleStore.setState({
96
+ translationOverridesLoaded: true,
97
+ loaded: false,
98
+ config,
99
+ });
100
+ }
81
101
  }
82
102
  }
83
103
 
@@ -105,6 +125,8 @@ function computeExtensionConfigs(
105
125
  tempConfigState: TemporaryConfigStore,
106
126
  ) {
107
127
  const configs = {};
128
+ // We assume that the module schema has already been defined, since the extension
129
+ // it contains is mounted.
108
130
  for (let extension of extensionState.mountedExtensions) {
109
131
  const config = computeExtensionConfig(
110
132
  extension.slotModuleName,
@@ -146,6 +168,24 @@ export function defineConfigSchema(moduleName: string, schema: ConfigSchema) {
146
168
  const state = configInternalStore.getState();
147
169
  configInternalStore.setState({
148
170
  schemas: { ...state.schemas, [moduleName]: enhancedSchema },
171
+ moduleLoaded: { ...state.moduleLoaded, [moduleName]: true },
172
+ });
173
+ }
174
+
175
+ /**
176
+ * This alerts the configuration system that a module exists. This allows config to be
177
+ * processed, while still allowing the extension system to know whether the module has
178
+ * actually had its front bundle executed yet.
179
+ *
180
+ * This should only be used in esm-app-shell.
181
+ *
182
+ * @internal
183
+ * @param moduleName
184
+ */
185
+ export function registerModuleWithConfigSystem(moduleName: string) {
186
+ const state = configInternalStore.getState();
187
+ configInternalStore.setState({
188
+ schemas: { ...state.schemas, [moduleName]: implicitConfigSchema },
149
189
  });
150
190
  }
151
191
 
@@ -214,13 +254,13 @@ export function getConfig<T = Record<string, any>>(moduleName: string): Promise<
214
254
  }
215
255
 
216
256
  /** @internal */
217
- export function getConfigInternal(moduleName: string): Promise<Config> {
218
- return new Promise<Config>((resolve) => {
257
+ export function getTranslationOverrides(moduleName: string): Promise<Object> {
258
+ return new Promise<Object>((resolve) => {
219
259
  const store = getConfigStore(moduleName);
220
260
  function update(state: ConfigStore) {
221
- if (state.loaded && state.config) {
222
- const config = state.config;
223
- resolve(config);
261
+ if (state.translationOverridesLoaded && state.config) {
262
+ const translationOverrides = state.config['Translation overrides'] ?? {};
263
+ resolve(translationOverrides);
224
264
  unsubscribe && unsubscribe();
225
265
  }
226
266
  }
@@ -279,7 +319,6 @@ function computeExtensionConfig(
279
319
  const configOverride = slotModuleConfig?.extensionSlots?.[slotName]?.configure?.[extensionId] ?? {};
280
320
  const extensionConfig = mergeConfigsFor(nameOfSchemaSource, providedConfigs);
281
321
  const combinedConfig = mergeConfigs([extensionConfig, configOverride]);
282
- // TODO: validate that a schema exists for the module
283
322
  const schema = extensionConfigSchema ?? configState.schemas[extensionModuleName];
284
323
  validateStructure(schema, combinedConfig, nameOfSchemaSource);
285
324
  const config = setDefaults(schema, combinedConfig);
@@ -477,10 +516,6 @@ function getConfigForModule(
477
516
  configState: ConfigInternalStore,
478
517
  tempConfigState: TemporaryConfigStore,
479
518
  ): ConfigObject {
480
- if (!configState.schemas.hasOwnProperty(moduleName)) {
481
- throw Error('No config schema has been defined for ' + moduleName);
482
- }
483
-
484
519
  const schema = configState.schemas[moduleName];
485
520
  const inputConfig = mergeConfigsFor(moduleName, getProvidedConfigs(configState, tempConfigState));
486
521
  validateStructure(schema, inputConfig, moduleName);
@@ -490,6 +525,18 @@ function getConfigForModule(
490
525
  return config;
491
526
  }
492
527
 
528
+ function getConfigForModuleImplicitSchema(
529
+ moduleName: string,
530
+ configState: ConfigInternalStore,
531
+ tempConfigState: TemporaryConfigStore,
532
+ ): ConfigObject {
533
+ const inputConfig = mergeConfigsFor(moduleName, getProvidedConfigs(configState, tempConfigState));
534
+ const config = setDefaults(implicitConfigSchema, inputConfig);
535
+ runAllValidatorsInConfigTree(implicitConfigSchema, config, moduleName);
536
+ delete config.extensionSlots;
537
+ return config;
538
+ }
539
+
493
540
  function mergeConfigsFor(moduleName: string, allConfigs: Array<Config>): ConfigObject {
494
541
  const allConfigsForModule = allConfigs.map(({ [moduleName]: c }) => c).filter((c) => !!c);
495
542
 
@@ -751,5 +798,16 @@ const implicitConfigSchema: ConfigSchema = {
751
798
  'Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value',
752
799
  _type: Type.Object,
753
800
  _default: {},
801
+ _validators: [
802
+ validator(
803
+ (o) => Object.keys(o).every((k) => /^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(k)),
804
+ (o) => {
805
+ const badKeys = Object.keys(o).filter((k) => !/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(k));
806
+ return `The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${badKeys.join(
807
+ ', ',
808
+ )}.`;
809
+ },
810
+ ),
811
+ ],
754
812
  },
755
813
  };
@@ -13,12 +13,18 @@ export interface ConfigInternalStore {
13
13
  providedConfigs: Array<ProvidedConfig>;
14
14
  /** An object with module names for keys and schemas for values */
15
15
  schemas: Record<string, ConfigSchema>;
16
- /** Whether to use dev defaults or not */
16
+ /**
17
+ * Before modules are loaded, they get implicit schemas added to `schemas`. Therefore
18
+ * we need to track separately whether they have actually been loaded (that is,
19
+ * whether the schema has actually been defined).
20
+ */
21
+ moduleLoaded: Record<string, boolean>;
17
22
  }
18
23
 
19
24
  const configInternalStoreInitialValue = {
20
25
  providedConfigs: [],
21
26
  schemas: {},
27
+ moduleLoaded: {},
22
28
  };
23
29
 
24
30
  /**
@@ -92,12 +98,14 @@ export const configExtensionStore = createGlobalStore<ConfigExtensionStore>('con
92
98
  export interface ConfigStore {
93
99
  config: ConfigObject | null;
94
100
  loaded: boolean;
101
+ translationOverridesLoaded: boolean;
95
102
  }
96
103
 
97
104
  function initializeConfigStore() {
98
105
  return {
99
106
  config: null,
100
107
  loaded: false,
108
+ translationOverridesLoaded: false,
101
109
  };
102
110
  }
103
111