// Promise.allSettled polyfill, until our supported browsers implement it
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled
if(Promise.allSettled===undefined){
Promise.allSettled=promises=>
Promise.all(
promises.map(promise=>
promise.then(
value=>({
status:'fulfilled',
value
}),
reason=>({
status:'rejected',
reason
})
)
)
);
}
require('./style.css');
functionloadScript(url){
returnnewPromise((resolve,reject)=>{
constnewScript=document.createElement('script');
newScript.onerror=reject;
newScript.onload=resolve;
newScript.async=true;
document.head.appendChild(newScript);
newScript.src=url;
});
}
asyncfunctionloadComponent(url,scope){
awaitloadScript(url);
// From MIT-licensed https://github.com/module-federation/module-federation-examples/blob/af043acd6be1718ee195b2511adf6011fba4233c/advanced-api/dynamic-remotes/app1/src/App.js#L6-L12
// eslint-disable-next-line no-undef
await__webpack_init_sharing__('default');
constcontainer=window._JUPYTERLAB[scope];
// Initialize the container, it may provide shared modules and may need ours