@openmrs/esm-extensions 3.2.0 → 3.2.1-pre.1015
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/openmrs-esm-extensions.js +1 -1
- package/dist/openmrs-esm-extensions.js.map +1 -1
- package/package.json +5 -5
- package/src/extensions.ts +174 -209
- package/src/index.ts +9 -1
- package/src/render.ts +6 -2
- package/src/store.ts +73 -39
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["@openmrs/esm-config","@openmrs/esm-state","single-spa"],(function(t,e){var n={},r={},o={};return{setters:[function(t){n.configExtensionStore=t.configExtensionStore,n.getExtensionSlotsConfigStore=t.getExtensionSlotsConfigStore,n.navigate=t.navigate},function(t){r.createGlobalStore=t.createGlobalStore,r.update=t.update},function(t){o.mountRootParcel=t.mountRootParcel}],execute:function(){t((()=>{var t={968:(t,e,n)=>{const r=n(577).R;e.s=function(t){if(t||(t=1),!n.y.meta||!n.y.meta.url)throw console.error("__system_context__",n.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");n.p=r(n.y.meta.url,t)}},577:(t,e,n)=>{e.R=function(t,e){var n=document.createElement("a");n.href=t;for(var r="/"===n.pathname[0]?n.pathname:"/"+n.pathname,o=0,s=r.length;o!==e&&s>=0;)"/"===r[--s]&&o++;if(o!==e)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+e+") is greater than the number of directories ("+o+") in the URL path "+t);var i=r.slice(0,s+1);return n.protocol+"//"+n.host+i};Number.isInteger},824:t=>{"use strict";t.exports=n},685:t=>{"use strict";t.exports=r},645:t=>{"use strict";t.exports=o}},s={};function i(e){var n=s[e];if(void 0!==n)return n.exports;var r=s[e]={exports:{}};return t[e](r,r.exports,i),r.exports}i.y=e,i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");n.length&&(t=n[n.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})();var a={};return(0,i(968).s)(1),(()=>{"use strict";i.r(a),i.d(a,{attach:()=>ve,checkStatus:()=>we,checkStatusFor:()=>Ee,detach:()=>ye,detachAll:()=>be,extensionStore:()=>ie,getAssignedIds:()=>ge,getCustomProps:()=>Ae,getExtensionNameFromId:()=>fe,getExtensionRegistration:()=>pe,getExtensionRegistrationFrom:()=>de,getExtensionSlotsForModule:()=>xe,getUpdatedExtensionSlotInfo:()=>Oe,pushNavigationContext:()=>n,registerExtension:()=>he,registerExtensionSlot:()=>je,renderExtension:()=>Pe,reset:()=>Se,switchTo:()=>e,unregisterExtensionSlot:()=>me,updateExtensionStore:()=>ce});var t=i(824);function e(e,n,r){(0,t.navigate)({to:n})}function n(t){return()=>{}}const r=function(t,e){return t===e||t!=t&&e!=e},o=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1};var s=Array.prototype.splice;function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=function(){this.__data__=[],this.size=0},c.prototype.delete=function(t){var e=this.__data__,n=o(e,t);return!(n<0||(n==e.length-1?e.pop():s.call(e,n,1),--this.size,0))},c.prototype.get=function(t){var e=this.__data__,n=o(e,t);return n<0?void 0:e[n][1]},c.prototype.has=function(t){return o(this.__data__,t)>-1},c.prototype.set=function(t,e){var n=this.__data__,r=o(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};const u=c,l="object"==typeof global&&global&&global.Object===Object&&global;var f="object"==typeof self&&self&&self.Object===Object&&self;const d=l||f||Function("return this")(),p=d.Symbol;var h=Object.prototype,v=h.hasOwnProperty,y=h.toString,b=p?p.toStringTag:void 0;var _=Object.prototype.toString;var g=p?p.toStringTag:void 0;const j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":g&&g in Object(t)?function(t){var e=v.call(t,b),n=t[b];try{t[b]=void 0;var r=!0}catch(t){}var o=y.call(t);return r&&(e?t[b]=n:delete t[b]),o}(t):function(t){return _.call(t)}(t)},m=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},x=function(t){if(!m(t))return!1;var e=j(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},S=d["__core-js_shared__"];var O,w=(O=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||""))?"Symbol(src)_1."+O:"";var E=Function.prototype.toString;const A=function(t){if(null!=t){try{return E.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var I=/^\[object .+?Constructor\]$/,P=Function.prototype,z=Object.prototype,k=P.toString,N=z.hasOwnProperty,M=RegExp("^"+k.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const T=function(t){return!(!m(t)||(e=t,w&&w in e))&&(x(t)?M:I).test(A(t));var e},F=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return T(n)?n:void 0},R=F(d,"Map"),$=F(Object,"create");var C=Object.prototype.hasOwnProperty;var B=Object.prototype.hasOwnProperty;function L(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}L.prototype.clear=function(){this.__data__=$?$(null):{},this.size=0},L.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},L.prototype.get=function(t){var e=this.__data__;if($){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return C.call(e,t)?e[t]:void 0},L.prototype.has=function(t){var e=this.__data__;return $?void 0!==e[t]:B.call(e,t)},L.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=$&&void 0===e?"__lodash_hash_undefined__":e,this};const U=L,D=function(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map};function G(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}G.prototype.clear=function(){this.size=0,this.__data__={hash:new U,map:new(R||u),string:new U}},G.prototype.delete=function(t){var e=D(this,t).delete(t);return this.size-=e?1:0,e},G.prototype.get=function(t){return D(this,t).get(t)},G.prototype.has=function(t){return D(this,t).has(t)},G.prototype.set=function(t,e){var n=D(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};const V=G;function W(t){var e=this.__data__=new u(t);this.size=e.size}W.prototype.clear=function(){this.__data__=new u,this.size=0},W.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},W.prototype.get=function(t){return this.__data__.get(t)},W.prototype.has=function(t){return this.__data__.has(t)},W.prototype.set=function(t,e){var n=this.__data__;if(n instanceof u){var r=n.__data__;if(!R||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new V(r)}return n.set(t,e),this.size=n.size,this};const q=W;function J(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new V;++e<n;)this.add(t[e])}J.prototype.add=J.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},J.prototype.has=function(t){return this.__data__.has(t)};const H=J,K=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1},Q=function(t,e,n,r,o,s){var i=1&n,a=t.length,c=e.length;if(a!=c&&!(i&&c>a))return!1;var u=s.get(t),l=s.get(e);if(u&&l)return u==e&&l==t;var f=-1,d=!0,p=2&n?new H:void 0;for(s.set(t,e),s.set(e,t);++f<a;){var h=t[f],v=e[f];if(r)var y=i?r(v,h,f,e,t,s):r(h,v,f,t,e,s);if(void 0!==y){if(y)continue;d=!1;break}if(p){if(!K(e,(function(t,e){if(i=e,!p.has(i)&&(h===t||o(h,t,n,r,s)))return p.push(e);var i}))){d=!1;break}}else if(h!==v&&!o(h,v,n,r,s)){d=!1;break}}return s.delete(t),s.delete(e),d},X=d.Uint8Array,Y=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},Z=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n};var tt=p?p.prototype:void 0,et=tt?tt.valueOf:void 0;const nt=Array.isArray;var rt=Object.prototype.propertyIsEnumerable,ot=Object.getOwnPropertySymbols;const st=ot?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[o++]=i)}return s}(ot(t),(function(e){return rt.call(t,e)})))}:function(){return[]},it=function(t){return null!=t&&"object"==typeof t},at=function(t){return it(t)&&"[object Arguments]"==j(t)};var ct=Object.prototype,ut=ct.hasOwnProperty,lt=ct.propertyIsEnumerable;const ft=at(function(){return arguments}())?at:function(t){return it(t)&&ut.call(t,"callee")&&!lt.call(t,"callee")};var dt="object"==typeof exports&&exports&&!exports.nodeType&&exports,pt=dt&&"object"==typeof module&&module&&!module.nodeType&&module,ht=pt&&pt.exports===dt?d.Buffer:void 0;const vt=(ht?ht.isBuffer:void 0)||function(){return!1};var yt=/^(?:0|[1-9]\d*)$/;const bt=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&yt.test(t))&&t>-1&&t%1==0&&t<e},_t=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var gt={};gt["[object Float32Array]"]=gt["[object Float64Array]"]=gt["[object Int8Array]"]=gt["[object Int16Array]"]=gt["[object Int32Array]"]=gt["[object Uint8Array]"]=gt["[object Uint8ClampedArray]"]=gt["[object Uint16Array]"]=gt["[object Uint32Array]"]=!0,gt["[object Arguments]"]=gt["[object Array]"]=gt["[object ArrayBuffer]"]=gt["[object Boolean]"]=gt["[object DataView]"]=gt["[object Date]"]=gt["[object Error]"]=gt["[object Function]"]=gt["[object Map]"]=gt["[object Number]"]=gt["[object Object]"]=gt["[object RegExp]"]=gt["[object Set]"]=gt["[object String]"]=gt["[object WeakMap]"]=!1;var jt="object"==typeof exports&&exports&&!exports.nodeType&&exports,mt=jt&&"object"==typeof module&&module&&!module.nodeType&&module,xt=mt&&mt.exports===jt&&l.process,St=function(){try{return mt&&mt.require&&mt.require("util").types||xt&&xt.binding&&xt.binding("util")}catch(t){}}(),Ot=St&&St.isTypedArray;const wt=Ot?(Et=Ot,function(t){return Et(t)}):function(t){return it(t)&&_t(t.length)&&!!gt[j(t)]};var Et,At=Object.prototype.hasOwnProperty;const It=function(t,e){var n=nt(t),r=!n&&ft(t),o=!n&&!r&&vt(t),s=!n&&!r&&!o&&wt(t),i=n||r||o||s,a=i?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!At.call(t,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||bt(u,c))||a.push(u);return a};var Pt=Object.prototype;const zt=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object);var kt=Object.prototype.hasOwnProperty;const Nt=function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||Pt))return zt(t);var e,n,r=[];for(var o in Object(t))kt.call(t,o)&&"constructor"!=o&&r.push(o);return r},Mt=function(t){return null!=(e=t)&&_t(e.length)&&!x(e)?It(t):Nt(t);var e},Tt=function(t){return function(t,e,n){var r=e(t);return nt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,Mt,st)};var Ft=Object.prototype.hasOwnProperty;const Rt=F(d,"DataView"),$t=F(d,"Promise"),Ct=F(d,"Set"),Bt=F(d,"WeakMap");var Lt="[object Map]",Ut="[object Promise]",Dt="[object Set]",Gt="[object WeakMap]",Vt="[object DataView]",Wt=A(Rt),qt=A(R),Jt=A($t),Ht=A(Ct),Kt=A(Bt),Qt=j;(Rt&&Qt(new Rt(new ArrayBuffer(1)))!=Vt||R&&Qt(new R)!=Lt||$t&&Qt($t.resolve())!=Ut||Ct&&Qt(new Ct)!=Dt||Bt&&Qt(new Bt)!=Gt)&&(Qt=function(t){var e=j(t),n="[object Object]"==e?t.constructor:void 0,r=n?A(n):"";if(r)switch(r){case Wt:return Vt;case qt:return Lt;case Jt:return Ut;case Ht:return Dt;case Kt:return Gt}return e});const Xt=Qt;var Yt="[object Arguments]",Zt="[object Array]",te="[object Object]",ee=Object.prototype.hasOwnProperty;const ne=function(t,e,n,o,s,i){var a=nt(t),c=nt(e),u=a?Zt:Xt(t),l=c?Zt:Xt(e),f=(u=u==Yt?te:u)==te,d=(l=l==Yt?te:l)==te,p=u==l;if(p&&vt(t)){if(!vt(e))return!1;a=!0,f=!1}if(p&&!f)return i||(i=new q),a||wt(t)?Q(t,e,n,o,s,i):function(t,e,n,o,s,i,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new X(t),new X(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return r(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var c=Y;case"[object Set]":var u=1&o;if(c||(c=Z),t.size!=e.size&&!u)return!1;var l=a.get(t);if(l)return l==e;o|=2,a.set(t,e);var f=Q(c(t),c(e),o,s,i,a);return a.delete(t),f;case"[object Symbol]":if(et)return et.call(t)==et.call(e)}return!1}(t,e,u,n,o,s,i);if(!(1&n)){var h=f&&ee.call(t,"__wrapped__"),v=d&&ee.call(e,"__wrapped__");if(h||v){var y=h?t.value():t,b=v?e.value():e;return i||(i=new q),s(y,b,n,o,i)}}return!!p&&(i||(i=new q),function(t,e,n,r,o,s){var i=1&n,a=Tt(t),c=a.length;if(c!=Tt(e).length&&!i)return!1;for(var u=c;u--;){var l=a[u];if(!(i?l in e:Ft.call(e,l)))return!1}var f=s.get(t),d=s.get(e);if(f&&d)return f==e&&d==t;var p=!0;s.set(t,e),s.set(e,t);for(var h=i;++u<c;){var v=t[l=a[u]],y=e[l];if(r)var b=i?r(y,v,l,e,t,s):r(v,y,l,t,e,s);if(!(void 0===b?v===y||o(v,y,n,r,s):b)){p=!1;break}h||(h="constructor"==l)}if(p&&!h){var _=t.constructor,g=e.constructor;_==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof g&&g instanceof g||(p=!1)}return s.delete(t),s.delete(e),p}(t,e,n,o,s,i))},re=function t(e,n,r,o,s){return e===n||(null==e||null==n||!it(e)&&!it(n)?e!=e&&n!=n:ne(e,n,r,o,t,s))},oe=function(t,e){return re(t,e)};var se=i(685);const ie=(0,se.createGlobalStore)("extensions",{slots:{},extensions:{}});let ae=Promise.resolve();function ce(t){ae=ae.then((async()=>{const e=ie.getState(),n=await t(e);n!==e&&ie.setState(n)}))}function ue(e){const n=[];for(let t of Object.values(e.extensions))for(let[e,r]of Object.entries(t.instances))for(let[o,s]of Object.entries(r))n.push({slotModuleName:e,extensionModuleName:t.moduleName,slotName:o,extensionId:s.id});oe(t.configExtensionStore.getState().mountedExtensions,n)||t.configExtensionStore.setState({mountedExtensions:n})}function le(t){return{name:t,attachedIds:[],instances:{}}}function fe(t){const[e]=t.split("#");return e}function de(t,e){const n=fe(e);return t.extensions[n]}function pe(t){return de(ie.getState(),t)}ue(ie.getState()),ie.subscribe(ue);const he=ie.action(((t,e,n)=>{t.extensions[e]={...n,name:e,instances:{}}}));function ve(t,e){ce((n=>{const r=n.slots[t];return r?{...n,slots:{...n.slots,[t]:{...r,attachedIds:[...r.attachedIds,e]}}}:{...n,slots:{...n.slots,[t]:{...le(t),attachedIds:[e]}}}}))}function ye(t,e){ce((n=>{const r=n.slots[t];return r&&r.attachedIds.includes(e)?{...n,slots:{...n.slots,[t]:{...r,attachedIds:r.attachedIds.filter((t=>t!==e))}}}:n}))}function be(t){ce((e=>{const n=e.slots[t];return n?{...e,slots:{...e.slots,[t]:{...n,attachedIds:[]}}}:e}))}function _e(t,e,n,r){const o=e.indexOf(t);if(-1!==o)return o;if(void 0!==n)return 1e3+n;{const e=r.indexOf(t);return-1!==e?2e3+e:-1}}function ge(t,e,n){const r=e.add||[],o=e.remove||[],s=e.order||[],{extensions:i}=ie.getState();return[...n,...r].filter((t=>!o.includes(t))).sort(((t,e)=>{const r=_e(t,s,i[fe(t)].order,n),o=_e(e,s,i[fe(e)].order,n);return-1===o?-1:-1===r?1:r-o}))}function je(t,e){ce((n=>{const r=n.slots[e],o=function(t,e,n){return t?n in t.instances?Oe(e,n,t):Oe(e,n,{...t,instances:{...t.instances,[n]:{addedIds:[],idOrder:[],removedIds:[]}}}):Oe(e,n,{...le(e),instances:{[n]:{addedIds:[],idOrder:[],removedIds:[]}}})}(r,e,t);return r!==o?{...n,slots:{...n.slots,[e]:o}}:n}))}function me(t,e){ce((n=>{const r=n.slots[e];if(r&&t in r.instances){const o=function(t,e,n){const{[n]:r,...o}=t.instances;return Oe(e,n,{...t,instances:o})}(r,e,t);return{...n,slots:{...n.slots,[e]:o}}}return n}))}function xe(t){const e=ie.getState();return Object.keys(e.slots).filter((n=>t in e.slots[n].instances))}const Se=ie.action((()=>({slots:{},extensions:{}})));function Oe(e,n,r){let o=r.instances[n];if(o){var s;const i=o,a=null!==(s=(0,t.getExtensionSlotsConfigStore)(n).getState().extensionSlotConfigs[e])&&void 0!==s?s:{};if(Array.isArray(a.add)&&a.add.forEach((t=>{o.addedIds.includes(t)||(o={...o,addedIds:[...o.addedIds,t]})})),Array.isArray(a.remove)&&a.remove.forEach((t=>{o.removedIds.includes(t)||(o={...o,removedIds:[...o.removedIds,t]})})),Array.isArray(a.order)){const t=a.order.join(",");o.idOrder.join(",").endsWith(t)||a.order.forEach((t=>{o={...o,idOrder:[...o.idOrder.filter((e=>e!==t)),t]}}))}if(o!==i)return{...r,instances:{...r.instances,[n]:o}}}return r}function we(t=!0,e=!1){return Ee(navigator.onLine,t,e)}function Ee(t,e=!0,n=!1){return Boolean(t?e:n)}function Ae(t,e){const n=navigator.onLine?t:e;return"object"==typeof n?n:{}}var Ie=i(645);function Pe(t,e,n,r,o=(t=>t),s={}){const i=fe(r),a=pe(r);let c=!0,u=null;if(t){if(!a)throw Error(`Couldn't find extension '${i}' to attach to '${e}'`);const{load:l,online:f,offline:d,meta:p,moduleName:h}=a;we(f,d)&&(l().then((({default:i,...a})=>{c&&(u=(0,Ie.mountRootParcel)(o(null!=i?i:a),{...Ae(f,d),...s,_meta:p,_extensionContext:{extensionId:r,extensionSlotName:e,extensionSlotModuleName:n,extensionModuleName:h},domElement:t}))})),ce((o=>(0,se.update)(o,["extensions",i,"instances",n,e],{domElement:t,id:r}))))}return()=>{c=!1,u&&("MOUNTED"!==u.getStatus()?u.mountPromise.then((()=>{u&&u.unmount()})):u.unmount())}}})(),a})())}}}));
|
|
1
|
+
System.register(["@openmrs/esm-config","@openmrs/esm-state","single-spa"],(function(t,e){var n={},r={},o={};return{setters:[function(t){n.configExtensionStore=t.configExtensionStore,n.getExtensionSlotConfigStore=t.getExtensionSlotConfigStore,n.navigate=t.navigate},function(t){r.createGlobalStore=t.createGlobalStore,r.getGlobalStore=t.getGlobalStore,r.update=t.update},function(t){o.mountRootParcel=t.mountRootParcel}],execute:function(){t((()=>{var t={968:(t,e,n)=>{const r=n(577).R;e.s=function(t){if(t||(t=1),!n.y.meta||!n.y.meta.url)throw console.error("__system_context__",n.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");n.p=r(n.y.meta.url,t)}},577:(t,e,n)=>{e.R=function(t,e){var n=document.createElement("a");n.href=t;for(var r="/"===n.pathname[0]?n.pathname:"/"+n.pathname,o=0,s=r.length;o!==e&&s>=0;)"/"===r[--s]&&o++;if(o!==e)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+e+") is greater than the number of directories ("+o+") in the URL path "+t);var i=r.slice(0,s+1);return n.protocol+"//"+n.host+i};Number.isInteger},824:t=>{"use strict";t.exports=n},685:t=>{"use strict";t.exports=r},645:t=>{"use strict";t.exports=o}},s={};function i(e){var n=s[e];if(void 0!==n)return n.exports;var r=s[e]={exports:{}};return t[e](r,r.exports,i),r.exports}i.y=e,i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");n.length&&(t=n[n.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})();var a={};return(0,i(968).s)(1),(()=>{"use strict";i.r(a),i.d(a,{attach:()=>me,checkStatus:()=>Pe,checkStatusFor:()=>ze,detach:()=>je,detachAll:()=>xe,extensionStore:()=>$e,getAssignedExtensions:()=>Oe,getConnectedExtensions:()=>we,getCustomProps:()=>Ne,getExtensionInternalStore:()=>ce,getExtensionNameFromId:()=>ve,getExtensionRegistration:()=>ge,getExtensionRegistrationFrom:()=>ye,getExtensionStore:()=>fe,pushNavigationContext:()=>n,registerExtension:()=>_e,registerExtensionSlot:()=>Ee,renderExtension:()=>Te,reset:()=>Ae,switchTo:()=>e,updateInternalExtensionStore:()=>le});var t=i(824);function e(e,n,r){(0,t.navigate)({to:n})}function n(t){return()=>{}}const r=function(t,e){return t===e||t!=t&&e!=e},o=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1};var s=Array.prototype.splice;function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=function(){this.__data__=[],this.size=0},c.prototype.delete=function(t){var e=this.__data__,n=o(e,t);return!(n<0||(n==e.length-1?e.pop():s.call(e,n,1),--this.size,0))},c.prototype.get=function(t){var e=this.__data__,n=o(e,t);return n<0?void 0:e[n][1]},c.prototype.has=function(t){return o(this.__data__,t)>-1},c.prototype.set=function(t,e){var n=this.__data__,r=o(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};const u=c,l="object"==typeof global&&global&&global.Object===Object&&global;var f="object"==typeof self&&self&&self.Object===Object&&self;const p=l||f||Function("return this")(),d=p.Symbol;var h=Object.prototype,b=h.hasOwnProperty,v=h.toString,y=d?d.toStringTag:void 0;var g=Object.prototype.toString;var _=d?d.toStringTag:void 0;const m=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":_&&_ in Object(t)?function(t){var e=b.call(t,y),n=t[y];try{t[y]=void 0;var r=!0}catch(t){}var o=v.call(t);return r&&(e?t[y]=n:delete t[y]),o}(t):function(t){return g.call(t)}(t)},j=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},x=function(t){if(!j(t))return!1;var e=m(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},S=p["__core-js_shared__"];var w,O=(w=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var E=Function.prototype.toString;const A=function(t){if(null!=t){try{return E.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var P=/^\[object .+?Constructor\]$/,z=Function.prototype,N=Object.prototype,I=z.toString,T=N.hasOwnProperty,$=RegExp("^"+I.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const k=function(t){return!(!j(t)||(e=t,O&&O in e))&&(x(t)?$:P).test(A(t));var e},M=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return k(n)?n:void 0},F=M(p,"Map"),R=M(Object,"create");var C=Object.prototype.hasOwnProperty;var L=Object.prototype.hasOwnProperty;function B(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}B.prototype.clear=function(){this.__data__=R?R(null):{},this.size=0},B.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},B.prototype.get=function(t){var e=this.__data__;if(R){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return C.call(e,t)?e[t]:void 0},B.prototype.has=function(t){var e=this.__data__;return R?void 0!==e[t]:L.call(e,t)},B.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=R&&void 0===e?"__lodash_hash_undefined__":e,this};const D=B,G=function(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map};function U(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}U.prototype.clear=function(){this.size=0,this.__data__={hash:new D,map:new(F||u),string:new D}},U.prototype.delete=function(t){var e=G(this,t).delete(t);return this.size-=e?1:0,e},U.prototype.get=function(t){return G(this,t).get(t)},U.prototype.has=function(t){return G(this,t).has(t)},U.prototype.set=function(t,e){var n=G(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};const V=U;function W(t){var e=this.__data__=new u(t);this.size=e.size}W.prototype.clear=function(){this.__data__=new u,this.size=0},W.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},W.prototype.get=function(t){return this.__data__.get(t)},W.prototype.has=function(t){return this.__data__.has(t)},W.prototype.set=function(t,e){var n=this.__data__;if(n instanceof u){var r=n.__data__;if(!F||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new V(r)}return n.set(t,e),this.size=n.size,this};const q=W;function J(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new V;++e<n;)this.add(t[e])}J.prototype.add=J.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},J.prototype.has=function(t){return this.__data__.has(t)};const H=J,K=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1},Q=function(t,e,n,r,o,s){var i=1&n,a=t.length,c=e.length;if(a!=c&&!(i&&c>a))return!1;var u=s.get(t),l=s.get(e);if(u&&l)return u==e&&l==t;var f=-1,p=!0,d=2&n?new H:void 0;for(s.set(t,e),s.set(e,t);++f<a;){var h=t[f],b=e[f];if(r)var v=i?r(b,h,f,e,t,s):r(h,b,f,t,e,s);if(void 0!==v){if(v)continue;p=!1;break}if(d){if(!K(e,(function(t,e){if(i=e,!d.has(i)&&(h===t||o(h,t,n,r,s)))return d.push(e);var i}))){p=!1;break}}else if(h!==b&&!o(h,b,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p},X=p.Uint8Array,Y=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},Z=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n};var tt=d?d.prototype:void 0,et=tt?tt.valueOf:void 0;const nt=Array.isArray;var rt=Object.prototype.propertyIsEnumerable,ot=Object.getOwnPropertySymbols;const st=ot?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[o++]=i)}return s}(ot(t),(function(e){return rt.call(t,e)})))}:function(){return[]},it=function(t){return null!=t&&"object"==typeof t},at=function(t){return it(t)&&"[object Arguments]"==m(t)};var ct=Object.prototype,ut=ct.hasOwnProperty,lt=ct.propertyIsEnumerable,ft=at(function(){return arguments}())?at:function(t){return it(t)&&ut.call(t,"callee")&&!lt.call(t,"callee")};const pt=ft;var dt="object"==typeof exports&&exports&&!exports.nodeType&&exports,ht=dt&&"object"==typeof module&&module&&!module.nodeType&&module,bt=ht&&ht.exports===dt?p.Buffer:void 0;const vt=(bt?bt.isBuffer:void 0)||function(){return!1};var yt=/^(?:0|[1-9]\d*)$/;const gt=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&yt.test(t))&&t>-1&&t%1==0&&t<e},_t=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var mt={};mt["[object Float32Array]"]=mt["[object Float64Array]"]=mt["[object Int8Array]"]=mt["[object Int16Array]"]=mt["[object Int32Array]"]=mt["[object Uint8Array]"]=mt["[object Uint8ClampedArray]"]=mt["[object Uint16Array]"]=mt["[object Uint32Array]"]=!0,mt["[object Arguments]"]=mt["[object Array]"]=mt["[object ArrayBuffer]"]=mt["[object Boolean]"]=mt["[object DataView]"]=mt["[object Date]"]=mt["[object Error]"]=mt["[object Function]"]=mt["[object Map]"]=mt["[object Number]"]=mt["[object Object]"]=mt["[object RegExp]"]=mt["[object Set]"]=mt["[object String]"]=mt["[object WeakMap]"]=!1;var jt="object"==typeof exports&&exports&&!exports.nodeType&&exports,xt=jt&&"object"==typeof module&&module&&!module.nodeType&&module,St=xt&&xt.exports===jt&&l.process,wt=function(){try{return xt&&xt.require&&xt.require("util").types||St&&St.binding&&St.binding("util")}catch(t){}}(),Ot=wt&&wt.isTypedArray;const Et=Ot?(At=Ot,function(t){return At(t)}):function(t){return it(t)&&_t(t.length)&&!!mt[m(t)]};var At,Pt=Object.prototype.hasOwnProperty;const zt=function(t,e){var n=nt(t),r=!n&&pt(t),o=!n&&!r&&vt(t),s=!n&&!r&&!o&&Et(t),i=n||r||o||s,a=i?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!Pt.call(t,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gt(u,c))||a.push(u);return a};var Nt=Object.prototype;const It=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object);var Tt=Object.prototype.hasOwnProperty;const $t=function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||Nt))return It(t);var e,n,r=[];for(var o in Object(t))Tt.call(t,o)&&"constructor"!=o&&r.push(o);return r},kt=function(t){return null!=(e=t)&&_t(e.length)&&!x(e)?zt(t):$t(t);var e},Mt=function(t){return function(t,e,n){var r=e(t);return nt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,kt,st)};var Ft=Object.prototype.hasOwnProperty;const Rt=M(p,"DataView"),Ct=M(p,"Promise"),Lt=M(p,"Set"),Bt=M(p,"WeakMap");var Dt="[object Map]",Gt="[object Promise]",Ut="[object Set]",Vt="[object WeakMap]",Wt="[object DataView]",qt=A(Rt),Jt=A(F),Ht=A(Ct),Kt=A(Lt),Qt=A(Bt),Xt=m;(Rt&&Xt(new Rt(new ArrayBuffer(1)))!=Wt||F&&Xt(new F)!=Dt||Ct&&Xt(Ct.resolve())!=Gt||Lt&&Xt(new Lt)!=Ut||Bt&&Xt(new Bt)!=Vt)&&(Xt=function(t){var e=m(t),n="[object Object]"==e?t.constructor:void 0,r=n?A(n):"";if(r)switch(r){case qt:return Wt;case Jt:return Dt;case Ht:return Gt;case Kt:return Ut;case Qt:return Vt}return e});const Yt=Xt;var Zt="[object Arguments]",te="[object Array]",ee="[object Object]",ne=Object.prototype.hasOwnProperty;const re=function(t,e,n,o,s,i){var a=nt(t),c=nt(e),u=a?te:Yt(t),l=c?te:Yt(e),f=(u=u==Zt?ee:u)==ee,p=(l=l==Zt?ee:l)==ee,d=u==l;if(d&&vt(t)){if(!vt(e))return!1;a=!0,f=!1}if(d&&!f)return i||(i=new q),a||Et(t)?Q(t,e,n,o,s,i):function(t,e,n,o,s,i,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new X(t),new X(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return r(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var c=Y;case"[object Set]":var u=1&o;if(c||(c=Z),t.size!=e.size&&!u)return!1;var l=a.get(t);if(l)return l==e;o|=2,a.set(t,e);var f=Q(c(t),c(e),o,s,i,a);return a.delete(t),f;case"[object Symbol]":if(et)return et.call(t)==et.call(e)}return!1}(t,e,u,n,o,s,i);if(!(1&n)){var h=f&&ne.call(t,"__wrapped__"),b=p&&ne.call(e,"__wrapped__");if(h||b){var v=h?t.value():t,y=b?e.value():e;return i||(i=new q),s(v,y,n,o,i)}}return!!d&&(i||(i=new q),function(t,e,n,r,o,s){var i=1&n,a=Mt(t),c=a.length;if(c!=Mt(e).length&&!i)return!1;for(var u=c;u--;){var l=a[u];if(!(i?l in e:Ft.call(e,l)))return!1}var f=s.get(t),p=s.get(e);if(f&&p)return f==e&&p==t;var d=!0;s.set(t,e),s.set(e,t);for(var h=i;++u<c;){var b=t[l=a[u]],v=e[l];if(r)var y=i?r(v,b,l,e,t,s):r(b,v,l,t,e,s);if(!(void 0===y?b===v||o(b,v,n,r,s):y)){d=!1;break}h||(h="constructor"==l)}if(d&&!h){var g=t.constructor,_=e.constructor;g==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof _&&_ instanceof _||(d=!1)}return s.delete(t),s.delete(e),d}(t,e,n,o,s,i))},oe=function t(e,n,r,o,s){return e===n||(null==e||null==n||!it(e)&&!it(n)?e!=e&&n!=n:re(e,n,r,o,t,s))},se=function(t,e){return oe(t,e)};var ie=i(685);const ae=(0,ie.createGlobalStore)("extensionsInternal",{slots:{},extensions:{}}),ce=()=>(0,ie.getGlobalStore)("extensionsInternal",{slots:{},extensions:{}});let ue=Promise.resolve();function le(t){ue=ue.then((async()=>{const e=ae.getState(),n=await t(e);n!==e&&ae.setState(n)}))}const fe=()=>(0,ie.getGlobalStore)("extensions",{slots:{}});function pe(e){const n=[];for(let t of Object.values(e.extensions))for(let[e,r]of Object.entries(t.instances))for(let[o,s]of Object.entries(r))n.push({slotModuleName:e,extensionModuleName:t.moduleName,slotName:o,extensionId:s.id});se(t.configExtensionStore.getState().mountedExtensions,n)||t.configExtensionStore.setState({mountedExtensions:n})}pe(ae.getState()),ae.subscribe(pe);const de=ce(),he=fe();function be(t,e){return{moduleName:e,name:t,attachedIds:[],config:null}}function ve(t){const[e]=t.split("#");return e}function ye(t,e){const n=ve(e);return t.extensions[n]}function ge(t){return ye(de.getState(),t)}de.subscribe((t=>{const e={};for(let[n,r]of Object.entries(t.slots))if(r.moduleName){const t=Oe(n);e[n]={moduleName:r.moduleName,assignedExtensions:t}}he.setState({slots:e})}));const _e=de.action(((t,e)=>{t.extensions[e.name]={...e,instances:{}}}));function me(t,e){le((n=>{const r=n.slots[t];return r?{...n,slots:{...n.slots,[t]:{...r,attachedIds:[...r.attachedIds,e]}}}:{...n,slots:{...n.slots,[t]:{...be(t),attachedIds:[e]}}}}))}function je(t,e){le((n=>{const r=n.slots[t];return r&&r.attachedIds.includes(e)?{...n,slots:{...n.slots,[t]:{...r,attachedIds:r.attachedIds.filter((t=>t!==e))}}}:n}))}function xe(t){le((e=>{const n=e.slots[t];return n?{...e,slots:{...e.slots,[t]:{...n,attachedIds:[]}}}:e}))}function Se(t,e,n,r){const o=e.indexOf(t);if(-1!==o)return o;if(void 0!==n)return 1e3+n;{const e=r.indexOf(t);return-1!==e?2e3+e:-1}}function we(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=e??navigator.onLine;return t.filter((t=>ze(n,t.online,t.offline)))}function Oe(e){const n=de.getState(),r=function(t,e){const n=t.add||[],r=t.remove||[],o=t.order||[],{extensions:s}=de.getState();return[...e,...n].filter((t=>!r.includes(t))).sort(((t,n)=>{const r=Se(t,o,s[ve(t)].order,e),i=Se(n,o,s[ve(n)].order,e);return-1===i?-1:-1===r?1:r-i}))}((0,t.getExtensionSlotConfigStore)(e).getState().config,n.slots[e].attachedIds),o=[];for(let t of r){const e=ve(t),r=n.extensions[e];o.push({id:t,name:e,moduleName:r.moduleName,meta:r.meta,online:r.online,offline:r.offline})}return o}const Ee=de.action(((t,e,n)=>{const r=t.slots[n]?.moduleName;if(r&&r!=e)return console.warn(`An extension slot with the name '${n}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${r}.`),t;if(r&&r==e)return t;if(t.slots[n])return{...t,slots:{...t.slots,[n]:{...t.slots[n],moduleName:e}}};const o=be(n,e);return{...t,slots:{...t.slots,[n]:o}}})),Ae=he.action((()=>({slots:{},extensions:{}})));function Pe(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=navigator.onLine;return ze(n,t,e)}function ze(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Boolean(t?e:n)}function Ne(t,e){const n=navigator.onLine?t:e;return"object"==typeof n?n:{}}var Ie=i(645);function Te(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t=>t,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const i=ve(r),a=ge(r);let c=!0,u=null;if(t){if(!a)throw Error(`Couldn't find extension '${i}' to attach to '${e}'`);const{load:l,online:f,offline:p,meta:d,moduleName:h}=a;Pe(f,p)&&(l().then((i=>{let{default:a,...l}=i;c&&(u=(0,Ie.mountRootParcel)(o(a??l),{...Ne(f,p),...s,_meta:d,_extensionContext:{extensionId:r,extensionSlotName:e,extensionSlotModuleName:n,extensionModuleName:h},domElement:t}))})),le((o=>(0,ie.update)(o,["extensions",i,"instances",n,e],{domElement:t,id:r}))))}else console.warn(`Tried to render ${r} into ${e} but no DOM element was available.`);return()=>{c=!1,u&&("MOUNTED"!==u.getStatus()?u.mountPromise.then((()=>{u&&u.unmount()})):u.unmount())}}const $e=ce()})(),a})())}}}));
|
|
2
2
|
//# sourceMappingURL=openmrs-esm-extensions.js.map
|